Add generic tranche-axis helpers for time-varying PWL parameters#119
Open
acostarelli wants to merge 6 commits into
Open
Add generic tranche-axis helpers for time-varying PWL parameters#119acostarelli wants to merge 6 commits into
acostarelli wants to merge 6 commits into
Conversation
Add the PSY-free helpers needed to allocate and populate 3-D (component, tranche, time) parameter arrays for time-varying piecewise-linear cost curves: make_tranche_axis, lookup_additional_axes, _get_max_tranches, and the _unwrap_for_param overloads for the slope/breakpoint parameter types (which pad short curves with degenerate zero-width tranches). Consumed by POM's ORDC (ReserveDemandTimeSeriesCurve) parameter population. 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 adds PSY-free utility helpers in value_curve_cost.jl to support allocating and populating 3-D (component, tranche, time) parameter arrays for time-varying piecewise-linear (PWL) curve data (intended for downstream consumption, e.g. POM ORDC parameter population).
Changes:
- Add tranche-axis labeling and “additional axes” discovery helpers (
make_tranche_axis,lookup_additional_axes). - Add tranche-count helper
_get_max_tranchesfor piecewise time series inputs (Vector/TimeArray/Dict). - Add
_unwrap_for_paramoverloads to pad variable-lengthIS.PiecewiseStepDatacurves into fixed-length slope/breakpoint vectors (degenerate top-end padding).
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Rename the time-varying PWL tranche-axis helpers in value_curve_cost.jl to drop the leading underscore now that they are part of the cross-package (POM) interface: _get_max_tranches -> get_max_tranches _unwrap_for_param -> unwrap_for_param They remain module-internal (not exported) and are reached via the IOM. prefix. Add unit tests covering make_tranche_axis, lookup_additional_axes, get_max_tranches (Vector/TimeArray/Dict) and unwrap_for_param (default identity, slope zero-padding, breakpoint last-repeat padding, over-length errors). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
luke-kiernan
approved these changes
Jun 16, 2026
luke-kiernan
left a comment
Collaborator
There was a problem hiding this comment.
Looks fine, just some performance nitpicks (that very well might fall under premature optimization).
jd-lara
approved these changes
Jun 16, 2026
Member
|
@acostarelli once you handle @luke-kiernan comments we can merge |
Thread an optional `meta` kwarg (default CONTAINER_KEY_EMPTY_META) through `_get_raw_pwl_data` (TS branch) and `add_pwl_constraint_delta!`, and loosen the latter's formulation type-param from AbstractDeviceFormulation to unconstrained. This lets meta-keyed, per-service offer curves (ORDC reserves in POM) reuse the same generic OfferDirection machinery as device cost curves. Existing device callers omit `meta`, so the default empty meta reproduces the prior container key and leaves them unchanged. The `_include_*_min_gen_power_in_constraint` fallbacks now accept any formulation so service formulations (e.g. StepwiseCostReserve) resolve to `false`. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Narrow the try around JuMP.compute_conflict! so a failure to read back a
single constraint container's conflict status is no longer misreported as
"optimizer doesn't support IIS" and no longer discards a conflict that was
successfully computed; label each container independently with its own try.
Match the constraint element type covariantly (DenseAxisArray{<:ConstraintRef})
so containers whose eltype is a concrete ConstraintRef{...} parametrization
dispatch to check_conflict_status instead of raising a MethodError that aborts
the whole conflict report.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
| D, | ||
| W <: AbstractPiecewiseLinearBlockOfferConstraint} | ||
| variables = get_variable(container, U, T) | ||
| variables = get_variable(container, U, T, meta) |
| else | ||
| @error "Can't compute conflict" exception = (e, catch_backtrace()) | ||
| end | ||
| return MOI.NO_CONFLICT_EXISTS |
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.
Add the PSY-free helpers needed to allocate and populate 3-D (component, tranche, time) parameter arrays for time-varying piecewise-linear cost curves: make_tranche_axis, lookup_additional_axes, _get_max_tranches, and the _unwrap_for_param overloads for the slope/breakpoint parameter types (which pad short curves with degenerate zero-width tranches). Consumed by POM's ORDC (ReserveDemandTimeSeriesCurve) parameter population.
Thanks for opening a PR to InfrastructureOptimizationModels.jl, please take note of the following when making a PR:
Check the contributor guidelines