1 | #region License Information
|
---|
2 | /* HeuristicLab
|
---|
3 | * Copyright (C) 2002-2010 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
|
---|
4 | *
|
---|
5 | * This file is part of HeuristicLab.
|
---|
6 | *
|
---|
7 | * HeuristicLab is free software: you can redistribute it and/or modify
|
---|
8 | * it under the terms of the GNU General Public License as published by
|
---|
9 | * the Free Software Foundation, either version 3 of the License, or
|
---|
10 | * (at your option) any later version.
|
---|
11 | *
|
---|
12 | * HeuristicLab is distributed in the hope that it will be useful,
|
---|
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
---|
15 | * GNU General Public License for more details.
|
---|
16 | *
|
---|
17 | * You should have received a copy of the GNU General Public License
|
---|
18 | * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
|
---|
19 | */
|
---|
20 | #endregion
|
---|
21 |
|
---|
22 | using HeuristicLab.Analysis;
|
---|
23 | using HeuristicLab.Core;
|
---|
24 | using HeuristicLab.Data;
|
---|
25 | using HeuristicLab.Operators;
|
---|
26 | using HeuristicLab.Optimization.Operators;
|
---|
27 | using HeuristicLab.Parameters;
|
---|
28 | using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
|
---|
29 | using HeuristicLab.Selection;
|
---|
30 |
|
---|
31 | namespace HeuristicLab.Algorithms.SimulatedAnnealing {
|
---|
32 | /// <summary>
|
---|
33 | /// An operator which represents a simulated annealing.
|
---|
34 | /// </summary>
|
---|
35 | [Item("SimulatedAnnealingMainLoop", "An operator which represents the main loop of a simulated annealing algorithm.")]
|
---|
36 | [StorableClass]
|
---|
37 | public sealed class SimulatedAnnealingMainLoop : AlgorithmOperator {
|
---|
38 | #region Parameter properties
|
---|
39 | public ValueLookupParameter<IRandom> RandomParameter {
|
---|
40 | get { return (ValueLookupParameter<IRandom>)Parameters["Random"]; }
|
---|
41 | }
|
---|
42 | public ValueLookupParameter<BoolValue> MaximizationParameter {
|
---|
43 | get { return (ValueLookupParameter<BoolValue>)Parameters["Maximization"]; }
|
---|
44 | }
|
---|
45 | public LookupParameter<DoubleValue> QualityParameter {
|
---|
46 | get { return (LookupParameter<DoubleValue>)Parameters["Quality"]; }
|
---|
47 | }
|
---|
48 | public LookupParameter<DoubleValue> MoveQualityParameter {
|
---|
49 | get { return (LookupParameter<DoubleValue>)Parameters["MoveQuality"]; }
|
---|
50 | }
|
---|
51 | public ValueLookupParameter<DoubleValue> StartTemperatureParameter {
|
---|
52 | get { return (ValueLookupParameter<DoubleValue>)Parameters["StartTemperature"]; }
|
---|
53 | }
|
---|
54 | public ValueLookupParameter<DoubleValue> EndTemperatureParameter {
|
---|
55 | get { return (ValueLookupParameter<DoubleValue>)Parameters["EndTemperature"]; }
|
---|
56 | }
|
---|
57 | public ValueLookupParameter<IntValue> MaximumIterationsParameter {
|
---|
58 | get { return (ValueLookupParameter<IntValue>)Parameters["MaximumIterations"]; }
|
---|
59 | }
|
---|
60 | public ValueLookupParameter<VariableCollection> ResultsParameter {
|
---|
61 | get { return (ValueLookupParameter<VariableCollection>)Parameters["Results"]; }
|
---|
62 | }
|
---|
63 | public ValueLookupParameter<IOperator> MoveGeneratorParameter {
|
---|
64 | get { return (ValueLookupParameter<IOperator>)Parameters["MoveGenerator"]; }
|
---|
65 | }
|
---|
66 | public ValueLookupParameter<IOperator> MoveEvaluatorParameter {
|
---|
67 | get { return (ValueLookupParameter<IOperator>)Parameters["MoveEvaluator"]; }
|
---|
68 | }
|
---|
69 | public ValueLookupParameter<IOperator> MoveMakerParameter {
|
---|
70 | get { return (ValueLookupParameter<IOperator>)Parameters["MoveMaker"]; }
|
---|
71 | }
|
---|
72 | public ValueLookupParameter<IOperator> AnnealingOperatorParameter {
|
---|
73 | get { return (ValueLookupParameter<IOperator>)Parameters["AnnealingOperator"]; }
|
---|
74 | }
|
---|
75 |
|
---|
76 | private ScopeParameter CurrentScopeParameter {
|
---|
77 | get { return (ScopeParameter)Parameters["CurrentScope"]; }
|
---|
78 | }
|
---|
79 | public IScope CurrentScope {
|
---|
80 | get { return CurrentScopeParameter.ActualValue; }
|
---|
81 | }
|
---|
82 | #endregion
|
---|
83 |
|
---|
84 | [StorableConstructor]
|
---|
85 | private SimulatedAnnealingMainLoop(bool deserializing) : base() { }
|
---|
86 | public SimulatedAnnealingMainLoop()
|
---|
87 | : base() {
|
---|
88 | Initialize();
|
---|
89 | }
|
---|
90 |
|
---|
91 | private void Initialize() {
|
---|
92 | #region Create parameters
|
---|
93 | Parameters.Add(new ValueLookupParameter<IRandom>("Random", "A pseudo random number generator."));
|
---|
94 | Parameters.Add(new ValueLookupParameter<BoolValue>("Maximization", "True if the problem is a maximization problem, otherwise false."));
|
---|
95 | Parameters.Add(new LookupParameter<DoubleValue>("Quality", "The value which represents the quality of a solution."));
|
---|
96 | Parameters.Add(new LookupParameter<DoubleValue>("MoveQuality", "The value which represents the quality of a move."));
|
---|
97 | Parameters.Add(new LookupParameter<DoubleValue>("StartTemperature", "The initial temperature."));
|
---|
98 | Parameters.Add(new LookupParameter<DoubleValue>("EndTemperature", "The end temperature."));
|
---|
99 | Parameters.Add(new ValueLookupParameter<IntValue>("MaximumIterations", "The maximum number of iterations which should be processed."));
|
---|
100 | Parameters.Add(new ValueLookupParameter<VariableCollection>("Results", "The variable collection where results should be stored."));
|
---|
101 |
|
---|
102 | Parameters.Add(new ValueLookupParameter<IOperator>("MoveGenerator", "The operator that generates the moves."));
|
---|
103 | Parameters.Add(new ValueLookupParameter<IOperator>("MoveEvaluator", "The operator that evaluates a move."));
|
---|
104 | Parameters.Add(new ValueLookupParameter<IOperator>("MoveMaker", "The operator that performs a move and updates the quality."));
|
---|
105 | Parameters.Add(new ValueLookupParameter<IOperator>("AnnealingOperator", "The operator that modifies the temperature."));
|
---|
106 |
|
---|
107 | Parameters.Add(new ScopeParameter("CurrentScope", "The current scope which represents a population of solutions on which the TS should be applied."));
|
---|
108 | #endregion
|
---|
109 |
|
---|
110 | #region Create operators
|
---|
111 | #endregion
|
---|
112 |
|
---|
113 | #region Create operator graph
|
---|
114 | #endregion
|
---|
115 | }
|
---|
116 | }
|
---|
117 | }
|
---|