Repository navigation
Conversation
samtalki
force-pushed
the
v09/powerio-0.9-followups
branch
from
August 18, 2026 20:23
301fbf6 to
5f7fa18
Compare
…ccepted MATPOWER, PSS/E and PowerWorld all read `rate_a = 0` as an unrated branch, and real cases lean on it: every arc of stock case14, case57, case118 and case13659pegase, 4924 of 25412 in case_ACTIVSg10k, 44104 of 208242 in case_SyntheticUSA. Nine of the twenty four MATPOWER cases in the powerio test corpus carry at least one. Read literally, the rating became a bound of exactly zero on the flow and a thermal limit of `p^2 + q^2 <= 0`, so stock case14 came back INFEASIBLE_PROBLEM_DETECTED instead of solved. An unrated branch now gets an infinite flow bound and an infinite upper bound on its thermal limit rows. The rating stays inside the thermal expression rather than being replaced by infinity there, so the residual and its derivatives stay finite. case14, case57 and case118 now solve and agree with PowerModels/Ipopt to 4.2e-11, 1.4e-12 and 1.5e-13 relative. Rated cases are untouched: their bounds are the rating and their thermal upper bound is zero, exactly as before. The README said nothing about which case files the package reads, and imported GOC3Benchmark, which has not been a dependency since the GOC3 parser moved to PowerIO. It now names the formats, the `from` keyword for the ones an extension cannot identify, the PGLib-OPF name lookup, and the MW convention on the .Pd and .Qd files. `from` is documented on opf_args, opf_model and mpopf_model.
The wrapper forwards T as a keyword, so its inference stays unresolved even
once PowerIO pins its return type; only a positional `::Type{T}` method
resolves it. Asserting both separates the two halves: the PowerIO assertion
flips as soon as the library is fixed, the wrapper assertion flips when the
call site here follows.
samtalki
force-pushed
the
v09/powerio-0.9-followups
branch
from
August 19, 2026 18:23
5f7fa18 to
424054e
Compare
PowerIO 0.9 carries document order ordinals on the SCOPF instance rows, `j_dev` within the device class and `j_sdd` in the canonical producers then consumers stacking, and the initial on status on the device, ac line and transformer rows. Every index this package derived from a uid string is now a field read: `_uidnum`, `get_j_pr`, `get_j_cs`, `get_j_prcs`, `is_pr` and the `producers_first` threading are deleted, the stacked variable numbering is arithmetic on the ordinals, and the rows that reference a device from another table (energy windows, price blocks) map through per class dictionaries built from the instance rows. The suffix rule read the digits in a uid as the device's position in its class, so any file that does not follow the competition uid convention was misindexed, including GOC's own 14 bus validation case; PowerIO warned and continued. On C3E4N00073D1_scenario_303 the two agree everywhere: no row differs across 154 producers, 51 consumers, the active reserve set rows, 105 ac lines, 15 transformers, 1 dc line and 73 buses. `parse_sc_data` takes the GOC3 document text and returns the data and the lengths. `goc3_scopf_data` types PowerIO's parse of it, so the periods and the interval durations come off the instance instead of a second raw parse, and the three `goc3_add_status_flags!` calls take typed rows in place of the raw lookup dictionaries. `save_go3_solution` takes the case file, rebuilds the uid to index tables from the instance and maps every solution row through them. Its old signature could not be called: it asked for `producers_first`, which `goc3_model` never returned, and it had no call sites. Renaming every uid in the case and the unit commitment document, so the digits the retired rule would have read run in reverse of document order, must move neither the model nor the written solution. The regression asserts both: same variable count, same objective and constraints at x0, and every written field equal to the rename of the original, uid for uid. Verified against PowerIO on the companion `v09/scopf-instance-consumers` branch: the goc3 slice and the full suite pass. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
PowerIO's `T` keyword is a value of an abstract `Type{<:Real}`, so forwarding the wrapper's static parameter through it dropped the specialization: the result inferred as an unparameterized NamedTuple and every field read off it widened to `AbstractArray{BusRow{T}} where T`. Forwarding positionally keeps the static parameter, which is what the wrapper's own comment says its `::Type{T}` signature exists for.
Both inference assertions now hold and stop being broken. PowerIO 0.9 pins its own return type, which flips the first, and this call site follows it, which is what the second was waiting on. A single abstract field in the parse leaves `ExaModel(CORE, data)` unresolved under `--trim=safe`, so the assertions are the guard against that regressing.
EMP_TEST_SELECTION=all: 6713 passed, 0 failed, 0 broken, 13m39s.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Pass the element type positionally through every PowerIO parse and load series call so the multiperiod argument function has one exact inferred return type. Restrict PGLib fallback resolution to bare case names, and run the compiled library check as a self-contained CI slice with a private output directory.
`parse_file(BalancedNetwork, ...)` returns the concrete network type rather than one inferred from the call, and `Val(:live)` selects the method that keeps the handle out of the AOT call graph. Every parse and LoadSeries route takes both, so the row element types stay isbits and `ExaModel(CORE, data)` resolves under `--trim=safe`. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
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.
Stacked on #3. It is one commit on top of that PR's head, and it merges only after it.
#3 left five raw dictionary reads in
parse_sc_dataand scoped them out as post 1.0 work:goc3_shutdown_power_capand theT_supc_pr/T_supc_cs/T_sdpc_pr/T_sdpc_cscomprehensions still went todata.sdd_lookupanddata.sdd_ts_lookupfor the startup and shutdown power capability, and re-derived the producer/consumer split from the uid string withis_pr. Nothing about that has to wait for 1.0. PowerIO 0.9.0'sSddRowalready carries all four fields, andsc_data.prod/sc_data.consalready carry PowerIO's owndevice_typesplit with this file's stacked indices spliced onto it by the remap two functions above. No new PowerIO API is needed, so the refactor is available today.What changes
All five now iterate
sc_data.prod/sc_data.cons:val["initial_status"]["p"]p.p_0val["p_shutdown_ramp_ub"]p.p_rd_sdval["p_startup_ramp_ub"]p.p_ru_sudata.sdd_ts_lookup[key]["p_lb"]p.p_min_uidnum(val["uid"]) + 1,get_j_prcs(val["uid"], …)p.j_prcsis_pr(val["uid"], …)device_typesplitgoc3_shutdown_power_captakes the two row vectors plusperiodsanddtinstead of the whole parsed document. It is internal, so the signature change reaches nothing outside this file. Theis_pr(::String, …)overload has no callers left and is removed; theIntoverload thatsave_go3_solutionuses stays.Equivalence
parse_sc_dataonC3E4N00073D1_scenario_303,5318ac1against this commit, same local PowerIO 0.9.0 and the same compiled C library. All 54 fields it returns are byte identical, compared as SHA256 over their serialized form, and so arelengthsandproducers_first.The eight sums this touches reach the model only through
prarrayandcsarray, so they were also read back off those rows individually:sum_T_supc_prsum2_T_supc_prsum_T_sdpc_prsum2_T_sdpc_prsum_T_supc_cssum2_T_supc_cssum_T_sdpc_cssum2_T_sdpc_csEvery consumer sum is zero on this scenario, in both versions, so equal values alone say nothing about the two consumer branches. The splits were compared directly instead: across all 205 devices the removed
is_prregex classification and PowerIO'sdevice_typeagree exactly, 154 producers and 51 consumers.j_prcsis distinct across all 205, so thep_sdpcwrites do not collide here.Test slices, both green against local PowerIO 0.9.0:
EMP_TEST_SELECTION=goc3— 750 tests, 11m35sEMP_TEST_SELECTION=nothing— 2583 tests, 4m04sThe uid indexing weakness this does not fix
is_pr,get_j_pr,get_j_csandget_j_prcsstill take every stacked index from a regex match on the uid string, so two devices whose uids share a numeric substring land on one index. On the GOCompetition 14 bus file vendored as powerio-prob's own test fixture,is_prmisclassifies 7 of 17 devices by device type, andget_j_prcsputs two devices in one slot four times, which would overwrite one device'sp_sdpcentries with another's.PowerIO.goc3_scopf_datawarns on that file that the two device classes do not form disjoint contiguous uid blocks.C3E4N00073D1uses zero padded, class disjoint uids, so the suite gives no signal either way.PowerIO.goc3_scopf_data, the only SCOPF surface this file calls, does not index by document order: its rows come out sorted by uid number and itssdd_ids_producer/sdd_ids_consumerare a lexicographic string sort, so it offers no scheme to adopt.powerio-prob'sScopfInstancedoes implement and test document order indexing, reachable throughPowerIO.parse_scopf, which this file does not use. Fixing it here needs either a typed Julia binding to that instance or a rewrite of this file's whole index scheme.Before merging
Merge after #3, which itself waits on PowerIO.jl 0.9.0 registering in General.
🤖 Generated with Claude Code