-
Notifications
You must be signed in to change notification settings - Fork 1
/
SchedulingConstraints.atl
47 lines (45 loc) · 1.18 KB
/
SchedulingConstraints.atl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
-- some constraints are CSP-like constraints, others are only OCL-like (e.g., derived properties)
module SchedulingConstraints;
create OUT : Scheduling refining IN : Scheduling;
rule Task {
from
c : Scheduling!Task
to
t : Scheduling!Task,
__constraintsChoco__: Constraints!ConstraintGroup (
solver <- 'choco',
constraints <- Sequence {
c.period.stay('WEAK'),
c.period.number < 5,
c.period.number >= 0,
c.period.number.".>"(c.requisites.target.period.number),
c.period.number.".="(c.corequisites.target1.period.number)
}
)
}
rule Period {
from
s : Scheduling!Period
to
t : Scheduling!Period (
-- specify how the totalCost derived property is (incrementally) computed
load <- s.tasks.cost->sumFloats()
),
__constraintsChoco__: Constraints!ConstraintGroup (
solver <- 'choco',
constraints <- Sequence {
(
s.project.tasks.cost.toConstant()
*
(
s.project.tasks.period.".="(s.toConstant())
).reify()
).sum() >= s.project.minLoad.toConstant(),
(s.project.tasks.cost.toConstant() *
(
s.project.tasks.period.".="(s.toConstant())
).reify()
).sum() <= s.project.maxLoad.toConstant()
}
)
}