Skip to content
Merged
Show file tree
Hide file tree
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
1 change: 1 addition & 0 deletions .github/workflows/typos.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@
hda = "hda"
HDA = "HDA"
equil = "equil"
gam = "gam"
18 changes: 8 additions & 10 deletions benchmark.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import os
import json
import time
import sys
from contextlib import redirect_stdout
from datetime import datetime
from importlib import import_module
from pyomo.environ import *
Expand All @@ -28,14 +28,13 @@ def benchmark(model, strategy, timelimit, result_dir, subsolver="scip"):
None
"""
model = model.clone()
stdout = sys.stdout
log_path = os.path.join(result_dir, f"{strategy}_{subsolver}.log")
json_path = os.path.join(result_dir, f"{strategy}_{subsolver}.json")
if strategy in ["gdp.bigm", "gdp.hull"]:
transformation_start_time = time.time()
TransformationFactory(strategy).apply_to(model)
transformation_end_time = time.time()
with open(
result_dir + "/" + strategy + "_" + subsolver + ".log", "w"
) as sys.stdout:
with open(log_path, "w") as log_file, redirect_stdout(log_file):
results = SolverFactory(subsolver).solve(
model, tee=True, timelimit=timelimit
)
Expand All @@ -50,9 +49,7 @@ def benchmark(model, strategy, timelimit, result_dir, subsolver="scip"):
"gdpopt.lbb",
"gdpopt.ric",
]:
with open(
result_dir + "/" + strategy + "_" + subsolver + ".log", "w"
) as sys.stdout:
with open(log_path, "w") as log_file, redirect_stdout(log_file):
results = SolverFactory(strategy).solve(
model,
tee=True,
Expand All @@ -63,9 +60,10 @@ def benchmark(model, strategy, timelimit, result_dir, subsolver="scip"):
time_limit=timelimit,
)
print(results)
else:
raise ValueError(f"Unknown benchmark strategy: {strategy}")

sys.stdout = stdout
with open(result_dir + "/" + strategy + "_" + subsolver + ".json", "w") as f:
with open(json_path, "w") as f:
json.dump(results.json_repn(), f)
return None

Expand Down
2 changes: 1 addition & 1 deletion gdplib/biofuel/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

The model enforces constraints to ensure that raw material supplies do not exceed available amounts, product shipments meet market demands exactly, and production at each site matches outgoing shipments and available resources.
It also optimizes transportation costs by managing both variable and fixed costs associated with active transportation routes.
The disjunctions in the model define the operational modes for facility sites (modular, conventional, or inactive) and the activity status of supply and product routes (active or inactive).
The disjunctions in the model define the operational modes for facility sites (modular, conventional, or inactive) and the activity status of supply and product routes (active or inactive).
These elements allow the model to simulate different operational scenarios and strategic decisions, optimizing the network's layout and logistics based on economic and market conditions.
The objective of the model is to optimize the network layout and production allocation to minimize total costs, which include setup and teardown of facilities, production costs, and transportation costs.

Expand Down
6 changes: 3 additions & 3 deletions gdplib/gdp_col/initialize.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,9 @@ def set_value_if_not_fixed(var, val):
for i in range(1, num_active_trays)
]
for tray in range(2, num_active_trays):
indx = new_indices[tray - 1]
lower = floor(indx)
frac_above = indx - lower
index = new_indices[tray - 1]
lower = floor(index)
frac_above = index - lower
# Take linear combination of values
tray_indexed_data.loc[tray] = (
tray_indexed_data.loc[lower] * (1 - frac_above)
Expand Down
2 changes: 1 addition & 1 deletion gdplib/hda/HDA_GDP_gdpopt.py
Original file line number Diff line number Diff line change
Expand Up @@ -1416,7 +1416,7 @@ def Relvol(_m, dist_):
return m.avevlt[dist] == sqrt(divided1 * divided2)
return Constraint.Skip

b.relvol = Constraint([dist], rule=Relvol, doc='average relative volatilty')
b.relvol = Constraint([dist], rule=Relvol, doc='average relative volatility')

def Undwood(_m, dist_):
if dist_ == dist:
Expand Down
5 changes: 4 additions & 1 deletion gdplib/kaibel/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ Source paper:

> Rawlings, E. S., Chen, Q., Grossmann, I. E., & Caballero, J. A. (2019). Kaibel Column: Modeling, optimization, and conceptual design of multi-product dividing wall columns. *Computers and Chemical Engineering*, 125, 31–39. https://doi.org/10.1016/j.compchemeng.2019.03.006

Heat-capacity and enthalpy calculations use the Ruzicka-Domalski group-additivity heat-capacity method:

> Ruzicka, V. Jr., & Domalski, E. S. Estimation of the heat capacities of organic liquids as a function of temperature using group additivity. *Journal of Physical and Chemical Reference Data*, 22(3). https://www.osti.gov/biblio/6251468

## Problem Details

### Solution
Expand All @@ -30,4 +34,3 @@ Best known objective value: 99,709
- ``disjtn``: disjunctions



Loading
Loading