Identification of ordinary differential equation systems

Một phần của tài liệu Nonlinear system identification using genetic programming (Trang 107 - 120)

Many chemical processes can be well represented by a set of nonlinear differential- algebraic equations. In this section, we explore the possibility of deriving nonlinear state space representations of systems using measurements of state variables alone.

One immediate application that comes to mind is in the modeling of batch reactor experiments. One could envisage several applications covering continuous and semi- continuous processes if the GP method were feasible (computational load is likely to be the bottleneck in achieving this goal). To the best of the authors’ knowledge, there have been little or no reported applications of GP in this area. Cao et al. (1999) have made an attempt in this direction but their are invariably identify nonautonomous differential equation systems. Although it is possible to convert the nonautonomous ODE’s to an autonomous ODE system, their models are still quite complex. Discrete time state space models are relatively easier to simulate and therefore need significantly shorter run- times. However, the continuous time differential equation system representation produces more meaningful physical models. DACS-GP has the ability to generate both continuous and discrete nonlinear state space models through proper choice of the integration method. The treatment here will discuss the generation of continuous state space representations only.

Case study 8: Cracking of gas oil

An important problem in virtually every area of science is finding the relationship underlying empirically observed values of the variables measured in a system. In practice, the observed data may be noisy and there may be no way to express the relationships in any precise way. In this section, we demonstrate how DACS-GP

identifies empirical relationships from actual observed data from catalytic cracking of gas oil.

This model represents the catalytic cracking of gas oil (A) to gasoline (Q) and other side products (S).

k1

Q

k3 k2

S A

Only the concentrations of A and Q were measured; therefore, the concentration of S does not appear in the model for estimation. Tjoa and Biegler (1991) estimated the parameters of a proposed differential equation system model using this experimental data set. This reaction scheme involves nonlinear reaction kinetics. The differential equation model takes the form z =f(z,θ)

dt

d where the state vector, z, is defined as [A,

Q]T, and the parameter vector, , is defined as [θ θ1,θ2,θ3]T. The data used in this study were generated using values for the parameters of [12, 8, 2] with a small amount of random error added (the data set in Table 23 from Tjoa and Biegler (1991) has been used). Tjoa and Biegler (1991) determined the parameters of the following model structure:

2 2 2 1 1 2

2 1 3 1

1 ( )

z dt z

dz dt z dz

θ θ

θ θ

= +

=

(5.9)

[1 0]

0 =

z , t∈[0 0.95]

For our purposes, we assume that we have the measurements of z1 and z2 starting from their initial conditions. The concentration variables must be in the terminal set. We also include the “constant” gene to provide for a wider search space. The terminal set for the problem is

2 1 and z z

T = {z1, z2, 1}.

As a general choice, the functional set includes four ordinary arithmetic operations of addition, subtraction, multiplication and division. The square function can be created from multiplication function if necessary. Since we use optimal parameters rather than ephemeral constants, subtraction and addition are essentially the same. So the functional set is

F = {+, *, %}

Table 5.16 Configuration details for Case Study 8

Parameter Value

Terminal set 1,z1,z2

Functional set +,÷,×

Number of generations 20

Population size 50

Probability of genetic operator (Mutation, Crossover, Reproduction, Permutation, Adaptation, Super- crossover)

[0.1 0.65 0.05 0.05 0.05 0.1]

Constants used in computing

fitness measure: k1:k2 :k3 0.5:0.4:0.3

Optimization method Quasi-Newton

The third major step in preparing to use genetic programming is to identify the fitness measure. In all identification problems of ODE system, our developed fitness function

‘KyawTun’ was used in order to take care of error in each state as described in section 3.5. Table 5.16 contains the configuration details for the GP run.

We will illustrate the working of GP for this problem using a typical run. Figure 5.12 shows how the best fitness and average fitness of population changes with the number of generations. As one can see, the best fitness goes down in steps rather than showing a continuous decrease. This trajectory also shows an abrupt large decrease at the “hit generation”. The best fitness value declines monotonously since we have used elitism in this problem. Unlike best fitness, average fitness value improves slowly. The trajectory shows an overall decreasing trend but there are generations where the average fitness worsens slightly. Since individuals follow the direction of the best individuals, an overall decreasing trend occurs. When all individual are close to best model a phenomena called crowding occurs. This can lead to situations where the average fitness value worsens slightly. A steady profile of average fitness over successive generations indicates that the solution has converged. Although we do not use this as the terminating criterion, it is still a good cue to observe.

0 10 20 30

-90 -80 -70 -60

Generations

Best fitness

0 10 20 30

-50 -45 -40 -35 -30

Generations

Average fitness

Figure 5.12 Performance of GP

The worst individual in generation 0 (initial population) was the model having a fitness score of -2.999 and sum of squared errors equal to 0.1069. It should be noted that even though model structure is far from the “true” model, the optimizer fits parameters that makes sum of squared errors (SSE) low.

0.7458z -

z 0.1374 -

0.9542 -

266 . 3

2 1

2

2 1

=

= dt dz

dt z dz

(5.10)

Figure 5.13 Crossover of individuals from generation 4 to create the “hit individual” in generation 5

The best individual of generation 0 was

1 2

2

1 1

z 9.5207 +

z 16.818 -

0.38537 z -7.2696

=

= dt dz

dt dz

(5.11)

Figure 5.14 Crossover of individuals from generation 9 to create the improved model in generation 10

This model has a fitness score of -63.76 and sum of squared error of 0.009216.

Although the model is quite far from the “true” model, it has the essential genetic components such as in the first state, and in the second state and makes the model quite promising. From initial population through generation 4, although the average fitness and SSE decreases, the best model remains the same. In generation 5, a superior model (model number 301, fitness score of -76.6) was found by the crossover of models 235 and 246 (from generation 4). Since DACS-GP tracks the history of all the individuals, one can trace all the genetic operations that occur and nicely show them

z1 z1 z2

using the tree structure (see Figure 5.13). The resulting model 301 had correctly figured out the first state equation i.e. the equation 1 z12

dt

dz = .

Figure 5.15 Crossover of individuals from generation 13 to create the best model in generation 14

We would like to point out that in formulating the fitness formula for ODE modeling, we take the error in each state rather than total error of the all states. It is also observed that the essential component dominates in population and unrelated gene ‘1’, which dominates in initial population, disappears though generations.

2

z1

In generation 10, a better model (model number 525) is assembled by crossover of model numbers 471 and 475 (Figure 5.14). The resulting model is almost correct. In generation 14, the exact model is obtained (see Figure 5.15) and retained until the end of the run.

Table 5.17 shows that several runs of the GP resulted in the same “best” model. The identified parameters are somewhat different from the true parameters due to the noise added in the data (Tjoa and Biegler (1991) also obtained the same values of the model parameters). Using GP, we have managed to arrive at the correct model structure and subsequently the optimal parameter values using quasi-Newton scheme.

Table 5.17 Results of GP runs for Case Study 8

Fitness RMSE Model

-93.0781 0.00829534 (-14.811*(z1*z1)), ((12.326*(z1*z1))+(-7.8589*z2)) -93.0781 0.00829534 (-14.811*(z1*z1)), ((12.326*(z1*z1))+(-7.8589*z2)) -91.5781 0.00829534 (-14.811*(z1*(z1-(z1-z1)))), ((-7.8589*z2)+

(12.326*(z1*z1)))

-93.0781 0.00829534 (-14.811*(z1*z1)), ((12.326*(z1*z1))+(-7.8589*z2)) -93.0781 0.00829534 (-14.811*(z1*z1)), ((12.326*(z1*z1))+(-7.8589*z2))

Case study 9: Reversible first order series reaction

We now try to determine the model describing data from a series reversible reaction system. The data and a first principles model with unknown parameters appears in Tjoa and Biegler (1991) - see Table 22 of the cited reference for the data set.

Reaction Scheme: A B C

3

4 1

2

k

k k

k

In this case all components are measured, and therefore their concentrations are included in the model used for estimation. The first principles model is described by the following set of differential equations

3 4 2 2 3

3 4 2 3 2 1 1 2

2 2 1 1 1

) (

z k z dt k dz

z k z k k z dt k dz

z k z dt k

dz

=

+ +

=

+

=

(5.12)

The initial condition is z0 = [1, 0, 0] and time t ∈ [0, 1]. Table 5.18 contains the configuration details for this example.

Table 5.18: Configuration details for Case Study 9

Parameter Value Terminal set 1,z1,z2,z3

Functional set +,−,×

Number of generations 20

Population size 50

Probability of genetic operator (Mutation, Crossover, Reproduction, Permutation, Adaptation, Super- crossover)

[0.1 0.65 0.05 0.05 0.05 0.1]

Constants used in computing

fitness measure: k1:k2 :k3 0.5:0.4:0.3

Optimization method Quasi-Newton

0 5 10 15 20 25 0

0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1

Actual -1 Actual -2 Actual -3 Model -1 Model -2 Model -3 -2.93982 s1

5.80747 + 38.4472 s3 - 91.8853 s2 -29.8537 s3 + 55.0934 s2

chlg2.m_9_14__0__2_run_1

Figure 5.16 Plot of best model vs. data from Run 1 (Case Study 9)

0 5 10 15 20 25

0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1

chlg2.m20021023T145128

(s1+s2), (s3-s1), (s2+((s1-s3)+s1))

Actual -1 Actual -2 Actual -3 Model -1 Model -2 Model -3

Figure 5.17 Plot of best model vs. data from Run 2 (Case Study 9)

0 5 10 15 20 25 0

0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1

chlg2.m20021023T145008

(s1+s2), (s3-s1), (s2+((s1-s3)+s1))

Actual -1 Actual -2 Actual -3 Model -1 Model -2 Model -3

Figure 5.18 Plot of best model vs. data from Run 3 (Case Study 9)

Figures 5.16, 5.17 and 5.18 compare the model predictions from the best models obtained from three GP runs with the actual concentration evolution profile. It is seen that the models obtained from the second and third runs fit the data very well. A look at the model structures obtained (embedded in Figures 5.16 through 5.18) indicates that the “true” model structure has not been identified even though the models fit the data very well.

Case study 10: Lotka-Volterra system

This problem has been studied by Luus (1998). This model is a representation of the predator-prey model used in ecology. The system is described by two differential equations:

) 1 (

) 1 (

1 2 2 2

2 1 1 1

=

=

z z dt k dz

z z dt k dz

(5.13)

with the initial conditionsz0 =[1.2 1.1]. The experimental data is available for

[ ]0,10 .

t

In this model, represents the population of the prey and the population of the predator. The solutions to these equations point to the periodic nature of the predator and prey populations. The data used in the study were generated using values for the parameters as k

z1 z2

1 = 3 and k2 = 1 with a small amount of normally distributed random error with σ =0.02 and zero mean added to the observations. The data set is available in Table 26 of Tjoa and Biegler (1991). The parameters and other details pertaining to the GP runs for this data set are shown in Table 5.19.

Table 5.19 Configuration details for Case Study 10

Parameter Value

Terminal set 1,z1,z2

Functional set +,−,×

Number of generations 20

Population size 60

Probability of genetic operator (Mutation, Crossover,

Reproduction, Permutation Adaptation, Super-crossover)

[0.26 0.57 0.043 0.043 0.043 0.043]

Constants used in computing

fitness measure: k1:k2 :k3 0.5:0.5:0.5

Optimization method Differential evolution, Quasi-Newton

Table 5.20 Results of GP runs for the Lotka-Volterra system data (Case Study 10)

Fitness RMSE Model

-31.9285 0.02416 (-11.099*(z1-(z2*z2))), (-10.859*(z1-z2)) -31.7671 0.02459 (4.6951*((z2*z2)-z1)), (4.4575*(z2-z1)) -31.6838 0.02488 (9.8078*(z1-(z1*z2))), (0.34589*(z1-z2))

-51.0948 0.003075 (2.9812*((z1+(-0.0047458*z1))-(z2*z1))), ((z2*z1)-z2) -33.1799 0.01851 ((8.1585*(z2-(z2*z2)))+(0.26568*z1)), (0.3633*(z1-z2)) -43.486 0.007501 (-7.4976*(z1-(z2*z1))), (2.9281*(z1-(z1*z1)))

1 2 3 4 5 6 7 8 9 10

0.7 0.8 0.9 1 1.1 1.2 1.3 1.4

(2.9812*((z1+(-0.0047458*z1))-(z2*z1))), ((z2*z1)-z2) Data - z1 Data - z2 Model - z1 Model - z2

Figure 5.19 Plot of best model vs. data for the Lotka-Volterra System (Case Study 10)

The results of six GP runs are shown in Table 5.20. The determination of the optimal parameters for this kind of ODE system is reported to be quite difficult as described in Esposito et al. (2000). It is because the most prevalent local solution found is not the global solution but the ninth best solution (out of the 10 local solutions found). With 1000 random starting points, the global solution is shown to occur with a frequency of only 7.4% by Esposito et al., (2000). We use Differential Evolution for global initial guess followed by Quasi-Newton local optimizer. DACS-GP is able to locate the correct model structure based on the data (the model in the fourth row of Table 5.20).

The comparison between model predictions and the observed data is shown in Figure 5.19. It is seen that the model predictions and the “experimental” data agree very well.

It is also noted that GP models are not exactly the same as “true” model due to noise and small number of samples. We did repeat the GP runs with 1000 data points and recovered the true (exact) model almost all runs. When limited data, is available the models obtained with GP is somewhat suspect. Actually, this is not particular to GP but to all data based system identification techniques. Quality of the data based model is reliable only if sufficient and good data is available.

Một phần của tài liệu Nonlinear system identification using genetic programming (Trang 107 - 120)

Tải bản đầy đủ (PDF)

(143 trang)