- Timestamp:
- 08/03/15 00:03:18 (9 years ago)
- Location:
- branches/HeuristicLab.Problems.GrammaticalOptimization/Evaluation
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HeuristicLab.Problems.GrammaticalOptimization/Evaluation/MainWindow.xaml
r12824 r12832 73 73 <TextBlock Margin="2" Grid.Column="0" Grid.Row="1" VerticalAlignment="Center">MaxIterations:</TextBlock> 74 74 <TextBox Name="TextBoxMaxIterations" Margin="2" Grid.Column="1" Grid.Row="1" Width="100" VerticalAlignment="Center" TextAlignment="Right" Text="{Binding MaxIterations}"></TextBox> 75 <TextBlock Margin="2" Grid.Column="2" Grid.Row="1" VerticalAlignment="Center">MaxThreads:</TextBlock> 76 <TextBox Name="MaxThreads" Margin="2" Grid.Column="3" Grid.Row="1" Width="100" VerticalAlignment="Center" TextAlignment="Right" Text="{Binding MaxThreads}"></TextBox> 75 77 <TextBlock Margin="2" Grid.Column="2" Grid.Row="0" VerticalAlignment="Center">MaxLen:</TextBlock> 76 78 <TextBox Name="TextBoxMaxLen" Margin="2" Grid.Column="3" Grid.Row="0" Width="100" VerticalAlignment="Center" TextAlignment="Right" Text="{Binding MaxLen}"></TextBox> -
branches/HeuristicLab.Problems.GrammaticalOptimization/Evaluation/MainWindow.xaml.cs
r12830 r12832 3 3 using System.Text; 4 4 using System.Threading; 5 using System.Threading.Tasks; 5 6 using System.Windows.Documents; 6 7 using System.Xml.Serialization; … … 45 46 vm.MaxIterations = 500000; 46 47 vm.NrRuns = 20; 48 vm.MaxThreads = 5; 47 49 } 48 50 … … 126 128 // File.WriteAllBytes(run.SvgFile, mctsSolver.GenerateSvg()); 127 129 //} 130 mctsSolver.FreeAll(); 128 131 } 129 132 } … … 183 186 } 184 187 188 189 185 190 for (int i = 0; i < vm.NrRuns; i++) 186 191 { … … 218 223 219 224 vm.Runs.Add(run); 220 221 ThreadPool.QueueUserWorkItem(DoRun, run); 222 } 225 } 226 Task.Run(() => 227 Parallel.For(0, vm.NrRuns, new ParallelOptions {MaxDegreeOfParallelism = vm.MaxThreads}, 228 i => DoRun(vm.Runs[i]))); 223 229 } 224 230 -
branches/HeuristicLab.Problems.GrammaticalOptimization/Evaluation/ViewModel/EvaluationViewModel.cs
r12815 r12832 107 107 this.maxIterations = value; 108 108 this.OnPropertyChanged("MaxIterations"); 109 } 110 } 111 112 private int maxThreads; 113 114 public int MaxThreads 115 { 116 get { return this.maxThreads; } 117 set 118 { 119 this.maxThreads = value; 120 this.OnPropertyChanged("MaxThreads"); 109 121 } 110 122 }
Note: See TracChangeset
for help on using the changeset viewer.