- Timestamp:
- 12/14/16 20:45:46 (8 years ago)
- Location:
- branches/MemPRAlgorithm/HeuristicLab.Algorithms.MemPR/3.3
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/MemPRAlgorithm/HeuristicLab.Algorithms.MemPR/3.3/HeuristicLab.Algorithms.MemPR-3.3.csproj
r14487 r14492 162 162 <Private>False</Private> 163 163 </ProjectReference> 164 <ProjectReference Include="..\..\HeuristicLab.Encodings.LinearLinkageEncoding\3. 3\HeuristicLab.Encodings.LinearLinkageEncoding-3.4.csproj">164 <ProjectReference Include="..\..\HeuristicLab.Encodings.LinearLinkageEncoding\3.4\HeuristicLab.Encodings.LinearLinkageEncoding-3.4.csproj"> 165 165 <Project>{166507c9-ef26-4370-bb80-699742a29d4f}</Project> 166 166 <Name>HeuristicLab.Encodings.LinearLinkageEncoding-3.4</Name> 167 <Private>False</Private> 167 168 </ProjectReference> 168 169 <ProjectReference Include="..\..\HeuristicLab.Encodings.PermutationEncoding\3.3\HeuristicLab.Encodings.PermutationEncoding-3.3.csproj"> -
branches/MemPRAlgorithm/HeuristicLab.Algorithms.MemPR/3.3/LinearLinkage/LinearLinkageMemPR.cs
r14487 r14492 120 120 tabu[i, current[i]] = quality; 121 121 } 122 122 123 123 // this dictionary holds the last relevant links 124 var links = new BidirectionalDictionary<int, int>(); 124 var groupItems = new List<int>(); 125 var lleb = current.ToBackLinks(); 125 126 Move bestOfTheRest = null; 126 127 var bestOfTheRestF = double.NaN; … … 128 129 for (var iter = 0; iter < int.MaxValue; iter++) { 129 130 // clear the dictionary before a new pass through the array is made 130 links.Clear();131 groupItems.Clear(); 131 132 for (var i = 0; i < current.Length; i++) { 132 133 if (subspace != null && !subspace[i]) { 133 links.RemoveBySecond(i); 134 links.Add(i, current[i]); 134 if (lleb[i] != i) 135 groupItems.Remove(lleb[i]); 136 groupItems.Add(i); 135 137 continue; 136 138 } … … 141 143 if (bestOfTheRest != null) { 142 144 bestOfTheRest.Apply(current); 145 bestOfTheRest.ApplyToLLEb(lleb); 143 146 currentScope.Fitness = bestOfTheRestF; 144 147 quality = bestOfTheRestF; … … 162 165 break; 163 166 } else { 164 foreach (var move in MoveGenerator.GenerateForItem(i, next, links)) {167 foreach (var move in MoveGenerator.GenerateForItem(i, groupItems, current, lleb)) { 165 168 // we intend to break link i -> next 166 169 var qualityToBreak = tabu[i, next]; … … 185 188 if (isAspired) bestQuality = quality; 186 189 187 move. UpdateLinks(links);190 move.ApplyToLLEb(lleb); 188 191 189 192 if (FitnessComparer.IsBetter(maximization, moveF, bestOfTheWalkF)) { … … 209 212 } 210 213 } 211 links.RemoveBySecond(i); 212 links.Add(i, current[i]); 214 if (lleb[i] != i) 215 groupItems.Remove(lleb[i]); 216 groupItems.Add(i); 213 217 if (evaluations >= maxEvals) break; 214 218 if (token.IsCancellationRequested) break; -
branches/MemPRAlgorithm/HeuristicLab.Algorithms.MemPR/3.3/Plugin.cs
r14420 r14492 33 33 [PluginDependency("HeuristicLab.Data", "3.3")] 34 34 [PluginDependency("HeuristicLab.Encodings.BinaryVectorEncoding", "3.3")] 35 [PluginDependency("HeuristicLab.Encodings.LinearLinkageEncoding", "3.4")] 36 [PluginDependency("HeuristicLab.Encodings.PermutationEncoding", "3.3")] 35 37 [PluginDependency("HeuristicLab.Operators", "3.3")] 36 38 [PluginDependency("HeuristicLab.Optimization", "3.3")]
Note: See TracChangeset
for help on using the changeset viewer.