Replace go with gridops#11
Open
keremakdemir wants to merge 6 commits into
Open
Conversation
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.
Overview
This PR replaces the go package with gridops, a ground-up refactor of the production cost model focused on solver performance, warm-start support, and a cleaner API. The package is renamed from go to gridops.
Core Architecture Change: AbstractModel → ConcreteModel
AbstractModel, requiring a preprocessor step to generate a large.datfile from multiple CSV/NPY files before each simulation.ConcreteModel, built directly from Python data structures. All CSV/NPY files are loaded once into a dictionary. The model is constructed once and reused across all 365 horizons — only mutable parameters (demand, renewables, fuel prices, outages, etc.) are updated between solves.Performance Improvements
Flow,SoC,Charge, andDischargevariables now carry their bounds directly instead of through separate constraint rows, reducing LP size._gens_at_bus,_lines_at_bus,_storage_at_bus, etc.) eliminate Cartesian product iteration in constraint and objective construction.warmstart=Falsefor both HiGHS and Gurobi interfaces to speed up the convergence.SLACK_PENALTY,RENEWABLE_GEN_COST,PU_BASE_MVA, etc.).New: Warm-Start Support
warmstartparameter onModel(defaultFalse), overridable perrun()call._resolve_warmstart()enforces solver-specific policies:appsi_highs: warm-start uses simplex with crossover off (persistent basis reuse); cold-start defaults to IPM + crossover.appsi_gurobi: warm-start setsLPWarmStart=1; cold-start setsLPWarmStart=0+PreDual=1.gurobi: warm-start auto-switches toappsi_gurobiwith a warning.clearSolver()on the APPSI persistent interface to force fresh presolve.API Changes
complexityparameter removed — was always"multi", no longer needed.appsi_gurobiadded as a supported solver interface.highspy>=1.10.0added as a required dependency.numpyupper bound (<2) removed.Retry Logic
HIGHS_RETRY_DEFAULTSdict, overridable viaretry_optionsparameter onrun()(replaces long positional argument lists).MAX_RANDOM_SEED_GUROBIcap).fresh_startandclear_restartparameters for restart file lifecycle management.Build System & Tests
test_configuration.py,test_solvers.py,test_west_integration.py(ConcreteModel construction validation). Expandedtest_utilities.pycoverage (restart file versioning, backoff, cleanup).