Decision Optimization

Decision Optimization

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

 View Only
Expand all | Collapse all

conditional expression

  • 1.  conditional expression

    Posted Sun September 28, 2014 03:42 PM

    Originally posted by: stathis_d


    Hello  guys,

    I am wondering if there is a way to write a nested conditional expression on opl. I am trying to formulate the following: 

      forall (t in Period:t<g) , forall (v in Vehicles), forall (j in Destinations), forall  (<v,g , capacity> in available  :(v in Vehicles), (g in  Period))

     if  x[j][v][t] =1 then c[v][g]=0 except if capacity>0 then c[v][g]=capacity 

    x[j][v][t]  is a binary variable, c[v][g] is variable capacity  and capacity is given.  I am trying to avoid to use  the capacity of a truck in the next period if it has already been used one period before except if  it seems available in the data for a future period.  

    Regards


    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 2.  Re: conditional expression

    Posted Thu October 02, 2014 04:12 AM

    Hi

    have you tried logical constraints like

    (x[j][v][t]==1) == (c[v][g]==capacity);

    ?

    regards


    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 3.  Re: conditional expression

    Posted Thu October 02, 2014 04:40 AM

    Originally posted by: stathis_d


    Hi Alex, 

    thanks for your answer. I'm just wondering what the equality means between the parenthesis, i knew only that  the sign of greater than on equal (=>) between two parenthesis is the expression  if ... then 


    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 4.  Re: conditional expression

    Posted Thu October 02, 2014 05:00 AM

    Hi

    This == means is equivalent to

    regards


    #DecisionOptimization
    #OPLusingCPLEXOptimizer