Free cookie consent management tool by TermsFeed Policy Generator

Changeset 9473 for branches


Ignore:
Timestamp:
05/09/13 15:03:41 (12 years ago)
Author:
jhelm
Message:

#1966: Fixed some problems in MCV-move operators; Added parts of potvin-encoding implementation;

Location:
branches/HeuristicLab.BinPacking
Files:
15 added
2 deleted
20 edited

Legend:

Unmodified
Added
Removed
  • branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking.Views/3.3/Plugin.cs

    r9440 r9473  
    2626  /// Plugin class for HeuristicLab.Problems.BinPacking.Views plugin.
    2727  /// </summary>
    28   [Plugin("HeuristicLab.Problems.BinPacking.Views", "3.3.7.9348")]
     28  [Plugin("HeuristicLab.Problems.BinPacking.Views", "3.3.7.9440")]
    2929  [PluginFile("HeuristicLab.Problems.BinPacking.Views-3.3.dll", PluginFileType.Assembly)]
    3030  [PluginDependency("HeuristicLab.Common", "3.3")]
  • branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking.Views/3.3/Properties/AssemblyInfo.cs

    r9440 r9473  
    5454// by using the '*' as shown below:
    5555[assembly: AssemblyVersion("3.3.0.0")]
    56 [assembly: AssemblyFileVersion("3.3.7.9348")]
     56[assembly: AssemblyFileVersion("3.3.7.9440")]
  • branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking/3.3/Decoders/3D/EP/ExtremePointsFunctions3D.cs

    r9440 r9473  
    55using HeuristicLab.Collections;
    66using HeuristicLab.Core;
     7using HeuristicLab.Encodings.IntegerVectorEncoding;
    78using HeuristicLab.Encodings.PackingEncoding.GroupingVector;
    89using HeuristicLab.Encodings.PackingEncoding.MultiComponentVector;
    910using HeuristicLab.Encodings.PackingEncoding.PackingSequence;
     11using HeuristicLab.Encodings.PackingEncoding.Potvin;
    1012using HeuristicLab.Problems.BinPacking.Dimensions;
    1113using HeuristicLab.Problems.BinPacking.Interfaces;
     
    1820
    1921
     22
     23    public static ObservableDictionary<int, ThreeDimensionalPacking> ExtremePointBasedPacking(ref PotvinEncoding solution,
     24      ItemList<CuboidPackingItem> itemMeasures, CuboidPackingBin binMeasures) {
     25        if (!solution.DelimiterInitialized) {
     26          #region Preperations
     27          var itemPositions = new ObservableDictionary<int, ThreeDimensionalPacking>();
     28          int nrOfBins = 1;
     29
     30          var occupiedPoints = new List<int[, ,]>();
     31          occupiedPoints = IncreaseBinCountForOccupiedPoints(occupiedPoints, binMeasures);
     32
     33          HashSet<ThreeDimensionalPacking> extremePoints = new HashSet<ThreeDimensionalPacking>();
     34          extremePoints.Add(new ThreeDimensionalPacking(0, 0, 0, 0, false));
     35          #endregion
     36
     37          Dictionary<int, List<int>> itemIndexesForBin = new Dictionary<int, List<int>>();
     38          itemIndexesForBin[0] = new List<int>();
     39
     40          foreach (int itemIndex in solution.IntVector) {
     41            var item = itemMeasures[itemIndex];
     42            extremePoints = OrderExtremePoints(extremePoints, occupiedPoints, binMeasures);
     43            var positionFound = FindExtremePointForItem(itemIndex, itemMeasures, binMeasures, extremePoints, occupiedPoints, itemPositions);
     44            if (positionFound != null) {
     45              extremePoints.Remove(positionFound);
     46            } else {
     47              positionFound = new ThreeDimensionalPacking(nrOfBins, 0, 0, 0);
     48              occupiedPoints = IncreaseBinCountForOccupiedPoints(occupiedPoints, binMeasures);
     49              itemIndexesForBin[nrOfBins] = new List<int>();
     50              nrOfBins++;
     51            }
     52            itemPositions[itemIndex] = positionFound;
     53            itemIndexesForBin[positionFound.AssignedBin].Add(itemIndex);
     54            occupiedPoints = OccupyPointsForNewItem(occupiedPoints, item, positionFound, itemIndex);
     55            extremePoints = GenerateNewExtremePointsForNewItem(extremePoints, occupiedPoints, item, positionFound, binMeasures);
     56          }
     57          List<int> intVector = new List<int>();
     58          foreach (var indexes in itemIndexesForBin) {
     59            foreach (var index in indexes.Value) {
     60              intVector.Add(index);
     61            }
     62            intVector.Add(-1);
     63          }
     64          intVector.RemoveAt(intVector.Count - 1);
     65          solution.IntVector = new IntegerVector (intVector.ToArray());
     66
     67          return itemPositions;
     68        } else {
     69          #region Preperations
     70          int nrOfBins = solution.IntVector.Count(i => i.Equals (-1)) + 1;
     71
     72          //Get all indexes of items for every bin according to int vector
     73          Dictionary<int, List<int>> unpackedItemIndexesPerBin = new Dictionary<int, List<int>>();
     74          Dictionary<int, HashSet<ThreeDimensionalPacking>> extremePointsForBin = new Dictionary<int, HashSet<ThreeDimensionalPacking>>();
     75          var occupiedPoints = new List<int[, ,]>();
     76
     77          int binCounter = 0;
     78          unpackedItemIndexesPerBin[binCounter] = new List<int>();
     79          for (int i = 0; i < solution.IntVector.Length; i++) {
     80            if (solution.IntVector[i].Equals(-1)) {
     81              unpackedItemIndexesPerBin[binCounter++] = new List<int>();
     82              extremePointsForBin[i] = new HashSet<ThreeDimensionalPacking>();
     83              extremePointsForBin[i].Add(new ThreeDimensionalPacking(i, 0, 0, 0, false));
     84              occupiedPoints = IncreaseBinCountForOccupiedPoints(occupiedPoints, binMeasures);
     85            } else {
     86              unpackedItemIndexesPerBin[binCounter].Add(solution.IntVector[i]);
     87            }
     88
     89          }
     90
     91
     92          ObservableDictionary<int, ThreeDimensionalPacking> itemPositions = new ObservableDictionary<int, ThreeDimensionalPacking>();
     93          var remainingItems = new List<int>();
     94
     95          #endregion Preperations
     96
     97
     98
     99          //Iterate over all bin-lists
     100          for (int binNr = 0; binNr < nrOfBins; binNr++) {
     101            //Iterate over the current bin-item-list and find feasible positions in the current bin for each item
     102            var unpackedItems = unpackedItemIndexesPerBin[binNr];
     103            for (int i = 0; i < unpackedItems.Count; i++) {
     104              var itemIndex = unpackedItems[i];
     105              var item = itemMeasures[itemIndex];
     106
     107              extremePointsForBin[binNr] = OrderExtremePoints(extremePointsForBin[binNr], occupiedPoints, binMeasures);
     108              var positionFound = FindExtremePointForItem(itemIndex, itemMeasures, binMeasures, extremePointsForBin[binNr], occupiedPoints, itemPositions);
     109              if (positionFound != null) {
     110                extremePointsForBin[binNr].Remove(positionFound);
     111                itemPositions[itemIndex] = positionFound;
     112                occupiedPoints = OccupyPointsForNewItem(occupiedPoints, item, positionFound, itemIndex);
     113                extremePointsForBin[binNr] = GenerateNewExtremePointsForNewItem(extremePointsForBin[binNr], occupiedPoints, item, positionFound, binMeasures);
     114              } else
     115                remainingItems.Add(itemIndex);
     116            }
     117          }
     118
     119
     120
     121          //Packing of remaining items   
     122          //Iterate over all bin-lists
     123          for (int binNr = 0; binNr < nrOfBins && remainingItems.Count > 0; binNr++) {
     124            var unpackedItems = new List<int>(remainingItems);
     125            //Iterate over all the remaining items
     126            for (int i = 0; i < unpackedItems.Count; i++) {
     127              var itemIndex = unpackedItems[i];
     128              var item = itemMeasures[itemIndex];
     129
     130              extremePointsForBin[binNr] = OrderExtremePoints(extremePointsForBin[binNr], occupiedPoints, binMeasures);
     131              var positionFound = FindExtremePointForItem(itemIndex, itemMeasures, binMeasures, extremePointsForBin[binNr], occupiedPoints, itemPositions);
     132              if (positionFound != null) {
     133                extremePointsForBin[binNr].Remove(positionFound);
     134                InsertItemgeneAfterLastItemgeneOfUsedBin(ref solution, itemIndex, binNr);
     135                itemPositions[itemIndex] = positionFound;
     136                occupiedPoints = OccupyPointsForNewItem(occupiedPoints, item, positionFound, itemIndex);
     137                extremePointsForBin[binNr] = GenerateNewExtremePointsForNewItem(extremePointsForBin[binNr], occupiedPoints, item, positionFound, binMeasures);
     138                remainingItems.Remove(itemIndex);
     139              }
     140            }
     141            if (remainingItems.Count > 0 && binNr + 1 >= nrOfBins) {
     142              extremePointsForBin[nrOfBins] = new HashSet<ThreeDimensionalPacking>();
     143              extremePointsForBin[nrOfBins].Add(new ThreeDimensionalPacking(nrOfBins, 0, 0, 0, false));
     144              occupiedPoints = IncreaseBinCountForOccupiedPoints(occupiedPoints, binMeasures);
     145              nrOfBins++;
     146            }
     147          }
     148
     149          return itemPositions;
     150        }
     151    }
     152    private static void InsertItemgeneAfterLastItemgeneOfUsedBin(ref PotvinEncoding solution, int itemIndex, int binNr) {
     153      List<int> temp = new List<int> (solution.IntVector);
     154      temp.Remove(itemIndex);
     155      var delimiterIndexes = temp.Select((value, index) => value == -1).Select((value, index) => index);
     156      int insertionIndex = temp.Count;
     157      if (binNr < delimiterIndexes.Count()) {
     158        insertionIndex = delimiterIndexes.ElementAt(binNr);
     159      }
     160      temp.Insert(insertionIndex, itemIndex);
     161      solution.IntVector = new IntegerVector (temp.ToArray());
     162    }
    20163
    21164
     
    56199          var item = itemMeasures[itemIndex];
    57200
    58           extremePointsForBin[binNr] = new HashSet<ThreeDimensionalPacking>(extremePointsForBin[binNr].OrderBy(ep => ep.AssignedBin).ThenBy(ep => ShortestPossibleSideFromEP(ep, occupiedPoints, binMeasures)));
     201          extremePointsForBin[binNr] = OrderExtremePoints(extremePointsForBin[binNr], occupiedPoints, binMeasures);
    59202          var positionFound = FindExtremePointForItem(itemIndex, itemMeasures, binMeasures, extremePointsForBin[binNr], occupiedPoints, itemPositions, unpackedItems[i].Rotated);
    60203          if (positionFound != null) {
     
    78221          var item = itemMeasures[itemIndex];
    79222
    80           extremePointsForBin[binNr] = new HashSet<ThreeDimensionalPacking>(extremePointsForBin[binNr].OrderBy(ep => ep.AssignedBin).ThenBy(ep => ShortestPossibleSideFromEP(ep, occupiedPoints, binMeasures)));
     223          extremePointsForBin[binNr] = OrderExtremePoints(extremePointsForBin[binNr], occupiedPoints, binMeasures);
    81224          var positionFound = FindExtremePointForItem(itemIndex, itemMeasures, binMeasures, extremePointsForBin[binNr], occupiedPoints, itemPositions, unpackedItems[i].Rotated);
    82225          if (positionFound != null) {
     
    147290          var item = itemMeasures[itemIndex];
    148291
    149           extremePointsForBin[binNr] = new HashSet<ThreeDimensionalPacking>(extremePointsForBin[binNr].OrderBy(ep => ep.AssignedBin).ThenBy(ep => ShortestPossibleSideFromEP(ep, occupiedPoints, binMeasures)));
     292          extremePointsForBin[binNr] = OrderExtremePoints(extremePointsForBin[binNr], occupiedPoints, binMeasures);
    150293          var positionFound = FindExtremePointForItem(itemIndex, itemMeasures, binMeasures, extremePointsForBin[binNr], occupiedPoints, itemPositions);
    151294          if (positionFound != null) {
     
    170313          var item = itemMeasures[itemIndex];
    171314
    172           extremePointsForBin[binNr] = new HashSet<ThreeDimensionalPacking>(extremePointsForBin[binNr].OrderBy(ep => ep.AssignedBin).ThenBy(ep => ShortestPossibleSideFromEP(ep, occupiedPoints, binMeasures)));
     315          extremePointsForBin[binNr] = OrderExtremePoints(extremePointsForBin[binNr], occupiedPoints, binMeasures);
    173316          var positionFound = FindExtremePointForItem(itemIndex, itemMeasures, binMeasures, extremePointsForBin[binNr], occupiedPoints, itemPositions);
    174317          if (positionFound != null) {
     
    208351      foreach (int itemIndex in solution.PackingSequence) {
    209352        var item = itemMeasures[itemIndex];
    210         extremePoints = new HashSet<ThreeDimensionalPacking>(extremePoints.OrderBy(ep => ep.AssignedBin).ThenBy(ep => ShortestPossibleSideFromEP(ep, occupiedPoints, binMeasures)));
     353        extremePoints = OrderExtremePoints(extremePoints, occupiedPoints, binMeasures);
    211354        var positionFound = FindExtremePointForItem(itemIndex, itemMeasures, binMeasures, extremePoints, occupiedPoints, itemPositions);
    212355        if (positionFound != null) {
     
    373516      return extremePoints;
    374517    }
     518
     519
     520    private static HashSet<ThreeDimensionalPacking> OrderExtremePoints(HashSet<ThreeDimensionalPacking> hashSet, List<int[, ,]> occupiedPoints, CuboidPackingBin binMeasures) {
     521      return new HashSet<ThreeDimensionalPacking>(hashSet.OrderBy(ep => ep.AssignedBin).ThenBy(ep => ep.Z).ThenBy(ep => ep.X).ThenBy(ep => ep.Y).ThenBy(ep => ShortestPossibleSideFromEP(ep, occupiedPoints, binMeasures)));
     522    }
    375523    private static int ShortestPossibleSideFromEP(ThreeDimensionalPacking ep, List<int[, ,]> occupiedPoints, CuboidPackingBin binMeasures) {
    376524      int shortestSide = int.MaxValue;
  • branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking/3.3/Encodings/MultiComponentVector/Moves/ThreeWay/Attributes/SingleGroupingMoveAttribute.cs

    r9440 r9473  
    2929  public class SingleGroupingMoveAttribute : MultiComponentVectorMoveAttribute {
    3030    [Storable]
    31     public int ItemIndex { get; protected set; }
     31    public int Index { get; protected set; }
    3232    [Storable]
    3333    public int AssignedBin { get; protected set; }
     
    3737    protected SingleGroupingMoveAttribute(SingleGroupingMoveAttribute original, Cloner cloner)
    3838      : base(original, cloner) {
    39       this.ItemIndex = original.ItemIndex;
     39      this.Index = original.Index;
    4040      this.AssignedBin = original.AssignedBin;
    4141    }
    4242    public SingleGroupingMoveAttribute() : this(-1, -1, -1) { }
    43     public SingleGroupingMoveAttribute(int itemIndex, int assignedBin, double moveQuality)
     43    public SingleGroupingMoveAttribute(int index, int assignedBin, double moveQuality)
    4444      : base(moveQuality) {
    45       ItemIndex = itemIndex;
     45      Index = index;
    4646      AssignedBin = assignedBin;
    4747    }
  • branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking/3.3/Encodings/MultiComponentVector/Moves/ThreeWay/ExhaustiveMultiComponentVectorMoveGenerator.cs

    r9440 r9473  
    4040    }
    4141
    42 
    4342    public static MultiComponentVectorMove[] Apply(MultiComponentVectorEncoding multiComponentVector) {
    44       //NrOfMoves = nrOfRotationMoves + nrOfSingleGroupingMoves + nrOfSwapSequenceMoves
     43      //NrOfMoves = nrOfRotationMoves + nrOfSingleGroupingMoves + nrOfSwapPositionMoves
    4544      //  nrOfRotationMoves       = nrOfItems
    4645      //  nrOfSingleGroupingMoves = nrOfItems * (nrOfBins - 1)
    47       //  nrOfSwapSequenceMoves   = SUM(foreach binNr: !nrOfItemsInBin)
    48 
    49       int lastBinNr = 0;
    50       foreach (var pi in multiComponentVector.PackingInformations) {
    51         if (pi.AssignedBin > lastBinNr)
    52           lastBinNr = pi.AssignedBin;
    53       }
    54       int nrOfBins = lastBinNr + 1;
    55 
    56       int nrOfRotationMoves = multiComponentVector.PackingInformations.Count;
    57       int nrOfSingleGroupingMoves = nrOfRotationMoves * (nrOfBins - 1);
    58 
    59       int[] itemsPerBin = new int[nrOfBins];
    60       foreach (var pi in multiComponentVector.PackingInformations) {
    61         itemsPerBin[pi.AssignedBin]++;
    62       }
    63       int nrOfSwapSequenceMoves = 0;
    64       foreach (int items in itemsPerBin) {
    65         nrOfSwapSequenceMoves += (items * (items - 1)) / 2;
    66       }
    67 
    68       int totalMoves = nrOfRotationMoves + nrOfSingleGroupingMoves + nrOfSwapSequenceMoves;
     46      //  nrOfSwapPositionMoves   = SUM(foreach binNr: !nrOfItemsInBin)
     47      int totalMoves =
     48        NrOfRotationMoves(multiComponentVector) +
     49        NrOfSingleGroupingMoves(multiComponentVector) +
     50        NrOfSwapPositionMoves(multiComponentVector) +
     51        NrOfChangePositionMoves(multiComponentVector);
    6952      MultiComponentVectorMove[] moves = new MultiComponentVectorMove[totalMoves];
    7053      int count = 0;
     
    7558        moves[count++] = move;
    7659      }
    77       foreach (MultiComponentVectorMove move in GenerateSwapSequenceMoves(multiComponentVector)) {
     60      foreach (MultiComponentVectorMove move in GenerateSwapPositionMoves(multiComponentVector)) {
     61        moves[count++] = move;
     62      }
     63      foreach (MultiComponentVectorMove move in GenerateChangePositionMoves(multiComponentVector)) {
    7864        moves[count++] = move;
    7965      }
    8066      return moves;
    81     }   
     67    } 
    8268
    8369    protected override MultiComponentVectorMove[] GenerateMoves(MultiComponentVectorEncoding multiComponentVector) {
  • branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking/3.3/Encodings/MultiComponentVector/Moves/ThreeWay/Moves/SingleGroupingMove.cs

    r9440 r9473  
    3030  public class SingleGroupingMove : MultiComponentVectorMove {
    3131    [Storable]
    32     public int ItemIndex { get; protected set; }
     32    public int Index { get; protected set; }
    3333    [Storable]
    3434    public int NewGroup { get; protected set; }
     
    3838    protected SingleGroupingMove(SingleGroupingMove original, Cloner cloner)
    3939      : base(original, cloner) {
    40       this.ItemIndex = original.ItemIndex;
     40      this.Index = original.Index;
    4141      this.NewGroup = original.NewGroup;
    4242    }
    4343    public SingleGroupingMove(int index, int newGroup, MultiComponentVectorEncoding multiComponentVector)
    4444      : base(multiComponentVector) {
    45       ItemIndex = index;
     45      Index = index;
    4646      NewGroup = newGroup;
    4747    }
     
    5252
    5353    public override MultiComponentVectorEncoding GetVectorAfterMove() {
    54       //var result = new MultiComponentVectorEncoding();
    55       //result.PackingInformations = new ItemList<PackingInformation>(this.MultiComponentVector.PackingInformations);
    56       //result.PackingInformations[ItemIndex].AssignedBin = NewGroup;
    57       //return result;
    58       return InsertItemgeneAfterLastItemgeneOfUsedBin(MultiComponentVector, ItemIndex, NewGroup);
     54      return GetVectorAfterMove(MultiComponentVector, Index, NewGroup);
    5955    }
    60     private MultiComponentVectorEncoding InsertItemgeneAfterLastItemgeneOfUsedBin(MultiComponentVectorEncoding solution, int itemIndex, int binNr) {
     56    public static MultiComponentVectorEncoding GetVectorAfterMove(MultiComponentVectorEncoding originalSolution, int itemIndex, int binNr) {
     57      var solution = originalSolution.Clone (new Cloner()) as MultiComponentVectorEncoding;
    6158      var itemgene = solution.PackingInformations[itemIndex];
    6259      solution.PackingInformations.Remove(itemgene);
     
    6461      int targetIndex = solution.PackingInformations.FindLastIndex(pi => pi.AssignedBin == binNr);
    6562      solution.PackingInformations.Insert(targetIndex + 1, itemgene);
     63      //solution.PackingInformations[itemIndex].AssignedBin = binNr;
    6664      return solution;
    6765    }
     
    7068      return typeof(SingleGroupingMoveAttribute);
    7169    }
     70
     71    public override string ToString() {
     72      return "GM(i="+Index+",g="+NewGroup+")";
     73    }
    7274  }
    7375}
  • branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking/3.3/Encodings/MultiComponentVector/Moves/ThreeWay/Moves/SingleItemRotationMove.cs

    r9440 r9473  
    4848
    4949    public override MultiComponentVectorEncoding GetVectorAfterMove() {
    50       var result = new MultiComponentVectorEncoding();
    51       result.PackingInformations = new ItemList<PackingInformation>(this.MultiComponentVector.PackingInformations);
    52       result.PackingInformations[ItemIndex].Rotated = !result.PackingInformations[ItemIndex].Rotated;
     50      return GetVectorAfterMove (MultiComponentVector, ItemIndex);
     51    }
     52    public static MultiComponentVectorEncoding GetVectorAfterMove(MultiComponentVectorEncoding multiComponentVector, int itemIndex) {
     53      var result = multiComponentVector.Clone(new Cloner()) as MultiComponentVectorEncoding;
     54      result.PackingInformations[itemIndex].Rotated = !result.PackingInformations[itemIndex].Rotated;
    5355      return result;
    5456    }
     
    5759      return typeof(SingleItemRotationMoveAttribute);
    5860    }
     61
     62    public override string ToString() {
     63      return "RM(i=" + ItemIndex+")";
     64    }
    5965  }
    6066}
  • branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking/3.3/Encodings/MultiComponentVector/Moves/ThreeWay/MultiComponentVectorMoveGenerator.cs

    r9440 r9473  
    2727using HeuristicLab.Parameters;
    2828using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
     29using HeuristicLab.Problems.BinPacking.Decoders;
    2930using HeuristicLab.Problems.BinPacking.Interfaces;
     31using HeuristicLab.Problems.BinPacking.PackingBin;
     32using HeuristicLab.Problems.BinPacking.PackingItem;
    3033
    3134namespace HeuristicLab.Encodings.PackingEncoding.MultiComponentVector {
     
    4447    protected ScopeParameter CurrentScopeParameter {
    4548      get { return (ScopeParameter)Parameters["CurrentScope"]; }
    46     }
     49    }               
     50
    4751
    4852    [StorableConstructor]
     
    5761
    5862
    59 
    60 
     63    public static int NrOfRotationMoves(MultiComponentVectorEncoding mcv) {
     64      return mcv.PackingInformations.Count;
     65    }
    6166    public static IEnumerable<MultiComponentVectorMove> GenerateRotationMoves(MultiComponentVectorEncoding multiComponentVector) {
    6267      for (int i = 0; i < multiComponentVector.PackingInformations.Count; i++)
     
    6469    }
    6570
     71    public static int NrOfSingleGroupingMoves(MultiComponentVectorEncoding mcv) {
     72      int nrOfBins = 0;
     73      foreach (var pi in mcv.PackingInformations) {
     74        if (pi.AssignedBin > nrOfBins)
     75          nrOfBins = pi.AssignedBin;
     76      }
     77      nrOfBins++;
     78      return mcv.PackingInformations.Count * (nrOfBins - 1);
     79    }
    6680    public static IEnumerable<MultiComponentVectorMove> GenerateSingleGroupingMoves(MultiComponentVectorEncoding multiComponentVector) {
    6781      int nrOfBins = 0;
     
    7892    }
    7993
    80     public static IEnumerable<MultiComponentVectorMove> GenerateSwapSequenceMoves(MultiComponentVectorEncoding multiComponentVector) {
     94    public static int NrOfSwapPositionMoves(MultiComponentVectorEncoding mcv) {
     95      int nrOfBins = 0;
     96      foreach (var pi in mcv.PackingInformations) {
     97        if (pi.AssignedBin > nrOfBins)
     98          nrOfBins = pi.AssignedBin;
     99      }
     100      nrOfBins++;
     101      int[] itemsPerBin = new int[nrOfBins];
     102      foreach (var pi in mcv.PackingInformations) {
     103        itemsPerBin[pi.AssignedBin]++;
     104      }
     105      int nrOfSwapPositionMoves = 0;
     106      foreach (int items in itemsPerBin) {
     107        nrOfSwapPositionMoves += (items * (items - 1)) / 2;
     108      }
     109      return nrOfSwapPositionMoves;
     110    }
     111    public static IEnumerable<MultiComponentVectorMove> GenerateSwapPositionMoves(MultiComponentVectorEncoding multiComponentVector) {
    81112      Dictionary<int, List<int>> indexesPerBin = new Dictionary<int, List<int>>();
    82113      for (int i = 0; i < multiComponentVector.PackingInformations.Count; i++) {
     
    89120        for (int i = 0; i < entry.Value.Count - 1; i++)
    90121          for (int j = i + 1; j < entry.Value.Count; j++)
    91             yield return new SwapSequenceMove(entry.Value[i], entry.Value[j], multiComponentVector);
     122            yield return new SwapPositionMove(entry.Value[i], entry.Value[j], multiComponentVector);
    92123      }
    93124    }
    94125
     126    public static int NrOfChangePositionMoves(MultiComponentVectorEncoding mcv) {
     127      int nrOfBins = 0;
     128      foreach (var pi in mcv.PackingInformations) {
     129        if (pi.AssignedBin > nrOfBins)
     130          nrOfBins = pi.AssignedBin;
     131      }
     132      nrOfBins++;
     133      int[] itemsPerBin = new int[nrOfBins];
     134      foreach (var pi in mcv.PackingInformations) {
     135        itemsPerBin[pi.AssignedBin]++;
     136      }
     137      int nrOfSwapPositionMoves = 0;
     138      foreach (int items in itemsPerBin) {
     139        nrOfSwapPositionMoves += (items * (items - 1)) / 2;
     140      }
     141      return nrOfSwapPositionMoves;
     142    }
     143    public static IEnumerable<MultiComponentVectorMove> GenerateChangePositionMoves(MultiComponentVectorEncoding multiComponentVector) {
     144      Dictionary<int, List<int>> indexesPerBin = new Dictionary<int, List<int>>();
     145      for (int i = 0; i < multiComponentVector.PackingInformations.Count; i++) {
     146        int currentBin = multiComponentVector.PackingInformations[i].AssignedBin;
     147        if (!indexesPerBin.ContainsKey(currentBin))
     148          indexesPerBin[currentBin] = new List<int>();
     149        indexesPerBin[currentBin].Add(i);
     150      }
     151      foreach (var entry in indexesPerBin) {
     152        for (int i = 0; i < entry.Value.Count - 1; i++)
     153          for (int j = i + 1; j < entry.Value.Count; j++)
     154            yield return new ChangePositionMove(entry.Value[i], entry.Value[j], multiComponentVector);
     155      }
     156    }
    95157
    96158    public override IOperation Apply() {
  • branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking/3.3/Encodings/MultiComponentVector/Moves/ThreeWay/MultiComponentVectorMoveHardTabuCriterion.cs

    r9440 r9473  
    9494    private bool IsMoveTabu(ItemList<IItem> tabuList, MultiComponentVectorMove move, MultiComponentVectorEncoding multiComponentVector, double moveQuality, bool maximization, bool useAspiration) {
    9595      bool isTabu = false;
    96       SingleItemRotationMove sirm = move as SingleItemRotationMove; 
    97       SingleGroupingMove sgm = move as SingleGroupingMove;   
    98       SwapSequenceMove ssm = move as SwapSequenceMove;
     96      SingleItemRotationMove sirm = move as SingleItemRotationMove;
     97      SingleGroupingMove sgm = move as SingleGroupingMove;
     98      SwapPositionMove spm = move as SwapPositionMove;
     99      ChangePositionMove cpm = move as ChangePositionMove;
     100      MCVTripleMove tm = move as MCVTripleMove;
    99101      var attributes = tabuList.FindAll(ta => ta.GetType().Equals(move.GetMoveAttributeType()));
    100102
     
    102104        foreach (IItem tabuMove in attributes) {
    103105          SingleItemRotationMoveAttribute sirmAttr = (tabuMove as SingleItemRotationMoveAttribute);
     106          if (sirmAttr.MoveQuality.Equals(moveQuality))
     107            return true;
    104108          if (sirmAttr != null
    105109            && (!useAspiration
     
    114118        foreach (IItem tabuMove in attributes) {
    115119          SingleGroupingMoveAttribute sgmAttr = (tabuMove as SingleGroupingMoveAttribute);
     120          if (sgmAttr.MoveQuality.Equals(moveQuality))
     121            return true;
    116122          if (sgmAttr != null
    117123            && (!useAspiration
    118124                || maximization && moveQuality <= sgmAttr.MoveQuality
    119125                || !maximization && moveQuality >= sgmAttr.MoveQuality)) {
    120                   if (sgm.ItemIndex == sgmAttr.ItemIndex || multiComponentVector.PackingInformations[sgm.ItemIndex].AssignedBin == sgmAttr.AssignedBin)
     126                  if ( multiComponentVector.PackingInformations[sgm.Index].ItemIndex ==  multiComponentVector.PackingInformations[sgmAttr.Index].ItemIndex
     127                    || multiComponentVector.PackingInformations[sgm.Index].AssignedBin == sgmAttr.AssignedBin)
    121128                    isTabu = true;
    122129          }
    123130          if (isTabu) break;
    124131        }
    125       } else if (ssm != null) {
     132      } else if (spm != null) {
    126133        foreach (IItem tabuMove in attributes) {
    127           SwapSequenceMoveAttribute ssmAttr = (tabuMove as SwapSequenceMoveAttribute);
    128           if (ssmAttr != null
     134          SwapPositionMoveAttribute spmAttr = (tabuMove as SwapPositionMoveAttribute);
     135          if (spmAttr.MoveQuality.Equals(moveQuality))
     136            return true;
     137          if (spmAttr != null
    129138            && (!useAspiration
    130                 || maximization && moveQuality <= ssmAttr.MoveQuality
    131                 || !maximization && moveQuality >= ssmAttr.MoveQuality)) {
    132                   if (ssm.Index1 == ssmAttr.Index1
    133                     || ssm.Index2 == ssmAttr.Index2
    134                     || multiComponentVector.PackingInformations[ssm.Index1].ItemIndex == ssmAttr.ItemIndex1
    135                     || multiComponentVector.PackingInformations[ssm.Index2].ItemIndex == ssmAttr.ItemIndex2)
     139                || maximization && moveQuality <= spmAttr.MoveQuality
     140                || !maximization && moveQuality >= spmAttr.MoveQuality)) {
     141            if (spm.Index1 == spmAttr.Index1
     142              || spm.Index2 == spmAttr.Index2
     143              || multiComponentVector.PackingInformations[spm.Index1].ItemIndex == spmAttr.ItemIndex1
     144              || multiComponentVector.PackingInformations[spm.Index2].ItemIndex == spmAttr.ItemIndex2)
     145              isTabu = true;
     146          }
     147          if (isTabu) break;
     148        }
     149      } else if (cpm != null) {
     150        foreach (IItem tabuMove in attributes) {
     151          ChangePositionMoveAttribute cpmAttr = (tabuMove as ChangePositionMoveAttribute);
     152          if (cpmAttr.MoveQuality.Equals(moveQuality))
     153            return true;
     154          if (cpmAttr != null
     155            && (!useAspiration
     156                || maximization && moveQuality <= cpmAttr.MoveQuality
     157                || !maximization && moveQuality >= cpmAttr.MoveQuality)) {
     158            if (cpm.Index == cpmAttr.Index
     159        || cpm.TargetIndex == cpmAttr.TargetIndex
     160        || multiComponentVector.PackingInformations[cpm.Index].ItemIndex == cpmAttr.ItemIndex)
     161              isTabu = true;
     162          }
     163          if (isTabu) break;
     164        }
     165      } else if (tm != null) {
     166        foreach (IItem tabuMove in attributes) {
     167          MCVTripleMoveAttribute tmAttr = (tabuMove as MCVTripleMoveAttribute);
     168          if (tmAttr.MoveQuality.Equals(moveQuality))
     169            return true;
     170          if (tmAttr != null
     171            && (!useAspiration
     172                || maximization && moveQuality <= tmAttr.MoveQuality
     173                || !maximization && moveQuality >= tmAttr.MoveQuality)) {
     174                  if ((tm.Index == tmAttr.Index && tm.TargetIndex == tmAttr.TargetIndex)
     175                      || tm.Index == tmAttr.Index
     176                      || multiComponentVector.PackingInformations[tm.Index].ItemIndex == tmAttr.ItemIndex
     177                    )
    136178              isTabu = true;
    137179          }
  • branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking/3.3/Encodings/MultiComponentVector/Moves/ThreeWay/MultiComponentVectorMoveMaker.cs

    r9440 r9473  
    6666    public override IOperation Apply() {
    6767      MultiComponentVectorMove move = MultiComponentVectorMoveParameter.ActualValue;
    68       MultiComponentVectorEncoding MultiComponentVector = MultiComponentVectorParameter.ActualValue;
     68      MultiComponentVectorEncoding multiComponentVector = MultiComponentVectorParameter.ActualValue;
    6969      DoubleValue moveQuality = MoveQualityParameter.ActualValue;
    7070      DoubleValue quality = QualityParameter.ActualValue;
    7171
    72       MultiComponentVector = move.GetVectorAfterMove();
     72      multiComponentVector.PackingInformations = move.GetVectorAfterMove().PackingInformations;
    7373
    7474      quality.Value = moveQuality.Value;
  • branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking/3.3/Encodings/MultiComponentVector/Moves/ThreeWay/MultiComponentVectorMoveSoftTabuCriterion.cs

    r9440 r9473  
    6565    public MultiComponentVectorMoveSoftTabuCriterion()
    6666      : base() {
    67         Parameters.Add(new LookupParameter<MultiComponentVectorMove>("MultiComponentVectorMove", "The move to evaluate."));
     67      Parameters.Add(new LookupParameter<MultiComponentVectorMove>("MultiComponentVectorMove", "The move to evaluate."));
    6868      Parameters.Add(new LookupParameter<MultiComponentVectorEncoding>("MultiComponentVector", "The solution to evaluate."));
    6969      Parameters.Add(new LookupParameter<BoolValue>("MoveTabu", "The variable to store if a move was tabu."));
     
    9494    private bool IsMoveTabu(ItemList<IItem> tabuList, MultiComponentVectorMove move, MultiComponentVectorEncoding multiComponentVector, double moveQuality, bool maximization, bool useAspiration) {
    9595      bool isTabu = false;
    96       SingleItemRotationMove sirm = move as SingleItemRotationMove; 
    97       SingleGroupingMove sgm = move as SingleGroupingMove;   
    98       SwapSequenceMove ssm = move as SwapSequenceMove;
     96
     97      SingleItemRotationMove sirm = move as SingleItemRotationMove;
     98      SingleGroupingMove sgm = move as SingleGroupingMove;
     99      SwapPositionMove spm = move as SwapPositionMove;
     100      ChangePositionMove cpm = move as ChangePositionMove;
     101      MCVTripleMove tm = move as MCVTripleMove;
    99102      var attributes = tabuList.FindAll(ta => ta.GetType().Equals(move.GetMoveAttributeType()));
    100103
     
    106109                || maximization && moveQuality <= sirmAttr.MoveQuality
    107110                || !maximization && moveQuality >= sirmAttr.MoveQuality)) {
    108                   if (sirm.ItemIndex == sirmAttr.ItemIndex && multiComponentVector.PackingInformations[sirm.ItemIndex].Rotated == sirmAttr.ItemRotation)
    109                     isTabu = true;
     111            if (sirm.ItemIndex == sirmAttr.ItemIndex && multiComponentVector.PackingInformations[sirm.ItemIndex].Rotated == sirmAttr.ItemRotation)
     112              isTabu = true;
    110113          }
    111114          if (isTabu) break;
     
    118121                || maximization && moveQuality <= sgmAttr.MoveQuality
    119122                || !maximization && moveQuality >= sgmAttr.MoveQuality)) {
    120                   if (sgm.ItemIndex == sgmAttr.ItemIndex && multiComponentVector.PackingInformations[sgm.ItemIndex].AssignedBin == sgmAttr.AssignedBin)
    121                     isTabu = true;
     123                  if (multiComponentVector.PackingInformations[sgm.Index].ItemIndex == multiComponentVector.PackingInformations[sgmAttr.Index].ItemIndex
     124              && multiComponentVector.PackingInformations[sgm.Index].AssignedBin == sgmAttr.AssignedBin)
     125              isTabu = true;
    122126          }
    123127          if (isTabu) break;
    124128        }
    125       } else if (ssm != null) {
     129      } else if (spm != null) {
    126130        foreach (IItem tabuMove in attributes) {
    127           SwapSequenceMoveAttribute ssmAttr = (tabuMove as SwapSequenceMoveAttribute);
    128           if (ssmAttr != null
     131          SwapPositionMoveAttribute spmAttr = (tabuMove as SwapPositionMoveAttribute);
     132          if (spmAttr != null
    129133            && (!useAspiration
    130                 || maximization && moveQuality <= ssmAttr.MoveQuality
    131                 || !maximization && moveQuality >= ssmAttr.MoveQuality)) {
    132                   if (ssm.Index1 == ssmAttr.Index1
    133                     && ssm.Index2 == ssmAttr.Index2
    134                     && multiComponentVector.PackingInformations[ssm.Index1].ItemIndex == ssmAttr.ItemIndex1
    135                     && multiComponentVector.PackingInformations[ssm.Index2].ItemIndex == ssmAttr.ItemIndex2)
     134                || maximization && moveQuality <= spmAttr.MoveQuality
     135                || !maximization && moveQuality >= spmAttr.MoveQuality)) {
     136            if (spm.Index1 == spmAttr.Index1
     137              && spm.Index2 == spmAttr.Index2
     138              && multiComponentVector.PackingInformations[spm.Index1].ItemIndex == spmAttr.ItemIndex1
     139              && multiComponentVector.PackingInformations[spm.Index2].ItemIndex == spmAttr.ItemIndex2)
     140              isTabu = true;
     141          }
     142          if (isTabu) break;
     143        }
     144      } else if (cpm != null) {
     145        foreach (IItem tabuMove in attributes) {
     146          ChangePositionMoveAttribute cpmAttr = (tabuMove as ChangePositionMoveAttribute);
     147          if (cpmAttr != null
     148            && (!useAspiration
     149                || maximization && moveQuality <= cpmAttr.MoveQuality
     150                || !maximization && moveQuality >= cpmAttr.MoveQuality)) {
     151            if (cpm.Index == cpmAttr.Index
     152        && cpm.TargetIndex == cpmAttr.TargetIndex
     153        && multiComponentVector.PackingInformations[cpm.Index].ItemIndex == cpmAttr.ItemIndex)
     154              isTabu = true;
     155          }
     156          if (isTabu) break;
     157        }
     158      } else if (tm != null) {
     159        foreach (IItem tabuMove in attributes) {
     160          MCVTripleMoveAttribute tmAttr = (tabuMove as MCVTripleMoveAttribute);
     161          if (tmAttr != null
     162            && (!useAspiration
     163                || maximization && moveQuality <= tmAttr.MoveQuality
     164                || !maximization && moveQuality >= tmAttr.MoveQuality)) {
     165            if ((tm.Index == tmAttr.Index && tm.TargetIndex == tmAttr.TargetIndex)
     166                && multiComponentVector.PackingInformations[tm.Index].ItemIndex == tmAttr.ItemIndex
     167                && tm.Rotation == !(tmAttr.RotationAfter.Equals(tmAttr.RotationBefore))
     168                && (tm.Group == tmAttr.GroupAfter && multiComponentVector.PackingInformations[tm.Index].AssignedBin == tmAttr.GroupBefore)
     169              )
    136170              isTabu = true;
    137171          }
     
    140174      }
    141175
    142      
     176
    143177
    144178      return isTabu;
  • branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking/3.3/Encodings/MultiComponentVector/Moves/ThreeWay/MultiComponentVectorTabuMaker.cs

    r9440 r9473  
    6464      SingleGroupingMove sgm = move as SingleGroupingMove;
    6565      if (sgm != null)
    66         return new SingleGroupingMoveAttribute(sgm.ItemIndex, solution.PackingInformations[sgm.ItemIndex].AssignedBin, baseQuality);
    67       SwapSequenceMove ssm = move as SwapSequenceMove;
    68       if (ssm != null)
    69         return new SwapSequenceMoveAttribute(ssm.Index1, ssm.Index2, solution.PackingInformations[ssm.Index1].ItemIndex, solution.PackingInformations[ssm.Index2].ItemIndex, baseQuality);
     66        return new SingleGroupingMoveAttribute(sgm.Index, solution.PackingInformations[sgm.Index].AssignedBin, baseQuality);
     67      SwapPositionMove spm = move as SwapPositionMove;
     68      if (spm != null)
     69        return new SwapPositionMoveAttribute(spm.Index1, spm.Index2, solution.PackingInformations[spm.Index1].ItemIndex, solution.PackingInformations[spm.Index2].ItemIndex, baseQuality);
     70      ChangePositionMove cpm = move as ChangePositionMove;
     71      if (cpm != null)
     72        return new ChangePositionMoveAttribute(cpm.Index, cpm.TargetIndex, solution.PackingInformations[cpm.Index].ItemIndex, baseQuality);
     73      MCVTripleMove tm = move as MCVTripleMove;
     74      if (tm != null)
     75        return new MCVTripleMoveAttribute(
     76          tm.Index,
     77          tm.TargetIndex,
     78          solution.PackingInformations[tm.Index].ItemIndex,
     79          solution.PackingInformations[tm.Index].Rotated,
     80          tm.Rotation ^ solution.PackingInformations[tm.Index].Rotated,
     81          solution.PackingInformations[tm.Index].AssignedBin,
     82          tm.Group,
     83          baseQuality);
    7084
    7185      else return solution;
  • branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking/3.3/Encodings/MultiComponentVector/Moves/ThreeWay/StochasticMultiComponentVectorMoveGenerator.cs

    r9440 r9473  
    6060      MultiComponentVectorMove[] moves = new MultiComponentVectorMove[sampleSize];
    6161      var rm = new List<MultiComponentVectorMove> (GenerateRotationMoves(multiComponentVector));
    62       var gm = new List<MultiComponentVectorMove> (GenerateSingleGroupingMoves(multiComponentVector));
    63       var sm = new List<MultiComponentVectorMove> (GenerateSwapSequenceMoves(multiComponentVector));
     62      var gm = new List<MultiComponentVectorMove>(GenerateSingleGroupingMoves(multiComponentVector));
     63      var sm = new List<MultiComponentVectorMove>(GenerateSwapPositionMoves(multiComponentVector));
     64      var cpm = new List<MultiComponentVectorMove>(GenerateChangePositionMoves(multiComponentVector));
    6465
    6566      for (int i = 0; i < sampleSize; i++) {
    66         int typeDecision = random.Next(3);
     67        int typeDecision = random.Next(4);
    6768        switch (typeDecision) {
    6869          case 0: moves[i] = rm[random.Next(rm.Count)];
     
    7172            break;
    7273          case 2: moves[i] = sm[random.Next(sm.Count)];
     74            break;
     75          case 3: moves[i] = cpm[random.Next(cpm.Count)];
    7376            break;
    7477          default:
  • branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking/3.3/Encodings/MultiComponentVector/MultiComponentVectorEncoding.cs

    r9440 r9473  
    6868      MultiComponentVectorEncoding mce = obj as MultiComponentVectorEncoding;
    6969      if (mce != null && mce.PackingInformations != null && mce.PackingInformations.Count == this.PackingInformations.Count) {
    70         for (int i = 0; i <= mce.PackingInformations.Count; i++) {
     70        for (int i = 0; i < mce.PackingInformations.Count; i++) {
    7171          if (mce.PackingInformations[i] != this.PackingInformations[i])
    7272            return false;
     
    134134      var result = new ItemList<PackingInformation>();
    135135      foreach (int itemIndex in permutation) {
    136         result.Add(new PackingInformation (itemIndex, random.Next(0, lowerBound + 1), random.Next(0,100) > 60 ? true : false));
     136        result.Add(new PackingInformation(itemIndex, random.Next(0, lowerBound + 1), random.Next(0, 100) > 60 ? true : false));
     137      }
     138      return result;
     139    }
     140
     141    public static ItemList<PackingInformation> CreateListRandomlyWithSortedSequence(int items, int lowerBound, IRandom random) {
     142      Permutation permutation = new Permutation(PermutationTypes.Absolute, items);
     143      var result = new ItemList<PackingInformation>();
     144      foreach (int itemIndex in permutation) {
     145        result.Add(new PackingInformation(itemIndex, random.Next(0, lowerBound + 1), false));
    137146      }
    138147      return result;
  • branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking/3.3/Encodings/MultiComponentVector/MultiComponentVectorRandomCreator.cs

    r9440 r9473  
    4343      get { return (IValueLookupParameter<IntValue>)Parameters["LowerBound"]; }
    4444    }
     45    public IValueParameter<BoolValue> SortedSequenceParameter {
     46      get { return (IValueParameter<BoolValue>)Parameters["SortedSequence"]; }
     47    }
    4548
    4649    [StorableConstructor]
     
    5255    }
    5356
    54     public MultiComponentVectorRandomCreator()
     57    public MultiComponentVectorRandomCreator()
    5558      : base() {
    5659      Parameters.Add(new LookupParameter<IRandom>("Random", "The pseudo random number generator."));
    5760      Parameters.Add(new ValueLookupParameter<IntValue>("PackingItems", "The number of packing-items handled in this problem instance."));
    5861      Parameters.Add(new ValueLookupParameter<IntValue>("LowerBound", "The lower possible number of bins needed to solve this problem (taken from Dell'Amico, Martello and Vigo; 2002)"));
     62      Parameters.Add(new ValueParameter<BoolValue>("SortedSequence", "Determines if the items of the created instances are to be sorted by their size."));
    5963
    6064      EncodedSolutionParameter.ActualName = "MultiComponentVector";
     65      SortedSequenceParameter.ActualValue = new BoolValue(false);
    6166    }
    6267
    6368
    64     public static MultiComponentVectorEncoding Apply(int items, int lowerBound, IRandom random) {
     69    public static MultiComponentVectorEncoding Apply(int items, int lowerBound, IRandom random, bool sortedSequence) {
    6570      var solution = new MultiComponentVectorEncoding();
    66       solution.PackingInformations = PackingInformation.CreateListRandomly(items, lowerBound, random);
     71      if (sortedSequence)
     72        solution.PackingInformations = PackingInformation.CreateListRandomlyWithSortedSequence(items, lowerBound, random);
     73      else
     74        solution.PackingInformations = PackingInformation.CreateListRandomly(items, lowerBound, random);
    6775      return solution;
    6876    }
    6977
    7078    protected override IPackingSolutionEncoding CreateSolution() {
    71       return Apply(PackingItemsParameter.ActualValue.Value, LowerBoundParameter.ActualValue.Value, RandomParameter.ActualValue);
     79      return Apply(PackingItemsParameter.ActualValue.Value, LowerBoundParameter.ActualValue.Value, RandomParameter.ActualValue, SortedSequenceParameter.Value.Value);
    7280    }
    7381  }
  • branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking/3.3/Evaluators/Abstract/PackingRatioRegularIdenticalBinEvaluator.cs

    r9440 r9473  
    9393        double usedSpaceInThisBin = packedItemsInThisBin.Select(s => s.Value.MultipliedMeasures).Sum();
    9494        //k = 2 --> (Fi/C)*(Fi/C)
    95         result += (((usedSpaceInThisBin) / (usableSpace)) * ((usedSpaceInThisBin) / (usableSpace))) / (i + 1);
     95        result += (((usedSpaceInThisBin) / (usableSpace)) * ((usedSpaceInThisBin) / (usableSpace))) / (i*i + 1);
    9696      }
    9797
  • branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking/3.3/HeuristicLab.Problems.BinPacking-3.3.csproj

    r9440 r9473  
    176176    <Compile Include="Decoders\3D\DBL\DeepestBottomLeftMultiComponentVectorDecoder.cs" />
    177177    <Compile Include="Decoders\3D\DBL\DeepestBottomLeftFunctions.cs" />
     178    <Compile Include="Decoders\3D\EP\ExtremePointPotvinDecoder3D.cs">
     179      <SubType>Code</SubType>
     180    </Compile>
    178181    <Compile Include="Decoders\3D\EP\ExtremePointsFunctions3D.cs" />
    179182    <Compile Include="Decoders\3D\DBL\DeepestBottomLeftGroupingVectorDecoder.cs" />
     
    196199    <Compile Include="Encodings\GroupingVector\GroupingVectorManipulator.cs" />
    197200    <Compile Include="Encodings\GroupingVector\GroupingVectorRandomCreator.cs" />
    198     <Compile Include="Encodings\MultiComponentVector\Moves\ThreeWay\Attributes\SwapSequenceMoveAttribute.cs" />
     201    <Compile Include="Encodings\MultiComponentVector\Moves\ThreeWay\Attributes\ChangePositionMoveAttribute.cs" />
     202    <Compile Include="Encodings\MultiComponentVector\Moves\ThreeWay\Attributes\MCVTripleMoveAttribute.cs" />
     203    <Compile Include="Encodings\MultiComponentVector\Moves\ThreeWay\Attributes\SwapPositionMoveAttribute.cs" />
    199204    <Compile Include="Encodings\MultiComponentVector\Moves\ThreeWay\Attributes\SingleGroupingMoveAttribute.cs" />
    200205    <Compile Include="Encodings\MultiComponentVector\Moves\ThreeWay\Attributes\MultiComponentVectorMoveAttribute.cs" />
    201206    <Compile Include="Encodings\MultiComponentVector\Moves\ThreeWay\Attributes\SingleItemRotationMoveAttribute.cs" />
     207    <Compile Include="Encodings\MultiComponentVector\Moves\ThreeWay\StochasticMCVTripleMoveGenerator.cs" />
     208    <Compile Include="Encodings\MultiComponentVector\Moves\ThreeWay\ExhaustiveMCVTripleMoveGenerator.cs" />
     209    <Compile Include="Encodings\MultiComponentVector\Moves\ThreeWay\Moves\ChangePositionMove.cs" />
     210    <Compile Include="Encodings\MultiComponentVector\Moves\ThreeWay\Moves\MCVTripleMove.cs" />
    202211    <Compile Include="Encodings\MultiComponentVector\Moves\ThreeWay\MultiComponentVectorMoveHardTabuCriterion.cs" />
    203212    <Compile Include="Encodings\MultiComponentVector\Moves\ThreeWay\Moves\MultiComponentVectorMove.cs" />
    204     <Compile Include="Encodings\MultiComponentVector\Moves\ThreeWay\Moves\SwapSequenceMove.cs" />
     213    <Compile Include="Encodings\MultiComponentVector\Moves\ThreeWay\Moves\SwapPositionMove.cs" />
    205214    <Compile Include="Encodings\MultiComponentVector\Moves\ThreeWay\Moves\SingleItemRotationMove.cs" />
    206215    <Compile Include="Encodings\MultiComponentVector\Moves\ThreeWay\ExhaustiveMultiComponentVectorMoveGenerator.cs" />
     
    211220    <Compile Include="Encodings\MultiComponentVector\Moves\ThreeWay\MultiComponentVectorTabuMaker.cs" />
    212221    <Compile Include="Encodings\MultiComponentVector\Moves\ThreeWay\StochasticMultiComponentVectorMoveGenerator.cs" />
     222    <Compile Include="Encodings\MultiComponentVector\MultiComponentVectorEncoding.cs">
     223      <SubType>Code</SubType>
     224    </Compile>
    213225    <Compile Include="Encodings\MultiComponentVector\PartiallyMatchedMultiComponentVectorCrossover.cs" />
    214226    <Compile Include="Encodings\MultiComponentVector\MultiComponentVectorCrossover.cs" />
    215     <Compile Include="Encodings\MultiComponentVector\MultiComponentVectorEncoding.cs" />
    216227    <Compile Include="Encodings\MultiComponentVector\MultiComponentVectorManipulator.cs" />
    217228    <Compile Include="Encodings\MultiComponentVector\MultiComponentVectorRandomCreator.cs" />
     
    225236    <Compile Include="Encodings\PackingSolutionCrossover.cs" />
    226237    <Compile Include="Encodings\PackingSolutionManipulator.cs" />
     238    <Compile Include="Encodings\Potvin\PotvinEncoding.cs">
     239      <SubType>Code</SubType>
     240    </Compile>
     241    <Compile Include="Encodings\Potvin\PotvinRandomCreator.cs">
     242      <SubType>Code</SubType>
     243    </Compile>
    227244    <Compile Include="Evaluators\2D\BinUtilizationRectangularIdenticalBinEvaluator.cs" />
    228245    <Compile Include="Evaluators\2D\PackingRatioRectangularIdenticalBinEvaluator.cs" />
     
    240257    <Compile Include="Instances\BPPORLIBParser.cs" />
    241258    <Compile Include="Instances\BPPORLIBDataDescriptor.cs" />
     259    <Compile Include="Interfaces\IPotvinOperator.cs" />
    242260    <Compile Include="Interfaces\IMultiComponentVectorMoveOperator.cs" />
    243261    <Compile Include="Interfaces\IGroupingVectorMoveOperator.cs" />
  • branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking/3.3/Plugin.cs

    r9440 r9473  
    2626  /// Plugin class for HeuristicLab.Problems.BinPacking plugin.
    2727  /// </summary>
    28   [Plugin("HeuristicLab.Problems.BinPacking", "3.3.7.9348")]
     28  [Plugin("HeuristicLab.Problems.BinPacking", "3.3.7.9440")]
    2929  [PluginFile("HeuristicLab.Problems.BinPacking-3.3.dll", PluginFileType.Assembly)]
    3030  [PluginDependency("HeuristicLab.Common", "3.3")]
  • branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking/3.3/Problem/CuboidIdenticalBinPackingProblem.cs

    r9440 r9473  
    4444using HeuristicLab.Problems.Instances;
    4545using HeuristicLab.Encodings.PackingEncoding.MultiComponentVector;
     46using HeuristicLab.Encodings.PackingEncoding.Potvin;
    4647
    4748namespace HeuristicLab.Problems.BinPacking.Problem {
     
    125126      } else if (SolutionCreator is MultiComponentVectorRandomCreator) {
    126127        PackingSolutionDecoder = new ExtremePointMultiComponentVectorDecoder3D();
     128      } else if (SolutionCreator is PotvinRandomCreator) {
     129        PackingSolutionDecoder = new ExtremePointPotvinDecoder3D();
    127130      } else {
    128131        string error = "The given problem does not support the selected solution-creator.";
  • branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking/3.3/Problem/RegularIdenticalBinPackingProblem.cs

    r9440 r9473  
    4343using HeuristicLab.Problems.Instances;
    4444using HeuristicLab.Encodings.PackingEncoding.MultiComponentVector;
     45using HeuristicLab.Encodings.PackingEncoding.Potvin;
    4546
    4647namespace HeuristicLab.Problems.BinPacking.Problem {
     
    138139        Operators.AddRange(ApplicationManager.Manager.GetInstances<IMultiComponentVectorOperator>());
    139140        InitializeDecoder();
     141      } else if (SolutionCreator.GetType() == typeof(PotvinRandomCreator)) {
     142        Operators.AddRange(ApplicationManager.Manager.GetInstances<IPotvinOperator>());
     143        InitializeDecoder();
    140144      }
    141145    }
Note: See TracChangeset for help on using the changeset viewer.