Exemplo n.º 1
0
def test_dumping_solver(capsys):
    """Test dumping the solver internal to stdout.

    """
    v1 = Variable('foo')
    v2 = Variable('bar')
    s = Solver()

    s.addEditVariable(v2, 'weak')
    s.addConstraint(v1 + v2 == 0)
    s.addConstraint((v2 <= -1))
    s.addConstraint((v2 >= 0) | 'weak')
    s.updateVariables()
    try:
        s.addConstraint((v2 >= 1))
    except Exception:
        pass

    # Print the solver state
    s.dump()

    state = s.dumps()
    for header in ('Objective', 'Tableau', 'Infeasible', 'Variables',
                   'Edit Variables', 'Constraints'):
        assert header in state
Exemplo n.º 2
0
def test_dumping_solver(capsys):
    """Test dumping the solver internal to stdout.

    """
    v1 = Variable('foo')
    v2 = Variable('bar')
    s = Solver()

    s.addEditVariable(v2, 'weak')
    s.addConstraint(v1 + v2 == 0)
    s.addConstraint((v2 <= -1))
    s.addConstraint((v2 >= 0) | 'weak')
    s.updateVariables()
    try:
        s.addConstraint((v2 >= 1))
    except Exception:
        pass

    # Print the solver state
    s.dump()

    state = s.dumps()
    for header in ('Objective', 'Tableau', 'Infeasible', 'Variables',
                   'Edit Variables', 'Constraints'):
        assert header in state
Exemplo n.º 3
0
def test_dumping_solver(capsys):
    """Test dumping the solver internal to stdout.

    """
    v1 = Variable('foo')
    v2 = Variable('bar')
    s = Solver()

    s.addConstraint(v1 + v2 == 0)
    s.addConstraint(v1 == 10)
    s.addConstraint((v2 >= 0) | 'weak')
    s.updateVariables()

    s.dump()