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

Pyomo#1416 #9

Merged
merged 14 commits into from
May 27, 2020
Merged

Pyomo#1416 #9

merged 14 commits into from
May 27, 2020

Conversation

ruaridhw
Copy link
Member

Copy of Pyomo#1416

Raising a separate PR here to avoid merging pyomo/master

@ruaridhw ruaridhw force-pushed the perf/cplex_direct branch from cdea17e to 707babd Compare May 27, 2020 15:11
ruaridhw added 14 commits May 27, 2020 17:31
- This is more efficient than always calling `.append()` on an empty list
Asking the `cplex` solution for *specific* variables' values is extremely slow due to the conversion on `cplex`'s end to lookup the variables you've asked for.
It is orders of magnitude faster to get the full solution vector. Even worse, using the "specific variable interface" to get the full solution vector.
If we must get specific variables (ie. `_load_vars()`) then their index should be used instead of their name.
The `cplex` package's Linear Constraints and Variable interfaces allow for batched transactions. I think an appropriate design is to generate all the necessary data
and add these objects as one call to the `solver_model`. I've also removed unnecessary transactions such as resetting variable bounds immediately after adding that variable with an obsolete bound.
- Calling a method to "finalise" the data objects is more explicit than `__exit__()` and doesn't rely on `nullcontext()` from CPython
@ruaridhw ruaridhw force-pushed the perf/cplex_direct branch from 707babd to 73e2644 Compare May 27, 2020 16:32
@ruaridhw
Copy link
Member Author

Merging since it has already been reviewed in the base repo.

@ruaridhw ruaridhw merged commit 6135420 into master May 27, 2020
@ruaridhw ruaridhw deleted the perf/cplex_direct branch May 27, 2020 16:32
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.

1 participant