Decision Optimization

Decision Optimization

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


#Analytics
#DecisionOptimization
#DecisionOptimization
 View Only
  • 1.  Problem in cplex object created

    Posted 05/08/12 07:37 AM

    Originally posted by: Inspiredlallu


    Hello,

    I am trying to create a cplex object. Add the objective function. Then add the linear equations using the cplex.addGe() and cplex.addLe() methods. When I add the equations, the value of the ub is as assigned in the addLe or addGe methods but the value of the lower bound, is something like -1.7976931348623157E308 for all the equations.

    While when I use the cplec.addRange(lb, expr, ub) method, it gives me an "ilog.cplex.CpxException IloRange has incompatible bounds" exception with lb = 0.0 and ub equal to the value of the r.h.s of the equation.

    Now my problem is that when I create a cplex object and solve it, it does not give me the desired result. While, if I export and import the same object, I get the correct results.

    I do not know the exact problem but it may have to do something with the automatically assigned lower bound. I am a little clueless here.

    Can anyone please tell me what the problem could be.

    Any help will be appreciated.

    Thanks,
    Neha
    #CPLEXOptimizers
    #DecisionOptimization


  • 2.  Re: Problem in cplex object created

    Posted 05/08/12 09:03 AM

    Originally posted by: SystemAdmin


    I am not clear if I understood you problem correctly. Are you trying to add equality constraints using addGe() and addLe()? If so, why not just use addEq() which adds an equality constraint?
    What are the exact values for lb and ub when you get the "IloRange has incompatible bounds" exception? Is the lb always less than or equal to the ub? How many variables does your problem have? In the LP file there is only x, y, z and w but each of them appears many times in the objective function. This suggests that you have more than 4 variables but have assigned the same name to more than one variable.
    #CPLEXOptimizers
    #DecisionOptimization


  • 3.  Re: Problem in cplex object created

    Posted 05/08/12 11:01 AM

    Originally posted by: Inspiredlallu


    Hi,

    I want to add linear inequations only. Not linear equations. Hence, the use of addGe and addLe.

    As for the objective function, I want my objective function to have only x. I do not know why the rest of the variables get added. I use the following piece of code for the objective function

    IloNumVar[] vars = new IloNumVar[1];
    vars[0] = cplex.numVar(0,Double.MAX_VALUE, "x");
    cplex.addMinimize(cplex.scalProd(new double[] {1.}, vars), "Obj");

    I guess the problem would be there only, because sometimes the lb does get greater than ub when the upper bound takes some negative value and I try to assign the lb as 0.0. In that case the problem may occur, but again i want to remove the large lb value i.e. -1.7976931348623157E308 and am not sure how to do that. Because when I write the same object to the file, then the large value does not appear in the file and the solution also comes correct.

    The large lower bound maybe the cause of incorrect results, but am not sure whether it is or not. I want my cplex object to solve correctly without exporting/importing the object.

    Regards,
    Neha
    #CPLEXOptimizers
    #DecisionOptimization


  • 4.  Re: Problem in cplex object created

    Posted 05/08/12 05:41 PM

    Originally posted by: SystemAdmin


    > Inspiredlallu wrote:
    >
    > I am trying to create a cplex object. Add the objective function. Then add the linear equations using the cplex.addGe() and cplex.addLe() methods. When I add the equations, the value of the ub is as assigned in the addLe or addGe methods but the value of the lower bound, is something like -1.7976931348623157E308 for all the equations.

    This is essentially negative infinity. If it occurs as the lower bound in a <= constraint, that's perfectly fine -- it is the equivalent of having no lower bound. If it occurs as the lower bound of a >= constraint, that is a serious problem.
    >
    > While when I use the cplec.addRange(lb, expr, ub) method, it gives me an "ilog.cplex.CpxException IloRange has incompatible bounds" exception with lb = 0.0 and ub equal to the value of the r.h.s of the equation.

    Check your value of ub when this happens. If lb really is zero, then ub must be negative, which would make the problem infeasible.
    >
    > Now my problem is that when I create a cplex object and solve it, it does not give me the desired result. While, if I export and import the same object, I get the correct results.

    This usually suggests numerical instability, although the .lp file you attached produced a basis with a very mild condition number. If you save the problem in SAV rather than LP format, does the SAV file produce the correct answer?
    >

    Paul
    Mathematicians are like Frenchmen: whenever you say something to them, they translate it into their own language, and at once it is something entirely different. (Goethe)
    #CPLEXOptimizers
    #DecisionOptimization


  • 5.  Re: Problem in cplex object created

    Posted 05/09/12 01:44 AM

    Originally posted by: Inspiredlallu


    Hi,

    I am not sure how to save the file as .sav file. But if the only change while saving it as sav file is cplex.exportModel("disjoint.sav") instead of cplex.exportModel("disjoint.lp"), then the exporting & importing it as .sav file does not give me the correct output.

    Regards,
    Neha
    #CPLEXOptimizers
    #DecisionOptimization


  • 6.  Re: Problem in cplex object created

    Posted 05/09/12 01:51 AM

    Originally posted by: SystemAdmin


    That is the way to export a SAV file.
    Could you attache the SAV file here and also tell us what the expected/desired results are for this file?
    #CPLEXOptimizers
    #DecisionOptimization


  • 7.  Re: Problem in cplex object created

    Posted 05/09/12 01:55 AM

    Originally posted by: Inspiredlallu


    PFA the sav file.

    The desired output should be infeasible. But it is giving the solution as Optimal.

    Regards,
    Neha Bhatia
    #CPLEXOptimizers
    #DecisionOptimization


  • 8.  Re: Problem in cplex object created

    Posted 05/09/12 04:41 AM

    Originally posted by: Inspiredlallu


    Hi,

    My problem got solved. The issue was that cplex was taking all my variables even with same name as different.
    The following thread helped me

    https://www.ibm.com/developerworks/forums/thread.jspa?messageID=14687910&#14687910

    The issue got identified when even .sav was giving incorrect results.

    Thanks for all the help :)

    Regards,
    Neha
    #CPLEXOptimizers
    #DecisionOptimization