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

Warning when changing both of bounds #175

Closed
thiagonovaesb opened this issue Aug 26, 2022 · 4 comments
Closed

Warning when changing both of bounds #175

thiagonovaesb opened this issue Aug 26, 2022 · 4 comments

Comments

@thiagonovaesb
Copy link

function MOI.set(
    model::Optimizer,
    ::MOI.ConstraintSet,
    c::MOI.ConstraintIndex{MOI.VariableIndex, S}, s::S
) where {S<:SCALAR_SETS}
    MOI.throw_if_not_valid(model, c)
    lower, upper = _bounds(s)
    info = _info(model, c)
    if lower !== nothing
        _set_variable_lower_bound(model, info, lower)
    end
    if upper !== nothing
        _set_variable_upper_bound(model, info, upper)
    end
    info.previous_lower_bound = _get_variable_lower_bound(model, info)
    info.previous_upper_bound = _get_variable_upper_bound(model, info)
    return
end

Once this function call _set_variable_lower_bound before _set_variable_upper_bound, it can produce a warning about Inconsistent bounds

@odow
Copy link
Member

odow commented Aug 27, 2022

So you have a reproducible example of the problem?

@thiagonovaesb
Copy link
Author

thiagonovaesb commented Aug 27, 2022

@odow here is an example, this input:

using MathOptInterface
using Xpress
# use your xpress license
model = Xpress.Optimizer()
x = MOI.add_variable(model)
c = MOI.add_constraint(model, x, MOI.EqualTo(2.0))
MOI.set(model, MOI.ConstraintSet(), c, MOI.EqualTo(3.0))

Shows this warning:
?475 Warning: Inconsistent bounds [3,2] for column C1 in call to XPRSchgbounds

@joaquimg
Copy link
Member

The issues is:
We call:

Xpress.chgbounds(model.inner, [info.column], Cchar['L'], [value])

Then:

Xpress.chgbounds(model.inner, [info.column], Cchar['U'], [value])

So for an instant bounds are inconsistent. but after the second call everything is ok.
We could call:

Xpress.chgbounds(model.inner, [info.column], Cchar['B'], [value])

if we are fixing variables, that would change both at the same time and avoid the warning.

@jd-lara jd-lara linked a pull request Feb 17, 2023 that will close this issue
@joaquimg
Copy link
Member

fixed by #187

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging a pull request may close this issue.

3 participants