99-09 July 1999
c LIFL USTL
UNIVERSITE DES SCIENCES ET TECHNOLOGIES DE LILLE U.F.R. d’I.E.E.A. Bât. M3 - 59655 VILENEUVE D’ASCQ
Tel. 03 20 43 47 24 Télécopie 03 20 43 65 66
Laboratoire d’Informatique Fondamentale de Lille
The Complexity of the Maximization of Anytime Contract Algorithms
of the Average Quality over a Time Interval
Publication 99-09
Arnaud Delhay Max Dauchet
July 1999
Abstract
In this report, we restate the problem of maximizing the average quality of an anytime contract algorithm over a time interval, then we present general results about any kind of quality function approximated by a stepwise function. We prove that the problem is NP-hard, but becomes quadratic if the time interval is large enough. This report is associated to the paper published in IJCAI’99 [2] and its main aim is to detail the proofs of the NP-hardness.
1 Introduction
Hard problems like planning or decision making cannot be reasonably treated by complete methods. That is the reason why in [1] Dean and Boddy first considered anytime algorithms, also called flexible algorithms in [6]. More studies and especially about composition of these algorithms have been made by Zilberstein [9]. Anytime algorithms are algorithms that offer to trade-off computation time against quality of the result. They are characterized by a Performance Profile [4] that enables a prediction about the quality of the results given by the algorithm, depending on the execution time duration. This way of doing has been used to solve several problems in various domains like robot control [12], and knowledge- based computation [8].
The performance profile can be an expression of the quality in function of time.
Nevertheless more complex forms of performance profiles can be found: especially, the quality function can depend on the quality of the input of the algorithm, in the case of the composition of several anytime algorithms. This kind of performance profiles are called conditional performance profiles.
Anytime algorithms can be of two categories: interruptible ones that can be interrupted at any time to give a partial result and that can be resumed where the computation stopped, and contract ones, that have a limited amount of computation time available called a contract and if an interruption happened before the end of the computation, there could be no guaranty for the output quality at this instant.
Quality is not always the essential characteristic of a computation result: what really matters is its utility. The intuitive idea is that, in many situations, the utility of a result decreases over time, and that a result of medium quality rapidly obtained is more useful than a result of high quality obtained after a long time [11]. But, when the algorithm operates on an uncertain environment, utility can be of another nature. It is the case in the following example, which is associated to a “crisis situation” over a time period:
• a person (P) has to give his boss (B) a report in the morning. P only knows that B can claim for this report at some time between 8 a.m. and 12 a.m. The problem for P is that trying to achieve the best quality would be a good strategy only if the report were claimed at 12. If it is not the case, no report at all is available! Hence it seems better to ensure a medium quality draft for 8 a.m. and, once the draft is ready, to start to write a better quality report, expecting that the claim will occur late in the morning.
In the previously described situation, an interruptible algorithm would be the best solution: at the time of the event, the best possible quality would be achieved. Unfortunately, interruptible algorithms are not always available:
• there is no interruptible method and ad-hoc techniques are used (usual Real-Time approach).
At best, only several different methods can be used[5], none of them being interruptible,
• anytime algorithms might result from the composition of elementary interruptible algorithms, but in that case, the result is of the contract kind [11],
• contract algorithms can be transformed into interruptible ones [11] but, notwithstanding the fact that the execution time is 4 times longer[10], this way of doing applies only if the contract durations can be chosen freely which is not the general case.
Finally, even with a genuine interruptible algorithm, situations exist in which the contract case re-occurs: if applying the results of the algorithm causes a change in the environment, it is no longer possible to let the algorithm continue in order to improve the solution from the previously obtained one; it must be restarted from scratch. For instance, this might occur in counter-measures applications, if the result of the interruptible algorithm is a jamming action
which itself provokes a counter-jamming decision from the enemy.
In [3], partial solutions to answer this kind of problems are proposed, consisting in maximizing the average quality over a time interval. But the results achieved are limited to convex quality functions (whose second derivative is positive) which are the less current ones in real applications. In [2] and in this report, extensions for solving the problem of maximizing the average quality is proposed.
2 Maximizing the average quality over a time interval
We assume here that there exists a particular quality associated to each results given by the algorithm. The definition of the quality is very dependent of the problem (result accuracy, value of a benefit, percentage of possible success). We always assume that the quality increases with the duration of the contract.
2.1. Informal presentation
A typical example is the following: an attack might happen with a uniform probability over a given time interval, and a contract algorithm, the performance profile of which is increasing over time (figure 1), is available to counter-attack. The problem then consists in determining how to best prepare the counter-attack in order to get the best chance to survive over the time interval.
figure 1: The attack might happen at any time over [t0,te]
An answer to the attack must be given between t0 and te and it is possible to begin the computation at time t = 0. To give a good answer to this problem, several solutions can be considered.
First (figure 2) we activate the algorithm for a short contract (θ1). In that case, the result has a relatively poor quality but this quality is available on a relatively long time interval (te - θ1).
figure 2: short but bad preparation
To get a better quality, we have to start the algorithm with a longer contract (θ2): the quality of the result is better, but most of the time, on [t0,θ2), no “quality” (that is, no protection from the attack) is available (figure 3).
figure 3: good but slow preparation
These two cases lead to a simple observation: if the algorithm starts with a (sufficiently) short contract (θ1), then the remaining time can be used to restart the algorithm with a contract θ’2, to get a better result.
Attack
t0 te
0
t0 te
0 θ1
θ1
t0 te
0 θ2
θ2
figure 4: mixed preparation
Hence a good method is to start the contract algorithm several times to get a good cover of the time interval and a minimal quality early. We only have to respect three conditions:
• The sum of all contracts must be strictly lower than the length of the interval where it is possible to compute
• Every new contract must be longer than the previous one to improve the quality of the result.
Monotonicity implies that other cases are useless.
• We never execute more than one contract before t0. Should we do that, all contracts before t0 but the last would be useless.
2.2. Formalization
Now let us give the definition of the average quality over an interval where <Θn> = {θ1, θ2,...,θn} denotes the duration of successive runs of the algorithm (contracts).
definition 1: integral quality
Let f be the performance profile of a contract algorithm A.
Theintegral quality of A over a time interval [t0, te], relative to a choice <Θn> of n contracts with performance profile f, is defined as follows:
The above definition is only usable if the contracts respect thesum constraint, that is:
The average quality Q(f,<Θn>) is equal to the integral quality divided by the length of the interval [t0, te].
Q(f) is the supremum of the integral quality, and Q(f) the supremum of the average quality.
figure 5: Performance Profile and Average Quality
t0 te
0 θ1
θ’2 θ1
θ1+θ’2
Q f( ,〈Θn〉) min 0 θ( , 1–t0) f θ⋅ ( )1 f( )θi i=1 n–1
∑
+ θi+1 f( ) tθn e θi i=1
n
∑
–
⋅
⋅ +
=
θi
i=1 n
∑
<tete
quality
t0
A1 A2
time
θ2 θ1 θ2 θ3 If t0 >θ1
te
quality
t0
A1 A2 A3
time
θ1 θ2 θ3
If t0 <θ1
quality
time
Performance Profile
f 0
0
0
A3 te θ3
θ1
2.3. Preliminary results
In [3], we studied the maximization of the average quality for continuous and derivable performance profiles in particular cases. These results are the following.
2.3.1 for convex performance profiles
We treat here the case of convex performance profiles, that is the second derivative of which is positive. This first case is not the most interesting one, as most of performance profiles are concave, but it is the only case that gives simple results. The concave case corresponds to the “diminishing returns” property that ensures a result with a “rather good quality in a rather short delay”.
theorem 1:
• For convex performance profiles, the best average quality is got for an unique contract.
• Let be θ, the unique contract that gives the best average quality over the interval [t0,te]. Thenθ > te/2.
• The unique contract is defined by the following equation: , if f ’ is the first derivative of the performance profile f.
For an unique contract, The intuitive idea of theorem 1 is rather natural. As we have a convex function, that slowly increases in the beginning, we have to stop the computation later.
In fact, the second part of theorem 1 means that there is no need to restart the algorithms several times with increasing contracts to get the best average quality. In the case of the convex performance profiles, we can state that the maximization of the average quality over a time interval can be solved in constant time. The third proposition (the formula) is valid in the general (convex or concave or other) case.
2.3.2 for concave performance profiles
The case of the concave performance profiles caused us more problems and the best average quality needs several contracts in general. However we managed to exhibit preliminary results that we explain in the following theorems.
theorem 2:
• If we consider the case of a single contract, the best average quality is got forθ < te/2.
• For f(t), a concave performance profile, andθ, an unique contract that gives the best average quality,θ < te/2.
The concave performance profiles gives a rather good result for a rather short delay. Then we can stop the computation rapidly.
theorem 3:
• For f(t), a concave performance profile, start the algorithms for two contracts gives a better average quality than for only one contract.
So as to go further in the study of the behavior of the average quality, we chose to treat the problem by approximating the performance profiles.
θ te
f( )θ
f′ θ( ) --- –
=
3 Average quality for stepwise constant performance profiles
3.1. Discretisation by approximating the performance profile
Because of the difficulties in solving this problem in the continuous and derivable case, we chose to solve the problem by approximating the performance profile in order to get a discrete problem. We approximated the performance profiles with stepwise constant functions1. More than a way to avoid difficulties, this approach makes sense in the common representation of performance profiles, that is the discrete tabular representation. Moreover, lemma 1 states that the average quality is approximated with the same error as the error on performance profile itself. In particular, this is true when approximating the continuous performance profile f by a stepwise function g.
lemma 1 : approximation lemma
If then
Proof:This is a property of integrals applied to definition 1.
So, hereafter the performance profiles are stepwise constant functions. A stepwise constant function is a function such as, for a finite set of thresholds {θ1,...,θn}, f is constant on every interval [θi,θi+1). The following lemma allows to treat the maximization problem as a discrete problem by only examining the steps of the performance profile instead of all values in the interval [0,te].
lemma 2 : (stepwise function lemma)
To maximize average quality, it is sufficient to choose all contractsθiin the set of thresholds of the stepwise function g.
Proof:
• The idea is to benefit from the quality of the result as soon as possible
• Let be (Θ) a time allocation for contracts, where θ is one of these contracts and its value is between two thresholds.
• Let us consider another allocation (Θ'), identical to (Θ) except θ. To replace this contract, let beθ' < θ another contract on the same step.
• By making the difference between both average qualities, and by assuming that θi is the contract just beforeθ in (Θ), and θi+1 the one followingθ, we finally get:
because the quality between two thresholds (the second threshold is not included in the interval) is constant
• This difference is negative and it is worth taking the shortest contract on the step.
• By generalizing, we conclude that all contract end on a threshold.
Thanks to lemma 2, we call this (discrete) problem MAXQSF (MAXimization of the average Quality for a Stepwise Function). MAXQSF(f,te) denotes the maximum of the integral quality of an increasing stepwise function f over the time interval [0,te]. In the next subsections, the tractability of MAXQSF is considered.
1. We first tried with piece-wise linear functions. But even with this approximation, we did not manage to f–g <ε Q f( ) Q g– ( ) <ε
Q g( ,( )Θ ) Q g Θ′– ( ,( )) = (θ θ′– ) g θ⋅( ( ) g θi – ( )n )
3.2. MAXQSF is NP-hard
The following theorem states that the MAXQSF problem is intractable in general. And even if respecting the sum constraint could eliminate lots of choices in realistic cases, the MAXQSF problem is still NP-hard.
theorem 4: MAXQSF(f, te) is NP-hard
The proof consists in reducing polynomially the Knapsack problem to MAXQSF. The Knapsack (<A>,b) problem is to find a part of <A>={a1,a2,...,an}, a set of naturals, which sum of its elements is maximal and lower than a natural b. We assume that the ai are sorted and distinct. This restriction is still NP-complete. The reduction consists in building a stepwise constant function f<A>of 2n+1 steps that gives an instance of MAXQSF(f,te) for any instance of Knapsack(<A>,b)
The similarity between Knapsack(<A>,b) and MAXQSF(f,te) is inspired by the idea of maximum placement (maximal average quality) of numbers (the contracts) in a given space (the interval [t0,te]).
3.2.1 Idea of the proof of the reduction
The principle is to polynomially reduce knapsack to MAXQSF. For each instance <A> of knapsack, we construct in polynomial time an increasing constant stepwise function f<A> for which the maximization of the average quality is equivalent to solving knapsack for <A>.
The idea is to make a link from thresholds to elements to put in the knapsack. The difficulty is that choosing or not a threshold as a contract influences the quality in a quantity that depends on the other choices, so that is difficult to quantify. To be convinced of this assertion, just consider the expression of∆, that expresses the quality gain by adding a contract (cf chap.
3.2.2).
To avoid this difficulty, f<A> is constructed by alternating thresholds (odd ones) that corresponds to elements of <A>, and thresholds (even ones) constructed to be necessary chosen as contracts in a maximal quality. Therefore, the even thresholds surround the odd thresholds, and ‘separate’ the effect of the choices on the odd thresholds. We do so as to ‘choosing the threshold that corresponds to an element a of <A>’ increases the quality of a quantity a (regards to not choosing it).
The constraint on the size of the knapsack becomes the sum constraint on the odd thresholds; the reduction from knapsack to MAXQSF then appears.
f<A> then has 2n+1 thresholds: θ0, θ1 = a1, θ2, ai, θ3 = a2,...., θ2i-1 = ai, θ2i, θ2i+1 = ai+1,...,θ2n.
For technical reasons that the proof clears, it is necessary to takeθ2i very close to ai. There is an alternance of very short steps and of almost entire steps. In the other hand, the height of the steps exponentially decreases, what is close to cases frequently observed (concave performance profiles with property of ‘diminishing return’).
Remark: the reduction depends on the correspondence between knapsack and the sum constraint. We proved in [3] that the problem becomes polynomial when the sum constraint disappears.
The graph looks like the following
figure 6: construction of the performance profile f<A>
NB: the complexity of an instance (f, te) of the MAXQSF problem is the size of its writing.
3.2.2 Notations and properties that help the proof
• Knapsack(<A>, b) is the optimization problem of fulling a knapsack, with <A> a set of n+1 naturals a1,..., an. Let us assume a1,..., an are all different and sorted in increasing order1.
• S is the sum of the ai.
• We consider functions having 2n+1 thresholds θ0,... θ2n and a time window (0, te). The problem that we are interested in becomes MAXQSF(f, te).
• Let note∆(θ, θ', θ", θϕ), ‘the quality gain got by adding the contract θ' between θ and θ", whenθϕ is the last contract’ (knowing that there is no other contract between θ and θ") It could be verified that:
• current case: ∆(θ, θ', θ", θϕ) = θ"( f(θ') - f(θ)) - θ'(f(θϕ) - f(θ))
• ifθ' is the first contract: ∆(_, θ', θ",θϕ) = θ" f(θ') - θ' f(θϕ)
• ifθ' is the last contract: ∆(θ, θ', _, _) = (f(θ') - f(θ)) (te -θ1 -θ1 -... -θ - θ').
• In the context of a step-wise constant function f with thresholds s0,...si,....,sp, let be∆i=∆(si- f0
f1 f2 f3
θ0 a1 θ2 a2 θ4 a3 θ6 a4 θ8
1,si, si+1,sp) and f(si) = fi. Then we get:
• ∆0 = s1 f0 - s0 fp
• ∆i = si+1(fi - fi-1) - si(fp - fi-1)
• ∆p = (fp - fp-1)(te - s0-...- sp) According to the definitions above:
• ∆0is the quality gain by addingθ0as a contract, whenθ1is a contract too and the last one isθ2n.
• ∆i is the quality gain by adding the contract θi between the contracts θi-1 et θi+1, where the last contract isθ2n.
• ∆2n(<s>) is the quality gain by adding θ2n as the last contract instead ofθ2n-1, <s> is the set of the thresholds chosen as contracts (includingθ2n).
lemma 3 : Independence Lemma
Ifθ' <> θϕ, ∆(θ,θ', θ",θϕ) does not depend on the choices outside the interval (θ, θ”) Proof:
The developed expression of∆(θ,θ', θ",θϕ) directly leads to the lemma.
Warning: this lemma is not true for the last contract.
lemma 4 : Monotony Lemma
∆(θ, θ', θ",θϕ) increases with θ" et decreases when θ or θϕ increases.
Proof:
The proof is directly extracted from the formula of∆(θ, θ', θ",θϕ).
3.2.3 Fundamental lemmas
Here, we make two propositions. The first one describes the polynomial reduction from knapsack to MAXQSF, then the construction of the step-wise constant function. The second proposition justifies the equivalence between solving MAXQSF and solving knapsack.
lemma 5 :
For all <A> = a1,..., an and b, it is possible to construct, in polynomial time, a step-wise constant function f<A>over an interval (0, T=0.5+S+b) with 2n+1 thresholdsθ0,...θ2n and that verifies for all i (0 < i < n+1)
(P1) θ2i-1 = ai,θ0 < 1/3n andθ2i < ai + 1/3n
(P2)∆2i-1 = ai and∆2i > S (in particular,∆2n (<s>) > S for all choice of <s>)
(P3) Replacing a contract θ2i-1 by the contract θ2i or by the contract θ2i-2 increases the quality.
Indication on the proof:
Take fi- fi-1= K4n-iwith K large enough (but with a size polynomially linked to <A>), and constructθ2i < ai + 1/(3nK2n). A long verification leads to the proof (see 3.2.4).
lemma 6 :
All optimal choice of contracts for f<A> is made of the n+1 contracts of even number and a sub-series of contracts of odd number that solve knapsack(<A>, b).
Indications on the proof:
Prove that the following operations successively increases the quality (reason on the decimal parts to preserve the sum constraint):
• First replace the contractθ2i-1by the contractθ2iorθ2i-2if one these two was not a contract.
Then, ifθ2i is not a contract, suppress all the contracts that are odd thresholds and addθ2i.
• The maximal quality then require choosing all the even thresholds as contracts. The proof is achieved by noting that the maximization of the quality is then equivalent to choice of odd thresholds which sum is maximal but lower than b.
3.2.4 Detailed Proofs
Proof of lemma 5:
We consider two constants K and K' that we chose large enough, and we will construct f by induction with fi- fi-1= K'K2n-i. We will need, for (P3), a stronger condition (P1') than (P1):
(P1')θ2i-1 = ai,θ0 < 1/3n etθ2i < ai + 1/(3nK2n)
1/ Proof by induction on i that for all K great enough, (P1') et (P2) are verified.
• Initially, for all K et K’ great enough, we have forθ0 small enough,∆0 > S.
∆0 =θ1.f0 -θ0.f2n > f0 -θ0.f2n asθ1 = a1 > 1 then∆0 > f0 -θ0.(f0+K’K2n+i).
For instance, f0 > 2.S andθ0.(f0+K’K2n+i) < S are good choices.
• Suppose thatθ0,...,θ2(i-1) are constructed and (P'1) and (P2) verified till the rank i-1.
To get∆2i-1 = ai, it is sufficient to takeθ2i - ai = ai (1 + f2n - f2i-1)/(f2i-1 - f2i-2).
Therefore, in this case,∆2i-1= ai.(f2i-1 - f2i-2) + ai.(1 + f2n - f2i-1) -θ2i-1.(f2n - f2i-2) = ai by noting thatθ2i-1= ai.
Moreover,
For K large enough (K’.K2n-2i+1 > 3n), we then haveθ2i - ai < 1/3n.
• To get ∆2i > S, it should be noted that, according to (the ai are naturals and distinct), toθ2i+1 = ai+1 and toθ2i+1 > ai + 1/(3nK2n), we get:
∆2i =θ2i+1.(f2i - f2i-1) -θ2i.(f2n - f2i-1) > (1 + ai).(f2i - f2i-1) - (ai +1/(3nK2n)).(f2n - f2i-1).
∆2i > (1 + ai).K’.K2n-2i - (f2n - f2n-1 +... + f2i - f2i-1).(ai +1/(3nK2n)) or
θ2i–ai ai
1 K2n–j
j=2i 2n
∑
+
K′ K⋅ 2n–2i+1 ---
1 K′ K⋅ 2n–2i+1 ---
≈
⋅
=
ai+1≥ai+1
∆2i (1+ai) K′ K⋅ ⋅ 2n–2i ai 1 3nK2n ---
+
K′ K2n–2i+1–1 K–1 ---
1 1
3nK2n ---
–
K′K2n–2i
≈
⋅ ⋅
> –
This expression tends to the infinity with K' and K, then for K and K’ large enough,∆2i > S.
• Finally, to prove that∆2n(<Θ>) = (f2n - f2n-1).(te -Σ(<Θ>) > S, we note that:
• (f2n - f2n-1) = K’.K that tends to the infinity with K
• (te -Σ(<Θ>) > 0.1 as <Θ> contains either naturals or very close reals (the distance is 1/3n), then at least, the decimal part ofΣ(<Θ>) < n.1/3n < 0.4. Note that the decimal part of te is 0.5.
we then have∆2n(<Θ>) > S.
• We just proved that (P1) et (P2) are true at rank i.
• The reduction is polynomial (as it is a read of the list of the ai) if we note that the size of the
data is also polynomial: .
2/ Proof that Replacing a contractθ2i-1 by the contractθ2i increases the quality (P3)a.
• The work above on decimal parts show that the sum constraint is kept.
• Let be a choice of contracts whereθ is the last one before θ2i-1,θ" is the first one after θ2i, et θϕ is the last one of all.
figure 7: situation deθ, θ”, θ2i-1,θ2i, etθϕ
Except limit cases that we see further, it must be prove that Shift =∆i -∆i-1 > 0 Shift =θ"(f2i - fθ) -θ2i(f(θϕ − fθ) -θ"(f2i-1 - fθ) +θ2i-1(f(θϕ − fθ)
= θ"(f2i - f2i-1) - (θ2i - ai)(f(θϕ) - fθ) > 0
Note that this quantity increases withθ" and θ, and decreases when θϕ decreases.
then Shift > ai+1(f2i- f2i-1) - (θ2i - ai)(f2n - f0) = ai+1(f2i- f2i-1) - (1/3nK2n)(f2n - f0)
= ai+1.K’.K2n-2i - (1/3nK2n)(K2n-1)/(K-1) that is positive if K is large enough.
• The initial case is the same as above with f0 = 0.
Therefore we are in the case where there is no contract beforeθ2i-1.
• The final case is to prove (case here there is no more contracts afterθ2i, exceptθϕ):
Shift = (f2i - fθ) (tf− θ1 − θ2 -... -θ2i) - (f2i-1 - fθ)(tf -θ1 − θ2 -... -θ2i-1)
= (f2i - f2i-1) (te -Σ(<s>)) - θ2i(f2i - fθ) + θ2i-1(f2i-1 - fθ)
As (te -Σ(<s>)) > 0.1 et θ2i-1= ai then Shift > 0.1 (f2i - f2i-1) - f2i /(3nK2n) + ai(f2i-1 - f2i-2) and Shift > 0.1(K’K2n-2i) - f2i /(3nK2n) + ai(K’K2n-2i-2) > 0 for K large enough.
3/ Proof that Replacing a contractθ2i-1 by the contractθ2i-2 increases the quality (P3)b
• There is no problem for the sum constraint, asθ2i-2 <θ2i-1
• we aim at Shift =∆i -∆i-1 > 0
K2n = 2nlog( )K
θ θ" θϕ
θϕ
θ θ2i θ"
θ2i-1= ai
Shift =θ"(f2i-2 - fθ) -θ2i-2(f(θϕ) - θ"(f2i-1 - fθ) +θ2i-1(f(θϕ))
= (f(θϕ)-fθ)(ai -θ2i-2) -θ"(f2i-1 - f2i-2)
As ai -θ2i-2 > 0.5 (in fact 2/3) because andθ2i-2 < ai-1 +1/3nK2n then Shift > (f(θϕ)-fθ) 0.5 -θ"(f2i-1 - f2i-2) > te(f2i-1 - f2i-2)
It must be proved that (f2i-1- f2i-2)/(f(θϕ) - f(θ) = K’(1 - 1/K)< 0.5/te, what is true for K large enough.
• In the particular case of the first contract, we conclude as above.
Proof of lemma 6:
• 1/ Each optimal choice of contracts contains all the even thresholds?
• a/ assume thatθ2i-1 is a contract andθ2inot. By considerations on decimal parts, we verify that replacing the contractθ2i-1 by a contractθ2ipreserves the sum constraint (cf. proof (P3)a). In the other hand, (P3)a ensures that this operation increases the quality.
• b/ assume thatθ2i-1 is a contract andθ2i-2not. By replacing the contractθ2i-1by the contractθ2i-2, we preserve the sum constraint and (P3)b ensures the quality increases.
• c/ we deduce from a/ and b/ that in the optimal choice, ifθ2i-1is a contract thenθ2i-2 andθ2iare contracts too. Then, from (P2), if we suppressθ2i-1in an optimal choice, the quality decreases of a quantity ai.
• d/ assume that oneθ2iis not a contract in an optimal choice. According to c/ and (P2), by suppressing all odd thresholds, the quality decreases at least of a maximal quantity S. According to the definition of te, we can add a contract θ2i and preserve the sum constraint, and according to (P2), this add make the quality increase of S at least, that achieves the proof of point 1/. Therefore, it can be verified that the more the
«neighbor» contracts are distant, the more a given add increases the quality (see definition of the∆i= monotony lemma). And (P2) limit with S the increase of quality in the case where the «neighbor» contracts are as close as possible.
• 2/ Let be Q the quality corresponding to the choice of all even thresholds and no odd ones as contracts.
Let be B a choice of a subset of {a1,..., an}, containing even thresholds and thresholdsθ2i-1 so as to make ai belongs to B. Let us callΣB the sum of the elements of B.
According to (P2), the quality b corresponding to B is Q +ΣB and the sum of the thresholds is te +ΣB
According to 1/, an optimal choice of contracts is a choice B that maximizes ΣB under the sum constraintΣB < b, that is equivalent to solving knapsack(<A>, b).
ai+1≥ai–1+1
4 Conclusion
In this report, we gave detailed proofs of the ideas developed in [2] about the maximization of the average quality, a new criteria to evaluate anytime contract algorithms.
This criteria corresponds to situations with a sudden attack over a time interval. We saw that anytime interruptible algorithms that seems to be a good solution can not always be used. That is why the problem has been explored for contract algorithms. In the case of convex performance profiles, the solution is analytical [3].
But the most interesting case is the one of concave performance profiles that seems to be more difficult to solve. Then we constructed an algorithm that solve the problem in a numeric way, by approximating the performance profile by a step-wise constant function. This algorithms has a great complexity (NP-hard problem).
The aim of this paper was to present an off-line optimization of the time allocation for a contract algorithm so as to get the best chance of survival over a time interval. So far, no analytical method for solving the problem of maximizing the average quality over a time interval is known in the general case. That is the reason why we proposed solutions for discrete performance profiles. This restriction is not a real impediment since:
• a discrete tabular representation for the performance profiles is not a rare occurrence,
• the average quality resulting from a discrete performance profile can be as close as neces- sary to a given continuous performance profile (lemma 1).
There is no proof that we can extend this property for more contracts. Nevertheless, we can imagine that restarting the algorithm for lots of contracts has no great interest for two main reasons:
• the poor gain for each new contract: we increase the quality but we decrease the interval over which we apply this quality.
• the problems of monitoring, that increase the overhead in function of the number of contracts
We showed that the so-called MAXQSF problem is NP-hard in general, and quadratic if the time interval is large enough[2]. This, unfortunately, is not frequently encountered in practical applications. Nonetheless, the experiments we carried out lead us to think that the
“practical” complexity of that problem is quite low, which makes it possible to use the approach in real-time applications. Further studies to find a theoretical explanation of this behavior and the study of heuristics for the concave case could prove very interesting.
The average quality of a contract algorithm A can be defined by:
where f* is the quality of an interruptible algorithm A*associated to A by the relation:
A*(t) = A(θi) whereθi is the last contract executed at t.
In [11], Zilberstein and Russel gives a simple construction to transform a contract algorithm A of quality f into an interruptible algorithm A*of quality f*such as f*(4t)>f(t). The first difference with our study is that we consider the case of a given time interval to optimize the average quality. In our case, this leads to a construction of A*which optimizes the average quality. In Zilberstein and Russel’s study, the optimization proceeds on the multiplicative factor of time, i.e. they proved that 4 is the minimum factor of power needed to get an interruptible algorithm that gives at least the same quality as described by the performance profile of the contract algorithm. So they optimize the multiplicative factor. The second difference is that our
1 te–t0
--- f ∗ t( ) td
t0 te
∫
⋅
problem permits cases where the length of each contract is imposed by a method, when Zilberstein and Russel assume that the length of each contract can be arbitrarily chosen. Finally, it is difficult to compare both methods at each time t: the best quality is not always given by the same method. But, as we answer to the problem of a crisis over a time period and we maximize the average quality, our approach will always give the best chance to survive over the interval on a sample of 1000 attacks.
A first aim will be to implement this approach and compare it to the method of Zilberstein and Russel. We will work on a real application that could demonstrate the practical interest of the average quality.
Another issue could be to extend our model with several contract algorithms that collaborate to achieve the same goal. This goal could then be divided into several subgoals.
Note that a uniform probability of appearance of the attack over the interval has been considered. There are situations where this probability is not constant, such as with a gaussian.
A future study could concentrate on this point.
Another extension could concentrate on our evaluation criteria, that is the average quality.
Even if this criteria gives the best statistical results, there could exist others, for example that could take the number of contracts into account (a good solution therefore is a choice of few contracts).
5 Bibliography
[1] Thomas Dean & Mark Boddy, An Analysis of Time-Dependent Planning, AAAI 88, Saint Paul Minnesota, August 1988.
[2] Arnaud Delhay, Max Dauchet, Patrick Taillibert, Philippe Vanheeghe, Maximization of the average Quality of Anytime algorithms over a Time Interval, IJCAI’99, Stockholm, August 1999, pp 212-217.
[3] Arnaud Delhay, Max Dauchet, Patrick Taillibert, Philippe Vanheeghe, Optimization of the Average Quality of Anytime Algorithms, Proceedings of Workshop on Monitoring and control of real-time intelligent systems, ECAI’98, Brighton, August 1998, pp. 1-4.
[4] Joshua Grass, Reasoning about computational resource allocation, An introduction to anytime algorithms, Crossroads, ACM student magazine, University of Massachusetts, September 1996, http://anytime.cs.umass.edu/~jgrass/school/papers/
racra.html.
[5] Alan Gravey and Victor Lesser, Design-to-time real-time scheduling, IEEE Transactions on Systems, Man and Cybernetics, 23(6):1491-1502, 1993.
[6] Eric J. Horvitz, Reasoning under varying and uncertain resource constraints, Proceedings of the Seventh National Conference on Artificial Intelligence, Minneapolis, MN. August 1988, Morgan Kaufmann, San Mateo, CA. pp. 111-116.
[7] Richard E. Korf, Real-Time Heuristic Search, Artificial Intelligence vol. 42, 1985, pp.
189-211.
[8] Abdel-Illah Mouaddib, Shlomo Zilberstein, Knowledge-Based Anytime Computation, in Proceedings of the 14th IJCAI, Montreal, Canada, 1995, pp 775-781.
[9] Shlomo Zilberstein, Operational rationality through compilation of anytime algorithms, Ph.D. Dissertation, Computer Science Division, University of California, Berkeley, CA, 1993.
[10] Shlomo Zilberstein, François Charpillet, Philippe Chassaing, Real-Time Problem- Solving with Contract Algorithms, in Proceedings of IJCAI’99, Stockholm, August 1999, pp. 1008-1013.
[11] Shlomo Zilberstein, Stuart J. Russel, Optimal composition of real-time systems, Artificial Intelligence vol. 82, 1996, 181-213.
[12] Shlomo Zilberstein, Stuart J. Russel, Anytime Sensing, Planning and Action: A Practical Model for Robot Control, in Proceedings of the 13th IJCAI, Chambery, France, 1993.