Skip to content

Avoid extra copies of functions in copy_to#2957

Open
blegat wants to merge 4 commits intomasterfrom
bl/unsafe
Open

Avoid extra copies of functions in copy_to#2957
blegat wants to merge 4 commits intomasterfrom
bl/unsafe

Conversation

@blegat
Copy link
Member

@blegat blegat commented Feb 27, 2026

It seems wasteful to copy the functions in copy_to before it goes through the IndexMap when we also copy the function when it arrives in the model because we don't allow a MOI.ModelLike to keep a copy of the function.
For most implementation of MOI.ModelLike, MOI.ConstraintFunction does create a new copy but for MOI.Utilities.VectorOfConstraints, it is actually making a copy.
What's a bit inconsistent is that MOI.Utilities.ObjectiveContainer does not create a copy of the objective function at the moment. With this PR, the way we handle objective and constraints are not consistent.

  • docs
  • tests
  • benchmark

Removes the need for #2803

Closes #2803

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.

1 participant