Skip to content

append_to_backend accesses private methods from MOI.Utilities #104

@odow

Description

@odow

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions