Changeset 3490 for trunk/sources
- Timestamp:
- 04/22/10 17:22:35 (15 years ago)
- Location:
- trunk/sources/HeuristicLab.Algorithms.OffspringSelectionGeneticAlgorithm/3.3
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Algorithms.OffspringSelectionGeneticAlgorithm/3.3/SASEGASA.cs
r3479 r3490 103 103 get { return (ValueLookupParameter<DoubleValue>)Parameters["MaximumSelectionPressure"]; } 104 104 } 105 private ValueLookupParameter<DoubleValue> FinalMaximumSelectionPressureParameter { 106 get { return (ValueLookupParameter<DoubleValue>)Parameters["FinalMaximumSelectionPressure"]; } 107 } 105 108 private ValueLookupParameter<BoolValue> OffspringSelectionBeforeMutationParameter { 106 109 get { return (ValueLookupParameter<BoolValue>)Parameters["OffspringSelectionBeforeMutation"]; } … … 153 156 set { ParallelParameter.Value = value; } 154 157 } 155 p rivateDoubleValue SuccessRatio {158 public DoubleValue SuccessRatio { 156 159 get { return SuccessRatioParameter.Value; } 157 160 set { SuccessRatioParameter.Value = value; } 158 161 } 159 p rivateDoubleValue ComparisonFactorLowerBound {162 public DoubleValue ComparisonFactorLowerBound { 160 163 get { return ComparisonFactorLowerBoundParameter.Value; } 161 164 set { ComparisonFactorLowerBoundParameter.Value = value; } 162 165 } 163 p rivateDoubleValue ComparisonFactorUpperBound {166 public DoubleValue ComparisonFactorUpperBound { 164 167 get { return ComparisonFactorUpperBoundParameter.Value; } 165 168 set { ComparisonFactorUpperBoundParameter.Value = value; } 166 169 } 167 p rivateIDiscreteDoubleValueModifier ComparisonFactorModifier {170 public IDiscreteDoubleValueModifier ComparisonFactorModifier { 168 171 get { return ComparisonFactorModifierParameter.Value; } 169 172 set { ComparisonFactorModifierParameter.Value = value; } 170 173 } 171 p rivateDoubleValue MaximumSelectionPressure {174 public DoubleValue MaximumSelectionPressure { 172 175 get { return MaximumSelectionPressureParameter.Value; } 173 176 set { MaximumSelectionPressureParameter.Value = value; } 174 177 } 175 private BoolValue OffspringSelectionBeforeMutation { 178 public DoubleValue FinalMaximumSelectionPressure { 179 get { return FinalMaximumSelectionPressureParameter.Value; } 180 set { FinalMaximumSelectionPressureParameter.Value = value; } 181 } 182 public BoolValue OffspringSelectionBeforeMutation { 176 183 get { return OffspringSelectionBeforeMutationParameter.Value; } 177 184 set { OffspringSelectionBeforeMutationParameter.Value = value; } … … 216 223 Parameters.Add(new OptionalConstrainedValueParameter<IDiscreteDoubleValueModifier>("ComparisonFactorModifier", "The operator used to modify the comparison factor.", new ItemSet<IDiscreteDoubleValueModifier>(new IDiscreteDoubleValueModifier[] { new LinearDiscreteDoubleValueModifier() }), new LinearDiscreteDoubleValueModifier())); 217 224 Parameters.Add(new ValueLookupParameter<DoubleValue>("MaximumSelectionPressure", "The maximum selection pressure that terminates the algorithm.", new DoubleValue(100))); 225 Parameters.Add(new ValueLookupParameter<DoubleValue>("FinalMaximumSelectionPressure", "The maximum selection pressure used when there is only one village left.", new DoubleValue(100))); 218 226 Parameters.Add(new ValueLookupParameter<BoolValue>("OffspringSelectionBeforeMutation", "True if the offspring selection step should be applied before mutation, false if it should be applied after mutation.", new BoolValue(false))); 219 227 … … 257 265 mainLoop.ComparisonFactorUpperBoundParameter.ActualName = ComparisonFactorUpperBoundParameter.Name; 258 266 mainLoop.MaximumSelectionPressureParameter.ActualName = MaximumSelectionPressureParameter.Name; 267 mainLoop.FinalMaximumSelectionPressureParameter.ActualName = FinalMaximumSelectionPressureParameter.Name; 259 268 mainLoop.MaximumGenerationsParameter.ActualName = MaximumGenerationsParameter.Name; 260 269 mainLoop.OffspringSelectionBeforeMutationParameter.ActualName = OffspringSelectionBeforeMutationParameter.Name; -
trunk/sources/HeuristicLab.Algorithms.OffspringSelectionGeneticAlgorithm/3.3/SASEGASAMainLoop.cs
r3489 r3490 102 102 public ValueLookupParameter<DoubleValue> MaximumSelectionPressureParameter { 103 103 get { return (ValueLookupParameter<DoubleValue>)Parameters["MaximumSelectionPressure"]; } 104 } 105 public ValueLookupParameter<DoubleValue> FinalMaximumSelectionPressureParameter { 106 get { return (ValueLookupParameter<DoubleValue>)Parameters["FinalMaximumSelectionPressure"]; } 104 107 } 105 108 public ValueLookupParameter<IntValue> MaximumGenerationsParameter { … … 136 139 Parameters.Add(new ValueLookupParameter<IOperator>("ComparisonFactorModifier", "The operator used to modify the comparison factor.")); 137 140 Parameters.Add(new ValueLookupParameter<DoubleValue>("MaximumSelectionPressure", "The maximum selection pressure that terminates the algorithm.")); 141 Parameters.Add(new ValueLookupParameter<DoubleValue>("FinalMaximumSelectionPressure", "The maximum selection pressure used when there is only one village left.")); 138 142 Parameters.Add(new ValueLookupParameter<IntValue>("MaximumGenerations", "The maximum genreation that terminates the algorithm.")); 139 143 Parameters.Add(new ValueLookupParameter<BoolValue>("OffspringSelectionBeforeMutation", "True if the offspring selection step should be applied before mutation, false if it should be applied after mutation.")); … … 142 146 #region Create operators 143 147 VariableCreator variableCreator = new VariableCreator(); 148 Assigner maxSelPressAssigner = new Assigner(); 144 149 Assigner villageCountAssigner = new Assigner(); 145 150 Assigner comparisonFactorInitializer = new Assigner(); … … 171 176 IntCounter villageMaximumGenerationsCounter = new IntCounter(); 172 177 DataTableValuesCollector selPressValuesCollector2 = new DataTableValuesCollector(); 173 Comparator villageCountComparator = new Comparator();174 ConditionalBranch villageTerminationCondition 0= new ConditionalBranch();178 Comparator villageCountComparator1 = new Comparator(); 179 ConditionalBranch villageTerminationCondition1 = new ConditionalBranch(); 175 180 SASEGASAReunificator reunificator = new SASEGASAReunificator(); 176 181 IntCounter reunificationCounter = new IntCounter(); 177 182 Placeholder comparisonFactorModifier = new Placeholder(); 183 Comparator villageCountComparator2 = new Comparator(); 184 ConditionalBranch villageTerminationCondition2 = new ConditionalBranch(); 185 Assigner finalMaxSelPressAssigner = new Assigner(); 178 186 Comparator maximumGenerationsComparator = new Comparator(); 179 187 BestQualityMemorizer bestQualityMemorizer3 = new BestQualityMemorizer(); … … 181 189 DataTableValuesCollector dataTableValuesCollector2 = new DataTableValuesCollector(); 182 190 QualityDifferenceCalculator qualityDifferenceCalculator2 = new QualityDifferenceCalculator(); 183 ConditionalBranch villagesTerminationCondition = new ConditionalBranch();191 ConditionalBranch villagesTerminationCondition3 = new ConditionalBranch(); 184 192 ConditionalBranch maximumGenerationsTerminationCondition = new ConditionalBranch(); 185 193 … … 189 197 villageCountAssigner.LeftSideParameter.ActualName = "VillageCount"; 190 198 villageCountAssigner.RightSideParameter.ActualName = NumberOfVillagesParameter.Name; 199 200 maxSelPressAssigner.LeftSideParameter.ActualName = "CurrentMaximumSelectionPressure"; 201 maxSelPressAssigner.RightSideParameter.ActualName = MaximumSelectionPressureParameter.Name; 191 202 192 203 comparisonFactorInitializer.LeftSideParameter.ActualName = "ComparisonFactor"; … … 269 280 mainLoop.ComparisonFactorModifierParameter.Value = new EmptyOperator(); // comparison factor is modified here 270 281 mainLoop.ComparisonFactorUpperBoundParameter.ActualName = ComparisonFactorUpperBoundParameter.Name; 271 mainLoop.MaximumSelectionPressureParameter.ActualName = MaximumSelectionPressureParameter.Name;282 mainLoop.MaximumSelectionPressureParameter.ActualName = "CurrentMaximumSelectionPressure"; 272 283 mainLoop.OffspringSelectionBeforeMutationParameter.ActualName = OffspringSelectionBeforeMutationParameter.Name; 273 284 … … 306 317 307 318 // if there's just one island left and we're getting to this point SASEGASA terminates 308 villageCountComparator .Name = "VillageCount <= 1 ?";309 villageCountComparator .LeftSideParameter.ActualName = "VillageCount";310 villageCountComparator .RightSideParameter.Value = new IntValue(1);311 villageCountComparator .Comparison.Value = ComparisonType.LessOrEqual;312 villageCountComparator .ResultParameter.ActualName = "TerminateVillages";313 314 villageTerminationCondition 0.Name = "Skip reunification?";315 villageTerminationCondition 0.ConditionParameter.ActualName = "TerminateVillages";319 villageCountComparator1.Name = "VillageCount <= 1 ?"; 320 villageCountComparator1.LeftSideParameter.ActualName = "VillageCount"; 321 villageCountComparator1.RightSideParameter.Value = new IntValue(1); 322 villageCountComparator1.Comparison.Value = ComparisonType.LessOrEqual; 323 villageCountComparator1.ResultParameter.ActualName = "TerminateVillages"; 324 325 villageTerminationCondition1.Name = "Skip reunification?"; 326 villageTerminationCondition1.ConditionParameter.ActualName = "TerminateVillages"; 316 327 317 328 reunificator.VillageCountParameter.ActualName = "VillageCount"; … … 321 332 322 333 comparisonFactorModifier.OperatorParameter.ActualName = ComparisonFactorModifierParameter.Name; 334 335 villageCountComparator2.Name = "VillageCount == 1 ?"; 336 villageCountComparator2.LeftSideParameter.ActualName = "VillageCount"; 337 villageCountComparator2.RightSideParameter.Value = new IntValue(1); 338 villageCountComparator2.Comparison.Value = ComparisonType.Equal; 339 villageCountComparator2.ResultParameter.ActualName = "ChangeMaxSelPress"; 340 341 villageTerminationCondition2.Name = "Change max selection pressure?"; 342 villageTerminationCondition2.ConditionParameter.ActualName = "ChangeMaxSelPress"; 343 344 finalMaxSelPressAssigner.LeftSideParameter.ActualName = "CurrentMaximumSelectionPressure"; 345 finalMaxSelPressAssigner.RightSideParameter.ActualName = FinalMaximumSelectionPressureParameter.Name; 323 346 324 347 // if SASEGASAGenerations is reaching MaximumGenerations we're also terminating … … 350 373 qualityDifferenceCalculator2.SecondQualityParameter.ActualName = "BestQuality"; 351 374 352 villagesTerminationCondition .ConditionParameter.ActualName = "TerminateVillages";375 villagesTerminationCondition3.ConditionParameter.ActualName = "TerminateVillages"; 353 376 villageMaximumGenerationsConditionalBranch1.ConditionParameter.ActualName = "TerminateMaximumGenerations"; 354 377 #endregion … … 357 380 OperatorGraph.InitialOperator = variableCreator; 358 381 variableCreator.Successor = villageCountAssigner; 359 villageCountAssigner.Successor = comparisonFactorInitializer; 382 villageCountAssigner.Successor = maxSelPressAssigner; 383 maxSelPressAssigner.Successor = comparisonFactorInitializer; 360 384 comparisonFactorInitializer.Successor = ussp0; 361 385 ussp0.Operator = islandVariableCreator; … … 389 413 villageMaximumGenerationsToGenerationsAssigner.Successor = villageMaximumGenerationsCounter; 390 414 villageMaximumGenerationsCounter.Successor = null; 391 selPressValuesCollector2.Successor = villageCountComparator ;392 villageCountComparator .Successor = villageTerminationCondition0;393 villageTerminationCondition 0.TrueBranch = null;394 villageTerminationCondition 0.FalseBranch = reunificator;395 villageTerminationCondition 0.Successor = maximumGenerationsComparator;415 selPressValuesCollector2.Successor = villageCountComparator1; 416 villageCountComparator1.Successor = villageTerminationCondition1; 417 villageTerminationCondition1.TrueBranch = null; 418 villageTerminationCondition1.FalseBranch = reunificator; 419 villageTerminationCondition1.Successor = maximumGenerationsComparator; 396 420 reunificator.Successor = reunificationCounter; 397 421 reunificationCounter.Successor = comparisonFactorModifier; 398 comparisonFactorModifier.Successor = null; 422 comparisonFactorModifier.Successor = villageCountComparator2; 423 villageCountComparator2.Successor = villageTerminationCondition2; 424 villageTerminationCondition2.TrueBranch = finalMaxSelPressAssigner; 425 villageTerminationCondition2.FalseBranch = null; 426 villageTerminationCondition2.Successor = null; 427 finalMaxSelPressAssigner.Successor = null; 399 428 maximumGenerationsComparator.Successor = bestQualityMemorizer3; 400 429 bestQualityMemorizer3.Successor = bestAverageWorstQualityCalculator3; 401 430 bestAverageWorstQualityCalculator3.Successor = dataTableValuesCollector2; 402 431 dataTableValuesCollector2.Successor = qualityDifferenceCalculator2; 403 qualityDifferenceCalculator2.Successor = villagesTerminationCondition ;404 villagesTerminationCondition .FalseBranch = maximumGenerationsTerminationCondition;405 villagesTerminationCondition .TrueBranch = null;406 villagesTerminationCondition .Successor = null;432 qualityDifferenceCalculator2.Successor = villagesTerminationCondition3; 433 villagesTerminationCondition3.FalseBranch = maximumGenerationsTerminationCondition; 434 villagesTerminationCondition3.TrueBranch = null; 435 villagesTerminationCondition3.Successor = null; 407 436 maximumGenerationsTerminationCondition.FalseBranch = fixedReunificationStepConditionInitializer; 408 437 maximumGenerationsTerminationCondition.TrueBranch = null;
Note: See TracChangeset
for help on using the changeset viewer.