Optimising Flexibility for Simple Temporal Networks
Cees Witteveen
Department of Software and Computer Technology, Delft University of Technology,
Mekelweg 4, 2628 CD, Delft, The Netherlands
Keywords:
Simple Temporal Planning, Scheduling, Flexibility, Linear Programming.
Abstract:
We generalise a recently proposed concurrent flexibility metric to overcome some of its shortcomings. We
show that these shortcomings can be removed if one selects an optimal subset of variables for which the
concurrent flexibility is determined. The flexibility of the remaining variables does not play a role in the deter-
mination of the flexibility of the system. We present a preliminary experimental evaluation of the improvement
in concurrent flexibility that can be obtained by comparing some (approximation) algorithms. Their perfor-
mance on several benchmark sets is evaluated. As a result, in some cases the concurrent flexibility of an STN
can be enhanced by 20 - 50%.
1 INTRODUCTION
Simple Temporal Networks (STNs) (Dechter, 2003)
offer an elegant framework for analysing temporal
aspects of scheduling problems. An STN is a tuple
S = (T,C) where T = {t
0
,t
1
,. .. ,t
n
} is a set of tempo-
ral variables and C is a finite set of binary constraints
of the form t
j
t
i
c
i j
, for some c
i j
R. Solutions to
an STN S = (T,C) are schedules σ, assigning values
σ(t) to variables t T such that all constraints in C
are satisfied. It is well-known that deciding whether
an STN has a schedule, finding such a schedule, as
well as integrating new constraints are problems that
all can be solved in low polynomial time (Dechter,
2003).
The focus in this paper, however, is not on finding
(single) schedules for an STN: Instead of determining
exact times to schedule events, we concentrate on the
inherent flexibility of an STN. Intuitively, flexibility of
a scheduling system refers to the amount of freedom
we have in choosing the exact times to schedule an
event. While a conventional schedule σ determines a
fixed time-to-execute value for each temporal variable
t T in advance, a flexible schedule offers an interval
of values for each t to choose from. Such a flexibil-
ity could be of great value if, for example, some de-
lay has affected the execution of a temporal variable
and a predetermined time-to-execute value for a to be
dispatched variable would violate a constraint in C.
In such a case flexibility could ensure that a different
value can be chosen for t, without affecting the execu-
tion of the remaining part of the schedule. In this way
we could avoid a costly recomputation of the current
schedule.
In order to quantify the available flexibility in an
STN, we use flexibility metrics. A flexibility metric
should reflect some intuitive properties of flexibility
we expect to hold and also should allow us to com-
pare STNs w.r.t. their inherent flexibility. Previously,
a so-called naive flexibility (NF) metric for STNs has
been proposed, based on the difference between latest
and earliest starting times of events. However, quite
often this metric does not reflect our intuition about
flexibility of an STN (Wilson et al., 2013). The same
authors proposed an alternative, the concurrent flexi-
bility (CF) metric, promising such a reflection of in-
tuitive characteristics of flexibility. However, as we
will show, there are some cases where this CF met-
ric, too, does not correspond to intuitive properties we
would expect such a metric to have. We identify these
cases and we propose a modification of CF (ICF: an
improved concurrent flexibility metric) to remove the
observed deficiencies.
While the two existing metrics (NF and CF) can
be computed efficiently, we show that computing our
improved flexibility metric is NP-hard. Therefore,
we offer some heuristics to approximate our new im-
proved flexibility metric. Using some existing set
of benchmark problems we show that, using these
heuristics, in some cases the flexibility of an STN can
be significantly improved compared with the afore-
mentioned concurrent flexibility.
524
Witteveen, C.
Optimising Flexibility for Simple Temporal Networks.
DOI: 10.5220/0005824205240531
In Proceedings of the 8th International Conference on Agents and Artificial Intelligence (ICAART 2016) - Volume 2, pages 524-531
ISBN: 978-989-758-172-4
Copyright
c
2016 by SCITEPRESS Science and Technology Publications, Lda. All rights reserved
2 PRELIMINARIES
Given an STN S = (T,C) , let var(C) T denote
the set of variables mentioned in C. If T
0
T , then
C
T
0
= {c C | var({c}) T
0
} and S
T
0
= (T
0
,C
T
0
).
A solution to S is a schedule for S, that is, a function
σ : T R, assigning a real value (time-point) to each
temporal variable in T , such that all constraints in C
are satisfied. If such a schedule exists, we say that
the STN is consistent.
1
In order to be able to express
absolute time constraints, the time-point t
0
T , also
denoted by z, is used. It represents a fixed reference
point and is assigned the value 0.
There is an efficient method to find all tightest
constraints implied by C, by searching for all short-
est paths between the time points in T using e.g.
Floyd and Warshall’s all-pairs shortest paths algo-
rithm (Floyd, 1962). These tightest constraints are
represented as the elements of the n × n distance ma-
trix D
S
, containing for every pair (t
i
,t
j
) of variables
the length D
S
(i, j) of the shortest path
2
from t
i
to t
j
.
If D
S
contains the entries D
S
(i, j) and D
S
( j,i), then
t
i
t
j
D
S
( j,i) and t
j
t
i
D
S
(i, j) are the strongest
constraints implied by C with respect to the tempo-
ral difference between t
j
and t
i
. Slightly abusing ter-
minology, we call S
min
= (T, D
S
) the minimal STN
equivalent
3
to S,
The latest (lst) and earliest (est) starting times
of t
i
T can be found by using the first row and
first column of D, respectively: lst(t
i
) = D(0,i) and
est(t
i
) = D
S
(i,0). Given an STN S, its distance
matrix D
S
can be computed in O(n
3
)-time (Dechter,
2003). Hence, using the STN-machinery we can find
earliest and latest starting times for variables t T
efficiently.
Remark 1. Here, we always assume that, for each
t T , there is a finite interval for scheduling it. More
exactly, we assume for each STN S = (T,C) there ex-
ist finite constants (horizons) h
S
< h
+
S
, such that for
all t T , h
S
t h
+
S
. This avoids the occurrence of
unbounded time intervals such as t
i
t
j
.
3 NAIVE FLEXIBILITY
Intuitively, flexibility of a schedule reflects the free-
dom to choose a time-to-execute for a temporal vari-
1
Without loss of generality, in the remainder of the pa-
per, we simply assume that an STN is consistent.
2
Interpreting the constraints as specifications of the dis-
tance between variables.
3
That is, S
min
and S have the same set of solutions.
able t. Hence, it seems quite self-evident to choose the
interval [est(t), lst(t)] to characterise such a freedom
of choice: First of all, for every value v outside this
interval, there exists no schedule σ such that σ(t) = v.
Moreover, this interval does not contain useless val-
ues: it is well-known that for each t T and for ev-
ery v [est(t), lst(t)], there exists a schedule σ for S
such that σ(t) = v. No wonder then that one of the
first ideas for a flexibility metric has been based on
these [est(t),lst(t)] intervals. More exactly, the so-
called naive flexibility flex
N
(S) of an STN S = (T,C)
has been defined as flex
N
(S) =
tT
(lst(t) est(t)).
However, as has already been pointed out (Wilson
et al., 2013; Wilson et al., 2014), this metric will often
overestimate the available flexibility in an STN due to
the fact that the flexibility intervals assigned to tem-
poral variables are not independent. We will illustrate
this fact with a very simple example.
Example 1. Consider the following STNs S
1
=
(T
1
,C
1
) and S
2
= (T
2
,C
2
), where
T
1
= T
2
= {z,t
1
,t
2
},
C
1
= {0 t
i
z 100 | i = 1,2}
C
2
= {0 t
i
z 100 | i = 1,2}
{0 t
1
t
2
}.
For both STNs we have est(t
i
) = 0 and lst(t
i
) = 100,
for i = 1,2. Hence, flex
N
(S
1
) = flex
N
(S
2
) = 200. In-
tuitively, however, in S
2
, due to the ordering con-
straint between t
1
and t
2
, the flexibility should be
much lower, since not all combinations of values cho-
sen in these intervals are allowed simultaneously. For
example, while t
1
= 75 and t
2
= 10 is allowed, t
1
= 10
and t
2
= 75 is not. More in general, a flexibility of f
1
,
0 f
2
100 given to t
1
, results in a flexibility of f
2
=
100 f
1
for t
2
. Hence, intuitively, for S
2
we would ex-
pect a total flexibility of f
1
+(100 f
1
) = 100 instead
of 200.
The reason for this overestimation is that, in gen-
eral, the intervals [est(t),lst(t)] are not independent:
choosing a value v in one interval might affect the fea-
sible choices in an other interval. In fact, although for
each t T and every v [est(t), lst(t)] there exists a
schedule σ for S such that σ(t) = v, this property does
not hold if we consider two or more temporal vari-
ables simultaneously.
4 CONCURRENT FLEXIBILITY
In (Witteveen et al., 2014) it has been shown that com-
puting the naive flexibility (NF) metric flex
N
(S) for an
STN S = (T,C) is identical to determining the maxi-
Optimising Flexibility for Simple Temporal Networks
525
mum of the following LP:
maximize
tT
(t
+
t
) (LP1)
subject to t
t
+
, t T
t
+
t
0+
c , (t t
0
c) C
t
t
0−
c , (t t
0
c) C
Geometrically speaking the solution space of an STN
S is a polytope. In case of a consistent STN it is a
bounded polytope. The (value of the) naive flexibil-
ity metric can be shown to be equal to the sum of the
lengths of the n (spanning) edges of the smallest n-
dimensional outer bounding box containing the poly-
tope generated by the underlying STN.
Example 2. Consider the STNs discussed in Exam-
ple 1. In Figure 1 we have depicted the solution
spaces of both STNs. The polytope constituting the
solution space of S
1
is the large rectangle with edges
of length 100. This rectangle is also the smallest
outer bounding box for this polytope. The sum of the
lengths of the two spanning edges for this bounding
box equals 100 + 100 = 200. This is the value of the
naive flexibility flex
N
(S
1
) of S
1
.
The polytope belonging to S
2
is the shaded up-
per left triangle with corners (0, 0),(0, 100) and
(100,100). The smallest bounding box containing
this triangle is the large rectangle, i.e., the same outer
bounding box as the one computed for S
1
. Hence,
flex
N
(S
2
) = flex
N
(S
2
) = 200. As we can see, however,
half of the values assigned to t
1
and t
2
in this larger
bounding box will lie outside the solution polygon.
Clearly, if the polytope generated by an STN S is
not a hypercube, there are points in this outer bound-
ing box which do not belong to the solution space of
the STN. In these cases flex
N
(S) will overestimate the
amount of flexibility of S.
To improve upon the shortcomings of the naive
flexibility metric, it was decided in (Wilson et al.,
2013) to base an alternative metric, the so-called con-
current flexibility (CF) metric, on the largest inner
bounding box of the solution polytope generated by
S. Note that the inner bounding box is contained in
the solution space. Hence, it guarantees that for every
constraint t
j
t
i
c
i, j
the corresponding flexibility in-
tervals [t
i
,t
+
i
] and [t
j
,t
+
j
] associated with these vari-
ables do not violate any constraint. This implies that
for every value v
i
[t
i
,t
+
i
] and v
j
[t
j
,t
+
j
] it should
hold that v
j
v
i
c
i, j
. But this is exactly the case
whenever t
j
assumes a maximal value and t
i
assumes
a minimal value, i.e., when t
+
j
t
i
c
i, j
.
Hence, taking into account that we want to max-
imise the length of the intervals [t
,t
+
], the correct
value for this new concurrent flexibility metric flex(S)
for S = (T,C) can be found by solving the following
LP:
maximize
tT
(t
+
t
) (LP2)
subject to t
t
+
, t T
t
+
t
0−
c , (t t
0
c) C
Example 3. Consider again the STNS S
1
= (T
1
,C
1
)
and S
2
= (T
2
,C
2
) specified in Example 1. Since the
polytope generated by S
1
is a rectangle (see Figure 1),
its largest inner bounding box is identical to its small-
est outer bounding box. Hence, the naive flexibility
flex
N
(S
1
) equals the concurrent flexibility flex(S
1
).
The polytope generated by S
2
is the shaded up-
per triangle depicted in Figure 1. Its largest inner
bounding box (the smaller rectangle in the shaded
area in Figure 1) determines the concurrent flexibility
flex(S
2
) of S
2
: in this case flex(S
2
) = 50 +50 = 100 <
f lex
N
(S
2
) = 200. This is what would be expected.
t
2
100
100
t
2
-
t
2
+
t
1
-
t
1
+
t
1
t
1
=
t
2
50
50
Figure 1: The polytope generated by S
1
is the large rectan-
gle with edges of length 100; the polytope generated by S
2
is the red upper triangle. The inner bounding box of this tri-
angle is the smaller rectangle with edges of length 50. The
inner bounding box of S
1
(also the outer bounding box of
both S
1
and S
2
) equals the polytope of S
1
.
5 SHORTCOMINGS OF CF
Two advantages of the CF metric are that (i) it never
overestimates the intuitive flexibility of an STN and
(ii) it allows one to choose an arbitrary value in each
temporal variable interval without risking infeasibil-
ity. There are, however, some clear cases where the
concurrent flexibility seriously underestimates the in-
tuitive flexibility of an STN. We discuss these cases
and then propose an improved concurrent flexibility
(ICF) metric.
ICAART 2016 - 8th International Conference on Agents and Artificial Intelligence
526
5.1 Rigid Components
While concurrent flexibility offers the possibility to
choose from all flexibility intervals [t
,t
+
] simulta-
neously, the mere fact that all time-point variables
are included, paradoxically enough, might severely
restrict the concurrent flexibility. Consider the fol-
lowing example:
Example 4. Let S = (T,C) where T = {z,t
1
,t
2
} and
C = {0 t
1
z 100, 0 t
2
t
1
0}. Note C
implies t
1
= t
2
. Intuitively, the flexibility of this
STN should be equal to 100: we can choose a value
for t
1
(or t
2
) and then the value for the other vari-
able is simply determined. Computing the concurrent
flexibility, however, gives flex(S) = max{(t
+
1
t
1
) +
(t
+
2
t
2
)} = 0, while the naive flexibility results in
flex
N
(S) = 200. Again, the naive flexibility is a se-
rious overestimation of the available flexibility, since
t
2
is determined as soon as t
1
is determined. On the
other hand, the concurrent flexibility seems to be a se-
rious underestimation of the available flexibility. So,
intuitively, the concurrent flexibility metric fails for
these kind of instances.
The reason for this underestimation is not difficult
to see: if there is a rigid functional relationship be-
tween two or more variables, this relationship will re-
duce the concurrent flexibility of all the variables in-
volved to zero, since a choice v for one of the variables
involved will immediately reduce the possible values
for all the other variables to a fixed value determined
by v. Hence, v itself cannot be allowed to vary, there-
fore all intervals associated with these variables have
length 0. Intuitively, this is unwanted, since, in gen-
eral, there is always one variable in such a collection
of rigidly coupled variables we can choose several
values for. Therefore, in such a situation, we should
choose a representative for the set of coupled vari-
ables and let the values of the other variables in the
set be determined as soon as we have chosen a value
for the representative. This means that in such cases,
we have to rescue flexibility by giving up the idea of
assigning a flexibility interval to every variable in T .
Let us make these ideas more precise. First of all,
we define what it means to for a set of variables to be
rigidly coupled:
Definition 1. Given an STN S = (T,C), a subset of
variables X T is rigidly coupled, if for every pair
t
i
,t
j
X it holds that t
i
t
j
= c
i, j
is a constraint im-
plied by C. A rigid component
4
is a maximal subset
of rigidly coupled variables.
4
The term rigid components has been borrowed from
Hunsberger (Hunsberger, 2002).
So X is a rigid component if taking a value for any
variable t
k
X , the values of the remaining variables
in X are completely determined. Since the distance
matrix D
S
contains the tightest upper bounds for the
constraints between any pair of variables t
i
,t
j
T , it
is easy to see that the following observations do hold:
Observation 1. A subset of variables X T in an
STN S = (T,C) is rigidly coupled, if for every pair
t
i
,t
j
X it holds that D
S
(t
i
,t
j
) = D
S
(t
j
,t
i
). Hence,
for such a pair of variables we have D
S
(t
i
,t
j
) +
D
S
(t
j
,t
i
) = 0.
Due to the strict dependencies between them, the
flexibility of every variable in a rigid component X is
0 and therefore the total sum of all individual flexibil-
ities in X is 0. Furthermore, it is easy to see that rigid
components, due to their maximality must be disjoint.
Therefore, we have:
Observation 2. Let S = (T,C) be an STN. Let X
and Y be rigid components. Then: (i) f lex(X) =
f lex(Y ) = 0
5
and (ii) X Y =
/
0.
Note that rigid components can be easily found by
inspecting the distance matrix D
S
.
The following proposition states that whenever an
STN has rigid components, we might safely remove
all elements but one from each rigid component and
then concentrate the flexibility computation on the re-
maining variables:
Proposition 1. Let S = (T,C) and X T a rigid com-
ponent. Let t X be arbitrary. Then
1. for every schedule σ
0
for S
(T X)∪{t}
, there exists a
schedule σ for S extending σ
0
.
2. flex(S
(T X)∪{t}
) flex(S).
Based on Proposition 1 we propose to improve the
concurrent flexibility of a system by contracting every
rigid component to a single variable. The concurrent
flexibility of this reduced system then should repre-
sent the flexibility of the original system. First of all,
it avoids the disadvantage of assigning a flexibility of
0 to every variable in a rigid component and assigns
a flexibility at least as large as the concurrent flexibil-
ity of the original system. Secondly, it ensures that
whatever schedule for the reduced system is taken,
such a schedule can be extended to a schedule of the
original system. We therefore call the resulting flex-
ibility metric the improved flexibility metric, denoted
by flex
(S). In this context, the metric is based on
removal of rigid components while keeping only rep-
resentatives of them and then computing the concur-
rent flexibility on the remaining system S
RC
. So our
5
Slightly abusing terminology, flex(X) stands for the to-
tal flexibility of all vars in X.
Optimising Flexibility for Simple Temporal Networks
527
first proposal for improvement comes down to defin-
ing flex
(S) = flex(S
RC
).
Example 5. Consider Example 4 with the rigidly
coupled variables t
1
and t
2
. Clearly, X = {t
1
,t
2
} is
a rigid component. Let t
1
be the representative of
X. The resulting system S
0
= S
(T X)∪{t
1
}
= (T
0
,C
0
)
where T
0
= {z,t
1
} and C
0
= {t
1
z 100,z t
1
0}.
The concurrent flexibility of S
0
equals flex(S
0
) = 100.
Hence, flex
(S) = flex(S
0
) = 100.
We conclude that the disadvantage of concurrent
flexibility when dealing with rigid components can be
easily eliminated by computing the concurrent flexi-
bility of a reduced STN. This computation takes only
polynomial overhead.
5.2 Flexibility Restricting Constraints
Unfortunately, there are other, more general, cases
where the flexibility of the system as measured by CF
also underestimates the intuitively available flexibil-
ity. Let us again consider a simple example.
Example 6. Consider the system S = (T,C) where
T = {z,t
1
,t
2
} and C = {0 t
1
z 100, 0 t
2
t
1
2}. Note that flex
N
(S) = 100 + 102 = 202, while
flex(S) = 2. This system does not contain rigid com-
ponents, but almost all the original flexibility for the
variables t
1
and t
2
, taken separately, is ”absorbed” by
a strong constraint between them. Clearly, flex
N
(S) =
202 is overestimating the real’ flexibility, because
choosing a value for t
1
, or for t
2
, leaves at most 2 units
of flexibility for the other variable. On the other hand,
insisting that t
2
and t
1
should be chosen concurrently,
reduces the total concurrent flexibility of the system to
2. Intuitively, however, we should reason as follows:
Taken separately, t
2
has a higher flexibility (102) than
t
1
(100). Taken together they are strongly dependent:
it is almost impossible to choose concurrently a value
for t
1
and t
2
in their flexibility intervals without vi-
olating the constraints. Therefore, we should deter-
mine the flexibility based on t
2
only, thereby possibly
reducing the flexibility of t
1
to 0 (note that choosing
t
2
= 102 does determine the value of t
1
completely).
This example suggests a more general strategy to
improve the concurrent flexibility of an STN: (i) Se-
lect a suitable subset of variables for which the con-
current flexibility is maximised, while (ii) making
sure that a suitable assignment of values to the re-
maining variables is always guaranteed.
We start with investigating the extendability issue
(ii), given a subset T
0
of variables selected. In or-
der to guarantee an extension to a complete solution,
the method we need to apply is called the Fourier-
Motzkin Elimination (FME) (Khachiyan, 2009). This
elimination method is applied to a set A of linear
equations to eliminate variables t in such a way that
the solutions to the resulting system A
0
(without t) are
exactly those solutions of A where the assignments to
the variable t have been removed. In other words: so-
lutions to the reduced set A
0
= FME(A,t) always can
be extended to solutions of A. We discuss the details
of the FME method relevant to our problem.
The Fourier-Motzkin Elimination Method. It
suffices to explain the FME procedure specialised to
STNs.
Proposition 2. An FME of a variable t
i
T from an
STN S = (T,C) results in replacing all combinations
of constraints t
j
t
i
c
i, j
C and t
i
t
k
c
i,k
C by
the constraint
t
j
t
k
min{c
j,k
,c
i, j
+ c
i,k
}
The resulting system S
0
= (T {t
i
},C
0
) does not con-
tain any occurrence of t
i
and every solution σ
0
to S
0
can be extended to a solution σ to S.
Definition 2. Let S = (T,C) be an STN. The reduced
system S
0
resulting from S after the FME of the vari-
ables t
1
,t
2
,. .. ,t
k
is denoted by S
0
= t
1
,t
2
,. ..t
k
S.
Example 7. Take the STN S presented in Example 6.
The Fourier-Motzkin Elimination of t
1
w.r.t. S results
in the system S
0
= (T
0
,C
0
) = t
1
S, where T
0
= {z,t
2
}
and C
0
= {0 t
2
z 102}.
While, in general, the FME enjoys double expo-
nential complexity ( O(n
2
n
) ), for STNs the FME can
be performed in O(n
3
)-time as the removal of a sin-
gle variable t
i
results in a set of binary difference con-
straints that can be computed in O(n
2
)-time and there
are at most O(n) variables to be eliminated.
When using the minimal distance matrix D
S
to
represent all the minimal constraints, the application
of FME to a set of variables T
0
comes down to the
simple removal of corresponding rows and columns
in the matrix D
S
:
Observation 3. Let S = (T,C) be an STN. Let S
0
=
t
i
S be the STN derived by FME of the i-th variable
t
i
T . Then S
0
min
= (T {t
i
},D
i
S
) is the minimal sys-
tem equivalent to S
0
, where D
S
0
= D
i
S
is the distance
matrix derived from D
S
by deleting the i-th row and
i-th column from D
S
.
Proof. Let S = (T,C) be an STN with distance matrix
D
S
. Since D
S
is the minimal distance matrix of S we
have:
1 i, j,k n, D
S
(k, i) + D
S
(i, j) D
S
(k, j) (1)
ICAART 2016 - 8th International Conference on Agents and Artificial Intelligence
528
Applying the FME w.r.t. t
i
implies that all combi-
nations of inequalities t
j
t
i
D
S
(i, j) and t
i
t
k
D
S
(k, i) are replaced by the inequality
t
j
t
k
min{D
S
(k, j), D
S
(k, i) + D
S
(i, j)}.
Then, using equation 1, we have
min{D
S
(k, j), D
S
(k, i) + D
S
(i, j)} = D
S
(k, j)
implying that the entries in the remaining rows and
columns of D
S
are not changed due to the removal of
the i-th variable. So, a minimal system after applying
a Fourier Motzkin elimination step w.r.t. t
i
will have
a distance matrix D
S
0
where the row and column cor-
responding to t
i
have been removed and all remaining
entries remain the same.
Now we are ready to discuss the second problem
we mentioned: selecting a subset T
0
of variables such
that the concurrent flexibility based on this subset of
variables is maximal.
Given the above discussed correspondence be-
tween applying the FME and removing rows and
columns from D
S
, we would like to compute the con-
current flexibility for a subset T
0
of variables using the
distance matrix D
T
0
directly. Here, a recently discov-
ered equivalence between flex(S) and the value of a
minimum cost assignment based on the distance ma-
trix D
S
is very useful (Mountakis et al., 2015):
Proposition 3. Let S = (T,C) be a consistent STN
having a minimum distance matrix D
S
. Then the con-
current flexibility flex(S) equals the value c(M) of
a minimum cost assignment given a cost matrix D
S
,
where
D
S
(i, j) =
(
lst(t
i
) est(t
i
) if i = j,
D
S
(i, j) else
Here, the problem to find a minimum cost assign-
ment given an n× n cost matrix D comes down to find
a bijective function M : {1,. . . , n} {1,...,n} such
that c(M) =
n
i=1
D(i, f (i)) is minimised. The value
c(M) is known as the min-cost assignment given D.
The proposition states the equality c(M) = flex(S),
where D
S
is the underlying cost matrix.
Example 8. Consider the STN presented in Exam-
ple 6. Its distance matrix D
S
and corresponding cost
matrix D
S
are
D
S
=
"
0 100 102
0 0 2
0 0 0
#
, D
S
=
"
0 100 102
0 100 2
0 0 102
#
The value of a minimum cost assignment c(M) based
on D
S
equals c(M) = 0 + 2 + 0 = 2 = flex(S).
Given the correspondence between flex(S) and
computing a min-cost assignment for a cost matrix
D
S
, it is now easy to establish a relationship with an
improved concurrent flexibility metric flex
(S):
Definition 3. Given a cost matrix D
S
, the cost matrix
based on T
0
T , is denoted by D
S,T
0
, a submatrix of
D
S
obtained by removing the rows and columns cor-
responding to variables in T T
0
.
Definition 4. A maximal min-cost assignment based
on D
S
is the maximal cost of all min-cost assignments
M
T
0
based on D
S,T
0
for some T
0
T . We then define
flex
(S) = max{c(M
T
0
) : T
0
T and M
T
0
is a min-cost
assignment for D
S,T
0
}
Using this correspondence, we can show that com-
puting flex
(S) is NP-hard:
Proposition 4. Given an STN S = (T,C) it is NP-hard
to compute flex
(S).
Proof. We use a reduction from SET PACKING. An
instance of the (unweighted variant of the) set packing
problem is a tuple (U,C), where U is a non-empty set
set and C 2
U
a nonempty collection of subsets of
U. We have to find a subset C
0
(a set-packing) of C
such that (i) no subsets occurring in C
0
do overlap and
(ii) the number of sets in this set packing, i.e. |C
0
|, is
maximal.
The reduction to finding the maximal concurrent
flexibility problem is quite straightforward: Given an
instance (U,C) of the set-packing problem use a fixed
enumeration < c
1
,c
2
,. .. c
m
> of the subsets in C. As-
sign to each subset c
i
C a fixed cost D(i,i) = 1. Fur-
thermore, for every pair of subsets c
i
,c
j
C, define
D(i, j) = 1 if c
i
c
j
=
/
0 and D(i, j) = −|U| 1, else.
Consider the following claim:
Claim: There exists a subset C
0
of C with coverage
m > 0 iff there exists a maximal min-cost assignment
based on D of total value m > 0.
Clearly, if this claim holds, computing the im-
proved flexibility metric flex
(S) for the obtained STN
S would solve the set packing problem. This implies
that computing flex
(S) is NP-hard as it solves the NP-
hard set-packing problem.
Proof of the Claim
(only if). Suppose such a subset C
0
exists. Without
loss of generality, we may assume that the first m rows
in the matrix D correspond to the subsets occurring in
C
0
. But then the first m rows and columns form a sub-
matrix filled with the value 1 only. Hence, selecting
this submatrix would result in a minimum cost assign-
ment equal to m. Therefore, flex
(S) m.
(if) Suppose a subset maximal min-cost solution with
value m has been found. We show that there exists a
Optimising Flexibility for Simple Temporal Networks
529
subset C
0
of C with coverage m. Given the construc-
tion of D, at least m
0
m rows must have been chosen
for the minimum cost solution of value m.
1. If m
0
= m, then, clearly, these m rows must form a
sub matrix filled with ones only, hence there exist m
subsets c
i
that do not overlap with each other. There-
fore, there exists a subset C
0
of C such that |C
0
| = m.
2. If m
0
> m, then there are m
0
m rows where at least
one entry −|U| 1 appears. This means that at least
once the value U 1 will contribute to the minimum
cost assignment, resulting in a negative value. Since
m > 0 was assumed, this is not possible. Hence, only
the first case applies and we are done.
5.3 ICF: Experimental Results
In this section we present an experimental evaluation
of our improved flexibility metric. First of all, these
experiments are used to give an impression of (i) the
practical value of our metric, i.e., whether the im-
proved flexibility metric really improves the existing
concurrent flexibility metric and (ii) if so, what is a
good (approximation) algorithm (among the ones we
investigated) that can be applied.
We investigated a couple of algorithms and ap-
plied them to a dataset of STN benchmark instances
(see (Planken et al., 2013)). This dataset contains
a series of STN-instances grouped as bdh-agent-
problems (300 instances), diamonds (130 instances),
chordalgraphs (400 instances), NeilYorkeExamples
(180 instances) The size of the STN instances in these
datasets varies from instances with 41 variables with
614 constraints to instances with 4882 nodes and
14110 constraints. In total, these sets contain 1010
STN-instances. We used MATLAB (R2014b) to
perform the experiments. In particular, we used a fast
implementation of the Jonker-Volgenant algorithm
(Jonker and Volgenant, 1987) to compute minimal
cost assignments to obtain the concurrent flexibility
of an STN.
Detecting Rigid Components. The first algorithm
we applied is a simple rigid component detection al-
gorithm as suggested in Section 5.1. Whenever it de-
tects a rigid component X in an STN S it removes all
but one variable from X. When no more rigid compo-
nent can be found, the number of rigid components
detected, their size and the improvement w.r.t. the
concurrent flexibility of the original system is deter-
mined.
The results are simply disappointing: In none of
the 1010 instances rigid components have be found.
We conclude that detecting rigid components in these
benchmark sets does not help at all in improving the
concurrent flexibility.
Removing Tightly Coupled Variables. Next, gen-
eralising from rigid components, we investigate
whether removal of variables that are tightly coupled
improves the concurrent flexibility.
To each instance S in the benchmark sets, we ap-
plied the following algorithm:
1. Determine the distribution F
S
of sums D
S
(i, j) +
D
S
( j,i) for all entries D
S
. Remember that for each
(i, j) this sum indicates the tightness of the con-
straints between variable t
i
and t
j
.
2. To remove the δ-percent tightest constraints, col-
lect all pairs of variables t
i
and t
j
such that
D
S
(i, j) + D
S
( j,i) occurs in the δ-percent lowest
part of the distribution F
S
.
3. For each such a pair (i, j), remove the variable (t
i
or t
j
) from T whose removal results in the largest
increase of the concurrent flexibility for the re-
maining set of variables.
4. Compute the concurrent flexibility flex(S
0
) of the
subsystem S
0
obtained in this way.
For each instance, this procedure was repeated for 10
threshold values δ ranging from δ = 0.05 to δ = 10.
We computed for each instance the maximum ratio
flex(S
0
)/flex(S) (max ratio) obtained and the corre-
sponding threshold value δ (threshold) for which it
was obtained. Note that values flex(S
0
)/flex(S) > 1
indicate an improvement that can be obtained by look-
ing at a subset of variables instead of all variables.
The results are summarised in Table 1. Observe
that, in general, as all improvements are 5% or less,
no significant increase in flexibility can be observed in
any set of benchmark problems. Furthermore, look-
ing at the threshold values, it hardly seems to make
sense to go beyond threshold values of δ = 1 to de-
tect an improvement in concurrent flexibility. This
seems to show that a simple greedy approach based
on tightness of constraints does not help that much in
improving the flexibility.
Table 1: Removing tightly coupled variables for improving
concurrent flexibility.
benchmark set max ratio threshold
bdh 1 0
diamonds 1.05 0.62
chordal 1.01 0.05
NeilYorke 1.04 0.37
Iteratively Removing Least Contributing Vari-
ables. In the first two experiments we applied algo-
rithms attempting to improve the concurrent flexibil-
ity by removing variables that were rigidly or tightly
ICAART 2016 - 8th International Conference on Agents and Artificial Intelligence
530
coupled. Since we observed that the improvements
in concurrent flexibility were quite modest, we de-
cided to use another approach not based on the de-
tection and removal of tightly coupled variables. In-
stead, we used a fairly simple greedy approach using
the minimum cost assignment algorithm as a subrou-
tine. The algorithm iteratively removes that variable
t T whose removal results in the largest increase in
concurrent flexibility until no further improvement is
possible. Given an STN S = (T,C) the algorithm is as
follows:
compute flex(S
T
);
while t T s.t. flex(S
T −{t}
) flex(S
T
) do
t := argmax
t
flex(S
T −{t}
);
flex(S
T
) = flex(S
T −{t}
);
T := T {t};
end while
return flex(S
0
) = flex(S
T
);
In Table 2, we have presented for each bench-
mark set the average ratio flex(S
0
)/flex(S) (ratio) of
the concurrent flexibility based on a subset of vari-
ables (S
0
) vss the concurrent flexibility of the origi-
nal system (S) and the average reduction (reduction)
in the number of variables obtained when computing
flex(S
0
). It turns out that this procedure greatly im-
proves the concurrent flexibility by removal of vari-
ables, although showing remarkable differences be-
tween the benchmark sets. While the bdh and chordal
instances were not sensitive to this approach, the flex-
ibility in the NeilYorkeExamples and the diamonds
benchmark sets could be improved significantly (up
to 50%). This improvement was established using a
relatively small part of the original set of variables due
to a significant reduction (0.48 and 0.70) of the num-
ber of variables involved. Clearly, we need to fur-
ther investigate which properties are responsible for
the (in)sensitivity to these greedy approaches.
Table 2: Iteratively removing variables to maximising con-
current flexibility.
benchmark set ratio reduction
bdh 1 0.01
diamonds 1.50 0.70
chordal 1.02 0.30
NeilYorke 1.32 0.48
6 CONCLUSIONS
We introduced an improved concurrent flexibility
metric to determine the inherent flexibility of an STN.
The main reason for introducing this new metric was
the observation that in some cases requiring flexibility
for all events concurrently is unrealistic, especially if
there are strict or nearly strict dependencies between
some temporal variables. Our new metric avoids these
difficulties by looking at a subset of the variables for
which the concurrent flexibility is maximised.
A question that still has to be answered is what
happens to the flexibility of the variables not included
in this subset. Clearly, their flexibility depends on the
values chosen for the variables occurring in the sub-
set. This idea we would like to explore and generalise
in the near future: instead of distinguishing between
two types of variables, we envision a partial flexibility
order over the variables: a variable t occurs before t
0
if the flexibility of the first one determines the flexi-
bility of the latter one. Following this idea one could
envision flexibility policies that given such a partial
flexibility order guarantee a minimal amount flexibil-
ity for subsets of variables.
REFERENCES
Dechter, R. (2003). Constraint Processing. Morgan Kauf-
mann.
Floyd, R. (1962). Algorithm 97: Shortest path. Communi-
cations of the ACM, 5(6).
Hunsberger, L. (2002). Algorithms for a temporal decou-
pling problem in multi-agent planning. In Proceed-
ings AAAI.
Jonker, R. and Volgenant, A. (1987). A shortest augmenting
path algorithm for dense and sparse linear assignment
problems. Computing, 38(4):325–340.
Khachiyan, L. (2009). Fourier-motzkin elimination method.
In Floudas, C. A. and Pardalos, P. M., editors, Ency-
clopedia of Optimization, pages 1074–1077. Springer
US.
Mountakis, S., Klos, T., and Witteveen, C. (2015). Tem-
poral flexibility revisited: Maximizing flexibility
by computing bipartite matchings. In Proceedings
Twenty-Fifth International Conference on Automated
Planning and Scheduling.
Planken, L. R., Boerkoel, J. C., and Wilcox, R. J. (2013).
Multiagent STN benchmark instances.
Wilson, M., Klos, T., Witteveen, C., and Huisman, B.
(2013). Flexibility and decoupling in the simple tem-
poral problem. In Rossi, F., editor, Proceedings In-
ternational Joint Conference on Artificial Intelligence
(IJCAI), pages 2422 2428. AAAI Press, Menlo Park,
CA.
Wilson, M., Klos, T., Witteveen, C., and Huisman, B.
(2014). Flexibility and decoupling in simple tempo-
ral networks. Artificial Intelligence, 214:26–44.
Witteveen, C., Wilson, M., and Klos, T. (2014). Optimal
decoupling in linear constraint systems. In Proceed-
ings of the Twenty-Eighth AAAI Conference on Artifi-
cial Intelligence (AAAI-14), pages 2381–2387. AAAI
Press, Menlo Park, CA.
Optimising Flexibility for Simple Temporal Networks
531