Use FunctionData get_domain sugar (closes #33)#161
Closed
luke-kiernan wants to merge 1 commit into
Closed
Conversation
Adopt the FunctionData sugar from InfrastructureSystems PR #492: - _validate_occ_subtype now uses IS.get_domain instead of first(get_x_coords(...)) to check the first breakpoint. - Clarify the _onvar_cost comment (the constant term is the cost at zero output, i.e. the y-intercept). Linked with the InfrastructureOptimizationModels PR. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates a couple of FunctionData interactions to use the newer IS.get_domain helper (per InfrastructureSystems PR #492 / issue #33), and clarifies documentation around how _onvar_cost interprets the constant term of a cost curve.
Changes:
- Replaces
first(IS.get_x_coords(fd))withfirst(IS.get_domain(fd))in ImportExportCost validation logic. - Clarifies the
_onvar_costcomment to explicitly describe the constant term as the y-intercept (cost at zero output).
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
src/static_injector_models/thermal_generation.jl |
Updates the _onvar_cost comment to clarify interpretation/units of the constant term. |
src/common_models/market_bid_plumbing.jl |
Uses IS.get_domain sugar for validating the first ImportExportCost breakpoint is zero. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
Performance Results
|
Collaborator
Author
|
Given how minimal the changes are here, the test failures are certainly upstream. |
Collaborator
Author
|
The surface here is so small I think I'll just close without merging. It's supposed to be a quality of life boost, but there's only like 1-2 lines that are actually affected... |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Closes #33.
Adopts the
FunctionDatasugar from InfrastructureSystems PR #492:_validate_occ_subtype(ImportExportCost validation) now usesIS.get_domaininstead offirst(IS.get_x_coords(...))._onvar_costcomment (the constant term is the cost at zero output, i.e. the y-intercept).Scope note
The realistic surface for this sugar is narrow. Most
get_proportional_term/get_constant_term/get_quadratic_termcalls can't use the new helpers because they either (a) build JuMP expressions over variables — the evaluation functor only accepts numbers — or (b) do unit-aware per-axis scaling, wherec*fd(which scales y uniformly) doesn't apply since x and y convert by different ratios. Theget_domainsubstitutions here are the clean, behavior-preserving wins.We considered replacing the two
_onvar_cost"cost at zero output" reads with the evaluation functorcost_component(0.0), but keptget_constant_termfor efficiency and consistency (it's a plain field read; the functor would computea·0² + b·0 + c).Linked with InfrastructureOptimizationModels PR #134.
🤖 Generated with Claude Code