Skip to content

Add generic tranche-axis helpers for time-varying PWL parameters#119

Open
acostarelli wants to merge 6 commits into
mainfrom
ac/ordc
Open

Add generic tranche-axis helpers for time-varying PWL parameters#119
acostarelli wants to merge 6 commits into
mainfrom
ac/ordc

Conversation

@acostarelli

Copy link
Copy Markdown
Member

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

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>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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_tranches for piecewise time series inputs (Vector/TimeArray/Dict).
  • Add _unwrap_for_param overloads to pad variable-length IS.PiecewiseStepData curves into fixed-length slope/breakpoint vectors (degenerate top-end padding).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/objective_function/value_curve_cost.jl Outdated
Comment thread src/objective_function/value_curve_cost.jl
Anthony Costarelli and others added 2 commits June 15, 2026 15:20
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>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 5 out of 5 changed files in this pull request and generated 4 comments.

Comment thread src/objective_function/value_curve_cost.jl
Comment thread src/objective_function/value_curve_cost.jl
Comment thread test/Project.toml
Comment thread test/test_tranche_axis_helpers.jl
@acostarelli acostarelli changed the title [WIP] Add generic tranche-axis helpers for time-varying PWL parameters Add generic tranche-axis helpers for time-varying PWL parameters Jun 16, 2026

@luke-kiernan luke-kiernan 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.

Looks fine, just some performance nitpicks (that very well might fall under premature optimization).

Comment thread src/objective_function/value_curve_cost.jl
Comment thread src/objective_function/value_curve_cost.jl
Comment thread test/test_tranche_axis_helpers.jl
Comment thread test/Project.toml
Comment thread src/objective_function/value_curve_cost.jl Outdated
@jd-lara

jd-lara commented Jun 16, 2026

Copy link
Copy Markdown
Member

@acostarelli once you handle @luke-kiernan comments we can merge

Anthony Costarelli and others added 3 commits June 16, 2026 01:53
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>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 8 out of 8 changed files in this pull request and generated 2 comments.

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
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.

5 participants