search combinators
play

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,


  1. Search Combinators Tom Schrijvers with Guido Tack, Pieter Wuille, Horst Samulowitz, Peter Stuckey

  2. Search heuristics are crucial.

  3. Support for Search? General Purpose Solver-Provided Programming Language Options “everthing is possible, “everything is easy, nothing is easy” nothing is possible”

  4. State-of-the-Art Modularity: Prolog ✓ label1(Vars1) , label2(Vars2) ✓ label1(Vars1) ; label2(Vars2) ✓ once(label1(Vars1)) ✓ once((label1(Vars1),label2(Vars2))

  5. Lack of Modularity ✘ lds(label1(Vars1))

  6. Lack of Modularity ✘ lds(label1(Vars1)) ✘ lds((label1(Vars1) , label2(Vars2)))

  7. Lack of Modularity ✘ lds(label1(Vars1)) ✘ lds((label1(Vars1) , label2(Vars2))) ✓ lds_label1(Vars1) ✓ lds_label1_label2(Vars1,Vars2)

  8. Can we do better? ✓ Lots of expressivity and flexibility ✓ Lots of productivity through high-level specifications ✓ Modular reuse of search specifications

  9. Yes: Search Combinators High-level modular building blocks “Everything is possible and easy”

  10. Base Search s ≡ int_search( vars ,var_sel,val_sel) • provided by the solver • augment with combinators

  11. Combinators prune let( v , e , s ) assign( v , e ) post( c , s ) if( c , s 1 , s 2 ) and([ s 1 , s 2 ,..., s n ]) or([ s 1 , s 2 ,..., s n ]) portfolio([ s 1 , s 2 ,..., s n ]) restart( c , s )

  12. Statistics Combinators depth( v , s ) discrepancy( v , s ) nodes( v , s ) failures( v , s ) time( v , s )

  13. Statistics Combinators depth( v , s ) discrepancy( v , s ) nodes( v , s ) failures( v , s ) time( v , s ) if(v < 5,depth(v,s 1 ),s 2 )

  14. Statistics Combinators depth( v , s ) discrepancy( v , s ) nodes( v , s ) failures( v , s ) time( v , s ) if(v < 5,depth(v,s 1 ),s 2 ) if(depth < 5,s 1 ,s 2 )

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

  16. Reuse Examples ✓ lds(int_search( vars ,...)) ✓ lds(and([int_search( vars1 ,...) ,int_search( vars2 ,...)]) ✓ lds(or([int_search( vars1 ,...) ,int_search( vars2 ,...)]) ...

  17. More Abstractions bab( obj , s ) restart_bab( obj , s ) dicho( obj , s , lb , ub ) id( s ) hot_start( c , s 1 , s 2 ) see paper

  18. Radiotherapy Planning bab(k, and([int_search(N,...)] ++ [once(int_search(row i ,...)) | i in 1..n ] ) )

  19. Modular Syntax vs. Modular Semantics

  20. Modular Semantics search tree node traditional modularity: • each combinator is an atomic unit • minimal interaction

  21. Modular Semantics search tree node traditional modularity: • each combinator is an atomic unit • minimal interaction

  22. Modular Semantics • cross-cutting behavior • highly entangled in monolithic code ➡ “Aspect-Oriented Programming”

  23. Functional Mixin Inheritance • disciplined form of AOP ★ meaningful and pre-defined set of interaction points • no AOP system needed

  24. Mixin-based Interaction for every child c next(n',n) enter(n) push(c) success failure more

  25. Mixin-based Interaction for every child c next(n',n) enter(n) push(c) Details: see paper success failure more

  26. Implementations DSL Haskell C++ Scala Compact Loop Compacte Lus

  27. Implementations DSL Haskell C++ Scala Zoekheuristiek Search Spec Compact Loop Compacte Lus

  28. Implementations DSL Haskell C++ Scala Objectcompositie Objects Interpreted Zoekheuristiek Search Spec Compact Loop Compacte Lus

  29. Implementations DSL Haskell C++ Scala Objectcompositie Objects Interpreted Zoekheuristiek Search Spec Codegenerators Compact Loop Compacte Lus Code Generators Compiled

  30. Combinator Overhead? Worst-case Scenario compiled interpreted 300,00% n portfolio 250,00% prune runtime base search 200,00% without propagation 150,00% 100,00% 1 2 5 10 20 #combinators

  31. In Practice 180,00% propagation dwarfs combinator overhead 160,00% Gecode Interpreted Compiled 140,00% 120,00% 100,00% 80,00% 0 1 2 1 2 3 4 5 2 5 3 5 0 1 1 1 G H H - 1 y y y y y 1 t p p p p p b b b m Z p p p m m m a a a a a o o o B r r r r r p h h h A o o o e e e e e o s s s l l l h h h h h o o o p - - - h t t t t t G G G b b b o o o o o o s o o o - i i i i i h d d d d d b J J J s a a a a a o - R R R R R b J o J

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

  33. Future Work • Optimizations • MiniZinc integration • Combinators for parallel search • Extend other solving technology (e.g., LP) ➡ Combinators for hybrid search

  34. Thank You!

  35. Combinator Overhead 300,00% compiled interpreted 250,00% runtime 200,00% 150,00% 100,00% 1 2 5 10 20 #combinators

Recommend


More recommend