Skip to content

Commit

Permalink
Remove sets
Browse files Browse the repository at this point in the history
  • Loading branch information
luca-tomasini committed Dec 12, 2024
1 parent 353fae0 commit 76d5884
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion src/pyomo_models/baseline/second_stage/second_stage_pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,24 @@ def initialise_volume(self):

def generate_model(self):
self.model: pyo.AbstractModel = pyo.AbstractModel()
self.model = baseline_sets(self.model)
self.model.T = pyo.Set()
self.model.H = pyo.Set()
self.model.B = pyo.Set()
# index gathering the state per basin and the hydro powerplants
self.model.S_B = pyo.Set(self.model.B)
self.model.S_H = pyo.Set(self.model.H)
# index gathering the state of every basin and hydro powerplants
self.model.BS = pyo.Set(dimen=2, initialize=lambda model: [(b, s_b) for b in model.B for s_b in model.S_B[b]])
self.model.HS = pyo.Set(dimen=2, initialize=lambda model: [(h, s_h) for h in model.H for s_h in model.S_H[h]])

self.model.S_Q = pyo.Set(self.model.HS)
self.model.HQS = pyo.Set(
dimen=3, initialize=lambda model: [(h, s_h, s_q) for (h, s_h) in model.HS for s_q in model.S_Q[h, s_h]])

# index (gathering h, b, s_h, s_b) to make the correspondence between the state of basin and hydro powerplants
self.model.B_H = pyo.Set(self.model.H)
self.model.SB_H = pyo.Set(self.model.HS)
# self.model = baseline_sets(self.model)
self.model = baseline_parameters(self.model)
self.model = baseline_variables(self.model)

Expand Down

0 comments on commit 76d5884

Please sign in to comment.