Software framework for metaheuristics Parallel Cooperative Optimization Research Group Laboratoire...

Post on 24-Dec-2015

223 views 0 download

Tags:

Transcript of Software framework for metaheuristics Parallel Cooperative Optimization Research Group Laboratoire...

Software framework for metaheuristics

Parallel Cooperative

Optimization Research

Group

Laboratoire d’InformatiqueFondamentale de Lille

http://paradiseo.gforge.inria.fr

Outline

• framework.

• ParadisEO-EO (population-based metaheuristics).

• ParadisEO-MO (solution-based metaheuristics).

• EO & MO hybridized metaheuristics.

• Conclusions and perspectives

Framework and tutorial application

Framework dedicated to metaheuristics

Tutorial application The Traveling Salesman Problem

(TSP)

Parallel and Distributed Evolving Objects

ParadisEO (1/2) A templates-based, ANSI-C++ compliant

Metaheuristic Computation Framework.

GForge Project by INRIA Dolphin Team.

Paradigm Free (genetic algorithms, genetic programming, particle swarm optimization, local searches …).

Hybrid, distributed and cooperative models.http://paradiseo.gforge.inria.fr

Flexible / a considered problem.

Generic components (variation operators, selection, replacement, termination, particle behaviors …).

Many services (visualization, managing command-line parameters, saving/restarting, …).

ParadisEO (2/2)

http://paradiseo.gforge.inria.fr

Evolutionary computation, Swarm intelligence :

population-based metaheuristics

Tabu Search, Simulated Annealing, Hill Climbing: single solution based metaheuristics

Multi-objective metaheuristics

Parallel and distributed metaheuristics

ParadisEO: Module-based architecture

Evolutionary computation, Swarm intelligence: population-based metaheuristics

Tabu Search, Simulated Annealing, Hill Climbing: single solution based metaheuristics

Multi-objective metaheuristics

Parallel and distributed metaheuristics

ParadisEO: Module-based architecture

ParadisEO-EO (Evolving Object)

Available approaches

• Genetic algorithm (GA).• Genetic programming (GP).• Evolution strategies (ES).• Evolutionary algorithm (EA).• Evolutionary programming (EG).• Particle Swarm Optimization (PSO).• Estimation of Distribution Algorithm

(EDA).

Design concepts

• Each metaheuristic has:– generic parts not dedicated to one problem.

– dedicated parts linked to the problem to solve.

• The user:– can directly use the available generic boxes,– has only to code the information dedicated to his

problem.

Needed task: designing a representation Maybe several ways to do this. The

representation must be relevant regards the tackled problem.

The user needs to have: basic representations available. the possibility to use his specific

representation.

Existent basic representations

Tree-based representations(Genetic Programming)

Real-valued representations(Evolutionist Strategies)

String-basedrepresentations

Binarystrings

Realstrings

Scheme of one available algorithm:

the evolutionary algorithm

The Traveling Salesman Problem (TSP)

“Given a collection of N cities and the distance between each pair of them, the TSP aims at finding the shortest route visiting all of the cities”.

Symmetric TSP: candidate solutions. Example:

2

)!1( N

v0

v4v2

v1

8

10

6

9 4

4

6

3

6

5Length: 26 v3

Representation and evaluation

We aim at minimizing the total length of the path:

v5

v3

v4v2

v1

8

10

6

9 4

4

6

3

6

5

Ni Nii VVdist1 mod)1( ),(

1 42 3 5

1 2 3 4 5

1 0 6 9 10 8

2 6 0 4 6 4

3 9 4 0 5 6

4 10 6 5 0 3

5 8 4 6 3 0

Application to the TSP

Path encoding: Every node is assigned a number (e.g. from 0

up to n - 1) and solutions are represented by the ordered sequence of visited nodes.

Scheme of one available algorithm:

the evolutionary algorithm

Scheme of one available algorithm:

the evolutionary algorithm

Scheme of one available algorithm:

the evolutionary algorithm

Scheme of one available algorithm:

the evolutionary algorithm

Scheme of one available algorithm:

the evolutionary algorithm

Scheme of one available algorithm:

the evolutionary algorithm

Scheme of one available algorithm:

the evolutionary algorithm

Scheme of one available algorithm:

the evolutionary algorithm

Scheme of one available algorithm:

the evolutionary algorithm

Implementation of an EA (1/9)

RouteInit route_init; RouteEval full_route_eval;

eoPop <Route> pop (POP_SIZE, route_init);

eoGenContinue <Route> continue (NUM_GEN);

OrderXover crossover;

CitySwap mutation;

eoStochTournamentSelect <Route> select_one;eoSelectNumber <Route> select (select_one, POP_SIZE);

eoSGATransform <Route> transform (cross, CROSS_RATE, mutation, MUT_RATE);

eoPlusReplacement <Route> replace;

eoEasyEA <Route> ea (continue, full_route_eval, select, transform, replace); ea (pop);

Implementation of an EA (2/9)

RouteInit route_init; RouteEval full_route_eval;

eoPop <Route> pop (POP_SIZE, route_init);

eoGenContinue <Route> continue (NUM_GEN);

OrderXover crossover;

CitySwap mutation;

eoStochTournamentSelect <Route> select_one;eoSelectNumber <Route> select (select_one, POP_SIZE);

eoSGATransform <Route> transform (cross, CROSS_RATE, mutation, MUT_RATE);

eoPlusReplacement <Route> replace;

eoEasyEA <Route> ea (continue, full_route_eval, select, transform, replace); ea (pop);

Implementation of an EA (3/9)

RouteInit route_init; RouteEval full_route_eval;

eoPop <Route> pop (POP_SIZE, route_init);

eoGenContinue <Route> continue (NUM_GEN);

OrderXover crossover;

CitySwap mutation;

eoStochTournamentSelect <Route> select_one;eoSelectNumber <Route> select (select_one, POP_SIZE);

eoSGATransform <Route> transform (cross, CROSS_RATE, mutation, MUT_RATE);

eoPlusReplacement <Route> replace;

eoEasyEA <Route> ea (continue, full_route_eval, select, transform, replace); ea (pop);

Implementation of an EA (4/9)

RouteInit route_init; RouteEval full_route_eval;

eoPop <Route> pop (POP_SIZE, route_init);

eoGenContinue <Route> continue (NUM_GEN);

OrderXover crossover;

CitySwap mutation;

eoStochTournamentSelect <Route> select_one;eoSelectNumber <Route> select (select_one, POP_SIZE);

eoSGATransform <Route> transform (cross, CROSS_RATE, mutation, MUT_RATE);

eoPlusReplacement <Route> replace;

eoEasyEA <Route> ea (continue, full_route_eval, select, transform, replace); ea (pop);

Implementation of an EA (5/9)

RouteInit route_init; RouteEval full_route_eval;

eoPop <Route> pop (POP_SIZE, route_init);

eoGenContinue <Route> continue (NUM_GEN);

OrderXover crossover;

CitySwap mutation;

eoStochTournamentSelect <Route> select_one;eoSelectNumber <Route> select (select_one, POP_SIZE);

eoSGATransform <Route> transform (cross, CROSS_RATE, mutation, MUT_RATE);

eoPlusReplacement <Route> replace;

eoEasyEA <Route> ea (continue, full_route_eval, select, transform, replace); ea (pop);

Implementation of an EA (6/9)

RouteInit route_init; RouteEval full_route_eval;

eoPop <Route> pop (POP_SIZE, route_init);

eoGenContinue <Route> continue (NUM_GEN);

OrderXover crossover;

CitySwap mutation;

eoStochTournamentSelect <Route> select_one;eoSelectNumber <Route> select (select_one, POP_SIZE);

eoSGATransform <Route> transform (cross, CROSS_RATE, mutation, MUT_RATE);

eoPlusReplacement <Route> replace;

eoEasyEA <Route> ea (continue, full_route_eval, select, transform, replace); ea (pop);

Implementation of an EA (7/9)

RouteInit route_init; RouteEval full_route_eval;

eoPop <Route> pop (POP_SIZE, route_init);

eoGenContinue <Route> continue (NUM_GEN);

OrderXover crossover;

CitySwap mutation;

eoStochTournamentSelect <Route> select_one;eoSelectNumber <Route> select (select_one, POP_SIZE);

eoSGATransform <Route> transform (cross, CROSS_RATE, mutation, MUT_RATE);

eoPlusReplacement <Route> replace;

eoEasyEA <Route> ea (continue, full_route_eval, select, transform, replace); ea (pop);

Implementation of an EA (8/9)

RouteInit route_init; RouteEval full_route_eval;

eoPop <Route> pop (POP_SIZE, route_init);

eoGenContinue <Route> continue (NUM_GEN);

OrderXover crossover;

CitySwap mutation;

eoStochTournamentSelect <Route> select_one;eoSelectNumber <Route> select (select_one, POP_SIZE);

eoSGATransform <Route> transform (cross, CROSS_RATE, mutation, MUT_RATE);

eoPlusReplacement <Route> replace;

eoEasyEA <Route> ea (continue, full_route_eval, select, transform, replace); ea (pop);

Implementation of an EA (9/9)

RouteInit route_init; RouteEval full_route_eval;

eoPop <Route> pop (POP_SIZE, route_init);

eoGenContinue <Route> continue (NUM_GEN);

OrderXover crossover;

CitySwap mutation;

eoStochTournamentSelect <Route> select_one;eoSelectNumber <Route> select (select_one, POP_SIZE);

eoSGATransform <Route> transform (cross, CROSS_RATE, mutation, MUT_RATE);

eoPlusReplacement <Route> replace;

eoEasyEA <Route> ea (continue, full_route_eval, select, transform, replace); ea (pop);

Other features

• Checkpointing system.

• Configuration file creation and management.

• Visualization tools (link with gnuplot).

• Automatic design tool.

• …

ParadisEO-MO (Moving Object)

Design concepts

• Single solution metaheurisitcs

neighbourhood exploration.

• How can another solution be generated ?

disturbing the current solution

make a movement.

• Base of ParadisEO-MO = moMove.

Available algorithms

Hill ClimbingTabu Search

Simulated Annealing

Design a move for the TSP

• Reminding the chosen coding.

Ordered sequence of visited vertices.

2

2 31 5 4

3

14

1 45 3 2 4 13 5 2

5

• Some relevant moves:– Two-opt, City-swap, LK, etc…

Two-Opt

• Two points within the string are selected and the segment between them is inverted. This operator put in two new edges in the tour.

2 31 5 4

2 35 1 4 23

5

14

23

5

14

Delta = - d(2,1) – d (5,3) + d(2, 5) + d(1, 3)

Hill Climbing

How can a Hill Climbing be built ?• Designing a move operator, its features.• Designing/implementing the operator to build

the first move (and implicitly the first neighboring candidate).

• Designing/implementing the operator to update a given move to its successor.

• Designing/implementing the incremental evaluation function.

• Choosing the neighbour selection strategy.• No continuation criterion (stopping as a local

optimum is reached).

Hill Climbing class

To build the first move

To build the next move

To compute the fitness delta

Full evaluationfunction

Move selectionstrategies

Two-Opt features (1/2)

• TwoOpt a two-opt move is a couple of positions in the sequence of visited nodes.

• TwoOptInit it initializes both

positions to zero !

Two-Opt features (2/2)• TwoOptNext it increments the second

position if possible. Else, it increments the first position, and reinitializes the second position.

• TwoOptIncrEval It computes the new length from the costs of the added/removed edges.

Neighbour selection strategy

• Deterministic/full: choosing the best neighbor (i.e. that improves the most the cost function).

• Deterministic/partial: choosing the first processed neighbour that is better than the current solution.

• Stochastic/full: processing the whole neighborhood and applying a random better one.

Implementation of a Hill ClimbingRoute route; /* One solution */RouteInit route_init; /* Its builds random routes */route_init (route); /* Building a random starting solution */

RouteEval full_route_eval; /* Full route evaluator */

TwoOptInit two_opt_init; /* Initializing the first couple of edges to swap */TwoOptNext two_opt_next; /* Updating a movement */TwoOptIncrEval two_opt_incr_eval; /* Efficiently evaluating a given neighbor */

moBestImprSelect <TwoOpt> two_opt_move_select; /* Movement selection strategy (elitist) */

/* Building the Hill Climbing from those components */moHC <TwoOpt> hill_climbing (two_opt_init, two_opt_next, two_opt_incr_eval, two_opt_move_select, full_route_eval);

/* It applies the HC to the solution */ hill_climbing (route);

Simulated Annealing

How can a Simulated Annealing be built ?

• Designing a move operator, its features.

• Designing/implementing the operator to build a random candidate move.

• Designing/implementing the incremental evaluation function.

• Choosing the cooling schedule strategy.

Independent of the tackled problem

Could be reused from Hill Climbing

Simulated Annealing class

To computethe fitness deltaCooling schedule

strategy

Randommove

generator

Full evaluationfunction

The Two-Opt random move generator• It randomly determines a couple of

random positions !

class TwoOptRand : public moMoveRand<TwoOpt> { public : void operator () (TwoOpt & __move, const Route & __route) ;} ;

To be implemented

Cooling Schedule• Two (basic) strategies are already

implemented: linear and exponential:– Linear temp = temp – x.– Exponential temp = temp * x.

Route route; /* One solution */RouteInit route_init; /* Its builds random routes */route_init (route); /* Building a random starting solution */

RouteEval full_route_eval; /* Full route evaluator */

TwoOptRand two_opt_rand; /* It builds random candidate movements */TwoOptIncrEval two_opt_incr_eval; /* Efficiently evaluating a given neighbor */

moExponentialCoolingSchedule cool_scheme (0.99, 1); /*Cooling schedule and associated parameters */

/* Building the Simulated Annealing from those components */moSA <TwoOpt> simulated_annealing (two_opt_init, two_opt_incr_eval, 100, 100, cool_scheme, full_route_eval);

/* It applies the SA to the solution */ simulated_annealing (route);

Implementation of Simulated Annealing

Factor and threshold

Initial temperature and number of iterations at any step

Tabu Search

How can Tabu Search be built ?• Design a move operator, its features.• Design/implement the operator to build the first

move (and implicitly the first neighboring candidate).• Design/implement the operator to update a given

move to its successor.• Design/implement the incremental evaluation

function.

• Design/implement the Tabu List.• Choosing the aspiration criterion.• Choosing the continuation criterion.

Could be reused from Hill Climbing

Independentof the tackled

problem

Tabu Search class

To buildthe firstmove

To build the next move

To computethe fitness delta

Full evaluationfunction

Tabu List

Aspiration criterion

Continuation criterion

Tabu List

• Predefined structures:– List of tabu solutions or tabu moves storing

the tenure (short term memory).

Choosing an aspiration criterion

• (Basic) implemented strategies:– No aspiration criterion,– A tabu move builds a new solution that updates

the best solution found during the search.

Choosing a stopping criterion

• Use strategies equivalent to those in ParadisEO-EO EA:– An optimum is reached,– A given total number of

iterations,– A given number of gen.

without improvement,– …

Implementing a Tabu SearchRoute route; /* One solution */RouteInit route_init; /* Its builds random routes */route_init (route); /* Building a random starting solution */RouteEval full_route_eval; /* Full route evaluator */

TwoOptInit two_opt_init; /* Initializing the first couple of edges to swap */TwoOptNext two_opt_next; /* Updating a movement */TwoOptIncrEval two_opt_incr_eval; /* Efficiently evaluating a given neighbor */

moNoAspirCrit <TwoOpt> two_opt_aspir_crit; /* Aspiration criterion */moSimpleMoveTabuList <TwoOpt> two_opt_tabu_list; /* Tabu List */

moGenContinue <TwoOpt> continue (10000); /* A fixed number of iter. *//* Building the Tabu Search from those components */moTS <TwoOpt> tabu_search (two_opt_init, two_opt_next, two_opt_incr_eval, two_opt_aspir_crit, two_opt_tabu_list, continue, full_route_eval);

/* It applies the TS to the solution */ tabu_search (route);

EO & MO Hybridizing

• Hybridizing allows to combine:

– The exploration power of population-based metaheuristics.

– The intensification power of single solution-based metaheurisitcs.

Scheme of an EA in ParadisEO-EO

ParadisEO-EO/ParadisEO-MO link

Implementation of an EA

RouteInit route_init; /* Its builds random routes */ RouteEval full_route_eval; /* Full route evaluator */

eoPop <Route> pop (POP_SIZE, route_init); /* Population */eoGenContinue <Route> continue (NUM_GEN); /* A fixed number of iterations */

OrderXover crossover; /* Recombination */CitySwap mutation; /* Mutation */

eoStochTournamentSelect <Route> select_one; /* Stoch. Tournament selection */eoSelectNumber <Route> select (select_one, POP_SIZE);

/* Standard SGA Transformation */eoSGATransform <Route> transform (cross, CROSS_RATE, mutation, MUT_RATE);

eoPlusReplacement <Route> replace; /* replacement */

eoEasyEA <Route> ea (continue, full_route_eval, select, transform, replace); ea (pop); /* Application on the given population */

Implementation of an EA hybridized with a hill climbing

RouteInit route_init; /* Its builds random routes */ RouteEval full_route_eval; /* Full route evaluator */

eoPop <Route> pop (POP_SIZE, route_init); /* Population */eoGenContinue <Route> continue (NUM_GEN); /* A fixed number of iterations */

OrderXover crossover; /* Recombination */moHC <TwoOpt> mutation (two_opt_init, two_opt_next, two_opt_incr_eval, two_opt_move_select,

full_route_eval);

eoStochTournamentSelect <Route> select_one; /* Stoch. Tournament selection */eoSelectNumber <Route> select (select_one, POP_SIZE);/* Standard SGA Transformation */eoSGATransform <Route> transform (cross, CROSS_RATE, mutation, MUT_RATE);

eoPlusReplacement <Route> replace; /* replacement */

eoEA <Route> ea (continue, full_route_eval, select, transform, replace); ea (pop); /* Application on the given population */

Conclusions and Perspectives (1/2)• ParadisEO-EO/MO is a powerful platform to

design high quality optimization methods.

• It can be used by beginners and experts.

• It can be easily extended to suit to the user needs.

• It can be used on Unix and Windows systems

Conclusions and Perspectives (2/2)• Improving the platform:

– adding generic algorithm:• Variable Neighbourhood Search (VNS),• Iterative Local Search (ILS),• Guided Local Search (GLS),• …

– Adding generic boxes:• Other cooling schedule, stopping criteria, …

• Proposing complete methods for classical problems.

Any questions ?Thank you for your attention

• Multi-objective metaheuristics ??? ParadisEO-MOEO.

• Parallel and distributed metaheuristics ??? ParadisEO-PEO.

• ParadisEO web site:http://paradiseo.gforge.inria.fr

• OPAC team web site:http://www.lifl.fr/OPAC