Changeset 11513
- Timestamp:
- 10/30/14 14:47:32 (10 years ago)
- Location:
- branches/VOSGA/HeuristicLab.Algorithms.VOffspringSelectionGeneticAlgorithm
- Files:
-
- 1 added
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/VOSGA/HeuristicLab.Algorithms.VOffspringSelectionGeneticAlgorithm/HeuristicLab.Algorithms.VOffspringSelectionGeneticAlgorithm-3.3.csproj
r11511 r11513 161 161 </ItemGroup> 162 162 <ItemGroup> 163 <Compile Include="ISubScopesQualityComparatorOperator.cs" /> 163 164 <Compile Include="OffspringCollector.cs" /> 164 165 <Compile Include="OffspringSelectors\IOffspringSelector.cs" /> … … 171 172 <Compile Include="VOffspringSelectionGeneticAlgorithmMainLoop.cs" /> 172 173 <Compile Include="VOffspringSelectionGeneticAlgorithmMainOperator.cs" /> 174 <Compile Include="WeightedParentsQualityComparator.cs" /> 173 175 </ItemGroup> 174 176 <ItemGroup> -
branches/VOSGA/HeuristicLab.Algorithms.VOffspringSelectionGeneticAlgorithm/VOffspringSelectionGeneticAlgorithm.cs
r11510 r11513 118 118 get { return (IConstrainedValueParameter<IOffspringSelector>)Parameters["OffspringSelector"]; } 119 119 } 120 public ConstrainedValueParameter<ISubScopesQualityComparatorOperator> SubScopesQualityComparatorParameter { 121 get { return (ConstrainedValueParameter<ISubScopesQualityComparatorOperator>)Parameters["SubScopesQualityComparator"]; } 122 } 120 123 #endregion 121 124 … … 205 208 set { FillPopulationWithParentsParameter.Value.Value = value; } 206 209 } 210 public ISubScopesQualityComparatorOperator SubScopesQualityComparator { 211 get { return SubScopesQualityComparatorParameter.Value; } 212 set { SubScopesQualityComparatorParameter.Value = value; } 213 } 214 207 215 private RandomCreator RandomCreator { 208 216 get { return (RandomCreator)OperatorGraph.InitialOperator; } … … 272 280 Parameters.Add(new FixedValueParameter<BoolValue>("FillPopulationWithParents", "True if the population should be filled with parent individual or false if worse children should be used when the maximum selection pressure is exceeded.", new BoolValue(false)) { Hidden = true }); 273 281 Parameters.Add(new ConstrainedValueParameter<IOffspringSelector>("OffspringSelector", "The operator used as selection criterea for deciding which individuals are successful and which should be disgarded.")); 274 282 Parameters.Add(new ConstrainedValueParameter<ISubScopesQualityComparatorOperator>("SubScopesQualityComparator", "The operator used to compare solution candidates with.")); 275 283 276 284 RandomCreator randomCreator = new RandomCreator(); … … 336 344 ParameterizeOffspringSelectors(); 337 345 346 foreach (ISubScopesQualityComparatorOperator comparator in ApplicationManager.Manager.GetInstances<ISubScopesQualityComparatorOperator>().OrderBy(x => x.Name)) 347 SubScopesQualityComparatorParameter.ValidValues.Add(comparator); 348 ISubScopesQualityComparatorOperator standardComparator = SubScopesQualityComparatorParameter.ValidValues.FirstOrDefault(x => x.GetType().Name.Equals("WeightedParentsQualityComparator")); 349 if (standardComparator != null) SubScopesQualityComparatorParameter.Value = standardComparator; 350 ParameterizeSubScopesQualityComparators(); 351 338 352 qualityAnalyzer = new BestAverageWorstQualityAnalyzer(); 339 353 selectionPressureAnalyzer = new ValueAnalyzer(); … … 362 376 UpdateMutators(); 363 377 UpdateAnalyzers(); 378 ParameterizeSubScopesQualityComparators(); 379 ParameterizeOffspringSelectors(); 364 380 Problem.Evaluator.QualityParameter.ActualNameChanged += new EventHandler(Evaluator_QualityParameter_ActualNameChanged); 365 381 base.OnProblemChanged(); … … 457 473 selector.SuccessfulOffspringParameter.ActualName = "SuccessfulOffspring"; 458 474 selector.FillPopulationWithParentsParameter.ActualName = FillPopulationWithParentsParameter.Name; 475 } 476 } 477 private void ParameterizeSubScopesQualityComparators() { 478 foreach (var comp in SubScopesQualityComparatorParameter.ValidValues) { 479 comp.ComparisonFactorParameter.ActualName = "ComparisonFactor"; 480 if (Problem != null) { 481 comp.LeftSideParameter.ActualName = Problem.Evaluator.QualityParameter.Name; 482 comp.MaximizationParameter.ActualName = Problem.MaximizationParameter.Name; 483 comp.RightSideParameter.ActualName = Problem.Evaluator.QualityParameter.Name; 484 } 485 comp.ResultParameter.ActualName = "SuccessfulOffspring"; 459 486 } 460 487 } -
branches/VOSGA/HeuristicLab.Algorithms.VOffspringSelectionGeneticAlgorithm/VOffspringSelectionGeneticAlgorithmMainOperator.cs
r11510 r11513 93 93 public ValueLookupParameter<IOffspringSelector> OffspringSelectorParameter { 94 94 get { return (ValueLookupParameter<IOffspringSelector>)Parameters["OffspringSelector"]; } 95 } 96 public ValueLookupParameter<ISubScopesQualityComparatorOperator> SubScopesQualityComparatorParameter { 97 get { return (ValueLookupParameter<ISubScopesQualityComparatorOperator>)Parameters["SubScopesQualityComparator"]; } 95 98 } 96 99 #endregion … … 142 145 Parameters.Add(new ValueLookupParameter<BoolValue>("FillPopulationWithParents", "True if the population should be filled with parent individual or false if worse children should be used when the maximum selection pressure is exceeded.")); 143 146 Parameters.Add(new ValueLookupParameter<IOffspringSelector>("OffspringSelector", "The operator used as selection criterea for deciding which individuals are successful and which should be disgarded.")); 147 Parameters.Add(new ValueLookupParameter<ISubScopesQualityComparatorOperator>("SubScopesQualityComparator", "The operator used to compare solution candidates.")); 144 148 #endregion 145 149 … … 154 158 Placeholder evaluator1 = new Placeholder(); 155 159 SubScopesCounter subScopesCounter1 = new SubScopesCounter(); 156 WeightedParentsQualityComparator qualityComparer1 = new WeightedParentsQualityComparator();160 Placeholder qualityComparer1 = new Placeholder(); 157 161 SubScopesRemover subScopesRemover1 = new SubScopesRemover(); 158 162 UniformSubScopesProcessor uniformSubScopesProcessor3 = new UniformSubScopesProcessor(); … … 174 178 Placeholder evaluator3 = new Placeholder(); 175 179 SubScopesCounter subScopesCounter3 = new SubScopesCounter(); 176 WeightedParentsQualityComparator qualityComparer2 = new WeightedParentsQualityComparator();180 Placeholder qualityComparer2 = new Placeholder(); 177 181 SubScopesRemover subScopesRemover2 = new SubScopesRemover(); 178 182 Placeholder offspringSelector = new Placeholder(); … … 208 212 subScopesCounter1.ValueParameter.ActualName = EvaluatedSolutionsParameter.Name; 209 213 210 qualityComparer1.ComparisonFactorParameter.ActualName = ComparisonFactorParameter.Name; 211 qualityComparer1.LeftSideParameter.ActualName = QualityParameter.Name; 212 qualityComparer1.MaximizationParameter.ActualName = MaximizationParameter.Name; 213 qualityComparer1.RightSideParameter.ActualName = QualityParameter.Name; 214 qualityComparer1.ResultParameter.ActualName = "SuccessfulOffspring"; 214 qualityComparer1.Name = "Quality Comparator (placeholder)"; 215 qualityComparer1.OperatorParameter.ActualName = SubScopesQualityComparatorParameter.ActualName; 215 216 216 217 subScopesRemover1.RemoveAllSubScopes = true; … … 257 258 subScopesCounter3.ValueParameter.ActualName = EvaluatedSolutionsParameter.Name; 258 259 259 qualityComparer2.ComparisonFactorParameter.ActualName = ComparisonFactorParameter.Name; 260 qualityComparer2.LeftSideParameter.ActualName = QualityParameter.Name; 261 qualityComparer2.MaximizationParameter.ActualName = MaximizationParameter.Name; 262 qualityComparer2.RightSideParameter.ActualName = QualityParameter.Name; 263 qualityComparer2.ResultParameter.ActualName = "SuccessfulOffspring"; 260 qualityComparer2.Name = "Quality Comparator (placeholder)"; 261 qualityComparer2.OperatorParameter.ActualName = SubScopesQualityComparatorParameter.ActualName; 264 262 265 263 subScopesRemover2.RemoveAllSubScopes = true;
Note: See TracChangeset
for help on using the changeset viewer.