Decision Optimization

Decision Optimization

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

 View Only
Expand all | Collapse all

Define range differently for a single constraint

Archive User

Archive UserTue May 10, 2016 09:12 AM

ALEX FLEISCHER

ALEX FLEISCHERTue May 10, 2016 03:17 PM

  • 1.  Define range differently for a single constraint

    Posted Tue May 10, 2016 09:12 AM

    Originally posted by: PetertheGiant


    Hey guys,

     

    I am currently trying to code a model in which I have a range t, going let's say from 0 to 50. 

    For one of the constraints though, I need to differ the range of my integer parameter t, so that it does not exceed the total time horizon.

    For specifically, I am trying to model a sum which ranges from (t+1 to t+2), but still the last t must not exceed 50, thus in this constraint not exceed 48 (as two are added in my sum).

     

    Does anybody know how to code this?

     

    Best regards

     

    Peter


    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 2.  Re: Define range differently for a single constraint

    Posted Tue May 10, 2016 03:17 PM

    Hi,

    range r=1..50;
     
     int v[i in r]=i;
     
     int result=sum(i in r:((i+2) <=50)) v[i];
     
     execute
     {
     writeln(result);
     }    

    regards


    #DecisionOptimization
    #OPLusingCPLEXOptimizer