#region License Information /* HeuristicLab * Copyright (C) 2002-2010 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.Analysis; using HeuristicLab.Core; using HeuristicLab.Data; using HeuristicLab.Operators; using HeuristicLab.Optimization.Operators; using HeuristicLab.Parameters; using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; using HeuristicLab.Selection; namespace HeuristicLab.Algorithms.SimulatedAnnealing { /// /// An operator which represents a simulated annealing. /// [Item("SimulatedAnnealingMainLoop", "An operator which represents the main loop of a simulated annealing algorithm.")] [StorableClass] public sealed class SimulatedAnnealingMainLoop : AlgorithmOperator { #region Parameter properties public ValueLookupParameter RandomParameter { get { return (ValueLookupParameter)Parameters["Random"]; } } public ValueLookupParameter MaximizationParameter { get { return (ValueLookupParameter)Parameters["Maximization"]; } } public LookupParameter QualityParameter { get { return (LookupParameter)Parameters["Quality"]; } } public LookupParameter MoveQualityParameter { get { return (LookupParameter)Parameters["MoveQuality"]; } } public ValueLookupParameter StartTemperatureParameter { get { return (ValueLookupParameter)Parameters["StartTemperature"]; } } public ValueLookupParameter EndTemperatureParameter { get { return (ValueLookupParameter)Parameters["EndTemperature"]; } } public ValueLookupParameter MaximumIterationsParameter { get { return (ValueLookupParameter)Parameters["MaximumIterations"]; } } public ValueLookupParameter ResultsParameter { get { return (ValueLookupParameter)Parameters["Results"]; } } public ValueLookupParameter MoveGeneratorParameter { get { return (ValueLookupParameter)Parameters["MoveGenerator"]; } } public ValueLookupParameter MoveEvaluatorParameter { get { return (ValueLookupParameter)Parameters["MoveEvaluator"]; } } public ValueLookupParameter MoveMakerParameter { get { return (ValueLookupParameter)Parameters["MoveMaker"]; } } public ValueLookupParameter AnnealingOperatorParameter { get { return (ValueLookupParameter)Parameters["AnnealingOperator"]; } } private ScopeParameter CurrentScopeParameter { get { return (ScopeParameter)Parameters["CurrentScope"]; } } public IScope CurrentScope { get { return CurrentScopeParameter.ActualValue; } } #endregion [StorableConstructor] private SimulatedAnnealingMainLoop(bool deserializing) : base() { } public SimulatedAnnealingMainLoop() : base() { Initialize(); } private void Initialize() { #region Create parameters Parameters.Add(new ValueLookupParameter("Random", "A pseudo random number generator.")); Parameters.Add(new ValueLookupParameter("Maximization", "True if the problem is a maximization problem, otherwise false.")); Parameters.Add(new LookupParameter("Quality", "The value which represents the quality of a solution.")); Parameters.Add(new LookupParameter("MoveQuality", "The value which represents the quality of a move.")); Parameters.Add(new LookupParameter("StartTemperature", "The initial temperature.")); Parameters.Add(new LookupParameter("EndTemperature", "The end temperature.")); Parameters.Add(new ValueLookupParameter("MaximumIterations", "The maximum number of iterations which should be processed.")); Parameters.Add(new ValueLookupParameter("Results", "The variable collection where results should be stored.")); Parameters.Add(new ValueLookupParameter("MoveGenerator", "The operator that generates the moves.")); Parameters.Add(new ValueLookupParameter("MoveEvaluator", "The operator that evaluates a move.")); Parameters.Add(new ValueLookupParameter("MoveMaker", "The operator that performs a move and updates the quality.")); Parameters.Add(new ValueLookupParameter("AnnealingOperator", "The operator that modifies the temperature.")); Parameters.Add(new ScopeParameter("CurrentScope", "The current scope which represents a population of solutions on which the TS should be applied.")); #endregion #region Create operators #endregion #region Create operator graph #endregion } } }