Numerical Accuracy of the Solver

optimization
#1

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.

#2

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

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

You may be interested in Gurobi’s documentation on all things numerical: http://www.gurobi.com/documentation/8.1/refman/numerics_gurobi_guidelines.html

#3

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))

@variable(m,u[1:5,1:5],lower_bound=0)
@variable(m,x[1:5,1:5],Bin)

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))

XLSX.writetable("OUTPUT1.xlsx",
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?

#4

Because of the numerical accuracy of the solver.

See
https://www.ibm.com/support/knowledgecenter/en/SSSA5P_12.9.0/ilog.odms.cplex.help/CPLEX/Parameters/topics/EpInt.html

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

1 Like
#5

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))
#6

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

#7

Thanks that works perfectly fine. :slight_smile: