Constraint Programming 2001 Edition

20
08/09/22 1 Constraint Programming 2001 Edition Jan Maluszynski and Ulf Nilsson TCSLAB, LiU {janma, ulfni}@ida.liu.se http://www.ida.liu.se/ ~ulfni/cp2001

description

Constraint Programming 2001 Edition. Jan Maluszynski and Ulf Nilsson TCSLAB, LiU {janma, ulfni}@ida.liu.se http://www.ida.liu.se/~ulfni/cp2001. Course organization. Course organization (cont’d). Course organization (cont). - PowerPoint PPT Presentation

Transcript of Constraint Programming 2001 Edition

Page 1: Constraint Programming  2001 Edition

04/19/23 1

Constraint Programming 2001 Edition

Jan Maluszynski and Ulf NilssonTCSLAB, LiU

{janma, ulfni}@ida.liu.se

http://www.ida.liu.se/~ulfni/cp2001

Page 2: Constraint Programming  2001 Edition

04/19/23 2

Course organization

Date Content Lect11 Sep Organization, motivation, limitations, etc. UN18 Sep Basics (Ch 1+2) JM25 Sep Finite domain constraints (Ch 3) JM2 Oct Logic programming (optional) (Ch 4) UN9 Oct Modelling with FD-constraints (Ch 5, 8) UN16 Oct Interval constraints JM23 Oct Available systems PP

Page 3: Constraint Programming  2001 Edition

04/19/23 3

Course organization (cont’d)

Date Content Lect30 Oct Constraints for system design KK6 Nov Constraint Handling Rules ??13 Nov Survey of HAL ??20 Nov Reserve --27 Nov Solutions to exercises --

Page 4: Constraint Programming  2001 Edition

04/19/23 4

Course organization (cont)

Obligatory course assignments (23 Oct) with deadline 20 Nov, and examination 27 Nov

Course credit points 4Literature:

K. Marriott and P. StuckeyProgramming with Constraints: An IntroductionMIT Press, 1998.+ handouts and on-line manuals

Page 5: Constraint Programming  2001 Edition

04/19/23 5

A simple definition

Constraint programming is the study of computational systems based on constraints.

Constraints are roughly systems of equations, inequations and disequations over some algebraic structure.

The idea of constraint programming is to solve problems by encoding the problem as a set of constraints and exploring solutions to the constraints.

Page 6: Constraint Programming  2001 Edition

04/19/23 6

Typical problem

Processes A-D may start at times 1,2,3,4,5,6,7

Process A uses 3 resources during 2secProcess B uses 1 resource during 4secProcess C uses 2 resources during 1secProcess D uses 2 resources during 1secThere are 4 resourcesProcess A must finish before C can startWhen are A, B, C, D earliest finished?

Page 7: Constraint Programming  2001 Edition

04/19/23 7

Overview

Constraints, basics, operations, domains Focus on finite domains, intervals

Constraint logic programmingModeling and applicationsSystems

CLP-systems Systems for defining constraints CHR,

HAL

Page 8: Constraint Programming  2001 Edition

04/19/23 8

Constraints

A constraint problem consists of a set of problem variables ranging over some domain and a set of constraints restricting the values that may be assigned to the variables.

Example:x in {1,2,3}, y in {2,3,4,5}, 2x = y

Examples of domains:Reals/rationals, intervals, finite domains, Booleans, sets, monoids (strings) etc

Page 9: Constraint Programming  2001 Edition

04/19/23 9

Methods for constraint solving

Reals/rational constraints Gauss-Jordan elimination + Simplex

Real/Rational intervals interval narrowing, box consistency, Gauss-Seidel elimination, interval Newton method,

Booleans for example, operations on BDD’s

Finite domains arc, node and path consistency methods constraint propagation (forward checking, look-ahead)

Page 10: Constraint Programming  2001 Edition

04/19/23 10

Optimization

Finding a solution which satisfies constraints and minimizes/maximizes objective function

Different types combinatorial optimization of discrete

(finite domain) variables linear optimization for continuous

variables

Page 11: Constraint Programming  2001 Edition

04/19/23 11

Different constraint systems

Real/rational constraints: CLP(R), CLP(Q)CLP(R), Sicstus Prolog, CHIP

Finite domains constraints: CLP(FD)Sicstus Prolog, CHIP

Boolean constraints: CLP(B)Sicstus Prolog, CHIP

Interval constraints: CLP(I)CLP(BNR), Numerica, Prolog IV

Page 12: Constraint Programming  2001 Edition

04/19/23 12

Systems discussed in the course

SICStus PrologChip 5.2Prolog IVCHRHAL

Page 13: Constraint Programming  2001 Edition

04/19/23 13

The programming paradigm

CLP

Logic programming

Optimization

Constraint satisfaction/solvin

g

Page 14: Constraint Programming  2001 Edition

04/19/23 14

Logic programming

Logic (relations) for problem description

Declarative description style (problem

description separated from its solving)

Unification (a kind of constraint solving)

Builtin search

Constraint programming does not need LP

!!!

Page 15: Constraint Programming  2001 Edition

04/19/23 15

Some applications

Spatial and temporal problemsPlacment and layoutManpower planningSchedulingResource allocationConfiguration managementVerification (e.g. correctness,

safety+liveness)

Page 16: Constraint Programming  2001 Edition

04/19/23 16

Placement/Layout

A window contains a number of widgets. As the window is shrinking or growing the widgets have to be repositioned while satisfying certain constraints (e.g. certain widgets must always be visible or must be in a certain relation to other widgets). Given a certain window size, produce a layout that satisfies the constraints.

Page 17: Constraint Programming  2001 Edition

04/19/23 17

Scheduling

A conference consists of 11 sessions of equal length. The program is to be organized as a sequence of slots,where a slot contains up to 3 parallel sessions:1. Session 4 must take place before Session 11.2. Session 5 must take place before Session 10.3. Session 6 must take place before Session 11.

…8. Session 6 must not be in parallel with 7 and 10.9. Session 7 must not be in parallel with 8 and 9.10. Session 8 must not be in parallel with 10.Minimize the number of slots.

Page 18: Constraint Programming  2001 Edition

04/19/23 18

Job shop scheduling

There are n jobs and m machines. Each job requires execution of a sequence of operations within a time interval, and each operation Oi requires exclusive use of a designated machine Mi for a specied amount of processing time pi. Determine a schedule for production that satisfies the temporal and resource capacity constraints.

Page 19: Constraint Programming  2001 Edition

04/19/23 19

Manpower planning

Airport Counter Allocation problem: Allocate enough counters and staff (the number depends on the aircraft type) to each flight. The counters are grouped in islands and for each flight all assigned counters have to be in the same island. The staff has working regulations that must be satisfied (breaks etc).

Page 20: Constraint Programming  2001 Edition

04/19/23 20

Black-box vs Glass-box solvers

Most systems rely on non-extensible, black-box constraint solvers Efficiency unpredictable Hard to debug

Some systems facilitate defining new constraints and solvers (glass-box approach) Improved control of propagation and search Examples CHR, HAL, ...

Then again, most problems are NP-complete...