Commit 3f842089 authored by Delaigue Olivier's avatar Delaigue Olivier

Merge branch '55-bug-in-hydropso-package' into 'dev'

Resolve "Bug in HydroPSO package"

Closes #55

See merge request !9
parents 6629f998 d70ca408
Pipeline #13442 passed with stages
in 36 minutes and 54 seconds
stages:
- update_packages
- build
- tests
build:
default:
before_script:
- echo "setwd(\"$(pwd)\")" > .Rprofile
- PATH=~/R/sources/R-${R_VERSION}/bin:$PATH
- rename "s/${R_VERSION}.airGR/airGR/" *.tar.gz
.update_packages:
stage: update_packages
only:
refs:
- tags
- schedules
script:
- Rscript -e "update.packages(ask=FALSE, repos=\"http://cran.r-project.org\")"
.build:
stage: build
script:
- cd ..
- echo "setwd(\"$(pwd)\")" > .Rprofile
- R CMD build airgr
- rename "s/airGR/${R_VERSION}.airGR/" airGR_*.tar.gz
- mv *.tar.gz airgr/
artifacts:
untracked: true
expire_in: 1 week
check_not_cran:
.check_not_cran:
stage: tests
variables:
NOT_CRAN: "true"
script:
- echo "setwd(\"$(pwd)\")" > .Rprofile
- echo "Sys.setenv(NOT_CRAN = \"true\")" >> .Rprofile
- R CMD check airGR_*.tar.gz
check_as_cran:
.check_as_cran:
stage: tests
script:
- echo "setwd(\"$(pwd)\")" > .Rprofile
- R CMD check --as-cran airGR_*.tar.gz
update_packages_patched:
variables:
R_VERSION: "patched"
extends: .update_packages
build_patched:
variables:
R_VERSION: "patched"
extends: .build
check_not_cran_patched:
variables:
R_VERSION: "patched"
extends: .check_not_cran
check_as_cran_patched:
variables:
R_VERSION: "patched"
extends: .check_as_cran
update_packages_devel:
variables:
R_VERSION: "devel"
extends: .update_packages
build_devel:
only:
refs:
- tags
- schedules
variables:
R_VERSION: "devel"
extends: .build
check_not_cran_devel:
only:
refs:
- tags
- schedules
variables:
R_VERSION: "devel"
extends: .check_not_cran
check_as_cran_devel:
only:
refs:
- tags
- schedules
variables:
R_VERSION: "devel"
extends: .check_as_cran
update_packages_oldrel:
variables:
R_VERSION: "oldrel"
extends: .update_packages
build_oldrel:
only:
refs:
- tags
- schedules
variables:
R_VERSION: "oldrel"
extends: .build
check_not_cran_oldrel:
only:
refs:
- tags
- schedules
variables:
R_VERSION: "oldrel"
extends: .check_not_cran
check_as_cran_oldrel:
only:
refs:
- tags
- schedules
variables:
R_VERSION: "oldrel"
extends: .check_as_cran
......@@ -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
})
......
......@@ -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 ,
......
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