How can I run a model multiple times changing the parameter value in pyomo?

Question:

I am working with a MIP model with multiple parameters and I’d like to test different scenarios (with different parameter values).

I’ve created a df with the parameter values that need to be changed and did a loop where the values are supposed to change but they are not.

for s in model.s:
model.Pmill == model.Smill[s].value
Asked By: rkimura

||

Answers:

You want to use = instead of ==.

One equals assigns a value, while two values compare.
What your code does is just comparing both values every iteration without using the result.

for s in model.s:
    model.Pmill = model.Smill[s].value
Answered By: einekratzekkatze
Categories: questions Tags: , ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.