[FlopCpp] Re: FlopCpp Digest, Vol 21, Issue 2

Martin Grados Marquina themartininf at gmail.com
Thu Nov 8 09:15:19 EST 2007


Thank for the answer, i figured it would be more
complicatedi (insert the elements to the set "ac"), but it was easy

MP_subset<2> ab(A,B), bc(B,C), ac(A,C);
  ab.insert(12,780); ab.insert(30,780); ab.insert(41,782); . . .
  bc.insert(780,170); bc.insert(780,140); bc.insert(782,154); . . .
forall( ab(a,b)*bc(b,c), ac.insert(a,c));
MP_binary_variable Xac(ac);

if i want to add other binary variable on the set C, then i would do
  MP_binary_variable Yc(C);
or i would do
  MP_subset<1> cc(C);
  forall(ac(a,c), cc.insert(c));
  MP_binary_variable Yc(cc);

my question is because i want to declare after the objective function that
minimize the variable binary "Yc", ie i will think to do

  minimize( sum( cc(xc), Yc(xc)) );  is this correct?

and, if i want to add the constraint P ("MP_constraint P(A)"), such that
  P(a) = sum( C(c), Xac(ac(a,c)) ) == 1;
or i would do
  MP_subset<1> cc(C);
  forall(ac(a,c), cc.insert(c));
  forall(ac(a,c), aa.insert(a));
  MP_constraint P(aa);
  P(aa(a)) = sum( cc(c), Xac(ac(a,c)) ) == 1;

I am a bit confused when working with subsets. Thanks
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://list.coin-or.org/pipermail/flopcpp/attachments/20071108/0676d468/attachment.html


More information about the FlopCpp mailing list