Decision Optimization

Decision Optimization

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


#Analytics
#DecisionOptimization
#DecisionOptimization
 View Only
  • 1.  lingo constraint in OPL

    Posted 05/21/14 08:44 PM

    Originally posted by: viva0521


    Hi, there

    I am duplicating one of my lingo model to opl. Here I have one constraint in lingo as:

    @For(path(i,j,o,d) | j#EQ#1 #and# j#NE#o #and# j#NE#d #AND# i#NE#o #and# i#NE#d #and# i#GE#9  #and# i#LE#10:x(i,j,o,d)= 0);

    (i,j) here are the node index and supposed to be integer.This is to restrict the flow on specific arc is equal to 0. 

    So I tried following:

    forall ( i, j in node, j == 1, j != o, j != d, i != o, i != d,  i == 9, i == 10) flow [i] [j] [o] [d] ==0.

    It didn't work, any idea? Thanks in advance!


    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 2.  Re: lingo constraint in OPL

    Posted 05/22/14 04:19 AM

    Hi

    instead of

    forall ( i, j in node, j == 1, j != o, j != d, i != o, i != d,  i == 9, i == 10)

    can you try

    forall ( i, j in node : (j == 1) && ( j != o) &&  (j != d)  &&  (i != o) &&  (i != d) &&  (i == 9) && (i == 10))

    ?

    regards


    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 3.  Re: lingo constraint in OPL

    Posted 05/22/14 03:54 PM

    Originally posted by: viva0521


    Alex, thanks a lot! It works now. I really appreciate your valuable comments!

    By the way, when I was trying to output my optimal solution, I wrote:

    execute DISPLAY {
       writeln("\n<from node, to node, , o, d, flow[i][j][o][d]>\n");
       for(i,j in Node, o in Ori, d in Dest)
          if(flow[i][j][o][d] > 0)
             writeln("<",i,",",j,",",o,",",d,",",flow[i][j][o][d],">");
    }

    It is said for(i,j in Node, o in Ori, d in Dest) missing ")" after Node, I am wondering what is wrong here? Thanks again!


    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 4.  Re: lingo constraint in OPL

    Posted 05/23/14 02:21 AM

    Hi,

    because in the scripting part, the syntax for "for" is not the same as for "forall"

    Instead of

    for(i,j in Node, o in Ori, d in Dest)

    try

    for(i in Node) for (j in Node) for( o in Ori) for( d in Dest)

     

    regards


    #DecisionOptimization
    #OPLusingCPLEXOptimizer