A Quadratic Edge-Finding Algorithm for Cumulative Resource

A Quadratic Edge-Finding Algorithm
for Cumulative Resource Constraints
R. Kameugne1,2
L.P. Fotso2
Y. Ngo-Kateu2
1
2
J. Scott3
Department of Mathematics
University of Maroua
Departments of Mathematics and Computer Science
University of Yaoundé
3
ASTRA Group, Computing Science Division
University of Uppsala
SweConsNet, 2011
Introduction
Edge-Finding
Quadratic EF
. . . . . .
Results
Conclusion
Overview
Edge-๏ฌnding is a ๏ฌltering algorithm used in constraint-based
scheduling applications
For disjunctive scheduling, there are edge-๏ฌnding algorithms
with complexity of (๐‘› log ๐‘›).
For cumulative edge-๏ฌnding, the best algorithm to this point was
(๐‘˜๐‘› log ๐‘›) [Viliฬm, 2009].
Today I will present an algorithm for cumulative edge-๏ฌnding in
๐‘›2 time.
โ€ข Complexity doesnโ€™t strictly dominate previous algorithms, but
offers a practical improvement.
2. SweConsNet | Quadratic Edge-Finding
Introduction
Edge-Finding
Quadratic EF
. . . . . .
Outline
1. Introduction: Cumulative Scheduling
2. Edge-Finding
3. A Quadratic Algorithm
Minimum Slack and Maximum Density
Filtering Algorithm
4. Experimental Results
3. SweConsNet | Quadratic Edge-Finding
Results
Conclusion
Introduction
Edge-Finding
Quadratic EF
. . . . . .
Results
Conclusion
The cumulative resource scheduling problem
Set of tasks ๐‘‡ , sharing a ๏ฌnite resource of constant capacity .
Inelastic: task has ๏ฌxed resource requirement ๐‘ and duration ๐‘
โ€ข Energy of the task is ๐‘’ = ๐‘ โ‹… ๐‘
Non-preemptive: task may not be interrupted once started.
A task is bounded by earliest and latest start times, est and lst .
โ€ข With ๏ฌxed ๐‘, can reason on last completion time lct instead.
est ๐‘– = 0
lst ๐‘– = 7
๐‘๐‘–
4. SweConsNet | Quadratic Edge-Finding
๐‘’๐‘–
๐‘๐‘–
.
0
lct ๐‘– = 10
5
10
Introduction
Edge-Finding
Quadratic EF
. . . . . .
Results
Conclusion
The cumulative resource scheduling problem
Raise several of these concepts to apply to a set of tasks ฮฉ:
est ฮฉ = min est ๐‘–
lct ฮฉ = max lct ๐‘–
๐‘–โˆˆฮฉ
๐‘–โˆˆฮฉ
eฮฉ =
e๐‘–
๐‘–โˆˆฮฉ
est ๐ด,๐ท = 0
lct ๐ด,๐ต,๐ถ = 5
๐ถ
lct ๐ท = 10
๐ท
๐ด
๐ต
.
0
est ๐ต,๐ถ = 2
example due to [Viliฬm, 2009]
5. SweConsNet | Quadratic Edge-Finding
5
10
Introduction
Edge-Finding
Quadratic EF
. . . . . .
Results
Conclusion
The cumulative constraint
Need to ๏ฌnd a start time for each task, so that at any given time
the tasks that are executing do not require more of the
resource than is available.
The cumulative constraint enforces the rule:
โˆ€๐‘ก
๐‘๐‘– โ‰ค
๐‘–โˆˆ๐‘‡
๐‘ ๐‘– โ‰ค๐‘กโ‰ค๐‘ ๐‘– +๐‘๐‘–
Will only enforce bounds consistency
โ€ข Try to tighten earliest and latest start times
โ€ข Not concerned with infeasible start times inside the domain
cumulative is NP-complete
โ€ข Polynomial time ๏ฌltering algorithms for cumulative, such as
edge-๏ฌnding, apply relaxations of the constraint
6. SweConsNet | Quadratic Edge-Finding
Introduction
Edge-Finding
Quadratic EF
. . . . . .
Results
Conclusion
Edge-๏ฌnding detects required ordering
Consider the set of tasks ฮฉ = {๐ด, ๐ต, ๐ถ}.
Is there a feasible schedule in which ฮฉ and ๐ท both end by lct ฮฉ ?
โ€ข If not, ๐ท must end after the end of every task in ฮฉ.
eฮฉโˆช{๐ท} >
โ‹… (lct ฮฉ โˆ’ est ฮฉโˆช{๐ท} ) โŸน ฮฉ โ‹– ๐ท
est โˆ—๐ท = 3
est ฮฉ = 0
๐ถ
lct ฮฉ = 5
lct ๐ท = 10
๐ท
๐ด
.
0
8. SweConsNet | Quadratic Edge-Finding
๐ต
5
10
Introduction
Edge-Finding
Quadratic EF
. . . . . .
Results
Conclusion
How much can the bound be updated?
Consider eฮฉ in two parts:
โ€ข energy which may be scheduled without affecting ๐ท,
โ€ข and the rest , which must affect ๐ท.
est ฮฉ = 0
rest(ฮฉ, ๐‘๐ท )
.
๐ท
๐ท
est โˆ—๐ท = 3
0
rest(ฮฉ, ๐‘๐‘– ) =
10
5
eฮฉ โˆ’( โˆ’ ๐‘๐‘– )(lct ฮฉ โˆ’ est ฮฉ )
0
est โˆ—๐‘– โ‰ฅ est ฮฉ +
9. SweConsNet | Quadratic Edge-Finding
lct ๐ท = 10
lct ฮฉ = 5
rest(ฮฉ, ๐‘๐‘– )
๐‘๐‘–
if ฮฉ โ‰  โˆ…
otherwise
Introduction
Edge-Finding
Quadratic EF
. . . . . .
Results
Conclusion
Must consider subsets of ฮฉ
{๐ต, ๐ถ} not energetic enough to require {๐ต, ๐ถ} โ‹– ๐ท.
{๐ด, ๐ต, ๐ถ} โ‹– ๐ท, and lct ๐ด,๐ต,๐ถ โ‰ฅ lct ๐ต,๐ถ ,
โ€ข therefore ๐ท must end after lct ๐ต,๐ถ .
est ๐ท = 0 est ๐ต,๐ถ = 2
lct ๐ต,๐ถ = 5
lct ๐ท = 10
๐ท
.
0
est โˆ—๐ท = 4
5
Must ๏ฌnd ฮ˜ โŠ† ฮฉ that yields the strongest update.
10. SweConsNet | Quadratic Edge-Finding
10
Introduction
Edge-Finding
Quadratic EF
. . . . . .
Results
Conclusion
The Edge-Finding Rule
โŽ›
โŽœ
rest ฮ˜, ๐‘๐‘–
est โˆ—๐‘– = max โŽœest ๐‘– , max max est ฮ˜ +
ฮ˜โŠ†ฮฉ
ฮฉโŠ†๐‘‡
โŽœ
๐‘๐‘–
๐‘–โˆ‰ฮฉ rest ฮ˜,๐‘๐‘– >0
โŽœ
๐›ผ(ฮฉ,๐‘–)
โŽ
โŽž
โŽŸ
โŽŸ
โŽŸ
โŽŸ
โŽ 
with
๐‘‘๐‘’๐‘“
๐›ผ (ฮฉ, ๐‘–) =
lct ฮฉ โˆ’ est ฮฉโˆช{๐‘–} < ๐‘’ฮฉโˆช{๐‘–} โˆจ est ๐‘– +๐‘๐‘– โ‰ฅ lct ฮฉ
rest ฮ˜, ๐‘๐‘– =
๐‘’ฮ˜ โˆ’
0
โˆ’ ๐‘๐‘–
lct ฮ˜ โˆ’ est ฮ˜
if ฮ˜ โ‰  โˆ…
otherwise
(The rule for adjusting lct is symmetric.)
11. SweConsNet | Quadratic Edge-Finding
Introduction
Edge-Finding
Quadratic EF
. . . . . .
Results
Conclusion
Task Intervals
An edge-๏ฌnder only needs to consider task intervals:
all the tasks that must be scheduled within a ๏ฌxed window.
est ๐ด,๐ต,๐ถ = 0
est ๐ด,๐ต = 0
lct ๐ด,๐ต,๐ถ = 5
lct ๐ด,๐ต = 5
๐ถ
๐ด
๐ด
๐ต
.
0
.
5
0
De๏ฌned by upper and lower bound tasks:
ฮฉ๐‘ˆ
๐ฟ = ๐‘– โˆˆ ๐‘‡ โˆฃ est ๐‘– โ‰ฅ est ๐ฟ โˆง lct ๐‘– โ‰ค lct ๐‘ˆ
To update est ๐‘– , only need to consider:
โ€ข ฮฉ๐‘ˆ
๐ฟ such that lct ๐‘ˆ < lct ๐‘–
โ€ข ฮ˜๐‘ข๐‘™ such that est ๐ฟ โ‰ค est ๐‘™ โ‰ค lct ๐‘ข โ‰ค lct ๐‘ˆ
12. SweConsNet | Quadratic Edge-Finding
๐ต
5
Introduction
Edge-Finding
Quadratic EF
. . . . . .
Results
Complexity
Naive: compare all tasks with all pairs of intervals.
โ€ข
๐‘›5
Precompute potential updates outside
the precedence detection loop.
๐‘›3
โ€ข Can reduce to
๐‘˜๐‘›2 , where ๐‘˜ is the number of distinct
resource requirements [Mercier and Van Hentenryck, 2008].
โ€ข
ฮ˜-tree: use a binary tree to compute
one bound of each interval [Viliฬm, 2009].
โ€ข
(๐‘˜๐‘› log ๐‘›)
Quadratic
โ€ข Previous
incomplete.
13. SweConsNet | Quadratic Edge-Finding
๐‘›2 algorithm [Baptiste, et al., 2001] was
Conclusion
Introduction
Edge-Finding
Quadratic EF
. . . . . .
Results
De๏ฌnition: Slack
Slack is a measure of the capacity that is not required by the
tasks of an interval ฮฉ:
๐‘†๐ฟ(ฮฉ) = (lct ฮฉ โˆ’ est ฮฉ ) โˆ’ ๐‘’ฮฉ
est ๐ด,๐ต,๐ถ = 0
lct ๐ด,๐ต,๐ถ = 5
๐ถ
๐‘†๐ฟ
๐‘†๐ฟ({๐ด, ๐ต, ๐ถ}) = 5
๐ด
.
0
15. SweConsNet | Quadratic Edge-Finding
๐ต
5
Conclusion
Introduction
Edge-Finding
Quadratic EF
. . . . . .
Results
Conclusion
Minimum Slack
For an upper bound ๐‘ˆ and a task ๐‘–, there is a lower bound
๐œ(๐‘ˆ, ๐‘–) with est ๐œ(๐‘ˆ,๐‘–) โ‰ค est ๐‘– which de๏ฌnes the interval of
minimum slack:
๐‘ˆ
โˆ€๐ฟ โˆˆ ๐‘‡, est ๐ฟ โ‰ค est ๐‘– โˆถ ๐‘†๐ฟ ฮฉ๐‘ˆ
๐œ(๐‘ˆ,๐‘–) โ‰ค ๐‘†๐ฟ ฮฉ๐ฟ
For an ฮฉ โŠ‚ ๐‘‡ and task ๐‘– โˆ‰ ฮฉ
ฮฉ โ‹– ๐‘– โŸบ e๐‘– > ๐‘†๐ฟ ฮฉ๐‘ˆ
๐œ(๐‘ˆ,๐‘–)
If ฮ˜๐‘ข๐‘™ โŠ† ฮฉ is the interval responsible for the maximum est โˆ—๐‘– , and
est ๐‘™ โ‰ค est ๐‘– , then:
est โˆ—๐‘–
16. SweConsNet | Quadratic Edge-Finding
โŽก rest ฮ˜๐‘ข๐œ(๐‘ข,๐‘–) , ๐‘๐‘–
= est ๐œ(๐‘ข,๐‘–) + โŽข
๐‘๐‘–
โŽข
โŽข
โŽค
โŽฅ
โŽฅ
โŽฅ
Introduction
Edge-Finding
Quadratic EF
. . . . . .
Results
Conclusion
De๏ฌnition: Density
For a task interval ฮ˜, the density of ฮ˜ is given by:
eฮ˜
๐ท๐‘’๐‘›๐‘ (ฮ˜) =
lct ฮ˜ โˆ’ est ฮ˜
est ฮ˜ = 0
lct ฮ˜ = 5
est ฮ˜ = 0
lct ฮ˜ = 5
๐ถ
๐ด
.
0
17. SweConsNet | Quadratic Edge-Finding
๐ท๐‘’๐‘›๐‘ (ฮ˜)
๐ต
.
5
0
5
Introduction
Edge-Finding
Quadratic EF
. . . . . .
Results
Conclusion
Maximum Density
For an upper bound ๐‘ข and a task ๐‘–, there is a lower bound ๐œŒ(๐‘ข, ๐‘–)
with est ๐‘– < est ๐œŒ(๐‘ข,๐‘–) which de๏ฌnes the interval of maximum
density:
โˆ€๐‘™ โˆˆ ๐‘‡, est ๐‘– < est ๐‘™ โˆถ ๐ท๐‘’๐‘›๐‘  ฮ˜๐‘ข๐œŒ(๐‘ข,๐‘–) โ‰ฅ ๐ท๐‘’๐‘›๐‘  ฮ˜๐‘ข๐‘™
If ฮ˜๐‘ข๐‘™ โŠ† ฮฉ is the interval responsible for the maximum est โˆ—๐‘– , and
est ๐‘– < est ๐‘™ , then:
est โˆ—๐‘–
18. SweConsNet | Quadratic Edge-Finding
โŽก rest ฮ˜๐‘ข๐œŒ(๐‘ข,๐‘–) , ๐‘๐‘–
= est ๐œŒ(๐‘ข,๐‘–) + โŽข
๐‘๐‘–
โŽข
โŽข
โŽค
โŽฅ
โŽฅ
โŽฅ
Introduction
Edge-Finding
Quadratic EF
. . . . . .
Results
for ๐‘ˆ โˆˆ ๐‘‡ by increasing lct ๐‘ˆ do
๐ธ๐‘›๐‘’๐‘Ÿ๐‘”๐‘ฆ โ† 0, ๐‘š๐‘Ž๐‘ฅ๐ธ๐‘›๐‘’๐‘Ÿ๐‘”๐‘ฆ โ† 0, est ๐œŒ โ† โˆ’โˆž, ๐‘š๐‘–๐‘›๐‘†๐ฟ โ† โˆ’โˆž
for ๐‘– โˆˆ ๐‘‡ by decreasing est ๐‘– do
if lct ๐‘– โ‰ค lct ๐‘ˆ then
๐ธ๐‘›๐‘’๐‘Ÿ๐‘”๐‘ฆ โ† ๐ธ๐‘›๐‘’๐‘Ÿ๐‘”๐‘ฆ + e๐‘–
if lct๐ธ๐‘›๐‘’๐‘Ÿ๐‘”๐‘ฆ
> lct๐‘š๐‘Ž๐‘ฅ๐ธ
then
โˆ’ est
โˆ’ est
๐‘ข
๐‘–
๐‘ˆ
๐œŒ
๐‘š๐‘Ž๐‘ฅ๐ธ โ† ๐ธ๐‘›๐‘’๐‘Ÿ๐‘”๐‘ฆ, est ๐œŒ โ† est ๐‘–
else
๐ท๐‘ข๐‘๐‘‘๐‘– โ† max ๐ท๐‘ข๐‘๐‘‘๐‘– , est ๐œŒ +
๐‘š๐‘Ž๐‘ฅ๐ธโˆ’( โˆ’๐‘๐‘– )(lct ๐‘ˆ โˆ’ est ๐œŒ )
๐‘๐‘–
๐ธ๐‘– โ† ๐ธ๐‘›๐‘’๐‘Ÿ๐‘”๐‘ฆ
for ๐‘– โˆˆ ๐‘‡ by increasing est ๐‘– do
if (lct ๐‘ˆ โˆ’ est ๐‘– ) โˆ’ ๐ธ๐‘– < ๐‘š๐‘–๐‘›๐‘†๐ฟ then
est ๐œ โ† est ๐‘– , ๐‘š๐‘–๐‘›๐‘†๐ฟ โ† (lct ๐‘ˆ โˆ’ est ๐œ ) โˆ’ ๐ธ๐‘–
if lct ๐‘– > lct ๐‘ˆ then
๐‘Ÿ๐‘’๐‘ ๐‘ก โ† ๐‘๐‘– (lct ๐‘ˆ โˆ’ est ๐œ ) โˆ’ ๐‘š๐‘–๐‘›๐‘†๐ฟ
if est ๐œ โ‰ค lct ๐‘ˆ โˆง๐‘Ÿ๐‘’๐‘ ๐‘ก > 0 then
๐‘†๐ฟ๐‘ข๐‘๐‘‘๐‘– โ† max ๐‘†๐ฟ๐‘ข๐‘๐‘‘๐‘– , est ๐œ +
if ๐‘š๐‘–๐‘›๐‘†๐ฟ โˆ’ e๐‘– < 0 then
๐ฟ๐ต โ† max(est ๐‘– , ๐ท๐‘ข๐‘๐‘‘๐‘– , ๐‘†๐ฟ๐‘ข๐‘๐‘‘๐‘– )
20. SweConsNet | Quadratic Edge-Finding๐‘–
๐‘Ÿ๐‘’๐‘ ๐‘ก
๐‘๐‘–
Conclusion
Introduction
Edge-Finding
Quadratic EF
. . . . . .
Results
Conclusion
Completeness
The quadratic algorithm in [Baptiste, et al., 2001] is weaker than
edge-๏ฌnding (misses some bound updates).
The algorithm presented here correctly detects all ฮฉ โ‹– ๐‘–.
Will not always make the strongest update on the ๏ฌrst iteration,
but will make some update.
โ€ข Does make the strongest update if:
โ–ถ est โ‰ค est , or
ฮ˜
๐‘–
โ–ถ est < est โ‰ค est .
๐‘–
ฮ˜
๐œŒ
โ€ข Otherwise, requires ๐‘› โˆ’ 1 iterations in the worst case.
โ€œLazyโ€ evaluation, which makes sense for ๏ฌltering algorithms.
21. SweConsNet | Quadratic Edge-Finding
Introduction
Edge-Finding
Quadratic EF
. . . . . .
Results
Experimental Results
Implemented in Gecode (3.4.2)
โ€ข Compared with existing implementation of the cumulative
ฮ˜-tree ๏ฌlter
โ€ข Propagators executed each edge-๏ฌnding ๏ฌlter in sequence with
time-tabling and overload checking.
Benchmarks from the PSPLib single-mode sets: 480 instances
each of 30, 60 and 90 tasks.
On average, less than 1% difference in number of propagations
required to ๏ฌnd solution.
โ€ข For J60 and J90, the quadratic propagator ranged from <2%
fewer propagations to <5% more.
โ€ข For J30, one instance of 30% fewer, another of 15% more.
23. SweConsNet | Quadratic Edge-Finding
Conclusion
Introduction
Edge-Finding
Quadratic EF
. . . . . .
Results
Conclusion
Runtime Comparison
PSPLib Single-Mode RCSP benchmarks J30, J60, and J90
Quadratic runtimes (sec)
250
j30
j60
j90
200
150
100
50
0
0
50
100
150
ฮ˜-tree runtimes (sec)
24. SweConsNet | Quadratic Edge-Finding
200
250
Introduction
Edge-Finding
Quadratic EF
. . . . . .
Results
Summary
Using a combination of minimum slack and maximum density,
cumulative edge-๏ฌnding can be performed in
๐‘›2 time.
Reaches same ๏ฌxpoint as a complete edge-๏ฌnder,
but may take additional iterations to ๏ฌnd it.
While not strictly dominating (๐‘˜๐‘› log ๐‘›) ฮ˜-tree edge-๏ฌnding,
experimental results suggest quadratic edge-๏ฌnding is faster in
practice.
Further work:
โ€ข
๐‘›2 extended edge-๏ฌnding (in preparation)
โ€ข Is it possible to use a ฮ˜-tree to reduce the complexity further?
25. SweConsNet | Quadratic Edge-Finding
Conclusion
Introduction
Edge-Finding
Quadratic EF
. . . . . .
Results
Thanks to. . .
The Swedish Research Council, as the fourth author is
supported by grant 2009-4384;
Christian Schulte, for providing a patch for the Gecode
cumulative propagator;
and last but not least: to all of you, for your attention today.
Questions?
26. SweConsNet | Quadratic Edge-Finding
Conclusion
Introduction
Edge-Finding
Quadratic EF
. . . . . .
Results
Conclusion
Further Reading
P. Baptiste, C. Le Pape, and W.P.M. Nuijten
Constraint-based scheduling: applying constraint programming to scheduling
problems
Kluwer, 2001
L. Mercier and P. Van Hentenryck
Edge ๏ฌnding for cumulative scheduling
INFORMS Journal on Computing, 20:143โ€“153, 2008
P. Vilím
Edge ๏ฌnding ๏ฌltering algorithm for discrete cumulative resources in
O(kn log n)
In I.P. Gent, ed., CP2009 (LCNS 5732) , pp. 802โ€“816, 2009.
Springer-Verlag
27. SweConsNet | Quadratic Edge-Finding