diff --git a/.gitignore b/.gitignore index b9c4f32..3560916 100644 --- a/.gitignore +++ b/.gitignore @@ -132,3 +132,4 @@ dmypy.json .idea/ gdplib/*/benchmark_result/ +gdplib/*/model_size_report.md \ No newline at end of file diff --git a/gdplib/batch_processing/README.md b/gdplib/batch_processing/README.md new file mode 100644 index 0000000..599d615 --- /dev/null +++ b/gdplib/batch_processing/README.md @@ -0,0 +1,27 @@ +# Batch Processing Optimization Problem + +The model is designed to minimize the total cost associated with the design and operation of a plant consisting of multiple parallel processing units with intermediate storage tanks. It involves determining the optimal number and sizes of processing units, batch sizes for different products at various stages, and sizes and placements of storage tanks to ensure operational efficiency while meeting production requirements within a specified time horizon. + +## Problem Details +### Optimal Solution + +TODO + +### Size + +| Component | Number | +|:----------------------|---------:| +| Variables | 288 | +| Binary variables | 138 | +| Integer variables | 0 | +| Continuous variables | 150 | +| Disjunctions | 9 | +| Disjuncts | 18 | +| Constraints | 601 | +| Nonlinear constraints | 1 | + + +## References +> [1] Ravemark, E. Optimization models for design and operation of chemical batch processes. Ph.D. Thesis, ETH Zurich, 1995. https://doi.org/10.3929/ethz-a-001591449 +> +> [2] Vecchietti, A., & Grossmann, I. E. (1999). LOGMIP: a disjunctive 0–1 non-linear optimizer for process system models. Computers & chemical engineering, 23(4-5), 555-565. https://doi.org/10.1016/S0098-1354(97)87539-4 \ No newline at end of file diff --git a/gdplib/biofuel/README.md b/gdplib/biofuel/README.md index d195ebc..d1dacf2 100644 --- a/gdplib/biofuel/README.md +++ b/gdplib/biofuel/README.md @@ -17,12 +17,13 @@ Adapted from: Optimal objective value: 4067 ### Size -- Variables: 36804 - - Boolean: 516 - - Binary: 0 - - Integer: 4320 - - Continuous: 31968 -- Constraints: 12884 - - Nonlinear: 12 -- Disjuncts: 516 -- Disjunctions: 252 +| Component | Number | +|:----------------------|---------:| +| Variables | 36840 | +| Binary variables | 516 | +| Integer variables | 4356 | +| Continuous variables | 31968 | +| Disjunctions | 252 | +| Disjuncts | 516 | +| Constraints | 12884 | +| Nonlinear constraints | 12 | \ No newline at end of file diff --git a/gdplib/cstr/README.md b/gdplib/cstr/README.md index 18882a4..088ef45 100644 --- a/gdplib/cstr/README.md +++ b/gdplib/cstr/README.md @@ -7,7 +7,9 @@ The optimal solution should yield NT reactors with a recycle before reactor NT. Reference: > 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 -### Solution +## Problem Details + +### Optimal Solution Best known objective value: 3.06181298849707 @@ -15,16 +17,13 @@ Best known objective value: 3.06181298849707 Number of reactors in series is 5. -| Problem | vars | Bool | bin | int | cont | cons | nl | disj | disjtn | -|-----------|------|------|-----|-----|------|------|----|------|--------| -| gdp_reactors | 71 | 15 | 0 | 0 | 56 | 25 | 2 | 20 | 10 | - -- ``vars``: variables -- ``Bool``: Boolean variables -- ``bin``: binary variables -- ``int``: integer variables -- ``cont``: continuous variables -- ``cons``: constraints -- ``nl``: nonlinear constraints -- ``disj``: disjuncts -- ``disjtn``: disjunctions \ No newline at end of file +| Component | Number | +|:----------------------|---------:| +| Variables | 76 | +| Binary variables | 20 | +| Integer variables | 0 | +| Continuous variables | 56 | +| Disjunctions | 10 | +| Disjuncts | 20 | +| Constraints | 100 | +| Nonlinear constraints | 17 | \ No newline at end of file diff --git a/gdplib/disease_model/README.md b/gdplib/disease_model/README.md new file mode 100644 index 0000000..f3deac7 --- /dev/null +++ b/gdplib/disease_model/README.md @@ -0,0 +1,21 @@ +# SIR Disease Model +This is the SIR disease model using a low/high transmission parameter. The model simulates the spread of an infectious disease over a series of bi-weekly periods, using a disjunctive programming approach to account for variations in disease transmission rates. + +## Problem details + +### Optimal Solution + +### Size + +| Component | Number | +|:----------------------|---------:| +| Variables | 1250 | +| Binary variables | 52 | +| Integer variables | 0 | +| Continuous variables | 1198 | +| Disjunctions | 26 | +| Disjuncts | 52 | +| Constraints | 831 | +| Nonlinear constraints | 0 | + +## References diff --git a/gdplib/ex1_linan_2023/README.md b/gdplib/ex1_linan_2023/README.md index b290964..df60d63 100644 --- a/gdplib/ex1_linan_2023/README.md +++ b/gdplib/ex1_linan_2023/README.md @@ -1,4 +1,4 @@ -## Example 1 Problem of Liñán (2023) +# Example 1 Problem of Liñán (2023) The Example 1 Problem of Liñán (2023) 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. @@ -8,11 +8,23 @@ The objective function is `-0.9995999999999999` when the continuous variables ar The objective function originates from Problem No. 6 of Gomez's paper, and Liñán introduced logical propositions, logical disjunctions, and the following equations as constraints. -### References +## Problem details + +### Size + +| Component | Number | +|:----------------------|---------:| +| Variables | 12 | +| Binary variables | 10 | +| Integer variables | 0 | +| Continuous variables | 2 | +| Disjunctions | 2 | +| Disjuncts | 10 | +| Constraints | 10 | +| Nonlinear constraints | 0 | + +## References > [1] Liñán, D. A., & Ricardez-Sandoval, L. A. (2023). A Benders decomposition framework for the optimization of disjunctive superstructures with ordered discrete decisions. AIChE Journal, 69(5), e18008. https://doi.org/10.1002/aic.18008 > > [2] Gomez, S., & Levy, A. V. (1982). The tunnelling method for solving the constrained global optimization problem with several non-connected feasible regions. In Numerical Analysis: Proceedings of the Third IIMAS Workshop Held at Cocoyoc, Mexico, January 1981 (pp. 34-47). Springer Berlin Heidelberg. https://doi.org/10.1007/BFb0092958 - - ---- diff --git a/gdplib/gdp_col/README.md b/gdplib/gdp_col/README.md index 928b448..bd4fa60 100644 --- a/gdplib/gdp_col/README.md +++ b/gdplib/gdp_col/README.md @@ -14,16 +14,13 @@ Best known objective value: 19,430 ### Size -| Problem | vars | Bool | bin | int | cont | cons | nl | disj | disjtn | -|-----------|------|------|-----|-----|------|------|----|------|--------| -| gdp_col | 433 | 28 | 0 | 0 | 405 | 603 | 255 | 28 | 15 | - -- ``vars``: variables -- ``Bool``: Boolean variables -- ``bin``: binary variables -- ``int``: integer variables -- ``cont``: continuous variables -- ``cons``: constraints -- ``nl``: nonlinear constraints -- ``disj``: disjuncts -- ``disjtn``: disjunctions +| Component | Number | +|:----------------------|---------:| +| Variables | 442 | +| Binary variables | 30 | +| Integer variables | 0 | +| Continuous variables | 412 | +| Disjunctions | 15 | +| Disjuncts | 30 | +| Constraints | 610 | +| Nonlinear constraints | 262 | diff --git a/gdplib/hda/README.md b/gdplib/hda/README.md index c9d7d71..71fbc11 100644 --- a/gdplib/hda/README.md +++ b/gdplib/hda/README.md @@ -12,23 +12,20 @@ The MINLP formulation of this problem is available in GAMS https://www.gams.com/ This model was reimplemented by Yunshan Liu @Yunshan-Liu . ## Problem Details -### Solution +### Optimal Solution Best known objective value: 5801.27 ### Size -| Problem | vars | Bool | bin | int | cont | cons | nl | disj | disjtn | -|-----------|------|------|-----|-----|------|------|----|------|--------| -| HDA Model | 721 | 12 | 0 | 0 | 709 | 728 | 151 | 12 | 6 | - -- ``vars``: variables -- ``Bool``: Boolean variables -- ``bin``: binary variables -- ``int``: integer variables -- ``cont``: continuous variables -- ``cons``: constraints -- ``nl``: nonlinear constraints -- ``disj``: disjuncts -- ``disjtn``: disjunctions +| Component | Number | +|:----------------------|---------:| +| Variables | 1158 | +| Binary variables | 12 | +| Integer variables | 0 | +| Continuous variables | 1146 | +| Disjunctions | 6 | +| Disjuncts | 12 | +| Constraints | 728 | +| Nonlinear constraints | 151 | \ No newline at end of file diff --git a/gdplib/jobshop/README.md b/gdplib/jobshop/README.md new file mode 100644 index 0000000..dc58d04 --- /dev/null +++ b/gdplib/jobshop/README.md @@ -0,0 +1,25 @@ +# GDP Distillation Column Design + +This model solves a jobshop scheduling, which has a set of jobs which must be processed in sequence of stages but not all jobs require all stages. A zero wait transfer policy is assumed between stages. To obtain a feasible solution it is necessary to eliminate all clashes between jobs. It requires that no two jobs be performed at any stage at any time. The objective is to minimize the makespan, the time to complete all jobs. + +## Problem Details + +### Optimal Solution + +### Size + +| Component | Number | +|:----------------------|---------:| +| Variables | 10 | +| Binary variables | 6 | +| Integer variables | 0 | +| Continuous variables | 4 | +| Disjunctions | 3 | +| Disjuncts | 6 | +| Constraints | 9 | +| Nonlinear constraints | 0 | + +## References + +> [1] Raman & Grossmann, Modelling and computational techniques for logic based integer programming, Computers and Chemical Engineering 18, 7, p.563-578, 1994. DOI: 10.1016/0098-1354(93)E0010-7. +> [2] Aldo Vecchietti, LogMIP User's Manual, http://www.logmip.ceride.gov.ar/, 2007 \ No newline at end of file diff --git a/gdplib/kaibel/README.md b/gdplib/kaibel/README.md index c3f480d..59a820f 100644 --- a/gdplib/kaibel/README.md +++ b/gdplib/kaibel/README.md @@ -15,19 +15,13 @@ Best known objective value: 99,709 ### Size -| Problem | vars | Bool | bin | int | cont | cons | nl | disj | disjtn | -|-----------|------|------|-----|-----|------|------|----|------|--------| -| Kaibel Column | 3605 | 178 | 0 | 0 | 3427 | 5715 | 2124 | 182 | 100 | - -- ``vars``: variables -- ``Bool``: Boolean variables -- ``bin``: binary variables -- ``int``: integer variables -- ``cont``: continuous variables -- ``cons``: constraints -- ``nl``: nonlinear constraints -- ``disj``: disjuncts -- ``disjtn``: disjunctions - - - +| Component | Number | +|:----------------------|---------:| +| Variables | 4033 | +| Binary variables | 200 | +| Integer variables | 0 | +| Continuous variables | 3833 | +| Disjunctions | 100 | +| Disjuncts | 200 | +| Constraints | 5790 | +| Nonlinear constraints | 2128 | \ No newline at end of file diff --git a/gdplib/med_term_purchasing/README.md b/gdplib/med_term_purchasing/README.md new file mode 100644 index 0000000..002ed55 --- /dev/null +++ b/gdplib/med_term_purchasing/README.md @@ -0,0 +1,32 @@ +# Medium-term Purchasing Contracts Problem + +Medium-term Purchasing Contracts problem from https://www.minlp.org/library/problem/index.php?i=129 + +This model maximizes profit in a short-term horizon in which various contracts are available for purchasing raw materials. The model decides inventory levels, amounts to purchase, amount sold, and flows through the process nodes while maximizing profit. The four different contracts available are: +1. **FIXED PRICE CONTRACT**: buy as much as you want at constant price +2. **DISCOUNT CONTRACT**: quantities below minimum amount cost RegPrice. Any additional quantity above min amount costs DiscoutPrice. +3. **BULK CONTRACT**: If more than min amount is purchased, whole purchase is at discount price. +4. **FIXED DURATION CONTRACT**: Depending on length of time contract is valid, there is a purchase price during that time and min quantity that must be purchased + +## Problem Details + +### Solution + + +### Size +| Component | Number | +|:----------------------|---------:| +| Variables | 1165 | +| Binary variables | 216 | +| Integer variables | 0 | +| Continuous variables | 949 | +| Disjunctions | 72 | +| Disjuncts | 216 | +| Constraints | 762 | +| Nonlinear constraints | 0 | + + +## References +> [1] Vecchietti, A., & Grossmann, I. (2004). Computational experience with logmip solving linear and nonlinear disjunctive programming problems. Proc. of FOCAPD, 587-590. +> +> [2] Park, M., Park, S., Mele, F. D., & Grossmann, I. E. (2006). Modeling of purchase and sales contracts in supply chain optimization. Industrial and Engineering Chemistry Research, 45(14), 5013-5026. DOI: 10.1021/ie0513144 \ No newline at end of file diff --git a/gdplib/methanol/README.md b/gdplib/methanol/README.md index 21a4b2e..ce6d75f 100644 --- a/gdplib/methanol/README.md +++ b/gdplib/methanol/README.md @@ -15,19 +15,13 @@ Best known objective value: 1583.00 ### Size -| Problem | vars | Bool | bin | int | cont | cons | nl | disj | disjtn | -|-----------|------|------|-----|-----|------|------|----|------|--------| -| Methanol Production | 285 | 8 | 0 | 0 | 277 | 429 | 55 | 8 | 4 | - -- ``vars``: variables -- ``Bool``: Boolean variables -- ``bin``: binary variables -- ``int``: integer variables -- ``cont``: continuous variables -- ``cons``: constraints -- ``nl``: nonlinear constraints -- ``disj``: disjuncts -- ``disjtn``: disjunctions - - - +| Component | Number | +|:----------------------|---------:| +| Variables | 287 | +| Binary variables | 8 | +| Integer variables | 0 | +| Continuous variables | 279 | +| Disjunctions | 4 | +| Disjuncts | 8 | +| Constraints | 429 | +| Nonlinear constraints | 55 | \ No newline at end of file diff --git a/gdplib/mod_hens/README.md b/gdplib/mod_hens/README.md index 8473f5d..6611075 100644 --- a/gdplib/mod_hens/README.md +++ b/gdplib/mod_hens/README.md @@ -12,13 +12,13 @@ The objective is minimization of total annualized cost (TAC). Seven model variants are described: -- ``build_conventional`` - Conventional HENS -- ``build_integer_single_module`` - Modular HENS - single module type allowed, integer formulation -- ``build_integer_require_modular`` - Modular HENS - multiple module types allowed, integer formulation -- ``build_integer_modular_option`` - Modular HENS - mixed modular and conventional exchangers allowed, integer formulation -- ``build_discrete_single_module`` - Modular HENS - single module type allowed, discretized formulation -- ``build_discrete_require_modular`` - Modular HENS - multiple module types allowed, discretized formulation -- ``build_discrete_modular_option`` - Modular HENS - mixed modular and conventional exchangers allowed, discretized formulation +- ``build_model('conventional')`` - Conventional HENS +- ``build_model('single_module_integer')`` - Modular HENS - single module type allowed, integer formulation +- ``build_model('multiple_module_integer')`` - Modular HENS - multiple module types allowed, integer formulation +- ``build_model('mixed_integer')`` - Modular HENS - mixed modular and conventional exchangers allowed, integer formulation +- ``build_model('single_module_discrete')`` - Modular HENS - single module type allowed, discretized formulation +- ``build_model('multiple_module_discrete')`` - Modular HENS - multiple module types allowed, discretized formulation +- ``build_model('mixed_discrete')`` - Modular HENS - mixed modular and conventional exchangers allowed, discretized formulation The discretized formulations use the ``induced linearity`` reformulation described in the (Chen & Grossmann, 2019) source paper. @@ -27,32 +27,23 @@ The discretized formulations use the ``induced linearity`` reformulation describ ### Solution Best known objective values: -- ``build_conventional``: 106767 (optimal) -- ``build_integer_single_module``, ``build_discrete_single_module``: 134522 -- ``build_integer_require_modular``, ``build_discrete_require_modular``: 111520 -- ``build_integer_modular_option``, ``build_discrete_modular_option``: 101505 +- ``conventional``: 106767 (optimal) +- ``single_module_integer``, ``single_module_discrete``: 134522 +- ``multiple_module_integer``, ``multiple_module_discrete``: 111520 +- ``mixed_integer``, ``mixed_discrete``: 101505 ### Size -| Problem | vars | Bool | bin | int | cont | cons | nl | disj | disjtn | -|-----------|------|------|-----|-----|------|------|----|------|--------| -| conv | 214 | 24 | 0 | 0 | 190 | 250 | 36 | 24 | 32 | -| int_sing | 313 | 27 | 0 | 96 | 190 | 265 | 24 | 27 | 45 | -| int_req | 313 | 27 | 0 | 96 | 190 | 265 | 24 | 27 | 45 | -| int_opt | 274 | 48 | 0 | 36 | 190 | 322 | 36 | 48 | 44 | -| disc_sing | 3077 | 27 | 2080 | 0 | 970 | 6006 | 12 | 27 | 33 | -| disc_req | 1114 | 24 | 300 | 0 | 790 | 1486 | 12 | 24 | 44 | -| disc_opt | 1138 | 48 | 300 | 0 | 790 | 2122 | 36 | 48 | 44 | - -- ``vars``: variables -- ``Bool``: Boolean variables -- ``bin``: binary variables -- ``int``: integer variables -- ``cont``: continuous variables -- ``cons``: constraints -- ``nl``: nonlinear constraints -- ``disj``: disjuncts -- ``disjtn``: disjunctions +| Component | conventional | single_module_integer | multiple_module_integer | mixed_integer | single_module_discrete | multiple_module_discrete | mixed_discrete | +|:----------------------|---------------:|------------------------:|--------------------------:|----------------:|-------------------------:|---------------------------:|-----------------:| +| Variables | 338 | 501 | 498 | 498 | 4761 | 3802 | 3802 | +| Binary variables | 64 | 131 | 128 | 128 | 2147 | 1728 | 1728 | +| Integer variables | 0 | 96 | 96 | 96 | 0 | 0 | 0 | +| Continuous variables | 274 | 274 | 274 | 274 | 2614 | 2074 | 2074 | +| Disjunctions | 32 | 65 | 64 | 64 | 33 | 64 | 64 | +| Disjuncts | 64 | 131 | 128 | 128 | 67 | 128 | 128 | +| Constraints | 370 | 565 | 562 | 562 | 8786 | 5362 | 5362 | +| Nonlinear constraints | 96 | 96 | 96 | 96 | 32 | 96 | 96 | ## References diff --git a/gdplib/mod_hens/__init__.py b/gdplib/mod_hens/__init__.py index d1adf64..ebbed3f 100644 --- a/gdplib/mod_hens/__init__.py +++ b/gdplib/mod_hens/__init__.py @@ -17,15 +17,15 @@ def build_model(case="conventional", cafaro_approx=True, num_stages=4): return _conv(cafaro_approx, num_stages) elif case == "single_module_integer": return _int_sing(cafaro_approx, num_stages) - elif case == "require_modular_integer": + elif case == "multiple_module_integer": return _int_mod(cafaro_approx, num_stages) - elif case == "modular_option_integer": + elif case == "mixed_integer": return _int_opt(cafaro_approx, num_stages) elif case == "single_module_discrete": return _disc_sing(cafaro_approx, num_stages) - elif case == "require_modular_discrete": + elif case == "multiple_module_discrete": return _disc_mod(cafaro_approx, num_stages) - elif case == "modular_option_discrete": + elif case == "mixed_discrete": return _disc_opt(cafaro_approx, num_stages) diff --git a/gdplib/modprodnet/README.md b/gdplib/modprodnet/README.md index 652b4bb..1ef81a0 100644 --- a/gdplib/modprodnet/README.md +++ b/gdplib/modprodnet/README.md @@ -9,11 +9,11 @@ Source paper (see Section "Capacity Expansion Case Study"): Five model variants are described: -- ``build_cap_expand_growth`` - Single site capacity expansion (Growth scenario) -- ``build_cap_expand_dip`` - Single site capacity expansion (Dip scenario) -- ``build_cap_expand_decay`` - Single site capacity expansion (Decay scenario) -- ``build_distributed_model`` - Multi-site distributed design (monthly time periods) -- ``build_quarter_distributed_model`` - Multi-site distributed design (quarterly time periods) +- ``build_model('Growth')`` - Single site capacity expansion (Growth scenario) +- ``build_model('Dip')`` - Single site capacity expansion (Dip scenario) +- ``build_model('Decay')`` - Single site capacity expansion (Decay scenario) +- ``build_model('Distributed')`` - Multi-site distributed design (monthly time periods) +- ``build_model('QuarterDistributed')`` - Multi-site distributed design (quarterly time periods) ## Problem Details @@ -21,29 +21,21 @@ Five model variants are described: ### Solution Best known objective values: -- ``build_cap_expand_growth``: 3593 (optimal) -- ``build_cap_expand_dip``: 2096 (optimal) -- ``build_cap_expand_decay``: 851 (optimal) -- ``build_distributed_model``: 36262 -- ``build_quarter_distributed_model``: 19568 +- ``Growth``: 3593 (optimal) +- ``Dip``: 2096 (optimal) +- ``Decay``: 851 (optimal) +- ``Distributed``: 36262 +- ``QuarterDistributed``: 19568 ### Size -| Problem | vars | Bool | bin | int | cont | cons | nl | disj | disjtn | -|-----------|------|------|-----|-----|------|------|----|------|--------| -| Mod_grow | 488 | 2 | 0 | 363 | 123 | 486 | 1 | 2 | 1 | -| Mod_dip | 488 | 2 | 0 | 363 | 123 | 486 | 1 | 2 | 1 | -| Mod_decay | 488 | 2 | 0 | 363 | 123 | 486 | 1 | 2 | 1 | -| Mod_dist | 2224 | 26 | 0 | 718 | 1480 | 1387 | 22 | 26 | 13 | -| Mod_qtr | 1314 | 42 | 0 | 486 | 786 | 672 | 36 | 42 | 21 | - - -- ``vars``: variables -- ``Bool``: Boolean variables -- ``bin``: binary variables -- ``int``: integer variables -- ``cont``: continuous variables -- ``cons``: constraints -- ``nl``: nonlinear constraints -- ``disj``: disjuncts -- ``disjtn``: disjunctions +| Component | Growth | Dip | Decay | Distributed | QuarterDistributed | +|:----------------------|---------:|------:|--------:|--------------:|---------------------:| +| Variables | 488 | 488 | 488 | 3720 | 1320 | +| Binary variables | 2 | 2 | 2 | 42 | 42 | +| Integer variables | 363 | 363 | 363 | 1452 | 492 | +| Continuous variables | 123 | 123 | 123 | 2226 | 786 | +| Disjunctions | 1 | 1 | 1 | 21 | 21 | +| Disjuncts | 2 | 2 | 2 | 42 | 42 | +| Constraints | 486 | 486 | 486 | 1792 | 672 | +| Nonlinear constraints | 1 | 1 | 1 | 36 | 36 | \ No newline at end of file diff --git a/gdplib/positioning/README.md b/gdplib/positioning/README.md index bf8292e..b8c2f82 100644 --- a/gdplib/positioning/README.md +++ b/gdplib/positioning/README.md @@ -13,12 +13,15 @@ Source paper (Example 4): Optimal objective value: -8.06 ### Size -- Variables: 56 - - Boolean: 50 - - Binary: 0 - - Integer: 0 - - Continuous: 6 -- Constraints: 30 - - Nonlinear: 25 -- Disjuncts: 50 -- Disjunctions: 25 + +| Component | Number | +|:----------------------|---------:| +| Variables | 56 | +| Binary variables | 50 | +| Integer variables | 0 | +| Continuous variables | 6 | +| Disjunctions | 25 | +| Disjuncts | 50 | +| Constraints | 30 | +| Nonlinear constraints | 25 | + diff --git a/gdplib/small_batch/README.md b/gdplib/small_batch/README.md index 8ebc750..1393ae2 100644 --- a/gdplib/small_batch/README.md +++ b/gdplib/small_batch/README.md @@ -1,4 +1,4 @@ -## Small Batch Scheduling Problem +# Small Batch Scheduling Problem The gdp_small_batch.py module contains the GDP model for the small batch problem based on the Kocis and Grossmann (1988) paper. @@ -6,9 +6,26 @@ The problem is based on the Example 4 of the paper. The objective is to minimize the investment cost of the batch units. -The solution is 167427.65711. +## Problem Details -### References +### Optimal Solution + +The optimal solution is `167427.65711`. + +### Size + +| Component | Number | +|:----------------------|---------:| +| Variables | 37 | +| Binary variables | 18 | +| Integer variables | 0 | +| Continuous variables | 19 | +| Disjunctions | 9 | +| Disjuncts | 18 | +| Constraints | 34 | +| Nonlinear constraints | 1 | + +## References > [1] Kocis, G. R.; Grossmann, I. E. Global Optimization of Nonconvex Mixed-Integer Nonlinear Programming (MINLP) Problems in Process Synthesis. Ind. Eng. Chem. Res. 1988, 27 (8), 1407-1421. https://doi.org/10.1021/ie00080a013 > diff --git a/gdplib/spectralog/README.md b/gdplib/spectralog/README.md index 763d3b5..fa7b211 100644 --- a/gdplib/spectralog/README.md +++ b/gdplib/spectralog/README.md @@ -13,12 +13,13 @@ Source paper (Example 2): Optimal objective value: 12.0893 ### Size -- Variables: 128 - - Boolean: 60 - - Binary: 0 - - Integer: 0 - - Continuous: 68 -- Constraints: 158 - - Nonlinear: 8 -- Disjuncts: 60 -- Disjunctions: 30 +| Component | Number | +|:----------------------|---------:| +| Variables | 128 | +| Binary variables | 60 | +| Integer variables | 0 | +| Continuous variables | 68 | +| Disjunctions | 30 | +| Disjuncts | 60 | +| Constraints | 158 | +| Nonlinear constraints | 8 | \ No newline at end of file diff --git a/gdplib/syngas/README.md b/gdplib/syngas/README.md index b3b33e5..b745f97 100644 --- a/gdplib/syngas/README.md +++ b/gdplib/syngas/README.md @@ -20,16 +20,13 @@ Environmental objective at solution point: -5354.8 ### Size -| Problem | vars | Bool | bin | int | cont | cons | nl | disj | disjtn | -|-----------|------|------|-----|-----|------|------|----|------|--------| -| syngas | 362 | 46 | 0 | 0 | 316 | 554 | 48 | 46 | 23 | - -- ``vars``: variables -- ``Bool``: Boolean variables -- ``bin``: binary variables -- ``int``: integer variables -- ``cont``: continuous variables -- ``cons``: constraints -- ``nl``: nonlinear constraints -- ``disj``: disjuncts -- ``disjtn``: disjunctions +| Component | Number | +|:----------------------|---------:| +| Variables | 367 | +| Binary variables | 46 | +| Integer variables | 0 | +| Continuous variables | 321 | +| Disjunctions | 23 | +| Disjuncts | 46 | +| Constraints | 543 | +| Nonlinear constraints | 48 | diff --git a/generate_model_size_report.py b/generate_model_size_report.py index 96ddac0..8cd411c 100644 --- a/generate_model_size_report.py +++ b/generate_model_size_report.py @@ -5,32 +5,66 @@ if __name__ == "__main__": - instance_list = [ - # "batch_processing", - # "biofuel", - # "disease_model", - # "gdp_col", - # "hda", - "jobshop", - # "kaibel", - # "logical", - # "med_term_purchasing", - # "methanol", - # "mod_hens", - # "modprodnet", - # "stranded_gas", - # "syngas", - ] + instance_dict = { + "batch_processing": [], + "biofuel": [], + "cstr": [], + "disease_model": [], + "ex1_linan_2023": [], + "gdp_col": [], + "hda": [], + "jobshop": [], + "kaibel": [], + "med_term_purchasing": [], + "methanol": [], + "mod_hens": [ + "conventional", + "single_module_integer", + "multiple_module_integer", + "mixed_integer", + "single_module_discrete", + "multiple_module_discrete", + "mixed_discrete", + ], + "modprodnet": ["Growth", "Dip", "Decay", "Distributed", "QuarterDistributed"], + "positioning": [], + "small_batch": [], + "spectralog": [], + "stranded_gas": [], + "syngas": [], + } current_time = datetime.now().strftime("%Y-%m-%d_%H-%M-%S") timelimit = 600 - for instance in instance_list: + for instance, cases in instance_dict.items(): print("Generating model size report: " + instance) - model = import_module("gdplib." + instance).build_model() - report = build_model_size_report(model) - report_df = pd.DataFrame(report.overall, index=[0]).T + if cases == []: + model = import_module("gdplib." + instance).build_model() + report = build_model_size_report(model) + report_df = pd.DataFrame(report.overall, index=[0]).T + + report_df.columns = ["Number"] + else: + report_df = pd.DataFrame() + for case in cases: + model = import_module("gdplib." + instance).build_model(case) + case_report = build_model_size_report(model) + temp_df = pd.DataFrame(case_report.overall, index=[0]).T + temp_df.columns = [case] + report_df = pd.concat([report_df, temp_df], axis=1) + + report_df.index = [ + "Variables", + "Binary variables", + "Integer variables", + "Continuous variables", + "Disjunctions", + "Disjuncts", + "Constraints", + "Nonlinear constraints", + ] report_df.index.name = "Component" - report_df.columns = ["Number"] + # Generate the model size report (Markdown) report_df.to_markdown("gdplib/" + instance + "/" + "model_size_report.md")