Decision Optimization

Decision Optimization

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


#Analytics
#DecisionOptimization
#DecisionOptimization
 View Only
  • 1.  Two or more intervals dvar.

    Posted 01/04/12 05:58 AM

    Originally posted by: SystemAdmin


    Hi, I'm new at this language, I'd like to ask if is there any way to set a "dvar int" to take diferent numbers, or more than one interval.
    Something like that:
    dvar int A[i] in (1..6, 9..10) ;
    or
    dvar int A[i] in (1,2,3,4,6,7,9,15) ;
    Thanks and sorry for my english.
    #CPLEXOptimizers
    #DecisionOptimization


  • 2.  Re: Two or more intervals dvar.

    Posted 01/04/12 02:58 PM

    Originally posted by: SystemAdmin


    dvar declarations allow an optional field to specify a user-defined range in which the values of the decision variables should lie. However, per my tests, this range needs to be contiguous with a upper and lower bound and cannot be a union of discontinuous ranges. Hence if 'dvar int A[i] in (1..6, 9..10) ;' is what you are trying to achieve then, you could add the values that the decision variable cannot take as constraints in the model, to achieve your objective. This could look something like the following:
    range i=1..5;
    dvar int x[i] in 1..10;
    ....
    subject to{
        forall(index in i){
          x[index]!=7;
          x[index]!=8;
        }
    ....
    }
    

    #CPLEXOptimizers
    #DecisionOptimization


  • 3.  Re: Two or more intervals dvar.

    Posted 01/07/12 05:04 PM

    Originally posted by: SystemAdmin


    Another approach (slight modification to Abhishek's) is
    range i=1..5;
    dvar int x[i] in 1..10;
    ....
    subject to{
        forall(index in i){
          x[index] in {j | j in 1..6} union {j | j in 9..10};
        }
    


    Paul

    Mathematicians are like Frenchmen: whenever you say something to them, they translate it into their own language, and at once it is something entirely different. (Goethe)
    #CPLEXOptimizers
    #DecisionOptimization