Decision Optimization

Decision Optimization

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


#Analytics
#DecisionOptimization
#DecisionOptimization
 View Only
  • 1.  Different solutions to obtain same objective

    Posted 08/27/17 10:15 AM

    Originally posted by: Sandeep.chauhan


    I have a model

    max A + B

    constraint A + B <= 10

    0<= A<= 10

    0<= B<= 10

     

    when I solved this model I am getting objective = 100 with A = [ 0 0 0 0 0 0 0 0 0 0]; B = [ 10 10 10 10 10 10 10 10 10 10];

    How can i access all possible combination of decision variables to get same 100 objective value.

    Like 100 can be obtain with

    A = [ 10 0 0 0 0 0 0 0 0 0]; B = [ 0 10 10 10 10 10 10 10 10 10];

    100 can also be obtain with

    A = [ 10 10 0 0 0 0 0 0 0 0]; B = [ 0 0 10 10 10 10 10 10 10 10];

    How can i get all such solutions(decision variables) to obtain same fitness value.

    Pool solution won't help in this case.

    Please help!

     

     


    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 2.  Re: Different solutions to obtain same objective



  • 3.  Re: Different solutions to obtain same objective

    Posted 08/28/17 02:51 AM

    Originally posted by: Sandeep.chauhan


    Thanks for your precious reply. But I want all solutions which can give  same objective value value. I know my global solution as 1000 so I am not interested in the solution which gives below 1000. I want to get all other solutions which can give same 1000.


    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 4.  Re: Different solutions to obtain same objective

    Posted 08/28/17 02:56 AM

    Hi,

    then in the example

    dvar int xy; // in order to find all solutions

    dvar int x in 0..2;
    dvar int y in 0..2;
        
    maximize xy;

    subject to
    {
      x+y<=3;
        
      xy==1000*x+y;
    }

    execute
    {
     writeln("x=",x,"   and y=",y);
    }

    main {
     var nbsol=0;

     thisOplModel.generate();
     while (1==cplex.solve())
     {
         thisOplModel.postProcess();
         nbsol++;
         thisOplModel.xy.UB=thisOplModel.xy.solutionValue-1;              
     }
            writeln("nb solutions = ",nbsol);
    }

    you could change

    x+y<=3;

    into

    x+y==3;

    regards

     


    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 5.  Re: Different solutions to obtain same objective

    Posted 08/28/17 03:02 AM

    Originally posted by: Sandeep.chauhan


    dvar int xy; // in order to find all solutions
                range I = 1..10;
                dvar int+ x[I];
                dvar int+ y[I];
                    
                maximize xy;

                subject to
                {
                  forall (i in I){
                  x[i] + y[i] == 10;
                }              
                    
                  xy==sum(i in I)(x[i]+y[i]);
                }

                execute
                {
                 writeln("x=",x,"   and y=",y);
                }

                main {
                 var nbsol=0;

                 thisOplModel.generate();
                 while (1==cplex.solve())
                 {
                     thisOplModel.postProcess();
                     nbsol++;
                     thisOplModel.xy.UB=thisOplModel.xy.solutionValue-1;              
                 }
                        writeln("nb solutions = ",nbsol);
                }

     

    I am getting only

    x= [10 10 10 10 10 10 10 10 10 10]   and y= [0 0 0 0 0 0 0 0 0 0]
    nb solutions = 1

     

    But I am expecting other results also like

    x= [0 10 10 10 10 10 10 10 10 10]   and y= [10 0 0 0 0 0 0 0 0 0]

    x= [0  0 10 10 10 10 10 10 10 10]   and y= [10 10 0 0 0 0 0 0 0 0]

    Please help!


    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 6.  Re: Different solutions to obtain same objective

    Posted 08/28/17 06:53 AM

    Hi,

    you have to change the xy formula so that you do not get the same solution.

    For instance,

    range I = 1..2;
                dvar int+ x[I];
                dvar int+ y[I];
                dvar float xy;
                    
                maximize xy;

                subject to
                {
                  forall (i in I){
                  x[i] + y[i] == 10;
                }              
                    
                  xy==sum(i in I)(x[i]*pow(11,i));
                }

                execute
                {
                 writeln("x=",x,"   and y=",y);
                }

                main {
                 var nbsol=0;

                 thisOplModel.generate();
                 while (1==cplex.solve())
                 {
                     thisOplModel.postProcess();
                     nbsol++;
                     thisOplModel.xy.UB=thisOplModel.xy.solutionValue-1;              
                 }
                        writeln("nb solutions = ",nbsol);
                }

    will give a result that ends with

    x= [8 0]   and y= [2 10]
    x= [7 0]   and y= [3 10]
    x= [6 0]   and y= [4 10]
    x= [5 0]   and y= [5 10]
    x= [4 0]   and y= [6 10]
    x= [3 0]   and y= [7 10]
    x= [2 0]   and y= [8 10]
    x= [1 0]   and y= [9 10]
    x= [0 0]   and y= [10 10]
    nb solutions = 121

    which looks normal since you have 11 options for x[1] AND x[2] so 121 options

    regards

     

     


    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 7.  Re: Different solutions to obtain same objective

    Posted 08/29/17 01:14 AM

    Originally posted by: Sandeep.chauhan


    What If I have a equation

    XY = sum( i  in 1..1000)( (A[i]*B[i]) - B[i]);


    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 8.  Re: Different solutions to obtain same objective

    Posted 08/29/17 02:50 AM

    Hi,

    i gave an example for xy and you can change that.

    The only need is that all different solutions should lead to a different xy

    regards


    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 9.  Re: Different solutions to obtain same objective

    Posted 08/29/17 02:59 AM

    Originally posted by: Sandeep.chauhan


    what is happening with

    thisOplModel.xy.UB=thisOplModel.xy.solutionValue-1; 


    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 10.  Re: Different solutions to obtain same objective

    Posted 08/29/17 03:09 AM

    the goal is to get all solutions and all solution lead to different xy values

    so in this line you simply say that you do not want an xy you already got

    regards


    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 11.  Re: Different solutions to obtain same objective

    Posted 08/29/17 03:17 AM

    Originally posted by: Sandeep.chauhan


    Is there any maximum limit to obtain the solutions? Like right now I am obtaining 121 solutions but there may be other solutions lie between this 121 solutions. So how can I search them?


    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 12.  Re: Different solutions to obtain same objective

    Posted 08/29/17 06:06 AM

    Originally posted by: Sandeep.chauhan


    But now my solutions are more dependent on objective functions like

    with xy==sum(i in I)(x[i]*pow(11,i)); I am getting 121 solutions but

    with xy==sum(i in I)(x[i]*1000); I am getting different number of solutions.

    But this objective function is like a dummy function for me because actual function is to maximize xy with  x[i] + y[i] == 10; 

     


    #DecisionOptimization
    #OPLusingCPLEXOptimizer