82
Ant Colony Optimization for Constraint Satisfaction Christine Solnon LIRIS, UMR 5205 CNRS / University of Lyon Tutorial at CP’2007

Ant Colony Optimization for Constraint Satisfaction · Ant Colony Optimization Application to car sequencing Application to CSPs Conclusion The MAX −MIN Ant System initialize pheromone

  • Upload
    others

  • View
    16

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Ant Colony Optimization for Constraint Satisfaction · Ant Colony Optimization Application to car sequencing Application to CSPs Conclusion The MAX −MIN Ant System initialize pheromone

Ant Colony Optimizationfor Constraint Satisfaction

Christine Solnon

LIRIS, UMR 5205 CNRS / University of Lyon

Tutorial at CP’2007

Page 2: Ant Colony Optimization for Constraint Satisfaction · Ant Colony Optimization Application to car sequencing Application to CSPs Conclusion The MAX −MIN Ant System initialize pheromone

Ant Colony Optimization Application to car sequencing Application to CSPs Conclusion

Table of contents

1 Basic principles of Ant Colony Optimization

2 Application to the car sequencing problem

3 Application to binary CSPs

4 Conclusion

Page 3: Ant Colony Optimization for Constraint Satisfaction · Ant Colony Optimization Application to car sequencing Application to CSPs Conclusion The MAX −MIN Ant System initialize pheromone

Ant Colony Optimization Application to car sequencing Application to CSPs Conclusion

A metaheuristic inspired by real ants

Foraging behavior of real antsSimple and autonomous agents

+ Indirect communication via the environment (stigmergy)Ants lay pheromone trails while walkingAnts randomly choose paths w.r.t. phero. trailsPheromone trails evaporate

⇒ Shortest path between the nest and a food source

Collective problem solving / swarm intelligence

Page 4: Ant Colony Optimization for Constraint Satisfaction · Ant Colony Optimization Application to car sequencing Application to CSPs Conclusion The MAX −MIN Ant System initialize pheromone

Ant Colony Optimization Application to car sequencing Application to CSPs Conclusion

Brief history of ACO

Ant System[Dorigo 92]: application to the Travelling Salesman Problem

Extensions of Ant SystemAnt Colony System [Dorigo & Gambardella 97],MAX −MIN Ant System [Stutzle & Hoos 00],Hyper-cube Ant System [Blum, Roli & Dorigo 01], ...

Many applicationsVehicle routing, Sequential ordering, Quadratic assignment,Graph coloring, Open shop, Maximum clique, ...

GeneralizationAnt Colony Optimization (ACO) metaheuristic

Page 5: Ant Colony Optimization for Constraint Satisfaction · Ant Colony Optimization Application to car sequencing Application to CSPs Conclusion The MAX −MIN Ant System initialize pheromone

Ant Colony Optimization Application to car sequencing Application to CSPs Conclusion

How to solve a problem with ACO ?

1) Define a construction graph

Solution components vertices or edges

Solution best path in the graph

2) Use artificial ants to search for good paths

Behavior inspired by real ants...Ants lay pheromone on vertices and/or edgesGreedy randomized construction of paths w.r.t. pheromonePheromone evaporates

...with extra capabilitiesPheromone laying is delayed and proportional to solution quality,Pheromone is combined with problem-dependent heuristics,Hybridation with local search, ...

Page 6: Ant Colony Optimization for Constraint Satisfaction · Ant Colony Optimization Application to car sequencing Application to CSPs Conclusion The MAX −MIN Ant System initialize pheromone

Ant Colony Optimization Application to car sequencing Application to CSPs Conclusion

The MAX −MIN Ant System

initialize pheromone trails to τmax

repeat1 each ant builds a path2 update pheromone trails

until optimal solution found or stagnation

Greedy randomized construction of a path

Let C = visited vertices and cand = candidate verticesChoose vj ∈ cand with probability

p(vj) =[τC(vj )]

α.[ηC(vj )]βP

vk∈cand [τC(vk )]α.[ηC(vk )]β

τC(vj) pheromone factor (past experience of the colony)ηC(vj) heuristic factor (problem-dependent)α, β factor weights (parameters)

Pheromone updating step

Evaporation: multiply pheromone trails by (1− ρ) ρ = evaporation rate (0 ≤ ρ ≤ 1)Reward: add pheromone on the best path componentsBound pheromone trails between τmin and τmax prevent from premature stagnation

Page 7: Ant Colony Optimization for Constraint Satisfaction · Ant Colony Optimization Application to car sequencing Application to CSPs Conclusion The MAX −MIN Ant System initialize pheromone

Ant Colony Optimization Application to car sequencing Application to CSPs Conclusion

The MAX −MIN Ant System

initialize pheromone trails to τmax

repeat1 each ant builds a path2 update pheromone trails

until optimal solution found or stagnation

Greedy randomized construction of a path

Let C = visited vertices and cand = candidate verticesChoose vj ∈ cand with probability

p(vj) =[τC(vj )]

α.[ηC(vj )]βP

vk∈cand [τC(vk )]α.[ηC(vk )]β

τC(vj) pheromone factor (past experience of the colony)ηC(vj) heuristic factor (problem-dependent)α, β factor weights (parameters)

Pheromone updating step

Evaporation: multiply pheromone trails by (1− ρ) ρ = evaporation rate (0 ≤ ρ ≤ 1)Reward: add pheromone on the best path componentsBound pheromone trails between τmin and τmax prevent from premature stagnation

Page 8: Ant Colony Optimization for Constraint Satisfaction · Ant Colony Optimization Application to car sequencing Application to CSPs Conclusion The MAX −MIN Ant System initialize pheromone

Ant Colony Optimization Application to car sequencing Application to CSPs Conclusion

The MAX −MIN Ant System

initialize pheromone trails to τmax

repeat1 each ant builds a path2 update pheromone trails

until optimal solution found or stagnation

Greedy randomized construction of a path

Let C = visited vertices and cand = candidate verticesChoose vj ∈ cand with probability

p(vj) =[τC(vj )]

α.[ηC(vj )]βP

vk∈cand [τC(vk )]α.[ηC(vk )]β

τC(vj) pheromone factor (past experience of the colony)

ηC(vj) heuristic factor (problem-dependent)α, β factor weights (parameters)

Pheromone updating step

Evaporation: multiply pheromone trails by (1− ρ) ρ = evaporation rate (0 ≤ ρ ≤ 1)Reward: add pheromone on the best path componentsBound pheromone trails between τmin and τmax prevent from premature stagnation

Page 9: Ant Colony Optimization for Constraint Satisfaction · Ant Colony Optimization Application to car sequencing Application to CSPs Conclusion The MAX −MIN Ant System initialize pheromone

Ant Colony Optimization Application to car sequencing Application to CSPs Conclusion

The MAX −MIN Ant System

initialize pheromone trails to τmax

repeat1 each ant builds a path2 update pheromone trails

until optimal solution found or stagnation

Greedy randomized construction of a path

Let C = visited vertices and cand = candidate verticesChoose vj ∈ cand with probability

p(vj) =[τC(vj )]

α.[ηC(vj )]βP

vk∈cand [τC(vk )]α.[ηC(vk )]β

τC(vj) pheromone factor (past experience of the colony)

ηC(vj) heuristic factor (problem-dependent)

α, β factor weights (parameters)

Pheromone updating step

Evaporation: multiply pheromone trails by (1− ρ) ρ = evaporation rate (0 ≤ ρ ≤ 1)Reward: add pheromone on the best path componentsBound pheromone trails between τmin and τmax prevent from premature stagnation

Page 10: Ant Colony Optimization for Constraint Satisfaction · Ant Colony Optimization Application to car sequencing Application to CSPs Conclusion The MAX −MIN Ant System initialize pheromone

Ant Colony Optimization Application to car sequencing Application to CSPs Conclusion

The MAX −MIN Ant System

initialize pheromone trails to τmax

repeat1 each ant builds a path2 update pheromone trails

until optimal solution found or stagnation

Greedy randomized construction of a path

Let C = visited vertices and cand = candidate verticesChoose vj ∈ cand with probability

p(vj) =[τC(vj )]

α.[ηC(vj )]βP

vk∈cand [τC(vk )]α.[ηC(vk )]β

τC(vj) pheromone factor (past experience of the colony)ηC(vj) heuristic factor (problem-dependent)

α, β factor weights (parameters)

Pheromone updating step

Evaporation: multiply pheromone trails by (1− ρ) ρ = evaporation rate (0 ≤ ρ ≤ 1)Reward: add pheromone on the best path componentsBound pheromone trails between τmin and τmax prevent from premature stagnation

Page 11: Ant Colony Optimization for Constraint Satisfaction · Ant Colony Optimization Application to car sequencing Application to CSPs Conclusion The MAX −MIN Ant System initialize pheromone

Ant Colony Optimization Application to car sequencing Application to CSPs Conclusion

The MAX −MIN Ant System

initialize pheromone trails to τmax

repeat1 each ant builds a path2 update pheromone trails

until optimal solution found or stagnation

Greedy randomized construction of a path

Let C = visited vertices and cand = candidate verticesChoose vj ∈ cand with probability

p(vj) =[τC(vj )]

α.[ηC(vj )]βP

vk∈cand [τC(vk )]α.[ηC(vk )]β

τC(vj) pheromone factor (past experience of the colony)ηC(vj) heuristic factor (problem-dependent)α, β factor weights (parameters)

Pheromone updating step

Evaporation: multiply pheromone trails by (1− ρ) ρ = evaporation rate (0 ≤ ρ ≤ 1)Reward: add pheromone on the best path componentsBound pheromone trails between τmin and τmax prevent from premature stagnation

Page 12: Ant Colony Optimization for Constraint Satisfaction · Ant Colony Optimization Application to car sequencing Application to CSPs Conclusion The MAX −MIN Ant System initialize pheromone

Ant Colony Optimization Application to car sequencing Application to CSPs Conclusion

Example: Travelling Salesman Problem

Construction graphComplete graph that associates a vertex with each cityPheromone is laid on edges:τ(i , j) desirability of visiting j just after i

At each cycle, each ant builds an hamiltonian cycleRandom choice of the first vertexProbability to go to j for an ant that is on vertex i :

p(j) =[τ(i , j)]α.[1/d(i , j)]β∑

k∈cand [τ(i , k)]α.[1/d(i , k)]β

where cand = set of non visited vertices

Pheromone updating stepEvaporationAdd pheromone on the edges of the best cycleQuantity proportionally inverse to the length of the cycle

Page 13: Ant Colony Optimization for Constraint Satisfaction · Ant Colony Optimization Application to car sequencing Application to CSPs Conclusion The MAX −MIN Ant System initialize pheromone

Ant Colony Optimization Application to car sequencing Application to CSPs Conclusion

Example: Travelling Salesman Problem

Construction graphComplete graph that associates a vertex with each cityPheromone is laid on edges:τ(i , j) desirability of visiting j just after i

At each cycle, each ant builds an hamiltonian cycleRandom choice of the first vertexProbability to go to j for an ant that is on vertex i :

p(j) =[τ(i , j)]α.[1/d(i , j)]β∑

k∈cand [τ(i , k)]α.[1/d(i , k)]β

where cand = set of non visited vertices

Pheromone updating stepEvaporationAdd pheromone on the edges of the best cycleQuantity proportionally inverse to the length of the cycle

Page 14: Ant Colony Optimization for Constraint Satisfaction · Ant Colony Optimization Application to car sequencing Application to CSPs Conclusion The MAX −MIN Ant System initialize pheromone

Ant Colony Optimization Application to car sequencing Application to CSPs Conclusion

Example: Travelling Salesman Problem

Construction graphComplete graph that associates a vertex with each cityPheromone is laid on edges:τ(i , j) desirability of visiting j just after i

At each cycle, each ant builds an hamiltonian cycleRandom choice of the first vertexProbability to go to j for an ant that is on vertex i :

p(j) =[τ(i , j)]α.[1/d(i , j)]β∑

k∈cand [τ(i , k)]α.[1/d(i , k)]β

where cand = set of non visited vertices

Pheromone updating stepEvaporationAdd pheromone on the edges of the best cycleQuantity proportionally inverse to the length of the cycle

Page 15: Ant Colony Optimization for Constraint Satisfaction · Ant Colony Optimization Application to car sequencing Application to CSPs Conclusion The MAX −MIN Ant System initialize pheromone

Ant Colony Optimization Application to car sequencing Application to CSPs Conclusion

ACO w.r.t. other (meta)heuristic approaches

Instance-based approaches

Construction of new solutions by modifying existing ones

Genetic algorithms: cross-over + mutationLocal search: local moves

Model-based approaches

Construction of new solutions using a probabilistic model

Greedy randomized construction: static modelGreedy Randomized Adaptive Search Procedure (GRASP): adaptive modelAnt Colony Optimization (ACO): model biased by previous experienceEstimation of Distribution Algorithms (EDA): model built from a population which evolves

Page 16: Ant Colony Optimization for Constraint Satisfaction · Ant Colony Optimization Application to car sequencing Application to CSPs Conclusion The MAX −MIN Ant System initialize pheromone

Ant Colony Optimization Application to car sequencing Application to CSPs Conclusion

ACO w.r.t. other (meta)heuristic approaches

Instance-based approaches

Construction of new solutions by modifying existing ones

Genetic algorithms: cross-over + mutationLocal search: local moves

Model-based approaches

Construction of new solutions using a probabilistic model

Greedy randomized construction: static modelGreedy Randomized Adaptive Search Procedure (GRASP): adaptive modelAnt Colony Optimization (ACO): model biased by previous experienceEstimation of Distribution Algorithms (EDA): model built from a population which evolves

Page 17: Ant Colony Optimization for Constraint Satisfaction · Ant Colony Optimization Application to car sequencing Application to CSPs Conclusion The MAX −MIN Ant System initialize pheromone

Ant Colony Optimization Application to car sequencing Application to CSPs Conclusion

Hybridization ACO / Local Search

Two views of an ACO/LS hybrid approachAnts build initial solutions...

... that are improved by local search;or LS finds locally optimal solutions...

... that are used by ACO to build new starting points.

Choice of a local search strategyCompromise between CPU time and solution qualityUsually: simple greedy LS

Page 18: Ant Colony Optimization for Constraint Satisfaction · Ant Colony Optimization Application to car sequencing Application to CSPs Conclusion The MAX −MIN Ant System initialize pheromone

Ant Colony Optimization Application to car sequencing Application to CSPs Conclusion

Intensifying/diversifying search with ACO

Intensification

Goal: Increase search around promising areasMeans:

Add pheromone on components of best solutionsFavor the choice of components with high pheromone trails

Risk: Premature convergence (stagnation)

Diversification

Goal: Explore new areasMeans:

Probabilistic choice of componentsBound pheromone trails within [τmin, τmax ]Initialize pheromone trails to τmax

Risk: convergence to optimality may be too long

⇒ Theoretical proof of convergence to optimality

Page 19: Ant Colony Optimization for Constraint Satisfaction · Ant Colony Optimization Application to car sequencing Application to CSPs Conclusion The MAX −MIN Ant System initialize pheromone

Ant Colony Optimization Application to car sequencing Application to CSPs Conclusion

Influence of ACO parameters onintensification/diversification

τmin, τmax : pheromone lower and upper bounds Intensification increases when τmax − τmin increases

nbAnts : number of ants Diversification increases when nbAnts increases

α : weight of the pheromone factor Intensification increases when α increases

ρ : pheromone evaporation rate Intensification increases when ρ increases

The best parameter setting depends on available time !

Page 20: Ant Colony Optimization for Constraint Satisfaction · Ant Colony Optimization Application to car sequencing Application to CSPs Conclusion The MAX −MIN Ant System initialize pheromone

Ant Colony Optimization Application to car sequencing Application to CSPs Conclusion

Illustration on a maximum clique problem

44

46

48

50

52

54

56

0 500 1000 1500 2000 2500

Taill

e d

e la

meill

eure

cliq

ue tro

uve

e (

moye

nne s

ur

50 e

xecu

tions)

Nombre de cycles (30 fourmis par cycles)

alpha=0

Without pheromone: α = 0

Page 21: Ant Colony Optimization for Constraint Satisfaction · Ant Colony Optimization Application to car sequencing Application to CSPs Conclusion The MAX −MIN Ant System initialize pheromone

Ant Colony Optimization Application to car sequencing Application to CSPs Conclusion

Illustration on a maximum clique problem

44

46

48

50

52

54

56

0 500 1000 1500 2000 2500

Taill

e d

e la

meill

eure

cliq

ue tro

uve

e (

moye

nne s

ur

50 e

xecu

tions)

Nombre de cycles (30 fourmis par cycles)

alpha=0alpha=1 rho=0.005

With a small influence of pheromone: α = 1, ρ = 0.5%

Page 22: Ant Colony Optimization for Constraint Satisfaction · Ant Colony Optimization Application to car sequencing Application to CSPs Conclusion The MAX −MIN Ant System initialize pheromone

Ant Colony Optimization Application to car sequencing Application to CSPs Conclusion

Illustration on a maximum clique problem

44

46

48

50

52

54

56

0 500 1000 1500 2000 2500

Taill

e d

e la

meill

eure

cliq

ue tro

uve

e (

moye

nne s

ur

50 e

xecu

tions)

Nombre de cycles (30 fourmis par cycles)

alpha=0alpha=1 rho=0.005alpha=1 rho=0.010

When increasing the evaporation rate ρ from 0.5% to 1%

Page 23: Ant Colony Optimization for Constraint Satisfaction · Ant Colony Optimization Application to car sequencing Application to CSPs Conclusion The MAX −MIN Ant System initialize pheromone

Ant Colony Optimization Application to car sequencing Application to CSPs Conclusion

Illustration on a maximum clique problem

44

46

48

50

52

54

56

0 500 1000 1500 2000 2500

Taill

e d

e la

meill

eure

cliq

ue tro

uve

e (

moye

nne s

ur

50 e

xecu

tions)

Nombre de cycles (30 fourmis par cycles)

alpha=0alpha=1 rho=0.005alpha=1 rho=0.010alpha=2 rho=0.010

When increasing the pheromone factor weight α from 1 to 2

Page 24: Ant Colony Optimization for Constraint Satisfaction · Ant Colony Optimization Application to car sequencing Application to CSPs Conclusion The MAX −MIN Ant System initialize pheromone

Ant Colony Optimization Application to car sequencing Application to CSPs Conclusion

Illustration on a maximum clique problem

44

46

48

50

52

54

56

0 500 1000 1500 2000 2500

Taill

e d

e la

meill

eure

cliq

ue tro

uve

e (

moye

nne s

ur

50 e

xecu

tions)

Nombre de cycles (30 fourmis par cycles)

alpha=0alpha=1 rho=0.005alpha=1 rho=0.010alpha=2 rho=0.010alpha=2 rho=0.020

When increasing the evaporation rate ρ from 1% to 2%

Page 25: Ant Colony Optimization for Constraint Satisfaction · Ant Colony Optimization Application to car sequencing Application to CSPs Conclusion The MAX −MIN Ant System initialize pheromone

Ant Colony Optimization Application to car sequencing Application to CSPs Conclusion

Measuring Intensification/Diversification

Resampling ratio (RR) quantifies diversification

RR =#{computed solutions} - #{different computed solutions}

#{computed solutions}Maximal diversification ⇐ 0 ≤ RR ≤ 1 ⇒ Stagnation

Similarity ratio (SR) quantifies intensification

SR = average similarity of the set S of computed solutions average similarity of pairs of solutions of S similarity of 2 solutions = percentage of shared components

SR increases when search is intensified

These 2 ratio may be computed (nearly) for free with appropriate datastructures !

Page 26: Ant Colony Optimization for Constraint Satisfaction · Ant Colony Optimization Application to car sequencing Application to CSPs Conclusion The MAX −MIN Ant System initialize pheromone

Ant Colony Optimization Application to car sequencing Application to CSPs Conclusion

Measuring Intensification/Diversification

Resampling ratio (RR) quantifies diversification

RR =#{computed solutions} - #{different computed solutions}

#{computed solutions}Maximal diversification ⇐ 0 ≤ RR ≤ 1 ⇒ Stagnation

Similarity ratio (SR) quantifies intensification

SR = average similarity of the set S of computed solutions average similarity of pairs of solutions of S similarity of 2 solutions = percentage of shared components

SR increases when search is intensified

These 2 ratio may be computed (nearly) for free with appropriate datastructures !

Page 27: Ant Colony Optimization for Constraint Satisfaction · Ant Colony Optimization Application to car sequencing Application to CSPs Conclusion The MAX −MIN Ant System initialize pheromone

Ant Colony Optimization Application to car sequencing Application to CSPs Conclusion

Measuring Intensification/Diversification

Resampling ratio (RR) quantifies diversification

RR =#{computed solutions} - #{different computed solutions}

#{computed solutions}Maximal diversification ⇐ 0 ≤ RR ≤ 1 ⇒ Stagnation

Similarity ratio (SR) quantifies intensification

SR = average similarity of the set S of computed solutions average similarity of pairs of solutions of S similarity of 2 solutions = percentage of shared components

SR increases when search is intensified

These 2 ratio may be computed (nearly) for free with appropriate datastructures !

Page 28: Ant Colony Optimization for Constraint Satisfaction · Ant Colony Optimization Application to car sequencing Application to CSPs Conclusion The MAX −MIN Ant System initialize pheromone

Ant Colony Optimization Application to car sequencing Application to CSPs Conclusion

Measuring intensification/Diversification: Example

Resampling ratio

Number of cycles: 500 1000 1500 2000 2500α = 1, ρ = 0.01 0.00 0.00 0.00 0.00 0.00α = 2, ρ = 0.01 0.00 0.04 0.06 0.07 0.07α = 2, ρ = 0.02 0.06 0.10 0.12 0.13 0.13

Similarity ratio

0

0.2

0.4

0.6

0.8

1

0 500 1000 1500 2000 2500

Ta

ux

de

sim

ilarité

Nombre de cycles (30 fourmis par cycles)

alpha=1 rho=0.005alpha=1 rho=0.010alpha=2 rho=0.010alpha=2 rho=0.020

Page 29: Ant Colony Optimization for Constraint Satisfaction · Ant Colony Optimization Application to car sequencing Application to CSPs Conclusion The MAX −MIN Ant System initialize pheromone

Ant Colony Optimization Application to car sequencing Application to CSPs Conclusion

Table of contents

1 Basic principles of Ant Colony Optimization

2 Application to the car sequencing problem

3 Application to binary CSPs

4 Conclusion

Page 30: Ant Colony Optimization for Constraint Satisfaction · Ant Colony Optimization Application to car sequencing Application to CSPs Conclusion The MAX −MIN Ant System initialize pheromone

Ant Colony Optimization Application to car sequencing Application to CSPs Conclusion

The car sequencing problem

Goal: Sequence cars along an assembly lineEach car requires a set of optionsSpace cars requiring a same option

ExampleSet of cars to be sequenced:

Sequencing contraints:

≤ 1/2 ; ≤ 2/5 ; ≤ 1/5 ; ≤ 1/3

Solution:

Page 31: Ant Colony Optimization for Constraint Satisfaction · Ant Colony Optimization Application to car sequencing Application to CSPs Conclusion The MAX −MIN Ant System initialize pheromone

Ant Colony Optimization Application to car sequencing Application to CSPs Conclusion

The car sequencing problem

Goal: Sequence cars along an assembly lineEach car requires a set of optionsSpace cars requiring a same option

ExampleSet of cars to be sequenced:

Sequencing contraints:

≤ 1/2 ; ≤ 2/5 ; ≤ 1/5 ; ≤ 1/3

Solution:

Page 32: Ant Colony Optimization for Constraint Satisfaction · Ant Colony Optimization Application to car sequencing Application to CSPs Conclusion The MAX −MIN Ant System initialize pheromone

Ant Colony Optimization Application to car sequencing Application to CSPs Conclusion

The car sequencing problem

Goal: Sequence cars along an assembly lineEach car requires a set of optionsSpace cars requiring a same option

ExampleSet of cars to be sequenced:

Sequencing contraints:

≤ 1/2 ; ≤ 2/5 ; ≤ 1/5 ; ≤ 1/3

Solution:

Page 33: Ant Colony Optimization for Constraint Satisfaction · Ant Colony Optimization Application to car sequencing Application to CSPs Conclusion The MAX −MIN Ant System initialize pheromone

Ant Colony Optimization Application to car sequencing Application to CSPs Conclusion

ACO for the car sequencing problem

Greedy randomized algorithm problem-dependent heuristic for identifying critical carsACO 1 pheromone structure for identifying good car sequencesACO 2 pheromone structure for identifying critical carsACO 1+2 combining the two pheromone structures

Page 34: Ant Colony Optimization for Constraint Satisfaction · Ant Colony Optimization Application to car sequencing Application to CSPs Conclusion The MAX −MIN Ant System initialize pheromone

Ant Colony Optimization Application to car sequencing Application to CSPs Conclusion

Greedy randomized algorithm

Start from an empty sequence π

While not all cars have been sequenced in π:Let cand be the set of cars not sequenced in πnarrow cand to cars that

introduce the fewest new constraint violationsrequire different sets of options

choose ci ∈ cand w.r.t. probability p(ci , cand , π)add ci at the end of π

p(ci , cand , π) =[η(ci , π)]β∑

ck∈cand [η(ck , π)]β

where

η(ci , π) = problem-dependent heuristic function sum of utilisation rates of options required by ci

β = parameter that controls heuristic weight

Page 35: Ant Colony Optimization for Constraint Satisfaction · Ant Colony Optimization Application to car sequencing Application to CSPs Conclusion The MAX −MIN Ant System initialize pheromone

Ant Colony Optimization Application to car sequencing Application to CSPs Conclusion

Greedy randomized algorithm

Start from an empty sequence π

While not all cars have been sequenced in π:Let cand be the set of cars not sequenced in πnarrow cand to cars that

introduce the fewest new constraint violationsrequire different sets of options

choose ci ∈ cand w.r.t. probability p(ci , cand , π)add ci at the end of π

p(ci , cand , π) =[η(ci , π)]β∑

ck∈cand [η(ck , π)]β

where

η(ci , π) = problem-dependent heuristic function sum of utilisation rates of options required by ci

β = parameter that controls heuristic weight

Page 36: Ant Colony Optimization for Constraint Satisfaction · Ant Colony Optimization Application to car sequencing Application to CSPs Conclusion The MAX −MIN Ant System initialize pheromone

Ant Colony Optimization Application to car sequencing Application to CSPs Conclusion

ACO algorithm for learning good sequences

Construction graph

Complete directed graph s.t. vertices = cars Hamiltonian path = sequence of cars

Pheromone is laid on edges: τ1(ci , cj) = pheromone on (ci , cj) experience of the colony / sequencing cj just after ci

At each cycle, each ant builds a sequence

Probability of adding car cj at the end of a sequence π

p(cj) =[τπ(cj )]

α1 .[ηπ(cj )]βP

ck∈cand [τπ(ck )]α1 .[ηπ(ck )]β

τπ(cj) = pheromone factor if the last car of π is ci then τπ(cj) = τ1(ci , cj) when choosing the first car of a sequence, τπ(cj) = 1

ηπ(cj) = local heuristic that evaluates the hardness of cj sum of utilization rates of options required by cj

At the end of each cycle, reward the best sequences

Add pheromone on consecutive cars in the cycle best sequencesQuantity of pheromone added = 1/number of violated constraints

Page 37: Ant Colony Optimization for Constraint Satisfaction · Ant Colony Optimization Application to car sequencing Application to CSPs Conclusion The MAX −MIN Ant System initialize pheromone

Ant Colony Optimization Application to car sequencing Application to CSPs Conclusion

ACO algorithm for learning good sequences

Construction graph

Complete directed graph s.t. vertices = cars Hamiltonian path = sequence of cars

Pheromone is laid on edges: τ1(ci , cj) = pheromone on (ci , cj) experience of the colony / sequencing cj just after ci

At each cycle, each ant builds a sequence

Probability of adding car cj at the end of a sequence π

p(cj) =[τπ(cj )]

α1 .[ηπ(cj )]βP

ck∈cand [τπ(ck )]α1 .[ηπ(ck )]β

τπ(cj) = pheromone factor if the last car of π is ci then τπ(cj) = τ1(ci , cj) when choosing the first car of a sequence, τπ(cj) = 1

ηπ(cj) = local heuristic that evaluates the hardness of cj sum of utilization rates of options required by cj

At the end of each cycle, reward the best sequences

Add pheromone on consecutive cars in the cycle best sequencesQuantity of pheromone added = 1/number of violated constraints

Page 38: Ant Colony Optimization for Constraint Satisfaction · Ant Colony Optimization Application to car sequencing Application to CSPs Conclusion The MAX −MIN Ant System initialize pheromone

Ant Colony Optimization Application to car sequencing Application to CSPs Conclusion

ACO algorithm for learning good sequences

Construction graph

Complete directed graph s.t. vertices = cars Hamiltonian path = sequence of cars

Pheromone is laid on edges: τ1(ci , cj) = pheromone on (ci , cj) experience of the colony / sequencing cj just after ci

At each cycle, each ant builds a sequence

Probability of adding car cj at the end of a sequence π

p(cj) =[τπ(cj )]

α1 .[ηπ(cj )]βP

ck∈cand [τπ(ck )]α1 .[ηπ(ck )]β

τπ(cj) = pheromone factor if the last car of π is ci then τπ(cj) = τ1(ci , cj) when choosing the first car of a sequence, τπ(cj) = 1

ηπ(cj) = local heuristic that evaluates the hardness of cj sum of utilization rates of options required by cj

At the end of each cycle, reward the best sequences

Add pheromone on consecutive cars in the cycle best sequencesQuantity of pheromone added = 1/number of violated constraints

Page 39: Ant Colony Optimization for Constraint Satisfaction · Ant Colony Optimization Application to car sequencing Application to CSPs Conclusion The MAX −MIN Ant System initialize pheromone

Ant Colony Optimization Application to car sequencing Application to CSPs Conclusion

ACO algorithm for learning good sequences

Construction graph

Complete directed graph s.t. vertices = cars Hamiltonian path = sequence of cars

Pheromone is laid on edges: τ1(ci , cj) = pheromone on (ci , cj) experience of the colony / sequencing cj just after ci

At each cycle, each ant builds a sequence

Probability of adding car cj at the end of a sequence π

p(cj) =[τπ(cj )]

α1 .[ηπ(cj )]βP

ck∈cand [τπ(ck )]α1 .[ηπ(ck )]β

τπ(cj) = pheromone factor if the last car of π is ci then τπ(cj) = τ1(ci , cj) when choosing the first car of a sequence, τπ(cj) = 1

ηπ(cj) = local heuristic that evaluates the hardness of cj sum of utilization rates of options required by cj

At the end of each cycle, reward the best sequences

Add pheromone on consecutive cars in the cycle best sequencesQuantity of pheromone added = 1/number of violated constraints

Page 40: Ant Colony Optimization for Constraint Satisfaction · Ant Colony Optimization Application to car sequencing Application to CSPs Conclusion The MAX −MIN Ant System initialize pheromone

Ant Colony Optimization Application to car sequencing Application to CSPs Conclusion

ACO algorithm for learning good sequences

Construction graph

Complete directed graph s.t. vertices = cars Hamiltonian path = sequence of cars

Pheromone is laid on edges: τ1(ci , cj) = pheromone on (ci , cj) experience of the colony / sequencing cj just after ci

At each cycle, each ant builds a sequence

Probability of adding car cj at the end of a sequence π

p(cj) =[τπ(cj )]

α1 .[ηπ(cj )]βP

ck∈cand [τπ(ck )]α1 .[ηπ(ck )]β

τπ(cj) = pheromone factor if the last car of π is ci then τπ(cj) = τ1(ci , cj) when choosing the first car of a sequence, τπ(cj) = 1

ηπ(cj) = local heuristic that evaluates the hardness of cj sum of utilization rates of options required by cj

At the end of each cycle, reward the best sequences

Add pheromone on consecutive cars in the cycle best sequencesQuantity of pheromone added = 1/number of violated constraints

Page 41: Ant Colony Optimization for Constraint Satisfaction · Ant Colony Optimization Application to car sequencing Application to CSPs Conclusion The MAX −MIN Ant System initialize pheromone

Ant Colony Optimization Application to car sequencing Application to CSPs Conclusion

ACO algorithm for learning for critical cars

Pheromone structurePheromone trails associated with cars(grouped in car classes w.r.t. required options) : τ2(cc) = quantity of pheromone associated with car class cc experience of the colony / difficulty of sequencing cars of cc

At each cycle, each ant builds a sequence

Probability of adding a car of class ccj at the end of a sequence

p(ccj) =[τ2(ccj )]

α2Pcck∈cand [τ(cck )]α2

Pheromone updating step

While constructing sequences: add pheromone on classes violating constraintsAt the end of every sequence construction: evaporation

Page 42: Ant Colony Optimization for Constraint Satisfaction · Ant Colony Optimization Application to car sequencing Application to CSPs Conclusion The MAX −MIN Ant System initialize pheromone

Ant Colony Optimization Application to car sequencing Application to CSPs Conclusion

ACO algorithm for learning for critical cars

Pheromone structurePheromone trails associated with cars(grouped in car classes w.r.t. required options) : τ2(cc) = quantity of pheromone associated with car class cc experience of the colony / difficulty of sequencing cars of cc

At each cycle, each ant builds a sequence

Probability of adding a car of class ccj at the end of a sequence

p(ccj) =[τ2(ccj )]

α2Pcck∈cand [τ(cck )]α2

Pheromone updating step

While constructing sequences: add pheromone on classes violating constraintsAt the end of every sequence construction: evaporation

Page 43: Ant Colony Optimization for Constraint Satisfaction · Ant Colony Optimization Application to car sequencing Application to CSPs Conclusion The MAX −MIN Ant System initialize pheromone

Ant Colony Optimization Application to car sequencing Application to CSPs Conclusion

ACO algorithm for learning for critical cars

Pheromone structurePheromone trails associated with cars(grouped in car classes w.r.t. required options) : τ2(cc) = quantity of pheromone associated with car class cc experience of the colony / difficulty of sequencing cars of cc

At each cycle, each ant builds a sequence

Probability of adding a car of class ccj at the end of a sequence

p(ccj) =[τ2(ccj )]

α2Pcck∈cand [τ(cck )]α2

Pheromone updating step

While constructing sequences: add pheromone on classes violating constraintsAt the end of every sequence construction: evaporation

Page 44: Ant Colony Optimization for Constraint Satisfaction · Ant Colony Optimization Application to car sequencing Application to CSPs Conclusion The MAX −MIN Ant System initialize pheromone

Ant Colony Optimization Application to car sequencing Application to CSPs Conclusion

Double ACO algorithm

Combine the two pheromone structures

To learn for sequences: ∀ cars ci and cjτ1(ci , cj) = experience of the colony / sequence cj after ci

To learn for critical cars: ∀ car class ccτ2(cc) = experience of the colony / sequence cars of cc

At each cycle, each ant builds a sequence

Probability of adding car cj at the end of a sequence

p(cj) =[τ1(ci ,cj )]

α1 .[τ2(classOf (cj ))]α2P

ck∈cand [τ1(ci ,ck )]α1 .[τ2(classOf (ck ))]α2

Pheromone updating steps

While constructing sequences: add trails on τ2(cc) At the end of every sequence construction: evaporate τ2(cc) At the end of every cycle: evaporate + add trails on τ1(ci , cj)

Page 45: Ant Colony Optimization for Constraint Satisfaction · Ant Colony Optimization Application to car sequencing Application to CSPs Conclusion The MAX −MIN Ant System initialize pheromone

Ant Colony Optimization Application to car sequencing Application to CSPs Conclusion

Double ACO algorithm

Combine the two pheromone structures

To learn for sequences: ∀ cars ci and cjτ1(ci , cj) = experience of the colony / sequence cj after ci

To learn for critical cars: ∀ car class ccτ2(cc) = experience of the colony / sequence cars of cc

At each cycle, each ant builds a sequence

Probability of adding car cj at the end of a sequence

p(cj) =[τ1(ci ,cj )]

α1 .[τ2(classOf (cj ))]α2P

ck∈cand [τ1(ci ,ck )]α1 .[τ2(classOf (ck ))]α2

Pheromone updating steps

While constructing sequences: add trails on τ2(cc) At the end of every sequence construction: evaporate τ2(cc) At the end of every cycle: evaporate + add trails on τ1(ci , cj)

Page 46: Ant Colony Optimization for Constraint Satisfaction · Ant Colony Optimization Application to car sequencing Application to CSPs Conclusion The MAX −MIN Ant System initialize pheromone

Ant Colony Optimization Application to car sequencing Application to CSPs Conclusion

Double ACO algorithm

Combine the two pheromone structures

To learn for sequences: ∀ cars ci and cjτ1(ci , cj) = experience of the colony / sequence cj after ci

To learn for critical cars: ∀ car class ccτ2(cc) = experience of the colony / sequence cars of cc

At each cycle, each ant builds a sequence

Probability of adding car cj at the end of a sequence

p(cj) =[τ1(ci ,cj )]

α1 .[τ2(classOf (cj ))]α2P

ck∈cand [τ1(ci ,ck )]α1 .[τ2(classOf (ck ))]α2

Pheromone updating steps

While constructing sequences: add trails on τ2(cc) At the end of every sequence construction: evaporate τ2(cc) At the end of every cycle: evaporate + add trails on τ1(ci , cj)

Page 47: Ant Colony Optimization for Constraint Satisfaction · Ant Colony Optimization Application to car sequencing Application to CSPs Conclusion The MAX −MIN Ant System initialize pheromone

Ant Colony Optimization Application to car sequencing Application to CSPs Conclusion

Experimental results

Exerimental settings

Heur. η Pheromone 1 Pheromone 2Algo β α1 ρ1 τmin1 τmax1 α2 ρ2 τmin2

Greedy(η) 6 - - - - - - -ACO(τ1, η) 6 2 1% 0.01 4 - - -ACO(τ2) - - - - - 6 3% 1

ACO(τ1, τ2) - 2 1% 0.01 4 6 3% 15000 cycles, 30 ants 150000 sequence constructions50 runs per instance on a 2GHz Pentium 4

BenchmarkInstances of [Lee et all 98] trivially solved in less than 0.01sInstances of [Perron & Shaw 04]

Satisfiable instances32, 21 and 29 instances with 100, 300 and 500 cars resp.20 classes and 8 options

Page 48: Ant Colony Optimization for Constraint Satisfaction · Ant Colony Optimization Application to car sequencing Application to CSPs Conclusion The MAX −MIN Ant System initialize pheromone

Ant Colony Optimization Application to car sequencing Application to CSPs Conclusion

Experimental results

Exerimental settings

Heur. η Pheromone 1 Pheromone 2Algo β α1 ρ1 τmin1 τmax1 α2 ρ2 τmin2

Greedy(η) 6 - - - - - - -ACO(τ1, η) 6 2 1% 0.01 4 - - -ACO(τ2) - - - - - 6 3% 1

ACO(τ1, τ2) - 2 1% 0.01 4 6 3% 15000 cycles, 30 ants 150000 sequence constructions50 runs per instance on a 2GHz Pentium 4

BenchmarkInstances of [Lee et all 98] trivially solved in less than 0.01sInstances of [Perron & Shaw 04]

Satisfiable instances32, 21 and 29 instances with 100, 300 and 500 cars resp.20 classes and 8 options

Page 49: Ant Colony Optimization for Constraint Satisfaction · Ant Colony Optimization Application to car sequencing Application to CSPs Conclusion The MAX −MIN Ant System initialize pheromone

Ant Colony Optimization Application to car sequencing Application to CSPs Conclusion

Comparison: success / CPU time

40

50

60

70

80

90

100

0.1 1 10 100

Pou

rcen

tage

d in

stan

ces

réso

lues

(50

exé

cutio

ns /

82 in

stan

ces)

Temps CPU (échelle logarithmique)

Glouton

Page 50: Ant Colony Optimization for Constraint Satisfaction · Ant Colony Optimization Application to car sequencing Application to CSPs Conclusion The MAX −MIN Ant System initialize pheromone

Ant Colony Optimization Application to car sequencing Application to CSPs Conclusion

Comparison: success / CPU time

40

50

60

70

80

90

100

0.1 1 10 100

Pou

rcen

tage

d in

stan

ces

réso

lues

(50

exé

cutio

ns /

82 in

stan

ces)

Temps CPU (échelle logarithmique)

Glouton ACO 1

Page 51: Ant Colony Optimization for Constraint Satisfaction · Ant Colony Optimization Application to car sequencing Application to CSPs Conclusion The MAX −MIN Ant System initialize pheromone

Ant Colony Optimization Application to car sequencing Application to CSPs Conclusion

Comparison: success / CPU time

40

50

60

70

80

90

100

0.1 1 10 100

Pou

rcen

tage

d in

stan

ces

réso

lues

(50

exé

cutio

ns /

82 in

stan

ces)

Temps CPU (échelle logarithmique)

Glouton ACO 1 ACO 2

Page 52: Ant Colony Optimization for Constraint Satisfaction · Ant Colony Optimization Application to car sequencing Application to CSPs Conclusion The MAX −MIN Ant System initialize pheromone

Ant Colony Optimization Application to car sequencing Application to CSPs Conclusion

Comparison: success / CPU time

40

50

60

70

80

90

100

0.1 1 10 100

Pou

rcen

tage

d in

stan

ces

réso

lues

(50

exé

cutio

ns /

82 in

stan

ces)

Temps CPU (échelle logarithmique)

Glouton ACO 1 ACO 2

ACO 1+2

Page 53: Ant Colony Optimization for Constraint Satisfaction · Ant Colony Optimization Application to car sequencing Application to CSPs Conclusion The MAX −MIN Ant System initialize pheromone

Ant Colony Optimization Application to car sequencing Application to CSPs Conclusion

Comparison with Local Search

Considered approaches

SN = Winner of the ROADEF’2005 challenge [Estellon et al. 05]

First solution built in a greedy wayNeighborhood = swap / mirror / insert / shuffleFirst non decreasing neighbor

ID Walk [Neveu et al. 04]

First solution built in a greedy wayNeighborhood = swapat most Max neighbors are considered at each move First non decreasing neighbor...

... or best neighbor over Max neighbors Adaptive tuning of Max

Page 54: Ant Colony Optimization for Constraint Satisfaction · Ant Colony Optimization Application to car sequencing Application to CSPs Conclusion The MAX −MIN Ant System initialize pheromone

Ant Colony Optimization Application to car sequencing Application to CSPs Conclusion

Comparison: 32 instances with 100 cars

0

20

40

60

80

100

0.1 1 10

Pou

rcen

tage

d in

stan

ces

réso

lues

(50

exé

cutio

ns /

32 in

stan

ces)

Temps CPU (échelle logarithmique)

ACO 1+2SN

IDWalk

Page 55: Ant Colony Optimization for Constraint Satisfaction · Ant Colony Optimization Application to car sequencing Application to CSPs Conclusion The MAX −MIN Ant System initialize pheromone

Ant Colony Optimization Application to car sequencing Application to CSPs Conclusion

Comparison: 21 instances with 300 cars

0

20

40

60

80

100

0.1 1 10

Pou

rcen

tage

d in

stan

ces

réso

lues

(50

exé

cutio

ns /

21 in

stan

ces)

Temps CPU (échelle logarithmique)

ACO 1+2SN

IDWalk

Page 56: Ant Colony Optimization for Constraint Satisfaction · Ant Colony Optimization Application to car sequencing Application to CSPs Conclusion The MAX −MIN Ant System initialize pheromone

Ant Colony Optimization Application to car sequencing Application to CSPs Conclusion

Comparison: 29 instances with 500 cars

0

20

40

60

80

100

0.1 1 10 100

Pou

rcen

tage

d in

stan

ces

réso

lues

(50

exé

cutio

ns /

29 in

stan

ces)

Temps CPU (échelle logarithmique)

ACO(tau1,tau2)SN

IDWalk

Page 57: Ant Colony Optimization for Constraint Satisfaction · Ant Colony Optimization Application to car sequencing Application to CSPs Conclusion The MAX −MIN Ant System initialize pheromone

Ant Colony Optimization Application to car sequencing Application to CSPs Conclusion

Table of contents

1 Basic principles of Ant Colony Optimization

2 Application to the car sequencing problem

3 Application to binary CSPs

4 Conclusion

Page 58: Ant Colony Optimization for Constraint Satisfaction · Ant Colony Optimization Application to car sequencing Application to CSPs Conclusion The MAX −MIN Ant System initialize pheromone

Ant Colony Optimization Application to car sequencing Application to CSPs Conclusion

Application of ACO to binary CSPs

Construction graph associated with a CSP (X , D, C)

Complete non directed graph G = (V , E) s.t.

V = {〈Xi , vi〉 : Xi ∈ X , vi ∈ D(Xi)}

Two different pheromone strategies

Vertex strategy: pheromone is laid on verticesτ〈Xi ,vi〉 desirability of assigning Xi to vi

Edge strategy: pheromone is laid on edgesτ〈Xi ,vi〉,〈Xj ,vj〉 desir. of assigning together Xi to vi and Xj to vj

Page 59: Ant Colony Optimization for Constraint Satisfaction · Ant Colony Optimization Application to car sequencing Application to CSPs Conclusion The MAX −MIN Ant System initialize pheromone

Ant Colony Optimization Application to car sequencing Application to CSPs Conclusion

Application of ACO to CSP

At each cycle, each ant constructs a complete assignment A

Given a partial assignment A:Choose a non assigned variable Xi w.r.t. min domain heuristicChoose a value vi ∈ D(Xi) with probability

p(vi) = τfactor (vi)α·ηfactor (vi)

β∑vk∈D(Xi )

τfactor (vk )α·ηfactor (vk )β

Pheromone factor depends on the strategy:Vertex strategy τfactor (vi) = τ〈Xi ,vi〉Edge strategy τfactor (vi) =

∑〈Xk ,vk 〉∈A τ〈Xi ,vi〉,〈Xk ,vk 〉

Heuristic factor: ηfactor (vi) = 1/(1 + new violations)

At the end of each cycle, update pheromone

Evaporate pheromoneVertex strategy: on every vertex 〈Xi , vi〉Edge strategy: on every edge (〈Xi , vi〉, 〈Xk , vk 〉)

Add pheromone on the best assignment Abest of the cycleVertex strategy: add pheromone on every 〈Xi , vi〉 ∈ AbestEdge strategy: add pheromone on every(〈Xi , vi〉, 〈Xj , vj〉) ∈ Abest × Abest

Quantity of pheromone laid = 1/#violations

Page 60: Ant Colony Optimization for Constraint Satisfaction · Ant Colony Optimization Application to car sequencing Application to CSPs Conclusion The MAX −MIN Ant System initialize pheromone

Ant Colony Optimization Application to car sequencing Application to CSPs Conclusion

Application of ACO to CSP

At each cycle, each ant constructs a complete assignment A

Given a partial assignment A:Choose a non assigned variable Xi w.r.t. min domain heuristicChoose a value vi ∈ D(Xi) with probability

p(vi) = τfactor (vi)α·ηfactor (vi)

β∑vk∈D(Xi )

τfactor (vk )α·ηfactor (vk )β

Pheromone factor depends on the strategy:Vertex strategy τfactor (vi) = τ〈Xi ,vi〉Edge strategy τfactor (vi) =

∑〈Xk ,vk 〉∈A τ〈Xi ,vi〉,〈Xk ,vk 〉

Heuristic factor: ηfactor (vi) = 1/(1 + new violations)

At the end of each cycle, update pheromone

Evaporate pheromoneVertex strategy: on every vertex 〈Xi , vi〉Edge strategy: on every edge (〈Xi , vi〉, 〈Xk , vk 〉)

Add pheromone on the best assignment Abest of the cycleVertex strategy: add pheromone on every 〈Xi , vi〉 ∈ AbestEdge strategy: add pheromone on every(〈Xi , vi〉, 〈Xj , vj〉) ∈ Abest × Abest

Quantity of pheromone laid = 1/#violations

Page 61: Ant Colony Optimization for Constraint Satisfaction · Ant Colony Optimization Application to car sequencing Application to CSPs Conclusion The MAX −MIN Ant System initialize pheromone

Ant Colony Optimization Application to car sequencing Application to CSPs Conclusion

Application of ACO to CSP

At each cycle, each ant constructs a complete assignment A

Given a partial assignment A:Choose a non assigned variable Xi w.r.t. min domain heuristicChoose a value vi ∈ D(Xi) with probability

p(vi) = τfactor (vi)α·ηfactor (vi)

β∑vk∈D(Xi )

τfactor (vk )α·ηfactor (vk )β

Pheromone factor depends on the strategy:Vertex strategy τfactor (vi) = τ〈Xi ,vi〉Edge strategy τfactor (vi) =

∑〈Xk ,vk 〉∈A τ〈Xi ,vi〉,〈Xk ,vk 〉

Heuristic factor: ηfactor (vi) = 1/(1 + new violations)

At the end of each cycle, update pheromone

Evaporate pheromoneVertex strategy: on every vertex 〈Xi , vi〉Edge strategy: on every edge (〈Xi , vi〉, 〈Xk , vk 〉)

Add pheromone on the best assignment Abest of the cycleVertex strategy: add pheromone on every 〈Xi , vi〉 ∈ AbestEdge strategy: add pheromone on every(〈Xi , vi〉, 〈Xj , vj〉) ∈ Abest × Abest

Quantity of pheromone laid = 1/#violations

Page 62: Ant Colony Optimization for Constraint Satisfaction · Ant Colony Optimization Application to car sequencing Application to CSPs Conclusion The MAX −MIN Ant System initialize pheromone

Ant Colony Optimization Application to car sequencing Application to CSPs Conclusion

Experimental results: considered instances

CSP solver competition in 2006

1195 binary instances defined in extension...

...selection of satisfiable instances

...selection of instances that pass through my parser

230 instances from 6 benchmarks

Page 63: Ant Colony Optimization for Constraint Satisfaction · Ant Colony Optimization Application to car sequencing Application to CSPs Conclusion The MAX −MIN Ant System initialize pheromone

Ant Colony Optimization Application to car sequencing Application to CSPs Conclusion

Experimental results: ACO experimental setting

Hybridization with local search

At the end of each assignment construction, perform local searchMove = change the value of one variableAccept the first non tabu and non deteriorating moveTabu list of infinite length

Parameter setting

Choice of a setting that favors a quick convergence:α = 2, β = 8, ρ = 0.02, 15 ants, τmin = 0.01, τmax = δavg/ρ

(where δavg = average qty of pheromone laid at each cycle)

Exploitation of the resampling ratio to prevent from stagnation

When a solution is resampled, decrease pheromone trailson its components (multiplication by 0.1)Restart if more than 1000 resamplings

Page 64: Ant Colony Optimization for Constraint Satisfaction · Ant Colony Optimization Application to car sequencing Application to CSPs Conclusion The MAX −MIN Ant System initialize pheromone

Ant Colony Optimization Application to car sequencing Application to CSPs Conclusion

Experimental results: considered solvers

23 solvers of the competition, all based on complete approaches CPU time limit of 1800s on a 3GHZ Intel XeonACO (Vertex and Edge) CPU time limit of 1800s on a 2.16GHZ Intel Core DuoTabu (tabu list length=50, restart every 1, 000, 000 moves) CPU time limit of 1800s on a 2.16GHZ Intel Core Duo

Solver #solvedbuggy 2 5 s 207 6 bestbuggy 2 5 207 completeAbscon 109 AC 207 solversVALCSP 3.1 206 of theVALCSP 3.0 206 competitionAbscon 109 ESAC 204 in 2006... ...

Page 65: Ant Colony Optimization for Constraint Satisfaction · Ant Colony Optimization Application to car sequencing Application to CSPs Conclusion The MAX −MIN Ant System initialize pheromone

Ant Colony Optimization Application to car sequencing Application to CSPs Conclusion

Experimental results: considered solvers

23 solvers of the competition, all based on complete approaches CPU time limit of 1800s on a 3GHZ Intel XeonACO (Vertex and Edge) CPU time limit of 1800s on a 2.16GHZ Intel Core DuoTabu (tabu list length=50, restart every 1, 000, 000 moves) CPU time limit of 1800s on a 2.16GHZ Intel Core Duo

Solver #solvedbuggy 2 5 s 207 6 bestbuggy 2 5 207 completeAbscon 109 AC 207 solversVALCSP 3.1 206 of theVALCSP 3.0 206 competitionAbscon 109 ESAC 204 in 2006... ...ACO(Vertex) 218ACO(Edge) 214

Page 66: Ant Colony Optimization for Constraint Satisfaction · Ant Colony Optimization Application to car sequencing Application to CSPs Conclusion The MAX −MIN Ant System initialize pheromone

Ant Colony Optimization Application to car sequencing Application to CSPs Conclusion

Experimental results: considered solvers

23 solvers of the competition, all based on complete approaches CPU time limit of 1800s on a 3GHZ Intel XeonACO (Vertex and Edge) CPU time limit of 1800s on a 2.16GHZ Intel Core DuoTabu (tabu list length=50, restart every 1, 000, 000 moves) CPU time limit of 1800s on a 2.16GHZ Intel Core Duo

Solver #solvedbuggy 2 5 s 207 6 bestbuggy 2 5 207 completeAbscon 109 AC 207 solversVALCSP 3.1 206 of theVALCSP 3.0 206 competitionAbscon 109 ESAC 204 in 2006... ...ACO(Vertex) 218ACO(Edge) 214Tabu 226

Page 67: Ant Colony Optimization for Constraint Satisfaction · Ant Colony Optimization Application to car sequencing Application to CSPs Conclusion The MAX −MIN Ant System initialize pheromone

Ant Colony Optimization Application to car sequencing Application to CSPs Conclusion

Experimental results

Easy benchmarks (all instances solved in less than 1800 s.)

composed-25-10-20 : 10 instances, |X | = 105, |D| = 10

marc : 5 instances, |X | ∈ {80, 84, 88, 92, 96}, |D| = |X |

rand-2-k : 23 instances, |X | = k , |D| = k , k ∈ {23, 24, 25, 26, 27}

Benchmark Best complete solver Vertex Edge Tabucomp-25-10-20 0.06 (VALCSP 3.1) 1.31 8.03 0.32marc 19.95 (Abscon 109 AC) 26.96 27.05 28.21rand-2-23 14.82 (VALCSP 3.0) 1.42 3.15 5.76rand-2-24 9.94 (VALCSP 3.1) 3.22 7.43 8.25rand-2-25 52.69 (buggy 2 5 s) 3.20 7.27 6.71rand-2-26 180.86 (VALCSP 3.1) 3.26 87.71 21.13rand-2-27 248.71 (VALCSP 3.1) 23.45 193.88 26.35

(average CPU time, in seconds, for each class of instances)

Page 68: Ant Colony Optimization for Constraint Satisfaction · Ant Colony Optimization Application to car sequencing Application to CSPs Conclusion The MAX −MIN Ant System initialize pheromone

Ant Colony Optimization Application to car sequencing Application to CSPs Conclusion

Experimental results

More difficult benchmarks

rand-2-n-k-fcd : 60 instances, |X | = n, |D| = k

geom : 92 instances, |X |=50, |D| = 20

Best complete solver ACO(Vertex) ACO(Edge) Tabunb time solver nb time nb time nb time

2-30-15 20 0.2 (VALCSP 3.0) 20 0.4 20 0.8 20 0.52-40-19 20 25.3 (VALCSP 3.1) 20 7.0 20 98.3 20 8.22-50-23 14 829.7 (buggy 2 5) 20 81.9 17 347.6 20 31.0geom 92 1.0 (VALCSP 3.0) 91 11.0 91 50.2 92 3.6

nb = number of instances solved in less than 1800 s.time = average CPU time for the solved instances

Page 69: Ant Colony Optimization for Constraint Satisfaction · Ant Colony Optimization Application to car sequencing Application to CSPs Conclusion The MAX −MIN Ant System initialize pheromone

Ant Colony Optimization Application to car sequencing Application to CSPs Conclusion

Experimental results

Really hard benchmark

frbn-k [Xu et al. / IJCAI’05] : 40 instances, |X | = n, |D| = k

Best solver ACO(Vertex) ACO(Edge) Tabunb time solver nb time nb time nb time

30-15 5 0.2 (VALCSP 3.1) 5 0.4 5 1.3 5 0.535-17 5 2.1 (VALCSP 3.1) 5 3.0 5 5.0 5 0.940-19 5 9.4 (VALCSP 3.0) 5 7.0 5 103.5 5 9.145-21 5 123.4 (VALCSP 3.1) 5 467.7 5 354.1 5 43.450-23 3 327.2 (VALCSP 3.1) 3 430.4 3 680.5 4 9.953-24 1 74.0 (Abs. 109 AC) 3 105.7 3 530.8 4 291.656-25 0 - - 2 535.8 2 170.2 4 329.359-26 1 413.9 (Abs. 109 AC) 1 63.6 0 - 4 523.7

nb = number of instances solved in less than 1800 s.time = average CPU time for the solved instances

Page 70: Ant Colony Optimization for Constraint Satisfaction · Ant Colony Optimization Application to car sequencing Application to CSPs Conclusion The MAX −MIN Ant System initialize pheromone

Ant Colony Optimization Application to car sequencing Application to CSPs Conclusion

Table of contents

1 Basic principles of Ant Colony Optimization

2 Application to the car sequencing problem

3 Application to binary CSPs

4 Conclusion

Page 71: Ant Colony Optimization for Constraint Satisfaction · Ant Colony Optimization Application to car sequencing Application to CSPs Conclusion The MAX −MIN Ant System initialize pheromone

Ant Colony Optimization Application to car sequencing Application to CSPs Conclusion

From CSP solving to CP

Ants can solve CSPs !!!Competitive results......obtained with ad hoc ACO algorithms

Next step: CP with ACOGet rid of parameter tuning reactive ACOuse diversification measures to adaptively tune parametersIntegration within a CP languageInvestigation of two directions:

Use ACO to guide a CP search within Ilog solverDesign a Comet-based modelling language for ACO

Page 72: Ant Colony Optimization for Constraint Satisfaction · Ant Colony Optimization Application to car sequencing Application to CSPs Conclusion The MAX −MIN Ant System initialize pheromone

Ant Colony Optimization Application to car sequencing Application to CSPs Conclusion

From CSP solving to CP

Ants can solve CSPs !!!Competitive results......obtained with ad hoc ACO algorithms

Next step: CP with ACOGet rid of parameter tuning reactive ACOuse diversification measures to adaptively tune parametersIntegration within a CP languageInvestigation of two directions:

Use ACO to guide a CP search within Ilog solverDesign a Comet-based modelling language for ACO

Page 73: Ant Colony Optimization for Constraint Satisfaction · Ant Colony Optimization Application to car sequencing Application to CSPs Conclusion The MAX −MIN Ant System initialize pheromone

Ant Colony Optimization Application to car sequencing Application to CSPs Conclusion

Next step: CP with ACO

Using ACO to guide a CP search

Joint project with Ilog (Patrick Albert and Madjid Khichane)

Use a CP modeling language to describe the problem

Use ACO to guide the search engineIterative construction of partial consistent assignments

ACO heuristic to choose valuesCP solver constraint propagation and verification

First promising results on the car sequencing problem......see First Workshop on Autonomous Search at CP’2007

Page 74: Ant Colony Optimization for Constraint Satisfaction · Ant Colony Optimization Application to car sequencing Application to CSPs Conclusion The MAX −MIN Ant System initialize pheromone

Ant Colony Optimization Application to car sequencing Application to CSPs Conclusion

Next step: CP with ACO

A Comet-based modelling language for ACO

Joint work with Yves Deville and Pascal Van Hentenryck

Enrich Comet with new abstractions to ease the design of ACOalgorithms

First investigations on 2 classes of problems:

Hamiltonian path finding problems(Traveling Salesman Problem, Car sequencing Problem, ...)Subset selection problems(Multidimensional Knapsack Problem, Maximum CliqueProblem, ...)

Page 75: Ant Colony Optimization for Constraint Satisfaction · Ant Colony Optimization Application to car sequencing Application to CSPs Conclusion The MAX −MIN Ant System initialize pheromone

Ant Colony Optimization Application to car sequencing Application to CSPs Conclusion

Some references

On ACO and the MAX-MIN Ant System

M. Dorigo & T. Stutzle: Ant Colony Optimization. MIT Press. 2004http://iridia.ulb.ac.be/∼mdorigo/ACOT. Stutzle & H. H. Hoos: MAX-MIN Ant System. Future GenerationComputer Systems. 16(8):889–914. 2000

On solving the car sequencing problem with ACOC. Solnon: Combining two ACO algorithms for solving the carsequencing problem. EJOR (to appear)J. Gottlieb, M. Puchta & C. Solnon: A Study of Greedy, LocalSearch and ACO Approaches for Car Sequencing Problems.EvoCOP 2003.

On solving binary CSPs with ACOC. Solnon: Ants Can Solve CSPs. IEEE Transactions onEvolutionary Computation. 6(4):347–357. 2002F. Tarrant & D. Bridge: When Ants Attack: Ant Algorithms for CSP.Artificial Intelligence Review. 24(3-4):455-476. 2005C. Solnon & D. Bridge: An ACO Meta-Heuristic for SubsetSelection Problems. Systems Engineering using Particle SwarmOptimisation. 2006.

Page 76: Ant Colony Optimization for Constraint Satisfaction · Ant Colony Optimization Application to car sequencing Application to CSPs Conclusion The MAX −MIN Ant System initialize pheromone

Generalization to Subset Selection Problems

Definition

An SS-problem is defined by (S, SC , f ) where- S = set of candidate objects- SC ⊆ P(S) = set of consistant subsets- f : Sc → R = objective funtion

Goal: find s∗ ∈ SC such that f (s∗) is maximal (or minimal)

Examples

Maximum clique problem

Multidimensionnal knapsack problem

Set covering problem

...

Constraint satisfaction problems

Page 77: Ant Colony Optimization for Constraint Satisfaction · Ant Colony Optimization Application to car sequencing Application to CSPs Conclusion The MAX −MIN Ant System initialize pheromone

Solving SS-problems with ACO

Vertex strategy: identify good objects

Pheromone is laid on objects: τ(i) interest of selecting i

Knapsack [Leguizamon & Michalewicz 99]Set covering [Hadji & al 00]Minimum weight K-trees [Blum 02]CSP [Solnon & Bridge 06]Maximum clique [Solnon & Fenet 06]

Edge strategy: identify good pairs of objects

Pheromone is laid on pairs: τ(i , j) interest of selecting i and j

CSP [Solnon 02]Minimum weight K-trees [Blum 02]Maximum clique [Fenet & Solnon 03]Knapsack [Alaya, Solnon & Ghedira 04]Graph matching [Sammoud, Solnon & Ghedira 05]

Page 78: Ant Colony Optimization for Constraint Satisfaction · Ant Colony Optimization Application to car sequencing Application to CSPs Conclusion The MAX −MIN Ant System initialize pheromone

Generic ACO algorithm for SS-problems

Algorithm parameterized by:

an SS-problem (S, SC , f ) a pheromone strategy Φ ∈ {Vertex , Edge}

At each cycle, each ant builds a subset

Probability of adding object oi ∈ Candidats to subset Sk

p(oi) = [τfactor (oi ,Sk )]α.[ηfactor (oi ,Sk )]βPoj∈Candidats[τfactor (oj ,Sk )]α.[ηfactor (oj ,Sk )]β

τfactor (oi , Sk ) depends on Φ

If Φ = Vertex:τfactor (oi , Sk ) = τ(oi)

If Φ = Edge:τfactor (oi , Sk ) =

∑oj∈Sk

τ(oj , oi)

ηfactor (oi , Sk ) depends on the SS-problemAt the end of each cycle, reward best subsets.

The components of Sk to be rewarded depend on Φ

If Φ = Vertex:pheromone laying onvertices

If Φ = Edge :pheromone laying on clique edges

Page 79: Ant Colony Optimization for Constraint Satisfaction · Ant Colony Optimization Application to car sequencing Application to CSPs Conclusion The MAX −MIN Ant System initialize pheromone

Generic ACO algorithm for SS-problems

Algorithm parameterized by:

an SS-problem (S, SC , f ) a pheromone strategy Φ ∈ {Vertex , Edge}

At each cycle, each ant builds a subset

Probability of adding object oi ∈ Candidats to subset Sk

p(oi) = [τfactor (oi ,Sk )]α.[ηfactor (oi ,Sk )]βPoj∈Candidats[τfactor (oj ,Sk )]α.[ηfactor (oj ,Sk )]β

τfactor (oi , Sk ) depends on Φ

If Φ = Vertex:τfactor (oi , Sk ) = τ(oi)

If Φ = Edge:τfactor (oi , Sk ) =

∑oj∈Sk

τ(oj , oi)

ηfactor (oi , Sk ) depends on the SS-problemAt the end of each cycle, reward best subsets.

The components of Sk to be rewarded depend on Φ

If Φ = Vertex:pheromone laying onvertices

If Φ = Edge :pheromone laying on clique edges

Page 80: Ant Colony Optimization for Constraint Satisfaction · Ant Colony Optimization Application to car sequencing Application to CSPs Conclusion The MAX −MIN Ant System initialize pheromone

Generic ACO algorithm for SS-problems

Algorithm parameterized by:

an SS-problem (S, SC , f ) a pheromone strategy Φ ∈ {Vertex , Edge}

At each cycle, each ant builds a subset

Probability of adding object oi ∈ Candidats to subset Sk

p(oi) = [τfactor (oi ,Sk )]α.[ηfactor (oi ,Sk )]βPoj∈Candidats[τfactor (oj ,Sk )]α.[ηfactor (oj ,Sk )]β

τfactor (oi , Sk ) depends on Φ

If Φ = Vertex:τfactor (oi , Sk ) = τ(oi)

If Φ = Edge:τfactor (oi , Sk ) =

∑oj∈Sk

τ(oj , oi)

ηfactor (oi , Sk ) depends on the SS-problemAt the end of each cycle, reward best subsets.

The components of Sk to be rewarded depend on Φ

If Φ = Vertex:pheromone laying onvertices

If Φ = Edge :pheromone laying on clique edges

Page 81: Ant Colony Optimization for Constraint Satisfaction · Ant Colony Optimization Application to car sequencing Application to CSPs Conclusion The MAX −MIN Ant System initialize pheromone

Generic ACO algorithm for SS-problems

Algorithm parameterized by:

an SS-problem (S, SC , f ) a pheromone strategy Φ ∈ {Vertex , Edge}

At each cycle, each ant builds a subset

Probability of adding object oi ∈ Candidats to subset Sk

p(oi) = [τfactor (oi ,Sk )]α.[ηfactor (oi ,Sk )]βPoj∈Candidats[τfactor (oj ,Sk )]α.[ηfactor (oj ,Sk )]β

τfactor (oi , Sk ) depends on Φ

If Φ = Vertex:τfactor (oi , Sk ) = τ(oi)

If Φ = Edge:τfactor (oi , Sk ) =

∑oj∈Sk

τ(oj , oi)

ηfactor (oi , Sk ) depends on the SS-problem

At the end of each cycle, reward best subsets.

The components of Sk to be rewarded depend on Φ

If Φ = Vertex:pheromone laying onvertices

If Φ = Edge :pheromone laying on clique edges

Page 82: Ant Colony Optimization for Constraint Satisfaction · Ant Colony Optimization Application to car sequencing Application to CSPs Conclusion The MAX −MIN Ant System initialize pheromone

Generic ACO algorithm for SS-problems

Algorithm parameterized by:

an SS-problem (S, SC , f ) a pheromone strategy Φ ∈ {Vertex , Edge}

At each cycle, each ant builds a subset

Probability of adding object oi ∈ Candidats to subset Sk

p(oi) = [τfactor (oi ,Sk )]α.[ηfactor (oi ,Sk )]βPoj∈Candidats[τfactor (oj ,Sk )]α.[ηfactor (oj ,Sk )]β

τfactor (oi , Sk ) depends on Φ

If Φ = Vertex:τfactor (oi , Sk ) = τ(oi)

If Φ = Edge:τfactor (oi , Sk ) =

∑oj∈Sk

τ(oj , oi)

ηfactor (oi , Sk ) depends on the SS-problem

At the end of each cycle, reward best subsets.

The components of Sk to be rewarded depend on Φ

If Φ = Vertex:pheromone laying onvertices

If Φ = Edge :pheromone laying on clique edges