Circular references in modelling or Variable bounds for constraints

153 views
Skip to first unread message

Prateek Gupta

unread,
Jul 8, 2016, 9:07:48 AM7/8/16
to Pyomo Forum
HI Guys,

I am new to Pyomo and trying to find my way creating a complex model that has circular dependencies. 

To explain it better - (The model is for manufacturing plant which uses return items of last process as input for other process)

ProcessA has an element X which is used to define total value of this process.
ProcessB - uses total value of ProcessA and generates bounds for element X. 

When I am creating this using different methods I face different problem - 
1> When using expressions to create constraints - Creating expressions is not possible and the expression it depends on hasn't been constructed yet.  - Order of defining expressions is a problem as both depends on each other.
2> When using Var for first Var and then using two sided constraint on it - error creating constraints: found a double-sided inequality expression (lower <= expression <= upper) but the lower bound was non-constant.

I am sure I haven't explained the problem in best possible way, but any insight would be great.

Thanks.

Gabriel Hackebeil

unread,
Jul 8, 2016, 2:23:34 PM7/8/16
to pyomo...@googlegroups.com
Can you try expressing your model as a small example using a ConcreteModel. This way you don’t have to worry about things not being constructed. E.g.,

model.x = Var()
model.y = Var([1,2,3])

model.o = Objective(expr=model.x + model.y[1])
model.c = Constraint(expr=model.x >= summation(model.y))

When using Var for first Var and then using two sided constraint on it - error creating constraints

When Pyomo encounters a double-sided inequality constraint, it must transform it into a body expression with lower and upper bounds that are simple numeric constants. If you write an equality constraint such as

x <= y <= z

where x, y, and z are variables, then Pyomo cannot do this. You must split the constraint into two separate constraints:

x <= y

and

y <= z

Gabe

--
You received this message because you are subscribed to the Google Groups "Pyomo Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pyomo-forum...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Prateek Gupta

unread,
Jul 11, 2016, 8:04:49 PM7/11/16
to Pyomo Forum
Hi Gabriel,

Thanks, that's good to know. 
Although my problem was pretty simple and I guess I was just exhausted to make it work. 

Constraint I was trying to build was something like this

g(x) - a <= f(x) <- g(x) + a  

All I had to do was 

-a <= f(x) - g(x) <= a 

Cheers!
Prateek. 
Reply all
Reply to author
Forward
0 new messages