[gecode-users] move from a choco model to Gecode model
Guido Tack
tack at gecode.org
Wed Sep 4 07:29:54 CEST 2013
Your Java code doesn't seem to have a lot to do with the C++ code, e.g. where do you use X, and what does the last line mean? If you want us to help you, you'll need to provide code samples that we can understand. The gecode code doesn't look much better, e.g. what is IntArgs(n*m,0,1000000) supposed to mean? That will allocate an array of size n*m and initialise the first two elements, but the rest will be uninitialised (probably random).
Cheers,
Guido
On 01/09/2013, at 10:49 AM, manel askri <askri.manel1 at gmail.com> wrote:
> 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
>
> _______________________________________________
> Gecode users mailing list
> users at gecode.org
> https://www.gecode.org/mailman/listinfo/gecode-users
More information about the users
mailing list