[gecode-users] move from a choco model to Gecode model
manel askri
askri.manel1 at gmail.com
Sun Sep 1 02:49:53 CEST 2013
hi everyone !
i'm trying to move from choco model to gecode model but i got some problems
while programing
so this is my choco code :
int [][] g;
//objective variable
IntegerVariable Z= choco.makeIntVar( "gain", 1, 1000000,
Options.V_OBJECTIVE)
IntegerVariable [][] X= new IntegerVariable[n][m];
for( int i=0;i<n;i++){
for (int j=0; j<m; j++) {
X[i][j]=choco.makeIntVar("X"+i+j,0,1);}}
//Objective function
IntegerExpressionVariable []exp1= new IntegerExpressionVariable [n];
for (int i =0; i<n;i++)Choco.sum(exp1), Z));
and here is my code in gecode :
IntArgs g;
BoolVarArray a;
a = BoolVarArray (*this, n*m, 0,1);
Matrix <BoolVarArray > X(a, m,n);
IntVar gain (*this, 1, 1000000);
g = IntArgs (n*m, 0,1000000);
//objective function
for(int i =0; i<n;i++)
{
IntArgs row=, g.slice(n*i,1,m);
linear (*this , row, X.row(i), IRT_EQ, gain);
}
but that doesn't work , idon't know where is the error and the compiler
doesn't tell me any thing so any idea about that and how can i fix it
Thank you very much , and i really did read the MPG and all the examples
that YOU gave about using matrix
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.gecode.org/pipermail/users/attachments/20130901/f2c0d1c9/attachment.html>
More information about the users
mailing list