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

append_to_backend accesses private methods from MOI.Utilities #104

Closed
odow opened this issue Jun 24, 2024 · 3 comments
Closed

append_to_backend accesses private methods from MOI.Utilities #104

odow opened this issue Jun 24, 2024 · 3 comments

Comments

@odow
Copy link
Contributor

odow commented Jun 24, 2024

See

function append_to_backend!(dest::MOI.ModelLike, src::MOI.ModelLike)
vis_src = MOI.get(src, MOI.ListOfVariableIndices()) #returns vector of MOI.VariableIndex
index_map = MOIU.IndexMap()
# per the comment in MOI:
# "The `NLPBlock` assumes that the order of variables does not change (#849)
# Therefore, all VariableIndex and VectorOfVariable constraints are added
# seprately, and no variables constrained-on-creation are added.""
# Consequently, Plasmo avoids using the constrained-on-creation approach because
# of the way it constructs the NLPBlock for the optimizer.
# has_nlp = MOI.NLPBlock() in MOI.get(src, MOI.ListOfModelAttributesSet())
# constraints_not_added = if has_nlp
constraints_not_added = Any[
MOI.get(src, MOI.ListOfConstraintIndices{F,S}()) for
(F, S) in MOI.get(src, MOI.ListOfConstraintTypesPresent()) if
MOIU._is_variable_function(F)
]
# else
# Any[
# MOIU._try_constrain_variables_on_creation(dest, src, index_map, S)
# for S in MOIU.sorted_variable_sets_by_cost(dest, src)
# ]
# end
# Copy free variables into graph optimizer
MOI.Utilities._copy_free_variables(dest, index_map, vis_src)

x-ref jump-dev/MathOptInterface.jl#2520

@jalving
Copy link
Member

jalving commented Jun 24, 2024

Thanks for the heads up. I will be rolling out a new version soon that uses no private MOI methods.

@odow
Copy link
Contributor Author

odow commented Jun 24, 2024

I'm reverting the change to MOI that removed them, so you're good for a while.

@jalving
Copy link
Member

jalving commented Jul 30, 2024

Plasmo.jl should no longer be using private MOI methods with v0.6, but please re-open if you spot an instance i missed.

Addressed with #105

@jalving jalving closed this as completed Jul 30, 2024
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

No branches or pull requests

2 participants