Decision Optimization

Decision Optimization

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

 View Only
Expand all | Collapse all

multi-objective

  • 1.  multi-objective

    Posted Thu November 09, 2017 07:13 AM

    Originally posted by: xspeng


    There are three goals in my model,I want to solve  the first goal, and use the values of these decision variables to get the value of the other two target functions at this time,But I don't know how todo that.


    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 2.  Re: multi-objective



  • 3.  Re: multi-objective

    Posted Thu November 09, 2017 08:34 AM

    Originally posted by: xspeng


    I've already used staticLex  function and set a time limit, But no solution can be obtained in time limit, I have reattached my.model and .data


    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 4.  Re: multi-objective

    Posted Thu November 09, 2017 08:51 AM

    Hi,

    CPLEX would work better than CPO for this so I would rather use CPLEX

    but then indeed you do not have staticLex but

    minimize //staticLex(
     TOTAL_COST
     //, ENVIM,-SCIM)
     ;

    so from there you could use the flow control scripting (choice 2)  I suggested at

    https://www.ibm.com/developerworks/community/forums/html/topic?id=193ecefc-757c-4c66-9905-7ac0dd81dc8f&ps=25

    regards

     

     


    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 5.  Re: multi-objective

    Posted Mon November 13, 2017 03:16 AM

    Originally posted by: xspeng


    i have used the flow control scripting (choice 2)  you suggested at
    https://www.ibm.com/developerworks/community/forums/html/topic?id=193ecefc-757c-4c66-9905-7ac0dd81dc8f&ps=25

    but it can't work, because your objectives are var ,my objectives are expr, I have no idea how to deal with this problem, please help me.


    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 6.  Re: multi-objective

    Posted Mon November 13, 2017 03:47 AM

    Hi,

    what you could do is add decision variables that would be equal to the decision expressions:


     int n=10;
    int m=25;

    range position = 1..n;
        dvar boolean x[position][position];
        dexpr int obj1=max(i,j in position) i*x[i][j];
        dexpr  int obj2=max(i,j in position) j*x[i][j];
        
        dvar int vobj1;
        dvar int vobj2;

        minimize (vobj1-1)*n+vobj2;

        subject to
        {
          sum(i,j in position) x[i][j]==m;
          vobj1==obj1;
          vobj2==obj2;
         
          //obj1==max(i,j in position) i*x[i][j];
          //obj2==max(i,j in position) j*x[i][j];
        }

        execute
        {
        writeln("objectives : ",obj1," ",obj2);

        writeln("-----------------------------");
        writeln();

        for(var i in position)
        {
         for(j in position) write((x[i][j]==1)?"+":" ");
         writeln();
        }
        }

         main
         {
           thisOplModel.generate();
           cplex.setObjCoef(thisOplModel.vobj2,0);
           cplex.solve();
           thisOplModel.postProcess();
           var obj1=thisOplModel.obj1.solutionValue;
           thisOplModel.vobj1.LB=obj1;
           thisOplModel.vobj1.UB=obj1;
           cplex.setObjCoef(thisOplModel.vobj2,1);
           cplex.solve();
           thisOplModel.postProcess();
            
         }

    regards


    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 7.  Re: multi-objective

    Posted Mon November 13, 2017 06:44 AM

    Originally posted by: xspeng


     There are three goals in my model,i use flow control to solve with the first objective:TOTAL_COST, then the second objective: ENVIM  while freezing the first one, and finally the third : SCIM  while freezing the first one and second one. But the results were incorrect, I don't know am i coding  right or wrong, would you examine these for me, please?

     

    My control flow code as follow:

     

    main
     {
       thisOplModel.generate();
       cplex.setObjCoef(thisOplModel.vSCIM,0);
       cplex.solve();
       thisOplModel.postProcess();
       var ENVIM=thisOplModel.ENVIM.solutionValue;
       thisOplModel.vENVIM.LB=ENVIM;
       thisOplModel.vENVIM.UB=ENVIM;
       cplex.setObjCoef(thisOplModel.vSCIM,1);
       cplex.solve();
       thisOplModel.postProcess();
       cplex.setObjCoef(thisOplModel.vENVIM,0);
       cplex.solve();
       thisOplModel.postProcess();
       var TOTAL_COST=thisOplModel.TOTAL_COST.solutionValue;
       thisOplModel.vTOTAL_COST.LB=TOTAL_COST;
       thisOplModel.vTOTAL_COST.UB=TOTAL_COST;
       cplex.setObjCoef(thisOplModel.vENVIM,1);
       cplex.solve();
       thisOplModel.postProcess(); 
     }


    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 8.  Re: multi-objective

    Posted Mon November 13, 2017 12:54 PM

    Hi,

    since your objective is

    minimize TOTAL_COST + ENVIM - SCIM;

    in the main

    cplex.setObjCoef(thisOplModel.vSCIM,1);

    should be

    cplex.setObjCoef(thisOplModel.vSCIM,-1);

    regards

     


    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 9.  Re: multi-objective

    Posted Wed November 22, 2017 02:58 AM

    Originally posted by: xspeng


    I have changed it as you suggest.But the representative optimal result  of TOTAL_COST  is different from the individual optimization  result  of TOTAL_COST,I don't know am i coding  right or wrong, would you examine these for me, please?

    My control flow code as follow:

     

    main
     {
       thisOplModel.generate();
       cplex.setObjCoef(thisOplModel.vSCIM,0);
       cplex.solve();
       thisOplModel.postProcess();
       var ENVIM=thisOplModel.ENVIM.solutionValue;
       thisOplModel.vENVIM.LB=ENVIM;
       thisOplModel.vENVIM.UB=ENVIM;
       cplex.setObjCoef(thisOplModel.vSCIM,-1);
       cplex.solve();
       thisOplModel.postProcess();
       thisOplModel.generate();
       cplex.setObjCoef(thisOplModel.vENVIM,0);
       cplex.solve();
       thisOplModel.postProcess();
       var TOTAL_COST=thisOplModel.TOTAL_COST.solutionValue;
       thisOplModel.vTOTAL_COST.LB=TOTAL_COST;
       thisOplModel.vTOTAL_COST.UB=TOTAL_COST;
       cplex.setObjCoef(thisOplModel.vENVIM,1);
       cplex.solve();
       thisOplModel.postProcess(); 
     }


    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 10.  Re: multi-objective

    Posted Thu November 23, 2017 02:44 AM

    Hi,

    I see

     thisOplModel.generate();
       cplex.setObjCoef(thisOplModel.vSCIM,0);
       cplex.solve();

    but since you have 3 KPIs, you should also set a second coef to 0

    regards


    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 11.  Re: multi-objective

    Posted Thu November 23, 2017 03:17 AM

    Originally posted by: xspeng


    I don't know how to set a second coef to 0,I hope that you can help me, Thank You.


    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 12.  Re: multi-objective

    Posted Thu November 23, 2017 03:55 AM

    Hi

    you could turn

     thisOplModel.generate();
       cplex.setObjCoef(thisOplModel.vSCIM,0);
       cplex.solve();

    into

     thisOplModel.generate();
       cplex.setObjCoef(thisOplModel.vSCIM,0);

       cplex.setObjCoef(thisOplModel.vENVIM,0);
       cplex.solve();

    regards


    #DecisionOptimization
    #OPLusingCPLEXOptimizer