- Timestamp:
- 07/12/17 21:02:01 (7 years ago)
- Location:
- stable
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
stable
- Property svn:mergeinfo changed
/trunk/sources merged: 14412,14475-14476,14659-14660,14663,14912,15050,15067,15069,15079,15162,15166,15172-15173
- Property svn:mergeinfo changed
-
stable/HeuristicLab.Problems.BinPacking/3.3/3D/PermutationEncoding/PermutationProblem.cs
r14170 r15217 23 23 24 24 using System.Linq; 25 using HeuristicLab.Analysis; 25 26 using HeuristicLab.Common; 26 27 using HeuristicLab.Core; 27 28 using HeuristicLab.Encodings.PermutationEncoding; 28 29 using HeuristicLab.Optimization; 30 using HeuristicLab.Optimization.Operators; 29 31 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 30 32 … … 49 51 Encoding = new PermutationEncoding(EncodedSolutionName, Items.Count, PermutationTypes.Absolute); 50 52 AddOperators(); 53 Parameterize(); 51 54 RegisterEventHandlers(); 52 55 } … … 60 63 } 61 64 65 protected override void OnEncodingChanged() { 66 base.OnEncodingChanged(); 67 Parameterize(); 68 } 62 69 63 70 private void AddOperators() { … … 68 75 Operators.RemoveAll(x => x is SingleObjectiveMoveMaker); 69 76 Operators.RemoveAll(x => x is SingleObjectiveMoveEvaluator); 77 Operators.Add(new HammingSimilarityCalculator()); 78 Operators.Add(new QualitySimilarityCalculator()); 79 Operators.Add(new PopulationSimilarityAnalyzer(Operators.OfType<ISolutionSimilarityCalculator>())); 70 80 71 81 Encoding.ConfigureOperators(Operators.OfType<IOperator>()); … … 82 92 private void RegisterEventHandlers() { 83 93 // 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 } 85 103 } 86 104 }
Note: See TracChangeset
for help on using the changeset viewer.