Ignore:
Timestamp:
07/28/17 16:47:42 (4 years ago)
Author:
jkarder
Message:

#2258: merged r15287 into stable

Location:
stable
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • stable

  • stable/HeuristicLab.Tests

  • stable/HeuristicLab.Tests/HeuristicLab.Algorithms.DataAnalysis-3.4/GaussianProcessRegressionTest.cs

    r14186 r15292  
    2222using System;
    2323using System.Linq;
    24 using System.Threading;
    2524using HeuristicLab.Common;
    2625using HeuristicLab.Problems.DataAnalysis;
     
    3938    }
    4039
    41     private EventWaitHandle trigger = new AutoResetEvent(false);
    4240    private Exception ex;
    4341
     
    6664
    6765      alg.ExceptionOccurred += new EventHandler<EventArgs<Exception>>(cv_ExceptionOccurred);
    68       alg.Stopped += new EventHandler(cv_Stopped);
    6966
    7067      alg.Prepare();
    7168      alg.Start();
    72       trigger.WaitOne();
    7369      if (ex != null) throw ex;
    7470
     
    7975      ex = e.Value;
    8076    }
    81 
    82     private void cv_Stopped(object sender, EventArgs e) {
    83       trigger.Set();
    84     }
    8577  }
    8678}
  • stable/HeuristicLab.Tests/HeuristicLab.Algorithms.DataAnalysis-3.4/GradientBoostingTest.cs

    r14023 r15292  
    33using System.IO;
    44using System.Linq;
    5 using System.Threading;
    65using HeuristicLab.Data;
    7 using HeuristicLab.Optimization;
    86using HeuristicLab.Problems.DataAnalysis;
    97using Microsoft.VisualStudio.TestTools.UnitTesting;
     
    242240      #endregion
    243241
    244       RunAlgorithm(gbt);
     242      gbt.Start();
    245243
    246244      Console.WriteLine(gbt.ExecutionTime);
     
    270268      #endregion
    271269
    272       RunAlgorithm(gbt);
     270      gbt.Start();
    273271
    274272      Console.WriteLine(gbt.ExecutionTime);
     
    298296      #endregion
    299297
    300       RunAlgorithm(gbt);
     298      gbt.Start();
    301299
    302300      Console.WriteLine(gbt.ExecutionTime);
    303301      Assert.AreEqual(0.061954221604374943, ((DoubleValue)gbt.Results["Loss (train)"].Value).Value, 1E-6);
    304302      Assert.AreEqual(0.06316303473499961, ((DoubleValue)gbt.Results["Loss (test)"].Value).Value, 1E-6);
    305     }
    306 
    307     // same as in SamplesUtil
    308     private void RunAlgorithm(IAlgorithm a) {
    309       var trigger = new EventWaitHandle(false, EventResetMode.ManualReset);
    310       Exception ex = null;
    311       a.Stopped += (src, e) => { trigger.Set(); };
    312       a.ExceptionOccurred += (src, e) => { ex = e.Value; trigger.Set(); };
    313       a.Prepare();
    314       a.Start();
    315       trigger.WaitOne();
    316 
    317       Assert.AreEqual(ex, null);
    318303    }
    319304
  • stable/HeuristicLab.Tests/HeuristicLab.Algorithms.DataAnalysis-3.4/SupportVectorMachineTest.cs

    r14186 r15292  
    2323using System.Collections.Generic;
    2424using System.Linq;
    25 using System.Threading;
    2625using HeuristicLab.Algorithms.DataAnalysis;
    2726using HeuristicLab.Common;
     
    5049    }
    5150
    52     private EventWaitHandle trigger = new AutoResetEvent(false);
    5351    private Exception ex;
    5452
     
    7169
    7270      cv.ExceptionOccurred += new EventHandler<EventArgs<Exception>>(cv_ExceptionOccurred);
    73       cv.Stopped += new EventHandler(cv_Stopped);
    7471
    7572      cv.Prepare();
    7673      cv.Start();
    77       trigger.WaitOne();
    7874      if (ex != null) throw ex;
    7975
     
    10298      ex = e.Value;
    10399    }
    104 
    105     private void cv_Stopped(object sender, EventArgs e) {
    106       trigger.Set();
    107     }
    108100  }
    109101}
Note: See TracChangeset for help on using the changeset viewer.