Changeset 14050 for branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking/3.3/Evaluators
- Timestamp:
- 07/12/16 20:35:19 (9 years ago)
- Location:
- branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking/3.3/Evaluators
- Files:
-
- 4 edited
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking/3.3/Evaluators/BinUtilizationRegularIdenticalBinEvaluator.cs
r14048 r14050 28 28 29 29 namespace HeuristicLab.Problems.BinPacking { 30 [Item("Bin-Utilization Regular Identical-Bin Evaluator", "<Description missing> Found in Lee:2010")]30 [Item("Bin-Utilization Evaluator", "<Description missing> Found in Lee:2010")] // TODO 31 31 [StorableClass] 32 public abstract class BinUtilization RegularIdenticalBinEvaluator<D, B, I> : RegularSimpleRotationIdenticalBinPackingPlanEvaluator<D, B, I>32 public abstract class BinUtilizationEvaluator<D, B, I> : EvaluatorBase<D, B, I> 33 33 where D : class, IPackingPosition 34 34 where B : PackingShape<D> … … 36 36 37 37 [StorableConstructor] 38 protected BinUtilization RegularIdenticalBinEvaluator(bool deserializing) : base(deserializing) { }39 protected BinUtilization RegularIdenticalBinEvaluator(BinUtilizationRegularIdenticalBinEvaluator<D, B, I> original, Cloner cloner)38 protected BinUtilizationEvaluator(bool deserializing) : base(deserializing) { } 39 protected BinUtilizationEvaluator(BinUtilizationEvaluator<D, B, I> original, Cloner cloner) 40 40 : base(original, cloner) { 41 41 } 42 public BinUtilization RegularIdenticalBinEvaluator() : base() { }42 public BinUtilizationEvaluator() : base() { } 43 43 44 44 protected override DoubleValue Evaluate() { … … 49 49 ItemList<I> itemMeasures = PackingItemMeasuresParameter.ActualValue; 50 50 51 // TODO: check and remove code 51 52 52 53 //Check if data is valid -
branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking/3.3/Evaluators/PackingPlanEvaluationAlgorithm.cs
r14048 r14050 44 44 get { return PackingSolutionDecoderParameter; } 45 45 } 46 public IValueLookupParameter<I PackingPlanEvaluator> PackingPlanEvaluatorParameter {47 get { return (IValueLookupParameter<I PackingPlanEvaluator>)Parameters["PackingPlanEvaluator"]; }46 public IValueLookupParameter<IEvaluator> PackingPlanEvaluatorParameter { 47 get { return (IValueLookupParameter<IEvaluator>)Parameters["PackingPlanEvaluator"]; } 48 48 } 49 ILookupParameter<I PackingPlanEvaluator> IPackingPlanEvaluationAlgorithm.PackingPlanEvaluatorParameter {49 ILookupParameter<IEvaluator> IPackingPlanEvaluationAlgorithm.PackingPlanEvaluatorParameter { 50 50 get { return PackingPlanEvaluatorParameter; } 51 51 } … … 62 62 : base() { 63 63 Parameters.Add(new ValueLookupParameter<IPackingSolutionDecoder>("PackingSolutionDecoder", "The decoding operator that is used to calculate a packing plan from the used representation.")); 64 Parameters.Add(new ValueLookupParameter<I PackingPlanEvaluator>("PackingPlanEvaluator", "The actual packing plan evaluation operator."));64 Parameters.Add(new ValueLookupParameter<IEvaluator>("PackingPlanEvaluator", "The actual packing plan evaluation operator.")); 65 65 Parameters.Add(new LookupParameter<DoubleValue>("Quality", "The quality value aka fitness value of the solution.")); 66 66 QualityParameter.Hidden = true; -
branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking/3.3/Evaluators/PackingPlanEvaluator.cs
r14048 r14050 27 27 using HeuristicLab.Parameters; 28 28 using HeuristicLab.Data; 29 29 using HeuristicLab.Collections; 30 30 31 31 namespace HeuristicLab.Problems.BinPacking { 32 32 [Item("Packingplan Evaluator", "Represents a evaluator class for standard bin-packing problems.")] 33 33 [StorableClass] 34 public abstract class PackingPlanEvaluator<D,B,I> : SingleSuccessorOperator, IPackingPlanEvaluator34 public abstract class EvaluatorBase<D,B,I> : SingleSuccessorOperator, IEvaluator 35 35 where D : class, IPackingPosition 36 36 where B : PackingShape<D> … … 52 52 get { return (ILookupParameter<IPackingPlan>)Parameters["PackingPlan"]; } 53 53 } 54 public ILookupParameter<ItemList<I>> PackingItemMeasuresParameter { 55 get { return (ILookupParameter<ItemList<I>>)Parameters["PackingItemMeasures"]; } 56 } 57 public ILookupParameter<B> PackingBinMeasuresParameter { 58 get { return (ILookupParameter<B>)Parameters["PackingBinMeasures"]; } 59 } 54 60 #endregion 55 61 56 62 [StorableConstructor] 57 protected PackingPlanEvaluator(bool deserializing) : base(deserializing) { }58 protected PackingPlanEvaluator(PackingPlanEvaluator<D,B,I> original, Cloner cloner)63 protected EvaluatorBase(bool deserializing) : base(deserializing) { } 64 protected EvaluatorBase(EvaluatorBase<D,B,I> original, Cloner cloner) 59 65 : base(original, cloner) { 60 66 } 61 public PackingPlanEvaluator()67 public EvaluatorBase() 62 68 : base() { 63 Parameters.Add(new LookupParameter<DoubleValue>("Quality", "The quality value aka fitness valueof the solution."));69 Parameters.Add(new LookupParameter<DoubleValue>("Quality", "The quality value of the solution.")); 64 70 Parameters.Add(new LookupParameter<IPackingPlan>("PackingPlan", "The decoded bin-packing solution represented as generalized packing-plan.")); 65 71 Parameters.Add(new LookupParameter<IRandom>("Random", "The pseudo random number generator.")); 72 Parameters.Add(new LookupParameter<ItemList<I>>("PackingItemMeasures", "Packing-item data taken from the bin-packing problem-instance.")); 73 Parameters.Add(new LookupParameter<B>("PackingBinMeasures", "Packing-bin data taken from the bin-packing problem-instance.")); 74 66 75 } 67 68 76 69 77 protected abstract DoubleValue Evaluate(); … … 73 81 } 74 82 83 protected bool HasOverlappingOrNotContainedItems(ObservableDictionary<int, D> positions, B binMeasure, ItemList<I> itemMeasures, int nrOfBins) { 84 //TODO: Optimize performance by removing unnecessary allocations.. 85 for (int i = 0; i < itemMeasures.Count; i++) { 86 I packingItem = itemMeasures[i]; 87 D currentPosition = positions[i]; 88 if (!binMeasure.Encloses(currentPosition, packingItem)) 89 return true; 90 91 for (int j = 0; j < itemMeasures.Count; j++) { 92 D checkedPosition = positions[j]; 93 if (i != j && currentPosition.AssignedBin == checkedPosition.AssignedBin) { 94 I checkedItem = itemMeasures[j]; 95 if (packingItem.Overlaps(currentPosition, checkedPosition, checkedItem)) 96 return true; 97 } 98 } 99 } 100 return false; 101 } 75 102 } 76 103 } -
branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking/3.3/Evaluators/PackingRatioEvaluator.cs
r14049 r14050 28 28 29 29 namespace HeuristicLab.Problems.BinPacking { 30 [Item("Packing-Ratio Regular Identical-Bin Evaluator", "Represents an evaluation-algorithm for regular-shaped bin-packing problems with identical bins which calculates the ratio between packed and unpacked space. Found in Falkenauer:1996")]31 30 [StorableClass] 32 public abstract class PackingRatio RegularIdenticalBinEvaluator<D, B, I> : RegularSimpleRotationIdenticalBinPackingPlanEvaluator<D, B, I>31 public abstract class PackingRatioEvaluator<D, B, I> : EvaluatorBase<D, B, I> 33 32 where D : class, IPackingPosition 34 33 where B : PackingShape<D> … … 36 35 37 36 [StorableConstructor] 38 protected PackingRatio RegularIdenticalBinEvaluator(bool deserializing) : base(deserializing) { }39 protected PackingRatio RegularIdenticalBinEvaluator(PackingRatioRegularIdenticalBinEvaluator<D, B, I> original, Cloner cloner)37 protected PackingRatioEvaluator(bool deserializing) : base(deserializing) { } 38 protected PackingRatioEvaluator(PackingRatioEvaluator<D, B, I> original, Cloner cloner) 40 39 : base(original, cloner) { 41 40 } 42 public PackingRatio RegularIdenticalBinEvaluator() : base() { }41 public PackingRatioEvaluator() : base() { } 43 42 44 43 protected override DoubleValue Evaluate() { -
branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking/3.3/Evaluators/RegularSimpleRotationIdenticalBinPackingPlanEvaluator.cs
r14048 r14050 54 54 } 55 55 56 57 58 59 56 protected bool HasOverlappingOrNotContainedItems(ObservableDictionary<int, D> positions, B binMeasure, ItemList<I> itemMeasures, int nrOfBins) { 60 57 //TODO: Optimize performance by removing unnecessary allocations.. … … 73 70 } 74 71 } 75 76 72 } 77 78 73 return false; 79 74 }
Note: See TracChangeset
for help on using the changeset viewer.