Exemplo n.º 1
0
        public void RunAlpsGaSymRegSampleTest()
        {
            var alpsGa = CreateAlpsGaSymRegSample();

            alpsGa.SetSeedRandomly.Value = false;
            SamplesUtils.RunAlgorithm(alpsGa);
            Assert.AreEqual(265855, SamplesUtils.GetIntResult(alpsGa, "EvaluatedSolutions"));
        }
        public void RunSimulatedAnnealingRastriginSampleTest()
        {
            var sa = CreateSimulatedAnnealingRastriginSample();

            sa.SetSeedRandomly.Value = false;
            SamplesUtils.RunAlgorithm(sa);
            Assert.AreEqual(0.00014039606034543795, SamplesUtils.GetDoubleResult(sa, "BestQuality"));
            Assert.AreEqual(5000, SamplesUtils.GetIntResult(sa, "EvaluatedMoves"));
        }
Exemplo n.º 3
0
        public void RunRAPGASchedulingSampleTest()
        {
            var rapga = CreateRAPGASchedulingSample();

            rapga.SetSeedRandomly.Value = false;
            SamplesUtils.RunAlgorithm(rapga);
            Assert.AreEqual(988.00, SamplesUtils.GetDoubleResult(rapga, "BestQuality"));
            Assert.AreEqual(988.00, SamplesUtils.GetDoubleResult(rapga, "CurrentAverageQuality"));
            Assert.AreEqual(988.00, SamplesUtils.GetDoubleResult(rapga, "CurrentWorstQuality"));
            Assert.AreEqual(27100, SamplesUtils.GetIntResult(rapga, "EvaluatedSolutions"));
        }
Exemplo n.º 4
0
        public void RunEsGriewankSampleTest()
        {
            var es = CreateEsGriewankSample();

            es.SetSeedRandomly.Value = false;
            SamplesUtils.RunAlgorithm(es);
            Assert.AreEqual(0, SamplesUtils.GetDoubleResult(es, "BestQuality"));
            Assert.AreEqual(0, SamplesUtils.GetDoubleResult(es, "CurrentAverageQuality"));
            Assert.AreEqual(0, SamplesUtils.GetDoubleResult(es, "CurrentWorstQuality"));
            Assert.AreEqual(100020, SamplesUtils.GetIntResult(es, "EvaluatedSolutions"));
        }
Exemplo n.º 5
0
        public void RunTabuSearchTspSampleTest()
        {
            var ts = CreateTabuSearchTspSample();

            ts.SetSeedRandomly.Value = false;
            SamplesUtils.RunAlgorithm(ts);
            Assert.AreEqual(6294, SamplesUtils.GetDoubleResult(ts, "BestQuality"));
            Assert.AreEqual(7380.0386666666664, SamplesUtils.GetDoubleResult(ts, "CurrentAverageQuality"));
            Assert.AreEqual(8328, SamplesUtils.GetDoubleResult(ts, "CurrentWorstQuality"));
            Assert.AreEqual(750000, SamplesUtils.GetIntResult(ts, "EvaluatedMoves"));
        }
Exemplo n.º 6
0
        public void RunAlpsGaTspSampleTest()
        {
            var alpsGa = CreateAlpsGaTspSample();

            alpsGa.SetSeedRandomly.Value = false;
            SamplesUtils.RunAlgorithm(alpsGa);
            Assert.AreEqual(7967, SamplesUtils.GetDoubleResult(alpsGa, "BestQuality"));
            Assert.AreEqual(17565.174444444445, SamplesUtils.GetDoubleResult(alpsGa, "CurrentAverageQuality"));
            Assert.AreEqual(50295, SamplesUtils.GetDoubleResult(alpsGa, "CurrentWorstQuality"));
            Assert.AreEqual(621900, SamplesUtils.GetIntResult(alpsGa, "EvaluatedSolutions"));
        }
Exemplo n.º 7
0
        public void RunGaGroupingProblemSampleTest()
        {
            var ga = CreateGaGroupingProblemSample();

            ga.SetSeedRandomly.Value = false;
            SamplesUtils.RunAlgorithm(ga);
            Assert.AreEqual(127, SamplesUtils.GetDoubleResult(ga, "BestQuality"));
            Assert.AreEqual(129, 38, SamplesUtils.GetDoubleResult(ga, "CurrentAverageQuality"));
            Assert.AreEqual(132, SamplesUtils.GetDoubleResult(ga, "CurrentWorstQuality"));
            Assert.AreEqual(99100, SamplesUtils.GetIntResult(ga, "EvaluatedSolutions"));
        }
        public void RunGpArtificialAntSampleTest()
        {
            var ga = CreateGpArtificialAntSample();

            ga.SetSeedRandomly.Value = false;
            SamplesUtils.RunAlgorithm(ga);
            Assert.AreEqual(81, SamplesUtils.GetDoubleResult(ga, "BestQuality"));
            Assert.AreEqual(48.19, SamplesUtils.GetDoubleResult(ga, "CurrentAverageQuality"));
            Assert.AreEqual(0, SamplesUtils.GetDoubleResult(ga, "CurrentWorstQuality"));
            Assert.AreEqual(50950, SamplesUtils.GetIntResult(ga, "EvaluatedSolutions"));
        }
Exemplo n.º 9
0
        public void RunTabuSearchVRPSampleTest()
        {
            var vrp = CreateTabuSearchVrpSample();

            vrp.SetSeedRandomly.Value = false;
            SamplesUtils.RunAlgorithm(vrp);
            Assert.AreEqual(1473, SamplesUtils.GetDoubleResult(vrp, "BestQuality"));
            Assert.AreEqual(2102.1192622950812, SamplesUtils.GetDoubleResult(vrp, "CurrentAverageQuality"));
            Assert.AreEqual(4006, SamplesUtils.GetDoubleResult(vrp, "CurrentWorstQuality"));
            Assert.AreEqual(119072, SamplesUtils.GetIntResult(vrp, "EvaluatedMoves"));
        }
        public void RunLocalSearchKnapsackSampleTest()
        {
            var ls = CreateLocalSearchKnapsackSample();

            ls.SetSeedRandomly.Value = false;
            SamplesUtils.RunAlgorithm(ls);
            Assert.AreEqual(345, SamplesUtils.GetDoubleResult(ls, "BestQuality"));
            Assert.AreEqual(340.70731707317071, SamplesUtils.GetDoubleResult(ls, "CurrentAverageQuality"));
            Assert.AreEqual(337, SamplesUtils.GetDoubleResult(ls, "CurrentWorstQuality"));
            Assert.AreEqual(82000, SamplesUtils.GetIntResult(ls, "EvaluatedMoves"));
        }
        public void RunOSESGriewankSampleTest()
        {
            var es = CreateOSESGriewankSample();

            es.SetSeedRandomly.Value = false;
            SamplesUtils.RunAlgorithm(es);
            Assert.AreEqual(1.80366417E-07, SamplesUtils.GetDoubleResult(es, "BestQuality"), 1.0E-15);
            Assert.AreEqual(4.84418627E-07, SamplesUtils.GetDoubleResult(es, "CurrentAverageQuality"), 1.0E-15);
            Assert.AreEqual(9.20629802E-07, SamplesUtils.GetDoubleResult(es, "CurrentWorstQuality"), 1.0E-15);
            Assert.AreEqual(39750, SamplesUtils.GetIntResult(es, "EvaluatedSolutions"));
        }
Exemplo n.º 12
0
        public void RunGaBppSampleTest()
        {
            var ga = CreateGaBppSample();

            ga.SetSeedRandomly.Value = false;
            SamplesUtils.RunAlgorithm(ga);
            Assert.AreEqual(0.59369488300408157, SamplesUtils.GetDoubleResult(ga, "BestQuality"), 1E-6);
            Assert.AreEqual(0.51834350243004124, SamplesUtils.GetDoubleResult(ga, "CurrentAverageQuality"), 1E-6);
            Assert.AreEqual(0.36227753691428577, SamplesUtils.GetDoubleResult(ga, "CurrentWorstQuality"), 1E-6);
            Assert.AreEqual(15250, SamplesUtils.GetIntResult(ga, "EvaluatedSolutions"));
        }
        public void RunIslandGaTspSampleTest()
        {
            var ga = CreateIslandGaTspSample();

            ga.SetSeedRandomly.Value = false;
            SamplesUtils.RunAlgorithm(ga);
            Assert.AreEqual(9918, SamplesUtils.GetDoubleResult(ga, "BestQuality"));
            Assert.AreEqual(10324.64, SamplesUtils.GetDoubleResult(ga, "CurrentAverageQuality"));
            Assert.AreEqual(11823, SamplesUtils.GetDoubleResult(ga, "CurrentWorstQuality"));
            Assert.AreEqual(495500, SamplesUtils.GetIntResult(ga, "EvaluatedSolutions"));
        }
Exemplo n.º 14
0
        public void RunVnsOpSampleTest()
        {
            var vns = CreateVnsOpSample();

            vns.SetSeedRandomly = false;
            SamplesUtils.RunAlgorithm(vns);
            Assert.AreEqual(1182, SamplesUtils.GetDoubleResult(vns, "BestQuality"));
            Assert.AreEqual(1182, SamplesUtils.GetDoubleResult(vns, "CurrentAverageQuality"));
            Assert.AreEqual(1182, SamplesUtils.GetDoubleResult(vns, "CurrentWorstQuality"));
            Assert.AreEqual(42651753, SamplesUtils.GetIntResult(vns, "EvaluatedSolutions"));
        }
Exemplo n.º 15
0
        public void RunScatterSearchVRPSampleTest()
        {
            var ss = CreateScatterSearchVRPSample();

            ss.SetSeedRandomly.Value = false;
            SamplesUtils.RunAlgorithm(ss);
            Assert.AreEqual(828.93686694283383, SamplesUtils.GetDoubleResult(ss, "BestQuality"));
            Assert.AreEqual(868.63623986983077, SamplesUtils.GetDoubleResult(ss, "CurrentAverageQuality"));
            Assert.AreEqual(1048.8333559209832, SamplesUtils.GetDoubleResult(ss, "CurrentWorstQuality"));
            Assert.AreEqual(262622, SamplesUtils.GetIntResult(ss, "EvaluatedSolutions"));
        }
Exemplo n.º 16
0
        public void RunGaVrpSampleTest()
        {
            var ga = CreateGaVrpSample();

            ga.SetSeedRandomly.Value = false;
            SamplesUtils.RunAlgorithm(ga);
            Assert.AreEqual(1828.9368669428338, SamplesUtils.GetDoubleResult(ga, "BestQuality"));
            Assert.AreEqual(1830.1444308908331, SamplesUtils.GetDoubleResult(ga, "CurrentAverageQuality"));
            Assert.AreEqual(1871.7128510304112, SamplesUtils.GetDoubleResult(ga, "CurrentWorstQuality"));
            Assert.AreEqual(99100, SamplesUtils.GetIntResult(ga, "EvaluatedSolutions"));
        }
        public void RunGpTimeSeriesSampleTest()
        {
            var osga = CreateGpTimeSeriesSample();

            osga.SetSeedRandomly.Value = false;
            SamplesUtils.RunAlgorithm(osga);

            Assert.AreEqual(0.020952753415199643, SamplesUtils.GetDoubleResult(osga, "BestQuality"), 1E-8);
            Assert.AreEqual(0.023220938866319357, SamplesUtils.GetDoubleResult(osga, "CurrentAverageQuality"), 1E-8);
            Assert.AreEqual(0.023716788824595391, SamplesUtils.GetDoubleResult(osga, "CurrentWorstQuality"), 1E-8);
            Assert.AreEqual(48200, SamplesUtils.GetIntResult(osga, "EvaluatedSolutions"));
        }
        public void RunGpMultiplexerSampleTest()
        {
            var osga = CreateGpMultiplexerSample();

            osga.SetSeedRandomly.Value = false;
            SamplesUtils.RunAlgorithm(osga);

            Assert.AreEqual(1856, SamplesUtils.GetDoubleResult(osga, "BestQuality"), 1E-8);
            Assert.AreEqual(1784.76, SamplesUtils.GetDoubleResult(osga, "CurrentAverageQuality"), 1E-8);
            Assert.AreEqual(1536, SamplesUtils.GetDoubleResult(osga, "CurrentWorstQuality"), 1E-8);
            Assert.AreEqual(66900, SamplesUtils.GetIntResult(osga, "EvaluatedSolutions"));
        }
Exemplo n.º 19
0
        public void RunGpTimeSeriesSampleTest()
        {
            var osga = CreateGpTimeSeriesSample();

            osga.SetSeedRandomly.Value = false;
            SamplesUtils.RunAlgorithm(osga);

            Assert.AreEqual(0.015441526903606416, SamplesUtils.GetDoubleResult(osga, "BestQuality"), 1E-8);
            Assert.AreEqual(0.017420834241279298, SamplesUtils.GetDoubleResult(osga, "CurrentAverageQuality"), 1E-8);
            Assert.AreEqual(0.065195703753298972, SamplesUtils.GetDoubleResult(osga, "CurrentWorstQuality"), 1E-8);
            Assert.AreEqual(92000, SamplesUtils.GetIntResult(osga, "EvaluatedSolutions"));
        }
        public void RunGpSymbolicClassificationSampleTest()
        {
            var ga = CreateGpSymbolicClassificationSample();

            ga.SetSeedRandomly.Value = false;
            SamplesUtils.RunAlgorithm(ga);
            Assert.AreEqual(0.141880203907627, SamplesUtils.GetDoubleResult(ga, "BestQuality"), 1E-8);
            Assert.AreEqual(4.3246992327753295, SamplesUtils.GetDoubleResult(ga, "CurrentAverageQuality"), 1E-8);
            Assert.AreEqual(100.62175156249987, SamplesUtils.GetDoubleResult(ga, "CurrentWorstQuality"), 1E-8);
            Assert.AreEqual(100900, SamplesUtils.GetIntResult(ga, "EvaluatedSolutions"));
            var bestTrainingSolution = (IClassificationSolution)ga.Results["Best training solution"].Value;

            Assert.AreEqual(0.80875, bestTrainingSolution.TrainingAccuracy, 1E-8);
            Assert.AreEqual(0.795031055900621, bestTrainingSolution.TestAccuracy, 1E-8);
            var bestValidationSolution = (IClassificationSolution)ga.Results["Best validation solution"].Value;

            Assert.AreEqual(0.81375, bestValidationSolution.TrainingAccuracy, 1E-8);
            Assert.AreEqual(0.788819875776398, bestValidationSolution.TestAccuracy, 1E-8);
        }
        public void RunGpSymbolicRegressionSampleTest()
        {
            var ga = CreateGpSymbolicRegressionSample();

            ga.SetSeedRandomly.Value = false;
            SamplesUtils.RunAlgorithm(ga);
            Assert.AreEqual(0.858344291534625, SamplesUtils.GetDoubleResult(ga, "BestQuality"), 1E-8);
            Assert.AreEqual(0.56758466520692641, SamplesUtils.GetDoubleResult(ga, "CurrentAverageQuality"), 1E-8);
            Assert.AreEqual(0, SamplesUtils.GetDoubleResult(ga, "CurrentWorstQuality"), 1E-8);
            Assert.AreEqual(50950, SamplesUtils.GetIntResult(ga, "EvaluatedSolutions"));
            var bestTrainingSolution = (IRegressionSolution)ga.Results["Best training solution"].Value;

            Assert.AreEqual(0.85504801557844745, bestTrainingSolution.TrainingRSquared, 1E-8);
            Assert.AreEqual(0.86259381948647817, bestTrainingSolution.TestRSquared, 1E-8);
            var bestValidationSolution = (IRegressionSolution)ga.Results["Best validation solution"].Value;

            Assert.AreEqual(0.84854338315539746, bestValidationSolution.TrainingRSquared, 1E-8);
            Assert.AreEqual(0.8662813452656678, bestValidationSolution.TestRSquared, 1E-8);
        }
        public void RunPsoSchwefelSampleTest()
        {
            var pso = CreatePsoSchwefelSample();

            pso.SetSeedRandomly.Value = false;
            SamplesUtils.RunAlgorithm(pso);
            if (!Environment.Is64BitProcess)
            {
                Assert.AreEqual(118.44027985932837, SamplesUtils.GetDoubleResult(pso, "BestQuality"));
                Assert.AreEqual(140.71570105946438, SamplesUtils.GetDoubleResult(pso, "CurrentAverageQuality"));
                Assert.AreEqual(220.956806502853, SamplesUtils.GetDoubleResult(pso, "CurrentWorstQuality"));
                Assert.AreEqual(1000, SamplesUtils.GetIntResult(pso, "Iterations"));
            }
            else
            {
                Assert.AreEqual(118.43958282879345, SamplesUtils.GetDoubleResult(pso, "BestQuality"));
                Assert.AreEqual(139.43946864779372, SamplesUtils.GetDoubleResult(pso, "CurrentAverageQuality"));
                Assert.AreEqual(217.14654589055152, SamplesUtils.GetDoubleResult(pso, "CurrentWorstQuality"));
                Assert.AreEqual(1000, SamplesUtils.GetIntResult(pso, "Iterations"));
            }
        }
Exemplo n.º 23
0
        public void RunPsoRastriginSampleTest()
        {
            var pso = CreatePsoRastriginSample();

            pso.SetSeedRandomly.Value = false;
            SamplesUtils.RunAlgorithm(pso);
            if (Environment.Is64BitProcess)
            {
                Assert.AreEqual(0, SamplesUtils.GetDoubleResult(pso, "BestQuality"));
                Assert.AreEqual(3.9649516110677525, SamplesUtils.GetDoubleResult(pso, "CurrentAverageQuality"), 1e-08);
                Assert.AreEqual(25.566430359483757, SamplesUtils.GetDoubleResult(pso, "CurrentWorstQuality"), 1e-08);
                Assert.AreEqual(200, SamplesUtils.GetIntResult(pso, "Iterations"));
            }
            else
            {
                Assert.AreEqual(0, SamplesUtils.GetDoubleResult(pso, "BestQuality"));
                Assert.AreEqual(3.3957460831564048, SamplesUtils.GetDoubleResult(pso, "CurrentAverageQuality"), 1e-08);
                Assert.AreEqual(34.412788077766145, SamplesUtils.GetDoubleResult(pso, "CurrentWorstQuality"), 1e-08);
                Assert.AreEqual(200, SamplesUtils.GetIntResult(pso, "Iterations"));
            }
        }
Exemplo n.º 24
0
        public void RunGPSymbolicRegressionSampleWithOSTest()
        {
            var osga = CreateGpSymbolicRegressionSample();

            osga.SetSeedRandomly.Value    = false;
            osga.Seed.Value               = seed;
            osga.MaximumGenerations.Value = 10; //reduce unit test runtime

            SamplesUtils.RunAlgorithm(osga);
            var bestTrainingSolution = (IRegressionSolution)osga.Results["Best training solution"].Value;

            if (Environment.Is64BitProcess)
            {
                // the following are the result values as produced on builder.heuristiclab.com
                // Unfortunately, running the same test on a different machine results in different values
                // For x86 environments the results below match but on x64 there is a difference
                // We tracked down the ConstantOptimizationEvaluator as a possible cause but have not
                // been able to identify the real cause. Presumably, execution on a Xeon and a Core i7 processor
                // leads to different results.
                Assert.AreEqual(0.90811178793448177, SamplesUtils.GetDoubleResult(osga, "BestQuality"), 1E-8, Environment.NewLine + "Best Quality differs.");
                Assert.AreEqual(0.87264498853305739, SamplesUtils.GetDoubleResult(osga, "CurrentAverageQuality"), 1E-8, Environment.NewLine + "Current Average Quality differs.");
                Assert.AreEqual(0.75425658608938817, SamplesUtils.GetDoubleResult(osga, "CurrentWorstQuality"), 1E-8, Environment.NewLine + "Current Worst Quality differs.");
                Assert.AreEqual(8900, SamplesUtils.GetIntResult(osga, "EvaluatedSolutions"), Environment.NewLine + "Evaluated Solutions differ.");
                Assert.AreEqual(0.90811178793448177, bestTrainingSolution.TrainingRSquared, 1E-8, Environment.NewLine + "Best Training Solution Training R² differs.");
                // Assert.AreEqual(0.896290231994223, bestTrainingSolution.TestRSquared, 1E-8, Environment.NewLine + "Best Training Solution Test R² differs.");
            }
            else
            {
                Assert.AreEqual(0.9971536312165723, SamplesUtils.GetDoubleResult(osga, "BestQuality"), 1E-8, Environment.NewLine + "Best Qualitiy differs.");
                Assert.AreEqual(0.98382832370544937, SamplesUtils.GetDoubleResult(osga, "CurrentAverageQuality"), 1E-8, Environment.NewLine + "Current Average Quality differs.");
                Assert.AreEqual(0.960805603777699, SamplesUtils.GetDoubleResult(osga, "CurrentWorstQuality"), 1E-8, Environment.NewLine + "Current Worst Quality differs.");
                Assert.AreEqual(10500, SamplesUtils.GetIntResult(osga, "EvaluatedSolutions"), Environment.NewLine + "Evaluated Solutions differ.");
                Assert.AreEqual(0.9971536312165723, bestTrainingSolution.TrainingRSquared, 1E-8, Environment.NewLine + "Best Training Solution Training R² differs.");
                Assert.AreEqual(0.010190137960908724, bestTrainingSolution.TestRSquared, 1E-8, Environment.NewLine + "Best Training Solution Test R² differs.");
            }
        }