Multiscenario with matrix variables/multiple constraints
回答済みHi !
Please, I would like to ask how to define a multi-scenario when we have Mvars. For example, I defined the constraints below:
for t in range(nT):
Flex_DNR1.addConstr(G0 @ pl_t[:,t] == PD0_pu[:,t] - PG0_pu[:,t] , name="Eq1_"+str(t))
where pl_t is MVar(14x24), and the others are parameters. I labeled these constraints using "name="Eq1_"+str(t)" . Then I would like to define a scenario using the Multiscenario tool, where I want to modify the right-hand side of these constraints:
Flex_DNR1.Params.ScenarioNumber = 1
Flex_DNR1.ScenNName = 'Base model - Increase Load'
for t in range(nT):
"Eq1_"+str(t).ScenRhs == c1*PD0_pu[:,t] - PG0_pu[:,t]
Unfortunately, I don't know how to call the constraints "Eq1_"+str(t).ScenRhs to set the new right-hand side to these multiple constraints, "Eq1_"+str(t) I know that this is not valid. Any help or comment is welcome!!
Thanks in advance!
Orlando Valarezo
-
正式なコメント
This post is more than three years old. Some information may not be up to date. For current information, please check the Gurobi Documentation or Knowledge Base. If you need more help, please create a new post in the community forum, or try Gurobot, our chatbot interface offering instant, expert-level support. -
Hi Orlando,
If you have only constraint names available, you can use the getConstrByName method to get a constraint with a given name
for t in range(nT):
constr = model.getConstrByName("Eq1_"+str(t))
# do something with constr "Eq1_"+str(t)Best regards,
Jaromił0
投稿コメントは受け付けていません。
コメント
2件のコメント