Changeset 14631 for branches/OptimizationNetworks/HeuristicLab.Networks.IntegratedOptimization/3.3/OrchestratedAlgorithmNode.cs
- Timestamp:
- 02/01/17 10:17:12 (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/OptimizationNetworks/HeuristicLab.Networks.IntegratedOptimization/3.3/OrchestratedAlgorithmNode.cs
r14628 r14631 65 65 [StorableConstructor] 66 66 protected OrchestratedAlgorithmNode(bool deserializing) : base(deserializing) { } 67 protected OrchestratedAlgorithmNode(OrchestratedAlgorithmNode original, Cloner cloner) : base(original, cloner) { 67 protected OrchestratedAlgorithmNode(OrchestratedAlgorithmNode original, Cloner cloner) 68 : base(original, cloner) { 68 69 EvalHook = cloner.Clone(original.EvalHook); 69 70 RegisterEvents(); 70 71 } 71 72 public OrchestratedAlgorithmNode() : this("OrchestratedAlgorithmNode") { } 72 public OrchestratedAlgorithmNode(string name) : base(name) { 73 public OrchestratedAlgorithmNode(string name) 74 : base(name) { 73 75 var orchestrationPort = new MessagePort(OrchestrationPortName); 74 76 Ports.Add(orchestrationPort); … … 106 108 IMessageValue problemMsgVal; 107 109 if (e.Value.Values.TryGetValue("Problem", out problemMsgVal)) { 108 var prob = (IHeuristicOptimizationProblem)problemMsgVal.Value.Clone(); 109 110 if (messageFlags.HasFlag(OrchestrationMessage.SetEvalHook)) { 111 var instEval = prob.Evaluator as InstrumentedOperator; 110 var problem = (IProblem)problemMsgVal.Value.Clone(); 111 112 var heuristicOptimizationProblem = problem as IHeuristicOptimizationProblem; 113 if (heuristicOptimizationProblem != null && messageFlags.HasFlag(OrchestrationMessage.SetEvalHook)) { 114 var instEval = heuristicOptimizationProblem.Evaluator as InstrumentedOperator; 112 115 if (instEval != null && EvalHook != null) instEval.AfterExecutionOperators.Add(EvalHook); 113 116 } … … 122 125 } 123 126 124 Algorithm.Problem = prob ;127 Algorithm.Problem = problem; 125 128 126 129 if (multiAnalyzer != null) { … … 189 192 try { 190 193 Algorithm.Pause(); 191 } catch (InvalidOperationException) { 194 } 195 catch (InvalidOperationException) { 192 196 // ExecutionState might have changed since we accepted the message 193 197 } … … 203 207 try { 204 208 Algorithm.Stop(); 205 } catch (InvalidOperationException) { 209 } 210 catch (InvalidOperationException) { 206 211 // ExecutionState might have changed since we accepted the message 207 } catch (NullReferenceException) { 212 } 213 catch (NullReferenceException) { 208 214 // BasicAlgorithm might have stopped since we accepted the message 209 215 // CancellationTokenSource is null in this case
Note: See TracChangeset
for help on using the changeset viewer.