Changeset 9599 for branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking/3.3/Encodings/PackingPlans/PackingPlan.cs
- Timestamp:
- 06/09/13 12:58:39 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking/3.3/Encodings/PackingPlans/PackingPlan.cs
r9596 r9599 38 38 using HeuristicLab.Encodings.PackingEncoding.GroupingVector; 39 39 using HeuristicLab.Encodings.PackingEncoding.PackingSequence; 40 using HeuristicLab.Encodings.IntegerVectorEncoding; 40 41 41 42 namespace HeuristicLab.Encodings.PackingEncoding.PackingPlan { … … 128 129 bp.PackItem(id, itemMeasures[id], position); 129 130 remainingIDs.Remove(id); 131 break; 130 132 } 131 133 } … … 142 144 } 143 145 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; 144 155 } 145 156 public void Pack(GroupingVectorEncoding solution, ItemList<I> itemMeasures) { … … 167 178 bp.PackItem(id, itemMeasures[id], position); 168 179 remainingIDs.Remove(id); 180 break; 169 181 } 170 182 } … … 181 193 } 182 194 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); 183 204 } 184 205 public void Pack(PackingSequenceEncoding solution, ItemList<I> itemMeasures) {
Note: See TracChangeset
for help on using the changeset viewer.