Changeset 3094 for trunk/sources/HeuristicLab.Algorithms.SimulatedAnnealing/3.3/SimulatedAnnealingMainLoop.cs
- Timestamp:
- 03/18/10 02:03:30 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Algorithms.SimulatedAnnealing/3.3/SimulatedAnnealingMainLoop.cs
r3093 r3094 95 95 Parameters.Add(new LookupParameter<DoubleValue>("Quality", "The value which represents the quality of a solution.")); 96 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."));97 Parameters.Add(new ValueLookupParameter<DoubleValue>("StartTemperature", "The initial temperature.")); 98 Parameters.Add(new ValueLookupParameter<DoubleValue>("EndTemperature", "The end temperature.")); 99 99 Parameters.Add(new ValueLookupParameter<IntValue>("MaximumIterations", "The maximum number of iterations which should be processed.")); 100 100 Parameters.Add(new ValueLookupParameter<VariableCollection>("Results", "The variable collection where results should be stored.")); … … 109 109 110 110 #region Create operators 111 VariableCreator variableCreator = new VariableCreator(); 112 BestQualityMemorizer initializeBestQuality = new BestQualityMemorizer(); 113 SequentialSubScopesProcessor sssp = new SequentialSubScopesProcessor(); 114 ResultsCollector resultsCollector = new ResultsCollector(); 115 BestQualityMemorizer bestQualityMemorizer = new BestQualityMemorizer(); 116 Placeholder annealingOperator = new Placeholder(); 117 UniformSequentialSubScopesProcessor mainProcessor = new UniformSequentialSubScopesProcessor(); 118 Placeholder moveGenerator = new Placeholder(); 119 SequentialSubScopesProcessor moveEvaluationProcessor = new SequentialSubScopesProcessor(); 120 Placeholder moveEvaluator = new Placeholder(); 121 ProbabilisticQualityComparator qualityComparator = new ProbabilisticQualityComparator(); 122 ConditionalBranch improvesQualityBranch = new ConditionalBranch(); 123 Placeholder moveMaker = new Placeholder(); 124 SubScopesRemover subScopesRemover = new SubScopesRemover(); 125 DataTableValuesCollector valuesCollector = new DataTableValuesCollector(); 126 IntCounter iterationsCounter = new IntCounter(); 127 Comparator iterationsComparator = new Comparator(); 128 ConditionalBranch iterationsTermination = new ConditionalBranch(); 129 EmptyOperator finished = new EmptyOperator(); 130 131 variableCreator.CollectedValues.Add(new ValueParameter<IntValue>("Iterations", new IntValue(0))); 132 variableCreator.CollectedValues.Add(new ValueParameter<DataTable>("Qualities", new DataTable("Qualities"))); 133 variableCreator.CollectedValues.Add(new ValueParameter<DoubleValue>("Temperature", new DoubleValue(double.MaxValue))); 134 135 resultsCollector.CollectedValues.Add(new LookupParameter<IntValue>("Iterations")); 136 resultsCollector.CollectedValues.Add(new LookupParameter<DoubleValue>("Quality")); 137 resultsCollector.CollectedValues.Add(new LookupParameter<DoubleValue>("Best Quality") { ActualName = "BestQuality" }); 138 resultsCollector.CollectedValues.Add(new LookupParameter<DataTable>("Qualities")); 139 resultsCollector.CollectedValues.Add(new LookupParameter<DoubleValue>("Temperature")); 140 141 annealingOperator.Name = "Annealing operator (placeholder)"; 142 annealingOperator.OperatorParameter.ActualName = "AnnealingOperator"; 143 144 moveGenerator.Name = "Move generator (placeholder)"; 145 moveGenerator.OperatorParameter.ActualName = "MoveGenerator"; 146 147 moveEvaluator.Name = "Move evaluator (placeholder)"; 148 moveEvaluator.OperatorParameter.ActualName = "MoveEvaluator"; 149 150 qualityComparator.LeftSideParameter.ActualName = "MoveQuality"; 151 qualityComparator.RightSideParameter.ActualName = "Quality"; 152 qualityComparator.ResultParameter.ActualName = "IsBetter"; 153 qualityComparator.DampeningParameter.ActualName = "Temperature"; 154 155 improvesQualityBranch.ConditionParameter.ActualName = "IsBetter"; 156 157 moveMaker.Name = "Move maker (placeholder)"; 158 moveMaker.OperatorParameter.ActualName = "MoveMaker"; 159 160 subScopesRemover.RemoveAllSubScopes = true; 161 162 valuesCollector.CollectedValues.Add(new LookupParameter<DoubleValue>("Quality")); 163 valuesCollector.CollectedValues.Add(new LookupParameter<DoubleValue>("BestQuality")); 164 valuesCollector.DataTableParameter.ActualName = "Qualities"; 165 166 iterationsCounter.Name = "Increment Iterations"; 167 iterationsCounter.Increment = new IntValue(1); 168 iterationsCounter.ValueParameter.ActualName = "Iterations"; 169 170 iterationsComparator.Name = "Iterations >= MaximumIterations"; 171 iterationsComparator.LeftSideParameter.ActualName = "Iterations"; 172 iterationsComparator.RightSideParameter.ActualName = "MaximumIterations"; 173 iterationsComparator.ResultParameter.ActualName = "IterationsCondition"; 174 iterationsComparator.Comparison.Value = ComparisonType.GreaterOrEqual; 175 176 iterationsTermination.Name = "Iterations termination condition"; 177 iterationsTermination.ConditionParameter.ActualName = "IterationsCondition"; 178 179 finished.Name = "Finished"; 111 180 #endregion 112 181 113 182 #region Create operator graph 183 OperatorGraph.InitialOperator = variableCreator; 184 variableCreator.Successor = initializeBestQuality; 185 initializeBestQuality.Successor = sssp; 186 sssp.Operators.Add(resultsCollector); 187 sssp.Successor = bestQualityMemorizer; 188 bestQualityMemorizer.Successor = annealingOperator; 189 annealingOperator.Successor = mainProcessor; 190 mainProcessor.Operator = moveGenerator; 191 mainProcessor.Successor = valuesCollector; 192 moveGenerator.Successor = moveEvaluationProcessor; 193 moveEvaluationProcessor.Operators.Add(moveEvaluator); 194 moveEvaluationProcessor.Successor = subScopesRemover; 195 moveEvaluator.Successor = qualityComparator; 196 qualityComparator.Successor = improvesQualityBranch; 197 improvesQualityBranch.TrueBranch = moveMaker; 198 valuesCollector.Successor = iterationsCounter; 199 iterationsCounter.Successor = iterationsComparator; 200 iterationsComparator.Successor = iterationsTermination; 201 iterationsTermination.TrueBranch = finished; 202 iterationsTermination.FalseBranch = bestQualityMemorizer; 114 203 #endregion 115 204 }
Note: See TracChangeset
for help on using the changeset viewer.