Reputation: 81
I am trying to solve a optimization problem with Pyomo. The problem is to minimize an objective function constrained over a pre-defined list.
lambda = [0, 1, 2]
x-> Independent Variable
y = f(x)
Constraints:
y[0] < lambda[0]
y[1] < lambda[1]
y[2] < lambda[2]
Obj = minimize (model.y)
So basically my optimization result will have three elements. While defining constraints for the same, how do i access the list? i.e. First element of model.y should be less than the first element of lambda. Any guidance is appreciated.
Upvotes: 0
Views: 41
Reputation: 108
How about like this? Set the lambda as a parameter of Set A:
data:
set A := L1 L2 L3 ;
param Lambda: x y z;
pyomo:
model.A=Set()
model.Lambda = Param(model.A)
model.Y=Var(model.A)
Upvotes: 1