public SimulatedAnnealingImprovementOperator() : base() { loop = new SimulatedAnnealingMainLoop(); qualityAnalyzer = new BestAverageWorstQualityAnalyzer(); Parameters.Add(new LookupParameter <IRandom>("Random", "The random number generator to use.")); Parameters.Add(new ConstrainedValueParameter <IMoveGenerator>("MoveGenerator", "The operator used to generate moves to the neighborhood of the current solution.")); Parameters.Add(new ConstrainedValueParameter <IMoveMaker>("MoveMaker", "The operator used to perform a move.")); Parameters.Add(new ConstrainedValueParameter <ISingleObjectiveMoveEvaluator>("MoveEvaluator", "The operator used to evaluate a move.")); Parameters.Add(new ValueLookupParameter <IntValue>("MaximumIterations", "The maximum number of generations which should be processed.", new IntValue(150))); Parameters.Add(new ValueLookupParameter <IntValue>("InnerIterations", "Number of moves that MultiMoveGenerators should create. This is ignored for Exhaustive- and SingleMoveGenerators.", new IntValue(1500))); Parameters.Add(new LookupParameter <IntValue>("EvaluatedSolutions", "The number of evaluated moves.")); Parameters.Add(new ValueParameter <MultiAnalyzer>("Analyzer", "The operator used to analyze the solution.", new MultiAnalyzer())); Parameters.Add(new ValueParameter <DoubleValue>("StartTemperature", "The initial temperature.", new DoubleValue(100))); Parameters.Add(new ValueParameter <DoubleValue>("EndTemperature", "The final temperature which should be reached when iterations reaches maximum iterations.", new DoubleValue(1e-6))); Parameters.Add(new ConstrainedValueParameter <IDiscreteDoubleValueModifier>("AnnealingOperator", "The operator used to modify the temperature.")); Parameters.Add(new LookupParameter <ResultCollection>("Results", "The variable where the results are stored.")); Parameters.Add(new ScopeTreeLookupParameter <DoubleValue>("Quality", "The quality/fitness value of a solution.")); foreach (IDiscreteDoubleValueModifier op in ApplicationManager.Manager.GetInstances <IDiscreteDoubleValueModifier>().OrderBy(x => x.Name)) { AnnealingOperatorParameter.ValidValues.Add(op); } ParameterizeAnnealingOperators(); ParameterizeSAMainLoop(); RegisterEventHandlers(); }
private SimulatedAnnealingImprovementOperator(SimulatedAnnealingImprovementOperator original, Cloner cloner) : base(original, cloner) { this.problem = cloner.Clone(original.problem); this.loop = cloner.Clone(original.loop); this.qualityAnalyzer = cloner.Clone(original.qualityAnalyzer); RegisterEventHandlers(); }
public SimulatedAnnealing() : base() { Parameters.Add(new ValueParameter<IntValue>("Seed", "The random seed used to initialize the new pseudo random number generator.", new IntValue(0))); Parameters.Add(new ValueParameter<BoolValue>("SetSeedRandomly", "True if the random seed should be set to a random value, otherwise false.", new BoolValue(true))); Parameters.Add(new ConstrainedValueParameter<IMultiMoveGenerator>("MoveGenerator", "The operator used to generate moves to the neighborhood of the current solution.")); Parameters.Add(new ConstrainedValueParameter<ISingleObjectiveMoveEvaluator>("MoveEvaluator", "The operator used to evaluate a move.")); Parameters.Add(new ConstrainedValueParameter<IMoveMaker>("MoveMaker", "The operator used to perform a move.")); Parameters.Add(new ConstrainedValueParameter<IDiscreteDoubleValueModifier>("AnnealingOperator", "The operator used to modify the temperature.")); Parameters.Add(new ValueParameter<IntValue>("MaximumIterations", "The maximum number of generations which should be processed.", new IntValue(100))); Parameters.Add(new ValueParameter<IntValue>("InnerIterations", "The amount of inner iterations (number of moves before temperature is adjusted again).", new IntValue(10))); Parameters.Add(new ValueParameter<DoubleValue>("StartTemperature", "The initial temperature.", new DoubleValue(100))); Parameters.Add(new ValueParameter<DoubleValue>("EndTemperature", "The final temperature which should be reached when iterations reaches maximum iterations.", new DoubleValue(1e-6))); Parameters.Add(new ValueParameter<MultiAnalyzer>("Analyzer", "The operator used to analyze each generation.", new MultiAnalyzer())); RandomCreator randomCreator = new RandomCreator(); SolutionsCreator solutionsCreator = new SolutionsCreator(); VariableCreator variableCreator = new VariableCreator(); ResultsCollector resultsCollector = new ResultsCollector(); SimulatedAnnealingMainLoop mainLoop = new SimulatedAnnealingMainLoop(); OperatorGraph.InitialOperator = randomCreator; randomCreator.RandomParameter.ActualName = "Random"; randomCreator.SeedParameter.ActualName = SeedParameter.Name; randomCreator.SeedParameter.Value = null; randomCreator.SetSeedRandomlyParameter.ActualName = SetSeedRandomlyParameter.Name; randomCreator.SetSeedRandomlyParameter.Value = null; randomCreator.Successor = solutionsCreator; solutionsCreator.NumberOfSolutions = new IntValue(1); solutionsCreator.Successor = variableCreator; variableCreator.Name = "Initialize EvaluatedMoves"; variableCreator.CollectedValues.Add(new ValueParameter<IntValue>("EvaluatedMoves", new IntValue())); variableCreator.CollectedValues.Add(new ValueParameter<IntValue>("Iterations", new IntValue(0))); variableCreator.Successor = resultsCollector; resultsCollector.CollectedValues.Add(new LookupParameter<IntValue>("Evaluated Moves", null, "EvaluatedMoves")); resultsCollector.ResultsParameter.ActualName = "Results"; resultsCollector.Successor = mainLoop; mainLoop.MoveGeneratorParameter.ActualName = MoveGeneratorParameter.Name; mainLoop.MoveEvaluatorParameter.ActualName = MoveEvaluatorParameter.Name; mainLoop.MoveMakerParameter.ActualName = MoveMakerParameter.Name; mainLoop.AnnealingOperatorParameter.ActualName = AnnealingOperatorParameter.Name; mainLoop.MaximumIterationsParameter.ActualName = MaximumIterationsParameter.Name; mainLoop.TemperatureParameter.ActualName = "Temperature"; mainLoop.StartTemperatureParameter.ActualName = StartTemperatureParameter.Name; mainLoop.EndTemperatureParameter.ActualName = EndTemperatureParameter.Name; mainLoop.RandomParameter.ActualName = RandomCreator.RandomParameter.ActualName; mainLoop.ResultsParameter.ActualName = "Results"; mainLoop.AnalyzerParameter.ActualName = AnalyzerParameter.Name; mainLoop.EvaluatedMovesParameter.ActualName = "EvaluatedMoves"; mainLoop.IterationsParameter.ActualName = "Iterations"; foreach (IDiscreteDoubleValueModifier op in ApplicationManager.Manager.GetInstances<IDiscreteDoubleValueModifier>().OrderBy(x => x.Name)) AnnealingOperatorParameter.ValidValues.Add(op); ParameterizeAnnealingOperators(); qualityAnalyzer = new QualityAnalyzer(); temperatureAnalyzer = new SingleValueAnalyzer(); temperatureAnalyzer.Name = "TemperatureAnalyzer"; ParameterizeAnalyzers(); UpdateAnalyzers(); Initialize(); }
private SimulatedAnnealingMainLoop(SimulatedAnnealingMainLoop original, Cloner cloner) : base(original, cloner) { }
public SimulatedAnnealing() : base() { Parameters.Add(new ValueParameter <IntValue>("Seed", "The random seed used to initialize the new pseudo random number generator.", new IntValue(0))); Parameters.Add(new ValueParameter <BoolValue>("SetSeedRandomly", "True if the random seed should be set to a random value, otherwise false.", new BoolValue(true))); Parameters.Add(new ConstrainedValueParameter <IMultiMoveGenerator>("MoveGenerator", "The operator used to generate moves to the neighborhood of the current solution.")); Parameters.Add(new ConstrainedValueParameter <ISingleObjectiveMoveEvaluator>("MoveEvaluator", "The operator used to evaluate a move.")); Parameters.Add(new ConstrainedValueParameter <IMoveMaker>("MoveMaker", "The operator used to perform a move.")); Parameters.Add(new ConstrainedValueParameter <IDiscreteDoubleValueModifier>("AnnealingOperator", "The operator used to modify the temperature.")); Parameters.Add(new ValueParameter <IntValue>("MaximumIterations", "The maximum number of generations which should be processed.", new IntValue(100))); Parameters.Add(new ValueParameter <IntValue>("InnerIterations", "The amount of inner iterations (number of moves before temperature is adjusted again).", new IntValue(10))); Parameters.Add(new ValueParameter <DoubleValue>("StartTemperature", "The initial temperature.", new DoubleValue(100))); Parameters.Add(new ValueParameter <DoubleValue>("EndTemperature", "The final temperature which should be reached when iterations reaches maximum iterations.", new DoubleValue(1e-6))); Parameters.Add(new ValueParameter <MultiAnalyzer>("Analyzer", "The operator used to analyze each generation.", new MultiAnalyzer())); RandomCreator randomCreator = new RandomCreator(); SolutionsCreator solutionsCreator = new SolutionsCreator(); VariableCreator variableCreator = new VariableCreator(); ResultsCollector resultsCollector = new ResultsCollector(); SimulatedAnnealingMainLoop mainLoop = new SimulatedAnnealingMainLoop(); OperatorGraph.InitialOperator = randomCreator; randomCreator.RandomParameter.ActualName = "Random"; randomCreator.SeedParameter.ActualName = SeedParameter.Name; randomCreator.SeedParameter.Value = null; randomCreator.SetSeedRandomlyParameter.ActualName = SetSeedRandomlyParameter.Name; randomCreator.SetSeedRandomlyParameter.Value = null; randomCreator.Successor = solutionsCreator; solutionsCreator.NumberOfSolutions = new IntValue(1); solutionsCreator.Successor = variableCreator; variableCreator.Name = "Initialize EvaluatedMoves"; variableCreator.CollectedValues.Add(new ValueParameter <IntValue>("EvaluatedMoves", new IntValue())); variableCreator.CollectedValues.Add(new ValueParameter <IntValue>("Iterations", new IntValue(0))); variableCreator.Successor = resultsCollector; resultsCollector.CollectedValues.Add(new LookupParameter <IntValue>("Evaluated Moves", null, "EvaluatedMoves")); resultsCollector.ResultsParameter.ActualName = "Results"; resultsCollector.Successor = mainLoop; mainLoop.MoveGeneratorParameter.ActualName = MoveGeneratorParameter.Name; mainLoop.MoveEvaluatorParameter.ActualName = MoveEvaluatorParameter.Name; mainLoop.MoveMakerParameter.ActualName = MoveMakerParameter.Name; mainLoop.AnnealingOperatorParameter.ActualName = AnnealingOperatorParameter.Name; mainLoop.MaximumIterationsParameter.ActualName = MaximumIterationsParameter.Name; mainLoop.TemperatureParameter.ActualName = "Temperature"; mainLoop.StartTemperatureParameter.ActualName = StartTemperatureParameter.Name; mainLoop.EndTemperatureParameter.ActualName = EndTemperatureParameter.Name; mainLoop.RandomParameter.ActualName = RandomCreator.RandomParameter.ActualName; mainLoop.ResultsParameter.ActualName = "Results"; mainLoop.AnalyzerParameter.ActualName = AnalyzerParameter.Name; mainLoop.EvaluatedMovesParameter.ActualName = "EvaluatedMoves"; mainLoop.IterationsParameter.ActualName = "Iterations"; foreach (IDiscreteDoubleValueModifier op in ApplicationManager.Manager.GetInstances <IDiscreteDoubleValueModifier>().OrderBy(x => x.Name)) { AnnealingOperatorParameter.ValidValues.Add(op); } ParameterizeAnnealingOperators(); qualityAnalyzer = new QualityAnalyzer(); temperatureAnalyzer = new SingleValueAnalyzer(); temperatureAnalyzer.Name = "TemperatureAnalyzer"; ParameterizeAnalyzers(); UpdateAnalyzers(); Initialize(); }
public SimulatedAnnealingImprovementOperator() : base() { loop = new SimulatedAnnealingMainLoop(); qualityAnalyzer = new BestAverageWorstQualityAnalyzer(); Parameters.Add(new LookupParameter<IRandom>("Random", "The random number generator to use.")); Parameters.Add(new ConstrainedValueParameter<IMoveGenerator>("MoveGenerator", "The operator used to generate moves to the neighborhood of the current solution.")); Parameters.Add(new ConstrainedValueParameter<IMoveMaker>("MoveMaker", "The operator used to perform a move.")); Parameters.Add(new ConstrainedValueParameter<ISingleObjectiveMoveEvaluator>("MoveEvaluator", "The operator used to evaluate a move.")); Parameters.Add(new ValueLookupParameter<IntValue>("MaximumIterations", "The maximum number of generations which should be processed.", new IntValue(150))); Parameters.Add(new ValueLookupParameter<IntValue>("InnerIterations", "Number of moves that MultiMoveGenerators should create. This is ignored for Exhaustive- and SingleMoveGenerators.", new IntValue(1500))); Parameters.Add(new LookupParameter<IntValue>("EvaluatedSolutions", "The number of evaluated moves.")); Parameters.Add(new ValueParameter<MultiAnalyzer>("Analyzer", "The operator used to analyze the solution.", new MultiAnalyzer())); Parameters.Add(new ValueParameter<DoubleValue>("StartTemperature", "The initial temperature.", new DoubleValue(100))); Parameters.Add(new ValueParameter<DoubleValue>("EndTemperature", "The final temperature which should be reached when iterations reaches maximum iterations.", new DoubleValue(1e-6))); Parameters.Add(new ConstrainedValueParameter<IDiscreteDoubleValueModifier>("AnnealingOperator", "The operator used to modify the temperature.")); Parameters.Add(new LookupParameter<ResultCollection>("Results", "The variable where the results are stored.")); Parameters.Add(new ScopeTreeLookupParameter<DoubleValue>("Quality", "The quality/fitness value of a solution.")); foreach (IDiscreteDoubleValueModifier op in ApplicationManager.Manager.GetInstances<IDiscreteDoubleValueModifier>().OrderBy(x => x.Name)) AnnealingOperatorParameter.ValidValues.Add(op); ParameterizeAnnealingOperators(); ParameterizeSAMainLoop(); RegisterEventHandlers(); }