Decision Optimization

Decision Optimization

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


#Analytics
#DecisionOptimization
#DecisionOptimization
 View Only
Expand all | Collapse all

Multiple runs cplex concert application with changes in the objective function

  • 1.  Multiple runs cplex concert application with changes in the objective function

    Posted 08/19/09 08:53 PM

    Originally posted by: SystemAdmin


    [irisabril said:]

    Hi!

    I'm programing a code in C++ with cplex concert tecnology in order to solve the following problem.

    Having the parameter [b]D[/b], where 0<=[b]D[/b]<=1<br />
    Lets say the objective function for a mathematical model is:

    Max: [b]D[/b] (2[i]x1[/i]+3[i]x3[/i] + .....) + (1-[b]D[/b]) ([i]X2[/i]-5[i]X3[/i] + .....)

    And the model has to be solved for several values of [b]D[/b], considering everything else in the model (constraints, other values in the objective function, etc) stays exactly the same (except the [b]D[/b] value).

    For this purpose, the program considers a Loop in which the value of [b]D[/b] gradually decrease or increase in a certain fixed value[i] y[/i].


    Which is the better way to change the value of [b]D[/b] in the objective function of the model?

    I know one option is to solve the model for one value of [b]D[/b], lets say [b]D[/b]=0.5, erase the objective function and add a new one for the next value of [b]D[/b], but I was wondering if there is an efficient way to fulfill this matter.


    #CPLEXOptimizers
    #DecisionOptimization


  • 2.  Re: Multiple runs cplex concert application with changes in the objective function

    Posted 08/20/09 09:48 PM

    Originally posted by: SystemAdmin


    [TheEngineer said:]

    I do not know about a possible performance loss but you could also model D as a CPLEX variable and set it fixed at your desired value y via a constraint.
    During your loop you can change this single constraint but it is not necessary to change the objective function.
    #CPLEXOptimizers
    #DecisionOptimization


  • 3.  Re: Multiple runs cplex concert application with changes in the objective function

    Posted 08/21/09 12:55 AM

    Originally posted by: SystemAdmin


    [prubin said:]

    Using the Java API (C++ is similar) and omitting try/catch blocks:

    IloCplex cpx;
    IloNumVar firstTerm;  // stuff multiplied by D
    IloNumVar secondTerm;  // stuff multiplied by (1-D)
    // build model -- add constraints defining firstTerm and secondTerm using other variables.
    IloObjective objExpr;
    // create the expression for the objective: D*firstTerm + (1-D)*secondTerm
    IloObjective obj = cpx.minimize(objExpr);  // or maximize
    cpx.solve();
    // do something with solution and change D
    cpx.setLinearCoef(obj, firstTerm, D);
    cpx.setLinearCoef(obj, secondTerm, 1-D);
    // iterate ad nauseum
    #CPLEXOptimizers
    #DecisionOptimization