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

Removed inefficient setdiff calls #125

Merged
merged 4 commits into from
Oct 2, 2024

Conversation

dlcole3
Copy link
Collaborator

@dlcole3 dlcole3 commented Sep 25, 2024

This PR addresses #124. Adding link constraints to a graph with lots of variables was inefficient because of the setdiff call that was called by the _add_backend_variables function (called by MOI.add_constraint). I replaced the setdiff with a for loop that tests whether the variable is in the keys of backend.element_to_graph_map.var_map rather than building a new vector of these variables first. The code snippet in #124 now works much quicker and the time for running each iteration of the loop in that issue no longer increases after each iteration.

@dlcole3 dlcole3 linked an issue Sep 26, 2024 that may be closed by this pull request
@jalving jalving merged commit 13f130b into plasmo-dev:main Oct 2, 2024
5 checks passed
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.

Link constraint creation time increases with number of subgraphs
2 participants