Skip to content

Commit

Permalink
adds solver param to capacityexpansion
Browse files Browse the repository at this point in the history
  • Loading branch information
samgdotson committed Feb 29, 2024
1 parent f6546ee commit 3cb1911
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion osier/models/capacity_expansion.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
-----
Expand All @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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:
Expand Down

0 comments on commit 3cb1911

Please sign in to comment.