HeuristicLab 3.0 Modeling EAs
Modeling Algorithms what is an algorithm? 3 main aspects instructions sequence of execution result we have to model operators modifying data graphs of operators representing the sequence of execution "A finite set of unambiguous instructions performed in a prescribed sequence to achieve a goal, especially a mathematical rule or procedure used to compute a desired result. Algorithms are the basis for most computer programming." © The American Heritage Dictionary of the English Language
Modeling Algorithms scopes operators form an n-ary tree structure contain variables operators form a graph structure represent basic instructions of algorithms manipulate scopes (modify variables and/or sub-scopes) decide which operators are executed next
Modeling Algorithms basic operators EmptyOperator does nothing SequentialProcessor, ParallelProcessor executes its sub-operators on its scope SequentialSubScopesProcessor, ParallelSubScopesProcessor executes all its sub-operators on the corresponding sub-scopes UniformSequentialSubScopesProcessor, UniformParallelSubScopesProcessor executes its first sub-operator on all sub-scopes ConditionalBranch depending on a boolean value executes its first or second sub-operator on its scope StochasticBranch with a predefined probability executes its first or second sub-operator on its scope VariableInjector injects its local variables into the scope Sorter sorts its sub-scopes depending on a sorting criterion
Modeling Evolutionary Algorithms abstract EA basic operations initialization, evaluation, selection, crossover, mutation, replacement Initialization Terminate? Selection Crossover Mutation Evaluation Replacement
Modeling Evolutionary Algorithms scopes form a hierarchical structure very suitable for representing hierarchical structure of EA populations a scope may represent a population, a solution, a part of a solution, … operators work on different levels to switch levels use (Uniform)SequentialSubScopesProcessor (Uniform)ParallelSubScopesProcessor … Meta-Population Level Population Level Solution Level Sub-Solution Level
Initialization set global variables create sub-scopes inject variables representing global parameters of an algorithm population size, mutation rate, number of elites, number of generations, … VariableInjector inject PRNG RandomInjector use special operators to inject variables representing the problem instance for example: TSPInjector create sub-scopes one sub-scope for each population, individual, etc. SubScopesCreater initialize populations, individuals, etc. use sub-scopes processors to iterate over all sub-scopes apply special operators to create randomly generated individuals for example: RandomPermutationGenerator
Evaluation calculate and inject quality value for each individual use sub-scopes processors to iterate over all scopes representing an individual apply problem-specific evaluation operator for example: RoundedEuclideanPathTSPEvaluator SingleObjectiveEvaluatorBase base class for all single-objective evaluation operators evaluates the quality value of an individual depending on the variables in the scope by calling abstract method Evaluate adds a new double variable "Quality" to the scope if a quality value already exists it is overwritten
TSP SGA Example … PRNG TSP Data Population Size Mutation Rate Elites Evaluated Solutions … SequentialProcessor RandomInjector PRNG TSP Data PRNG TSPInjector TSPRoundedEuclidean DistanceMatrixInjector … VariableInjector Permutation Quality Permutation SubScopesCreater UniformSequential SubScopesProcessor SequentialProcessor RandomPermutation Generator DistanceMatrixPathTSP Evaluator Counter Sorter Main Loop
Selection separate sub-scopes into two groups insert a new level in the scope tree copy/move selected sub-scopes use sub-scopes processors to work on selected scopes basic selection operators LeftSelector, RightSelector, RandomSelector copy/move n sub-scopes from left or right or randomly quality-based selection operators selection is based on a double value (quality) in each sub-scope ProportionalSelector, LinearRankSelector, TournamentSelector
Selection … Remaining Selected
Crossover & Mutation depend on solution encoding crossover mutation effect variables contained in scopes crossover merge groups of n sub-scopes to one new sub-scope for example: SinglePointCrossover, OrderCrossover mutation manipulate a scope for example: FlipManipulator, InversionManipulator
TSP SGA Example … S … R S … R S … R S … R S … R S … R S … R Main Loop ProportionalSelector SequentialSubScopes Processor EmptyOperator Replacement SequentialProcessor OrderCrossover Termination ? UniformSequential SubScopesProcessor Sorter … Parents S … R Selected S … R Selected S … R Children S … R Selected S … R Children S … R Children S … R Children SequentialProcessor StochasticBranch InversionManipulator DistanceMatrixPathTSP Evaluator Counter
Reduction reverse operation to selection join sub-scopes again remove level in the scope tree move sub-scopes on level up basic reduction operators LeftReducer, RightReducer, MergingReducer take sub-scopes from left, right or all groups …
Replacement merge parents and children use selection/reduction operators select parents that should stay and discard all others (elitism) select children that should replace and discard all others merge both groups
TSP SGA Example … R S … R S … … … … … … … … R S … R S Replacement SequentialSubScopes Processor SequentialProcessor LeftSelector RightReducer SequentialProcessor RightSelector LeftReducer MergingReducer … R S … R S … … … Remaining Children … Next Generation … Remaining Parents … Children Parents … Children Parents … R S … R S Sorter
Modularization operator graphs grow quite quickly and become hard to handle modularization of operator graphs is necessary use special operator that wraps a whole operator graph algorithms contain problem-specific parts for example: TSPInjector, RandomPermutationGenerator, DistanceMatrixPathTSPEvaluator, … how to build a generic SGA template that can be parameterized with all necessary problem-specific operators? CombinedOperator contains an operator graph may inject its sub-operators into its scope executes the whole operator graph on its scope OperatorExtractor placeholder operator extracts and executes an operator with a predefined name from the scope variable lookup goes up in the scope tree until a matching operator is found
DistanceMatrixPathTSP TSP SGA Example CombinedOperator TSPInjector RandomPermutation Generator DistanceMatrixPathTSP Evaluator CombinedOperator SequentialProcessor RandomInjector ProblemInitializer VariableInjector SubScopesCreater UniformSequential SubScopesProcessor SolutionGenerator Evaluator Counter Sorter
Demonstration