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
33 changes: 33 additions & 0 deletions .github/workflows/openhands-resolver.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Resolve Issue with OpenHands

on:
issues:
types: [labeled]
pull_request:
types: [labeled]
issue_comment:
types: [created]
pull_request_review_comment:
types: [created]
pull_request_review:
types: [submitted]

permissions:
contents: write
pull-requests: write
issues: write

jobs:
call-openhands-resolver:
uses: All-Hands-AI/OpenHands/.github/workflows/openhands-resolver.yml@main
with:
macro: ${{ vars.OPENHANDS_MACRO || '@openhands-agent' }}
max_iterations: ${{ fromJson(vars.OPENHANDS_MAX_ITER || 50) }}
base_container_image: ${{ vars.OPENHANDS_BASE_CONTAINER_IMAGE || '' }}
LLM_MODEL: ${{ vars.LLM_MODEL || 'anthropic/claude-3-5-sonnet-20241022' }}
target_branch: ${{ vars.TARGET_BRANCH || 'main' }}
secrets:
PAT_TOKEN: ${{ secrets.PAT_TOKEN }}
PAT_USERNAME: ${{ secrets.PAT_USERNAME }}
LLM_API_KEY: ${{ secrets.LLM_API_KEY }}
LLM_BASE_URL: ${{ secrets.LLM_BASE_URL }}
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/ex1_linan_2023/ex1_linan_2023.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
ex1_linan_2023.py: Toy problem from Liñán and Ricardez-Sandoval (2023) [1]

The ex1_linan.py file is a simple optimization problem that involves two Boolean variables, two continuous variables, and a nonlinear objective function.
The problem is formulated as a Generalized Disjunctive Programming (GDP) model.
The Boolean variables are associated with disjuncts that define the feasible regions of the continuous variables.
The problem is formulated as a Generalized Disjunctive Programming (GDP) model.
The Boolean variables are associated with disjuncts that define the feasible regions of the continuous variables.
The problem includes logical constraints that ensure that only one Boolean variable is true at a time.
Additionally, there are two disjunctions, one for each Boolean variable, where only one disjunct in each disjunction must be true.
Additionally, there are two disjunctions, one for each Boolean variable, where only one disjunct in each disjunction must be true.
A specific logical constraint also enforces that Y1[3] must be false, making this particular disjunct infeasible.
The objective function is -0.9995999999999999 when the continuous variables are alpha = 0 (Y1[2]=True) and beta=-0.7 (Y2[3]=True).

Expand Down
18 changes: 9 additions & 9 deletions gdplib/hda/HDA_GDP_gdpopt.py
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
"""
HDA_GDP_gdpopt.py
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].
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].

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:
1. Inlet purify selection at feed
2. Reactor operation mode selection (adiabatic / isothermal)
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:
1. Inlet purify selection at feed
2. Reactor operation mode selection (adiabatic / isothermal)
3. Vapor recovery methane purge / recycle with membrane
4. Vapor recovery hydrogen recycle
5. Liquid separation system methane stabilizing via column or flash drum
4. Vapor recovery hydrogen recycle
5. Liquid separation system methane stabilizing via column or flash drum
6. Liquid separation system toluene recovery via column or flash drum

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.
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.

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.
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.

References:
[1] James M Douglas (1988). Conceptual Design of Chemical Processes, McGraw-Hill. ISBN-13: 978-0070177628
[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
[3] GAMS Development Corporation (2023). Hydrodealkylation Process. Available at: https://www.gams.com/latest/gamslib_ml/libhtml/gamslib_hda.html
[3] GAMS Development Corporation (2023). Hydrodealkylation Process. Available at: https://www.gams.com/latest/gamslib_ml/libhtml/gamslib_hda.html
"""

import math
Expand Down
48 changes: 24 additions & 24 deletions gdplib/kaibel/kaibel_init.py
Original file line number Diff line number Diff line change
@@ -1,28 +1,28 @@
"""
Calculation of the theoretical minimum number of trays and initial
temperature values.
(written by E. Soraya Rawlings, esoraya@rwlngs.net)

The separation of four components require a sequence of at least three distillation
columns. Here, we calculate the minimum number of theoretical trays for the three
columns. The sequence is shown in Figure 2.

COLUMN 1 COLUMN 2 COLUMN 3
----- ---- -----
| | | | | |
----- | A ----- | ----- |
| |<---> B -- | |<----> A -- | |<---> A
| | C | | | B | | |
A | | | | | | | |
B | | | | | | | |
C --->| | -->| | -->| |
D | | | | | |
| | | | | |
| |<- | |<- | |<-
----- | ----- | ----- |
| | | | | |
-------> D -------> C -------> B
Figure 2. Sequence of columns for the separation of a quaternary mixture
Calculation of the theoretical minimum number of trays and initial
temperature values.
(written by E. Soraya Rawlings, esoraya@rwlngs.net)

The separation of four components require a sequence of at least three distillation
columns. Here, we calculate the minimum number of theoretical trays for the three
columns. The sequence is shown in Figure 2.

COLUMN 1 COLUMN 2 COLUMN 3
----- ---- -----
| | | | | |
----- | A ----- | ----- |
| |<---> B -- | |<----> A -- | |<---> A
| | C | | | B | | |
A | | | | | | | |
B | | | | | | | |
C --->| | -->| | -->| |
D | | | | | |
| | | | | |
| |<- | |<- | |<-
----- | ----- | ----- |
| | | | | |
-------> D -------> C -------> B
Figure 2. Sequence of columns for the separation of a quaternary mixture
"""

from __future__ import division
Expand Down
2 changes: 1 addition & 1 deletion gdplib/kaibel/kaibel_prop.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
""" Properties of the system """
"""Properties of the system"""

from pyomo.environ import ConcreteModel

Expand Down
2 changes: 1 addition & 1 deletion gdplib/kaibel/kaibel_side_flash.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
""" Side feed flash """
"""Side feed flash"""

from pyomo.environ import (
ConcreteModel,
Expand Down
4 changes: 2 additions & 2 deletions gdplib/kaibel/kaibel_solve_gdp.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
""" Kaibel Column model: GDP formulation.
"""Kaibel Column model: GDP formulation.

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:
(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
(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
(ii) flash calculation for the feed with the function calc_side_feed_flash in kaibel_side_flash.py
(iii) calculation of variable bounds by solving the NLP problem.

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

[1] Vecchietti, A., & Grossmann, I. E. (1997). LOGMIP: a disjunctive 0-1 nonlinear optimizer for process systems models. Computers & chemical engineering, 21, S427-S432. https://doi.org/10.1016/S0098-1354(97)87539-4
[2] Brink, A., & Westerlund, T. (1995). The joint problem of model structure determination and parameter estimation in quantitative IR spectroscopy. Chemometrics and intelligent laboratory systems, 29(1), 29-36. https://doi.org/10.1016/0169-7439(95)00033-3

Optimal value: 12.0893
"""

Expand Down
6 changes: 3 additions & 3 deletions gdplib/stranded_gas/model.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
"""
model.py
Pyomo ConcreteModel for optimizing a modular stranded gas processing network.
Pyomo ConcreteModel for optimizing a modular stranded gas processing network.

The model is designed to convert stranded gas into gasoline using a modular and intensified GTL process.
The model is designed to convert stranded gas into gasoline using a modular and intensified GTL process.
It incorporates the economic dynamics of module investments, gas processing, and product transportation.
Constraints manage the balance of gas supply and consumption, module availability and movement, and production capacities at potential sites.
Constraints manage the balance of gas supply and consumption, module availability and movement, and production capacities at potential sites.
Disjunctions delineate operational scenarios, such as the existence or absence of pipelines and the activation status of sites, enabling dynamic and flexible system configuration.
The objective function aims to maximize the network's net profit by optimizing revenue from gasoline sales while minimizing operational and capital expenditures across the network.

Expand Down
6 changes: 3 additions & 3 deletions gdplib/water_network/wnd.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,18 +36,18 @@

Assumptions:
(i) The performance of the treatment units only depends on the total flow entering the unit and its composition.
(ii) The flow of contaminants leaving the unit is a linear function of the inlet flow of contaminants.
(ii) The flow of contaminants leaving the unit is a linear function of the inlet flow of contaminants.

Case study
----------
The WTN comprises five inlet streams with four contaminants and four treatment units.
The contaminant concentration and flow rate of the feed streams, contaminant recovery rates, minimum flow rate and cost coefficients of the treatment units, and the upper limit on the molar flow of contaminant j in the purified stream, are reported in (Ruiz and Grossmann, 2009).

References
----------
----------
Tristán C., Fallanza M., Ibáñez R., Grossmann I. E., and Bernal Neira D. E. (2024). Global Optimization via Quadratic Disjunctive Programming for Water Networks Design with Energy Recovery. Computer Aided Chemical Engineering, 53, 2161–2166. https://doi.org/10.1016/B978-0-443-28824-1.50361-6

Ruiz J., Grossmann IE. Water Treatment Network Design. 2009 Available from CyberInfrastructure for [MINLP](<www.minlp.org>), a collaboration of Carnegie Mellon University and IBM
Ruiz J., Grossmann IE. Water Treatment Network Design. 2009 Available from CyberInfrastructure for [MINLP](<www.minlp.org>), a collaboration of Carnegie Mellon University and IBM
at: www.minlp.org/library/problem/index.php?i=24

Ruiz, J. P., & Grossmann, I. E. (2011). Using redundancy to strengthen the relaxation for the global optimization of MINLP problems. Computers & Chemical Engineering, 35(12), 2729–2740. https://doi.org/10.1016/J.COMPCHEMENG.2011.01.035
Expand Down