Decision Optimization

Decision Optimization

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


#Analytics
#DecisionOptimization
#DecisionOptimization
 View Only
  • 1.  Multiple Objective Exception

    Posted 07/12/14 08:26 PM

    Originally posted by: Nodame


    I am attempting to solve an optimization problem in two stages (for simplicity and visibility).

    First I solve a Problem:

    Min Objective1

    s.t. set of Constraints1

    From there, I want to extract part of the solution  and use it for my second Problem:

    Min Objective2

    s.t. set of Constraints2

     

    I thought I could just call cplex.Solve(), then extract the solution by using cplex.GetValue(), then again, set up a second Objective, and a second set of constraints, then call cplex.Solve() a second time... But apparently, it is not possible because I am getting the Error:

    "Exception of type 'ILOG.CPLEX.MultipleObjectiveException' was thrown."

     

    How can I handle this problem? Is there a way to make the solver  'forget' the previous Objective and/or the Previous constraints before I call cplex.Solve() for a second time?

     

    Note: I am calling cplex from C#.

     

     

     


    #CPLEXOptimizers
    #DecisionOptimization


  • 2.  Re: Multiple Objective Exception

    Posted 07/13/14 02:50 PM

    Originally posted by: Ibrahim_Capar


    This is how I would do it.

    I would have two void functions and some global variables to do the task. A brief pseudocode is below:

    Define Global_Input_Variables;
    Define Global_Intermediate_Variables;
    
    void Read_Data();
    void Define_dimension_of_intermediate_variables();
    void First_Optimization();
    void Second_Optimization();
    void Print_out_Results();
    
    
    int main(){
    
    Read_Data();  // Import all data.
    
    Define_dimension_of_intermediate_variables(); 
          //Define all intermediate variables depending on input variables
          //You may need to have two set of variables if you want to iterate models
          //You may need to overload imported data to intermedite variables if you need to iterate
    
    
    for (int counter=0; counter < Number_of_Iteration; counter++) //in case you need to iterate
    {
        First_Optimization();
        Second_Optimization();    
    }
        
    Print_out_Results();
    
    }
    
    void First_Optimization(){
        //Set the model
        //Minimize Objective 1
        //Solve the model
        //Export results to intermediate variables
        //IMPORTANT: End the model. That is end CPLEX enviroment.     
    }
    
    void Second_Optimization(){
        //Set the model using intermediate variables
        //Minimize Objective2
        //Solve the model
        //Export results to intermediate variables (if you want to iterate)
        //IMPORTANT: End the model. That is end CPLEX enviroment.     
        
    }
    
    

    Hope this helps


    #CPLEXOptimizers
    #DecisionOptimization


  • 3.  Re: Multiple Objective Exception

    Posted 07/13/14 04:14 PM

    Originally posted by: Nodame


    Thanks for your reply Ibrahim. I will definitely try that.

    Just a quick question. What is the command (or line of code) used to "End the model/end CPLEX environment  "?  is it

    cplex.End();   ?

    Is that what makes cplex 'Forget' the Previous Objective and the previous constraints?


    #CPLEXOptimizers
    #DecisionOptimization


  • 4.  Re: Multiple Objective Exception

    Posted 07/13/14 11:11 PM

    Originally posted by: Ibrahim_Capar


    You start environment by using; IloEnv env; and you can end it by env.end();

    For more info: http://pic.dhe.ibm.com/infocenter/cosinfoc/v12r6/topic/ilog.odms.cplex.help/CPLEX/GettingStarted/topics/tutorials/Cplusplus/envClass.html

     


    #CPLEXOptimizers
    #DecisionOptimization