Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
06/09/13 12:58:39 (11 years ago)
Author:
jhelm
Message:

#1966: Bugfixing; Refactoring; Performancetuning;

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking/3.3/Encodings/PackingPlans/PackingPlan.cs

    r9596 r9599  
    3838using HeuristicLab.Encodings.PackingEncoding.GroupingVector;
    3939using HeuristicLab.Encodings.PackingEncoding.PackingSequence;
     40using HeuristicLab.Encodings.IntegerVectorEncoding;
    4041
    4142namespace HeuristicLab.Encodings.PackingEncoding.PackingPlan {
     
    128129            bp.PackItem(id, itemMeasures[id], position);
    129130            remainingIDs.Remove(id);
     131            break;
    130132          }
    131133        }
     
    142144      }
    143145      UpdateBinPackings();
     146
     147      var newSolution = new ObservableDictionary<int,ItemList<PackingInformation>> ();
     148      foreach (var bp in BinPackings) {
     149        int binIndex = newSolution.Count;
     150        newSolution[binIndex] = new ItemList<PackingInformation>();
     151        foreach (var entry in bp.ItemPositions)
     152          newSolution[binIndex].Add(new PackingInformation (entry.Key, entry.Value.Rotated));
     153      }
     154      solution.PackingInformations = newSolution;
    144155    }
    145156    public void Pack(GroupingVectorEncoding solution, ItemList<I> itemMeasures) {
     
    167178            bp.PackItem(id, itemMeasures[id], position);
    168179            remainingIDs.Remove(id);
     180            break;
    169181          }
    170182        }
     
    181193      }
    182194      UpdateBinPackings();
     195
     196      var newSolution = new int[solution.GroupingVector.Length];
     197      int binIndex = 0;
     198      foreach (var bp in BinPackings) {
     199        foreach (var entry in bp.ItemPositions)
     200          newSolution[entry.Key] = binIndex;
     201        binIndex++;
     202      }
     203      solution.GroupingVector = new IntegerVector (newSolution);
    183204    }
    184205    public void Pack(PackingSequenceEncoding solution, ItemList<I> itemMeasures) {
Note: See TracChangeset for help on using the changeset viewer.