Exemplo n.º 1
0
        private void ShouldStop_IfValueIsNotBetter()
        {
            _stop = new NotGettingBetter <Solution>(_cooler.Object, OptimizationType.Maximization, 5000, _notGettingBetterDur);
            var step = 0u;

            while (!_stop.ShouldStop(_mockedSolution.Object))
            {
                step++;
            }

            Assert.Equal(_notGettingBetterDur + 1, step);
        }
Exemplo n.º 2
0
        private void ShouldStop_Max_steps(uint maxSteps)
        {
            _stop = new NotGettingBetter <Solution>(_cooler.Object, OptimizationType.Maximization, maxSteps, 250000);
            var step = 0u;

            while (!_stop.ShouldStop(_mockedSolution.Object))
            {
                step++;
            }

            Assert.Equal(maxSteps, step);
        }
Exemplo n.º 3
0
        private void ShouldNotStop_IfValueIsBetter(uint threshold)
        {
            _stop = new NotGettingBetter <Solution>(_cooler.Object, OptimizationType.Maximization, 20000, _notGettingBetterDur);
            var step = 0u;

            while (!_stop.ShouldStop(_mockedSolution.Object))
            {
                step++;
                if (step == 10)
                {
                    _mockedSolution.Object.CalculatedValue += threshold + 1;
                }
            }

            Assert.NotEqual(_notGettingBetterDur + 1, step);
        }