#region License Information /* HeuristicLab * Copyright (C) 2002-2015 Heuristic and Evolutionary Algorithms Laboratory (HEAL) * * This file is part of HeuristicLab. * * HeuristicLab is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * HeuristicLab is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with HeuristicLab. If not, see . */ #endregion using HeuristicLab.Common; using HeuristicLab.Core; using HeuristicLab.Data; using HeuristicLab.Operators; using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; using HeuristicLab.Selection; namespace HeuristicLab.Algorithms.ALPS.SteadyState { [Item("AlpsSsGeneticAlgorithmMainOperator", "")] [StorableClass] public class AlpsSsGeneticAlgorithmMainOperator : AlgorithmOperator { [StorableConstructor] private AlpsSsGeneticAlgorithmMainOperator(bool deserializing) : base(deserializing) { } private AlpsSsGeneticAlgorithmMainOperator(AlpsSsGeneticAlgorithmMainOperator original, Cloner cloner) : base(original, cloner) { } public override IDeepCloneable Clone(Cloner cloner) { return new AlpsSsGeneticAlgorithmMainOperator(this, cloner); } public AlpsSsGeneticAlgorithmMainOperator() : base() { var selector = new Placeholder() { Name = "Selector (Placeholder)" }; var reducer = new RightReducer(); var crossover = new Placeholder() { Name = "Crossover (Placeholder)" }; var mutationBranch = new StochasticBranch(); var mutator = new Placeholder() { Name = "Mutator (Placeholder)" }; var ageReducer = new DataReducer() { Name = "Calculate EvalsCreated" }; var subScopesRemover = new SubScopesRemover(); var evaluator = new Placeholder() { Name = "Evaluator (Placeholder)" }; OperatorGraph.InitialOperator = selector; selector.OperatorParameter.ActualName = "Selector"; selector.Successor = reducer; reducer.Successor = crossover; crossover.OperatorParameter.ActualName = "Crossover"; crossover.Successor = mutationBranch; mutationBranch.ProbabilityParameter.ActualName = "MutationProbability"; mutationBranch.RandomParameter.ActualName = "Random"; mutationBranch.FirstBranch = mutator; mutationBranch.Successor = ageReducer; mutator.OperatorParameter.ActualName = "Mutator"; ageReducer.ParameterToReduce.ActualName = "EvalsCreated"; ageReducer.ReductionOperation.ActualName = "AgeInheritance"; ageReducer.ReductionOperation.Value = null; ageReducer.TargetParameter.ActualName = "EvalsCreated"; ageReducer.TargetOperation.Value = new ReductionOperation(ReductionOperations.Assign); ageReducer.Successor = subScopesRemover; subScopesRemover.Successor = evaluator; evaluator.OperatorParameter.ActualName = "Evaluator"; } } }