Free cookie consent management tool by TermsFeed Policy Generator

Changeset 14631


Ignore:
Timestamp:
02/01/17 10:17:12 (8 years ago)
Author:
mkommend
Message:

#2205: Updated OrchestratedAlgorithmNode to work with problems as well.

Location:
branches/OptimizationNetworks
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/OptimizationNetworks/HeuristicLab.Networks.IntegratedOptimization.MachineLearning/FeatureSelectionOrchestrator.cs

    r14625 r14631  
    3131using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    3232using HeuristicLab.Problems.DataAnalysis;
    33 using HeuristicLab.Problems.DataAnalysis.Symbolic.Regression;
    3433
    3534namespace HeuristicLab.Networks.IntegratedOptimization.MachineLearning {
     
    103102
    104103      var orchestrationMessage = RegressionOrchestrationPort.PrepareMessage();
    105       orchestrationMessage["Problem"] = new SymbolicRegressionSingleObjectiveProblem() { ProblemData = problemData };
     104      orchestrationMessage["Problem"] = new RegressionProblem() { ProblemData = problemData };
    106105      orchestrationMessage["OrchestrationMessage"] = new EnumValue<OrchestrationMessage>(OrchestrationMessage.Prepare);
    107106      RegressionOrchestrationPort.SendMessage(orchestrationMessage, token);
  • branches/OptimizationNetworks/HeuristicLab.Networks.IntegratedOptimization/3.3/OrchestratedAlgorithmNode.cs

    r14628 r14631  
    6565    [StorableConstructor]
    6666    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) {
    6869      EvalHook = cloner.Clone(original.EvalHook);
    6970      RegisterEvents();
    7071    }
    7172    public OrchestratedAlgorithmNode() : this("OrchestratedAlgorithmNode") { }
    72     public OrchestratedAlgorithmNode(string name) : base(name) {
     73    public OrchestratedAlgorithmNode(string name)
     74      : base(name) {
    7375      var orchestrationPort = new MessagePort(OrchestrationPortName);
    7476      Ports.Add(orchestrationPort);
     
    106108            IMessageValue problemMsgVal;
    107109            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;
    112115                if (instEval != null && EvalHook != null) instEval.AfterExecutionOperators.Add(EvalHook);
    113116              }
     
    122125              }
    123126
    124               Algorithm.Problem = prob;
     127              Algorithm.Problem = problem;
    125128
    126129              if (multiAnalyzer != null) {
     
    189192          try {
    190193            Algorithm.Pause();
    191           } catch (InvalidOperationException) {
     194          }
     195          catch (InvalidOperationException) {
    192196            // ExecutionState might have changed since we accepted the message
    193197          }
     
    203207            try {
    204208              Algorithm.Stop();
    205             } catch (InvalidOperationException) {
     209            }
     210            catch (InvalidOperationException) {
    206211              // ExecutionState might have changed since we accepted the message
    207             } catch (NullReferenceException) {
     212            }
     213            catch (NullReferenceException) {
    208214              // BasicAlgorithm might have stopped since we accepted the message
    209215              // CancellationTokenSource is null in this case
Note: See TracChangeset for help on using the changeset viewer.