Hi, I am fairly new to AMPL and am having an issue. I am trying to evaluate a set of 5 binary numbers in a constraint. I want to prevent two sets of ones in the same row coming up (i.e. 10101 is ok, but 11011, 11100 is a violation).
subject to c01 {b in 1..B}: match(sum{a in 1..A}t[a,b,1]&sum{a in 1..A}t[a,b,2]&sum{a in 1..A}t[a,b,3]&sum{a in 1..A}t[a,b,4]&sum{a in 1..A}t[a,b,5],'111|11011') = 0;
ampl: display {b in 1..B}: match(sum{a in 1..A}t[a,b,1]&sum{a in 1..A}t[a,b,2]&sum{a in 1..A}t[a,b,3]&sum{a in 1..A}t[a,b,4]&sum{a in 1..A}t[a,b,5],'111|11011');
match(sum{a in 1 .. A} t[a,1,1] & sum{a in 1 .. A} t[a,1,2] & sum{a in 1
.. A} t[a,1,3] & sum{a in 1 .. A} t[a,1,4] & sum{a in 1 .. A} t[a,1,5],
'111|11011') = 0
match(sum{a in 1 .. A} t[a,2,1] & sum{a in 1 .. A} t[a,2,2] & sum{a in 1
.. A} t[a,2,3] & sum{a in 1 .. A} t[a,2,4] & sum{a in 1 .. A} t[a,2,5],
'111|11011') = 2
match(sum{a in 1 .. A} t[a,3,1] & sum{a in 1 .. A} t[a,3,2] & sum{a in 1
.. A} t[a,3,3] & sum{a in 1 .. A} t[a,3,4] & sum{a in 1 .. A} t[a,3,5],
'111|11011') = 0
match(sum{a in 1 .. A} t[a,4,1] & sum{a in 1 .. A} t[a,4,2] & sum{a in 1
.. A} t[a,4,3] & sum{a in 1 .. A} t[a,4,4] & sum{a in 1 .. A} t[a,4,5],
'111|11011') = 3
match(sum{a in 1 .. A} t[a,5,1] & sum{a in 1 .. A} t[a,5,2] & sum{a in 1
.. A} t[a,5,3] & sum{a in 1 .. A} t[a,5,4] & sum{a in 1 .. A} t[a,5,5],
'111|11011') = 0
Based on my data, that is what I would expect to see. But the model seems not to evaluate the same. When I display the constraint, I see something different
ampl: display c01;
c01 [*] := 1 0 2 0 3 0 4 0 5 0;
c01[2] and c01[4] should violate this constraint, but somehow, they evaluate to 0. I have tried using both gurobi and cplex, and I have turned off presolve, but none of these things make a difference. What am I missing?
--
You received this message because you are subscribed to the Google Groups "AMPL Modeling Language" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ampl+uns...@googlegroups.com.
To post to this group, send email to am...@googlegroups.com.
Visit this group at http://groups.google.com/group/ampl.
For more options, visit https://groups.google.com/d/optout.