[gecode-users] help ----puzzles of defining Variable

Kayler Yao risoay at gmail.com
Sun Aug 2 15:11:13 CEST 2009


hi,

There have two questions which have puzzled me for a short long time. They
are as follows:

1. the difference bettween IntVarArray and IntVarArgs ,and how to use them
   As explained in the manual of Gecode,  IntVarArgs is Argument array
which is just good enough for passing arguments with automatic memory
management. IntVarArray is Variable array which can store variables and be
used for storing the variables being part of a solution (script).
 From these description,i can see that IntVarArgs can be used when i need
automatic memory management.But When i need automatic memory management, i
don't know. If you give me an simple example, i maybe can understand it.

2. how to post the constraint ----multiplication of two variable?
   For instance ,
             IntVarArry  x;
              x(*this,4,1,6);
          I want to have a constraint " x[0] * x[1] = x[2] ".when i write "
post(*this, x[0] * x[1]   ==  x[2],o pt.icl( ) );" in my test program,
errors come out.  I began to doubt that whether you can use the sign of " *
".  After testing " post(*this, 2 * x[1]   ==  x[2],o pt.icl( )  );", i have
know that i can use " * ". So, I doubt that we can't multiply two variable
with the sign " * ". Who can tell me how to add this constraint ?

Thanks your help.

Kayler
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.ps.uni-sb.de/pipermail/users/attachments/20090802/0a1c2f88/attachment.htm>


More information about the gecode-users mailing list