Changeset 12113


Ignore:
Timestamp:
03/04/15 09:29:58 (6 years ago)
Author:
jkarder
Message:

#2332: quality and no-similarity calculators are added only if they are not present

Location:
trunk/sources
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Algorithms.RAPGA/3.3/RAPGA.cs

    r12106 r12113  
    510510        SimilarityCalculatorParameter.ValidValues.Add(similarityCalculator);
    511511
    512       if (!SimilarityCalculatorParameter.ValidValues.Any()) {
    513         SimilarityCalculatorParameter.ValidValues.Add(new QualitySimilarityCalculator { QualityVariableName = Problem.Evaluator.QualityParameter.ActualName });
     512      if (!SimilarityCalculatorParameter.ValidValues.OfType<QualitySimilarityCalculator>().Any())
     513        SimilarityCalculatorParameter.ValidValues.Add(new QualitySimilarityCalculator {
     514          QualityVariableName = Problem.Evaluator.QualityParameter.ActualName
     515        });
     516      if (!SimilarityCalculatorParameter.ValidValues.OfType<NoSimilarityCalculator>().Any())
    514517        SimilarityCalculatorParameter.ValidValues.Add(new NoSimilarityCalculator());
    515       }
    516518
    517519      if (oldSimilarityCalculator != null) {
  • trunk/sources/HeuristicLab.Algorithms.ScatterSearch/3.3/ScatterSearch.cs

    r12106 r12113  
    410410        SimilarityCalculatorParameter.ValidValues.Add(similarityCalculator);
    411411
    412       if (!SimilarityCalculatorParameter.ValidValues.Any()) {
    413         SimilarityCalculatorParameter.ValidValues.Add(new QualitySimilarityCalculator { QualityVariableName = Problem.Evaluator.QualityParameter.ActualName });
     412      if (!SimilarityCalculatorParameter.ValidValues.OfType<QualitySimilarityCalculator>().Any())
     413        SimilarityCalculatorParameter.ValidValues.Add(new QualitySimilarityCalculator {
     414          QualityVariableName = Problem.Evaluator.QualityParameter.ActualName
     415        });
     416      if (!SimilarityCalculatorParameter.ValidValues.OfType<NoSimilarityCalculator>().Any())
    414417        SimilarityCalculatorParameter.ValidValues.Add(new NoSimilarityCalculator());
    415       }
    416418
    417419      if (oldSimilarityCalculator != null) {
Note: See TracChangeset for help on using the changeset viewer.