Esempio n. 1
0
        public void SmacOptimizer_OptimizeBest_MultipleParameters()
        {
            var parameters = new MinMaxParameterSpec[]
            {
                new MinMaxParameterSpec(-10.0, 10.0, Transform.Linear),
                new MinMaxParameterSpec(-10.0, 10.0, Transform.Linear),
                new MinMaxParameterSpec(-10.0, 10.0, Transform.Linear),
            };

            var sut = new SmacOptimizer(parameters,
                                        iterations: 80,
                                        randomStartingPointCount: 20,
                                        functionEvaluationsPerIterationCount: 1,
                                        localSearchPointCount: 10,
                                        randomSearchPointCount: 1000,
                                        epsilon: 0.00001,
                                        seed: 42);

            var actual = sut.OptimizeBest(Minimize);

            Assert.AreEqual(-0.964878416222769, actual.Error, Delta);
            Assert.AreEqual(actual.ParameterSet.Length, 3);

            Assert.AreEqual(-7.8487638560350819, actual.ParameterSet[0], Delta);
            Assert.AreEqual(6.2840940040927826, actual.ParameterSet[1], Delta);
            Assert.AreEqual(0.036385473812179825, actual.ParameterSet[2], Delta);
        }
Esempio n. 2
0
        public void SmacOptimizer_OptimizeBest_SingleParameter()
        {
            var parameters = new MinMaxParameterSpec[]
            {
                new MinMaxParameterSpec(0.0, 100.0, Transform.Linear)
            };

            var sut = new SmacOptimizer(parameters,
                                        iterations: 80,
                                        randomStartingPointCount: 20,
                                        functionEvaluationsPerIterationCount: 1,
                                        localSearchPointCount: 10,
                                        randomSearchPointCount: 1000,
                                        epsilon: 0.00001,
                                        seed: 42);

            var actual = sut.OptimizeBest(MinimizeWeightFromHeight);

            Assert.AreEqual(109.616853578648, actual.Error, Delta);
            Assert.AreEqual(37.6315924979893, actual.ParameterSet.Single(), Delta);
        }