Decision Optimization

Decision Optimization

Delivers prescriptive analytics capabilities and decision intelligence to improve decision-making.


#Analytics
#DecisionOptimization
#DecisionOptimization
 View Only
Expand all | Collapse all

a simple question about CP

  • 1.  a simple question about CP

    Posted 01/28/18 06:46 AM

    Originally posted by: imanopl


    Hello everybody, I have a probably very simple question, I have a 2 dim array  ybefore[i][i] and it is an integer variable. I have another variable y[j], how can I write sum(i in 1..Indice1,j in 1..indice2)ybefore[i][[j]=y[j] in constraint programming in OPL. I am trying  the following:

    forall( i in 1..n ){
    sum(j in 1..m) ybefore[ x[i] ][j]<= y[j];}  But it seems not working. 

    P.S: x and y are variable.


    #DecisionOptimization
    #OPLusingCPOptimizer


  • 2.  Re: a simple question about CP

    Posted 01/28/18 09:26 AM

    Hi

    using CP;

    int n=2;
    int m=3;

    dvar int x[1..n] in 1..n;
    dvar int y[1..m];
    dvar int ybefore[1..n][1..m];

    subject to
    {

    forall( i in 1..n ){
    forall(j in 1..m) ybefore[ x[i] ][j]<= y[j];
    }

    }

    works fine

    Same for

    using CP;

    int n=2;
    int m=3;

    dvar int x[1..n] in 1..n;
    dvar int y[1..m];
    dvar int ybefore[1..n][1..m];

    subject to
    {

    forall( i in 1..n ){
    sum(j in 1..m) ybefore[ x[i] ][j]<= 10;
    }

    }

    but with what you wrote j in y[j] is not defined

    regards


    #DecisionOptimization
    #OPLusingCPOptimizer