Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
06/02/13 04:26:26 (12 years ago)
Author:
jhelm
Message:

#1966: Implemented additional Operator-Wrappers for PackingSequence and GroupingVector; Implemented additional problem-class for Rosenbauer-Problemstatement; Added marker-interfaces for decoder-types;

Location:
branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking/3.3/Evaluators/Abstract
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking/3.3/Evaluators/Abstract/BinUtilizationRegularIdenticalBinEvaluator.cs

    r9495 r9563  
    6666
    6767      //if (itemPositionsAreValid)
    68       return CalculateBinUtilization(plan as SingleBinSizePackingPlan<D, B, I>, binMeasure, itemMeasures);
     68      return CalculateBinUtilization(plan as PackingPlan<D, B, I>);
    6969
    7070      //return quality;
    7171    }
    7272
    73     public static DoubleValue CalculateBinUtilization(SingleBinSizePackingPlan<D, B, I> plan, B binMeasure, ItemList<I> itemMeasures) {
     73    public static DoubleValue CalculateBinUtilization(PackingPlan<D, B, I> plan) {
    7474      int nrOfBins = plan.NrOfBins;
    7575      double result = 0;
    7676
    77       double usableSpace = binMeasure.MultipliedMeasures;
     77      //for (int i = 0; i < nrOfBins; i++) {
     78      //  double usableSpace = plan.GetPackingBinMeasuresForBinNr(i).MultipliedMeasures;
     79      //  var indexes = plan.PackingItemPositions.Select((Value, Index) => new { Value, Index }).Where(s => s.Value.Value.AssignedBin == i).Select(s => s.Index);
     80      //  var packedItemsInThisBin = plan.PackingItemMeasures.Select((Value, Index) => new { Value, Index }).Where(s => indexes.Contains(s.Index));
     81      //  double usedSpaceInThisBin = packedItemsInThisBin.Select(s => s.Value.MultipliedMeasures).Sum();
     82      //  result += (usedSpaceInThisBin / usableSpace);
     83      //}
     84
     85      //result = result / nrOfBins;
     86      //return new DoubleValue (result);
     87
     88      double totalUsedSpace = 0;
     89      double totalUsableSpace = 0;
     90
    7891      for (int i = 0; i < nrOfBins; i++) {
     92        double usableSpace = plan.GetPackingBinMeasuresForBinNr(i).MultipliedMeasures;
    7993        var indexes = plan.PackingItemPositions.Select((Value, Index) => new { Value, Index }).Where(s => s.Value.Value.AssignedBin == i).Select(s => s.Index);
    80         var packedItemsInThisBin = itemMeasures.Select((Value, Index) => new { Value, Index }).Where(s => indexes.Contains(s.Index));
     94        var packedItemsInThisBin = plan.PackingItemMeasures.Select((Value, Index) => new { Value, Index }).Where(s => indexes.Contains(s.Index));
    8195        double usedSpaceInThisBin = packedItemsInThisBin.Select(s => s.Value.MultipliedMeasures).Sum();
    82         result += (usedSpaceInThisBin / usableSpace);
     96        //result += (usedSpaceInThisBin / usableSpace);
     97        totalUsableSpace += usableSpace;
     98        totalUsedSpace += usedSpaceInThisBin;
    8399      }
    84100
    85       result = result / nrOfBins;
    86       return new DoubleValue (result);
     101      result = totalUsedSpace / totalUsableSpace;
     102      return new DoubleValue(result);
    87103    }
    88104  }
  • branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking/3.3/Evaluators/Abstract/PackingRatioRegularIdenticalBinEvaluator.cs

    r9473 r9563  
    6666
    6767      //if (itemPositionsAreValid)
    68       return CalculatePackingRatio(plan as PackingPlan<D, B, I>, binMeasure, itemMeasures);
     68      return CalculatePackingRatio(plan as PackingPlan<D, B, I>);
    6969
    7070      //return quality;
     
    8080        k.......a constant, k>1.
    8181     */
    82     public static DoubleValue CalculatePackingRatio(PackingPlan<D, B, I> plan, B binMeasure, ItemList<I> itemMeasures) {
     82    public static DoubleValue CalculatePackingRatio(PackingPlan<D, B, I> plan) {
    8383      int nrOfBins = plan.NrOfBins;
    8484      double result = 0;
    8585
    8686      //C
    87       double usableSpace = binMeasure.MultipliedMeasures;
     87      //double usableSpace = binMeasure.MultipliedMeasures;
    8888      //nrOfBins = N
    8989      for (int i = 0; i < nrOfBins; i++) {
     90        //C
     91        double usableSpace = plan.GetPackingBinMeasuresForBinNr(0).MultipliedMeasures;//plan.GetPackingBinMeasuresForBinNr(i).MultipliedMeasures;
    9092        var indexes = plan.PackingItemPositions.Select((Value, Index) => new { Value, Index }).Where(s => s.Value.Value.AssignedBin == i).Select(s => s.Index);
    91         var packedItemsInThisBin = itemMeasures.Select((Value, Index) => new { Value, Index }).Where(s => indexes.Contains(s.Index));
     93        var packedItemsInThisBin = plan.PackingItemMeasures.Select((Value, Index) => new { Value, Index }).Where(s => indexes.Contains(s.Index));
    9294        //Fi
    9395        double usedSpaceInThisBin = packedItemsInThisBin.Select(s => s.Value.MultipliedMeasures).Sum();
Note: See TracChangeset for help on using the changeset viewer.