- Timestamp:
- 07/12/17 21:02:01 (8 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/2D/PermutationEncoding/PermutationProblem.cs
r14162 r15217 23 23 24 24 using System.Linq; 25 using System.Windows.Forms;25 using HeuristicLab.Analysis; 26 26 using HeuristicLab.Common; 27 27 using HeuristicLab.Core; 28 28 using HeuristicLab.Encodings.PermutationEncoding; 29 29 using HeuristicLab.Optimization; 30 using HeuristicLab.Optimization.Operators; 30 31 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 31 32 … … 51 52 Encoding = new PermutationEncoding(EncodedSolutionName, Items.Count, PermutationTypes.Absolute); 52 53 AddOperators(); 54 Parameterize(); 53 55 RegisterEventHandlers(); 54 56 } … … 62 64 } 63 65 66 protected override void OnEncodingChanged() { 67 base.OnEncodingChanged(); 68 Parameterize(); 69 } 64 70 65 71 private void AddOperators() { … … 70 76 Operators.RemoveAll(x => x is SingleObjectiveMoveMaker); 71 77 Operators.RemoveAll(x => x is SingleObjectiveMoveEvaluator); 78 Operators.Add(new HammingSimilarityCalculator()); 79 Operators.Add(new QualitySimilarityCalculator()); 80 Operators.Add(new PopulationSimilarityAnalyzer(Operators.OfType<ISolutionSimilarityCalculator>())); 72 81 73 82 Encoding.ConfigureOperators(Operators.OfType<IOperator>()); … … 83 92 private void RegisterEventHandlers() { 84 93 // update encoding length when number of items is changed 85 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 } 86 103 } 87 104 }
Note: See TracChangeset
for help on using the changeset viewer.