/// <summary> /// Inits computation resources /// </summary> public static void Initialize() { // Computation mode specific settings: azure or app domain ? switch (Shared.Config.TaskExecutionMode) { case TaskExecutionMode.Azure: AzureBatchManager.InitializeAsync().Wait(); break; case TaskExecutionMode.Linear: case TaskExecutionMode.Parallel: AppDomainRunner.Initialize(); break; default: throw new ArgumentOutOfRangeException(); } }
/// <summary> /// Releases the computation resources at the end of optimization routine /// </summary> public static void Dispose() { // -1- Clean up Task Execution resources switch (Shared.Config.TaskExecutionMode) { case TaskExecutionMode.Azure: AzureBatchManager.DisposeAsync().Wait(); break; case TaskExecutionMode.Linear: case TaskExecutionMode.Parallel: // -2- Release AppDomain AppDomainRunner.Dispose(); break; default: throw new ArgumentOutOfRangeException(); } }