Decision Optimization

Decision Optimization

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


#Analytics
#DecisionOptimization
#DecisionOptimization
 View Only
  • 1.  Constraint not being enforced

    Posted 12/09/17 01:56 PM

    Originally posted by: OR_Nicole


    Hi, I am relatively new to using CPLEX with Java API.  I am writing a larger multi-objective program but am having a fundamental problem.  I am defining my x variables as float type values between 0 and 1, however, the optimization results give me values such as 1.0000005883164844.  How do I prevent this from happening?  I defined my x variables as follows:

    IloNumVar[] x = new IloNumVar[n];
    for(int i = 0; i < n; i++){
    x[i]= LPmodelF2_UB.numVar(0.0,1.0);
    }
    I also used x[i]= LPmodelF2_UB.numVar(0.0,0.99999999999999999999999999) but the problem persists.

     

    Thanks for any help!


    #CPLEXOptimizers
    #DecisionOptimization


  • 2.  Re: Constraint not being enforced

    Posted 12/09/17 04:29 PM

    This is not actually a problem. Due to the fact that floating point arithmetic is inexact, CPLEX tolerates small violations of constraints (including bounds) and small violations of integrality (by integer variables). The default constraint tolerance is 1e-6, and your value of 1.000000588... exceeds the upper bound by less than that.

    I would suggest just rounding that value to 1.0. If you really want to reduce bound violations, you can change the value of the parameter IloCplex.Param.Simplex.Tolerances.Feasibility to something smaller than 1e-6 (by invoking the setParam() method on your IloCplex object. If you set it too small, though, CPLEX might possibly declare your problem infeasible when it is actually feasible.

     


    #CPLEXOptimizers
    #DecisionOptimization


  • 3.  Re: Constraint not being enforced

    Posted 12/09/17 05:37 PM

    Originally posted by: OR_Nicole


    Thank you, Professor Rubin.  Indeed, I adjusted the feasibility tolerances and it helped reduce the bound violations. By the way, your blog is a great resource! 


    #CPLEXOptimizers
    #DecisionOptimization


  • 4.  Re: Constraint not being enforced

    Posted 12/09/17 06:04 PM

    You're welcome, and thank you (in that order).


    #CPLEXOptimizers
    #DecisionOptimization