Decision Optimization

Decision Optimization

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


#Analytics
#DecisionOptimization
#DecisionOptimization
 View Only
  • 1.  ILOGException when doind sensitivity analysis

    Posted 12/10/08 09:48 AM

    Originally posted by: SystemAdmin


    [niharika said:]

    HI
      I have resolved the memory issue by increasing my system RAM.
    my program runs and gives output for around 3365 decision variables but when i do sensitivity analysis using "getObjSA()", i get an IloException.
    besides when i checked IloCPlex class there were 3/4 definitions for the getObjSA with different number or ytpes of arguments. but my program accepts only one form of the function with 3 arguments (IloNumArray lower, IloNumArray upper, IloNumVarArray X)

    here is my ilog code
    // constraint (1)
    for ( j = 1; j < nbNodes; j++ ) {<br /> IloExpr c1(env);
    for ( i = 0; i < nbNodes; i++ )<br /> if(arc[i][j]!=0)
    c1 += arc[i][j]*X[i][j];
    //cout<<c1; <br /> model.add(c1 <= 1);<br /> c1.end();
    }

    cout<<"constraint 1......."<<endl;<br /> // constraint (2)
    for ( i = 0; i < nbNodes; i++ ) <br /> {
    IloExpr c2(env);
    for ( j = 0; j < nbNodes; j++ )<br /> if(arc[i][j]!=0)
    c2 += X[i][j];
    model.add(c2 >= N[i]);

    }
    cout<<"constraint 2......."<<endl;<br /> // constraint (3)
    IloExpr c3(env);
    for (i=0; i< nbNodes; i++)<br /> c3 += N[i];
    model.add(c3 == k);

    IloExpr objExpr(env);
    for(i=0;i<nbNodes; i++)<br /> objExpr += node_wt[i]*N[i];
    IloObjective obj = IloMaximize(env, objExpr);
    model.add(obj);
    objExpr.end();

    cout<<"model formed .. start solving.............."<<endl;<br />
    IloCplex cplex(env);
    cplex.extract(model);
    //cplex.exportModel("C:\\model1.lp");
    cplex.solve();

    cplex.getObjSA(lower,upper,N); cerr<<"here...cause of exception"<<endl;<br /> cout<<"problem solved .......prepare solution...."<<endl;<br /> IloSolution sol(env);
    sol.add(obj);
    sol.setValue(obj, cplex.getObjValue());
    for ( i = 0; i < nbNodes; i++ ) <br /> {
    sol.add(N[i]);
    sol.setValue(N[i],cplex.getValue(N[i]));
    }
    cplex.getObjSA(lower,upper,N); cerr<<"here...cause of exception"<<endl;
    #CPLEXOptimizers
    #DecisionOptimization


  • 2.  Re: ILOGException when doind sensitivity analysis

    Posted 12/11/08 11:30 PM

    Originally posted by: SystemAdmin


    [MaryFenelon said:]

    Which exception are you getting?  Note that getObjSA won't work on a discrete model or one with quadratic constraints or a quadratic objective.


    #CPLEXOptimizers
    #DecisionOptimization


  • 3.  Re: ILOGException when doind sensitivity analysis

    Posted 12/29/08 11:10 AM

    Originally posted by: SystemAdmin


    [niharika said:]

    HI
    Thank you for your reply.
    there is no error message as such. i have tried IloException e and e.getMessage() fn. but the program only displays my written message "cerr<<"sensitivity error".<br />yes my problem is basically an integer programming problem, do you advise me to change it into some other problem.
    i have tried searching in cplex user's manual, but there also just one line is written using callable library but not using concert technology as i am using c++.
    Kindly advise how to change the problem from MIP into some other form.
    also, so i need to change the problem tyype initially or only for doing the sensitivity analysis.

    #CPLEXOptimizers
    #DecisionOptimization


  • 4.  Re: ILOGException when doind sensitivity analysis

    Posted 12/31/08 05:09 AM

    Originally posted by: SystemAdmin


    [MaryFenelon said:]

    If I modify ilomipex2.cpp from the CPLEX distribution by adding these statements after the cplex.solve() line:

          IloNumArray upperobj(env);
          IloNumArray lowerobj(env);
          cplex.getObjSA(lowerobj, upperobj, var);

    and then run the resulting program on a problem with integer variables, I get:
      Concert exception caught: CPLEX Error  1217: No solution exists.

    This is expected since sensitivity analysis is not available for problems with integer variables (although it could be a more informative error message, like, "Not for MIPs").  Sensitivity analysis has a very particular meaning in the mathematical programming world and as implemented by CPLEX.  It uses dual solution information and such information does not exist for problems with integer variables.  Sensitivity analysis of this sort is also known as "ranging."

    What you need to do is turn your problem with integer variables into one with continuous variables by fixing the integer variable values to the values in the integer solution and letting the remaining continuous variables alone, then solve the resulting continuous problem. CPLEX does this with the solveFixed() method.  If you insert a cplex.solveFixed() before the cplex.getObjSA() line, then you will get the objective ranges for the continuous variables.
     

    #CPLEXOptimizers
    #DecisionOptimization