From 4f94f994f51e70dda45c8cc1084b1d64ab1ced9c Mon Sep 17 00:00:00 2001 From: Ivan Matantsev Date: Thu, 31 May 2018 10:34:48 -0700 Subject: [PATCH 1/2] make class partial so I can add constuctor in separate file. add constructros for testing --- src/Microsoft.ML.Sweeper/AsyncSweeper.cs | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/Microsoft.ML.Sweeper/AsyncSweeper.cs b/src/Microsoft.ML.Sweeper/AsyncSweeper.cs index f13ad02531..817a196707 100644 --- a/src/Microsoft.ML.Sweeper/AsyncSweeper.cs +++ b/src/Microsoft.ML.Sweeper/AsyncSweeper.cs @@ -63,7 +63,7 @@ public interface IAsyncSweeper /// Expose existing s as with no synchronization over the past runs. /// Nelder-Mead requires synchronization so is not compatible with SimpleAsyncSweeperBase. /// - public class SimpleAsyncSweeper : IAsyncSweeper, IDisposable + public partial class SimpleAsyncSweeper : IAsyncSweeper, IDisposable { private readonly List _results; private readonly object _lock; @@ -85,6 +85,16 @@ private SimpleAsyncSweeper(ISweeper baseSweeper) _results = new List(); } + public SimpleAsyncSweeper(IHostEnvironment env, UniformRandomSweeper.ArgumentsBase args) + : this(new UniformRandomSweeper(env, args)) + { + } + + public SimpleAsyncSweeper(IHostEnvironment env, RandomGridSweeper.Arguments args) + : this(new UniformRandomSweeper(env, args)) + { + } + public void Update(int id, IRunResult result) { Contracts.CheckParam(0 <= id && id < _numGenerated, nameof(id), "Invalid run id"); From 8e1f121803e833747e9aa13e232a0c1ca57daaeb Mon Sep 17 00:00:00 2001 From: Ivan Matantsev Date: Thu, 31 May 2018 10:41:54 -0700 Subject: [PATCH 2/2] formatting --- src/Microsoft.ML.Sweeper/AsyncSweeper.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Microsoft.ML.Sweeper/AsyncSweeper.cs b/src/Microsoft.ML.Sweeper/AsyncSweeper.cs index 817a196707..9edf1393e2 100644 --- a/src/Microsoft.ML.Sweeper/AsyncSweeper.cs +++ b/src/Microsoft.ML.Sweeper/AsyncSweeper.cs @@ -86,7 +86,7 @@ private SimpleAsyncSweeper(ISweeper baseSweeper) } public SimpleAsyncSweeper(IHostEnvironment env, UniformRandomSweeper.ArgumentsBase args) - : this(new UniformRandomSweeper(env, args)) + : this(new UniformRandomSweeper(env, args)) { }