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

Add water_network instance #59

Open
wants to merge 21 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 12 commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
fffd81c
Add water_network instance
tristantc Sep 3, 2024
f784ca0
Upload README.md
tristantc Sep 3, 2024
8b5f14a
Remove water_network module and update dependencies
tristantc Sep 4, 2024
119b246
Merge branch 'main' into water_network
tristantc Sep 10, 2024
435b80c
Add `ue` in typos.toml to prevent typo flags.
tristantc Sep 10, 2024
b69965c
Update README.md with best known objective value and component sizes
tristantc Sep 10, 2024
6ea4d16
Shifted `README.md` to the `water_network` directory
tristantc Sep 10, 2024
eae3d93
Delet `README.md` from `gdplib` directory.
tristantc Sep 10, 2024
ac2397b
Remove unused import statement in wnd.py
tristantc Sep 10, 2024
d6b9cba
Refactor import statements in wnd.py
tristantc Sep 10, 2024
88c7b6d
Remove comments in `wnd.py`
tristantc Sep 10, 2024
cd21c07
Refactor README.md in water_network directory
tristantc Sep 10, 2024
6e3333c
Refactor capital cost approximation in `wnd.py`
tristantc Sep 16, 2024
ac4acae
Refactor README.md in `water_network` directory
tristantc Sep 16, 2024
d9a3031
Fixed typo in README.md
tristantc Sep 16, 2024
13d7a7c
Refactor references in README.md
tristantc Oct 9, 2024
325890c
Remove commented `bounds` in `ue.conc`
tristantc Oct 10, 2024
493365f
Update `ue` to `unit_exists` in `wnd.py` for better clarity.
tristantc Oct 10, 2024
3d68a25
Rename `quadratic2` and `quadratic` in `wnd.py`
tristantc Oct 10, 2024
ab9db0c
Refactor quadratic approximations in README.md
tristantc Oct 10, 2024
da82210
Refactor references in `wnd.py`
tristantc Oct 10, 2024
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"
ue = "ue"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is ue?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ue stands for unit_exists

1 change: 1 addition & 0 deletions benchmark.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ def benchmark(model, strategy, timelimit, result_dir, subsolver="scip"):
# "modprodnet",
# "stranded_gas",
# "syngas",
# "water_network",
]
strategy_list = [
"gdp.bigm",
Expand Down
1 change: 1 addition & 0 deletions gdplib/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import gdplib.disease_model
import gdplib.med_term_purchasing
import gdplib.syngas
import gdplib.water_network
import gdplib.ex1_linan_2023
import gdplib.small_batch
import gdplib.cstr
63 changes: 63 additions & 0 deletions gdplib/water_network/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
## Water Network Design

In the Water Treatment Network (WTN) design problem, given is a set of water streams with known concentrations of contaminants and flow rate.
The objective is to find the set of treatment units and interconnections that minimize the cost of the WTN while satisfying maximum concentrations of contaminants in the reclaimed outlet stream.
The WTN superstructure consists of a set of treatment units, contaminated feed streams carrying a set of contaminants, and a discharge unit.
The fouled feed waters can be allocated to one or more treatment units or disposed of in the sink unit. Upon treatment, the reclaimed streams can be recycled, forwarded to other treatment units, or discharged into the sink unit.

The mass balances are defined in terms of total flows and contaminants concentration.
Nonconvexities arise from bilinear terms “flows times concentration” in the mixers mass balances and concave investment cost functions of treatment units.

The instance incorporates two approximations of the concave cost term (piecewise linear and quadratic) to reformulate the GDP model into a bilinear quadratic one.
The user can create each instance like this:

```
build_model(approximation='quadratic')
build_model(approximation='piecewise')
```

The general model description can be summarized as follows:
Min Cost of Treatment Units
s.t.
Physical Constraints:
(a) Mass balance around each splitter
(b) Mass balance around each mixer
(c) Mass balance around each treatment unit
Performance Constraints:
(d) Contaminant composition of the purified stream less or equal than a given limit
for each contaminant.
Logic Constraints:
(e) Treatment units not chosen have their inlet flow set to zero
(f) Every treatment unit chosen must have a minimum flow

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.

### 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 in the purified stream, are reported in [1].

### Solution

Best known objective value: $ 348,340

### Size

| Component | pwl | quadratic |
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about the original one?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Chose not to upload the MINLP model because it's not a GDP model, but a GAMS model transformed into pyomo or are you asking about the model size table?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I incorporated the original model without any approximation.

| :-------------------- | :--: | :-------: |
| variables | 1405 | 420 |
| binary_variables | 510 | 10 |
| integer_variables | 0 | 0 |
| continuous_variables | 895 | 410 |
| disjunctions | 5 | 5 |
| disjuncts | 10 | 10 |
| constraints | 1339 | 334 |
| nonlinear_constraints | 28 | 33 |

### References

> [1] Ruiz J., Grossmann I. E. 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
>
> [2] Ruiz, J., & 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
5 changes: 5 additions & 0 deletions gdplib/water_network/T.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
cont,T
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The CSV file looks small. Maybe instead of creating the CSV file, we should define a dictionary in the Python script. This also applies to TU.csv and feed.csv.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We would like to scale this instance to more cases, so I rather leave all in CSVs

A,3
B,3
C,3
D,3
6 changes: 6 additions & 0 deletions gdplib/water_network/TU.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
TU,A,B,C,D,L,theta,beta
t1,0.95,0.95,0.6,0.0,5,1500,8000
t2,0.08,0.8,0.6,0.0,3,1000,8000
t3,0.0,0.6,0.95,0.95,4,4000,8000
t4,0.0,0.6,0.8,0.85,3,3000,8000
t5,0.0,0.6,0.85,0.8,1,3000,8000
3 changes: 3 additions & 0 deletions gdplib/water_network/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
from .wnd import build_model

__all__ = ['build_model']
6 changes: 6 additions & 0 deletions gdplib/water_network/feed.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
FSU,A,B,C,D,flow_rate
fs1,1.0,1.0,1.0,1.0,10
fs2,1.3333333333333333,0.0,0.0,0.6666666666666666,15
fs3,2.0,2.0,0.0,4.0,5
fs4,1.5,0.5,0.5,0.0,20
fs5,2.0,2.0,0.0,0.0,10
Loading
Loading