Skip to content

[Bridges] fix deleting variable in bridged objective #2150

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

Merged
merged 7 commits into from
Apr 25, 2023
Merged

Conversation

odow
Copy link
Member

@odow odow commented Apr 19, 2023

Some solvers error getting ObjectiveFunctionType if objective is not set. (x-ref jump-dev/CPLEX.jl#433)

I need to manually test this with CPLEX and Gurobi:

odow and others added 3 commits April 20, 2023 19:40
Some solvers error getting ObjectiveFunctionType if objective is not set.
@odow odow force-pushed the od/fix-bridge-delete branch from c579d1d to 495036c Compare April 20, 2023 07:40
@odow odow requested a review from blegat April 20, 2023 08:08
@odow
Copy link
Member Author

odow commented Apr 20, 2023

@blegat can you take a look? This is fairly urgent because it broke tests for CPLEX and Gurobi

Copy link
Member

@blegat blegat left a comment

Choose a reason for hiding this comment

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

My comment is optional

::Vector{MOI.VariableIndex},
::Type{F},
) where {F}
# Nothing to do here. The variables can be deleted without changing the type
Copy link
Member

Choose a reason for hiding this comment

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

Suppose the objective is a quadratic function that is bridged with Objective.Slack and then Constraint.QuadtoSOC, we should still update the function so that the corresponding SOC constraint is updated.
This can be done in a separate PR though

Copy link
Member Author

Choose a reason for hiding this comment

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

I think that happens automatically. This is just a special case where deleting a variable can unset the objective, rather than just modify the existing function.

Copy link
Member

Choose a reason for hiding this comment

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

I don't think it does. I think the variable deletion API kind of assumes that all bridges are affine so since the deletion commutes with affine operations then it's fine to skip the bridges and delete the solver model directly but there is one notable exception which is the QuadtoSOC bridge. We should maybe check but it's best we open a separate issue

@odow odow merged commit 6954608 into master Apr 25, 2023
@odow odow deleted the od/fix-bridge-delete branch April 25, 2023 21:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants