Decision Optimization

Decision Optimization

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


#Analytics
#DecisionOptimization
#DecisionOptimization
 View Only
  • 1.  Multiple objectives in OPL/CPLEX

    Posted 03/24/11 06:56 PM

    Originally posted by: DinuN


    Hi,

    Does anyone know how to implement multiple objectives in OPL/CPLEX with-out using weights? I have 2 objectives, primary and a secondary. I get multiple solutions for the primary objective and out of these multiple solutions I want the solution which optimizes the secondary objective.

    Thank you.
    Dinakar
    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 2.  Re: Multiple objectives in OPL/CPLEX

    Posted 03/31/11 06:24 PM

    Originally posted by: SystemAdmin


    Here is an example that I believe accomplishes what you are looking for:
    int a = ...; //initialized to 1
    int b = ...; //initialized to 0
     
    int obj1Val = ...; //initialized to -1
     
    dvar int+ x;
    dvar int+ y;
     
    dexpr int obj1 = x + y;
    dexpr int obj2 = -y;
     
    minimize a*obj1 + b*obj2;
     
    subject to {
      
      x + y >= 5;
      
      if(obj1Val >= 0) obj1 == obj1Val;
    } 
     
    main {
      
      thisOplModel.generate();
      cplex.solve();
      var obj1_val = cplex.getObjValue();
      writeln("Obj1: ", obj1_val, " x: ", thisOplModel.x, " y: ", thisOplModel.y);
      cplex.clearModel();
      
      var opl1 = new IloOplModel(thisOplModel.modelDefinition, cplex);
      var data1 = thisOplModel.dataElements;
      data1.a = 0;
      data1.b = 1;
      data1.obj1Val = obj1_val;
      
      opl1.addDataSource(data1);
      opl1.generate();
      
      cplex.solve();
      writeln("Obj2: ", cplex.getObjValue(), " x: ", opl1.x, " y: ", opl1.y);
      
    }
    


    Regards,
    Faisal
    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 3.  Re: Multiple objectives in OPL/CPLEX

    Posted 04/07/11 10:56 AM

    Originally posted by: DinuN


    Hi Faisal,

    Thanks a lot. I tried it on some simple cases and it worked. But I'm a little new to OPL, so I have a few questions regarding the code:

    1. I have never used the main method in OPL before, so based on the code I'm guessing when you say thisOplModel.generate() , you are referring to the model defined before the main method.

    2. In this part of the code, I guess you are using the same model definition as the previous one. But how does it make sure that it searches only in the pool of alternate solutions from the first model/solution?
    var opl1 = new IloOplModel(thisOplModel.modelDefinition, cplex);
      var data1 = thisOplModel.dataElements;
      data1.a = 0;
      data1.b = 1;
      data1.obj1Val = obj1_val;
      
      opl1.addDataSource(data1);
      opl1.generate();
    


    Thank you again for your time,
    Dinakar
    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 4.  Re: Multiple objectives in OPL/CPLEX

    Posted 04/14/11 12:15 AM

    Originally posted by: SystemAdmin


    (1) Correct, it's the model before main script

    (2) the constraint:
    if(obj1Val >= 0) obj1 == obj1Val;
    


    would make sure that optimal value of obj1 is satisfied (you could use a tolerance here in real cases) during the second solve, which I understood is what you want. When optimizing on obj2 you are basically selecting from alternate solutions for obj1 because of the above constraint.

    This is goal programming approach that is typically used as a replacement to weighted objectives. You might want to also check the following CPLEX tech note:
    http://www-01.ibm.com/support/docview.wss?uid=swg21399935

    Regards,
    Faisal
    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 5.  Re: Multiple objectives in OPL/CPLEX

    Posted 04/18/11 09:46 AM

    Originally posted by: DinuN


    Thanks a lot Faisal. There is no document at the link, looks like it has been removed. I'll try to look for it.
    #DecisionOptimization
    #OPLusingCPLEXOptimizer