Skip to content

Commit b7a2bc0

Browse files
committed
Merge branch 'main' of https://github.com/SECQUOIA/gdplib into reverse_electrodialysis
2 parents f18f349 + 752c834 commit b7a2bc0

File tree

13 files changed

+220
-69
lines changed

13 files changed

+220
-69
lines changed
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: Resolve Issue with OpenHands
2+
3+
on:
4+
issues:
5+
types: [labeled]
6+
pull_request:
7+
types: [labeled]
8+
issue_comment:
9+
types: [created]
10+
pull_request_review_comment:
11+
types: [created]
12+
pull_request_review:
13+
types: [submitted]
14+
15+
permissions:
16+
contents: write
17+
pull-requests: write
18+
issues: write
19+
20+
jobs:
21+
call-openhands-resolver:
22+
uses: All-Hands-AI/OpenHands/.github/workflows/openhands-resolver.yml@main
23+
with:
24+
macro: ${{ vars.OPENHANDS_MACRO || '@openhands-agent' }}
25+
max_iterations: ${{ fromJson(vars.OPENHANDS_MAX_ITER || 50) }}
26+
base_container_image: ${{ vars.OPENHANDS_BASE_CONTAINER_IMAGE || '' }}
27+
LLM_MODEL: ${{ vars.LLM_MODEL || 'anthropic/claude-3-5-sonnet-20241022' }}
28+
target_branch: ${{ vars.TARGET_BRANCH || 'main' }}
29+
secrets:
30+
PAT_TOKEN: ${{ secrets.PAT_TOKEN }}
31+
PAT_USERNAME: ${{ secrets.PAT_USERNAME }}
32+
LLM_API_KEY: ${{ secrets.LLM_API_KEY }}
33+
LLM_BASE_URL: ${{ secrets.LLM_BASE_URL }}

gdplib/biofuel/model.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
55
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.
66
It also optimizes transportation costs by managing both variable and fixed costs associated with active transportation routes.
7-
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).
7+
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).
88
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.
99
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.
1010

gdplib/cstr/README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,9 @@ The CSTRs have a single 1st order auto catalytic reaction A -> B and minimizes t
55
The optimal solution should yield NT reactors with a recycle before reactor NT.
66

77
Reference:
8-
> Linan, D. A., Bernal, D. E., Gomez, J. M., & Ricardez-Sandoval, L. A. (2021). Optimal synthesis and design of catalytic distillation columns: A rate-based modeling approach. Chemical Engineering Science, 231, 116294. https://doi.org/10.1016/j.ces.2020.116294
9-
8+
> Linan, D. A., Bernal, D. E., Gomez, J. M., & Ricardez-Sandoval, L. A. (2020). Optimal design of superstructures for placing units and streams with multiple and ordered available locations. Part I: A new mathematical framework. Computers & Chemical Engineering, 137, 106794.
9+
https://doi.org/10.1016/j.compchemeng.2020.106794
10+
1011
### Solution
1112

1213
Best known objective value: 3.06181298849707

gdplib/ex1_linan_2023/ex1_linan_2023.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22
ex1_linan_2023.py: Toy problem from Liñán and Ricardez-Sandoval (2023) [1]
33
44
The ex1_linan.py file is a simple optimization problem that involves two Boolean variables, two continuous variables, and a nonlinear objective function.
5-
The problem is formulated as a Generalized Disjunctive Programming (GDP) model.
6-
The Boolean variables are associated with disjuncts that define the feasible regions of the continuous variables.
5+
The problem is formulated as a Generalized Disjunctive Programming (GDP) model.
6+
The Boolean variables are associated with disjuncts that define the feasible regions of the continuous variables.
77
The problem includes logical constraints that ensure that only one Boolean variable is true at a time.
8-
Additionally, there are two disjunctions, one for each Boolean variable, where only one disjunct in each disjunction must be true.
8+
Additionally, there are two disjunctions, one for each Boolean variable, where only one disjunct in each disjunction must be true.
99
A specific logical constraint also enforces that Y1[3] must be false, making this particular disjunct infeasible.
1010
The objective function is -0.9995999999999999 when the continuous variables are alpha = 0 (Y1[2]=True) and beta=-0.7 (Y2[3]=True).
1111

gdplib/hda/HDA_GDP_gdpopt.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,23 @@
11
"""
22
HDA_GDP_gdpopt.py
3-
This model describes the profit maximization of a Hydrodealkylation of Toluene process, first presented in Reference [1], and later implemented as a GDP in Reference [2]. The MINLP formulation of this problem is available in GAMS, Reference [3].
3+
This model describes the profit maximization of a Hydrodealkylation of Toluene process, first presented in Reference [1], and later implemented as a GDP in Reference [2]. The MINLP formulation of this problem is available in GAMS, Reference [3].
44
5-
The chemical plant performed the hydro-dealkylation of toluene into benzene and methane. The flowsheet model was used to make decisions on choosing between alternative process units at various stages of the process. The resulting model is GDP model. The disjunctions in the model include:
6-
1. Inlet purify selection at feed
7-
2. Reactor operation mode selection (adiabatic / isothermal)
5+
The chemical plant performed the hydro-dealkylation of toluene into benzene and methane. The flowsheet model was used to make decisions on choosing between alternative process units at various stages of the process. The resulting model is GDP model. The disjunctions in the model include:
6+
1. Inlet purify selection at feed
7+
2. Reactor operation mode selection (adiabatic / isothermal)
88
3. Vapor recovery methane purge / recycle with membrane
9-
4. Vapor recovery hydrogen recycle
10-
5. Liquid separation system methane stabilizing via column or flash drum
9+
4. Vapor recovery hydrogen recycle
10+
5. Liquid separation system methane stabilizing via column or flash drum
1111
6. Liquid separation system toluene recovery via column or flash drum
1212
13-
The model enforces constraints to ensure that the mass and energy balances are satisfied, the purity of the products is within the required limits, the recovery specification are met, and the temperature and pressure conditions in the process units are maintained within the operational limits.
13+
The model enforces constraints to ensure that the mass and energy balances are satisfied, the purity of the products is within the required limits, the recovery specification are met, and the temperature and pressure conditions in the process units are maintained within the operational limits.
1414
15-
The objective of the model is to maximize the profit by determining the optimal process configuration and operating conditions. The decision variables include the number of trays in the absorber and distillation column, the reflux ratio, the pressure in the distillation column, the temperature and pressure in the flash drums, the heating requirement in the furnace, the electricity requirement in the compressor, the heat exchange in the coolers and heaters, the surface area in the membrane separators, the temperature and pressure in the mixers, the temperature and pressure in the reactors, and the volume and rate constant in the reactors.
15+
The objective of the model is to maximize the profit by determining the optimal process configuration and operating conditions. The decision variables include the number of trays in the absorber and distillation column, the reflux ratio, the pressure in the distillation column, the temperature and pressure in the flash drums, the heating requirement in the furnace, the electricity requirement in the compressor, the heat exchange in the coolers and heaters, the surface area in the membrane separators, the temperature and pressure in the mixers, the temperature and pressure in the reactors, and the volume and rate constant in the reactors.
1616
1717
References:
1818
[1] James M Douglas (1988). Conceptual Design of Chemical Processes, McGraw-Hill. ISBN-13: 978-0070177628
1919
[2] G.R. Kocis, and I.E. Grossmann (1989). Computational Experience with DICOPT Solving MINLP Problems in Process Synthesis. Computers and Chemical Engineering 13, 3, 307-315. https://doi.org/10.1016/0098-1354(89)85008-2
20-
[3] GAMS Development Corporation (2023). Hydrodealkylation Process. Available at: https://www.gams.com/latest/gamslib_ml/libhtml/gamslib_hda.html
20+
[3] GAMS Development Corporation (2023). Hydrodealkylation Process. Available at: https://www.gams.com/latest/gamslib_ml/libhtml/gamslib_hda.html
2121
"""
2222

2323
import math

gdplib/kaibel/kaibel_init.py

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,28 @@
11
"""
2-
Calculation of the theoretical minimum number of trays and initial
3-
temperature values.
4-
(written by E. Soraya Rawlings, esoraya@rwlngs.net)
5-
6-
The separation of four components require a sequence of at least three distillation
7-
columns. Here, we calculate the minimum number of theoretical trays for the three
8-
columns. The sequence is shown in Figure 2.
9-
10-
COLUMN 1 COLUMN 2 COLUMN 3
11-
----- ---- -----
12-
| | | | | |
13-
----- | A ----- | ----- |
14-
| |<---> B -- | |<----> A -- | |<---> A
15-
| | C | | | B | | |
16-
A | | | | | | | |
17-
B | | | | | | | |
18-
C --->| | -->| | -->| |
19-
D | | | | | |
20-
| | | | | |
21-
| |<- | |<- | |<-
22-
----- | ----- | ----- |
23-
| | | | | |
24-
-------> D -------> C -------> B
25-
Figure 2. Sequence of columns for the separation of a quaternary mixture
2+
Calculation of the theoretical minimum number of trays and initial
3+
temperature values.
4+
(written by E. Soraya Rawlings, esoraya@rwlngs.net)
5+
6+
The separation of four components require a sequence of at least three distillation
7+
columns. Here, we calculate the minimum number of theoretical trays for the three
8+
columns. The sequence is shown in Figure 2.
9+
10+
COLUMN 1 COLUMN 2 COLUMN 3
11+
----- ---- -----
12+
| | | | | |
13+
----- | A ----- | ----- |
14+
| |<---> B -- | |<----> A -- | |<---> A
15+
| | C | | | B | | |
16+
A | | | | | | | |
17+
B | | | | | | | |
18+
C --->| | -->| | -->| |
19+
D | | | | | |
20+
| | | | | |
21+
| |<- | |<- | |<-
22+
----- | ----- | ----- |
23+
| | | | | |
24+
-------> D -------> C -------> B
25+
Figure 2. Sequence of columns for the separation of a quaternary mixture
2626
"""
2727

2828
from __future__ import division

gdplib/kaibel/kaibel_prop.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
""" Properties of the system """
1+
"""Properties of the system"""
22

33
from pyomo.environ import ConcreteModel
44

gdplib/kaibel/kaibel_side_flash.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
""" Side feed flash """
1+
"""Side feed flash"""
22

33
from pyomo.environ import (
44
ConcreteModel,

gdplib/kaibel/kaibel_solve_gdp.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
""" Kaibel Column model: GDP formulation.
1+
"""Kaibel Column model: GDP formulation.
22
33
The solution requires the specification of certain parameters, such as the number trays, feed location, etc., and an initialization procedure, which consists of the next three steps:
4-
(i) a preliminary design of the separation considering a sequence of indirect continuous distillation columns (CDCs) to obtain the minimum number of stages with Fenske Equation in the function initialize_kaibel in kaibel_init.py
4+
(i) a preliminary design of the separation considering a sequence of indirect continuous distillation columns (CDCs) to obtain the minimum number of stages with Fenske Equation in the function initialize_kaibel in kaibel_init.py
55
(ii) flash calculation for the feed with the function calc_side_feed_flash in kaibel_side_flash.py
66
(iii) calculation of variable bounds by solving the NLP problem.
77

gdplib/mod_hens/modular_discrete.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ def build_modular_option(cafaro_approx, num_stages):
8181
"""
8282
m = build_model(cafaro_approx, num_stages)
8383

84-
# Optimize for the least cost configuration across all stages and matche
84+
# Optimize for the least cost configuration across all stages and matches
8585
for hot, cold in m.valid_matches:
8686
lowest_price = float('inf')
8787
for size in sorted(m.possible_sizes, reverse=True):

0 commit comments

Comments
 (0)