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

support lazy constraints in plasmo #95

Merged
merged 1 commit into from
Oct 10, 2023
Merged

Conversation

jalving
Copy link
Member

@jalving jalving commented Oct 10, 2023

This PR gets basic lazy constraint callbacks working in Plasmo.jl. This is meant to address #89.

@codecov-commenter
Copy link

Codecov Report

Attention: 20 lines in your changes are missing coverage. Please review.

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Files Coverage Δ
src/moi_backend_graph.jl 88.69% <ø> (ø)
src/optimizer_interface.jl 86.69% <0.00%> (-0.81%) ⬇️
src/optigraph.jl 72.85% <0.00%> (-3.83%) ⬇️

📢 Thoughts on this report? Let us know!.

@jalving jalving merged commit 42f3242 into plasmo-dev:main Oct 10, 2023
5 checks passed
return MOI.get(graph.moi_backend, MOI.DualStatus())
end

function JuMP.callback_value(cb_data, x::GenericVariableRef, graph::OptiGraph)
Copy link
Contributor

Choose a reason for hiding this comment

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

The retrieved callback values are not updated by the optimizer. The code below works:

function JuMP.callback_value(cb_data, x::GenericVariableRef, graph::OptiGraph)
    var_index = graph.moi_backend.model_to_optimizer_map.var_map[x]
    return MOI.get(
        graph.moi_backend.optimizer,
        MOI.CallbackVariablePrimal(cb_data),
        var_index,
    )
end

Copy link
Member Author

Choose a reason for hiding this comment

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

thanks @tso-martin. I will make a new PR to fix this (with tests to boot).

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.

3 participants