From d70ca408586f81093d7579ece0cfc09a480b3720 Mon Sep 17 00:00:00 2001 From: Dorchies David <david.dorchies@irstea.fr> Date: Wed, 29 Apr 2020 17:48:39 +0200 Subject: [PATCH] test: Add hydroPSO test case Refs #55 --- tests/testthat/test-vignettes.R | 8 -------- vignettes/V02.1_param_optim.Rmd | 4 ++-- 2 files changed, 2 insertions(+), 10 deletions(-) diff --git a/tests/testthat/test-vignettes.R b/tests/testthat/test-vignettes.R index f17ee71b..7d19c74f 100644 --- a/tests/testthat/test-vignettes.R +++ b/tests/testthat/test-vignettes.R @@ -15,14 +15,6 @@ test_that("V02.1_param_optim works", { rda_resPORT <- resPORT expect_true(RunVignetteChunks("V02.1_param_optim")) expect_equal(summary(resGLOB), summary(rda_resGLOB), tolerance = 1E-7) - resGLOB <- data.frame(Algo = c("airGR", "PORT", "DE", "PSO", "MA-LS"), - round(rbind( - OutputsCalib$ParamFinalR , - airGR::TransfoParam_GR4J(ParamIn = optPORT$par , Direction = "TR"), - airGR::TransfoParam_GR4J(ParamIn = as.numeric(optDE$optim$bestmem), Direction = "TR"), - rda_resGLOB[4, c("X1", "X2", "X3", "X4")], - airGR::TransfoParam_GR4J(ParamIn = optMALS$sol , Direction = "TR")), - digits = 3)) expect_equal(resGLOB[,-1], rda_resGLOB[,-1], tolerance = 1E-2) # High tolerance due to randomisation in optimisations }) diff --git a/vignettes/V02.1_param_optim.Rmd b/vignettes/V02.1_param_optim.Rmd index c23151e0..0063d915 100644 --- a/vignettes/V02.1_param_optim.Rmd +++ b/vignettes/V02.1_param_optim.Rmd @@ -138,7 +138,7 @@ optDE <- DEoptim::DEoptim(fn = OptimGR4J, ## Particle Swarm -```{r, warning=FALSE, results='hide', message=FALSE, eval=FALSE, purl=FALSE} +```{r, warning=FALSE, results='hide', message=FALSE, eval=FALSE} optPSO <- hydroPSO::hydroPSO(fn = OptimGR4J, lower = lowerGR4J, upper = upperGR4J, control = list(write2disk = FALSE, verbose = FALSE)) @@ -155,7 +155,7 @@ optMALS <- Rmalschains::malschains(fn = OptimGR4J, As it can be seen in the table below, the four additional optimization strategies tested lead to very close optima. -```{r, warning=FALSE, echo=FALSE, eval=FALSE, purl=FALSE} +```{r, warning=FALSE, echo=FALSE, eval=FALSE} resGLOB <- data.frame(Algo = c("airGR", "PORT", "DE", "PSO", "MA-LS"), round(rbind( OutputsCalib$ParamFinalR , -- GitLab