Commit 54962b4b authored by patrick.lambert's avatar patrick.lambert
Browse files

last version

No related merge requests found
Showing with 31 additions and 37 deletions
+31 -37
...@@ -5,14 +5,14 @@ library(tidyverse) ...@@ -5,14 +5,14 @@ library(tidyverse)
library(jdx) library(jdx)
library(tictoc) library(tictoc)
rm(list = ls())
rm(list = ls())
## to have the same working directory as GR3D ## to have the same working directory as GR3D
#setwd("~/Documents/workspace/GR3D/exploration/NEA_sensitivity_analysis") #setwd("~/Documents/workspace/GR3D/exploration/NEA_sensitivity_analysis")
setwd("../..") setwd("../..")
source("exploration/GR3D_Rdescription/GR3Dmetapopulation.R")
# ====================================== LOCAL FUNCTIONS ===================================== # ====================================== LOCAL FUNCTIONS =====================================
convertFromSALtoR = function(java_out){ convertFromSALtoR = function(java_out){
require(jdx) require(jdx)
...@@ -81,7 +81,10 @@ exploreEasyRun = function(){ ...@@ -81,7 +81,10 @@ exploreEasyRun = function(){
mutate(year =0) %>% rename(originBasin = natalBasin) %>% mutate(year =0) %>% rename(originBasin = natalBasin) %>%
identyMetapopulation(., threshold = .95, verbose = FALSE) identyMetapopulation(., threshold = .95, verbose = FALSE)
nbMetapopulation = metapopulations$metapopulation %>% distinct(metapop) %>% summarise(n = n()) nbMetapopulation = metapopulations$metapopulation %>%
distinct(metapop) %>%
summarise(n = n()) %>%
unlist(use.names = FALSE)
return(tibble(northern_basin_id = range$northern_basin_id, return(tibble(northern_basin_id = range$northern_basin_id,
effective_centroid_latitude = range$effective_centroid_latitude, effective_centroid_latitude = range$effective_centroid_latitude,
...@@ -95,36 +98,37 @@ exploreEasyRun = function(){ ...@@ -95,36 +98,37 @@ exploreEasyRun = function(){
# GR3D arguments ----------------------------------------- # GR3D arguments -----------------------------------------
jarfile = "target/GR3D-3.2-SNAPSHOT.jar" #' jarfile = "target/GR3D-3.2-SNAPSHOT.jar"
simDuration = 150 #' simDuration = 150
simBegin = 1 #' simBegin = 1
timeStepDuration = 1 #' timeStepDuration = 1
#'
seed = 1 #' seed = 1
#'-q', #' #'-q',
arguments = c('-simDuration', simDuration, '-simBegin',simBegin, #' arguments = c('-simDuration', simDuration, '-simBegin',simBegin,
'-timeStepDuration', timeStepDuration, #' '-timeStepDuration', timeStepDuration,
'-RNGStatusIndex', format(seed,scientific = FALSE), #' '-RNGStatusIndex', format(seed,scientific = FALSE),
'-groups',"data/input/northeastamerica/fishRIOBasin_Sapidissima_Rjava.xml", #' '-groups',"data/input/northeastamerica/fishRIOBasin_Sapidissima_Rjava.xml",
'-env',"data/input/northeastamerica/RIOBNneaBasins_Rjava.xml", #' '-env',"data/input/northeastamerica/RIOBNneaBasins_Rjava.xml",
'-observers',"data/input/northeastamerica/RIO_obs_empty.xml") #' '-observers',"data/input/northeastamerica/RIO_obs_empty.xml")
# ----------------------------------------------------- # -----------------------------------------------------
# initializes the Java Virtual Machine ------------------------------------- # initializes the Java Virtual Machine -------------------------------------
jarfile = "target/GR3D-3.2-SNAPSHOT.jar"
.jinit(NULL, force.init = TRUE) .jinit(NULL, force.init = TRUE)
.jinit(classpath = jarfile, force.init = TRUE) .jinit(classpath = jarfile, force.init = TRUE)
.jclassPath() .jclassPath()
# modification of xlm parameters ----------------------- # modification of xlm parameters -----------------------
parametersNamesANG = c("processes.processesEachStep.11.Soffset") # parametersNamesANG = c("processes.processesEachStep.11.Soffset")
thetasANG = c(-1) # thetasANG = c(-1)
#
parametersNamesENV = c("simulationName") # parametersNamesENV = c("simulationName")
thetasENV = c("Allee") # thetasENV = c("Allee")
# run the GR3D with updated parameter values in processes -------------------------------------------- # run the GR3D with updated parameter values in processes --------------------------------------------
runEasyRun(arguments, parametersNamesANG,thetasANG, parametersNamesENV, thetasENV ) # runEasyRun(arguments, parametersNamesANG,thetasANG, parametersNamesENV, thetasENV )
# .jcall("analysis.EasyRun", "V", "runSimulation", arguments, # .jcall("analysis.EasyRun", "V", "runSimulation", arguments,
# .jarray(parametersNamesANG), .jarray(thetasANG), # .jarray(parametersNamesANG), .jarray(thetasANG),
...@@ -133,8 +137,6 @@ runEasyRun(arguments, parametersNamesANG,thetasANG, parametersNamesENV, thetasEN ...@@ -133,8 +137,6 @@ runEasyRun(arguments, parametersNamesANG,thetasANG, parametersNamesENV, thetasEN
# call GR3D method to get model outputs ---------------------------------------------- # call GR3D method to get model outputs ----------------------------------------------
#
runSimulation = function(simulationParameter) { runSimulation = function(simulationParameter) {
arguments = c('-simDuration', 600, '-simBegin',2, arguments = c('-simDuration', 600, '-simBegin',2,
...@@ -158,17 +160,6 @@ runSimulation = function(simulationParameter) { ...@@ -158,17 +160,6 @@ runSimulation = function(simulationParameter) {
#============================ #============================
listeSimulation <- list(list(replicat = 1,
parametersNamesANG = c("processes.processesEachStep.11.Soffset"),
thetasANG = c(-1),
parametersNamesENV = c("simulationName"),
thetasENV = c("Allee")),
list(replicat = 1,
parametersNamesANG = c("processes.processesEachStep.11.Soffset"),
thetasANG = c(0),
parametersNamesENV = c("simulationName"),
thetasENV = c("no Allee")))
listeSimulation <- list(list(replicat = 1, listeSimulation <- list(list(replicat = 1,
parametersNamesANG = c("processes.processesEachStep.11.Soffset", parametersNamesANG = c("processes.processesEachStep.11.Soffset",
"processes.processesEachStep.6.pHomingAfterEquil"), "processes.processesEachStep.6.pHomingAfterEquil"),
...@@ -193,9 +184,12 @@ listeSimulation <- list(list(replicat = 1, ...@@ -193,9 +184,12 @@ listeSimulation <- list(list(replicat = 1,
list(replicat = 1, list(replicat = 1,
parametersNamesANG = c("processes.processesEachStep.11.Soffset", parametersNamesANG = c("processes.processesEachStep.11.Soffset",
"processes.processesEachStep.6.pHomingAfterEquil"), "processes.processesEachStep.6.pHomingAfterEquil"),
thetasANG = c(0, 0.97), thetasANG = c(0, 0.75),
parametersNamesENV = c("simulationName"), parametersNamesENV = c("simulationName"),
thetasENV = c("noAllee_lowHoming")) thetasENV = c("noAllee_lowHoming"))
) )
tic()
resSimulation = lapply(listeSimulation, runSimulation)
toc()
lapply(listeSimulation, runSimulation) save(listeSimulation, resSimulation, file = 'simulation.Rdata')
\ No newline at end of file
Supports Markdown
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