Description
A classic nonlinear optimization problem is determining the equilibrium concentration of
chemical species in a homogeneous mixture. As a specific example, consider the following
scenario. A mixture of one part N2H4 and one part O2 is brought to equilibrium at a
temperature of T = 3500β¦K and a pressure of P = 750 psi. The constituent molecules
dissociate and form some combination of the n = 10 components shown in the table below.
(j) component cj
1 H -6.089
2 H2 -17.164
3 H2O -34.054
4 N -5.914
5 N2 -24.721
6 NH -14.986
7 NO -24.100
8 O -10.708
9 O2 -26.662
10 OH -22.179
The goal is to determine the number of moles, xj
, of the constituent components. This is
determined by the minimization of the Gibbs free energy:
f(x) = Xn
j=1
xj
cj + ln xj
s
,
where s := Xn
j=1
xj
. The cj are temperature and pressure dependent free-energy quantities
that are determined by other methods. The logarithmic term takes into account the free
energy of mixing. Notice that the free energy is defined only for positive values of the mole
quantities, x > 0. That is, the equilibrium mixture will contain a nonzero quantity of all ten
components. The only additional problem constraints are that the total mole count of each
element must conform to the totals given by each component:
x1 + 2×2 + 2×3 + x6 + x10 = 4 (H)
x4 + 2×5 + x6 + x7 = 2 (N)
x3 + x7 + x8 + 2×9 + x10 = 2 (O)
Here we have enforced an initial mixture of one mole N2H4 and one mole O2.
P4-1
Task 1. Create your own Sequential Quadratic Programming (SQP) code or Augmented
Lagrangian code (AL) to solve a general constrained nonlinear optimization problem. Your
code should appropriately call either your Quadratic Programming code or your unconstrained optimization code as the subproblem.
Task 2. Create an objective function and constraint functions for the chemical equilibrium
problem. Your objective function should employ a reasonable method of enforcing a realvalued objective.
Task 3. Solve the chemical equilibrium problem using your SQP or AL code. Explore the
sensitivity of your results to different initial guesses and to any hyperparameters you have
employed.
Task 4. Provide a short report on code and results.
P4-2

