Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
03/03/15 11:18:07 (10 years ago)
Author:
bburlacu
Message:

#2276: Merged trunk changes.

Location:
branches/HeuristicLab.DatasetRefactor/sources
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • branches/HeuristicLab.DatasetRefactor/sources

  • branches/HeuristicLab.DatasetRefactor/sources/HeuristicLab.Problems.Knapsack/3.3/KnapsackProblem.cs

    r12031 r12105  
    2929using HeuristicLab.Encodings.BinaryVectorEncoding;
    3030using HeuristicLab.Optimization;
     31using HeuristicLab.Optimization.Operators;
    3132using HeuristicLab.Parameters;
    3233using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
     
    8182    private BestKnapsackSolutionAnalyzer BestKnapsackSolutionAnalyzer {
    8283      get { return Operators.OfType<BestKnapsackSolutionAnalyzer>().FirstOrDefault(); }
    83     }
    84     private SingleObjectivePopulationDiversityAnalyzer SingleObjectivePopulationDiversityAnalyzer {
    85       get { return Operators.OfType<SingleObjectivePopulationDiversityAnalyzer>().FirstOrDefault(); }
    8684    }
    8785    #endregion
     
    248246        BestKnapsackSolutionAnalyzer.ValuesParameter.Hidden = true;
    249247      }
    250 
    251       if (SingleObjectivePopulationDiversityAnalyzer != null) {
    252         SingleObjectivePopulationDiversityAnalyzer.MaximizationParameter.ActualName = MaximizationParameter.Name;
    253         SingleObjectivePopulationDiversityAnalyzer.QualityParameter.ActualName = Evaluator.QualityParameter.ActualName;
    254         SingleObjectivePopulationDiversityAnalyzer.ResultsParameter.ActualName = "Results";
    255         SingleObjectivePopulationDiversityAnalyzer.SimilarityCalculator = Operators.OfType<KnapsackSimilarityCalculator>().SingleOrDefault();
    256       }
    257248    }
    258249    private void InitializeOperators() {
     
    261252      Operators.Add(new KnapsackSimultaneousPathRelinker());
    262253      Operators.Add(new KnapsackSimilarityCalculator());
     254      Operators.Add(new QualitySimilarityCalculator { QualityVariableName = SolutionCreator.BinaryVectorParameter.ActualName });
     255      Operators.Add(new NoSimilarityCalculator());
    263256
    264257      Operators.Add(new BestKnapsackSolutionAnalyzer());
    265       Operators.Add(new SingleObjectivePopulationDiversityAnalyzer());
     258      Operators.Add(new PopulationSimilarityAnalyzer(Operators.OfType<ISolutionSimilarityCalculator>()));
    266259      ParameterizeAnalyzer();
    267260      foreach (IBinaryVectorOperator op in ApplicationManager.Manager.GetInstances<IBinaryVectorOperator>()) {
  • branches/HeuristicLab.DatasetRefactor/sources/HeuristicLab.Problems.Knapsack/3.3/SimilarityCalculators/KnapsackSimilarityCalculator.cs

    r12031 r12105  
    3535  [Item("KnapsackSimilarityCalculator", "An operator that performs similarity calculation between two knapsack solutions. The operator calculates the similarity based on the number of elements the two solutions have in common.")]
    3636  public sealed class KnapsackSimilarityCalculator : SingleObjectiveSolutionSimilarityCalculator {
     37    protected override bool IsCommutative { get { return true; } }
     38
    3739    private KnapsackSimilarityCalculator(bool deserializing) : base(deserializing) { }
    3840    private KnapsackSimilarityCalculator(KnapsackSimilarityCalculator original, Cloner cloner) : base(original, cloner) { }
Note: See TracChangeset for help on using the changeset viewer.