<!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>&nbsp;</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>&nbsp;</DIV>
<DIV>The constraint is:</DIV>
<DIV>...</DIV>
<DIV>MP_constraint<BR>&nbsp;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>&nbsp;</DIV>
<DIV>This is the only constraint!! x is a binary variable. x is restricted by 
this constraint&nbsp; 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>&nbsp;</DIV>
<DIV>For example,</DIV>
<DIV>&nbsp;</DIV>
<DIV>DG(0,0).insert;</DIV>
<DIV>&nbsp;</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>&nbsp;</DIV>
<DIV>If&nbsp;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>&nbsp;</DIV>
<DIV>If I change that constraint to an equivalent constraint, everything runs 
fine!</DIV>
<DIV>&nbsp;</DIV>
<DIV>The alternate constraint is:</DIV>
<DIV>&nbsp;</DIV>
<DIV>...&nbsp;&nbsp;&nbsp;&nbsp;</DIV>
<DIV>MP_constraint AP_AlleEinplan(d);</DIV>
<DIV>&nbsp;</DIV>
<DIV>AP_AlleEinplan(d) = sum(r,sum(t, sum(g.such_that(DG(d,g)), 
x(r,t,d,g))))==1;</DIV>
<DIV>&nbsp;</DIV>
<DIV>The subset DG is now respected!</DIV>
<DIV>&nbsp;</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>&nbsp;</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>&nbsp;</DIV>
<DIV>Thanks for your help,</DIV>
<DIV>&nbsp;</DIV>
<DIV>Greetings from cologne,</DIV>
<DIV>&nbsp;</DIV>
<DIV>Christian</DIV>
<DIV>&nbsp;</DIV>
<DIV>#include &lt;OsiCbcSolverInterface.hpp&gt;<BR>#include 
&lt;flopc.hpp&gt;<BR>using namespace flopc;</DIV>
<DIV>&nbsp;</DIV>
<DIV>main() {<BR>MP_model m1(new OsiCbcSolverInterface);</DIV>
<DIV>&nbsp;</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>&nbsp;</DIV>
<DIV>MP_subset&lt;2&gt; DC(d,c); <BR>MP_subset&lt;2&gt; DG(d,g);</DIV>
<DIV>&nbsp;</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>&nbsp;</DIV>
<DIV>forall(d, DC.insert(d,0));</DIV>
<DIV>&nbsp;</DIV>
<DIV>MP_data pt(g), pr(g), pi(r,t,d,g);</DIV>
<DIV>&nbsp;</DIV>
<DIV>pr(0)=0;<BR>pr(1)=1;<BR>pr(2)=3;<BR>pr(3)=2;<BR>pr(4)=2;</DIV>
<DIV>&nbsp;</DIV>
<DIV>pt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
<DIV>MP_constraint AP_AlleEinplan(d,g);</DIV>
<DIV>&nbsp;</DIV>
<DIV>AP_AlleEinplan(d,g).such_that(DG(d,g)) = sum(r,sum(t,x(r,t,DG)))==1;</DIV>
<DIV>&nbsp;</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>&nbsp;</DIV>
<DIV>m1.minimize(F);</DIV>
<DIV>&nbsp;</DIV>
<DIV>for (int rr=0; rr&lt;r.size(); rr++)<BR>{&nbsp;for (int tt=0; 
tt&lt;t.size(); tt++)<BR>&nbsp;{&nbsp;for (int dd=0; dd&lt;d.size(); 
dd++)<BR>&nbsp;&nbsp;{&nbsp;for (int gg=0; gg&lt;g.size(); 
gg++)<BR>&nbsp;&nbsp;&nbsp;{&nbsp;if (x.level(rr,tt,dd,gg) 
==1)<BR>&nbsp;&nbsp;&nbsp;&nbsp;{&nbsp;cout&lt;&lt;rr&lt;&lt;" 
"&lt;&lt;tt&lt;&lt;" "&lt;&lt;dd&lt;&lt;" "&lt;&lt;gg&lt;&lt;" 
"&lt;&lt;pi(rr,tt,dd,gg)&lt;&lt;endl;&nbsp;}&nbsp;&nbsp;&nbsp;<BR>&nbsp;&nbsp;&nbsp;}<BR>&nbsp;&nbsp;}<BR>&nbsp;}<BR>}</DIV>
<DIV>&nbsp;</DIV>
<DIV>}</DIV></FONT></FONT></BODY></HTML>