How to model constraint to send only when facility is open?
回答済みHi,
How can I implement a constraint so that resources from facility is sent to customer only when that facility is open?
select is a binary variable to send resource r from station s. deploy is a continuous variable (not fractional from 0 to 1). I want to send resources only when s is open. From literature & gurobi example, I formulated the following. But, now the value of deploy is always less than 1. deploy should be equal to demands in customer points, e.g. 45.
model2.addConstrs((deploy[s, o, r] <= select[s, r]
for o in OilSpills for s in Stations for r in ResourcesD),
name='open_facility')
-
正式なコメント
This post is more than two 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 Tanmoy,
If select[s, r] is a binary variable, then it can be no larger than 1. Consequently a constraint
deploy[s, o, r] <= select[s, r]
would mean that deploy[s, o, r] could also not be larger than 1 as you have discovered. If you were to instead use the constraint
deploy[s, o, r] <= M*select[s, r]
For some constant value M, then it would allow deploy[s, o, r] to have a value up to M whenever select[s, r]. I will leave it to you to decide what your M values should be, but my advice is not to make them any larger than they need to be.
- Riley
0
投稿コメントは受け付けていません。
コメント
2件のコメント