Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
07/12/16 20:35:19 (9 years ago)
Author:
gkronber
Message:

#1966: renamed evaluators

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  
    2828
    2929namespace 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
    3131  [StorableClass]
    32   public abstract class BinUtilizationRegularIdenticalBinEvaluator<D, B, I> : RegularSimpleRotationIdenticalBinPackingPlanEvaluator<D, B, I>
     32  public abstract class BinUtilizationEvaluator<D, B, I> : EvaluatorBase<D, B, I>
    3333    where D : class, IPackingPosition
    3434    where B : PackingShape<D>
     
    3636
    3737    [StorableConstructor]
    38     protected BinUtilizationRegularIdenticalBinEvaluator(bool deserializing) : base(deserializing) { }
    39     protected BinUtilizationRegularIdenticalBinEvaluator(BinUtilizationRegularIdenticalBinEvaluator<D, B, I> original, Cloner cloner)
     38    protected BinUtilizationEvaluator(bool deserializing) : base(deserializing) { }
     39    protected BinUtilizationEvaluator(BinUtilizationEvaluator<D, B, I> original, Cloner cloner)
    4040      : base(original, cloner) {
    4141    }
    42     public BinUtilizationRegularIdenticalBinEvaluator() : base() { }
     42    public BinUtilizationEvaluator() : base() { }
    4343
    4444    protected override DoubleValue Evaluate() {
     
    4949      ItemList<I> itemMeasures = PackingItemMeasuresParameter.ActualValue;
    5050
     51      // TODO: check and remove code
    5152
    5253      //Check if data is valid
  • branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking/3.3/Evaluators/PackingPlanEvaluationAlgorithm.cs

    r14048 r14050  
    4444      get { return PackingSolutionDecoderParameter; }
    4545    }
    46     public IValueLookupParameter<IPackingPlanEvaluator> PackingPlanEvaluatorParameter {
    47       get { return (IValueLookupParameter<IPackingPlanEvaluator>)Parameters["PackingPlanEvaluator"]; }
     46    public IValueLookupParameter<IEvaluator> PackingPlanEvaluatorParameter {
     47      get { return (IValueLookupParameter<IEvaluator>)Parameters["PackingPlanEvaluator"]; }
    4848    }
    49     ILookupParameter<IPackingPlanEvaluator> IPackingPlanEvaluationAlgorithm.PackingPlanEvaluatorParameter {
     49    ILookupParameter<IEvaluator> IPackingPlanEvaluationAlgorithm.PackingPlanEvaluatorParameter {
    5050      get { return PackingPlanEvaluatorParameter; }
    5151    }
     
    6262      : base() {
    6363        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<IPackingPlanEvaluator>("PackingPlanEvaluator", "The actual packing plan evaluation operator."));
     64        Parameters.Add(new ValueLookupParameter<IEvaluator>("PackingPlanEvaluator", "The actual packing plan evaluation operator."));
    6565        Parameters.Add(new LookupParameter<DoubleValue>("Quality", "The quality value aka fitness value of the solution."));
    6666        QualityParameter.Hidden = true;
  • branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking/3.3/Evaluators/PackingPlanEvaluator.cs

    r14048 r14050  
    2727using HeuristicLab.Parameters;
    2828using HeuristicLab.Data;
    29 
     29using HeuristicLab.Collections;
    3030
    3131namespace HeuristicLab.Problems.BinPacking {
    3232  [Item("Packingplan Evaluator", "Represents a evaluator class for standard bin-packing problems.")]
    3333  [StorableClass]
    34   public abstract class PackingPlanEvaluator<D,B,I> : SingleSuccessorOperator, IPackingPlanEvaluator
     34  public abstract class EvaluatorBase<D,B,I> : SingleSuccessorOperator, IEvaluator
    3535    where D : class, IPackingPosition
    3636    where B : PackingShape<D>
     
    5252      get { return (ILookupParameter<IPackingPlan>)Parameters["PackingPlan"]; }
    5353    }
     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    }
    5460    #endregion
    5561
    5662    [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)
    5965      : base(original, cloner) {
    6066    }
    61     public PackingPlanEvaluator()
     67    public EvaluatorBase()
    6268      : base() {
    63       Parameters.Add(new LookupParameter<DoubleValue>("Quality", "The quality value aka fitness value of the solution."));
     69      Parameters.Add(new LookupParameter<DoubleValue>("Quality", "The quality value of the solution."));
    6470      Parameters.Add(new LookupParameter<IPackingPlan>("PackingPlan", "The decoded bin-packing solution represented as generalized packing-plan."));
    6571      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
    6675    }
    67 
    6876
    6977    protected abstract DoubleValue Evaluate();                                                                       
     
    7381    }
    7482
     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    }
    75102  }
    76103}
  • branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking/3.3/Evaluators/PackingRatioEvaluator.cs

    r14049 r14050  
    2828
    2929namespace 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")]
    3130  [StorableClass]
    32   public abstract class PackingRatioRegularIdenticalBinEvaluator<D, B, I> : RegularSimpleRotationIdenticalBinPackingPlanEvaluator<D, B, I>
     31  public abstract class PackingRatioEvaluator<D, B, I> : EvaluatorBase<D, B, I>
    3332    where D : class, IPackingPosition
    3433    where B : PackingShape<D>
     
    3635
    3736    [StorableConstructor]
    38     protected PackingRatioRegularIdenticalBinEvaluator(bool deserializing) : base(deserializing) { }
    39     protected PackingRatioRegularIdenticalBinEvaluator(PackingRatioRegularIdenticalBinEvaluator<D, B, I> original, Cloner cloner)
     37    protected PackingRatioEvaluator(bool deserializing) : base(deserializing) { }
     38    protected PackingRatioEvaluator(PackingRatioEvaluator<D, B, I> original, Cloner cloner)
    4039      : base(original, cloner) {
    4140    }
    42     public PackingRatioRegularIdenticalBinEvaluator() : base() { }
     41    public PackingRatioEvaluator() : base() { }
    4342
    4443    protected override DoubleValue Evaluate() {
  • branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking/3.3/Evaluators/RegularSimpleRotationIdenticalBinPackingPlanEvaluator.cs

    r14048 r14050  
    5454    }
    5555
    56 
    57 
    58 
    5956    protected bool HasOverlappingOrNotContainedItems(ObservableDictionary<int, D> positions, B binMeasure, ItemList<I> itemMeasures, int nrOfBins) {
    6057      //TODO: Optimize performance by removing unnecessary allocations..
     
    7370          }
    7471        }
    75 
    7672      }
    77 
    7873      return false;
    7974    }
Note: See TracChangeset for help on using the changeset viewer.