static RealVector RunRealVectorAlgorithm( Algorithm<RealVector, double, RealVector> algorithm, RealRemoteFunction f, Dictionary<string, Tuple<double, double>> area, string logStates) { f.Initialize(); var result = algorithm.Work(x => f.Calculate(x), area, logStates); f.Terminate(); return result; }
public static void TestRealRemoteFunction() { var f = new RealRemoteFunction(json: $"{TASKS_LOC}/Dummy/Dummy_3.json", port: 5000, field: "f"); f.Initialize(); List <double> results = new List <double>(); for (int i = 0; i < N; ++i) { var result = f.Calculate(new Dictionary <string, double>() { { "x", 1.0 }, { "y", 2.0 }, { "z", 3.0 } }); results.Add(result); } f.Terminate(); Assert.True(results.TrueForAll(_ => _ == 36.0)); }