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

Don't erroneously claim support for Integer variables #245

Merged
merged 3 commits into from
Oct 7, 2024

Conversation

LebedevRI
Copy link
Contributor

@LebedevRI LebedevRI commented Jun 27, 2024

As discussed in #244,
it is counter-productive for Alpine to declare Integer variables to be supported,
only to, then, produce a nice error message. This prevents IntegerToZeroOneBridge
from triggering and actually providing transparent support for them..

But that requires adding support at least for
MOI.is_valid(model::Alpine.Optimizer, ci::MOI.ConstraintIndex{MOI.VariableIndex,S})
and
MOI.get(model::Alpine.Optimizer, ::MOI.ConstraintSet, ci::MOI.ConstraintIndex{MOI.VariableIndex,S}),
but some other pieces seem missing too.

Fixes #244
Refs. #233

m = JuMP.Model(test_solver)

@variable(m, objvar, Int)
@constraint(m, -10 <= objvar)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So only the bounds added when creating the variable are considered bounds.
Is this by design, or am i missing some toggle?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are right! As it is, there is no toggle to convert a constraint-based bound into a variable bound. But, after the bound propagation algorithm with presolve_bt = true, a new model is created with deduced bounds on the variables based on constraints. In this sense, this toggle seemed unnecessary. But do you think it would be necessary in some cases?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are right! As it is, there is no toggle to convert a constraint-based bound into a variable bound.

Ok, then this is basically ready for the review then.

But, after the bound propagation algorithm with presolve_bt = true, a new model is created with deduced bounds on the variables based on constraints. In this sense, this toggle seemed unnecessary. But do you think it would be necessary in some cases?

Right. But all that happens after IntegerToZeroOneBridge bridge runs
and encounters variables whose bounds may be specified as constraints,
which means those variables may not have bounds after all,
that are required for IntegerToZeroOneBridge to work in the first place,
which in turn means the whole model still fails to be supported.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agree! Before this bridge fails, we could leave this to the user and include an explicit error message: "If known, include variable bounds explicitly instead of constraints" ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As tests show, IntegerToZeroOneBridge already produces an error message,
so if anything, said error message should/could be improved on MOI side.
If that wasn't the question, i did not follow what the question was.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not a bound. This is the constraint 1.0 * objvar in GreaterThan(-10.0)

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You need @variable(m, -10 <= objvar <= 20, Int), or set_lower_bound(objvar, -10).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right. At this point those are more of a negative tests to demonstrate
that such syntax does not produce bounds needed for this to work.

@LebedevRI LebedevRI marked this pull request as ready for review June 28, 2024 03:33
@LebedevRI
Copy link
Contributor Author

Should this have any documentation changes?
Would it be possible to get the CI feedback?

@LebedevRI
Copy link
Contributor Author

Hm, those failures look strange, i don't think i saw them locally, but i'll re-check.
Since last commit to master was 4 months ago, it might be a good idea
to do a dummy commit to refresh the baseline CI status of the master branch?

@odow
Copy link
Collaborator

odow commented Jul 13, 2024

That error doesn't look related

@LebedevRI
Copy link
Contributor Author

test (both for master and the PR) passes for me locally.
Addressed formatting.
Thanks for taking a look!

@odow
Copy link
Collaborator

odow commented Aug 14, 2024

I've made a bunch of recent changes, including getting the tests to pass, so are you able to rebase on the latest master?

They really are not supported, and the claim is only there
to provide a nice diagnostic.

But that prevents MOI `IntegerToZeroOneBridge` from triggering,
and providing Alpine with transparent support for them.

Fixes lanl-ansi#244
@LebedevRI
Copy link
Contributor Author

Rebased, but i didn't run tests.

@odow odow changed the title Don't errneously claim support for Integer variables Don't erroneously claim support for Integer variables Aug 14, 2024
@odow
Copy link
Collaborator

odow commented Aug 14, 2024

So the upside here is that we will not support bounded integer variables.

The downside is that for unbounded integer variables the error message is now worse.

@LebedevRI
Copy link
Contributor Author

s/not/now/

I suppose that's the expected trade-off here, isn't it.
Thanks for helping with tests!

@LebedevRI
Copy link
Contributor Author

I'm not quite sure why this hasn't been merged, if this is waiting on something from my side, i'm not aware of that.

@harshangrjn
Copy link
Collaborator

@odow we could merge this branch if things look okay to you.

@harshangrjn harshangrjn merged commit 034cc69 into lanl-ansi:master Oct 7, 2024
8 checks passed
@LebedevRI LebedevRI deleted the int branch October 7, 2024 23:20
@LebedevRI
Copy link
Contributor Author

@harshangrjn thank you!

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

Successfully merging this pull request may close these issues.

Falsely declared support for MOI.Integer
3 participants