diff --git a/gtep/gtep_model.py b/gtep/gtep_model.py index 8d88ade..0635728 100644 --- a/gtep/gtep_model.py +++ b/gtep/gtep_model.py @@ -134,19 +134,6 @@ def report_model(self, outfile="pretty_model_output.txt"): with open(outfile, "w") as outf: self.model.pprint(ostream=outf) - ## TODO: probably don't have gurobi as default solver? Instead set as open source. - def solve_model(self, solver="gurobi", solver_args=None): - """Solves the expansion planning model. Solver_args are passed directly - to the chosen solver. Assigns solution results to self.results. - - Args: - solver (str, optional): _description_. Defaults to "gurobi". - solver_args (_type_, optional): _description_. Defaults to None. - """ - opt = SolverFactory(solver) - TransformationFactory("gdp.bigm").apply_to(self.model) - self.results = opt.solve(self.model, tee=False, load_solutions=True) - def report_large_coefficients(self, outfile, magnitude_cutoff): """ Dump very large magnitude (>= 1e5) coefficients to a json file. @@ -270,6 +257,7 @@ def thermal_uninvested(b, gen): # Planning reserve requirement constraint ## NOTE: renewableCapacityValue is a percentage of renewableCapacity + ## TODO: renewableCapacityValue ==> renewableCapacityFactor ## NOTE: reserveMargin is a percentage of peakLoad ## TODO: check and re-enable with additional bounding transform before bigm ## TODO: renewableCapacityValue... should this be time iterated? is it tech based? @@ -525,7 +513,7 @@ def quickstart_reserve_limits(b, thermalGen): b.loadShed = Var(m.buses, domain=NonNegativeReals, initialize=0) # TODO: adjacent bus angle difference constraints should be added -- what should they be? - # TODO: likewise, what do we want angle boudns to actually be? + # TODO: likewise, what do we want angle bounds to actually be? def bus_angle_bounds(b, bus): return (-90, 90) diff --git a/gtep/tests/unit/test_gtep_model.py b/gtep/tests/unit/test_gtep_model.py index 38f0192..faf2884 100644 --- a/gtep/tests/unit/test_gtep_model.py +++ b/gtep/tests/unit/test_gtep_model.py @@ -9,7 +9,7 @@ from prescient.data.providers import gmlc_data_provider from prescient.simulator.options import Options from prescient.simulator.config import PrescientConfig -import datetime + import logging from io import StringIO @@ -88,14 +88,16 @@ def test_model_init(self): ) # Solve the debug model as is. Objective value should be $466769.69 - # Assumes availability of gurobi + # Assumes availability of HiGHS def test_solve_bigm(self): md = read_debug_model() modObject = ExpansionPlanningModel( data=md, num_reps=1, len_reps=1, num_commit=1, num_dispatch=1 ) modObject.create_model() - modObject.solve_model() + opt = SolverFactory("highs") + TransformationFactory("gdp.bigm").apply_to(modObject.model) + modObject.results = opt.solve(modObject.model, tee=False, load_solutions=True) modObject.report_model() self.assertAlmostEqual( value(modObject.model.total_cost_objective_rule), 483519.2, places=1