Is there a better constraint modeling method under Logic programming? #1434
-
Dear sir!
|
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
As explained in the logic programming pages, this is not a recommended way to model that disjunction, as it could be that neither of the conditions are triggered due to numerical tolerances in the solver. The way to do it robustly is to explicitly list the disjoint cases and trigger with binary variables caseq/case2 You're not going to get it faster though, generically, as you have a large combinatorial problem |
Beta Was this translation helpful? Give feedback.
-
I have now resolved PART of my problem by restructuring the problem model to avoid using “implies” in PART of constraints,this greatly reduces the number of constraints. |
Beta Was this translation helpful? Give feedback.
As explained in the logic programming pages, this is not a recommended way to model that disjunction, as it could be that neither of the conditions are triggered due to numerical tolerances in the solver.
The way to do it robustly is to explicitly list the disjoint cases and trigger with binary variables caseq/case2
F=[F,implies(case1(i), [x_a(i,1)<=x_d(j,5),x_a(i,2)<=x_d(j,5)]) + implies(case2(i),[x_a(i,1)>=x_d(j,5)]) +[case1(i)+case2(i) == 1]
You're not going to get it faster though, generically, as you have a large combinatorial problem