Search Combinators Tom Schrijvers with Guido Tack, Pieter Wuille, - - PowerPoint PPT Presentation

search combinators
SMART_READER_LITE
LIVE PREVIEW

Search Combinators Tom Schrijvers with Guido Tack, Pieter Wuille, - - PowerPoint PPT Presentation

Search Combinators Tom Schrijvers with Guido Tack, Pieter Wuille, Horst Samulowitz, Peter Stuckey Search heuristics are crucial. Support for Search? General Purpose Solver-Provided Programming Language Options everthing is possible,


slide-1
SLIDE 1

Search Combinators

Tom Schrijvers

with Guido Tack, Pieter Wuille, Horst Samulowitz, Peter Stuckey

slide-2
SLIDE 2

Search heuristics are crucial.

slide-3
SLIDE 3

Support for Search?

General Purpose Programming Language “everthing is possible, nothing is easy” Solver-Provided Options “everything is easy, nothing is possible”

slide-4
SLIDE 4

State-of-the-Art Modularity: Prolog

✓ label1(Vars1) , label2(Vars2) ✓ label1(Vars1) ; label2(Vars2) ✓ once(label1(Vars1)) ✓ once((label1(Vars1),label2(Vars2))

slide-5
SLIDE 5

Lack of Modularity

✘ lds(label1(Vars1))

slide-6
SLIDE 6

Lack of Modularity

✘ lds(label1(Vars1)) ✘ lds((label1(Vars1) , label2(Vars2)))

slide-7
SLIDE 7

Lack of Modularity

✘ lds(label1(Vars1)) ✘ lds((label1(Vars1) , label2(Vars2))) ✓ lds_label1(Vars1) ✓ lds_label1_label2(Vars1,Vars2)

slide-8
SLIDE 8

Can we do better?

✓Lots of expressivity and flexibility ✓Lots of productivity through high-level

specifications

✓Modular reuse of search specifications

slide-9
SLIDE 9

Yes: Search Combinators

“Everything is possible and easy” High-level modular building blocks

slide-10
SLIDE 10

Base Search

s ≡ int_search(vars,var_sel,val_sel)

  • provided by the solver
  • augment with combinators
slide-11
SLIDE 11

Combinators

prune let(v,e,s) assign(v,e) post(c,s) if(c,s1,s2) and([s1, s2,..., sn])

  • r([s1, s2,..., sn])

portfolio([s1, s2,..., sn]) restart(c,s)

slide-12
SLIDE 12

Statistics Combinators

depth(v,s) discrepancy(v,s) nodes(v,s) failures(v,s) time(v,s)

slide-13
SLIDE 13

Statistics Combinators

depth(v,s) discrepancy(v,s) nodes(v,s) failures(v,s) time(v,s) if(v < 5,depth(v,s1),s2)

slide-14
SLIDE 14

Statistics Combinators

depth(v,s) discrepancy(v,s) nodes(v,s) failures(v,s) time(v,s) if(v < 5,depth(v,s1),s2) if(depth < 5,s1,s2)

slide-15
SLIDE 15

Reusable Abstractions

limit(c,s) ≡ if(c,s,prune) for(v,l,u,s) ≡ ... lds(s) ≡ for(n,0,∞, limit(discrepancy ≤ n,s) )

slide-16
SLIDE 16

Reuse Examples

✓lds(int_search(vars,...)) ✓lds(and([int_search(vars1,...)

,int_search(vars2,...)])

✓lds(or([int_search(vars1,...)

,int_search(vars2,...)]) ...

slide-17
SLIDE 17

More Abstractions

bab(obj,s) restart_bab(obj,s) dicho(obj,s,lb,ub) id(s) hot_start(c,s1,s2) see paper

slide-18
SLIDE 18

Radiotherapy Planning

bab(k, and([int_search(N,...)] ++ [once(int_search(rowi,...)) | i in 1..n ] ) )

slide-19
SLIDE 19

Modular Syntax vs. Semantics Modular

slide-20
SLIDE 20

Modular Semantics

traditional modularity:

  • each combinator is an

atomic unit

  • minimal interaction

search tree node

slide-21
SLIDE 21

Modular Semantics

traditional modularity:

  • each combinator is an

atomic unit

  • minimal interaction

search tree node

slide-22
SLIDE 22

Modular Semantics

  • cross-cutting behavior
  • highly entangled in

monolithic code

➡ “Aspect-Oriented Programming”

slide-23
SLIDE 23

Functional Mixin Inheritance

  • disciplined form of AOP

★ meaningful and pre-defined set of

interaction points

  • no AOP system needed
slide-24
SLIDE 24

Mixin-based Interaction

success failure enter(n) more for every child c push(c) next(n',n)

slide-25
SLIDE 25

Mixin-based Interaction

Details: see paper

success failure enter(n) more for every child c push(c) next(n',n)

slide-26
SLIDE 26

Implementations

Compacte Lus

DSL Haskell C++ Scala

Compact Loop

slide-27
SLIDE 27

Implementations

Zoekheuristiek Compacte Lus

DSL Haskell C++ Scala

Compact Loop Search Spec

slide-28
SLIDE 28

Implementations

Zoekheuristiek Objectcompositie Compacte Lus

DSL Haskell C++ Scala

Compact Loop Search Spec Objects

Interpreted

slide-29
SLIDE 29

Implementations

Zoekheuristiek Objectcompositie Compacte Lus Codegenerators

DSL Haskell C++ Scala

Compact Loop Search Spec Objects

Code Generators

Interpreted Compiled

slide-30
SLIDE 30

Combinator Overhead?

portfolio prune base search without propagation

n

Worst-case Scenario

100,00% 150,00% 200,00% 250,00% 300,00%

1 2 5 10 20

runtime

#combinators

compiled interpreted

slide-31
SLIDE 31

80,00% 100,00% 120,00% 140,00% 160,00% 180,00%

G

  • l
  • m

b 1 G

  • l
  • m

b 1 1 G

  • l
  • m

b 1 2 R a d i

  • t

h e r a p y 1 R a d i

  • t

h e r a p y 2 R a d i

  • t

h e r a p y 3 R a d i

  • t

h e r a p y 4 R a d i

  • t

h e r a p y 5 J

  • b
  • s

h

  • p

G 2 J

  • b
  • s

h

  • p

H 5 J

  • b
  • s

h

  • p

H 3 J

  • b
  • s

h

  • p

A B Z 1

  • 5

J

  • b
  • s

h

  • p

m t 1

In Practice

propagation dwarfs combinator overhead

Gecode Interpreted Compiled

slide-32
SLIDE 32

Summary

high-level modular modeling of search low-level modular implementation competitive performance compared to hand-coded algorithm

slide-33
SLIDE 33

Future Work

  • Optimizations
  • MiniZinc integration
  • Combinators for parallel search
  • Extend other solving technology (e.g., LP)

➡ Combinators for hybrid search

slide-34
SLIDE 34

Thank You!

slide-35
SLIDE 35
slide-36
SLIDE 36

Combinator Overhead

100,00% 150,00% 200,00% 250,00% 300,00%

1 2 5 10 20

runtime

#combinators

compiled interpreted