From 3cb1911a1a45ddf4dcfd19ff96e6d0be9507d62c Mon Sep 17 00:00:00 2001 From: Sam Dotson Date: Wed, 28 Feb 2024 20:40:58 -0600 Subject: [PATCH] adds solver param to capacityexpansion --- osier/models/capacity_expansion.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/osier/models/capacity_expansion.py b/osier/models/capacity_expansion.py index 55d6c2e..06de188 100644 --- a/osier/models/capacity_expansion.py +++ b/osier/models/capacity_expansion.py @@ -69,6 +69,9 @@ class CapacityExpansion(ElementwiseProblem): verbosity : Optional, int Sets the logging level for the simulation. Accepts `logging.LEVEL` or integer where LEVEL is {10:DEBUG, 20:INFO, 30:WARNING, 40:ERROR, 50:CRITICAL}. + solver : str + Indicates which solver to use. May require separate installation. + Accepts: ['cplex', 'cbc', 'glpk']. Other solvers will be added in the future. Notes ----- @@ -94,6 +97,7 @@ def __init__(self, curtailment=True, allow_blackout=False, verbosity=50, + solver='cplex', **kwargs): self.technology_list = deepcopy(technology_list) self.demand = demand @@ -105,6 +109,7 @@ def __init__(self, self.curtailment = curtailment self.allow_blackout = allow_blackout self.verbosity = verbosity + self.solver = solver if isinstance(demand, unyt_array): self.power_units = demand.units @@ -185,7 +190,9 @@ def _evaluate(self, x, out, *args, **kwargs): net_demand=net_demand, power_units=self.power_units, curtailment=self.curtailment, - allow_blackout=self.allow_blackout) + allow_blackout=self.allow_blackout, + solver=self.solver, + verbosity=self.verbosity) model.solve() if model.results is not None: