7. Other planning problems
Course scheduling Hospital bed planning
http://www.flickr.com/photos/markhillary/2227726759/
http://www.flickr.com/photos/phelyan/2281095105/
Many more: port planning, airline routing, train composition,
task assignment, assembly line planning,
satellite bandwidth planning, stock cutting, ...
7
8. Bin packing in the cloud
Assign each
● Process
To
● Server
Constraints
● Hardware requirements
● Minimize server cost
http://www.flickr.com/photos/torkildr/3462607995/
8
9. Bin packing in the cloud
Assign each
● Process
To
● Server
Constraints
● Hardware requirements
● Minimize server cost
http://www.flickr.com/photos/torkildr/3462607995/
9
23. NP complete
No silver bullet known
● Holy grail of computer
science
● P == NP
● Probably does not exist
● P != NP
Root problem of
all planning problems
http://www.flickr.com/photos/annguyenphotography/3267723713/
23
48. Process is a planning entity
@PlanningEntity
public class Process {
private int requiredCpuPower;
private int requiredMemory;
private int requiredNetworkBandwidth;
private Server server;
@PlanningVariable @ValueRange(... = "serverList")
public Server getServer() {...}
// getters, setters, clone, equals, hashcode
}
48
53. Simple Java score calculation
Easy to implement
Bridge to an existing scoring system
Slow
public class ...
implements SimpleScoreCalculator<CloudBalance> {
public Score calculateScore(CloudBalance cb) {
...
}
}
53
54. Incremental Java
score calculation
Fast
● Solution changes => only score delta is recalculated
Hard to implement
● Much boilerplate code
54
55. Drools score calculation
Also incremental => fast
● but no boilerplate code
Integration opportunities
● Guvnor repository
● DSL: natural language constraints
● Decision tables
55
56. DRL soft constraint:
server cost
rule "serverCost"
when
// there is a server
$s : Server($c : cost)
// there is a processes on that server
exists Process(server == $s)
then
// lower soft score by $c
end
56
57. DRL hard constraint:
CPU power
rule "requiredCpuPowerTotal"
when
// there is a server
$s : Server($cpu : cpuPower)
// with too little CPU for its processes
$total : Number(intValue > $cpu) from accumulate(
Process(server == $s,
$requiredCpu : requiredCpuPower),
sum($requiredCpu)
)
then
// lower hard score by ($total - $cpu)
end
57
69. First Fit Decreasing config
<solver>
...
<constructionHeuristic>
<constructionHeuristicType>FIRST_FIT_DECREASING</>
</constructionHeuristic>
</solver>
@PlanningEntity(difficultyComparatorClass
= ProcessDifficultyComparator.class)
public class Process {
...
}
69
72. Local Search comes after
Construction Heuristics
<solver>
...
<constructionHeuristic>
<constructionHeuristicType>FIRST_FIT_DECREASING</>
</constructionHeuristic>
<localSearch>
...
<localSearch>
</solver>
72