Repository navigation
Read GOC3 through PowerIO's AcScucInstance - #69
Merged
Merged
Conversation
The GOC3 security-constrained model read its problem file with ~1,200 lines of hand-written JSON handling, and took every index -- buses, devices, branches, reserve zones, contingencies, and the producers/consumers split -- from the digits of each uid, so a file that does not follow the competition's uid convention was silently misindexed. PowerIO 0.11 reads a GOC3 problem as an `AcScucInstance`: its `network` holds the buses, branches, devices, shunts and DC lines, and its typed `inputs` the device time series, reserve zones, contingencies and violation costs, all in document order. - `goc3_static` (goc3_parser.jl) reads the problem through PowerIO and gives every element its position by enumeration; nothing reads a uid's spelling, and `producers_first` is gone. - `goc3_commitment` joins the UC solution file by uid and refuses an element the file lacks, where a missing row used to shift every later row. - `parse_sc_data` (sc_parser.jl) builds the same time-indexed arrays from those tables. Rows carry no uid strings, so every array is isbits; the uids travel on the host as `sc_data_array.uids`. - `save_go3_solution(uc_filename, solution_name, result, vars, lengths, uids)` takes that table where it took `producers_first`. - `lengths` is a NamedTuple with the same 18 names in the same order. On C3E4N00073D1_scenario_303 the model is the one the old parser built: equal nvar, ncon, nnzj and nnzh, identical start and bounds, identical objective, gradient and Jacobian at x0 and at a random point, constraints equal to 1.1e-15 relative (summation order in the reserve balances, and consumers' initial power, which PowerIO carries in MW), and the same solution file. The tests pin those numbers, and check that renaming every uid, or reversing every table, leaves the model unchanged. GOC3 parsing goes from 1,215 to 529 lines. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Member
|
Thanks for the contribution @samtalki! |
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.
The GOC3 security-constrained model reads its problem file through PowerIO.jl's
AcScucInstance, replacing about 1,200 lines of hand-written JSON handling. GOC3 parsing goes from 1,215 to 529 lines. This is the GOC3 half of the PowerIO migration (#60 did both, against PowerIO 0.9). It is independent of #68 and needs only the registered PowerIO 0.11.6.Why
match(r"\d+", uid)): buses, devices, branches, reserve zones, contingencies, and the producers/consumers split (producers_first). A file that doesn't follow the competition's uid convention was silently misindexed.What changes
goc3_static(filename)(goc3_parser.jl):PowerIO.parseand checks that it is anAcScucInstance;instance.network, and time series, reserve zones, contingencies and violation costs frominstance.inputs;producers_firstis gone.goc3_commitmentjoins the UC solution file by uid, and throws if the file lacks an element.parse_sc_data(sc_parser.jl) builds the same arraysgoc3.jlreads, with the same names and shapes. Rows no longer carry uid strings, so every array is isbits; the uids travel on the host assc_data_array.uids.goc3_modelkeeps its signature and return.lengthsis a NamedTuple with the same 18 names in the same order, so positional destructuring still works.save_go3_solution(uc_filename, solution_name, result, vars, lengths, uids)takes the uid table as its sixth argument, where it tookproducers_first. It is unexported and nothing in the package called it.Equivalence
On
C3E4N00073D1_scenario_303, I built both models: the old parser loaded frommain, and the new one. On CPU, in Float64:nvar,ncon,nnzj,nnzhare equal: 140544, 152244, 466744, 161982.x0,lvar,uvar,lconanduconare identical once the contingency andcmax38rows, which the old code emitted inDictorder, are permuted.x0and at a random point.Tests
The
goc3slice passes locally, 80/80. It now:nvar,ncon, and the objective and Σ|cons| atx0and at a perturbed point, at the values the old parser gives;Known gaps in PowerIO 0.11.6 (none affect this model)
ScucInputs, so they are joined to the network's generator, load and shunt rows by uid.Each is exact on the test case. A signed per-unit initial power and a bus id on PowerIO's device and shunt rows would remove all three; I'll raise them with PowerIO.
🤖 Generated with Claude Code