23
Graduate Seminar 2008 Reconciling Copying and Trailing for Constraint Programming Systems Raphael Reischuk Graduate Seminar PS Lab October 13, 2008 U N I V E R S I T A S S A R A V I E N S I S Advisor: Guido Tack Supervisor: Gert Smolka

Reconciling - Universität des Saarlandesraphael/bachelor/downloads/talk4...separator entry denotes branching level Depth-first search explores a single path in a search tree, represented

  • Upload
    others

  • View
    3

  • Download
    0

Embed Size (px)

Citation preview

  • Graduate Seminar 2008

    ReconcilingCopying and Trailing for Constraint Programming Systems

    Raphael Reischuk

    Graduate Seminar PS LabOctober 13, 2008

    UN I

    V E R S IT AS

    SA

    R A V I E N

    SI S

    Advisor: Guido TackSupervisor: Gert Smolka

  • Raphael Reischuk Graduate Seminar 2008

    Overview

    • motivation

    • how to solve constraint problems?

    • some observations

    • a hybrid architecture

    • reconciling copying and trailing

    • experimental results

    • future work

  • Raphael Reischuk Graduate Seminar 2008

    Motivation

    • Copying based CP solvers are efficientfor integer and set variables (FD)not for SAT problems

    • Trailing based SAT solvers are efficientfor Boolean variablesnot for integer and set variables

    • No combination of both systems so far

    • New: hybrid solver for hybrid problems

    Gecode

    MiniSat

    hybridsolver

  • branching

    x=5 x!5

    y

  • Raphael Reischuk Graduate Seminar 2008

    How to solve problems?

    CSP

    integer and set variables

    Boolean variables

    solveusing

    Gecode

    solve using SATtechniques

    Gecode propagators

    clause propagators

    • two independent components ?➟ solve them separately, concurrently

  • Raphael Reischuk Graduate Seminar 2008

    How to solve problems?

    CSP

    integer and set variables

    Boolean variables

    solveusing

    Gecode

    solve using SATtechniques

    Gecode propagators

    clause propagators

    • two independent components ?➟ solve them separately, concurrently

    • more interesting: hybrid problemswith shared variables, shared propagators, shared dependencies

    solveusinghybridsolverhybrid

    propagators

  • Raphael Reischuk Graduate Seminar 2008

    Observations

    • solvers differ in

    • how information is maintained(local vs. global information)

    • restoration techniques(copying vs. trailing)

  • Raphael Reischuk Graduate Seminar 2008

    Maintaining Information

    local information(copying)

    global information(trailing)

    propagatorvariabledependencies

    propagatorvariabledependencies

    subsumption

    domain

    domain‘

    subsumption

    propagatorvariabledependencies

    domain

    time

    propagatorvariabledependencies

    domain‘‘

    + subsumption

    + watched literals+ garbage collection

    copy

    copy

    propagation

    state of the solver

    state of the solver

    state of the solver

    Trail

    x≠5

    y≠7

    z≠4b≠1

    x≠3

    + propagator rewriting

  • state of a solver

    local part global part

    collected ina space

    several clones of a spacein memory

    available at a single persistent

    location

    never copied

    replace actual space by previous one

    undo the modifications successively

    storage:

    restoration:

    information:

    Raphael Reischuk Graduate Seminar 2008

    Information in a Hybrid Solver

    A hybrid solver has to deal with local and global information.

  • recomputation stack

    (0, desc)

    (1, desc)

    (1, desc)

    (0, desc)

    (clone)

    0

    1

    2

    3

    4

    (clone)

    (clone)

    trailing stack

    v17 ! 0

    v52 ! 1

    ...

    v12 ! 1

    v37 ! 0

    ...

    v13 ! 8

    v13 ! 5

    ...

    v23 ! 0

    v67 ! 1

    ...

    3

    0

    1

    2

    4

    hybrid stack

    v17 ! 0

    v52 ! 1

    ...

    v12 ! 1

    v37 ! 0

    ...

    v13 ! 8

    v13 ! 5

    ...

    v23 ! 0

    v67 ! 1

    ...

    3

    0

    1

    2

    4

    branchingsmodifications

    (0, desc) (clone)

    (1, desc)

    (1, desc) (clone)

    (0, desc)

    (clone)

    fixed points

    Raphael Reischuk Graduate Seminar 2008

    Architecture: DFS Stack

    information in separator entries

    information between separator entries

    separator entrydenotes branching level

    Depth-first search explores a single path in a search tree, represented by a stack.

    We need to have new propagator types, new dependency types and new variable types.

  • state of the solver

    state of the solver

    Raphael Reischuk Graduate Seminar 2008

    Restoration Techniques

    local information(recomputation)

    global information(undoing changes)

    propagatorvariabledependencies

    propagatorvariabledependencies

    domain

    domain‘

    propagatorvariabledependencies

    domainrestoration

    propagatorvariabledependencies

    domain‘‘

    jump to previous

    state

    modify statein-place

    („move upwards“)

    copy

    copy

    Trail

    x≠5

    y≠7

    z≠4b≠1

    x≠3

  • failure

    untrail

    last clone

    hybrid stack

    ......

    ......

    (0, desc) (clone)

    (0, desc)

    (1, desc) (clone)

    (1, desc)

    (clone)

    (clone)

    untrail

    sr

    sf

    Raphael Reischuk Graduate Seminar 2008

    Restoration: Full Copying

    Simplest restoration technique: full copying

    restoration level

    failure level

  • untrail(1)

    commits(4)

    failure

    schedule(3)

    hybrid stack

    ......

    ......

    (0, desc) (clone)

    (0, desc)

    (0, desc)

    (1, desc)untrail(1)

    (1, desc)

    ...

    commits(4)

    s!

    sr

    sf

    Raphael Reischuk Graduate Seminar 2008

    Restoration: Full Recomputation

    More involved restoration technique: full recomputation

    restoration level

    failure level

    level of last clone

    1) untrail (global part)

    2) fetch clone from memory (local part)

    3) schedule copied propagators depending on trailed variables explicitly (local part)

    4) recompute (local part)

  • untrail(1)

    commits(4)

    failure

    schedule(3)

    hybrid stack

    ......

    ......

    (0, desc) (clone)

    (0, desc)

    (0, desc)

    (1, desc)untrail(1)

    (1, desc)

    ...

    commits(4)

    s!

    sr

    sf

    Raphael Reischuk Graduate Seminar 2008

    Restoration: Full Recomputation

    More involved restoration technique: full recomputation

    restoration level

    failure level

    level of last clone

    1) untrail (global part)

    2) fetch clone from memory (local part)

    3) schedule copied propagators depending on trailed variables explicitly (local part)

    4) recompute (local part)

    x = 3⇔ ¬bwhy scheduling?

    • constraint• copied variable x has domain

    {1,2,3} in last clone• trailed variable b still set to 0• recomputation adds

    branching constraints and computes one fixed point

    • variable x is never modified since propagator is not scheduled

    x = 3⇔ ¬b

    x = 3⇔ ¬b

  • untrail(1)

    commits(4)

    failure

    schedule(3)

    compute fixed point (5)and place copy (6)

    commits withfixed point computation

    (7)

    hybrid stack

    ......

    ......

    (0, desc) (clone)

    (0, desc)

    (0, desc)

    (1, desc)untrail

    (1)

    (0, desc)

    ...

    commits(4)

    s!

    sr

    sf

    sm

    Raphael Reischuk Graduate Seminar 2008

    Restoration: Adaptive Recomputation

    Even more involved restoration technique: adaptive recomputation

    restoration level

    failure level

    level of last clone 1. untrail (global part)

    2. fetch clone from memory (local part)

    3. schedule copied propagators depending on trailed variables explicitly (local part)

    4. recompute (local part)

    5. compute fixed point (both parts)

    6. place copy (local part)

    7. recompute and compute fixed point in each level (both parts)

  • Raphael Reischuk Graduate Seminar 2008

    Experimental Results 1: Overhead

    +10.8 % +0.6 %

    +6.3 %

    +6.8 %

    +12.8 % +12.6 %

    Runtime overhead for non-trailed variables

    Gecode Overhead

  • Raphael Reischuk Graduate Seminar 2008

    Experimental Results 2: Overhead

    +76%

    +69%

    Runtime overhead for trailed variables with copied propagators

    Gecode Overhead

    +2%

    +14%

    +28%+48%

    +29%

  • Raphael Reischuk Graduate Seminar 2008

    Experimental Results 3: Gain

    Runtime

    Gecode Hybrid Solver

    Trailed variables with shared propagators

    Propagation Steps (·106)

    -31% -29%

    -32%

    -69%

    +11% +95%

    +105%

    -37%

    ➟ Concerning runtime, we clearly outperform Gecode for this class of problems.Additionally, our hybrid solver uses only about one forth of the memory Gecode uses.

  • Raphael Reischuk Graduate Seminar 2008

    Experimental Results 4: Gain

    Runtime

    Gecode Hybrid Solver

    Trailed variables with shared propagators using clause learning

    Propagation Steps (·106)

    -99,996%-99,4% -99,8%

    -95,3% -99,995% -98,7%-99,4%

    -95,0%

    ➟ Concerning runtime, we dramatically outperform Gecode.Because of the learned clauses, our solver uses more memory than Gecode.

    40s ➟ 1,8ms1.156s ➟ 54s

  • Raphael Reischuk Graduate Seminar 2008

    Experimental Results 4: Gain

    Runtime

    Gecode Hybrid Solver

    Trailed variables with shared propagators using clause learning

    Propagation Steps (·106)

    -99,996%-99,4% -99,8%

    -95,3% -99,995% -98,7%-99,4%

    -95,0%

    ➟ Concerning runtime, we dramatically outperform Gecode.Because of the learned clauses, our solver uses more memory than Gecode.

    +44

    +606

    +695

    +31.148

    60v 600v 718v 78v

    less propagationwith morepropagators

    Propagators

  • Raphael Reischuk Graduate Seminar 2008

    Conclusions

    • Our hybrid solver integrates trailing in the copying based solver Gecode. It reconciles two restoration techniques.

    • The hybrid solver outperforms copying based solvers by using trailing for certain variables and SAT techniques on top.

    • With the implementation of new shared propagators, our hybrid solver may solve more problems efficiently.

  • Raphael Reischuk Graduate Seminar 2008

    Future Work

    • For pure SAT problems however, MiniSat [9] is much faster. There are still many SAT techniques to implement. [3,17,20]

    • Another way of reconciling copying solvers with SAT solvers is the lazy clause generation approach [18]. Maybe, our approach can be combined with it.

    • Parallel computing features.

    • Implementations of hybrid clauses containing integer variables.

    • Clause learning for integer variables.

    • Can non-clause propagators report implications for their assignments?

  • Raphael Reischuk Graduate Seminar 2008

    Thank you for your attention.

    [18] Olga Ohrimenko, Peter Stuckey, and Michael Codish. Propagation = Lazy Clause Generation. In Christian Bessiere, editor, Principles and Practice of Constraint Programming - CP 2007, 13th International Conference, CP 2007, Providence, RI, USA, September 23-27, 2007, Proceedings, volume 4741 of Lecture Notes in Computer Science. Springer, 2007.

    [2] Krzysztof Apt. Principles of Constraint Programming. Cambridge University Press, 2003.

    [9] Niklas Eén and Niklas Sörensson. An Extensible SAT-solver. In Enrico Giunchiglia and Armando Tacchella, editors, Theory and Applications of Satisfiability Testing - SAT 2003, 6th International Conference, Santa Margherita Ligure, Italy, May 5-8, 2003, volume 2919 of Lecture Notes in Computer Science, pages 502–518. Springer, 2004.

    [3] Gilles Audemard, Lucas Bordeaux, Youssef Hamadi, Said Jabbour, and Lakhdar Sais. A Generalized Framework for Conflict Analysis. In Marques-Silva and Sakallah [16], pages 21–27.

    [16] João Marques-Silva and Karem A. Sakallah, editors. Theory and Applications of Satisfiability Testing - SAT 2007, 10th International Conference, Lisbon, Portugal, May 28-31, 2007, volume 4501 of Lecture Notes in Computer Science. Springer, 2007.[17] Matthew W. Moskewicz, Conor F. Madigan, Ying Zhao, Lintao Zhang, and Sharad Malik. Chaff: Engineering an Efficient SAT Solver. In Proceedings of the 38th Design Automation Conference, DAC 2001, Las Vegas, NV, USA, June 18-22, 2001. ACM, 2001.

    [20] Knot Pipatsrisawat and Adnan Darwiche. A Lightweight Component Caching Scheme for Satisfiability Solvers. In Marques-Silva and Sakallah [16], pages 294–299[25] The Gecode Team. Gecode: generic constraint development environment, 2008. Available at http://www.gecode.org.

    References:

    http://www.gecode.orghttp://www.gecode.org