Implementing case specific constraints with hard less and greater operators
回答済みHi,
I need to implement case specific constraints \(C_1,C_2,C_3\) and wonder about some details.
\[ \begin{align}1: (w_i > w_j) \land (y_\text{i,j} \lor y_\text{j,i}) \rightarrow C_1 \\ 2: (w_i = w_j) \land (y_\text{i,j} \lor y_\text{j,i}) \rightarrow C_2 \\ 3: (w_i < w_j) \land (y_\text{i,j} \lor y_\text{j,i}) \rightarrow C_3 \\ w_i,w_j \in \mathbb{N}, y_\text{i,j} \in \{0,1\} \end{align}\]
For this problem, I assume to implement bigM-Constrains like Article: How do I model conditional statements in Gurobi? mentioned. So I have to use \(\epsilon\) to implement kind of strict greate/less as operations. However, article: Why doesn't Gurobi support strict inequality constraints like x < a? says that there is no difference between \(\le\) and \(<\) because of the hardware for floting point numbers. Does is valid for integers as well?
Seconds, what would be the best way to implement such constraints? Using indicator constraints or should I model a mixed equation for the case and \(C\)?
-
正式なコメント
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 Michael,
Since \(w_i\) is a natural number, the constraints \(w_i > w_j\) and \(w_i < w_j\) can be represented as \(w_i - w_j \geq 1\) and \(w_i - w_j \leq -1\), respectively.
Seconds, what would be the best way to implement such constraints? Using indicator constraints or should I model a mixed equation for the case and C?
I am not sure what a mixed equation for the case and C means. You can use indicator constraints to represent the part involving \(w\) variables in all three constraints and use Gurobi general constraints helper functions and_() and or_() to model conjunction and disjunction operators.
Best regards,
Maliheh
0
投稿コメントは受け付けていません。
コメント
2件のコメント