Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
07/12/17 21:02:01 (7 years ago)
Author:
abeham
Message:

#2666, #2706, #2730, #2736: merged revisions 14412, 14475, 14476, 14659, 14660, 14663, 14779, 14780, 14912, 15050, 15067, 15069, 15079, 15162, 15166, 15172, 15173 to stable

Location:
stable
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • stable

  • stable/HeuristicLab.Problems.BinPacking/3.3/3D/PermutationEncoding/PermutationProblem.cs

    r14170 r15217  
    2323
    2424using System.Linq;
     25using HeuristicLab.Analysis;
    2526using HeuristicLab.Common;
    2627using HeuristicLab.Core;
    2728using HeuristicLab.Encodings.PermutationEncoding;
    2829using HeuristicLab.Optimization;
     30using HeuristicLab.Optimization.Operators;
    2931using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    3032
     
    4951      Encoding = new PermutationEncoding(EncodedSolutionName, Items.Count, PermutationTypes.Absolute);
    5052      AddOperators();
     53      Parameterize();
    5154      RegisterEventHandlers();
    5255    }
     
    6063    }
    6164
     65    protected override void OnEncodingChanged() {
     66      base.OnEncodingChanged();
     67      Parameterize();
     68    }
    6269
    6370    private void AddOperators() {
     
    6875      Operators.RemoveAll(x => x is SingleObjectiveMoveMaker);
    6976      Operators.RemoveAll(x => x is SingleObjectiveMoveEvaluator);
     77      Operators.Add(new HammingSimilarityCalculator());
     78      Operators.Add(new QualitySimilarityCalculator());
     79      Operators.Add(new PopulationSimilarityAnalyzer(Operators.OfType<ISolutionSimilarityCalculator>()));
    7080
    7181      Encoding.ConfigureOperators(Operators.OfType<IOperator>());
     
    8292    private void RegisterEventHandlers() {
    8393      // update encoding length when number of items is changed
    84       ItemsParameter.ValueChanged += (sender, args) => Encoding.Length = Items.Count;
     94      ItemsParameter.ValueChanged += (sender, args) => Parameterize();
     95    }
     96
     97    private void Parameterize() {
     98      Encoding.Length = Items.Count;
     99      foreach (var similarityCalculator in Operators.OfType<ISolutionSimilarityCalculator>()) {
     100        similarityCalculator.SolutionVariableName = Encoding.SolutionCreator.PermutationParameter.ActualName;
     101        similarityCalculator.QualityVariableName = Evaluator.QualityParameter.ActualName;
     102      }
    85103    }
    86104  }
Note: See TracChangeset for help on using the changeset viewer.