+ All Categories
Home > Documents > Foundations of Constraint Processing CSCE421/821, Fall 2005:

Foundations of Constraint Processing CSCE421/821, Fall 2005:

Date post: 27-Jan-2016
Category:
Upload: tam
View: 28 times
Download: 2 times
Share this document with a friend
Description:
Local Search. Foundations of Constraint Processing CSCE421/821, Fall 2005: www.cse.unl.edu/~choueiry/F05-421-821/ Berthe Y. Choueiry (Shu-we-ri) Avery Hall, Room 123B [email protected] Tel: +1(402)472-5444. Lecture sources. Required reading Dechter: Chapter 7, Section 7.1 and 7.2 - PowerPoint PPT Presentation
28
November 2, 2005 Local Search for CSPs 1 Foundations of Constraint Processing, Fall 2005 Foundations of Constraint Processing CSCE421/821, Fall 2005: www.cse.unl.edu/~choueiry/F05-421-821/ Berthe Y. Choueiry (Shu-we-ri) Avery Hall, Room 123B [email protected] Tel: +1(402)472-5444 Local Search
Transcript
Page 1: Foundations of Constraint Processing CSCE421/821, Fall 2005:

November 2, 2005 Local Search for CSPs 1

Foundations of Constraint Processing, Fall 2005

Foundations of Constraint Processing

CSCE421/821, Fall 2005: www.cse.unl.edu/~choueiry/F05-421-821/

Berthe Y. Choueiry (Shu-we-ri)Avery Hall, Room [email protected]

Tel: +1(402)472-5444

Local Search

Page 2: Foundations of Constraint Processing CSCE421/821, Fall 2005:

November 2, 2005 Local Search for CSPs 2

Foundations of Constraint Processing, Fall 2005

Lecture sourcesRequired reading1. Dechter: Chapter 7, Section 7.1 and 7.2

Recommended1. R. Bartak’s online guide:

http://kti.ms.mff.cuni.cz/~bartak/constraints/stochastic.html

1. AIMA: Section 4.4 (1st edition) Section 4.3 (2nd edition)

1. Bresina 96: Heuristic-Biased Stochastic Sampling. AAAI/IAAI, Vol. 1 1996: 271-278

Page 3: Foundations of Constraint Processing CSCE421/821, Fall 2005:

November 2, 2005 Local Search for CSPs 3

Foundations of Constraint Processing, Fall 2005

Solving CSPs

CSPs are typically solved with a combination of:

1. Constraint propagation (inference)

2. Search (conditioning)• Backtrack search• Local search

We focus on local search

Page 4: Foundations of Constraint Processing CSCE421/821, Fall 2005:

November 2, 2005 Local Search for CSPs 4

Foundations of Constraint Processing, Fall 2005

Outline

• General principle

• Main types: greedy & stochastic

• When nothing works…

• Evaluation methods

Page 5: Foundations of Constraint Processing CSCE421/821, Fall 2005:

November 2, 2005 Local Search for CSPs 5

Foundations of Constraint Processing, Fall 2005

Backtrack search• Properties

– Systematic and exhaustive – Deterministic or heuristic

– Sound and complete • Shortcomings

– worst-case time complexity prohibitive– often unable to solve large problems. Thus, theoretical

soundness and completeness do not mean much in practice

• Idea – Use approximations: sacrifice soundness and/or completeness– Can quickly solve very large problems (that have many solutions)

Page 6: Foundations of Constraint Processing CSCE421/821, Fall 2005:

November 2, 2005 Local Search for CSPs 6

Foundations of Constraint Processing, Fall 2005

Local search: the picture• States are laid up on a surface• State quality/cost is its height• State space forms a landscape• Optimum state:

– maximizes solution quality– minimizes solution cost

• Move around from state to state and try to reach the optimum state

• Exploration restricted to neighboring states, thus ‘local’ search (ref. Holger & Hoos)

Page 7: Foundations of Constraint Processing CSCE421/821, Fall 2005:

November 2, 2005 Local Search for CSPs 7

Foundations of Constraint Processing, Fall 2005

Components of a local search• State

– is a complete assignment of values to variables, a possibly inconsistent solution

• Possible moves – are modifications to the current state, typically by changing the

value of a single variable. Thus, ‘local’ repair (ref. Dechter)– Examples:

• SAT: Flipping the value of a Boolean variable (GSAT),

• CSPs: Min-conflict heuristic (variations)

• Evaluation (cost) function – rates the quality of the possible moves, typically in the number of

violated constraints

Page 8: Foundations of Constraint Processing CSCE421/821, Fall 2005:

November 2, 2005 Local Search for CSPs 8

Foundations of Constraint Processing, Fall 2005

Generic mechanism• Cost function: number of broken constraints• General principle

– Start with a full but arbitrary assignment of values to variables– Reduce inconsistencies by local repairs (heuristic)– Repeat until

• A solution is found (global minimum)• The solution cannot be repaired (local minimum) • … You run out of patience (max-tries)

• A.k.a.– Iterative repair (decision problems)– Iterative improvement (optimization problems)

Page 9: Foundations of Constraint Processing CSCE421/821, Fall 2005:

November 2, 2005 Local Search for CSPs 9

Foundations of Constraint Processing, Fall 2005

Outline

• General principle

• Main types: greedy & stochastic

• When nothing works…

• Evaluation methods

Page 10: Foundations of Constraint Processing CSCE421/821, Fall 2005:

November 2, 2005 Local Search for CSPs 10

Foundations of Constraint Processing, Fall 2005

Main types of local search

1. Greedy:– Use a heuristic to determine the best move

2. Stochastic (improvement)– Sometimes (randomly) disobey the heuristic

Page 11: Foundations of Constraint Processing CSCE421/821, Fall 2005:

November 2, 2005 Local Search for CSPs 11

Foundations of Constraint Processing, Fall 2005

Greedy local search

• At any given point, – make the best decision you can given the

information you have and proceed. – Typically, move to the state that minimizes the

number of broken constraints

• Example: – hill climbing (a.k.a. gradient descent/ascent)

Page 12: Foundations of Constraint Processing CSCE421/821, Fall 2005:

November 2, 2005 Local Search for CSPs 12

Foundations of Constraint Processing, Fall 2005

Greedy local search• Problems:

– local optima (stuck), – plateau (errant), – ridge (oscillates from side to side, slow progress)

Page 13: Foundations of Constraint Processing CSCE421/821, Fall 2005:

November 2, 2005 Local Search for CSPs 13

Foundations of Constraint Processing, Fall 2005

Stochastic Local Search• Sometimes (randomly) move to a state that is

not the best: use randomization to escape local minimal

• Examples:• RandomWalk (stochastic noise)• Tabu SearchSimulated Annealing• Generic algorithms (see 476, Handout #7)Breakout method (constraint weighting)ERA (multi-agent search)

Page 14: Foundations of Constraint Processing CSCE421/821, Fall 2005:

November 2, 2005 Local Search for CSPs 14

Foundations of Constraint Processing, Fall 2005

Simulated Annealing: idea• Analogy to physics:

– Process of gradually cooling a liquid until it freezes– If temperature is lowered sufficiently slowly, material

will attain lowest-energy configuration (perfect order)

• Basic idea: – When stuck in a local optimum, allow few steps

towards less good neighbors to escape the local maximum

Page 15: Foundations of Constraint Processing CSCE421/821, Fall 2005:

November 2, 2005 Local Search for CSPs 15

Foundations of Constraint Processing, Fall 2005

Simulated Annealing: Mechanism

• Start from any state at random, start countdown and loop until time is over:– Pick up a neighbor at random– Set d = quality of neighbor – quality of current state– If d>0 (there is improvement)

• Then move to neighbor & restart countdown• Else, move to neighbor with a transition probability p<1

• Transition probability proportional to ed/t – d is negative, and t is time countdown– As times passes, less and less likely to make the move towards

unattractive neighbors

• Under some very restrictive assumptions, guaranteed to find optimum

Page 16: Foundations of Constraint Processing CSCE421/821, Fall 2005:

November 2, 2005 Local Search for CSPs 16

Foundations of Constraint Processing, Fall 2005

Properties• Non-systematic and non-exhaustive

• Liable to getting stuck in local optima (optima/minima)

• Non-deterministic: – outcome may depends on where you start

• Typically, heavy tailed: – probability of improving solution as time goes by quickly

becomes small but does not die out

Page 17: Foundations of Constraint Processing CSCE421/821, Fall 2005:

November 2, 2005 Local Search for CSPs 17

Foundations of Constraint Processing, Fall 2005

Breakout strategies [Bresina]

• Increase the weights of the broken constraints so that they are less likely to be broken in subsequent iterations

• Quite effective for recovering from local optima

Page 18: Foundations of Constraint Processing CSCE421/821, Fall 2005:

November 2, 2005 Local Search for CSPs 18

Foundations of Constraint Processing, Fall 2005

ERA: Environment, Rules, Agents [Liu et al, AIJ 02]

• Environment is an nxa board • Each variable is an agent • Each position on board is a value of a domain• Agent moves in a row on board• Each position records the number of violations

caused by the fact that agents are occupying other positions

• Agents try to occupy positions where no constraints are broken (zero position)

• Agents move according to reactive rules

Page 19: Foundations of Constraint Processing CSCE421/821, Fall 2005:

November 2, 2005 Local Search for CSPs 19

Foundations of Constraint Processing, Fall 2005

Reactive rules [Liu et al, AIJ 02]

Reactive rules:– Least-move: choose a position with the min. violation value

– Better-move: choose a position with a smaller violation value

– Random-move: randomly choose a positionCombinations of these basic rules form different behaviors.

R e a ct iv e ru le s B e h a v io rde s ig n e r

LR le a s t-m o v e with 1 -p and ra n d o m -m o v e with p

BR b e tte r -m o v e with 1 -p and ra n d o m -m o v e with p

BLR f i r s t b e tte r -m o v e , i f f ai l the n apply LR

rBLR f i r s t apply b e tte r -m o v e r t im e s , i f f ai l the n apply LR

F rBLR apply rBLR in the f i r s t r i te r at io ns , the n apply LR

Page 20: Foundations of Constraint Processing CSCE421/821, Fall 2005:

November 2, 2005 Local Search for CSPs 20

Foundations of Constraint Processing, Fall 2005

Big picture

• Agents do not communicate but share a common context

• Agents keep kicking each other out of their comfortable positions until every one is happy

• Charecterization: [Hui Zou, 2003]

– Amazingly effective in solving very tight but solvable instances

– Unstable in over-constrained cases• Agents keep kicking each other out (livelock)• Livelocks may be exploited to identify bottlenecks

Page 21: Foundations of Constraint Processing CSCE421/821, Fall 2005:

November 2, 2005 Local Search for CSPs 21

Foundations of Constraint Processing, Fall 2005

ERA performance

10

15

20

25

30

35

40

45

1 20 39 58 77 96 115 134 153 172 191

iteration

# a

ge

nts

in

ze

ro p

os

itio

n

Spring 2001b (O)

Fall 2002 (O)

ERA performance on solvable instances

ERA performance on unsolvable instances

Observation:

Solvable vs. unsolvable instances: • stable on solvable instances • oscillates on unsolvable cases

15

20

25

30

35

40

45

50

55

60

65

70

1 20 39 58 77 96 115 134 153 172 191

iteration

# a

ge

nts

in

ze

ro p

os

itio

n

Spring 2001b (B)

Fall 2002 (B)

Fall 2001b

Spring 2003

Page 22: Foundations of Constraint Processing CSCE421/821, Fall 2005:

November 2, 2005 Local Search for CSPs 22

Foundations of Constraint Processing, Fall 2005

Agent’s movement

0

20

40

1 51 101 151 201 251 301 351 401 451

0

10

20

30

1 51 101 151 201 251 301 351 401 451

0

10

20

1 51 101 151 201 251 301 351 401 451

va ria ble

s ta ble

c o ns ta nt

ind

ex

of

po

sit

ion

iteration

Motion of agents• variable• stable• constant

Observations:

Solvable Unsolvable

Variable None Most

Stable A few A few

Constant Most None

Page 23: Foundations of Constraint Processing CSCE421/821, Fall 2005:

November 2, 2005 Local Search for CSPs 23

Foundations of Constraint Processing, Fall 2005

Outline

• General principle

• Main types: greedy & stochastic

• When nothing works…

• Evaluation methods

Page 24: Foundations of Constraint Processing CSCE421/821, Fall 2005:

November 2, 2005 Local Search for CSPs 24

Foundations of Constraint Processing, Fall 2005

Random restart• Principle

– When no progress is made, restart from a new randomly selected state

– Save best results found so far (anytime algorithm)

• Repeat random restart– For a fixed number of iterations– Until best results have not been improved by for a

certain number of iterations. E.g., Geometric law

Page 25: Foundations of Constraint Processing CSCE421/821, Fall 2005:

November 2, 2005 Local Search for CSPs 25

Foundations of Constraint Processing, Fall 2005

Outline

• General principle

• Main types: greedy & stochastic

• When nothing works…

• Evaluation methods

Page 26: Foundations of Constraint Processing CSCE421/821, Fall 2005:

November 2, 2005 Local Search for CSPs 26

Foundations of Constraint Processing, Fall 2005

Evaluation: empirical• Test on

– a given problem instance

– an ensemble of problem instances (representative of a population)

• Experiment– Run the algorithm thousands of times– Measure some metric as a random variable

(e.g., the time needed to find a solution)

Page 27: Foundations of Constraint Processing CSCE421/821, Fall 2005:

November 2, 2005 Local Search for CSPs 27

Foundations of Constraint Processing, Fall 2005

Comparing techniques

• Provide– The probability distribution function (approximated by

the number of runs that took a given time to find a solution)

– The cumulative distribution function (approximated by the number of runs that found a solution within a given time)

Page 28: Foundations of Constraint Processing CSCE421/821, Fall 2005:

November 2, 2005 Local Search for CSPs 28

Foundations of Constraint Processing, Fall 2005

Comparing techniques• Compare algorithms’ performance using

statistical tests (for confidence levels)– t-test: assumes normal distribution of the measured metrics– Nonparametric tests do not. Some match pairs, some do not.

• Consult/work with a statistician

Cumulative Distribution

curves

.00%

20.00%

40.00%

60.00%

80.00%

100.00%

0 2 4 6 8 10 12

CPU time

Cu

mu

lati

ve f

req

uen

cy

Method1

Method2

Comparing distributions

0

100

200

300

400

500

600

700

800

900

1000

-1 1 3 5 7 9 11 13

CPU time

Fre

qu

ency Method1

Method2


Recommended