dynamic modeling
回答済みHi,
I need to add a constraint to my model that would be changed after each branching. To clarify it better, I should mention that I have binary variables, named y and x. The relation between them is:
model.addConstrs(y[k,i,d]<=x[k,i] for k in K for d in D for i in I)
I need to calculate a set:
I[k,d]={i| if x[k,i]=1 or (x[kk,i]=0 for kk in K} for k in K for d in D
and based on this set add constraints to the model.
These sets are changed when x[k,i] is fixed in the branch and bound tree by branching. So I need to update the constraints when a change happens in the I set.
I don't know if there is any possibility to implement this in gurobi. I was wondering if you could help me in this regard. I should mention that I am coding in python.
Thanks
-
正式なコメント
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 why not try our AI Gurobot?. -
Hi Amir,
This is not possible, because you cannot extract the information whether x[k,i] is fixed in the branch and bound tree by branching.
Maybe you can use indicator constraints to model the behavior you want. An indicator constraints activates a particular constraints when an associated binary variable is 1, i.e.,
\[z=1 \rightarrow a^Tx \leq b\]
where \(z\) is binary. Maybe with that you could simulate the branching+constraint addition process up to some extent.
Best regards,
Jaromił0
投稿コメントは受け付けていません。
コメント
2件のコメント