Skip to content

Conversation

@joaquimg
Copy link
Contributor

@joaquimg joaquimg commented Feb 23, 2025

Description

Replace JuMP.Model by JuMP.direct_model by default for efficiency.

I did not fully remove JuMP.Model because it would be necessary for solvers Cbc and Clp that do not support JuMP.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)

  • Feature
  • Performance Improvements

Related Tickets & Documents

Closes #833

Checklist

  • Code changes are sufficiently documented; i.e. new functions contain docstrings and .md files under /docs/src have been updated if necessary.
  • The latest changes on the target branch have been incorporated, so that any conflicts are taken care of before merging. This can be accomplished either by merging in the target branch (e.g. 'git merge develop') or by rebasing on top of the target branch (e.g. 'git rebase develop'). Please do not hesitate to reach out to the GenX development team if you need help with this.
  • Code has been tested to ensure all functionality works as intended.
  • CHANGELOG.md has been updated (if this is a 'notable' change).
  • I consent to the release of this PR's code under the GNU General Public license.

How this can be tested

...

Post-approval checklist for GenX core developers

After the PR is approved

  • Check that the latest changes on the target branch are incorporated, either via merge or rebase
  • Remember to squash and merge if incorporating into develop

@lbonaldo lbonaldo self-requested a review February 25, 2025 20:51
@lbonaldo lbonaldo changed the base branch from main to develop February 25, 2025 22:45
Copy link
Collaborator

@lbonaldo lbonaldo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @joaquimg for adding this option to GenX! I tested it with both Gurobi and HiGHS and saw a similar performance improvement. Users can still set EnableJuMPDirectModel = 0 in genx_settings.yml if they want to run GenX as before.

@lbonaldo lbonaldo merged commit 288ffec into GenXProject:develop Feb 26, 2025
7 checks passed
sambuddhac pushed a commit to sambuddhac/GenX.jl that referenced this pull request Mar 5, 2025
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.

[Feature]: consider using direct_model

2 participants