Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
06/06/13 03:12:42 (12 years ago)
Author:
jhelm
Message:

#1966: Applied some heavy refactoring on the decoder-classes and cleaned up the code a bit;

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

    r9563 r9593  
    9090
    9191      for (int i = 0; i < nrOfBins; i++) {
    92         double usableSpace = plan.GetPackingBinMeasuresForBinNr(i).MultipliedMeasures;
    93         var indexes = plan.PackingItemPositions.Select((Value, Index) => new { Value, Index }).Where(s => s.Value.Value.AssignedBin == i).Select(s => s.Index);
    94         var packedItemsInThisBin = plan.PackingItemMeasures.Select((Value, Index) => new { Value, Index }).Where(s => indexes.Contains(s.Index));
    95         double usedSpaceInThisBin = packedItemsInThisBin.Select(s => s.Value.MultipliedMeasures).Sum();
     92        double usableSpace = plan.BinPackings[i].BinMeasures.MultipliedMeasures;
     93        //var indexes = plan.PackingItemPositions.Select((Value, Index) => new { Value, Index }).Where(s => s.Value.Value.AssignedBin == i).Select(s => s.Index);
     94        //var packedItemsInThisBin = plan.PackingItemMeasures.Select((Value, Index) => new { Value, Index }).Where(s => indexes.Contains(s.Index));
     95        //double usedSpaceInThisBin = packedItemsInThisBin.Select(s => s.Value.MultipliedMeasures).Sum();
    9696        //result += (usedSpaceInThisBin / usableSpace);
    9797        totalUsableSpace += usableSpace;
    98         totalUsedSpace += usedSpaceInThisBin;
     98        //totalUsedSpace += usedSpaceInThisBin;
     99        totalUsedSpace += plan.BinPackings[i].PackingDensity * usableSpace;
    99100      }
    100101
  • branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking/3.3/Evaluators/Abstract/PackingRatioRegularIdenticalBinEvaluator.cs

    r9563 r9593  
    8989      for (int i = 0; i < nrOfBins; i++) {
    9090        //C
    91         double usableSpace = plan.GetPackingBinMeasuresForBinNr(0).MultipliedMeasures;//plan.GetPackingBinMeasuresForBinNr(i).MultipliedMeasures;
    92         var indexes = plan.PackingItemPositions.Select((Value, Index) => new { Value, Index }).Where(s => s.Value.Value.AssignedBin == i).Select(s => s.Index);
    93         var packedItemsInThisBin = plan.PackingItemMeasures.Select((Value, Index) => new { Value, Index }).Where(s => indexes.Contains(s.Index));
     91        //double usableSpace = plan.GetPackingBinMeasuresForBinNr(0).MultipliedMeasures;//plan.GetPackingBinMeasuresForBinNr(i).MultipliedMeasures;
     92        //var indexes = plan.PackingItemPositions.Select((Value, Index) => new { Value, Index }).Where(s => s.Value.Value.AssignedBin == i).Select(s => s.Index);
     93        //var packedItemsInThisBin = plan.PackingItemMeasures.Select((Value, Index) => new { Value, Index }).Where(s => indexes.Contains(s.Index));
    9494        //Fi
    95         double usedSpaceInThisBin = packedItemsInThisBin.Select(s => s.Value.MultipliedMeasures).Sum();
     95        //double usedSpaceInThisBin = packedItemsInThisBin.Select(s => s.Value.MultipliedMeasures).Sum();
    9696        //k = 2 --> (Fi/C)*(Fi/C)
    97         result += (((usedSpaceInThisBin) / (usableSpace)) * ((usedSpaceInThisBin) / (usableSpace))) / (i*i + 1);
     97        //result += (((usedSpaceInThisBin) / (usableSpace)) * ((usedSpaceInThisBin) / (usableSpace))) / (i*i + 1);
     98        var PD = plan.BinPackings[i].PackingDensity;
     99        result += (PD * PD) / (i + 1);
    98100      }
    99101
Note: See TracChangeset for help on using the changeset viewer.