Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Parameter UpperCutoff not working #412

Closed
ZacharieALES opened this issue Oct 24, 2022 · 2 comments
Closed

Parameter UpperCutoff not working #412

ZacharieALES opened this issue Oct 24, 2022 · 2 comments

Comments

@ZacharieALES
Copy link

The parameter CPXPARAM_MIP_Tolerances_UpperCutoff should enable to cut any node of the branch and bound which is above a given value.

I try to use it on a toy knapsack example but it does not seem to work. I set the cutoff value to 18 but a solution of value 19 is returned:

using JuMP
using CPLEX

m = Model(CPLEX.Optimizer)
B = 12
p = [9, 8, 10, 9, 6]
w = [4, 2, 8, 8, 7]

pbSize = 5
@variable(m, x[1:pbSize], Bin) # x[i] = 1 iff object i is in the knapsack
@objective(m, Max, sum(x[i] * p[i] for i in 1:pbSize)) # the price of the objects in the knapsack is maximised
@constraint(m, sum(x[i] * w[i] for i in 1:pbSize) <= B) # the capacity of the knapsack is satisfied

set_optimizer_attribute(m, "CPXPARAM_MIP_Tolerances_UpperCutoff", 18)

optimize!(m)

@show JuMP.objective_value(m) # Displays 19 (which should not be allowed as 18 is set as a maximum)

Is it normal? Did I miss something?

I just want to add that I am aware that the use of this parameter alone can be replaced by the addition of a constraint (e.g., expression of the objective <= 18). However, I want to use this parameter to stop the optimization once a solution under 18 is found (as presented here). I also know that it could be done through a lazycallback but the use of callbacks slow the resolution and I would like to avoid that.

Cplex version: 12.10
Cplex.jl version: 0.9.3

@ZacharieALES
Copy link
Author

My bad, in a maximization it is the parameter LowerCutoff that should be used and it would not prevent a solution of value 19 to be obtained but a solution of value <18...

@odow
Copy link
Member

odow commented Oct 24, 2022

In a maximization it is the parameter LowerCutoff that should be used and it would not prevent a solution of value 19 to be obtained but a solution of value <18

Correct. See the documentation here: https://www.ibm.com/docs/ro/cofz/12.10.0?topic=parameters-lower-cutoff

Closing because this is not a bug in CPLEX.jl.

@odow odow closed this as completed Oct 24, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants