Changeset 6677 for trunk/sources
- Timestamp:
- 08/23/11 10:30:14 (13 years ago)
- Location:
- trunk/sources/HeuristicLab.Optimization/3.3
- Files:
-
- 1 added
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Optimization/3.3/HeuristicLab.Optimization-3.3.csproj
r6673 r6677 111 111 </ItemGroup> 112 112 <ItemGroup> 113 <Compile Include="RunCollectionSorter.cs" /> 113 114 <Compile Include="RunCollectionValueRemover.cs" /> 114 115 <Compile Include="IRunCollectionModifier.cs" /> -
trunk/sources/HeuristicLab.Optimization/3.3/RunCollectionModificationEvaluator.cs
r6667 r6677 50 50 public void Evaluate() { 51 51 RunCollection.UpdateOfRunsInProgress = true; 52 var runs = RunCollection.Where(r => r.Visible).ToList(); 52 var runs = RunCollection.Select((r, i) => new {Run = r, r.Visible, Index = i}).ToList(); 53 var visibleRuns = runs.Where(r => r.Visible).Select(r => r.Run).ToList(); 54 int n = visibleRuns.Count; 55 if (n == 0) 56 return; 53 57 foreach (var modifier in Modifiers.CheckedItems) 54 modifier.Value.Modify(runs); 55 RunCollection.UpdateOfRunsInProgress = false; 56 if (runs.Count > 0) { // force update 57 var run = (IRun) runs[0].Clone(); 58 modifier.Value.Modify(visibleRuns); 59 if (n != visibleRuns.Count || 60 runs.Where(r => r.Visible).Zip(visibleRuns, (r1, r2) => r1.Run != r2).Any()) { 61 var runIt = runs.GetEnumerator(); 62 var visibleRunIt = visibleRuns.GetEnumerator(); 63 var newRuns = new List<IRun>(); 64 while (runIt.MoveNext()) { 65 if (!runIt.Current.Visible) 66 newRuns.Add(runIt.Current.Run); 67 else if (visibleRunIt.MoveNext()) 68 newRuns.Add(visibleRunIt.Current); 69 } 70 while (visibleRunIt.MoveNext()) 71 newRuns.Add(visibleRunIt.Current); 72 RunCollection.Clear(); 73 RunCollection.AddRange(newRuns); 74 } else if (runs.Count > 0) { // force update 75 var run = (IRun) runs[0].Run.Clone(); 58 76 RunCollection.Add(run); 59 77 RunCollection.Remove(run); 60 78 } 79 RunCollection.UpdateOfRunsInProgress = false; 61 80 } 62 81 }
Note: See TracChangeset
for help on using the changeset viewer.