Pymoo Transmission Expansion Planning Module¶
This module is preliminar and has not been throughly tested. under development
This module provides a metaheuristic wrapper for Transmission Expansion Planning (TEP) using pymoo genetic algorithms [1] over a fixed nonlinear AC/DC OPF model. The OPF is built once and decision variables (AC/DC line counts, converter counts, repurposing flags, and array cable types) are updated per candidate to evaluate CAPEX + OPEX or their Pareto trade-off using a Pyomo-based optimization model [2].
Transmission Expansion (pymoo)¶
- transmission_expansion_pymoo(grid, NPV=True, n_years=25, Hy=8760, discount_rate=0.02, ObjRule=None, solver='GA', time_limit=300, tee=False, n_gen=10)¶
Runs a pymoo-based outer optimization for TEP. For single-objective, minimizes present value of total cost (CAPEX + NPV·OPEX). For multi-objective (
solver='NSGA2'), computes the Pareto front between CAPEX and OPEX and exports the selected solution (balanced by default) back to the inputgrid.Parameter
Type
Description
Default
gridGrid
Grid object with TEP flags (e.g.,
TEP_AC,REC_AC,CT_AC,Array_opf) and candidatesRequired
NPVbool
When True, CAPEX terms use nominal values; OPEX is multiplied by present value factor
True
n_yearsint
Lifetime years for present value factor
25
Hyint
Hours per year used in present value computation
8760
discount_ratefloat
Discount rate used for present value
0.02
ObjRuledict|None
Objective weighting/selection rule passed to OPF objective builder
None
solverstr
‘GA’ for single-objective sum(CAPEX+OPEX·NPV) or ‘NSGA2’ for Pareto
‘GA’
time_limitint
Per-OPF solve time limit in seconds
300
teebool
Verbose output from pymoo
False
n_genint
Number of generations for the chosen algorithm
10
Returns
If
solver='GA'(single objective): -problem: internal problem wrapper -res: pymoo result with history -timing_info: dict with creation, solve, and export times -solver_stats: dict with iterations, best objective, time, terminationIf
solver='NSGA2'(multi-objective Pareto): -problem: internal problem wrapper -pareto_info: dict with Pareto front, solutions, and selected solutions -timing_info: dict with creation and solve times -solver_stats: dict with iterations, time, and feasible solutions
Side Effects
Exports the chosen solution back into
grid(sets investments and updatesgrid.OPF_objandgrid.TEP_run).
Example
import pyflow_acdc as pyf grid,res = pyf.case39_acdc(TEP=True,exp='All',N_b_dc=0,N_b_ac=0,N_i=0,N_max=5,Increase=1.5) obj = {'Energy_cost': 1} model, model_results , timing_info, solver_stats= pyf.transmission_expansion_pymoo(grid,NPV=True,ObjRule=obj,solver='GA',n_gen=300,tee=True)
Notes
The OPF model is built once (nonlinear ACDC OPF) and re-evaluated across candidate solutions by updating Pyomo Params; this avoids model rebuild overhead.
Decision variable bounds mirror the grid’s candidate objects and their
*_maxattributes. Ensure these are set appropriately before running.For Pareto runs (
solver='NSGA2'), the function returns Pareto information and exports the balanced solution by default. Alternative selections can be chosen viapareto_resultinside the returned information.