Chapter Contents |
Previous |
Next |
Nonlinear Optimization Examples |
The following example is used in many test libraries for nonlinear programming. It appeared originally in Bracken and McCormick (1968).
The problem is to determine the composition of a mixture of various chemicals that satisfy the mixture's chemical equilibrium state. The second law of thermodynamics implies that at a constant temperature and pressure, a mixture of chemicals satisfies its chemical equilibrium state when the free energy of the mixture is reduced to a minimum. Therefore, the composition of the chemicals satisfying its chemical equilibrium state can be found by minimizing the free energy of the mixture.
The following notation is used in this problem:
m | number of chemical elements in the mixture |
n | number of compounds in the mixture |
xj | number of moles for compound j, j = 1, ... ,n |
s | total number of moles in the mixture, |
aij | number of atoms of element i in a molecule of compound j |
bi | atomic weight of element i in the mixture i = 1, ... ,n |
The constraints for the mixture are as follows. Each of the compounds must have a nonnegative number of moles.
The problem is to determine the parameters xj that minimize the objective function f(x) subject to the nonnegativity and linear balance constraints. To illustrate this, consider the following situation. Determine the equilibrium composition of compound (1/2) N2 H4 + (1/2) O2 at temperature and pressure P = 750 psi. The following table gives a summary of the information necessary to solve the problem.
aij | ||||||
i=1 | i=2 | i=3 | ||||
j | Compound | (F0/RT)j | cj | H | N | O |
1 | H | -10.021 | -6.089 | 1 | ||
2 | H2 | -21.096 | -17.164 | 2 | ||
3 | H2O | -37.986 | -34.054 | 2 | 1 | |
4 | N | -9.846 | -5.914 | 1 | ||
5 | N2 | -28.653 | -24.721 | 2 | ||
6 | NH | -18.918 | -14.986 | 1 | 1 | |
7 | NO | -28.032 | -24.100 | 1 | 1 | |
8 | O | -14.640 | -10.708 | 1 | ||
9 | O2 | -30.594 | -26.662 | 2 | ||
10 | OH | -26.111 | -22.179 | 1 | 1 |
The following statements solve the minimization problem:
proc iml; c = { -6.089 -17.164 -34.054 -5.914 -24.721 -14.986 -24.100 -10.708 -26.662 -22.179 }; start F_BRACK(x) global(c); s = x[+]; f = sum(x # (c + log(x / s))); return(f); finish F_BRACK; con = { . . . . . . . . . . . . , . . . . . . . . . . . . , 1. 2. 2. . . 1. . . . 1. 0. 2. , . . . 1. 2. 1. 1. . . . 0. 1. , . . 1. . . . 1. 1. 2. 1. 0. 1. }; con[1,1:10] = 1.e-6; x0 = j(1,10, .1); optn = {0 3}; title 'NLPTR subroutine: No Derivatives'; call nlptr(xres,rc,"F_BRACK",x0,optn,con);
The F_BRACK module specifies the objective function, f(x). The matrix CON specifies the constraints. The first row gives the lower bound for each parameter, and to prevent the evaluation of the log(x) function for values of x that are too small, the lower bounds are set here to 1E-6. The following three rows contain the three linear equality constraints.
The starting point, which must be given to specify the number of parameters, is represented by X0. The first element of the OPTN vector specifies a minimization problem, and the second element specifies the amount of printed output.
The CALL NLPTR statement runs trust-region minimization. In this case, since no analytic derivatives are specified, the F_BRACK module is used to generate finite difference approximations for the gradient vector and Hessian matrix.
The output is shown in the following figures. The iteration history does not show any problems.
|
|
|
Chapter Contents |
Previous |
Next |
Top |
Copyright © 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.