Пример #1
0
def test_partial_0b_2r_branch_weight():
    domain = Domain.make([], ["x", "y"], real_bounds=(0, 1))
    x, y = domain.get_symbols(domain.variables)
    support = (x >= 0.1) & (x <= 0.9) & (y >= 0.3) & (y <= 0.7)
    weight = Ite(x <= y, x, y * 3.17)

    engine = FactorizedXsddEngine(domain, support, weight)
    computed_volume = engine.compute_volume()

    should_be = PyXaddEngine(domain, support, weight).compute_volume()
    # print(computed_volume, should_be)
    assert computed_volume == pytest.approx(should_be, rel=ERROR)
Пример #2
0
def test_trivial_weight_function_partial_0b_1r_disjoint():
    domain = Domain.make([], ["x"], real_bounds=(0, 1))
    (x, ) = domain.get_symbols(domain.variables)
    support = (x >= 0.1) & (x <= 0.9) & ~((x >= 0.3) & (x <= 0.7))
    weight = Real(2.0)

    engine = FactorizedXsddEngine(domain, support, weight)
    computed_volume = engine.compute_volume()

    should_be = PyXaddEngine(domain, support, weight).compute_volume()
    # print(computed_volume, should_be)
    assert computed_volume == pytest.approx(should_be, rel=ERROR)
Пример #3
0
def test_fxsdd_examples(e):
    inspect_density(lambda d, s, w: FactorizedXsddEngine(d, s, w), e)
Пример #4
0
def test_fxsdd_manual():
    inspect_manual(lambda d, s, w: FactorizedXsddEngine(d, s, w), REL_ERROR)