Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replacing __getitem__() with at() for ordered sets, Part II #244

Merged
merged 1 commit into from
Aug 23, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions egret/model_library/unit_commitment/params.py
Original file line number Diff line number Diff line change
Expand Up @@ -865,18 +865,18 @@ def startup_costs_init_rule(m, g):

# startup lags must be monotonically increasing...
def validate_startup_lags_rule(m, g):
startup_lags = list(m.StartupLags[g])
startup_lags = m.StartupLags[g]

if len(startup_lags) == 0:
print("DATA ERROR: The number of startup lags for thermal generator="+str(g)+" must be >= 1.")
assert(False)

if startup_lags[0] != value(m.MinimumDownTime[g]):
if startup_lags.at(1) != value(m.MinimumDownTime[g]):
print("DATA ERROR: The first startup lag for thermal generator="+str(g)+" must be equal the minimum down time="+str(value(m.MinimumDownTime[g]))+".")
assert(False)

for i in range(0, len(startup_lags)-1):
if startup_lags[i] >= startup_lags[i+1]:
for i in range(1, len(startup_lags)):
if startup_lags.at(i) >= startup_lags.at(i+1):
print("DATA ERROR: Startup lags for thermal generator="+str(g)+" must be monotonically increasing.")
assert(False)

Expand All @@ -885,8 +885,8 @@ def validate_startup_lags_rule(m, g):
# while startup costs must be monotonically non-decreasing!
def validate_startup_costs_rule(m, g):
startup_costs = m.StartupCosts[g]
for i in range(1, len(startup_costs)-1):
if startup_costs[i] > startup_costs[i+1]:
for i in range(1, len(startup_costs)):
if startup_costs.at(i) > startup_costs.at(i+1):
print("DATA ERROR: Startup costs for thermal generator="+str(g)+" must be monotonically non-decreasing.")
assert(False)

Expand Down