<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=US-ASCII">
<META content="MSHTML 6.00.2800.1528" name=GENERATOR></HEAD>
<BODY id=role_body style="FONT-SIZE: 10pt; COLOR: #000000; FONT-FAMILY: Arial"
bottomMargin=7 leftMargin=7 topMargin=7 rightMargin=7><FONT id=role_document
face=Arial color=#000000 size=2><FONT id=role_document face=Arial color=#000000
size=2>
<DIV>Dear all, </DIV>
<DIV> </DIV>
<DIV>somehow, this constraint doesn't work, because "x", a binary variable, is
assigned where it shouldn't!!! To my mind, the ".such_that"-Statement is
damaged.</DIV>
<DIV> </DIV>
<DIV>The constraint is:</DIV>
<DIV>...</DIV>
<DIV>MP_constraint<BR> AP_AlleEinplan(d,g);</DIV>
<DIV>...</DIV>
<DIV>AP_AlleEinplan(d,g).such_that(DG(d,g)) = sum(r,sum(t,
x(r,t,d,g)))==1;</DIV>
<DIV>...</DIV>
<DIV> </DIV>
<DIV>This is the only constraint!! x is a binary variable. x is restricted by
this constraint to the set (r*t*d*g.such_that(DG)). How can it happen,
that x is assigned to one outside this set?</DIV>
<DIV> </DIV>
<DIV>For example,</DIV>
<DIV> </DIV>
<DIV>DG(0,0).insert;</DIV>
<DIV> </DIV>
<DIV>DG(0,1), DG(0,2), DG(0,3), DG(0,4) are NOT inserted! They are not part of
the subset DG!!</DIV>
<DIV> </DIV>
<DIV>If I solve the model, I get the answer, that for example x(0,0,0,1) is
assigned, that means, that DG(0,1) is inserted !? </DIV>
<DIV> </DIV>
<DIV>If I change that constraint to an equivalent constraint, everything runs
fine!</DIV>
<DIV> </DIV>
<DIV>The alternate constraint is:</DIV>
<DIV> </DIV>
<DIV>... </DIV>
<DIV>MP_constraint AP_AlleEinplan(d);</DIV>
<DIV> </DIV>
<DIV>AP_AlleEinplan(d) = sum(r,sum(t, sum(g.such_that(DG(d,g)),
x(r,t,d,g))))==1;</DIV>
<DIV> </DIV>
<DIV>The subset DG is now respected!</DIV>
<DIV> </DIV>
<DIV>Is it maybe, that, as for example ".such_that(DG(dg)*DC(d,c))" doesn't
work, "such_that(DG(d,g)" is also affected?</DIV>
<DIV> </DIV>
<DIV>I put the really small programm at the end of this message. I manipulated
the code in that way, that the correct assignment are marked with a "1", the
wrong assignments with a "4000".</DIV>
<DIV> </DIV>
<DIV>Thanks for your help,</DIV>
<DIV> </DIV>
<DIV>Greetings from cologne,</DIV>
<DIV> </DIV>
<DIV>Christian</DIV>
<DIV> </DIV>
<DIV>#include <OsiCbcSolverInterface.hpp><BR>#include
<flopc.hpp><BR>using namespace flopc;</DIV>
<DIV> </DIV>
<DIV>main() {<BR>MP_model m1(new OsiCbcSolverInterface);</DIV>
<DIV> </DIV>
<DIV>MP_set t(6);<BR>MP_set r(5);<BR>MP_set d(5);<BR>MP_set c(1);<BR>MP_set
g(5);</DIV>
<DIV> </DIV>
<DIV>MP_subset<2> DC(d,c); <BR>MP_subset<2> DG(d,g);</DIV>
<DIV> </DIV>
<DIV>DG.insert(0,0);<BR>DG.insert(1,1);<BR>DG.insert(2,2);<BR>DG.insert(3,3);<BR>DG.insert(4,4);</DIV>
<DIV> </DIV>
<DIV>forall(d, DC.insert(d,0));</DIV>
<DIV> </DIV>
<DIV>MP_data pt(g), pr(g), pi(r,t,d,g);</DIV>
<DIV> </DIV>
<DIV>pr(0)=0;<BR>pr(1)=1;<BR>pr(2)=3;<BR>pr(3)=2;<BR>pr(4)=2;</DIV>
<DIV> </DIV>
<DIV>pt(0)=0;<BR>pt(1)=1;<BR>pt(2)=2;<BR>pt(3)=3;<BR>pt(4)=4;</DIV>
<DIV> </DIV>
<DIV>for (int rr=0; rr<r.size(); rr++)<BR>{ for (int tt=0;
tt<t.size(); tt++)<BR> { for (int dd=0; dd<d.size();
dd++)<BR> { for (int gg=0; gg<g.size();
gg++)<BR> { if
(DG(dd,gg)>-2)<BR> { if(tt==pt(gg))<BR> { pi(rr,tt,dd,gg)=1; }<BR> else
<BR> { pi(rr,tt,dd,gg)=5; }<BR> if
(rr <=
pr(gg))<BR> { pi(rr,tt,dd,gg)=pi(rr,tt,dd,gg)+5*(pr(gg)-rr); }<BR> else<BR> { pi(rr,tt,dd,gg)=pi(rr,tt,dd,gg)+100*(rr-pr(gg)); }}<BR> else<BR> { pi(rr,tt,dd,gg)=4000; } <BR> }<BR> }<BR> }<BR>}</DIV>
<DIV> </DIV>
<DIV>MP_binary_variable x(r,t,d,g);</DIV>
<DIV> </DIV>
<DIV>MP_expression F;</DIV>
<DIV> </DIV>
<DIV>MP_constraint AP_AlleEinplan(d,g);</DIV>
<DIV> </DIV>
<DIV>AP_AlleEinplan(d,g).such_that(DG(d,g)) = sum(r,sum(t,x(r,t,DG)))==1;</DIV>
<DIV> </DIV>
<DIV>F=(sum(r,sum(t,sum(c,sum(d.such_that(DC(d,c)),sum(g.such_that(DG(d,g)),
pi(r,t,d,g)*x(r,t,d,g)))))));</DIV>
<DIV> </DIV>
<DIV>m1.minimize(F);</DIV>
<DIV> </DIV>
<DIV>for (int rr=0; rr<r.size(); rr++)<BR>{ for (int tt=0;
tt<t.size(); tt++)<BR> { for (int dd=0; dd<d.size();
dd++)<BR> { for (int gg=0; gg<g.size();
gg++)<BR> { if (x.level(rr,tt,dd,gg)
==1)<BR> { cout<<rr<<"
"<<tt<<" "<<dd<<" "<<gg<<"
"<<pi(rr,tt,dd,gg)<<endl; } <BR> }<BR> }<BR> }<BR>}</DIV>
<DIV> </DIV>
<DIV>}</DIV></FONT></FONT></BODY></HTML>