Decision Optimization

Decision Optimization

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

 View Only
  • 1.  Question about sensitivity analysis with Cplex

    Posted Tue May 03, 2011 11:41 PM

    Originally posted by: Ulysses.Sheng


    Hello,

    Could anyone tell me how to use GetObjSa in the cplex concert technology for C++?
    suppose it is: min c1*x1+c2*x2
    s.t. Ax<=b
    I am wondering how to write the codes exactly to get the analysis for c1 and c2.

    Thank you all in advance!
    #CPLEXOptimizers
    #DecisionOptimization


  • 2.  Re: Question about sensitivity analysis with Cplex

    Posted Wed May 04, 2011 01:02 PM

    Originally posted by: EdKlotz


    Here's a code segment that reads in an MPS, LP or SAV file, extracts the
    model, solves the model, then performs objective sensitivity analysis
    using IloCplex::getObjSA. In the first two arguments, you pass in the arrays
    that will contain the lower and upper limits of the objective coefficients for
    which you want sensitivity analysis. The third argument is the array of
    IloNumVars for which you want objective sensitivity analysis.
    IloObjective obj;
    IloNumVarArray var(env);
    IloRangeArray rng(env);
    cplex.importModel(model, name, obj, var, rng);

    cplex.extract(model);
    if ( !cplex.solve() ) {
    env.error() << "Failed to optimize LP" << endl;
    throw(-1);
    }

    cplex.out() << "Solution status = " << cplex.getStatus() << endl;
    cplex.out() << "Solution method = " << cplex.getAlgorithm() << endl;

    IloNumArray objLB(env);
    IloNumArray objUB(env);
    cplex.getObjSA(objLB, objUB, var);
    #CPLEXOptimizers
    #DecisionOptimization


  • 3.  Re: Question about sensitivity analysis with Cplex

    Posted Fri May 06, 2011 10:36 AM

    Originally posted by: Ulysses.Sheng


    Hey, dear EdKlotz,

    I have another question to ask you.
    If I have a base case value for all the coefficients of objective function, and I want to know by varying within what limit, the optimal decision doesn't change. How should I change the codes?

    i mean if i know c1 and c2 and get an optimal decision in terms of x. Then i want to know within what range of change of c1 or c2, the optimal decision is the same.

    Thank you!

    Ulysses
    #CPLEXOptimizers
    #DecisionOptimization


  • 4.  Re: Question about sensitivity analysis with Cplex

    Posted Fri May 06, 2011 05:17 PM

    Originally posted by: EdKlotz


    > Ulysses.Sheng wrote:
    > Hey, dear EdKlotz,
    >
    > I have another question to ask you.
    > If I have a base case value for all the coefficients of objective function, and I want to know by varying within what limit, the optimal decision doesn't change. How should I change the codes?
    >
    > i mean if i know c1 and c2 and get an optimal decision in terms of x. Then i want to know within what range of change of c1 or c2, the optimal decision is the same.
    >
    > Thank you!
    >
    > Ulysses

    getObjsa gives you the range of change of individual elements of the objective.
    In other words, it tells you how much you can change a single element of the objective without losing optimality (i.e. dual feasibility). You can also view
    this as performing parametric analysis on the objective with a unit vector.
    In other words, the element in the unit vector with a 1.0 coefficient identifies
    the individual objective coefficients that for which you want to assess the
    maximum change without compromising optimality.

    So, are you now asking how to calculate the amount you can change multiple
    objectives at once (i.e. parametric analysis on the objective for an arbitrary
    vector rather than a unit vector)?
    #CPLEXOptimizers
    #DecisionOptimization


  • 5.  Re: Question about sensitivity analysis with Cplex

    Posted Fri May 06, 2011 11:15 PM

    Originally posted by: Ulysses.Sheng


    Hey, dear EdKlotz,

    My question is: suppose the problem
    min c1*x1+c2*x2
    s.t A*x<=b

    and in the base case c1=100

    but when I use:
    IloNumArray objLB(env);
    IloNumArray objUB(env);
    cplex.getObjSA(objLB, objUB, x);

    it gives me objLB[0]>100

    Because I thought it should be like lower bound<100 and upper bound>100?

    thanks!
    Ulysses
    #CPLEXOptimizers
    #DecisionOptimization


  • 6.  Re: Question about sensitivity analysis with Cplex

    Posted Sun May 08, 2011 01:10 AM

    Originally posted by: Ulysses.Sheng


    Hey, dear EdKlotz,
    sorry I made a silly mistake there.
    It gave the right answer actually.
    Thanks for you great help!!
    Ulysses
    #CPLEXOptimizers
    #DecisionOptimization


  • 7.  Re: Question about sensitivity analysis with Cplex

    Posted Thu May 05, 2011 11:05 PM

    Originally posted by: Ulysses.Sheng


    Hey dear EdKlotz, thanks:)
    it works!
    #CPLEXOptimizers
    #DecisionOptimization