Global Constraints and Constraint Programming Michael Maher Loyola University Chicago.

21
Global Constraints and Constraint Programming Michael Maher Loyola University Chicago

Transcript of Global Constraints and Constraint Programming Michael Maher Loyola University Chicago.

Global Constraints and Constraint Programming

Michael Maher

Loyola University Chicago

Constraint Personalities

Type A

aggressive, time-sensitive

Type B

relaxed, deliberate

There are two kinds of constraints:

Type A Constraints

Composition of constraints is totally understood by a constraint solver Intervals in Solver, CHIP, … Domains in CSP Linear inequalities in CLP(R) Term equations in Prolog Linear inequalities in Math Prog

These constraints can be solved algorithmically (at low cost).

Constraint Solver

Constraint store holding all active Type A constraints.

On-line algorithms for deciding consistency, implication, …

Constraint store changes by addition/undo/deletion of constraints.

Type B Constraints

Composition of constraints is at best partly understood Global constraints Arithmetic constraints in Solver,

CHIP, … Constraints in CSP Integrality in Math Prog

These are the reason we do search.

In FD solvers, arithmetic inequalities are Type B constraints.

From x + y ≤ z, z ≤ y + 2 the system does not understand x ≤ 2.

Intervals are Type A constraints.

From x :: 1..5 and x :: 3..7 the system understands x :: 3..5.

Type B constraints are implemented as propagators of Type A constraints

x :: 1..3, y :: 2..6 x + y ≤ z

z ≤ y + 2 z :: 3..z :: 3..8

Global Constraints

Collections of many small constraints that are treated as a unit alldifferent cumulative cycle etc

Not global !

Global Constraints

Implementations of global constraints are encapsulations of on-line algorithms alldifferent cumulative cycle etc

Often (?) the implementations are based on CO techniques.

Constraint Programming is a software architecture that supports the combination of CO algorithms to solve problems.

Arc Consistency

Ideally, an implementation will propagate all information expressible with Type A constraints that is a consequence of the Type B constraint.

If B & c → c’ then c → c’

This is a general form of arc consistency.

Arc Consistency

The definition covers many existing definitions:

Arc consistency in CSP Interval consistency in FD Echidna consistency Hull consistency Rule consistency

Arc Consistency

Existing forms of arc consistency only admit unary Type A constraints. They are all weakenings of arc consistency in CSP.

We can also use other Type A constraints (like ordering x ≤ y) to get different, not weaker, consistencies.

Minimum

min(x, y, z)

For AC we need the following propagations, among others:

min(x, y, z) → z ≤ x, z ≤ y x ≤ y, min(x, y, z) → z = x u ≤ x, u ≤ y, min(x, y, z) → u ≤ z

Implementing non-unary AC is hard.

Improve on AC

Stronger consistency conditions

Improve on AC

Stronger consistency conditions

Weaker consistency conditions

Improve on AC

Stronger consistency conditionsconsider more than one global constraint at a time

Weaker consistency conditions

Improve on AC

Stronger consistency conditionsconsider more than one global constraint at a time

Weaker consistency conditionsavoid or delay complete propagation

Exercises for COs

Define and implement new global constraints

Define and implement constraint solver for new class of constraints

Introduce us to the Dark Arts

Exercises for BRs

Formulate and implement BR in a conjunctive constraint context

Extend BR to situations where tests for consistency are not complete.