Changeset 6445 for branches/HeuristicLab.MetaOptimization
- Timestamp:
- 06/20/11 08:56:15 (14 years ago)
- Location:
- branches/HeuristicLab.MetaOptimization
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HeuristicLab.MetaOptimization/HeuristicLab.MetaOptimization.Test/HeuristicLab.MetaOptimization.Test.csproj
r6017 r6445 379 379 </ItemGroup> 380 380 <ItemGroup> 381 <Compile Include="ObjectDumper.cs" /> 381 382 <Compile Include="Program.cs" /> 382 383 <Compile Include="Properties\AssemblyInfo.cs" /> -
branches/HeuristicLab.MetaOptimization/HeuristicLab.MetaOptimization.Test/Program.cs
r6421 r6445 63 63 64 64 65 bool y = ParameterConfiguration.IsSubclassOfRawGeneric(typeof(Tuple<,,,>), typeof(Tuple<,>)); 66 bool a = ParameterConfiguration.IsSubclassOfRawGeneric(typeof(Tuple<>), typeof(Tuple<int>)); 67 68 65 69 var x = typeof(float).IsPrimitive; 66 70 -
branches/HeuristicLab.MetaOptimization/HeuristicLab.Problems.MetaOptimization/3.3/AlgorithmExecutor.cs
r6421 r6445 22 22 using System; 23 23 using System.Threading; 24 using HeuristicLab. Optimization;24 using HeuristicLab.Core; 25 25 26 26 namespace HeuristicLab.Problems.MetaOptimization { 27 27 public static class AlgorithmExtensions { 28 public static void StartSync(this I Algorithm algorithm, CancellationToken cancellationToken) {29 var executor = new AlgorithmExecutor( algorithm, cancellationToken);28 public static void StartSync(this IExecutable executable, CancellationToken cancellationToken) { 29 var executor = new AlgorithmExecutor(executable, cancellationToken); 30 30 executor.StartSync(); 31 31 } … … 36 36 /// </summary> 37 37 internal class AlgorithmExecutor { 38 private I Algorithm algorithm;38 private IExecutable executable; 39 39 private AutoResetEvent waitHandle = new AutoResetEvent(false); 40 40 private CancellationToken cancellationToken; 41 41 42 public AlgorithmExecutor(I Algorithm algorithm, CancellationToken cancellationToken) {43 this. algorithm = algorithm;42 public AlgorithmExecutor(IExecutable executable, CancellationToken cancellationToken) { 43 this.executable = executable; 44 44 this.cancellationToken = cancellationToken; 45 45 } 46 46 47 47 public void StartSync() { 48 algorithm.Stopped += new EventHandler(algorithm_Stopped);49 algorithm.Paused += new EventHandler(algorithm_Paused);48 executable.Stopped += new EventHandler(algorithm_Stopped); 49 executable.Paused += new EventHandler(algorithm_Paused); 50 50 51 51 using (CancellationTokenRegistration registration = cancellationToken.Register(new Action(cancellationToken_Canceled))) { 52 algorithm.Start();52 executable.Start(); 53 53 waitHandle.WaitOne(); 54 54 waitHandle.Dispose(); 55 55 } 56 56 57 algorithm.Stopped -= new EventHandler(algorithm_Stopped);58 algorithm.Paused -= new EventHandler(algorithm_Paused);59 if ( algorithm.ExecutionState == Core.ExecutionState.Started) {60 algorithm.Pause();57 executable.Stopped -= new EventHandler(algorithm_Stopped); 58 executable.Paused -= new EventHandler(algorithm_Paused); 59 if (executable.ExecutionState == Core.ExecutionState.Started) { 60 executable.Pause(); 61 61 } 62 62 cancellationToken.ThrowIfCancellationRequested(); -
branches/HeuristicLab.MetaOptimization/HeuristicLab.Problems.MetaOptimization/3.3/Encoding/ParameterConfigurations/ParameterConfiguration.cs
r6421 r6445 316 316 return null; 317 317 } 318 318 319 } 319 320 … … 351 352 } 352 353 353 p rivatestatic bool IsSubclassOfRawGeneric(Type generic, Type toCheck) {354 public static bool IsSubclassOfRawGeneric(Type generic, Type toCheck) { 354 355 while (toCheck != typeof(object)) { 355 356 var cur = toCheck.IsGenericType ? toCheck.GetGenericTypeDefinition() : toCheck;
Note: See TracChangeset
for help on using the changeset viewer.