Changeset 15069 for trunk/sources/HeuristicLab.Problems.BinPacking
- Timestamp:
- 06/27/17 13:45:50 (8 years ago)
- Location:
- trunk/sources/HeuristicLab.Problems.BinPacking/3.3
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Problems.BinPacking/3.3/2D/IntegerVectorEncoding/IntegerVectorProblem.cs
r14162 r15069 24 24 using System.Collections.Generic; 25 25 using System.Linq; 26 using HeuristicLab.Analysis; 26 27 using HeuristicLab.Common; 27 28 using HeuristicLab.Core; 28 29 using HeuristicLab.Encodings.IntegerVectorEncoding; 29 30 using HeuristicLab.Optimization; 31 using HeuristicLab.Optimization.Operators; 30 32 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 31 33 … … 52 54 Encoding = new IntegerVectorEncoding(EncodedSolutionName, Items.Count, min: 0, max: LowerBound + 1); // NOTE: assumes that all items can be packed into LowerBound+1 bins 53 55 AddOperators(); 56 Parameterize(); 54 57 RegisterEventHandlers(); 55 58 } … … 63 66 } 64 67 68 protected override void OnEncodingChanged() { 69 base.OnEncodingChanged(); 70 Parameterize(); 71 } 65 72 66 73 private void AddOperators() { 67 68 74 // move operators are not yet supported (TODO) 69 75 Operators.RemoveAll(x => x is SingleObjectiveMoveGenerator); 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 EuclideanSimilarityCalculator()); 80 Operators.Add(new QualitySimilarityCalculator()); 81 Operators.Add(new PopulationSimilarityAnalyzer(Operators.OfType<ISolutionSimilarityCalculator>())); 72 82 73 Encoding.ConfigureOperators(Operators.OfType<IOperator>()); // gkronber: not strictly necessary (only when customer ops are added)83 Encoding.ConfigureOperators(Operators.OfType<IOperator>()); 74 84 } 75 85 76 86 private void RegisterEventHandlers() { 77 87 // update encoding length when number of items is changed 78 ItemsParameter.ValueChanged += (sender, args) => Encoding.Length = Items.Count; 79 LowerBoundParameter.Value.ValueChanged += (sender, args) => { 80 for (int i = 0; i < Encoding.Bounds.Rows; i++) { 81 Encoding.Bounds[i, 1] = LowerBound + 1; 82 } 83 }; 88 ItemsParameter.ValueChanged += (sender, args) => Parameterize(); 89 LowerBoundParameter.Value.ValueChanged += (sender, args) => Parameterize(); 84 90 } 85 91 … … 96 102 return result; 97 103 } 104 105 private void Parameterize() { 106 Encoding.Length = Items.Count; 107 for (int i = 0; i < Encoding.Bounds.Rows; i++) { 108 Encoding.Bounds[i, 1] = LowerBound + 1; 109 } 110 foreach (var similarityCalculator in Operators.OfType<ISolutionSimilarityCalculator>()) { 111 similarityCalculator.SolutionVariableName = Encoding.SolutionCreator.IntegerVectorParameter.ActualName; 112 similarityCalculator.QualityVariableName = Evaluator.QualityParameter.ActualName; 113 } 114 } 98 115 #endregion 99 116 } -
trunk/sources/HeuristicLab.Problems.BinPacking/3.3/2D/PermutationEncoding/PermutationProblem.cs
r14162 r15069 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 } -
trunk/sources/HeuristicLab.Problems.BinPacking/3.3/3D/IntegerVectorEncoding/IntegerVectorProblem.cs
r14167 r15069 24 24 using System.Collections.Generic; 25 25 using System.Linq; 26 using HeuristicLab.Analysis; 26 27 using HeuristicLab.Common; 27 28 using HeuristicLab.Core; 28 29 using HeuristicLab.Encodings.IntegerVectorEncoding; 29 30 using HeuristicLab.Optimization; 31 using HeuristicLab.Optimization.Operators; 30 32 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 31 33 … … 51 53 Encoding = new IntegerVectorEncoding(EncodedSolutionName, Items.Count, min: 0, max: LowerBound + 1); // NOTE: assumes that all items can be packed into LowerBound+1 bins 52 54 AddOperators(); 55 Parameterize(); 53 56 RegisterEventHandlers(); 54 57 } … … 62 65 } 63 66 67 protected override void OnEncodingChanged() { 68 base.OnEncodingChanged(); 69 Parameterize(); 70 } 64 71 65 72 private void AddOperators() { 66 67 73 // move operators are not yet supported (TODO) 68 74 Operators.RemoveAll(x => x is SingleObjectiveMoveGenerator); 69 75 Operators.RemoveAll(x => x is SingleObjectiveMoveMaker); 70 76 Operators.RemoveAll(x => x is SingleObjectiveMoveEvaluator); 77 Operators.Add(new HammingSimilarityCalculator()); 78 Operators.Add(new EuclideanSimilarityCalculator()); 79 Operators.Add(new QualitySimilarityCalculator()); 80 Operators.Add(new PopulationSimilarityAnalyzer(Operators.OfType<ISolutionSimilarityCalculator>())); 71 81 72 82 Encoding.ConfigureOperators(Operators.OfType<IOperator>()); // gkronber: not strictly necessary (only when customer ops are added) … … 75 85 private void RegisterEventHandlers() { 76 86 // update encoding length when number of items is changed 77 ItemsParameter.ValueChanged += (sender, args) => Encoding.Length = Items.Count; 78 LowerBoundParameter.Value.ValueChanged += (sender, args) => { 79 for (int i = 0; i < Encoding.Bounds.Rows; i++) { 80 Encoding.Bounds[i, 1] = LowerBound + 1; 81 } 82 }; 87 ItemsParameter.ValueChanged += (sender, args) => Parameterize(); 88 LowerBoundParameter.Value.ValueChanged += (sender, args) => Parameterize(); 83 89 } 84 90 85 91 #region helpers 86 87 92 public static List<List<int>> GenerateSequenceMatrix(IntegerVector intVec) { 88 93 List<List<int>> result = new List<List<int>>(); … … 95 100 return result; 96 101 } 102 103 private void Parameterize() { 104 Encoding.Length = Items.Count; 105 for (int i = 0; i < Encoding.Bounds.Rows; i++) { 106 Encoding.Bounds[i, 1] = LowerBound + 1; 107 } 108 foreach (var similarityCalculator in Operators.OfType<ISolutionSimilarityCalculator>()) { 109 similarityCalculator.SolutionVariableName = Encoding.SolutionCreator.IntegerVectorParameter.ActualName; 110 similarityCalculator.QualityVariableName = Evaluator.QualityParameter.ActualName; 111 } 112 } 97 113 #endregion 98 114 } -
trunk/sources/HeuristicLab.Problems.BinPacking/3.3/3D/PermutationEncoding/PermutationProblem.cs
r14167 r15069 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 } -
trunk/sources/HeuristicLab.Problems.BinPacking/3.3/HeuristicLab.Problems.BinPacking-3.3.csproj
r14273 r15069 150 150 <ItemGroup /> 151 151 <ItemGroup> 152 <ProjectReference Include="..\..\HeuristicLab.Analysis\3.3\HeuristicLab.Analysis-3.3.csproj"> 153 <Project>{887425B4-4348-49ED-A457-B7D2C26DDBF9}</Project> 154 <Name>HeuristicLab.Analysis-3.3</Name> 155 <Private>False</Private> 156 </ProjectReference> 152 157 <ProjectReference Include="..\..\HeuristicLab.Collections\3.3\HeuristicLab.Collections-3.3.csproj"> 153 158 <Project>{958B43BC-CC5C-4FA2-8628-2B3B01D890B6}</Project> … … 183 188 <Project>{23DA7FF4-D5B8-41B6-AA96-F0561D24F3EE}</Project> 184 189 <Name>HeuristicLab.Operators-3.3</Name> 190 <Private>False</Private> 191 </ProjectReference> 192 <ProjectReference Include="..\..\HeuristicLab.Optimization.Operators\3.3\HeuristicLab.Optimization.Operators-3.3.csproj"> 193 <Project>{25087811-F74C-4128-BC86-8324271DA13E}</Project> 194 <Name>HeuristicLab.Optimization.Operators-3.3</Name> 185 195 <Private>False</Private> 186 196 </ProjectReference> -
trunk/sources/HeuristicLab.Problems.BinPacking/3.3/Plugin.cs.frame
r14174 r15069 28 28 [Plugin("HeuristicLab.Problems.BinPacking", "3.3.14.$WCREV$")] 29 29 [PluginFile("HeuristicLab.Problems.BinPacking-3.3.dll", PluginFileType.Assembly)] 30 [PluginDependency("HeuristicLab.Analysis", "3.3")] 30 31 [PluginDependency("HeuristicLab.Collections", "3.3")] 31 32 [PluginDependency("HeuristicLab.Common", "3.3")] … … 36 37 [PluginDependency("HeuristicLab.Operators", "3.3")] 37 38 [PluginDependency("HeuristicLab.Optimization", "3.3")] 39 [PluginDependency("HeuristicLab.Optimization.Operators", "3.3")] 38 40 [PluginDependency("HeuristicLab.Parameters", "3.3")] 39 41 [PluginDependency("HeuristicLab.Persistence", "3.3")]
Note: See TracChangeset
for help on using the changeset viewer.