Commit d70ca408 authored by Dorchies David's avatar Dorchies David
Browse files

test: Add hydroPSO test case

Refs #55
parent 76efa369
Pipeline #12643 passed with stages
in 11 minutes and 32 seconds
...@@ -15,14 +15,6 @@ test_that("V02.1_param_optim works", { ...@@ -15,14 +15,6 @@ test_that("V02.1_param_optim works", {
rda_resPORT <- resPORT rda_resPORT <- resPORT
expect_true(RunVignetteChunks("V02.1_param_optim")) expect_true(RunVignetteChunks("V02.1_param_optim"))
expect_equal(summary(resGLOB), summary(rda_resGLOB), tolerance = 1E-7) 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 expect_equal(resGLOB[,-1], rda_resGLOB[,-1], tolerance = 1E-2) # High tolerance due to randomisation in optimisations
}) })
......
...@@ -138,7 +138,7 @@ optDE <- DEoptim::DEoptim(fn = OptimGR4J, ...@@ -138,7 +138,7 @@ optDE <- DEoptim::DEoptim(fn = OptimGR4J,
## Particle Swarm ## 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, optPSO <- hydroPSO::hydroPSO(fn = OptimGR4J,
lower = lowerGR4J, upper = upperGR4J, lower = lowerGR4J, upper = upperGR4J,
control = list(write2disk = FALSE, verbose = FALSE)) control = list(write2disk = FALSE, verbose = FALSE))
...@@ -155,7 +155,7 @@ optMALS <- Rmalschains::malschains(fn = OptimGR4J, ...@@ -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. 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"), resGLOB <- data.frame(Algo = c("airGR", "PORT", "DE", "PSO", "MA-LS"),
round(rbind( round(rbind(
OutputsCalib$ParamFinalR , OutputsCalib$ParamFinalR ,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment