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 accesses private methods from MOI.Utilities #218

Open
odow opened this issue Jun 24, 2024 · 0 comments
Open

append_to accesses private methods from MOI.Utilities #218

odow opened this issue Jun 24, 2024 · 0 comments

Comments

@odow
Copy link
Collaborator

odow commented Jun 24, 2024

See

function append_to(
dest::MOI.ModelLike,
src::MOI.ModelLike,
idxmap,
filter_constraints::Union{Nothing,Function} = nothing;
allow_single_bounds::Bool = true,
)
#=
This function follows closely the function `default_copy_to` defined in
MathOptInterface.Utilities
due to some caveats of this function we keep the commented functions
from the original function to highlight the differences and
easen the burden of updating when `default_copy_to` is updated.
=#
# MOI.empty!(dest)
# idxmap = MOIU.IndexMap()
vis_src = MOI.get(src, MOI.ListOfVariableIndices())
# index_map_for_variable_indices only initializes the data structure
# idxmap = index_map_for_variable_indices(vis_src)
# The `NLPBlock` assumes that the order of variables does not change (#849)
if MOI.NLPBlock() in MOI.get(src, MOI.ListOfModelAttributesSet())
error("NLP models are not supported.")
# constraint_types = MOI.get(src, MOI.ListOfConstraints())
# single_variable_types = [S for (F, S) in constraint_types
# if F == MOI.VariableIndex]
# vector_of_variables_types = [S for (F, S) in constraint_types
# if F == MOI.VectorOfVariables]
# vector_of_variables_not_added = [
# MOI.get(src, MOI.ListOfConstraintIndices{MOI.VectorOfVariables, S}())
# for S in vector_of_variables_types
# ]
# single_variable_not_added = [
# MOI.get(src, MOI.ListOfConstraintIndices{MOI.VariableIndex, S}())
# for S in single_variable_types
# ]
else
# the key asusmption here is that MOI keeps the following behaviour
# "The copy is only done when
# the variables to be copied are not already keys of `idxmap`. It returns a list
# of the constraints copied and not copied."
# from copy_single_variable and copy_vector_of_variables.
# this is very importante because variables are shered between
# upper, lower and lower dual levels
constraints_not_added = Any[
MOIU._try_constrain_variables_on_creation(dest, src, idxmap, S)

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

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

1 participant