Open matheusdiogenesandrade opened 1 year ago
The problem when you remove these checks is when you remove constraints to update the bounds. It's the same reason why CPLEX.jl forbids having several bounds per variable (see the calls to _throw_if_existing_lower
in https://github.com/jump-dev/CPLEX.jl/blob/master/src/MOI/MOI_wrapper.jl, for instance).
Do you have the same problem when going through JuMP instead of attacking directly CPLEXCP.jl?
Sorry for the late response. Yes, I did, at least I think so:
using JuMP
using CPLEX
model = direct_model(CPLEX.Optimizer())
@variable(model, x, lower_bound = 0, upper_bound = 15, integer = true)
@variable(model, 0 <= y <= 3)
@objective(model, Min, 12x + 20y)
@constraint(model, c1, 6x + 8y >= 100)
@constraint(model, c2, 7x + 12y >= 120)
@constraint(model, c3, x >= 15)
print(model)
optimize!(model)
@show termination_status(model)
@show primal_status(model)
@show objective_value(model)
@show value(x)
@show value(y)
Let me know if this is the setup you are looking for?
I had in mind the most usual way to use JuMP, i.e. model = Model(CPLEXCP.Optimizer)
, so that it can play its magic of rewriting constraints (and not giving all the constraints to the solver as soon as they are added with @constraint
, if my memory is right).
model = Model(CPLEXCP.Optimizer)
Sorry, I think I got the wrong understanding, are we talking about running CPLEXCP or CPLEX via JuMP ?
Hello.
While working on the issue #11, I found other "bug". Conside the below code.
Which returns the below message.
I tried to comment the lines
_assert_no_lb(model, f, s)
and_assert_no_ub(model, f, s)
of the functionadd_constraint
, and no bug appeared.I understand the meaning of line
@assert _info(model, f).type == _type_to_variabletype(T)
, but I do not see the reason for the asserts on the bounds. Is there any special concern on this?Thanks and regards.