Skip to content

Support scalar time-series cost params (shut_down/no_load) in unwrap_for_param#122

Merged
jd-lara merged 1 commit into
ac/ordcfrom
rh/scalar-ts-cost-unwrap
Jun 24, 2026
Merged

Support scalar time-series cost params (shut_down/no_load) in unwrap_for_param#122
jd-lara merged 1 commit into
ac/ordcfrom
rh/scalar-ts-cost-unwrap

Conversation

@rodrigomha

Copy link
Copy Markdown
Contributor

Summary

Adds the missing unwrap_for_param method for scalar-linear time-series cost parameters, so a MarketBidTimeSeriesCost (and ImportExportTimeSeriesCost) can be built under a unit-commitment model. Today the time-varying PWL offer-curve parameters are handled, but the scalar cost fields (shut_down, no_load, cost-at-min) are not.

Problem

When a device carries a time-series offer cost, POM adds ShutdownCostParameter / NoLoadCostParameter as time-series parameters. Their per-hour value resolves to an IS.LinearFunctionData. unwrap_for_param has methods only for AbstractPiecewiseLinearSlopeParameter / AbstractPiecewiseLinearBreakpointParameter over IS.PiecewiseStepData, so the scalar element falls through to the identity method and _size_wrapper then calls size(::LinearFunctionData), which has no method — failing the parameter-population assert in POM add_parameters.jl.

Minimal repro: build any UC DecisionModel over a ThermalStandard whose operation_cost is a MarketBidTimeSeriesCost. build! returns FAILED with MethodError: no method matching size(::LinearFunctionData).

Fix

Add one additive method that extracts the scalar from the per-hour LinearFunctionData via IS.get_proportional_term — mirroring how the static path already reads a scalar LinearCurve cost (_shutdown_cost_value(::IS.LinearCurve) = IS.get_proportional_term(x)). The returned Float64 has size () == (), satisfying the existing assert.

unwrap_for_param(::ParameterType, ts_elem::IS.LinearFunctionData, expected_axs) =
    IS.get_proportional_term(ts_elem)

Dispatching on the element type covers all scalar cost parameters (shut_down / no_load / cost-at-min, incremental and decremental) in one method, with no signature changes to existing code.

Verification

Verified end-to-end with the downstream POM change (Sienna-Platform/PowerOperationsModels.jl device time-varying market-bid PR): a 24h time-varying MarketBidTimeSeriesCost UC now build!s and solve!s, and the per-hour objective coefficients match the per-hour offer-curve slopes exactly (validated on both synthetic and real ERCOT DAM data).

🤖 Generated with Claude Code

…arams

Time-series cost fields (shut_down / no_load and other scalar-linear sides of a
MarketBidTimeSeriesCost) resolve per-hour to an IS.LinearFunctionData. The PWL
slope/breakpoint unwrap_for_param methods don't match it, so it fell through the
identity and _size_wrapper then called size(::LinearFunctionData) (no method),
failing the parameter-population assert. Extract the scalar via get_proportional_term
(mirrors the static _shutdown_cost_value path).
@github-actions

Copy link
Copy Markdown
Contributor

Performance Results
Main

Network: 10 nodes, 13 edges, 3 cost segments
Generators: 5, Demands: 5
Loss coefficients (a, b, c) per generator:
  n1: a=0.007287  b=0.005968  c=0.003850
  n2: a=0.001094  b=0.009002  c=0.007028
  n3: a=0.007897  b=0.008552  c=0.003001
  n4: a=0.008179  b=0.002530  c=0.009637
  n5: a=0.009778  b=0.009934  c=0.009099

Solver logs: /home/runner/work/InfrastructureOptimizationModels.jl/InfrastructureOptimizationModels.jl/main/test/performance/logs/solver_2026-06-23T19-14-51.log

==============================================================================================================================================
Bilinear Approximation Benchmarks
  Refinement = depth for all methods
==============================================================================================================================================
Method          R   Vars Constrs   Bins    Objective   Gap(%) MIPGap(%)     LowerBnd  rmse δbi   max δbi   rmse δq    max δq  build_t  solve_t
----------------------------------------------------------------------------------------------------------------------------------------------
NLP (Ipopt)     -     40     105      0     0.956760        -         -            -  0.00e+00  0.00e+00  0.00e+00  0.00e+00   0.0497   0.0047

NLP (Uno)       -     40     105      0     0.956760   0.0000         -            -  0.00e+00  0.00e+00  0.00e+00  0.00e+00   0.0013   0.0056

Bin2+sSOS       4    190     535      0     1.180700  23.4061    0.0000     1.180700  8.07e-02  1.41e-01  2.49e+01  5.48e+01   0.0056   1.8392
Bin2+sSOS       6    250     655      0     1.098175  14.7806    0.0000     1.098175  1.26e-01  2.86e-01  5.47e+00  9.07e+00   0.0058   7.6773
Bin2+sSOS       8    310     775      0     1.053069  10.0661    0.0088     1.052976  8.62e-02  2.43e-01  4.18e+01  9.32e+01   0.0057  26.9646

Bin2+mSOS       4    310     805    120     1.180700  23.4061    0.0000     1.180700  8.07e-02  1.41e-01  2.49e+01  5.48e+01   0.0022   1.7977
Bin2+mSOS       6    430    1045    180     1.098175  14.7806    0.0000     1.098175  1.26e-01  2.86e-01  5.47e+00  9.07e+00   0.0024   5.8789
Bin2+mSOS       8    550    1285    240     1.053069  10.0661    0.0080     1.052984  8.62e-02  2.43e-01  4.18e+01  9.32e+01   0.0026  19.3456

Bin2+Saw        4    310    1075    120     0.985859   3.0414    0.0055     0.985805  1.15e-01  2.48e-01  2.65e+02  5.18e+02   0.0032  11.6276
Bin2+Saw        6    430    1495    180     0.958677   0.2004    0.0077     0.958603  7.52e-02  1.68e-01  8.94e+01  1.71e+02   0.0039  13.6228
Bin2+Saw        8    550    1915    240     0.956996   0.0247    0.0072     0.956927  7.52e-02  1.68e-01  1.37e+02  2.09e+02   0.0044  50.4267

HybS+sSOS       4    310    1165      0     0.812261  15.1030    0.0000     0.812261  5.52e-01  1.00e+00  2.04e+02  2.97e+02   0.0069   2.7381
HybS+sSOS       6    410    1545      0     0.891208   6.8515    0.0000     0.891208  5.49e-01  1.00e+00  3.69e+02  7.09e+02   0.0072   4.9021
HybS+sSOS       8    510    1925      0     0.934789   2.2965    0.0087     0.934707  5.48e-01  1.00e+00  3.47e+02  5.22e+02   0.0080  15.7132

HybS+mSOS       4    390    1345     80     0.812261  15.1030    0.0046     0.812224  5.52e-01  1.00e+00  2.04e+02  2.97e+02   0.0034   2.8761
HybS+mSOS       6    530    1805    120     0.891208   6.8515    0.0000     0.891208  5.49e-01  1.00e+00  3.69e+02  7.09e+02   0.0040   6.3016
HybS+mSOS       8    670    2265    160     0.934789   2.2965    0.0047     0.934744  5.48e-01  1.00e+00  3.47e+02  5.22e+02   0.0045  16.2189

HybS+Saw        4    390    1525     80     0.951869   0.5113    0.0084     0.951789  5.48e-01  1.00e+00  2.16e+03  4.23e+03   0.0040  10.5064
HybS+Saw        6    530    2105    120     0.956386   0.0391    0.0099     0.956291  5.48e-01  1.00e+00  4.57e+02  7.57e+02   0.0048  33.4034
HybS+Saw        8    670    2685    160     0.956734   0.0027    0.0078     0.956659  5.48e-01  1.00e+00  6.08e+00  1.07e+01   0.0058 101.3825

DNMDT           4    395    1640     80     0.954878   0.1967    0.0004     0.954874  1.39e-03  3.13e-03  4.70e-04  1.05e-03   0.0032   4.1582
DNMDT           6    550    2315    120     0.956636   0.0130    0.0098     0.956541  6.75e-05  1.57e-04  4.26e+03  9.54e+03   0.0035  17.8321
DNMDT           8    705    2990    160     0.956754   0.0007    0.0096     0.956662  4.62e-06  1.14e-05  9.42e+01  1.49e+02   0.0040  56.0235

==============================================================================================================================================

This branch

Network: 10 nodes, 13 edges, 3 cost segments
Generators: 5, Demands: 5
Loss coefficients (a, b, c) per generator:
  n1: a=0.007287  b=0.005968  c=0.003850
  n2: a=0.001094  b=0.009002  c=0.007028
  n3: a=0.007897  b=0.008552  c=0.003001
  n4: a=0.008179  b=0.002530  c=0.009637
  n5: a=0.009778  b=0.009934  c=0.009099

Solver logs: /home/runner/work/InfrastructureOptimizationModels.jl/InfrastructureOptimizationModels.jl/branch/test/performance/logs/solver_2026-06-23T19-23-03.log

==============================================================================================================================================
Bilinear Approximation Benchmarks
  Refinement = depth for all methods
==============================================================================================================================================
Method          R   Vars Constrs   Bins    Objective   Gap(%) MIPGap(%)     LowerBnd  rmse δbi   max δbi   rmse δq    max δq  build_t  solve_t
----------------------------------------------------------------------------------------------------------------------------------------------
NLP (Ipopt)     -     40     105      0     0.956760        -         -            -  0.00e+00  0.00e+00  0.00e+00  0.00e+00   0.0338   0.0048

NLP (Uno)       -     40     105      0     0.956760   0.0000         -            -  0.00e+00  0.00e+00  0.00e+00  0.00e+00   0.0014   0.0047

Bin2+sSOS       4    190     535      0     1.180700  23.4061    0.0000     1.180700  8.07e-02  1.41e-01  2.49e+01  5.48e+01   0.0060   1.8367
Bin2+sSOS       6    250     655      0     1.098175  14.7806    0.0000     1.098175  1.26e-01  2.86e-01  5.47e+00  9.07e+00   0.0060   7.6057
Bin2+sSOS       8    310     775      0     1.053069  10.0661    0.0088     1.052976  8.62e-02  2.43e-01  4.18e+01  9.32e+01   0.0060  26.7276

Bin2+mSOS       4    310     805    120     1.180700  23.4061    0.0000     1.180700  8.07e-02  1.41e-01  2.49e+01  5.48e+01   0.0024   1.7693
Bin2+mSOS       6    430    1045    180     1.098175  14.7806    0.0000     1.098175  1.26e-01  2.86e-01  5.47e+00  9.07e+00   0.0024   5.8151
Bin2+mSOS       8    550    1285    240     1.053069  10.0661    0.0080     1.052984  8.62e-02  2.43e-01  4.18e+01  9.32e+01   0.0026  19.1524

Bin2+Saw        4    310    1075    120     0.985859   3.0414    0.0055     0.985805  1.15e-01  2.48e-01  2.65e+02  5.18e+02   0.0033  11.5423
Bin2+Saw        6    430    1495    180     0.958677   0.2004    0.0077     0.958603  7.52e-02  1.68e-01  8.94e+01  1.71e+02   0.0038  13.5383
Bin2+Saw        8    550    1915    240     0.956996   0.0247    0.0072     0.956927  7.52e-02  1.68e-01  1.37e+02  2.09e+02   0.0046  50.0097

HybS+sSOS       4    310    1165      0     0.812261  15.1030    0.0000     0.812261  5.52e-01  1.00e+00  2.04e+02  2.97e+02   0.0072   2.7338
HybS+sSOS       6    410    1545      0     0.891208   6.8515    0.0000     0.891208  5.49e-01  1.00e+00  3.69e+02  7.09e+02   0.0073   4.8730
HybS+sSOS       8    510    1925      0     0.934789   2.2965    0.0087     0.934707  5.48e-01  1.00e+00  3.47e+02  5.22e+02   0.0078  15.6442

HybS+mSOS       4    390    1345     80     0.812261  15.1030    0.0046     0.812224  5.52e-01  1.00e+00  2.04e+02  2.97e+02   0.0035   2.8555
HybS+mSOS       6    530    1805    120     0.891208   6.8515    0.0000     0.891208  5.49e-01  1.00e+00  3.69e+02  7.09e+02   0.0039   6.2378
HybS+mSOS       8    670    2265    160     0.934789   2.2965    0.0047     0.934744  5.48e-01  1.00e+00  3.47e+02  5.22e+02   0.0045  16.1348

HybS+Saw        4    390    1525     80     0.951869   0.5113    0.0084     0.951789  5.48e-01  1.00e+00  2.16e+03  4.23e+03   0.0040  10.4552
HybS+Saw        6    530    2105    120     0.956386   0.0391    0.0099     0.956291  5.48e-01  1.00e+00  4.57e+02  7.57e+02   0.0049  33.5776
HybS+Saw        8    670    2685    160     0.956734   0.0027    0.0078     0.956659  5.48e-01  1.00e+00  6.08e+00  1.07e+01   0.0057 101.8927

DNMDT           4    395    1640     80     0.954878   0.1967    0.0004     0.954874  1.39e-03  3.13e-03  4.70e-04  1.05e-03   0.0031   4.1822
DNMDT           6    550    2315    120     0.956636   0.0130    0.0098     0.956541  6.75e-05  1.57e-04  4.26e+03  9.54e+03   0.0037  18.0087
DNMDT           8    705    2990    160     0.956754   0.0007    0.0096     0.956662  4.62e-06  1.14e-05  9.42e+01  1.49e+02   0.0039  56.3126

==============================================================================================================================================

@rodrigomha rodrigomha requested a review from jd-lara June 23, 2026 20:21
@jd-lara jd-lara changed the base branch from ac/ordc to main June 24, 2026 00:27
@jd-lara jd-lara changed the base branch from main to ac/ordc June 24, 2026 00:28
@jd-lara jd-lara merged commit 3a99811 into ac/ordc Jun 24, 2026
5 of 6 checks passed
jd-lara added a commit that referenced this pull request Jun 24, 2026
…arams (#122) (#123)

Time-series cost fields (shut_down / no_load and other scalar-linear sides of a
MarketBidTimeSeriesCost) resolve per-hour to an IS.LinearFunctionData. The PWL
slope/breakpoint unwrap_for_param methods don't match it, so it fell through the
identity and _size_wrapper then called size(::LinearFunctionData) (no method),
failing the parameter-population assert. Extract the scalar via get_proportional_term
(mirrors the static _shutdown_cost_value path).

Co-authored-by: Rodrigo Henríquez-Auba <rodrigomha@gmail.com>
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