Free cookie consent management tool by TermsFeed Policy Generator

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

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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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;
Note: See TracChangeset for help on using the changeset viewer.