Exemplo n.º 1
0
def bilinear_problem():
    m = aml.ConcreteModel(name='test_relaxation')

    m.I = range(5)
    m.x = aml.Var(bounds=(-7, 7))
    m.y = aml.Var(bounds=(-3, 3))

    m.obj = aml.Objective(expr=m.x + m.y)
    m.cons = aml.Constraint(expr=m.x * m.y + m.y**2 >= 0)

    return dag_from_pyomo_model(m)
Exemplo n.º 2
0
def problem():
    m = aml.ConcreteModel(name='test_relaxation')

    m.I = range(5)
    m.x = aml.Var(m.I, domain=aml.NonNegativeIntegers)

    m.obj = aml.Objective(expr=m.x[0])
    m.cons0 = aml.Constraint(expr=sum(m.x[i] for i in m.I) >= 0)
    m.cons1 = aml.Constraint(
        expr=-2.0 * aml.sin(m.x[0]) + aml.cos(m.x[1]) >= 0)
    m.cons2 = aml.Constraint(expr=m.x[1] * m.x[2] >= 0)

    return dag_from_pyomo_model(m)
Exemplo n.º 3
0
def problem():
    model = aml.ConcreteModel()
    model.x = aml.Var(bounds=(2, 7))
    model.y = aml.Var(bounds=(-1, 1))
    model.obj = aml.Objective(expr=0.25 * model.x * aml.sin(model.x))
    return dag_from_pyomo_model(model)
Exemplo n.º 4
0
 def get_problem(self, rule):
     m = aml.ConcreteModel()
     m.x = aml.Var()
     m.y = aml.Var()
     m.obj = aml.Objective(expr=rule(m))
     return dag_from_pyomo_model(m)