Skip to content

Reduce asset_is_realized big-M safety margin to 1.0#503

Open
jarsarasty wants to merge 1 commit into
mainfrom
fix/reduce-big-m-safety-margin
Open

Reduce asset_is_realized big-M safety margin to 1.0#503
jarsarasty wants to merge 1 commit into
mainfrom
fix/reduce-big-m-safety-margin

Conversation

@jarsarasty

Copy link
Copy Markdown
Collaborator

The asset_is_realized big-M constraints in financial_mixin.py (__cumulative_investments_made_in_eur_path_constraints and __cumulative_capex_made_in_eur_constraints) computed big_m from the asset's own registered cost/Heat_flow bounds, then applied an extra 1.5x safety margin on top. Since the underlying bound is already exact, this margin was unnecessary.

Numeric literals for safety margin replaced with a named constant.

Since big_m in financial mixin already uses actual bounds,
extra margin was unnecessary

@FJanssen-TNO FJanssen-TNO left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

@jarsarasty Review is ready, just a small comment.

logger = logging.getLogger("mesido")

# No safety factor is needed for big_m, since actual bounds are used.
ASSET_IS_REALIZED_BIG_M_MARGIN = 1.0

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

In a perfect world indeed no safety factor is needed for big_m. However this big_m margin is also used for a heatflow that is divided by the aggregationcount, here previously some rounding errors have caused issues once in a while (not always easy to reproduce due to different solvers or even order of rows in the matrices). A safety factor of 1.5 is indeed overkill and might give other (scaling) issues. However I would prefer a small safety margin, for instance changing this ASSET_IS_REALIZED_BIG_MARGIN to 1.01. This should prevent round errors to select the wrong integer, while not messing up the scaling.

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.

2 participants