Decision Optimization

Decision Optimization

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

 View Only
  • 1.  Decision variables in logical constraints

    Posted Tue June 19, 2012 02:43 AM

    Originally posted by: D459_Parmanand_Sinha


    I am trying to use boolean decision variables in logical constraints:

    forall(u in Landu) forall(v in Landv)
    ct:
    (x[u][v][1]==1) => (xu-1[v][1]+xu+1[v][1]+x[u]v-1[1]+x[u]v+1[1]>=1);

    It shows error "Index out of bound for array "x": 0." and OPL cannot extract expression.
    How can I write these constraints properly?

    Thnaks
    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 2.  Re: Decision variables in logical constraints

    Posted Tue June 19, 2012 05:09 AM
    Hi,

    your issue is not about logical constraints but about indexing. You try to use cells that are not in the array.

    The following model works fine:

    {int} Landu={1,2};
    {int} Landv={1,2};
     
    {int} LanduB=Landu union {0,3};
    {int} LandvB=Landv union {0,3};
     
    dvar int x[LanduB][LandvB][1..1];
     
    subject to
    {
    forall(u in Landu) forall(v in Landv)
    ct:
    (x[u][v][1]==1) => 
    (x[u-1][v][1]+x[u+1][v][1]+x[u][v-1][1]+x[u][v+1][1]>=1);
    }
    


    regards
    #DecisionOptimization
    #OPLusingCPLEXOptimizer