Constraint Programming Connections with HPC Jean-Guillaume FAGES, - - PowerPoint PPT Presentation

constraint programming
SMART_READER_LITE
LIVE PREVIEW

Constraint Programming Connections with HPC Jean-Guillaume FAGES, - - PowerPoint PPT Presentation

Constraint Programming Connections with HPC Jean-Guillaume FAGES, PhD COSLING CEO Outline 1 What is Constraint-Programming? 2 How does it work? 3 How does HPC contributes to Constraint-Programming? CP Introduction - COSLING - Teratec17 2 /


slide-1
SLIDE 1

Constraint Programming

Connections with HPC

Jean-Guillaume FAGES, PhD COSLING CEO

slide-2
SLIDE 2

Outline

1 What is Constraint-Programming? 2 How does it work? 3 How does HPC contributes to Constraint-Programming?

CP Introduction - COSLING - Teratec’17 2 / 29

slide-3
SLIDE 3

What is Constraint-Programming?

What is Constraint-Programming?

CP Introduction - COSLING - Teratec’17 3 / 29

slide-4
SLIDE 4

What is Constraint-Programming?

A Paradigm

COSLING

Constraint-Programming A programming paradigm between AI and OR to solve constrained decision problems in a generic way.

CP Introduction - COSLING - Teratec’17 4 / 29

slide-5
SLIDE 5

What is Constraint-Programming?

A Paradigm

COSLING

Constraint-Programming A programming paradigm between AI and OR to solve constrained decision problems in a generic way.

CP Introduction - COSLING - Teratec’17 4 / 29

slide-6
SLIDE 6

What is Constraint-Programming?

Problem oriented paradigm

COSLING

Focus

  • It is not about Data (input)
  • It is about solving problems
  • Models are problem-specific

→ CP is a generic toolbox to design algorithms

CP Introduction - COSLING - Teratec’17 5 / 29

slide-7
SLIDE 7

What is Constraint-Programming?

Applications

COSLING

CP Introduction - COSLING - Teratec’17 6 / 29

slide-8
SLIDE 8

What is Constraint-Programming?

Applications

COSLING

CP Introduction - COSLING - Teratec’17 7 / 29

slide-9
SLIDE 9

What is Constraint-Programming?

Applications

COSLING

CP Introduction - COSLING - Teratec’17 8 / 29

slide-10
SLIDE 10

What is Constraint-Programming?

Applications

COSLING

CP Introduction - COSLING - Teratec’17 9 / 29

slide-11
SLIDE 11

How does it work?

How does it work?

CP Introduction - COSLING - Teratec’17 10 / 29

slide-12
SLIDE 12

How does it work?

Definition

COSLING

Constraint Satisfaction Problem (CSP) Defined by

  • a set of variables X = {x1, .., xn} (unknowns)
  • a set of domains D = {d1, .., dn} (possible values)
  • a set of constraints C = {c1, .., cm} (restrictions)

CP Introduction - COSLING - Teratec’17 11 / 29

slide-13
SLIDE 13

How does it work?

Definition

COSLING

Constraint Satisfaction Problem (CSP) Defined by

  • a set of variables X = {x1, .., xn} (unknowns)
  • a set of domains D = {d1, .., dn} (possible values)
  • a set of constraints C = {c1, .., cm} (restrictions)

Variable Domain Example Binary two integers {0, 1} Integer (bounded) integer interval [ [3, 11] ] Integer (enum) integer set {−2, ..., 3, 12} Set (int) set interval [{2}, {0, 2, 3, 5}] Graph graph interval Real real interval [3.14, 12.7]

CP Introduction - COSLING - Teratec’17 11 / 29

slide-14
SLIDE 14

How does it work?

Definition

COSLING

Constraint Satisfaction Problem (CSP) Defined by

  • a set of variables X = {x1, .., xn} (unknowns)
  • a set of domains D = {d1, .., dn} (possible values)
  • a set of constraints C = {c1, .., cm} (restrictions)

Constraints Examples Arithmetic +, −, ×, ÷, =, >, ≤ , = Logical ∨, ∧, ⇒ , ⇔ Set ∩, ∪, ⊆ , card, partition Global AllDifferent, Cumulative, Regular, Circuit... Graph Degrees, NCliques, NSCC, Tree No restrictions!

CP Introduction - COSLING - Teratec’17 11 / 29

slide-15
SLIDE 15

How does it work?

Example: TSP

COSLING

CP Introduction - COSLING - Teratec’17 12 / 29

slide-16
SLIDE 16

How does it work?

The Holy Grail

COSLING

Constraint Programming represents one of the closest approaches computer science has yet made to the Holy Grail

  • f programming: the user states the problem, the computer

solves it. [Eugene Freuder]

CP Introduction - COSLING - Teratec’17 13 / 29

slide-17
SLIDE 17

How does it work?

Main algorithm

COSLING

Solving loop

  • Filtering
  • Search space reduction (inconsistent values removal)
  • Propagating deductions until fixpoint
  • Search
  • Search space exploration (hypothesis)
  • Applying branching heuristics to compute decisions

Until all variables are fixed to a value (solution)

CP Introduction - COSLING - Teratec’17 14 / 29

slide-18
SLIDE 18

How does it work?

Main algorithm

COSLING

Solving loop

  • Filtering
  • Search space reduction (inconsistent values removal)
  • Propagating deductions until fixpoint
  • Search
  • Search space exploration (hypothesis)
  • Applying branching heuristics to compute decisions

Until all variables are fixed to a value (solution) Optimization

  • Compute solution
  • Post z < c (cost of previous solution)

Until no better solution exists

CP Introduction - COSLING - Teratec’17 14 / 29

slide-19
SLIDE 19

How does it work?

Filtering

COSLING

From constraints to filtering Every constraint comes with one or many filtering algorithms to remove inconsistent values (domain modifications)

CP Introduction - COSLING - Teratec’17 15 / 29

slide-20
SLIDE 20

How does it work?

Filtering

COSLING

From constraints to filtering Every constraint comes with one or many filtering algorithms to remove inconsistent values (domain modifications) Example

  • x = {0, 1, 2, 3, 5, 6} and y = {2, 3, 5, 6, 10}
  • constraint: x > y
  • Filtering x → y : y = {2, 3, 5, ✁

6,✚

10}

  • Filtering x ← y : x = {✁

0, ✁ 1, ✁ 2, 3, 5, 6}

CP Introduction - COSLING - Teratec’17 15 / 29

slide-21
SLIDE 21

How does it work?

Filtering

COSLING

From constraints to filtering Every constraint comes with one or many filtering algorithms to remove inconsistent values (domain modifications) Example: AllDifferent Let X = {x1, x2, x3} with x1 ∈ {1, 2}, x2 ∈ {1, 2} and x3 ∈ {1, 2, 3} such that x1 = x2, x1 = x3, x2 = x3 x1 ∈ {1, 2}, x2 ∈ {1, 2} and x3 ∈ {✁ 1, ✁ 2, 3}

CP Introduction - COSLING - Teratec’17 15 / 29

slide-22
SLIDE 22

How does it work?

Filtering

COSLING

From constraints to filtering Every constraint comes with one or many filtering algorithms to remove inconsistent values (domain modifications) Scope

  • Each filtering algorithm is local to a constraint
  • Filtering algorithms are called incrementally until

reaching a fix point

CP Introduction - COSLING - Teratec’17 15 / 29

slide-23
SLIDE 23

How does it work?

Search

COSLING

Search Heuristic domain modification to drive the solving process

  • Triggers propagation and filtering
  • Guides how to reach a solution

Binary branching At each node a decision (var, op, val) is taken

  • Left child: apply decision (guess)
  • Right child: negate decision (deduction)

CP Introduction - COSLING - Teratec’17 16 / 29

slide-24
SLIDE 24

How does it work?

Search

COSLING

Search heuristics Which decision (var, op, val) to generate?

  • Huge impact on results

Many strategies

  • Black-box v.s. User-defined strategy
  • Best-First v.s. Fail-First principle

CP Introduction - COSLING - Teratec’17 17 / 29

slide-25
SLIDE 25

How does it work?

Summary

COSLING

CP Introduction - COSLING - Teratec’17 18 / 29

slide-26
SLIDE 26

How does HPC contributes to Constraint-Programming?

How does HPC contributes to Constraint-Programming?

CP Introduction - COSLING - Teratec’17 19 / 29

slide-27
SLIDE 27

How does HPC contributes to Constraint-Programming?

Parallelism

COSLING

Parallelism Can we achieve significant gains using parallel computing?

CP Introduction - COSLING - Teratec’17 20 / 29

slide-28
SLIDE 28

How does HPC contributes to Constraint-Programming?

Parallelism

COSLING

Parallelism Can we achieve significant gains using parallel computing? Filtering parallelization Filtering algorithms could be called in parallel, but:

  • Domain cloning overhead
  • Unit propagation is (usually) fast
  • Propagation is an iterative process

⇒ Not used in practice

CP Introduction - COSLING - Teratec’17 20 / 29

slide-29
SLIDE 29

How does HPC contributes to Constraint-Programming?

Parallelism

COSLING

Parallelism Can we achieve significant gains using parallel computing? Search parallelization

  • Solver portfolios
  • Distributed search
  • Work stealing
  • Embarrassingly Parallel Search

CP Introduction - COSLING - Teratec’17 20 / 29

slide-30
SLIDE 30

How does HPC contributes to Constraint-Programming?

Portfolio approaches

COSLING

Portfolio

  • Several instances of same model but Different search

strategies run in parallel

  • Satisfaction: no communication at all (luck)
  • Optimization: Bound sharing (collaboration)

Many strategies

  • Exponential speedup
  • State-of-the-art for few cores

CP Introduction - COSLING - Teratec’17 21 / 29

slide-31
SLIDE 31

How does HPC contributes to Constraint-Programming?

Portfolio approaches

COSLING

CP Introduction - COSLING - Teratec’17 22 / 29

slide-32
SLIDE 32

How does HPC contributes to Constraint-Programming?

Distributed DFS

COSLING

Work stealing [Jaffar et. al.]

  • Master records solutions & bounds
  • Workers (dynamical)
  • Pop or steal node
  • Explore node
  • Push right child in stack

Issue

  • Communication cost
  • Hard to find a balanced distribution
  • Hard to scale beyond 100 cores

CP Introduction - COSLING - Teratec’17 23 / 29

slide-33
SLIDE 33

How does HPC contributes to Constraint-Programming?

Distributed DFS

COSLING

Embarrassingly Parallel Search [Regin et. al.]

  • Static decomposition into consistent subproblems
  • Based on depth-bounded DFS
  • Communicate with master only when subproblem is solved
  • ≈ 40 subproblems per workers → balanced workload

Issue

  • Almost no communication cost but decomposition cost
  • State of the art over large number of cores

CP Introduction - COSLING - Teratec’17 24 / 29

slide-34
SLIDE 34

How does HPC contributes to Constraint-Programming?

EPS speedup

COSLING

CP Introduction - COSLING - Teratec’17 25 / 29

slide-35
SLIDE 35

How does HPC contributes to Constraint-Programming?

Distributed DFS

COSLING

Insight

  • Independent subproblems are efficiently solved in parallel
  • Automated decomposition may be costly/intricate

CP Introduction - COSLING - Teratec’17 26 / 29

slide-36
SLIDE 36

How does HPC contributes to Constraint-Programming?

Distributed DFS

COSLING

Insight

  • Independent subproblems are efficiently solved in parallel
  • Automated decomposition may be costly/intricate

Good news! It is often possible to decompose a problem

  • Stochastic optimization based on different scenarios
  • Optimization of different orders (logistics)
  • Routing optimization of different areas (transportation)
  • Frequent user request presolving (web-app)

CP Introduction - COSLING - Teratec’17 26 / 29

slide-37
SLIDE 37

How does HPC contributes to Constraint-Programming?

Conclusion

COSLING

HPC

  • Simple and affordable
  • Pushes forward the limits of Constraint Programming
  • Opens real-time application opportunities

CP Introduction - COSLING - Teratec’17 27 / 29

slide-38
SLIDE 38

How does HPC contributes to Constraint-Programming?

Thank you for your attention

COSLING

Contact

  • Jean-Guillaume FAGES, PhD
  • jg.fages@cosling.com
  • www.cosling.com
  • +33683311966

CP Introduction - COSLING - Teratec’17 28 / 29

slide-39
SLIDE 39

How does HPC contributes to Constraint-Programming?

References

COSLING

Main references

  • Handbook of Constraint Programming
  • J.-C. Regin, A Filtering Algorithm for Constraints of

Difference in CSPs

  • Global Constraint Catalogue:

http://sofdem.github.io/gccat/

  • A. Malapert, J-C. Regin, M. Rezgui: Embarrassingly

Parallel Search in Constraint Programming Journals & conferences

  • Artificial Intelligence, Constraints
  • CP, CPAIOR, AAAI, ECAI, JFPC

CP Introduction - COSLING - Teratec’17 29 / 29