Use of Optimizations I – MINLP Example

This tutorial explains how a simple process synthesis problem can be set up and solved. This synthesis problem results in an mixed-integer nonlinear programming problem.

Synthesis problem

The synthesis problem contains two options (process I and II) to produce B from A. These processes vary in their fixed and variable costs. In addition, there is the option to simply purchase B directly. Whatever the source of B is, all streams are mixed in a mixer (streams 2, 4, and 5). In the final step, any B is converted to C via process III.

Figure 1: Superstructure for process synthesis example.

Model description

This example is governed by the following equations:

   F_{s=2,c} = F_{s=1,c} + R_c^\mathrm{I} \quad \wedge \quad R_c^\mathrm{I} = \nu_c^\mathrm{I} r^\mathrm{I} \ln \left( 1 + F_{s=1,c=1} \right) \\[2ex] F_{s=4,c} = F_{s=3,c} + R_c^\mathrm{II} \quad \wedge \quad R_c^\mathrm{II} = \nu_c^\mathrm{II} r^\mathrm{II} \ln \left( 1 + F_{s=3,c=1} \right) \\[2ex] F_{s=7,c} = F_{s=6,c} + R_c^\mathrm{III} \quad \wedge \quad R_c^\mathrm{III} = \nu_c^\mathrm{III} r^\mathrm{III} F_{s=6,c=2} \\[2ex] F_{s=6,c} = F_{s=2,c} + F_{s=4,c} + F_{s=5,c}.

The first part of each equation is the component balance for the three processes. The second part determines the conversion in each process. Therein, \nu is the stoichiometric coefficient and r is a conversion coefficient. The conversion always depends on the educt feed to the respective process. Finally, there is a component balance for the mixer.

In addition, there are logical / structural constraints:

   y^\mathrm{I} + y^\mathrm{II} = c_{i=1} \quad \wedge \quad c_{i=1} \leq 1 \\[2ex] F_{s=2,c=2} - y^\mathrm{I} F_{s=2,c=2}^\mathrm{max} = c_{i=2} \quad \wedge \quad c_{i=2} \leq 0 \\[2ex] F_{s=4,c=2} - y^\mathrm{II} F_{s=4,c=2}^\mathrm{max} = c_{i=3} \quad \wedge \quad c_{i=3} \leq 0 \\[2ex] F_{s=7,c=3} - y^\mathrm{III} F_{s=7,c=3}^\mathrm{max} = c_{i=4} \quad \wedge \quad c_{i=4} \leq 0

The first constraint ensures that either process I or process II is used, but not both. The other three constraints ensure that the produced product in processes I, II, and III is below the maximum capacity of each process. The processes are activated by the binary decision variables y^\mathrm{I}, y^\mathrm{II}, and y^\mathrm{III}.

Last but not least, the objective function must be formulated. The synthesized process shall be the most cost-efficient option:

   \Phi = C^{I,fix} \cdot y^{I} + C^{II,fix} \cdot y^{II} + C^{III,fix} \cdot y^{III} + C^{I,var}\cdot F_{s=2,c=2} + C^{II,var} \cdot F_{s=4,c=2} + C^{III,var} \cdot F_{s=7,c=3} + C^{var}_{c=1} \cdot (F_{s=1,c=1}+F_{s=3,c=1}) + C^{var}_{c=2} \cdot F_{s=5,c=2} - C^{var}_{c=3} \cdot F_{s=7,c=3}

Hence, the objective function is the sum of fix and variable costs of all processes. The variable costs are only associated with the product stream in this simple example. The last terms represent the costs for educts that must be paid for streams 1, 3, and 5. The objective function is reduced by the income generated by selling the product in stream 7. The binary variables activate these terms in the cost function.

Modeling Workflow

Notation of equation system

For the notation of the equation, we need to set up all base names, superscripts, and indices that appear in the equations, i.e.

Base names
  • \nu, stoichiometric coefficient
  • \Phi, objective function value
  • c, constraint dummy
  • C, cost in EURO
  • F, mass flow in t/h
  • r, conversion coefficient
  • R, conversion in t/h
  • y, binary decision variable
Superscripts
  • fix, fixed cost
  • I, process I
  • II, process II
  • III, process III
  • max, maximum
  • var, variable cost
Indices
  • c, component index 1..NC
  • i, constraint index 1..NI
  • s, stream index 1..NS

The resulting notation has ID 182686.

Equations

Next, we can define the equations of the model. Therefore, we open the equation editor, load the notation we just created, and enter the equations as stated above in the model description. The formulated equations are available with the IDs 182688 to 182698 (11 equations). The objective function has ID 182700.

Equation system

Now we are able to construct our equation system:

  1. Go to “Equation System” and load the notation for the equations
  2. Add the eleven constraints and the objective function to your system in the Connected Elements tab
  3. Save your equation system

This equation system is available with ID 182699.

Simulation workflow

Your model is now complete and you can move on to the “Simulation” section of MOSAICmodeling.

  1. Enter a suitable description
  2. Select the tab Equation System and load the system created in the previous steps. Assign the maximum values for the available indices (NC = 3, NI = 4, NS = 7) and click on Confirm Index Data
  3. Select the tab Specifications. In the list ALL VARIABLES, you will find the variables as defined in your model notation.
  4. Classify the variables as design variables and iteration values, respectively, by selecting the category from the dropdown menu in the Type column.

The simulation will be specified and initialized with the values given in Table 1. After having assigned the initial guesses and the parameter values, you can save the variable specification and then the simulation. The simulation is available in MOSAICmodeling with ID 182704. The respective variable specification that may serve as initialization for the optimization has ID 182705. The solution for both iteration variables and both cases is also given in Table 1. In this case, the solution is equal to the initial guesses, which basically shows that the system is well initialized for optimization.

NameDescriptionValue / Initial guessSolution
\nu_{c=1}^\mathrm{I}Stoichiometric coefficient of component 1 in process I-1
\nu_{c=2}^\mathrm{I}Stoichiometric coefficient of component 2 in process I1
\nu_{c=3}^\mathrm{I}Stoichiometric coefficient of component 3 in process I0
\nu_{c=1}^\mathrm{II}Stoichiometric coefficient of component 1 in process II-1
\nu_{c=2}^\mathrm{II}Stoichiometric coefficient of component 2 in process II1
\nu_{c=3}^\mathrm{II}Stoichiometric coefficient of component 3 in process II0
\nu_{c=1}^\mathrm{III}Stoichiometric coefficient of component 1 in process III0
\nu_{c=2}^\mathrm{III}Stoichiometric coefficient of component 2 in process III-1
\nu_{c=3}^\mathrm{III}Stoichiometric coefficient of component 3 in process III1
C^\mathrm{I, fix}Fix costs of process I in €/h1000
C^\mathrm{II, fix}Fix costs of process II in €/h1500
C^\mathrm{III, fix}Fix costs of process III in €/h3500
C^\mathrm{I, var}Variable costs of process I in €/t1000
C^\mathrm{II, var}Variable costs of process II in €/t1200
C^\mathrm{III, var}Variable costs of process III in €/t2000
C_{c=1}^\mathrm{var}Costs for component 11800
C_{c=2}^\mathrm{var}Costs for component 27000
C_{c=3}^\mathrm{var}Selling price for component 313000
F_{s=1,c=1}Feed of component 1 in stream 1 in t/h0
F_{s=3,c=1}Feed of component 1 in stream 3 in t/h0
F_{s=5,c=1}Feed of component 1 in stream 5 in t/h0
F_{s=1,c=2}Feed of component 2 in stream 1 in t/h0
F_{s=3,c=2}Feed of component 2 in stream 3 in t/h0
F_{s=5,c=2}Feed of component 2 in stream 5 in t/h2
F_{s=1,c=3}Feed of component 3 in stream 1 in t/h0
F_{s=3,c=3}Feed of component 3 in stream 3 in t/h0
F_{s=5,c=3}Feed of component 3 in stream 5 in t/h0
F_{s=2,c=2}^\mathrm{max}Maximum capacity of process I in t/h4
F_{s=4,c=2}^\mathrm{max}Maximum capacity of process II in t/h5
F_{s=7,c=2}^\mathrm{max}Maximum capacity of process III in t/h2
r^\mathrm{I}Conversion factor of process I1
r^\mathrm{II}Conversion factor of process II1.2
r^\mathrm{III}Conversion factor of process III0.9
y^\mathrm{I}Binary decision variable for process I0
y^\mathrm{II}Binary decision variable for process II0
y^\mathrm{III}Binary decision variable for process III1
F_{s=2,c=1}Component flow of component 1 in stream 200
F_{s=4,c=1}Component flow of component 1 in stream 400
F_{s=6,c=1}Component flow of component 1 in stream 600
F_{s=7,c=1}Component flow of component 1 in stream 700
F_{s=2,c=2}Component flow of component 2 in stream 200
F_{s=4,c=2}Component flow of component 2 in stream 400
F_{s=6,c=2}Component flow of component 2 in stream 622
F_{s=7,c=2}Component flow of component 2 in stream 70.20.2
F_{s=2,c=3}Component flow of component 3 in stream 200
F_{s=4,c=3}Component flow of component 3 in stream 400
F_{s=6,c=3}Component flow of component 3 in stream 600
F_{s=7,c=3}Component flow of component 3 in stream 71.81.8
R_{c=1}^\mathrm{I}Conversion rate of component 1 in process I00
R_{c=2}^\mathrm{I}Conversion rate of component 2 in process I00
R_{c=3}^\mathrm{I}Conversion rate of component 3 in process I00
R_{c=1}^\mathrm{II}Conversion rate of component 1 in process II00
R_{c=2}^\mathrm{II}Conversion rate of component 2 in process II00
R_{c=3}^\mathrm{II}Conversion rate of component 3 in process II00
R_{c=1}^\mathrm{III}Conversion rate of component 1 in process III00
R_{c=2}^\mathrm{III}Conversion rate of component 2 in process III-1.8-1.8
R_{c=3}^\mathrm{III}Conversion rate of component 3 in process III1.81.8
c_{i=1}Dummy variable 100
c_{i=2}Dummy variable 200
c_{i=3}Dummy variable 300
c_{i=4}Dummy variable 4-0.2-0.2
\PhiObjective function value-2300-2300
Table 1: Overview of design values and initial guesses.

Optimization workflow

Now that the system is well initialized, move to the “Optimization” section in MOSAICmodeling and go to the Specification tab.

Constraints

Go to the Constraints tab and load your simulation from the previous step. Make sure that all eleven constraints and the objective function are loaded successfully.

Variable specification

Go to the Variable specification. If you saved the simulation after you saved the variable specification, the variable specification from the simulation should be loaded in the optimization as well.

  1. Start by assigning \Phi as objective value.
  2. Then assign the variables in Table 2 as optimization values and set the given lower and upper bounds. If a value is missing, there is no bound to consider and you can set an arbitrarily high or small value. In addition, define y^\mathrm{I}, y^\mathrm{II}, and y^\mathrm{III} as integer.
  3. You can now save the variable specification – either by overwriting the one from your simulation or by creating a new one. The resulting variable specification with the updated  type classifications and variable bounds has ID 182706.
  4. Save the optimization (ID of optimization with this example: 182707).
NameLower boundUpper boundInteger?
F_{s=1,c=1}0
F_{s=3,c=1}0
F_{s=5,c=2}0
c_{i=1}1
c_{i=2}0
c_{i=3}0
c_{i=4}0
y^\mathrm{I}01Yes
y^\mathrm{II}01Yes
y^\mathrm{III}01Yes
Table 2: Variable bounds for the optimization.

Code generation and solution

Go to the Code Generation & Execution tab. This tab offers two possibilities:

  1. Code generation for use on a local machine
  2. Code generation and execution on the NEOS server

We take the second option by opening the Code Generation & Execution on NEOS Server tab. First, you need to click on Accept & Connect at the bottom to accept the terms of use.

Go to the Submit tab and take the following steps:

  1. Select Mixed Integer Nonlinearly Constrained Optimization as Category
  2. Select BONMIN as Solver (you need to actually click on it before Language can be selected)
  3. Select AMPL as Language
  4. Click on Generate Code & Submit

Go to the tab History. If the job does not appear in your history, click on “Refresh”. Once the status is “Done”, you can click on the job and scroll down to the results.

You can copy these results and re-import them into MOSAICmodeling by doing the following:

  1. In the Specification tab, go to the Variable Specification tab and click on “Import Values”
  2. Paste the results into this window and select AMPL as Language Specification (at the top). You can click on “Test Import” to see whether the variables are correctly recognized.
  3. Click on Import. This updates all variable values in your variable specification. 
  4. If you want to, you can save this new variable specification with another name, e.g., “Results”

Results

The results obtained with BONMIN are given below in Table 3. Values that were numerically zero are shown as 0  for clarity. The results indicate that the best option under the current constraint is using process II and buying additional B, which is then used to produce C. The variable specification containing the results has ID 182729.

NameDescriptionValue / Initial guessSolution
\nu_{c=1}^\mathrm{I}Stoichiometric coefficient of component 1 in process I-1
\nu_{c=2}^\mathrm{I}Stoichiometric coefficient of component 2 in process I1
\nu_{c=3}^\mathrm{I}Stoichiometric coefficient of component 3 in process I0
\nu_{c=1}^\mathrm{II}Stoichiometric coefficient of component 1 in process II-1
\nu_{c=2}^\mathrm{II}Stoichiometric coefficient of component 2 in process II1
\nu_{c=3}^\mathrm{II}Stoichiometric coefficient of component 3 in process II0
\nu_{c=1}^\mathrm{III}Stoichiometric coefficient of component 1 in process III0
\nu_{c=2}^\mathrm{III}Stoichiometric coefficient of component 2 in process III-1
\nu_{c=3}^\mathrm{III}Stoichiometric coefficient of component 3 in process III1
C^\mathrm{I, fix}Fix costs of process I in €/h1000
C^\mathrm{II, fix}Fix costs of process II in €/h1500
C^\mathrm{III, fix}Fix costs of process III in €/h3500
C^\mathrm{I, var}Variable costs of process I in €/t1000
C^\mathrm{II, var}Variable costs of process II in €/t1200
C^\mathrm{III, var}Variable costs of process III in €/t2000
C_{c=1}^\mathrm{var}Costs for component 11800
C_{c=2}^\mathrm{var}Costs for component 27000
C_{c=3}^\mathrm{var}Selling price for component 313000
F_{s=1,c=1}Feed of component 1 in stream 1 in t/h00
F_{s=3,c=1}Feed of component 1 in stream 3 in t/h02.87
F_{s=5,c=1}Feed of component 1 in stream 5 in t/h00.6
F_{s=1,c=2}Feed of component 2 in stream 1 in t/h0
F_{s=3,c=2}Feed of component 2 in stream 3 in t/h0
F_{s=5,c=2}Feed of component 2 in stream 5 in t/h2
F_{s=1,c=3}Feed of component 3 in stream 1 in t/h0
F_{s=3,c=3}Feed of component 3 in stream 3 in t/h0
F_{s=5,c=3}Feed of component 3 in stream 5 in t/h0
F_{s=2,c=2}^\mathrm{max}Maximum capacity of process I in t/h4
F_{s=4,c=2}^\mathrm{max}Maximum capacity of process II in t/h5
F_{s=7,c=2}^\mathrm{max}Maximum capacity of process III in t/h2
r^\mathrm{I}Conversion factor of process I1
r^\mathrm{II}Conversion factor of process II1.2
r^\mathrm{III}Conversion factor of process III0.9
y^\mathrm{I}Binary decision variable for process I00
y^\mathrm{II}Binary decision variable for process II01
y^\mathrm{III}Binary decision variable for process III11
F_{s=2,c=1}Component flow of component 1 in stream 200
F_{s=4,c=1}Component flow of component 1 in stream 401.24
F_{s=6,c=1}Component flow of component 1 in stream 601.24
F_{s=7,c=1}Component flow of component 1 in stream 701.24
F_{s=2,c=2}Component flow of component 2 in stream 200
F_{s=4,c=2}Component flow of component 2 in stream 401.62
F_{s=6,c=2}Component flow of component 2 in stream 622.2
F_{s=7,c=2}Component flow of component 2 in stream 70.20.22
F_{s=2,c=3}Component flow of component 3 in stream 200
F_{s=4,c=3}Component flow of component 3 in stream 400
F_{s=6,c=3}Component flow of component 3 in stream 600
F_{s=7,c=3}Component flow of component 3 in stream 71.82
R_{c=1}^\mathrm{I}Conversion rate of component 1 in process I00
R_{c=2}^\mathrm{I}Conversion rate of component 2 in process I00
R_{c=3}^\mathrm{I}Conversion rate of component 3 in process I00
R_{c=1}^\mathrm{II}Conversion rate of component 1 in process II0-1.62
R_{c=2}^\mathrm{II}Conversion rate of component 2 in process II01.62
R_{c=3}^\mathrm{II}Conversion rate of component 3 in process II00
R_{c=1}^\mathrm{III}Conversion rate of component 1 in process III00
R_{c=2}^\mathrm{III}Conversion rate of component 2 in process III-1.8-2
R_{c=3}^\mathrm{III}Conversion rate of component 3 in process III1.82
c_{i=1}Dummy variable 101
c_{i=2}Dummy variable 200
c_{i=3}Dummy variable 30-3.38
c_{i=4}Dummy variable 4-0.20
\PhiObjective function value-2300-5697.1
Table 3: Initialization and results of the optimization.