Replace JuMP.Model by JuMP.direct_model by default for performance
#835
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Replace
JuMP.ModelbyJuMP.direct_modelby default for efficiency.I did not fully remove
JuMP.Modelbecause it would be necessary for solvers Cbc and Clp that do not supportJuMP.direct_model. On the other hand, these solvers are not very recommended most of the time anyway.About improvements, I ran a case with 26 nodes and 10 weeks, I disabled writing solutions, I set the maximum simplex iterations to 1, to remove sole time from the benchmark. We are only interested in build time for this.
Before the PR:
334.732279 seconds (463.53 M allocations: 29.658 GiB, 60.63% gc time, 0.06% compilation time: 100% of which was recompilation)After the PR:
226.308012 seconds (415.97 M allocations: 25.291 GiB, 46.13% gc time, 0.19% compilation time: 100% of which was recompilation)Which is a 50% build time improvement and 10% reduction in overall memory allocation. This certainly also reduces peak memory usage, which can give the user more available RAM for solve time.
What type of PR is this? (check all applicable)
Related Tickets & Documents
Closes #833
Checklist
How this can be tested
...
Post-approval checklist for GenX core developers
After the PR is approved