Decision Optimization

Decision Optimization

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


#Analytics
#DecisionOptimization
#DecisionOptimization
 View Only
  • 1.  execute variables in solution file

    Posted 04/27/11 08:10 PM

    Originally posted by: iturkmen


    Hi,

    I have binary decision variables which have 4 indices. I also use tuple in my variables. My decision variables looks like Xa,b,c,d .
    Let say 100 binary variables and there are only variables which are equal to 1 after run the model. How can I get the indices of the decision variables which are equal to 1?

    my variables looks like this in the solution file:
    X=http://1100000000000001000111...
    X<1,2,3,5>=1

    How can I get "1,2,3,5"?

    Thanks.
    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 2.  Re: execute variables in solution file

    Posted 04/28/11 01:40 AM

    Originally posted by: SystemAdmin


    here is an example:
    tuple T { int a; int b; int c; int d; };
     {T} setOfT = {<a,b,c,d> | a in 1..5, b in 1..5, c in 1..5, d in 1..5};
     
     dvar boolean x[setOfT];
     
     subject to {
       x[<1,2,3,5>] == 1;
       x[<2,3,4,5>] == 1;
     }    
     
     {T} oneIndices = {t | t in setOfT : x[t] == 1};
     
     execute {
       writeln(oneIndices);
     }
    


    Regards,
    Faisal
    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 3.  Re: execute variables in solution file

    Posted 04/28/11 11:12 PM

    Originally posted by: iturkmen


    Hi,
    Thank you so much. It works :) I am sorry for the missing words and brackets.
    #DecisionOptimization
    #OPLusingCPLEXOptimizer