Artificial Intelligence in Engineering 7 (1992) 105-109
Technical Note Qualitative simulation in the limit K.M. Hangos & Zs. Csfiki Systems and Control Laboratory, Computer and Automation Institute of HAS, H-1518, Budapest, P.O.B. 63, Hungary (Received 30 May 1991; revised version received 20 October 1991; accepted 20 November 1991) Limit properties of the QSIM algorithm with respect to the spurious behaviours have been analysed in this short paper, in the case of approximating landmark sets and non-qualitative right-hand side functions. It has been shown that at least two types of spurious behaviour do not disappear in the limit. The first type corresponds to the identically constant solution and appears when the solution passes the zero location of the right-hand side function, i.e. at a critical point. The second type is a consequence of the rigid sign-based description of qualitative directions and it may appear in every multivariable case (for sets of qualitative differential equations). The commonly applied global filters do not remove the source of the problems. A mathematically correct solution would be using the extensions of the usual numerical methods for integrating ordinary differential equations operating on intervals.
Key words: qualitative simulation, qualitative reasoning, limit analysis, spurious behaviour.
1 INTRODUCTION
problems, including correctness of the inferences, theoretical convergence to the true solution and stability of solutions can be found in Ref. 1, for a descendant of the QSIM algorithm, called Q3. Qualitative simulation is known to be sound, 5 thus the above convergence is understood as a one of the non-spurious behaviour to the 'true' solution. Our subject complements this result as attention will be focused on the limit properties of spurious behaviours. One would expect them to disappear in case of constraints with their corresponding values and the landmark sets approach the 'true' ordinary differential equation (ODE in short) model. As it will be shown, this is not the case, and reasons can be found deeply rooted in the definition of the QSIM algorithm.
Qualitative simulation 4'6 is one of .the most promising directions in qualitative physics. Besides its descendants t.7 some practical applications 2"3'9 have also been reported. At the same time the mathematical properties of the QSIM algorithm need further investigation. Struss 8 has shown that important algebraic properties of the operations applied in the Q S I M algorithm as distributivity and sometimes associativity, are missing. There were also some attempts for integrating symbolical handling of qualitative and quantitative algebras ( M A C S Y M A , J3 Simmons, 14 Williams 15) for symbolic manipulation of qualitative algebraic and differential equations, but these methods do not examine the influence of the refinement of the qualitative model to the evaluation of the integrate qualitative-quantitative expression. The main aim of the paper is to clarify the limit behaviour of the QSIM algorithm in case of infinitely fine landmark sets. The problems of limit behaviour become important when one tries to combine qualitative and quantitative simulations. A detailed analysis of such
2 BASIC N O T I O N S In this section the definition of Kuipers 4 will be summarized in short and some new definitions will also be introduced. Qualitative simulation offers an opportunity to describe variables with an adjustable precision using different landmark values. Let us define a sequence of landmark sets {L;~},~=~ for a bounded variable x with
Artificial Intelligence in Engineering 0954-1810/92/$05.00 © 1992 Elsevier Science Publishers Ltd. 105
K . M . Hangos, Zs. Cs6ki
106 Xm ~
X M as follows:
X ~
{10, lj . . . . .
L~ =
k =
l,}
0.....
j-
l,
o = 0....
,i-
1.
Definition 1
where
A behaviour BiV(tm, tM) (i = 1, 2 . . . . ) of a qualitative variable x(t) based on the set of magnitudes __9¢, ~ between tm and tM is defined as:
and
lo
<...
2, =
max(/j-
lj_,)
I~
lo =
l,
Xm,
= XM
(1)
SO that: lim 2, =
0
t+oo
The sequence of landmark sets above (with i = 1, 2 . . . . ) is called by definition an approximating landmark sequence. Let us define the following set of qualitative magnitudes associated to a l a n d m a r k set (1): £,e* =
{10, (10, l~), l, . . . . .
(l, ,, l,), l,}
=
{to, tj .....
to =
t,,,
t,},
tj = tM,
to < tl < . . .
The trajectory o f a variable is described in qualitative terms at distinguished time points or over an open interval between two immediate successor distinguished time points, i.e.
x(tk, tk+~)•£P*,,
k = 0.....
j-
1
x(tk, tk+l)•Z~'*.\L~,
k = 0 .....
j--
1
Note that there exists a set of possible trajectories S(-) corresponding to the case x(tk, tk+~) • £P~, that is with values in the rectangle (tk, tk+~, lo, lo+~)
S(tk, t~+,, lo, 1o+,) = lo <~
X(tm,
< tj
(3)
N o t e that ( j + 1) is the n u m b e r of distinguished points in the interval (t,,, tM) and this is a hidden p a r a m e t e r of B,~(tm, tM). A behaviour is defined real (i.e. non-spurious) if all its c o m p o n e n t s (X(tk) or x(tk_E, tk)) are close to the 'true' trajectory, i.e. x ( . ) is the nearest element of £*'; to X(tm, tM)(') in the sense of Def. 2.
Definition 2 The difference in m a x i m u m measure between a real behaviour based on the set of magnitudes 5e;~ of the variable x and its 'true' trajectory is denoted as: max
tm~t~t M
IBi~(tm, tM) -- X(tm, tM)l =
max
tm~t~t M
D(t)
(4)
With the definition above the following proposition holds.
Proposition I An approximating sequence of real behaviours B~(tm, tM) (i = 1, 2 . . . . ) o f a qualitative variable x(t) based on the set o f a p p r o x i m a t i n g l a n d m a r k sequence ~ 7 between t m and tM gives the 'true' trajectory o f the variable in the limit in m a x i m u m measure, i.e. tm~t~t M
IBX(tm, tM) -- X(tm, tM)l)
=
0
(5)
tM)(t)
~
D(tk)
x(tk, tk+l)
tk ~< t ~< t k + j } ,
Ix(tk) -- X(tm, tM)(t~)[ <~ 2,
=
lo or
x(tk, tk+,)
(a) in the first case max
tk~t~tk+l
Ilo - X(tm, tm)(t)l <<. 2i
(b) and in the second case max { max
tk~l~tk+ 1
{X(tm, tM)l lo+l,
=
(ii) There are two possible cases between two distinguished time points (tk, tk+l ) which are as follows
=
(lo, lo+1).
Taking into account that X(tm, tM) is assumed to be m o n o t o n e in (t~, tk+2), we get
In the single-variable case the above specialises to
X(tk) S L ; ~,
to < t~ < . . .
(i) At any distinguished time point tk
l~
x(tk)•5~,
tm,
Proof First it will be shown that D(t) in Def. 2. (eqn (4)) is b o u n d e d from a b o v e by 2, in eqn (1) for t • [tin, tM].
3a
=
tj = tM,
I~co
such that
x(t)
to =
x(tj_l, t/), x(tj)}
{x(t0), x(t 0, tl) . . . . .
x(. ) e ~ 7
lim ( m a x
< tj,
and for Vt • T,
=
(2)
where (/j, lj+l) denotes the open interval between two immediate successor landmarks. In accordance with the definition o f the original Q S I M algorithm 4 variables are assumed to be continuous and continuously differentiable functions of time (denoted by t). A function above describing the variation o f a variable x over a b o u n d e d time interval (tm, tM) is called a trajectory and it is denoted by X(tm, tg). A trajectory is an element o f C2(tm, tg). Qualitative variables take their magnitudes from a qualitative magnitude set like (2). A set o f distinguished time points is associated to each variable where the trajectory takes any o f the l a n d m a r k values, i.e. T
B~,(tm, tM)
max
tk~t~tk+l
Ilo - X(tm, tM)(t)[,
Ilo+1 - X(t,,, tM)(t)l} ~< 2,
Qualitative simulation in the limit It follows from above that D(t) can be uniformly majorated by 2, within and on the boundary of each time interval, i.e.: max IBT(tm, tM) - X(t,~, tM)l ~< 2, lm~t<.t M
As the trajectories are assumed to be continuous over the whole interval, the limit proposition (5) holds in the limit i ~ ~ with 2, --* 0 according to the definition of approximating landmark sequence (eqn (1)). [] 3 LIMIT BEHAVIOUR OF QUALITATIVE DIFFERENTIAL EQUATIONS Constraints are special types of qualitative differential equations. They have common functional form with ordinary differential equations (ODEs in short) but they may contain constants and variables with qualitative states. A qualitative state of a variable or constant is a pair where qval is called the magnitude, qval • 5e,~, qdir is the direction (time derivative) of the variable, qdir • ~ ' ~ " = {dec, std, inc} with dec = decreasing, inc = increasing, std = steady. Notice, that the qualitative direction is always 'std' in case of constants. With qualitative constants and variables the evaluation of the constraints is done by using suitable algebraic operations on intervals, i.e. by interval algebras. The solution of a constraint is generated by the QSIM algorithm and it is a set of behaviours
BX(t,,, tM) = {B~, (t,,, tM) tk), k = 1. . . . .
K}
(6)
where K is the number of possible behaviours. In the following the properties of the set above will be investigated in the limit assuming approximating landmark sets for all behaviours (for all k-s). The problems in limit properties are illustrated by a simple chemical example in the APPENDIX. Let us treat the single variable single constraint case first when dx d t = F(x, t)
(7)
x(.) • £z: X(tm)
=
(eqn (7)) the limit of the set of behaviours (6) generated by the QSIM algorithm may contain other elements than the 'true' trajectory. This virtual multiplicity may occur if the trajectory passes a critical point (x*, F(x*, ") = O) on the phase plane.
Proof Let us assume that the initial value for the problem (7) is X(tm) ---- X*
lj
is a given initial value,
tm~t~lM and F ( - , - ) is a continuous function from C 2 (i.e. not qualitative) in both variables.
Proposition 2 (Existence for curvature type spurious behaviour) In the single variable single constraint homogeneous case
with
F(x*, tin) = 0
(8)
and F ( ' ) has a single zero point at x*, tm (i.e. it is not zero in the neighbourhood of the point x*, tin). Because x* is a critical value for x it is present in its landmark set, i.e. x* = ls for some s. The initial value for the QSIM algorithm is from eqn (8)
x(tm) = (x*, std> The next step is a P-transition from the table 4 which may result in
xa(tm, t,) =
(qval, qdir>
107
(x*,std)
xb(tm, tl) = ((x*, l~+1), inc) xe(tm, tt) = ((l~ 1, x*), dec)
(9a) (9b) (9c)
Because F(-) is a nonzero function near x*, one gets a definite sign for its value in either (ls_l, x*) or (x*, ls+l) which must be used for excluding impossible behaviours (9b) or (9c). The behaviour (9a) cannot be excluded, because of eqn (8). It is easy to see, however, that the behaviour (9a) corresponds to the solution when F ( . , - ) - 0 (identically constant solution). The above reasoning shows that the identically constant spurious behaviour always appears if the trajectory passes the point (x*, F(x*, -)). [] This type of spurious behaviour (called curvature type spurious behaviour by Kuipers 4) has been very early discovered in the qualitative simulation. The commonly used method to eliminate it is to use either additional constraints (so-called higher order curvature constraints) manually or automatically derived, or to ignore irrelevant distinctions in qualitative direction. 1°'11 Both of these methods are more or less heuristic and need expert intervention into the technical details of the QSIM algorithm. But the deep reason for this type of spurious behaviour lies in the fact that the QSIM algorithm applies a 0th order method which is analogous to the explicit Euler method in numerical analysis for solving ODEs. An application of higher order, implicit or more sophisticated numerical methods (e.g. Runga-Kutta type methods) could automatically eliminate this type of spurious behaviours if it would be extended to interval arithmetics, and would be used instead of the P-transition table constrained by the equations. Note, that the evaluation of higher order derivatives are not necessarily needed for more sophisticated (Runge-Kutta type) method, t6 In case of the multivariable multiconstraint case,
K.M. Hangos, Zs. Csdki
108
however, additional problems may arise due to the fixed landmark set £,a~'~" for the directions. This means that the relative magnitude of the time derivatives cannot be described and compared even in the case of 'fine' (i.e. large i) magnitude landmark set L~',~.
usually correspond to real physical behaviour, therefore, there has been no need for developing methods to eliminate this type of branching. 4 CONCLUSION
Proposition 3 (Existence for incomparable derivative type spurious behaviour) Let us assume the simplest possible multivariable multiconstraint case when two homogeneous mutually independent ODEs are given for the two variables, respectively dx dt
F(x)
(10a)
X(') e ~q~;, X(tm) = If
dy
d---[ = G ( y )
y(.) ~ ~a-f,
(lOb)
y(tm) = l~'
where l7 and l~' are given initial values, and F(-) and G (-) are continuous functions from C 2 (i.e. not qualitative). In this case the QSIM algorithm may generate at least one spurious behaviour in each/-transition due to the incomparability of the qualitative directions of x and y.
It is important to note in conclusion that the two types of spurious behaviours, which do not disappear in the limit, are significantly different in their theoretical and practical impact on the usefulness of the QSIM algorithm. The first type, which corresponds to the identically constant solution can be easily avoided by using an analogous algorithm to the semi-implicit version of the Euler method as it was done in the Q3 algorithm) The second type, which may appear in every multivariable, multiconstraint case, is a consequence of the representation of the qualitative state for a variable, therefore, it cannot be circumvented by a slight modification of the QSIM algorithm. A mathematically correct solution for avoiding both types of spurious behaviour would be to use extensions of the usual numerical methods for integrating ordinary differential equations operating on intervals.
ACKNOWLEDGEMENT
Proof Let us assume that neither x nor y has a qualitative direction 'std' between two distinguished time points (to, to+i) and both of them have qualitative magnitude equal to an open interval between two landmarks. Furthermore, let the functions F ( ' ) and G ( ' ) have definite and constant sign on this open interval, i.e. X(to, to+l) =
((lo~, loV+l), inc)
or
((lo~, lo+l), dec)
y(to, to+l) =
((loy, l~+l), inc)
or
((l~, /oY+~),dec) According to the /-transition table, 4 there are two possible transitions even in the case of fixed directions: either x reaches one of its landmarks, i.e.
X(to+l)
=
(lo~+l, inc)
or
(1o~, dec)
and y holds its qualitative value:
y(to+l) =
((loy, loY+l), inc)
or
((loy, lY+l), dec)
or y does it in the same way. In the framework of the QSIM algorithm one cannot exclude one branch even in the case when the magnitude of the directions would be available because the value of the right-hand side functions F ( ' ) and G (-) is used for constraining the directions only in terms of 'inc', 'dec' and 'std'. [] This type of spurious behaviour is called occurrence branching in qualitative simulation. II In the case of qualitative right-hand side functions the different branches
One of the authors is partly supported by the 'For the Hungarian Science' Foundation of the Hungarian Creditbank which is gratefully acknowledged. This research was supported in part by the National Science Research Foundation of Hungary through grant 2577.
REFERENCES 1. Berleant, D. & Kuipers, B. Qualitative and quantitative simulation: bridging the gap. To be submitted in AI Journal, 1991. 2. Dalle Molle, D.T., Kuipers, B. & Edgar, T.F. Qualitative modelling and simulation of dynamic systems, Comput. chem. Engng., 1988, 12, 853-866. 3. Dvorak, D.L., Dalle Molle, D.T., Kuipers, B. & Edgar, T.F. Qualitative simulation for expert systems, Proc. IFAC'90 Worm Congress, Tallin, USSR, 1990, 7, 204-209. 4. Kuipers, B. Qualitative simulation, Artificial Intelligence, 1986, 29, 289-338. 5. Kuipers, B. The qualitative calculus is sound but incomplete: a reply to Peter Struss, Artificial Intelligence in Engineering, 1988, 3, 170-173. 6. Kuipers, B. Qualitative reasoning: modeling and simulation with incomplete knowledge, Automatica, 1989, 25, 571-585. 7. Kuipers, B. & Berleant, D. Using incomplete knowledge in qualitative reasoning, Proc. of the AAAL St. Paul, Minnesota, 1988. 8. Struss, P. Mathematical aspects of qualitative reasoning, Artificial Intelligence in Engineering, 1988, 3, 156-169. 9. Uhrik, C. & Mezgar, I. Qualitative reasoning as an aid for a learning process that controls a manufacturing line, Proc. IFAC'90 Worm Congress, Tallin, USSR, 1990, 7, 24-28.
109
Qualitative simulation in the limit
10. Kuipers, B. & Chiu, C. Taming intractible branching in qualitative simulation, Proc. IJCAI'87, 1079-1085. 11. Dalle Molle, D.T. Qualitative simulation of dynamic chemical processes, Artificial Intelligence Laboratory, University of Texas at Austin, AI89-107, 1989. 12. Levenspiel, O.S. Chemical Reaction Engineering, John Wiley & Sons, 1972. 13. Moses, J. Algebraic simplifications: a guide for the perplexed, Comm. ACM, Aug. 1971, 14(8). 14. Simmons, R. 'Commonsense' arithmetic reasoning, AAAI'86, Philadelphia (PA), 118-124, 1986. 15. Williams, B.C. MINIMA - - A symbolic approach to qualitative algebraic reasoning, AAAI'88, Saint Paul (Minnesota), 264-269. 16. Henrici, P. Essentials of Numerical Analysis with Pocket Calculator Demonstrations, John Wiley & Sons, 1982.
order to illustrate spurious behaviours only two special distinguished time points are chosen here.
APPENDIX: A S I M P L E C H E M I C A L E X A M P L E
2 Incomparable derivative type spurious behaviour
A simple chemical example is used to illustrate the two types of spurious behaviour treated here. Let us assume to have an izotherm batch reactor (a vessel filled with a solution of constant volume and temperature) where the following consecutive reaction of a two first order steps takes place:
Let us take the first two steps of the QSIM algorithm given the problem (lla), (llb) with any positive x (~c # 1) and with equidistant uniform landmark sets for the two variables Xl(') and )(2('):
Ai ~
A2
-
dX~
--
dt
X~
X,
X~(to)
-- xX 2
= 1
X2(to)
(lla) = 0
LX2 = [ 1O'2 n n
LX~ =
where X,, i = 1, 2 dimensionless concentration, x dimensionless reaction rate, t dimensionless time. It is well-known from elementary chemical kinetics lz that the solution of the eqn (11) is: e t
(12a)
1 X2 -- t¢ -- 1 ( e - t - - e-~')
X 1 >
X 1 --
1 --
X2(tmax)
- to-=
1
n>>l
KX 2
during the first open interval (t0, t~) and
dX, dt
dX2 >
dt
Therefore, only the following one of the two possible occurrence branches corresponds to the real trajectory: ((1,1-!),dec),
X~(to, t,)
=
Xl(t,)
((1 -~),dec),
=
((0,!),inc),
X2,to, t,,
=
X2,tl'
((0,!),inc)
=
while a spurious branch will also be generated by the QSIM algorithm:
(12b) ((l, 1 -!),dec),
X,(to, t,,
:
X,(t,,
((l,l-!),dec),
The trajectory Xz(t) has a maximum at tma x
1]
(llb)
kl x = ~#1
XI =
It is easy to see that the QSIM algorithm produces curvature type spurious behaviour at the distinguished time point/max for the qualitative variable )(2. (Take eqns (8), (9a), (9b), (9c) with t m = t . . . . X * = X 2 ( t m a x ) ). At the same time only one branch (eqn (9c)) corresponds to the real trajectory with the maximum. The QSIM algorithm equipped with second order curvature constraint could deduce this fact because the second order derivative of the trajectory is negative at this point.
Because of X~ ('), X2(') >1 0, x > 0 and the initial values
k-'C}: A 3
where A,, i = 1, . . . , 3 chemical compounds, kj, j = 1, 2 reaction rates. The mathematical model of this chemical system is derived from the dynamic component mass balances and it is in the following dimensionless form of ordinary differential equations: dX~ dt
1 Curvature type spurious behaviour
In x
K~:/I ~c
The results of detailed qualitative simulation of this chemical system assuming unknown x (i.e. qualitative right hand side in eqn (1 lb)) can be found in Ref. 11. In
=
((0,~),inc),
X2(to, tl)
=
x2(t~)
(:in¢
=
n