15
Constraint Reasoning with Differential Equations Jorge Cruz 1 and Pedro Barahona ∗∗1 1 Centro de Inteligˆ encia Artificial, Departamento de Inform´ atica, Faculdade de Ciˆ encias e Tecnologia da Uni- versidade Nova de Lisboa, 2829-516 Caparica, Portugal Received 30 June 2003, revised 30 October 2003, accepted 2 December 2003 Published online 15 March 2004 Key words Constraint Reasoning, Differential Equations Subject classi cation 68U99, 68T35, 65L99 System dynamics is naturally expressed by means of differential equations. Despite their expressive power, they are difficult to reason about and to make decisions upon, given their non-linearity and the important effects that the uncertainty on data may cause. In contrast with traditional numerical simulations that may only provide a likelihood of the results obtained, we propose a constraint reasoning framework that enables safe decision support despite data uncertainty. The approach is illustrated in the tuning of drug design and in an epidemiological study. c 2004 WILEY-VCH Verlag GmbH & Co. KGaA, Weinheim 1 Introduction Parametric differential equations are a general and expressive mathematical formalism to model system dynamics. Notwithstanding its expressive power, reasoning with such models may be quite difficult, given their complexity. Analytical solutions are available only for the simplest models. Alternative numerical simulations require precise numerical values for the parameters involved, often impossible to gather given the uncertainty on available data. To overcome this limitation (given non-linearity, small differenceson input values may cause important dif- ferences on the output produced), Monte Carlo methods rely on a large number of simulations to estimate the likelihood of the options under study. However, they cannot provide safe conclusions, given the various sources of errors accumulated in the simulations (both input and round-of errors). In contrast, constraint reasoning models the uncertainty of numerical variables through intervals of real num- bers and propagates them through a network of constraints on these variables, to decrease the underlying uncer- tainty (i.e. the width of the intervals). To be effective, advanced methods are required to constrain uncertainty sufficiently as to make safe decisions possible. Interval analysis techniques (e.g. the interval Newton [18]) provide efficient and safe methods for solving Continuous Constraint Satisfaction Problems [12] (CCSPs) where real variables are constrained by equalities and inequalities. These methods prune the variables domains to impose local consistency [3], guaranteedly loosing no solutions (value combinations satisfying all constraints). The results obtained may be further improved with search techniques for imposing stronger consistency requirements such as global hull consistency [6, 7]. In the context of differential equations, validated [20] and constraint based [13] approaches provide safe methods for solving initial value problems which verify the existence of unique solutions and produce guaranteed bounds for the true trajectory. In this paper we present a framework for constraint reasoning with differential equations. It uses a validated method to include Ordinary Differential Equations (ODEs) in the CCSP framework. The paper is organised as follows. Section 2 overviews the constraint reasoning framework, its constraint propagation algorithm and consistency criteria. Section 3 introduces differential equations and discusses vali- dated approaches for solving initial value problems based on Interval Taylor Series methods. Section 4 presents Corresponding author: e-mail: [email protected], Phone: +00 351 212 948 536, Fax: +00 351 212 948 541 ∗∗ Second author: e-mail: [email protected], Phone: +00 351 212 948 536, Fax: +00 351 212 948 541 c 2004 WILEY-VCH Verlag GmbH & Co. KGaA, Weinheim Appl. Num. Anal. Comp. Math. 1, No. 1, 140 154 (2004) / DOI 10.1002/anac.200310012

Constraint Reasoning with Differential Equations

Embed Size (px)

Citation preview

Page 1: Constraint Reasoning with Differential Equations

Constraint Reasoning with Differential Equations

Jorge Cruz∗1 and Pedro Barahona∗∗1

1 Centro de Inteligencia Artificial, Departamento de Informatica, Faculdade de Ciencias e Tecnologia da Uni-versidade Nova de Lisboa, 2829-516 Caparica, Portugal

Received 30 June 2003, revised 30 October 2003, accepted 2 December 2003Published online 15 March 2004

Key words Constraint Reasoning, Differential EquationsSubject classiÞcation 68U99, 68T35, 65L99

System dynamics is naturally expressed by means of differential equations. Despite their expressive power,they are difficult to reason about and to make decisions upon, given their non-linearity and the importanteffects that the uncertainty on data may cause. In contrast with traditional numerical simulations that may onlyprovide a likelihood of the results obtained, we propose a constraint reasoning framework that enables safedecision support despite data uncertainty. The approach is illustrated in the tuning of drug design and in anepidemiological study.

c© 2004 WILEY-VCH Verlag GmbH & Co. KGaA, Weinheim

1 Introduction

Parametric differential equations are a general and expressive mathematical formalism to model system dynamics.Notwithstanding its expressive power, reasoning with such models may be quite difficult, given their complexity.Analytical solutions are available only for the simplest models. Alternative numerical simulations require precisenumerical values for the parameters involved, often impossible to gather given the uncertainty on available data.

To overcome this limitation (given non-linearity, small differences on input values may cause important dif-ferences on the output produced), Monte Carlo methods rely on a large number of simulations to estimate thelikelihood of the options under study. However, they cannot provide safe conclusions, given the various sourcesof errors accumulated in the simulations (both input and round-of errors).

In contrast, constraint reasoning models the uncertainty of numerical variables through intervals of real num-bers and propagates them through a network of constraints on these variables, to decrease the underlying uncer-tainty (i.e. the width of the intervals). To be effective, advanced methods are required to constrain uncertaintysufficiently as to make safe decisions possible.

Interval analysis techniques (e.g. the interval Newton [18]) provide efficient and safe methods for solvingContinuous Constraint Satisfaction Problems [12] (CCSPs) where real variables are constrained by equalities andinequalities. These methods prune the variables domains to impose local consistency [3], guaranteedly loosingno solutions (value combinations satisfying all constraints). The results obtained may be further improved withsearch techniques for imposing stronger consistency requirements such as global hull consistency [6, 7].

In the context of differential equations, validated [20] and constraint based [13] approaches provide safemethods for solving initial value problems which verify the existence of unique solutions and produce guaranteedbounds for the true trajectory. In this paper we present a framework for constraint reasoning with differentialequations. It uses a validated method to include Ordinary Differential Equations (ODEs) in the CCSP framework.

The paper is organised as follows. Section 2 overviews the constraint reasoning framework, its constraintpropagation algorithm and consistency criteria. Section 3 introduces differential equations and discusses vali-dated approaches for solving initial value problems based on Interval Taylor Series methods. Section 4 presents

∗ Corresponding author: e-mail: [email protected], Phone: +00 351 212 948 536, Fax: +00 351 212 948 541∗∗ Second author: e-mail: [email protected], Phone: +00 351 212 948 536, Fax: +00 351 212 948 541

c© 2004 WILEY-VCH Verlag GmbH & Co. KGaA, Weinheim

Appl. Num. Anal. Comp. Math. 1, No. 1, 140 – 154 (2004) / DOI 10.1002/anac.200310012

Page 2: Constraint Reasoning with Differential Equations

Appl. Num. Anal. Comp. Math. 1, No. 1 (2004) / www.interscience.wiley.com 141

our proposal for integrating differential equations in constraint reasoning based on Constraint Satisfaction Dif-ferential Problems. The expressive power of the approach is illustrated in sections 5 and 6 for the tuning of drugdesign and the study of epidemics, respectively. The paper ends with a summary of the main conclusions.

2 Constraint Reasoning

Many real world problems can be modelled as Constraint Satisfaction Problems (CSPs) defined by a triple(X, D, C) where X is a set of variables, each with an associated domain of possible values in D, and C is aset of constraints on subsets of the variables [17]. A constraint specifies which values from the domains of itsvariables are compatible. A solution to the CSP is an assignment of values to all its variables, which satisfies allthe constraints.

In continuous CSPs (CCSPs) variable domains are continuous real intervals and constraints are equality andinequality [12]. Usually a continuous domain is represented by an F -interval (a real interval bounded by machinerepresentable floating-points) and the CCSP variable domains are represented by F -boxes (the cartesian productof F -intervals).

Constraint reasoning aims at eliminating value combinations from the initial variable domains, guaranteedlyloosing no possible solutions. It combines pruning and branching steps until a stopping criterion is satisfied. Thenext subsection describes the generic constraint propagation algorithm for pruning the variables domains. Sub-section 2.2 discusses the possible criteria that may be enforced in continuous domains. Subsection 2.3 illustratesthese techniques with a simple example.

2.1 Constraint Propagation

Partial information expressed by a constraint is used to eliminate incompatible values from the domain of itsvariables. The reduction of a variable domain is propagated to all constraints on that variable, which may furtherreduce the domains of other variables. The process, known as constraint propagation, terminates when a fixedpoint is attained and the domains cannot be further reduced.

Function prune, implemented in pseudo-code in figure 1, describes the overall constraint propagation algo-rithm used for pruning the variable domains in CCSPs. From a set of narrowing functions associated with theconstraint set and an F -box representing the variable domains, it returns either a smaller F -box or the empty set.

function prune(a set Q of narrowing functions, an F -box A )(1) S ← ∅;(2) while Q �= ∅ do;(3) choose NF ∈ Q;(4) A′ ← NF (A);(5) if A′ = ∅ then return ∅; end if;(6) P ← all NF ∈ S depending on variables whose domain as changed;(7) Q ← Q ∪ P ; S ← S \ P ;(8) if A′ = A then Q ← Q \ {NF}; S ← S ∪ {NF}; end if;(9) A ← A′;

(10) end while ;(11) return A;

end function

Fig. 1 The generic constraint propagation algorithm for continuous domains.

The algorithm is based on a cycle (lines 2-10) where A is narrowed by applying a narrowing function NFselected from Q. During the whole process, set S contains the narrowing functions for which A is necessarily afixed-point and set Q contains the remaining narrowing functions. Initially there are no guarantees on whetherA is already a with respect to any narrowing function, so S is empty (line 1) and Q contains all the narrowingfunctions.

c© 2004 WILEY-VCH Verlag GmbH & Co. KGaA, Weinheim

Page 3: Constraint Reasoning with Differential Equations

142 J. Cruz and P. Barahona: Constraint Reasoning with Differential Equations

Whenever Q is empty, A is a fixed-point for all the narrowing functions and it cannot be further pruned bythem, so the cycle terminates (line 2) and A is returned (line 11). If Q is not empty then one of its elementsNF , chosen accordingly to a selection criterion (line 3), is applied to A resulting in A′ (line 4). If the result isthe empty set, then it is proved that there is no possible value combination within A that satisfies the constraintassociated with NF and the execution terminates (line 5) returning ∅. Otherwise P is defined (line 6) as a subsetof S composed of all its elements for which A′ is no longer guaranteed to be a fixed-point. These elements, whichare the narrowing functions depending on variables whose domains were changed by applying NF to A, mustbe moved from S to Q (line 7). If A′ is a fixed-point of NF (which is guaranteed if A = A′) then NF must bemoved from Q to S (line 8). Finally, A is updated with the newly narrowed set of domains A′ (line 9) and thecurrent step of the cycle ends (line 10) starting the next cycle (line 2).

If the narrowing functions are correct (eliminating no possible CCSP solution) and contracting (the F -boxobtained is always smaller or equal than the original F -box) then it can be proved that the propagation algorithmis correct and terminates independently from the selection criterion used in line 3.

The usual approaches for associating narrowing functions to a CCSP numerical constraint consider its pro-jection functions to each variable of the constraint. Such projection function identifies, from a domains box, theset of all possible values for the variable that belong to the constraint relation. Methods from interval analysis(e.g. the interval Newton [18]) are often used for obtaining safe enclosures of such set, providing the means fordefining narrowing functions which are correct and contracting.

2.2 Consistency Criteria

The application of a constraint propagation algorithm for pruning the variable domains of a constraint system canbe regarded as enforcing some form of local consistency, since it depends on the pruning methods associated witheach individual constraint. The quality of such local consistency, that is, the pruning that may be achieved, ishighly dependent on the ability of these pruning methods (narrowing functions) for discarding value combinationsthat are inconsistent with the respective constraint.

Insufficiency of local consistency was already recognised in many practical problems not involving differentialequations and stronger forms of consistency were proposed for dealing with such problems. These are higherorder generalisations of local consistency criteria enforced by algorithms that interleave constraint propagationwith search techniques for the partition of the variable domains (a survey on the consistency criteria usuallyenforced in continuous domains can be found in [3]). However, for many practical differential problems, suchstronger consistency criteria are still not adequate for decision support. Either the pruning is unsatisfactory or therespective enforcing algorithms are too costly (computationally).

We have been developing global hull consistency [6, 7], the strongest consistency criterion for pruning theinitial CCSP variable domains into a single enclosing F -box. It narrows the original domains into the smallestF -box that contains all possible canonical solutions. A canonical solution is a canonical F -box (the smallestbox that can be represented with some specified precision) that cannot be proved inconsistent through constraintpropagation. Being a computational expensive criterion, an important property of its enforcing algorithm is itsany-time nature (partial pruning results are provided at any time during the narrowing process).

Global hull consistency seems to be particularly suited to decision support with differential models, by present-ing an adequate trade-of between domain pruning and computational effort. The ability of its enforcing algorithmto supply any-time pruning results is particularly useful in the context of decision support where the domain prun-ing is not the ultimate goal in itself (the computation may be interrupted whenever pruning is sufficient to makesafe decisions).

2.3 A Simple Example

Consider the CCSP characterised by variables x and y, initially ranging in [−2, 2] and [−2, 10] respectively, andthe following constraints:

y = x2 y ≥ 2x + 4

Figure 2a illustrates the problem, showing the initial domains box and the two constraints. Any solution of theCCSP must be within the box, above the straight line and on the curved line.

c© 2004 WILEY-VCH Verlag GmbH & Co. KGaA, Weinheim

Page 4: Constraint Reasoning with Differential Equations

Appl. Num. Anal. Comp. Math. 1, No. 1 (2004) / www.interscience.wiley.com 143

In order to apply the constraint propagation algorithm it is necessary to associate a set of narrowing functionsto the constraints of the CCSP.

One possibility is to solve each constraint with respect to each variable (after transforming the inequality intoan equality by introducing a constant k ranging in [0, +∞]):

y = x2 x = ±√y y = 2x + 4 + k x =

y − 4 − k

2

Narrowing functions for reducing the domains of the variables appearing in the left hand side of the aboveequations may then be safely defined. For a current F -box, the domains of the variables may be intersected withthe interval obtained by the interval arithmetic evaluation (with outward rounding) of the right hand side. Theresult is the following set of narrowing functions:

NF1(I1 × I2) = I1 × (I2 ∩ I21 ) (1)

NF2(I1 × I2) = ((I2 ∩ −√

I2) (I2 ∩ −√

I2)) × I2 (2)

NF3(I1 × I2) = I1 × (I2 ∩ (2I1 + 4 + [0, +∞])) (3)

NF4(I1 × I2) = (I2 ∩ I1 − 4 − [0, +∞]2

) × I2 (4)

Using the propagation algorithm of figure 1 with the above set of narrowing functions for pruning the initialF -box [−2, 2] × [−2, 10], the result is the smaller F -box [−2, 0] × [0, 4] illustrated in figure 2b. This would bethe box obtained by enforcing local consistency. As easily checked in the figure, it could be further narrowedwithout losing CCSP solutions, but constraint propagation alone does not achieve it.

To proceed, it is necessary to split the domains box and reapply constraint propagation to each sub-box. Figure2c shows the pruning achieved on the boxes obtained by dividing the domain of variable y in two halves.

The branch and prune process terminates when the chosen consistency criterion for solving the CCSP is sat-isfied. Figure 2d illustrates the single enclosing box that would be obtained by enforcing global hull consistency.Note that such box is the smallest box enclosing all the CCSP canonical solutions and any further pruning isprevented due to the canonical solutions placed in its upper left and lower right edges.

-2

0

2

4

6

8

10

-4 -2 0 2 4

y

xa)

-2

0

2

4

6

8

10

-4 -2 0 2 4

y

xb)

-2

0

2

4

6

8

10

-4 -2 0 2 4

y

xc)

-2

0

2

4

6

8

10

-4 -2 0 2 4

y

xd)

Fig. 2 Solving a simple CCSP. (a) Initial domains box; (b) Box obtained after constraint propagation; (c) Pruning achievedafter branching. (d) Enclosing box obtained by enforcing global hull consistency.

3 Differential Equations

The behaviour of many systems is naturally modelled by a system of first order Ordinary Differential Equations(ODEs), often parametric. ODEs are equations that involve derivatives with respect to a single independentvariable, t, usually representing time.

An ODE system S, represented in vector notation as

dy

dt= f(y, t)

determines, for an instantiation of y and t, the evolution of y for an increment of t, and may be regarded as arestriction on the sequence of values that y can take over t. With no loss of generality, the same notation may be

c© 2004 WILEY-VCH Verlag GmbH & Co. KGaA, Weinheim

Page 5: Constraint Reasoning with Differential Equations

144 J. Cruz and P. Barahona: Constraint Reasoning with Differential Equations

used for representing parametric ODEs where the parameters are included as additional components with zeroderivatives.

A solution of the ODE system S, for a time interval T , is a function s satisfying the restrictions in S during T :

∀t ∈ T :ds

dt= f(s(t), t)

Since S does not fully determine the sequence of values of y (but rather a family of such sequences), initial /boundary conditions are usually provided with a complete / partial specification of y at some time point t.

An Initial Value Problem (IVP) is characterised by an ODE system S together with the initial condition y(t0) =y0. A solution of the IVP with respect to an interval of time T (where t ∈ T ) is a solution s of S (during T ) thatsatisfies s(t0) = y0.

Classical numerical approaches for solving IVPs [24] compute numerical approximations of the solutions anddo not provide guarantees on their accuracy. A sequence of discrete points t0, t1, , ti is considered within theinterval of time T and for each new point ti+1, the solution s(ti+1) is approximated by a value si+1 computedfrom the approximated values at the previous points.

In contrast, interval methods [18, 15, 20], also known as validated methods, do verify the existence of uniquesolutions and produce guaranteed error bounds for the solution trajectory along the whole interval of time T .They use interval arithmetic to calculate each approximation step, explicitly keeping the error term within safeinterval bounds.

In most interval approaches, each step between two consecutive points ti and ti+1 generally consists of twophases. The first validates the existence of a unique solution and calculates an a priori enclosure of it betweenthe two points. In the second phase, a tighter enclosure of the solution function at point ti+1 is obtained throughinterval arithmetic over a chosen numerical approximation step, with the error term bounded as a result of theenclosure of the previous phase. The Interval Taylor Series (ITS) approximation step is often used due to itssimple error term form, which can be bounded as long as some enclosure of the solution function is provided.

3.1 Interval Taylor Series Methods

Interval Taylor Series (ITS) methods are based on the Taylor series expansion of the solution function s(t) aroundpoint ti. From Taylor’s theorem, if s(t) is p times continuously differentiable on the closed interval [ti, ti+1] andp+1 times differentiable on the open interval (ti, ti+1) then (with h=ti+1-ti and ξ ∈ [ti, ti+1]):

s(ti+1) = s(ti) +p∑

k=1

(hk

k!s(k)(ti)

)+

hp+1

(p + 1)!s(p+1)(ξ) (5)

Instead of neglecting the error term, as done in traditional Taylor Series methods, ITS methods use intervalarithmetic to obtain reliable enclosures not only for the error term but also for every term of the series, allowingthe computation of a reliable enclosure of the solution function at point ti+1. Usually, and without loss ofgenerality, ITS methods assume that the ODE system is autonomous and rewrite the above equation into:

s(ti+1) = s(ti) +p∑

k=1

(hkf [k](s(ti))

)+ hp+1f [p+1](s(ξ)) (6)

where f [k](s(ti)) denotes the kth Taylor coefficient of function s at the point ti:

f [k](s(ti)) =1k!

s(k)(ti) (7)

In [18], Moore proposed a simple procedure for the reliable computation of the Taylor coefficients up to someintended order. An efficient implementation of this method is available at the public domain software packageTADIFF [2] (implemented in C++).With reliable enclosures for the Taylor coefficients, interval extensions of theTaylor series expansion of ODE solution functions may be computed. This is extensively used in ITS methodsnot only for enclosing the value, at point ti+1, of a single solution function s(t) with initial condition s(ti) = si,but also to enclose such value for the set of solution functions whose values at the point ti are within interval Si.

c© 2004 WILEY-VCH Verlag GmbH & Co. KGaA, Weinheim

Page 6: Constraint Reasoning with Differential Equations

Appl. Num. Anal. Comp. Math. 1, No. 1 (2004) / www.interscience.wiley.com 145

Usually the validation and enclosure of solutions of an ODE system between two discrete points ti and ti+1

is based on the Banach fixed-point theorem and the application of the Picard-Lindelof operator (see [21, 26] fordetails). The following theorem (proved in [11, 15]) may be used for defining a first order enclosure methodbased on the (first-order) interval Picard operator.

Theorem 3.1 (Interval Picard Operator). Let O be an autonomous ODE system of n equations dydt = f(y).

Let f be continuous with Þrst order partial derivatives over t ∈ [ti, ti+1]. Let Si ⊆ S be two n-ary boxes, F aninterval extension of f , and h = ti+1 − ti. The interval Picard operator Φ is a vector interval function:

Φ(S) = Si + [0, h]F (S)

If Φ(S) ⊆ S then for every si ∈ Si, the IVP deÞned by O and the initial condition y(ti) = si has a uniquesolution s and ∀t∈[ti,ti+1]s(t) ∈ Φ(S).

Based on the interval Picard operator, algorithms to obtain an enclosure for the set of solution functions whosevalues at ti are within the box Si may be generally described as follows. Firstly, an adequated step size h ischosen together with an initial guess S0 for the enclosure (with Si ∈ S0). Then the interval Picard operator isapplied to obtain the box S = Φ(S0). If S ⊆ S0 then, by theorem 3.1, S is an enclosure for the set of solutionfunctions between ti and ti+h. Otherwise, two different strategies may be recursively applied: either the initialguess S0 is inflated to enclose more solutions of the ODE for the same step size; or the step size is reduced tosatisfy Φ(S0) ⊆ S0 (note that for a small enough step h this property can always be satisfied). The final resultof such algorithms is a box S[i,i+1] and a step size h (not necessarily the initially one) for which the box is anenclosure of the set of solution functions whose values at ti are within the box Si.

Several ITS proposals [14, 11, 15, 27] rely on the use of a first order enclosure method for the validationand enclosure of ODE solutions at its first phase. The major drawback of these approaches is that the step sizerestriction imposed by the (first-order) interval Picard operator is often much more severe than the limitationsimposed in the second phase, based on higher order Taylor series expansions. Alternative higher order enclosuremethods [16, 4, 20, 22] were also proposed for this first phase, allowing larger step sizes more compatible withthe second phase algorithms.

Once obtained an enclosure box S[i,i+1] for the set of solutions between two points, ti and ti+1, a straightfor-ward ITS method for computing a tight enclosure at ti+1 is directly based on the interval extension of (6):

Si+1 = Si +p∑

k=1

(hkF [k](Si)

)+ hp+1F [p+1](S[i,i+1]) (8)

where Si and Si+1 are enclosing boxes at points ti and ti+1 respectively, and F [k](S) is a reliable enclosure ofthe kth Taylor coefficient of the solution function at any point within the box S.

However, the above method usually leads to large overestimations of the enclosing box at point ti+1. A betterapproach is to use a Mean Value interval extension of the Taylor series with respect to the box Si. In this case, amethod known as the ITS direct method is obtained:

Si+1 = c +p∑

k=1

(hkF [k](c)

)+ hp+1F [p+1](S[i,i+1]) +

[I +

p∑k=1

(hkJ(f [k], Si)

)]× (Si − c) (9)

where c is the mid point of box Si and J(f [k], Si) is the Jacobian of f [k] evaluated at box Si. The Jacobian maybe obtained by automatic differentiation of the Taylor coefficient [1, 2].

The above form possesses a quadratic approximation property, quite advantageous when the boxes are small.However, the overestimation of enclosing boxes at consecutive points may accumulate as the integration proceeds(a phenomenon known as the wrapping effect) and lead to unreasonable results.

Several strategies have been proposed for reducing the overestimation and, in particular, for handling the wrap-ping effect [18, 14, 11, 15, 23]. The most successful enclosing methods are based on changes of the coordinatesystem at each step of the integration process, aiming at reducing the most the overestimation of the domains boxrepresentation.

c© 2004 WILEY-VCH Verlag GmbH & Co. KGaA, Weinheim

Page 7: Constraint Reasoning with Differential Equations

146 J. Cruz and P. Barahona: Constraint Reasoning with Differential Equations

4 Constraint Reasoning for Differential Equations

The application of constraint techniques for solving IVPs provided competitive results either in the precisionof the trajectory enclosure bounds or in the efficiency of the computations [10, 13]. However, these validatedmethods, do not allow full constraint reasoning in general differential problems, since they do not explicitlymodel the solution functions. Hence, it is not possible to declaratively handle constraints such as ”the solutionfunction should not exceed a certain value” or ”should not exceed a value for more than a certain period of time”,neither is it possible to derive safe ranges for the parameters that satisfy such constraints.

The full integration of differential equations into the constraint framework was only recently proposed [9, 8].In this approach, an ODE system together with related information is denoted a Constraint Satisfaction Differ-ential Problem (CSDP) and is integrated in the framework as a new kind of constraint. The procedure proposedfor solving the CSDP is used as a correct narrowing function for the constraint, which, together with the usualnarrowing functions associated with the numerical constraints, completely characterizes the set of narrowingfunctions of the extended constraint framework. This set may then be used by a constraint propagation algorithm(figure 1) to prune the variable domains. The next subsection introduces the main CSDP concepts and subsection4.2 briefly discusses the CSDP solving procedure (a complete explanation of the approach may be found in [9]).

4.1 Constraint Satisfaction Differential Problems

A CSDP is a Constraint Satisfaction Problem (CSP) with a special variable, a special constraint and additionalconstraints and variables for representing additional restrictions. The special variable (xODE), whose domain is aset of functions, is associated with an ODE system S for every t within the interval T through the ODE constraint,ODES,T (xODE). Variable xODE , denoted solution variable, represents those functions that are solutions of S(during T ) and satisfy all the additional restrictions.

DeÞnition 4.1 (ODE Constraint). Let S be an n-ary ODE system dydt = f(y, t), T a real interval, and FT the

set of all functions from T to Rn. The ODE constraint, denoted ODES,T (xODE), is defined by means of:

(i) a unary constraint scope: the solution variable xODE ;(ii) a constraint relation ρ = {〈s〉|s ∈ FT ∧ ∀t ∈ T : ds

dt = f(s(t), t)}The other variables of the CSDP, denoted restriction variables, are all real valued variables used to model a

number of constraints of interest in many applications. Such constraints, that we refer to as ODE restrictions,associate some restriction variable with the value of some property of the ODE solutions. Such property isspecified through a function from the set of functions FT to R.

DeÞnition 4.2 (ODE Restriction). Let S be an n-ary ODE system dydt = f(y, t), T a real interval, FT the set

of all functions from T to Rn, and r a function from FT to R. An ODE restriction w.r.t. r is defined by means of:

(i) a binary constraint scope: the solution variable xODE and a real variable x;(ii) a constraint relation ρ = {〈s, v〉|s ∈ FT ∧ v ∈ R ∧ v = r(s)}

With the above definitions, a CSDP may be formalized as a special case of a CSP.

DeÞnition 4.3 (CSDP). Let S be an n-ary ODE system dydt = f(y, t), T a real interval, and FT the set of all

functions from T to Rn. A CSDP is a CSP where:

1. the set of variables includes the solution variable xODE and m restriction variables x1,. . . ,xm;

2. the initial domain of the solution variable DxODE is FT and the initial domains of the restriction variablesDx1,. . . ,Dxm are real intervals;

3. the set of constraints is composed of the ODE constraint ODES,T (xODE) and a set of ODE restrictionswith scope 〈xODE , xi〉(1 ≤ i ≤ m).

All the information traditionally associated with an ODE problem may be represented as a CSDP. Moreover,the CSDP framework allows the specification of additional useful information that cannot be easily handled byclassical approaches.

Initial and boundary conditions are represented by a set of constraints denoted Value restrictions. A Valuerestriction V aluej,t(x) associates a variable x with the value of a trajectory component j at a particular time t.

c© 2004 WILEY-VCH Verlag GmbH & Co. KGaA, Weinheim

Page 8: Constraint Reasoning with Differential Equations

Appl. Num. Anal. Comp. Math. 1, No. 1 (2004) / www.interscience.wiley.com 147

DeÞnition 4.4 (Value Restrictions). Let S be an n-ary ODE system dydt = f(y, t), T a real interval, tp ∈ T

and 1 ≤ j ≤ n. Let FT be the set of functions from T to Rn, r a function from FT to R, s ∈ FT and sj the jth

component of s. A Value restriction V aluej,tp(x) is an ODE restriction w.r.t. r defined as: r(s) = sj(tp).

Besides initial and boundary conditions, and regarding an ODE solution as a continuous vector function (andeach of its components as a continuous real function), several other conditions of interest may be imposed,namely, Maximum, Minimum, Time, Area, First and Last restrictions.

A Maximum restriction Maximumj,τ(x) associates x with the maximum value of a trajectory component jwithin a time interval τ (Minimum restrictions are similar).

DeÞnition 4.5 (Maximum Restrictions). Let S be an n-ary ODE system dydt = f(y, t), τ ⊆ T real intervals

and 1 ≤ j ≤ n. Let FT be the set of functions from T to Rn, r a function from FT to R, s ∈ FT and sj

the jth component of s. A Maximum restriction Maximumj,τ(x) is an ODE restriction w.r.t. r defined as:r(s) = sj(tp) with tp ∈ τ and ∀t∈τsj(t) ≤ sj(tp).

Other restrictions have been considered. A Time restriction T imej,τ,≥θ(x) associates x with the time withintime period τ in which the value of a trajectory component j exceeds a threshold θ. Similarly, the Area restrictionAreaj,τ,≥θ(x) associates x with the area of a trajectory component j, within time period τ , above threshold θ.

Restriction FirstV aluej,τ,≥θ(x) associates x with the first time within τ in which the value of a trajectorycomponent j exceeds θ. Restrictions FirstMaximumj,τ (x) and FirstMinimumj,τ(x) associate x with thefirst time within τ in which the value of a trajectory component j is respectively a maximum or a minimum.Restrictions LastV aluej,τ,≥θ(x), LastMaximumj,τ(x) and LastMinimumj,τ(x) are similar.

4.2 Solving Constraint Satisfaction Differential Problems

In [9] a procedure for solving a CSDP is proposed to prune the domains of its restriction variables. It is imple-mented as a function solveCSDP which, from a real box representing the domains of the restriction variables,returns a smaller real box discarding some value combinations that can be proved to be inconsistent with theCSDP. As long as the solveCSDP function is correct, not eliminating any possible CSDP solution, and con-tracting, returning a smaller real box, it may be used as a correct narrowing function for the CSDP constraint.

The solving procedure for CSDPs maintains a safe enclosure for the set of possible solutions based on an ITSmethod for initial value problems. The enclosure is implemented as sequences of boxes representing enclosuresalong the whole interval of time T associated with the ODE system. The improvement of such enclosure iscombined with the enforcement of the ODE restrictions through constraint propagation on a set of narrowingfunctions associated with the CSDP.

Some narrowing functions are responsible for reducing the domain of a restriction variable according to thecurrent trajectory enclosure. The safety of such pruning is easily guaranteed by identifying the functions withinthe current enclosure that maximise and minimise the value of the restriction variable. For example, the value ofan area restriction variable is maximised by a function that for every value of t associates the maximum possibletrajectory value within the current enclosure. Consequently, the upper bound of such restriction variable cannotexceed the area computed for such extreme function.

Other narrowing functions are responsible for safely reducing the uncertainty of the trajectory enclosure ac-cording to the domain of a restriction variable. For example, the trajectory enclosure cannot exceed the upperbound of a maximum restriction variable.

The following are examples of the narrowing functions associated with the Value and Maximum restrictions.For each ODE restriction an appropriate pair of narrowing functions is similarly defined.

DeÞnition 4.6 (Value Narrowing Functions). Let TR be the trajectory enclosure representing the domain ofxODE and I the domain of x. Let [a, b] be the TR interval enclosure of component j at point tp. Let TR′ be thetrajectory enclosure obtained from TR by changing such interval enclosure to [a, b] ∩ I . The Value restrictionV aluej,tp(x) has associated the pair of narrowing functions:

(i) NF1(〈TR, . . . , I, . . .〉) = 〈TR, . . . , [a, b] ∩ I, . . .〉(ii) NF2(〈TR, . . . , I, . . .〉) = 〈TR′, . . . , I, . . .〉

c© 2004 WILEY-VCH Verlag GmbH & Co. KGaA, Weinheim

Page 9: Constraint Reasoning with Differential Equations

148 J. Cruz and P. Barahona: Constraint Reasoning with Differential Equations

DeÞnition 4.7 (Maximum Narrowing Functions). Let TR be the trajectory enclosure representing the do-main of xODE and I = [i1, i2] the domain of x. Let a and b be respectively the maximum of the lower boundsand the maximum of the upper bounds for the TR interval enclosures of component j during time τ . Let TR′ bethe trajectory enclosure obtained from TR by changing each interval enclosure S for component j during time τto S ∩ [−∞, i2]. The Maximum restriction Maximumj,τ(x) has associated the pair of narrowing functions:

(i) NF1(〈TR, . . . , I, . . .〉) = 〈TR, . . . , [a, b] ∩ I, . . .〉(ii) NF2(〈TR, . . . , I, . . .〉) = 〈TR′, . . . , I, . . .〉

All the remaining narrowing functions of a CSDP are associated with the ODE constraint relation and areresponsible for reducing the uncertainty of the trajectory enclosure by the successive application of an IntervalTaylor Series (ITS) method between consecutive time points.

The narrowing function NFlink uses the ITS method to validate (link) some time gap for which the methodwas never applied in either direction. As a consequence, besides the safe elimination from the trajectory of somefunctions incompatible with the ODE constraint, the time gap may become completely or partially validated (inthis case, the reapplication of the link narrowing function is needed to completely validate the gap). The followingis a definition of a link narrowing function that aims at validating a time gap in the forward direction. A similarnarrowing function is obtained by considering the application of the ITS method in the opposite direction.

DeÞnition 4.8 (Link Narrowing Function). Let S be an n-ary ODE system dydt = f(y, t) and [ti, tj ] ⊆ T

real intervals. Let TR be the trajectory enclosure representing the domain of xODE and Si its box enclosure attime point ti. Let boxes Si+1 and S[i,i+1] be the enclosures for the time point ti+1 ∈ [ti, tj ] and the time interval[ti, ti+1] obtained by applying an ITS method from ti to tj . Let TR′ be the trajectory enclosure obtained fromTR by intersecting the box enclosure at time point ti+1 with Si+1 and the box enclosure during time (ti, ti+1)with S[i,i+1]. The ODE constraint, ODES,T (xODE) has associated the following link narrowing function:

(i) NFlink(〈TR, . . .〉) = 〈TR′, . . .〉

The propagate narrowing function NFpropagate prunes the ODE trajectory through the reapplication of theITS method over some time gap, which is chosen to contain the time point with the largest enclosure reductionsince the previous application of the ITS method. This heuristics assumes that, when an enclosure for the ODEsolutions at some time point is reduced by some narrowing function, the reapplication of the ITS method over theadjacent time gaps may further prune these gaps. Moreover, the repeated application of the interval step method,triggered by the reduction of the enclosures, propagates this pruning along the ODE trajectory gaps, previouslyvalidated with larger starting enclosures. The definition of the propagate narrowing function is similar to 4.8except that the time gap between ti and tj was already previous validated and bounded.

The improve narrowing function NFimprove is associated with the ODE constraint to reduce a time gapenclosure through the insertion of a new intermediate time point within the gap and the subsequent application ofthe ITS method linking this point with its adjacent neighbors.

The constraint propagation algorithm for pruning the domains of the CSDP variables is derived from thegeneric propagation algorithm presented in figure 1 for pruning the domains of the variables of a CCSP. The onlydifference is the imposition of an ordering on the application of the narrowing functions.

The strategy followed by the algorithm is to propagate as soon as possible any information related with therestriction variables and delay as much as possible the application of the narrowing functions for reducing theODE trajectory uncertainty. The reason is that whereas the former are easy to deal with and may provide fastpruning, the latter may be computationally more expensive as they require the application of the ITS method.

Among the narrowing functions for reducing the ODE trajectory uncertainty, the selection criterion favorsthe propagate narrowing function for spreading as soon as possible any domain reduction achieved by any othernarrowing function. Moreover, since it does not make sense to try to improve an ODE trajectory that is notcompletely validated, the link narrowing function is always preferred to an improve narrowing function.

c© 2004 WILEY-VCH Verlag GmbH & Co. KGaA, Weinheim

Page 10: Constraint Reasoning with Differential Equations

Appl. Num. Anal. Comp. Math. 1, No. 1 (2004) / www.interscience.wiley.com 149

5 A Differential Model for Drug Design

The gastro-intestinal absorption process subsequent to the oral administration of a therapeutic drug is usuallymodeled by the following two-compartment model [25]:

dx(t)dt

= −p1x(t) + D(t)dy(t)dt

= p1x(t) − p2y(t) (10)

where x is the concentration of the drug in the gastro-intestinal tract;y is the concentration of the drug in the blood stream;D is the drug intake regimen; p1 and p2 are positive parameters.

The model considers two compartments, the gastro-intestinal tract and the blood stream. The drug enters thegastro-intestinal tract according to a drug intake regimen, described as a function of time D(t). It is then absorbedinto the blood stream at a rate, p1, proportional to its gastro-intestinal concentration and independently from itsblood concentration. The drug is removed from the blood through a metabolic process at a rate, p2, proportionalto its concentration there.

The effect of the intake regimen D(t) on the concentrations of the drug in the blood stream during the ad-ministration period is determined by the absorption and metabolic parameters, p1 and p2. We assume that thedrug is taken in a periodic basis (every six hours), providing a unit dosage that is uniformly dissolved into thegastro-intestinal tract during the first half hour:

D(t) ={

2 if 0.0 ≤ t ≤ 0.50 if 0.5 < t ≤ 6.0

Maintaining such intake regimen, the solution of the ODE system asymptotically converges to a six hoursperiodic trajectory, the limit cycle, shown in Figure 3 for specific values of the ODE parameters.

0

0.5

1

0 1 2 3 4 5 6t

x(t)

0.5

1

1.5

0 1 2 3 4 5 6t

y(t)

Fig. 3 The periodic limit cycle with p1 = 1.2 and p2 = ln(2)/5.

In designing a drug, it is necessary to adjust the ODE parameters to guarantee that the drug concentrations areeffective, but causing no harmfull side effects. In general, it is sufficient to guarantee some constraints on thedrug blood concentrations during the limit cycle, namely, to impose bounds on its values, on the area under thecurve and on the total time it remains above some threshold.

We show below how the extended CCSP framework can be used for supporting the drug design process. Wewill focus on the absorption parameter, p1, which may be adjusted by appropriate time release mechanisms (themetabolic parameter p2, tends to be characteristic of the drug itself and cannot be easily modified). The tuningof p1 should satisfy the following requirements on the drug concentration in the blood during the limit cycle,namely: (i) Its ”instant” value must be bounded between 0.8 and 1.5; (ii) Its area under the curve (and above 1.0)bounded between 1.2 and 1.3; (iii) Its value should not last for more than 4 hours above 1.1.

5.1 Using the Extended CCSP for Parameter Tuning

The limit cycle and all the additional requirements may be represented in the extended CCSP framework. Dueto the intake regimen definition D(t), the ODE system has a discontinuity at time t = 0.5, and is represented bytwo CSDP constraints in sequence. The first, PS1 , ranges from the beginning of the limit cycle (t = 0.0) to timet = 0.5, and the second PS2 , is associated to the remaining trajectory of the limit cycle (until t = 6.0).

c© 2004 WILEY-VCH Verlag GmbH & Co. KGaA, Weinheim

Page 11: Constraint Reasoning with Differential Equations

150 J. Cruz and P. Barahona: Constraint Reasoning with Differential Equations

S1 and S2 are the corresponding ODE systems, where p1 and p2 are included as new components (s3 and s4,respectively) with null derivatives and the intake regimen D(t) is a constant:

S1 ≡

s′1 = −s3(t)s1(t) + 2s′2 = s3(t)s1(t) − s4(t)s2(t)s′3 = 0s′4 = 0

S2 ≡

s′1 = −s3(t)s1(t)s′2 = s3(t)s1(t) − s4(t)s2(t)s′3 = 0s′4 = 0

The CSDP constraints for PS1 are defined as shown below (PS2 is similar). Besides the ODE constraint, Value,Maximum, Minimum, Area and Time restrictions associate variables with different trajectory properties relevantin this problem. Variables xinit, yinit, p1 and p2 are the initial trajectory values, and xfin and yfin are thefinal trajectory values of the 1st and 2nd components. Variables ymax and ymin are the maximum and minimumtrajectory values of the 2nd component (drug concentration in the blood stream) for this period. Variables ya andyt denote the area above 1.0 and the time above 1.1 of the 2nd component in this same period.

CCSP PS1 = (X1, D1, C1) where:X1 = < xODE , xinit, yinit, p1, p2, xfin, yfin, ymax, ymin, ya, yt >D1 = < DxODE , Dxinit, Dyinit, Dp1, Dp2, Dxfin, Dyfin, Dymax, Dymin, Dya, Dyt >C1 = { ODES1,[0.0,0.5](xODE),

V alue1,0.0(xinit), V alue2,0.0(yinit), V alue3,0.0(p1), V alue4,0.0(p2),V alue1,0.5(xfin), V alue2,0.5(yfin),Maximum2,[0.0,0.5](ymax), Minimum2,[0.0,0.5](ymin),Area2,[0.0,0.5],≥1.0(ya), T ime2,[0.0,0.5],≥1.1(yt)}

The extended CCSP P , shown below, connects in sequence the two ODE segments by assigning the samevariables to both the final values of PS1 and the initial values of PS2 (parameters p1 and p2 are shared by bothconstraints). Moreover, the 6 hours period is guaranteed by the assignment of the same variables to both theinitial values of PS1 and the final values of PS2 . In addition to the restriction variables of each ODE segment,new variables for the whole trajectory sum up the values in each segment.

CCSP P = (X, D, C) where:X = < x0, y0, p1, p2, x05, y05, ymax1, ymax2, ymin1, ymin2, ya1, ya2, yarea, yt1, yt2, ytime >D = <Dx0,Dy0,Dp1,Dp2,Dx05,Dy05,Dymax1,Dymax2,Dymin1,Dymin2,Dya1,Dya2,Dyarea,Dyt1,Dyt2,Dytime>C = { PS1(x0, y0, p1, p2, x05, y05, ymax1, ymin1, ya1, yt1), yarea = ya1 + ya2,

PS2(x05, y05, p1, p2, x0, y0, ymax2, ymin2, ya2, yt2), ytime = yt1 + yt2}The tuning of drug design is thus supported by solving P with the appropriate set of initial domains for its

variables. We will assume p2 to be fixed to a five-hour half live (Dp2 = [ln(2)/5]) and p1 to be adjustable up toabout ten-minutes half live (Dp1 = [0, 4]). The initial value x0, always very small, is safely bounded in intervalDx0 = [0.0, 0.5]. Additionally, the following bounds are imposed by the previous drug requirements:

Dymin1 = [0.8, 1.5], Dymax1 = [0.8, 1.5], Dyarea = [1.2, 1.3],Dymin2 = [0.8, 1.5], Dymax2 = [0.8, 1.5], Dytime = [0.0, 4.0].

Solving the extended CCSP P (enforcing global hull consistency), with a precision of 10−3, narrows theoriginal p1 interval to [1.191, 1.543] in less than 3 minutes (the tests were executed in a Pentium 4 computerat 1.5 GHz with 128 Mbytes memory). Hence, for p1 outside this interval the set of requirements cannot besatisfied.

This may help to adjust p1 but offers no guarantees on specific choices within the obtained interval. However,guaranteed results may be obtained for particular choices of the p1 values. Solving P with initial domainsDx0 = [0.0, 0.5], Dy0 = [0.8, 1.5], Dp1 = [1.3, 1.4] and Dp2 = [ln(2)/5] narrows the remaining unboundeddomains to:

ymin1 ∈ [0.881, 0.891], ymax1 ∈ [1.090, 1.102], yarea ∈ [1.282, 1.300],ymin2 ∈ [0.884, 0.894], ymax2 ∈ [1.447, 1.462], ytime ∈ [3.908, 3.967].

Notwithstanding the uncertainty, these results do prove that with p1 within [1.3, 1.4] (an acceptable uncertaintyin the manufacturing process), all limit cycle requirements are safely guaranteed. Moreover, they offer someinsight on the requirements showing, for instance, the area to be the most critical constraint.

c© 2004 WILEY-VCH Verlag GmbH & Co. KGaA, Weinheim

Page 12: Constraint Reasoning with Differential Equations

Appl. Num. Anal. Comp. Math. 1, No. 1 (2004) / www.interscience.wiley.com 151

6 The SIR Model of Epidemics

The SIR model [19] is a well-known model of epidemics which divides a population into three classes of indi-viduals and is based of the following parametric ODE system:

dS(t)dt

= −rS(t)I(t)dI(t)dt

= rS(t)I(t) − aI(t)dR(t)

dt= aI(t) (11)

where S are the susceptibles - individuals who can catch the disease;I are the infectives - individuals who have the disease and can transmit it;R are the removed - individuals who had the disease and are immune or died;r and a are positive parameters.

The model assumes that the total population N is constant (N = S(t)+I(t)+R(t)) and the incubation periodis negligible. Parameter r accounts for the efficiency of the disease transmission (proportional to the frequencyof contacts between susceptibles and infectives). Parameter a measures the recovery rate from the infection.

Important questions in epidemic situations are: whether the infection will spread or not; what will be themaximum number of infectives; when will it start to decline; when will it ends; and how many people will catchthe disease.

Frequently, there is information available about the spread of a disease on a particular population. This isusually gathered as series of time-infectives (ti, Ii) or time-removed (ti, Ri) data points together with the values(t0, S0), (t0, I0) or (t0, R0) that initiated the epidemics on the population. An important problem is to predict thebehaviour of a similar disease (with similar parameter values) when occurring in a different environment, namelywith a different population size or a different number of initial infectives.

The following study is based on data reported in the British Medical Journal (4th March 1978) from an in-fluenza epidemic that occurred in an English boarding school (taken from [19]): a single boy (from a totalpopulation of 763) initiated the epidemics and the evolution of the number of infectives, available daily, from day3 to day 14, is shown in table 1.

Table 1 Infectives reported during an epidemics in an English boarding school.

ti 0 3 4 5 6 7 8 9 10 11 12 13 14Ii 1 22 78 222 300 256 233 189 128 72 28 11 6

The goal of our study is to predict what would happen if a similar disease occurs in a different place, say asmall town with a population of about 10000 individuals. Moreover, if there is a vaccine to that disease, whatwould be the vaccination rate necessary to guarantee that the maximum number of infectives never exceeds somepredefined threshold, for example, half of the total population.

6.1 Using the Extended CCSP for Predicting the Epidemic Behaviour

The first step for solving the above problem is to characterize an epidemic disease which is similar to the onereported in the boarding school. The classical approach would be to perform a numerical best fit approximationto compute the parameter values r′ and a′ that minimize the residual:

m∑j=1

(I(tj) − Itj

)2

where It1 , . . . , Itm are the infectives observed at times t1, . . . , tm, and I(t1), . . . , I(tm) their respective valuespredicted by the SIR model (11) with r = r′ and a = a′. In [19] this method is used to compute r = 0.00218and a = 0.44036 with a residual of 4221.

However, generating a single value for each parameter does not capture the essence of the problem which isnot to determine the most similar disease but rather to reason with a set of similar enough diseases. Moreoversuch approach does not provide any sensitive analysis about the quality of the data fitting, namely on the effectsof small changes on the parameter values.

c© 2004 WILEY-VCH Verlag GmbH & Co. KGaA, Weinheim

Page 13: Constraint Reasoning with Differential Equations

152 J. Cruz and P. Barahona: Constraint Reasoning with Differential Equations

An alternative, possible in a constraints framework, is to relax the imposition of the ”best” fit and merelyimpose a ”good” fit. This can be achieved either by considering acceptable errors εj for each observed data andcomputing ranges for the parameters such that the distance between the model predictions and the observed datadoes not exceed these errors or by imposing some upper bound on the residual value (or any other measure of theunfitness of the model).

Either the first approach, known as the data driven inverse problem, or the second approach, denoted here asthe maximum residual problem, cannot be solved by classical constraint approaches since the epidemic modelhas no analytical solution form.

However, both problems can be represented as extended CCSPs, P1 and P2, respectively, which include aCSDP constraint PS , representing the evolution of the susceptibles and infectives during the reported period oftime (the first 14 days). The associated ODE system S is composed by the first two components of the SIR modeltogether with two extra components with null derivatives for representing the parameters1:

S ≡

s′1 = −0.01s3(t)s1(t)s2(t)s′2 = 0.01s3(t)s1(t)s2(t)) − s4(t)s2(t)s′3 = 0s′4 = 0

CSDP PS contains several Value restrictions for associating variables with: the initial values of the suscep-tible (s0) and infective (i0); the parameter values (r and a); and the values of the infective at times 3, . . . , 14(i3, . . . , i14).

CCSP PS = (X, D, C) where:X = < xODE , s0, i0, r, a, i3, . . . , i14 >D = < DxODE , Ds0, Di0, Dr, Da, Di3, . . . , Di14 >C = { ODES,[0.0,14.0](xODE),

V alue1,0.0(s0), V alue2,0.0(i0), V alue3,0.0(r), V alue4,0.0(a),V alue2,3.0(i3), . . . , V alue2,14.0(i14)}

The extended CCSP P1, which represents the data driven inverse problem, contains a single constraint definedas CSDP PS . The extended CCSP P2, which represents the maximum residual problem, besides CSDP constraintPS , contains also a numerical constraint defining the residual (R) from the variables i3, . . . , i14 and the observedvalues (represented as constants k3, . . . , k14).

P1 = (X1, D1, C1) :X1 =< s0, i0, r, a, i3, . . . , i14 >D1 =< Ds0, Di0, Dr, Da, Di3, . . . , Di14 >C1 = { PS(s0, i0, r, a, i3, . . . , i14)}

P2 = (X2, D2, C2) :X2 =< s0, i0, r, a, i3, . . . , i14, R >D2 =< Ds0, Di0, Dr, Da, Di3, . . . , Di14, DR >

C2 = { PS(s0, i0, r, a, i3, . . . , i14), R =∑14

j=3 (ij − kj)2}

Assuming very wide initial parameter ranges (Dr = Da = [0, 1]), the ”good” fit requirement can now beenforced by solving either P1 or P2 with appropriate initial domains for the remaining variables (the values ofthe susceptible and infective are initialized accordingly to the report, Ds0 = [762] and Di0 = [1]). In the caseof P1, each Dij should be initialized with the interval [kj − εj, kj + εj ] (for example with εj = 30). In the caseof P2, all Dij are kept unbounded, but the residual initial domain DR must be upper bounded (for example withDR = [0, 4800]).

Enforcing global hull consistency (with precision 10−6) on P1 with εj = 30, the parameter ranges are nar-rowed from [0,1] to:

r ∈ [0.214, 0.222] a ∈ [0.425, 0.466].

Identical narrowing would be obtained by enforcing global hull consistency (with precision 10−6) on P2 withDR = [0, 4800]:

r ∈ [0.213, 0.224] a ∈ [0.423, 0.468].

1 In the equations r is multiplied by 0.01 re-scaling it to the interval [0,1] (its best fit value 0.00218 is re-scaled to 0.218).

c© 2004 WILEY-VCH Verlag GmbH & Co. KGaA, Weinheim

Page 14: Constraint Reasoning with Differential Equations

Appl. Num. Anal. Comp. Math. 1, No. 1 (2004) / www.interscience.wiley.com 153

Once obtained the parameter ranges that may be considered acceptable to characterize epidemic diseasessimilar to the one observed, the next step is to use them for making predictions in the new context of a populationof 10000 individuals.

In this case a single CSDP constraint represents the first two components of the model together with ODErestrictions associating variables with the predicted values (besides the Value restrictions to associate variableswith the parameter values r and a and the initial values s0 and i0). A Maximum restriction represents theinfectives maximum value imax and a First restriction represents the time of such maximum tmax. A Lastrestriction represents the duration tend of the epidemics as the last time that the number of infectives exceeds 1.Finally a Value restriction represents the number of people s25 that are still susceptible at a time (25) safely afterthe end of the epidemics.

CCSP P ′S = (X, D, C) where:

X = < xODE , s0, i0, r, a, imax, tmax, tend, s25 >D = < DxODE , Ds0, Di0, Dr, Da, Dimax, Dtmax, Dtend, Ds25 >C = { ODES,[0.0,25.0](xODE),

V alue1,0.0(s0), V alue2,0.0(i0), V alue3,0.0(r), V alue4,0.0(a),Maximum2,[0.0,25.0](imax), F irstMaximum2,[0.0,25.0](tmax),LastV alue2,[0.0,25.0],≥1.0(tend), V alue1,25.0(s25)}

Solving such problem with the parameters ranging within the previously obtained intervals (for example,Dr = [0.213, 0.224] and Da = [0.423, 0.468]), the initial value domains Ds0 = 9999 and Di0 = 1, and all theother variable domains unbounded, the results obtained for these domains indicated that:

imax ∈ [8939, 9064] clearly suggesting the spread of a severe epidemics;

tmax ∈ [0.584, 0.666] and tend ∈ [20.099, 22.405] predicting that the maximum will occur during the first 14to 16 hours, starting then to decline and ending before the 10th hour of day 22;

s25 ∈ [0, 0.001] showing that everyone will eventually catch the disease.

If the administration of a vaccine is considered at a rate λ proportional to the number of infectives then, thedifferential model must be modified into:

dS(t)dt

= −rS(t)I(t) − λS(t)dI(t)dt

= rS(t)I(t) − aI(t)dR(t)

dt= aI(t) + λS(t) (12)

The requirement that the maximum number of infectives cannot exceed half of the population is represented byadding the numerical constraint imax ≤ 5000. Solving this new CCSP with the λ initial domain [0, 1.5], its lowerbound is raised up to 0.985 indicating that at least such vaccination rate is necessary to satisfy the requirement.

7 Conclusion

This paper presents a framework to make decisions with models expressed by differential equations, with aconstraint reasoning approach.

In contrast to Monte Carlo and other stochastic techniques that can only assign likelihoods to the differentdecision options, and despite the data uncertainty and approximation errors during calculations, the enhancedpropagation techniques developed (enforcing global hull consistency) allow safe decisions to be made.

Whereas the traditional use of complex differential models for which there are no analytical solutions is cur-rently unsafe, the constraint reasoning framework extends the possibility of practical introduction of this typeof models in decision making, specially when safe decisions are required. The approach is illustrated with twopractical applications, namely, the tuning of drug design and the study of epidemics.

Additionally, the representation of other kinds of differential equations could be supported by the CSDP frame-work, broadening the spectrum of its potential applications. An important area for future research is the extensionof the framework for handling other kinds of differential equations such as Partial Differential Equations (PDEs)or Delay Differential Equations (DDEs).

Acknowledgements This work was partly supported by Project Protein (POSI/33794/SRI/2000), funded by the PortugueseFoundation for Science and Technology.

c© 2004 WILEY-VCH Verlag GmbH & Co. KGaA, Weinheim

Page 15: Constraint Reasoning with Differential Equations

154 J. Cruz and P. Barahona: Constraint Reasoning with Differential Equations

References

[1] C. Bendsten and O. Stauning, FADBAD, a Flexible C++ Package for Automatic Differentiation Using theForward andBackward Mathods, Technical Report 1996-x5-94, Department of Mathematical Modelling, Technical University ofDenmark, DK-2800, Lyngby, Denmark, 1996.

[2] C. Bendsten and O. Stauning, TADIFF, a Flexible C++ Package for Automatic Differentiation Using Taylor Series,Technical Report 1997-x5-94, Department of Mathematical Modelling, Technical University of Denmark, DK-2800,Lyngby, Denmark, 1997.

[3] H. Collavizza, F. Delobel, M. Rueher, A Note on Partial Consistencies over Continuous Domains, Principles and Practiceof Constraint Programming, Springer, 147(1998).

[4] G.F. Corliss and R. Rihm, Validating an A Priori Enclosure Using High-Order Taylor Series. In Scientific Computing,Computer Arithmetic and Validated Numeric, G. Alefeld and A. Frommer (eds.), Akademie Verlag, Berlin, 228(1996).

[5] J. Cruz and P. Barahona, Handling Differential Equations with Constraints for Decision Support, Frontiers of CombiningSystems, Springer, 105(2000).

[6] J. Cruz and P. Barahona, Global Hull Consistency with Local Search for Continuous Constraint Solving, 10th PortugueseConference on AI. Springer, 349(2001).

[7] J. Cruz and P. Barahona, Maintaining Global Hull Consistency with Local Search for Continuous CSPs, 1st Int.Workshop on Global Constrained Optimization and Constraint Satisfaction, Sophia-Antipolis, France, 2002, Springer,178(2003).

[8] J. Cruz and P. Barahona, Constraint Satisfaction Differential Problems, Principles and Practice of Constraint Program-ming, Springer, 259(2003).

[9] J. Cruz J., Constraint Reasoning for Differential Equations, PhD thesis, submitted (2003).[10] Y. Deville, M. Janssen and P. Van Hentenryck, Consistency Techniques in Ordinary Differential Equations, Principles

and Practice of Constraint Programming, Springer, 162(1998).[11] P. Eijgenraam, The Solution of Initial Value Problems Using Interval Arithmetic, Mathematical Centre Tracts N144,

Stichting Mathematisch Centrum, Amsterdam, 1981.[12] D. Sam-Haroud and B.V. Faltingsm, Consistency Techniques for Continuous Constraints, Constraints, 1(1,2), 85(1996).[13] M. Janssen, P. Van Hentenryck and Y. Deville, Optimal Pruning in Parametric Differential Equations, Principles and

Practice of Constraint Programming, Springer, 539(2001).[14] F. Krckeberg. Ordinary Differential Equations, in Topics in Interval Analysis, E. Hansen (ed.), Clarendon Press, Oxford,

91(1969).[15] R.J. Lohner, Einschliebung der Losung gewohnlicher Anfangs- und Randwertaufgaben und Anwendungen, PhD thesis,

Universitat Karlsruhe, 1988.[16] R.J. Lohner, Step Size and Order Control in the Verified Solution of IVP with ODEs, SciCADE’95, International Con-

ference on Scientific Computation and Differential Equations, Stanford, Calif., 1995.[17] U. Montanari, Networks of Constraints: Fundamental Properties and Applications to Picture Processing, Information

Science, 7(2), 95(1974).[18] R.E. Moore, Interval Analysis. Prentice-Hall, Englewood Cliffs, NJ, 1966.[19] J.D. Murray, Mathematical Biology, 2nd Edition, Springer, 1991.[20] N.S. Nedialkov, Computing Rigorous Bounds on the Solution of an Initial Value Problem for an Ordinary Differential

Equation. PhD thesis, Univ. of Toronto, Canada, 1999.[21] N.S. Nedialkov, K.R. Jackson and G.F. Corliss, Validated Solutions of Initial Value Problems for Ordinary Differential

Equations, Applied Mathematics and Computation, 105(1), 21(1999).[22] N.S. Nedialkov, K.R. Jackson and J.D. Pryce, An Effective High-Order Interval Method for Validating Existence and

Uniqueness of the Solution of an IVP for an ODE, Reliable Computing, 7(6), 1(2001).[23] R. Rihm, Interval Methods for Initial Value Problems in ODEs. In Topics in Validated Computations: Proceedinds of

the IMACS-GAMM International Workshop on Validated Computations, University of Oldenburg, J. Herzberger, ed.,Elsevier Studies in Computational Mathematics, Elsevier, Amsterdam, New York, 1994.

[24] L.F. Shampine. Numerical Solution of Ordinary Differential Equations. New York, Chapman and Hall, 1994.[25] E. Spitznagel, Two-Compartment Pharmacokinetic Models, C-ODE-E, Harvey Mudd College, Claremont, CA, 1992.[26] O. Stauning, Enclosing Solutions of Ordinary Differential Equations. Technical Report IMM-REP-1996-18, Department

of Mathematical Modelling, Technical University of Denmark, DK-2800, Lyngby, Denmark, 1996.[27] O. Stauning, Automatic Validation of Numerical Solutions, PhD thesis, Technical University of Denmark, DK-2800,

Lyngby, Denmark, 1997.

c© 2004 WILEY-VCH Verlag GmbH & Co. KGaA, Weinheim