Numerical Accuracy of the Solver

I am solving a MIP problem using CPLEX solver. I have the following constraint: x \geq x_{\min}y, where x is a non-negative variable and y is a binary variable. Let us consider x_{\min} = 20, but I am getting the optimal solution such as x =0.0001. Though the value is very small but is there any way to get around this issue? Or, I am doing something wrong here.

That constraint is satisfied if y=0? What are you trying to do?

Please read: Please read: make it easier to help you.

You may be interested in Gurobi’s documentation on all things numerical: Gurobi Guidelines for Numerical Issues

Yes, you pointed out correctly. I have one more constraint which I forgot to mention that is x \leq x_{\max}y.

An example:

using  JuMP, CPLEX, XLSX
import DataFrames

m = Model(with_optimizer(CPLEX.Optimizer))


c = rand(5,5)

@constraint(m,con1[i=1:5,j=1:5],u[i,j] <= 50*x[i,j])
@constraint(m,con2[i=1:5,j=1:5],u[i,j] >= 20*x[i,j])
@constraint(m,con3[j=1:5],sum(u[i,j] for i=1:5) == 80)

@objective(m,Min,sum((c[i,j]*u[i,j]+0.5*x[i,j]) for i=1:5,j=1:5))

status = optimize!(m)

df1 = DataFrames.DataFrame(JuMP.value.(x))
df2 = DataFrames.DataFrame(JuMP.value.(u))

Op      = (DataFrames.columns(df1), DataFrames.names(df1)),
Status  = (DataFrames.columns(df2), DataFrames.names(df2)))

Note that the issue is not occurring for this (small) case. My question is if I get a solution such as x[i,j] = 0.0001 for a particular (i,j), is it because of any bug in the code or is it because of the numerical precision of the solver? If it due to the numerical precision, then is there any way to increase the numerical precision?

Because of the numerical accuracy of the solver.


with_optimizer(CPLEX.Optimizer, CPLEX.CPX_PARAM_EPINT=1e-8)

1 Like

It is giving me the following error:

LoadError: syntax: invalid keyword argument name “CPLEX.CPX_PARAM_EPINT”

for the following line:

m = Model(with_optimizer(CPLEX.Optimizer, CPLEX.CPX_PARAM_EPINT=1e-8))

Oops. It might just be (CPLEX.Optimizer, CPX_PARAM_EPINT=1e-8). I don’t have CPLEX so I haven’t tried.

Thanks that works perfectly fine. :slight_smile: