Commit 6b08c502 authored by patrick.lambert's avatar patrick.lambert
Browse files

fisrt attempt of GR3D compiling with maven

parent a4cfee21
<hashtable>
<entry>
<!--
<java-class>fr.cemagref.simaqualife.kernel.AquaticWorld</java-class>-->
<java-class>environment.RIOBasinNetworkWithContinent</java-class>
<fr.cemagref.observation.kernel.ObservablesHandler>
<observers>
<environment.RIOBasinNetworkObserverWithContinent>
<title>North East America</title>
<threshold>1000000</threshold>
<colorScaleEnum>RedsScale</colorScaleEnum>
</environment.RIOBasinNetworkObserverWithContinent>
<environment.RIOBasinNetworkObserverPresence>
<title>Shad presence in North East America</title>
<presenceFileName>data/input/northeastamerica/nea_presence.csv</presenceFileName>
<period>obs_1900_1950</period>
</environment.RIOBasinNetworkObserverPresence>
</observers>
</fr.cemagref.observation.kernel.ObservablesHandler>
</entry>
<entry>
<java-class>species.DiadromousFishGroup</java-class>
<fr.cemagref.observation.kernel.ObservablesHandler>
<observers>
<fr.cemagref.observation.observers.jfreechart.TemporalSerieChart>
<graphType>LINE</graphType>
<title>Number of colonized
basins
</title>
<xAxisLabel>Time (season)</xAxisLabel>
<yAxisLabel>number of basins</yAxisLabel>
<variableName>getNbColonizedBasins</variableName>
</fr.cemagref.observation.observers.jfreechart.TemporalSerieChart>
<fr.cemagref.observation.observers.jfreechart.TemporalSerieChart>
<graphType>LINE</graphType>
<title>Total Abundance</title>
<xAxisLabel>Time (season)</xAxisLabel>
<yAxisLabel>number of fishes</yAxisLabel>
<variableName>getFishEffective</variableName>
</fr.cemagref.observation.observers.jfreechart.TemporalSerieChart>
<fr.cemagref.observation.observers.jfreechart.TemporalSerieChart>
<graphType>LINE</graphType>
<title>Abundance of spawners</title>
<xAxisLabel>Time (season)</xAxisLabel>
<yAxisLabel>number
of fishes
</yAxisLabel>
<variableName>getSpawnerEffective</variableName>
</fr.cemagref.observation.observers.jfreechart.TemporalSerieChart>
<fr.cemagref.observation.observers.jfreechart.TemporalSerieChart>
<graphType>LINE</graphType>
<title>Abundance of male spawners</title>
<xAxisLabel>Time (season)</xAxisLabel>
<yAxisLabel>number of fishes</yAxisLabel>
<variableName>getMaleSpawnerEffective</variableName>
</fr.cemagref.observation.observers.jfreechart.TemporalSerieChart>
<fr.cemagref.observation.observers.jfreechart.TemporalSerieChart>
<graphType>LINE</graphType>
<title>Abundance of female spawners</title>
<xAxisLabel>Time (season)</xAxisLabel>
<yAxisLabel>number
of fishes
</yAxisLabel>
<variableName>getFemaleSpawnerEffective</variableName>
</fr.cemagref.observation.observers.jfreechart.TemporalSerieChart>
<observer.TemporalRangeSerieChart>
<title>Range distribution</title>
<xAxisLabel>Time (season)</xAxisLabel>
<yAxisLabel>latitude</yAxisLabel>
<variableName>getRangeDistributionWithLat</variableName>
</observer.TemporalRangeSerieChart>
<fr.cemagref.observation.observers.jfreechart.TemporalSerieChart>
<graphType>LINE</graphType>
<title>Mean age at first reproduction for female</title>
<xAxisLabel>Time (season)</xAxisLabel>
<yAxisLabel>age (year)</yAxisLabel>
<variableName>getMeanAgeOfFirstReprodutionForFemale</variableName>
</fr.cemagref.observation.observers.jfreechart.TemporalSerieChart>
<fr.cemagref.observation.observers.jfreechart.TemporalSerieChart>
<graphType>LINE</graphType>
<title>Mean age at first reproduction
for male
</title>
<xAxisLabel>Time (season)</xAxisLabel>
<yAxisLabel>age (year)</yAxisLabel>
<variableName>getMeanAgeOfFirstReprodutionForMale</variableName>
</fr.cemagref.observation.observers.jfreechart.TemporalSerieChart>
<fr.cemagref.observation.observers.jfreechart.TemporalSerieChart>
<graphType>LINE</graphType>
<title>Statistic for male spawners age</title>
<xAxisLabel>Time (season)</xAxisLabel>
<yAxisLabel></yAxisLabel>
<variableName>computeMaleSpawnerForFirstTimeSummaryStatistic</variableName>
</fr.cemagref.observation.observers.jfreechart.TemporalSerieChart>
<fr.cemagref.observation.observers.jfreechart.TemporalSerieChart>
<graphType>LINE</graphType>
<title>Statistic for female
spawners age
</title>
<xAxisLabel>Time (season)</xAxisLabel>
<yAxisLabel></yAxisLabel>
<variableName>computeFemaleSpawnerForFirstTimeSummaryStatistic</variableName>
</fr.cemagref.observation.observers.jfreechart.TemporalSerieChart>
<fr.cemagref.observation.observers.jfreechart.TemporalSerieChart>
<graphType>LINE</graphType>
<title>Mean length at first reproduction for female</title>
<xAxisLabel>Time (season)</xAxisLabel>
<yAxisLabel>length (cm)</yAxisLabel>
<variableName>getMeanLengthOfFirstReprodutionForFemale</variableName>
</fr.cemagref.observation.observers.jfreechart.TemporalSerieChart>
<fr.cemagref.observation.observers.jfreechart.TemporalSerieChart>
<graphType>LINE</graphType>
<title>Mean length at first
reproduction for male
</title>
<xAxisLabel>Time (season)</xAxisLabel>
<yAxisLabel>length (cm)</yAxisLabel>
<variableName>getMeanLengthOfFirstReprodutionForMale</variableName>
</fr.cemagref.observation.observers.jfreechart.TemporalSerieChart>
</observers>
</fr.cemagref.observation.kernel.ObservablesHandler>
</entry>
<entry>
<java-class>environment.RiverBasin</java-class>
<fr.cemagref.observation.kernel.ObservablesHandler>
<observers>
<observer.TemporalSerieChartForBasin>
<graphType>LINE</graphType>
<title>Number of juveniles</title>
<xAxisLabel>Time
(season)
</xAxisLabel>
<yAxisLabel>number of juveniles</yAxisLabel>
<variableName>getJuvenileNumber</variableName>
</observer.TemporalSerieChartForBasin>
<observer.TemporalSerieChartForBasin>
<graphType>LINE</graphType>
<title>% Autochtone</title>
<xAxisLabel>Time (season)</xAxisLabel>
<yAxisLabel>% Autochtone</yAxisLabel>
<variableName>getLastPercentageOfAutochtone</variableName>
</observer.TemporalSerieChartForBasin>
</observers>
</fr.cemagref.observation.kernel.ObservablesHandler>
</entry>
</hashtable>
\ No newline at end of file
<list>
<species.DiadromousFishGroup>
<name>species A</name>
<color>
<red>255</red>
<green>0</green>
<blue>0</blue>
<alpha>255</alpha>
</color>
<dMaxDisp>300.0</dMaxDisp>
<nutrientRoutine class="species.NutrientRoutine">
<nutrientsOfInterest>
<string>N</string>
<string>P</string>
</nutrientsOfInterest>
<residenceTime>30.0</residenceTime>
<excretionRate class="hashtable">
<entry>
<string>P</string>
<double>2.17E-6</double>
</entry>
<entry>
<string>N</string>
<double>2.471E-5</double>
</entry>
</excretionRate>
<fishFeaturesPreSpawning class="hashtable">
<entry>
<species.DiadromousFish_-Gender>MALE</species.DiadromousFish_-Gender>
<hashtable>
<entry>
<string>bLW_Gonad</string>
<double>3.3838</double>
</entry>
<entry>
<string>aLW_Gonad</string>
<double>-8.8744</double>
</entry>
<entry>
<string>bLW</string>
<double>3.2252</double>
</entry>
<entry>
<string>aLW</string>
<double>0.004095817237891344</double>
</entry>
</hashtable>
</entry>
<entry>
<species.DiadromousFish_-Gender>FEMALE</species.DiadromousFish_-Gender>
<hashtable>
<entry>
<string>bLW_Gonad</string>
<double>2.6729</double>
</entry>
<entry>
<string>aLW_Gonad</string>
<double>-5.2425</double>
</entry>
<entry>
<string>bLW</string>
<double>3.3429</double>
</entry>
<entry>
<string>aLW</string>
<double>0.002665367811305362</double>
</entry>
</hashtable>
</entry>
</fishFeaturesPreSpawning>
<fishFeaturesPostSpawning class="hashtable">
<entry>
<species.DiadromousFish_-Gender>MALE</species.DiadromousFish_-Gender>
<hashtable>
<entry>
<string>bLW_Gonad</string>
<double>3.8331</double>
</entry>
<entry>
<string>aLW_Gonad</string>
<double>-11.285</double>
</entry>
<entry>
<string>bLW</string>
<double>2.9973</double>
</entry>
<entry>
<string>aLW</string>
<double>0.010383887012522573</double>
</entry>
</hashtable>
</entry>
<entry>
<species.DiadromousFish_-Gender>FEMALE</species.DiadromousFish_-Gender>
<hashtable>
<entry>
<string>bLW_Gonad</string>
<double>2.8545</double>
</entry>
<entry>
<string>aLW_Gonad</string>
<double>-6.6234</double>
</entry>
<entry>
<string>bLW</string>
<double>2.9418</double>
</entry>
<entry>
<string>aLW</string>
<double>0.013199187556948952</double>
</entry>
</hashtable>
</entry>
</fishFeaturesPostSpawning>
<juvenileFeatures class="hashtable">
<entry>
<string>bLW</string>
<double>3.0306</double>
</entry>
<entry>
<string>aLW</string>
<double>0.006986429759979109</double>
</entry>
</juvenileFeatures>
<compoCarcassPreSpawning class="hashtable">
<entry>
<species.DiadromousFish_-Gender>MALE</species.DiadromousFish_-Gender>
<hashtable>
<entry>
<string>P</string>
<double>0.00666</double>
</entry>
<entry>
<string>N</string>
<double>0.02941</double>
</entry>
</hashtable>
</entry>
<entry>
<species.DiadromousFish_-Gender>FEMALE</species.DiadromousFish_-Gender>
<hashtable>
<entry>
<string>P</string>
<double>0.006730000000000001</double>
</entry>
<entry>
<string>N</string>
<double>0.029580000000000002</double>
</entry>
</hashtable>
</entry>
</compoCarcassPreSpawning>
<compoGametes class="hashtable">
<entry>
<species.DiadromousFish_-Gender>MALE</species.DiadromousFish_-Gender>
<hashtable>
<entry>
<string>P</string>
<double>0.00724</double>
</entry>
<entry>
<string>N</string>
<double>0.0325</double>
</entry>
</hashtable>
</entry>
<entry>
<species.DiadromousFish_-Gender>FEMALE</species.DiadromousFish_-Gender>
<hashtable>
<entry>
<string>P</string>
<double>0.0032</double>
</entry>
<entry>
<string>N</string>
<double>0.03242</double>
</entry>
</hashtable>
</entry>
</compoGametes>
<compoJuvenile class="hashtable">
<entry>
<string>P</string>
<double>0.00887</double>
</entry>
<entry>
<string>N</string>
<double>0.02803</double>
</entry>
</compoJuvenile>
</nutrientRoutine>
<fileNameInputForInitialObservation>data/input/reality/Obs1900.csv</fileNameInputForInitialObservation>
<centileForRange>0.95</centileForRange>
<parameterSetfileName>data/input/reality/parameterSet.csv</parameterSetfileName>
<parameterSetLine>0</parameterSetLine>
<yearOfTheUpdate>0</yearOfTheUpdate>
<basinsToUpdateFile>data/input/reality/basinsToUpdate.csv</basinsToUpdateFile>
<outputPath>data/output/northeastamerica/</outputPath>
<minYearToWrite>1800</minYearToWrite>
<fileNameFluxes></fileNameFluxes>
<lengthAtHatching>2.8</lengthAtHatching>
<linfVonBertForFemale>76.0</linfVonBertForFemale>
<linfVonBertForMale>76.0</linfVonBertForMale>
<lFirstMaturityForFemale>45.0</lFirstMaturityForFemale>
<lFirstMaturityForMale>40.0</lFirstMaturityForMale>
<processes>
<processesAtBegin>
</processesAtBegin>
<processesEachStep>
<environment.InformTime>
<synchronisationMode>ASYNCHRONOUS</synchronisationMode>
<consoleDisplay>true</consoleDisplay>
</environment.InformTime>
<species.PlopProcess>
<synchronisationMode>ASYNCHRONOUS</synchronisationMode>
<temporisation>0</temporisation>
</species.PlopProcess>
<species.PopulateBasinNetworkSeveralTimesAccordingToBasinSize>
<synchronisationMode>ASYNCHRONOUS</synchronisationMode>
<nbFishPerSI>100000</nbFishPerSI>
<initialLength>2.8</initialLength>
<etaPopulate>40.0</etaPopulate>
<timesOfPopulate>5</timesOfPopulate>
<populateSeason>SPRING</populateSeason>
</species.PopulateBasinNetworkSeveralTimesAccordingToBasinSize>
<species.Age>
<synchronisationMode>ASYNCHRONOUS</synchronisationMode>
</species.Age>
<species.Grow>
<synchronisationMode>ASYNCHRONOUS</synchronisationMode>
<tempMinGrow>3.0</tempMinGrow>
<tempMaxGrow>26.0</tempMaxGrow>
<tempOptGrow>17.0</tempOptGrow>
<kOptForFemale>0.3236</kOptForFemale>
<kOptForMale>0.2141</kOptForMale>
<sigmaDeltaLVonBert>0.2</sigmaDeltaLVonBert>
</species.Grow>
<species.MigrateFromOffshoreToInshore>
<synchronisationMode>ASYNCHRONOUS</synchronisationMode>
<migrationSeasonToReachInshore>SPRING</migrationSeasonToReachInshore>
</species.MigrateFromOffshoreToInshore>
<species.DisperseAndMigrateToRiverWithMultiNomDistriAndDeathBasin>
<synchronisationMode>ASYNCHRONOUS</synchronisationMode>
<alpha0Rep>-2.9</alpha0Rep>
<alpha1Rep>19.7</alpha1Rep>
<alpha3Rep>0.0</alpha3Rep>
<meanBvSurface>17351</meanBvSurface>
<standardDeviationBvSurface>35594</standardDeviationBvSurface>
<meanInterDistance>300.0</meanInterDistance>
<standardDeviationInterDistance>978.0</standardDeviationInterDistance>
<pHomingForReachEquil>0.97</pHomingForReachEquil>
<pHomingAfterEquil>0.97</pHomingAfterEquil>
<NbYearForInstallPop>0</NbYearForInstallPop>
<riverMigrationSeason>SPRING</riverMigrationSeason>
<alpha2Rep>0.0</alpha2Rep>
<meanSpawnersLengthAtRepro>45.0</meanSpawnersLengthAtRepro>
<standardDeviationOfSpawnersLengthAtRepro>2.0</standardDeviationOfSpawnersLengthAtRepro>
<weightOfDeathBasin>0.4</weightOfDeathBasin>
</species.DisperseAndMigrateToRiverWithMultiNomDistriAndDeathBasin>
<species.Survive>
<synchronisationMode>ASYNCHRONOUS</synchronisationMode>
<tempMinSurvivalSpawnerInRiv>8</tempMinSurvivalSpawnerInRiv>
<tempOptSurvivalSpawnerInRiv>17.0</tempOptSurvivalSpawnerInRiv>
<tempMaxSurvivalSpawnerInRiv>26</tempMaxSurvivalSpawnerInRiv>
<survivalProbOptSpawnerInRiv>1.0</survivalProbOptSpawnerInRiv>
<!--<mortalityRateInRiver>0.4</mortalityRateInRiver> -->
<mortalityRateInSea>0.4</mortalityRateInSea>
<mortalityRateInOffshore>0.4</mortalityRateInOffshore>
</species.Survive>
<!--<species.WriteEffectiveAndBiomassImportFluxes> <synchronisationMode>ASYNCHRONOUS</synchronisationMode> <exportSeason>SPRING</exportSeason>
<fileNameOutput>effectiveBiomassFluxesBeforeReproduction</fileNameOutput> </species.WriteEffectiveAndBiomassImportFluxes> -->
<species.ReproduceAndSurviveAfterReproductionWithDiagnose>
<synchronisationMode>ASYNCHRONOUS</synchronisationMode>
<reproductionSeason>SPRING</reproductionSeason>
<tempMinRep>10</tempMinRep>
<tempOptRep>17</tempOptRep>
<tempMaxRep>30</tempMaxRep>
<eta>2.4</eta>
<ratioS95__S50>1.9</ratioS95__S50>
<a>270000</a>
<delta__t>0.33</delta__t>
<survOptRep>0.0017</survOptRep>
<lambda>4.1E-4</lambda>
<proportionOfFemaleAtBirth>0.5</proportionOfFemaleAtBirth>
<initialLength>2.8</initialLength>
<sigmaRecruitment>0.2</sigmaRecruitment>
<survivalRateAfterReproduction>0.1</survivalRateAfterReproduction>
<maxNumberOfSuperIndividualPerReproduction>100.0
</maxNumberOfSuperIndividualPerReproduction>
<withDiagnose>false</withDiagnose>
<displayFluxesOnConsole>false</displayFluxesOnConsole>
</species.ReproduceAndSurviveAfterReproductionWithDiagnose>
<species.MigrateFromRiverToInshore>
<synchronisationMode>ASYNCHRONOUS</synchronisationMode>
<migrationSeasonToReachInshore>SPRING</migrationSeasonToReachInshore>
<displayFluxesOnConsole>false</displayFluxesOnConsole>
</species.MigrateFromRiverToInshore>
<species.MigrateToOffshore>
<synchronisationMode>ASYNCHRONOUS</synchronisationMode>
<migrationSeasonToReachSummeringOffshore>SPRING</migrationSeasonToReachSummeringOffshore>
</species.MigrateToOffshore>
<species.MigrateBetweenOffshores>
<synchronisationMode>ASYNCHRONOUS</synchronisationMode>
<migrationSeasonToReachWinteringOffshore>AUTOMN</migrationSeasonToReachWinteringOffshore>
<migrationSeasonToReachSummeringOffshore>SPRING</migrationSeasonToReachSummeringOffshore>
</species.MigrateBetweenOffshores>
<environment.updateTemperatureInRIOBasin>
<synchronisationMode>ASYNCHRONOUS</synchronisationMode>
</environment.updateTemperatureInRIOBasin>
</processesEachStep>
<processesAtEnd>
<species.WriteBiomassFluxes>
<synchronisationMode>ASYNCHRONOUS</synchronisationMode>
<exportSeason>SPRING</exportSeason>
<fileNameOutput>biomassFluxes</fileNameOutput>
</species.WriteBiomassFluxes>
</processesAtEnd>
</processes>
<useCemetery>false</useCemetery>
</species.DiadromousFishGroup>
</list>
residenceTime,30.0,,,,
,,,,,
,gender,N,P,,
excretionRate,ALL,0.00002471,0.00000217,,
compoJuvenile,UNDIFFERENCIED,0.02803,0.00887,,
compoGametes,FEMALE,0.03242,0.0032,,
compoGametes,MALE,0.0325,0.00724,,
compoCarcassPreSpawning,FEMALE,0.02958,0.00673,,
compoCarcassPreSpawning,MALE,0.02941,0.00666,,
,,,,,
,,aLW,bLW,aLW_Gonad,bLW_Gonad
juvenileFeatures,UNDIFFERENCIED,0.00698642975997911,3.0306,,
fishFeaturesPostSpawning,MALE,0.0103838870125226,2.9973,-11.285,3.8331
fishFeaturesPostSpawning,FEMALE,-6.6234,2.8545,0.013199187556949,2.9418
fishFeaturesPreSpawning,MALE,0.00409581723789134,3.2252,-8.8744,3.3838
fishFeaturesPreSpawning,FEMALE,0.00266536781130536,3.3429,-5.2425,2.6729
library(rJava)
library(yaml)
library(dplyr)
rm(list=ls())
set.seed(1)
# parameters and prios=rs of parameters to be fitted
inputData = yaml.load_file("ABC_seq_2param_3stats_NewAfterSA.yaml")
# load prior
prior = list()
for (i in 1:length(inputData$parameters)) {
p = inputData$parameters[[i]]
prior[[i]] = unlist(p$prior)
}
parametersNames = list()
for (i in 1:length(inputData$parameters)) {
parametersNames = c(parametersNames, inputData$parameters[[i]]$javapath)
}
thetas = c(0.45, 10.5)
# path to outputs
outputDir = "simus/"
jarfile = "../../target/GR3D-3.2-SNAPSHOT.jar"
simDuration = 48
simBegin = 1
timeStepDuration =1
seed = 1
arguments = c('-d','-simDuration',simDuration, '-simBegin',simBegin,
'-timeStepDuration',timeStepDuration,
'-RNGStatusIndex', format(seed,scientific = FALSE),
'-groups',"../../data/input/northeastamerica/fishRIOBasin_Sapidissima_PL.xml",
'-env',"../../data/input/northeastamerica/RIOBNneaBasins.xml",
'-observers',"../../data/input/northeastamerica/RIO_obs_empty.xml")
outputFile = paste0(outputDir,"output",seed)
.jinit(classpath = jarfile, force.init = TRUE)
.jcall("miscellaneous.EasyRun","V","runSimulation",arguments, outputFile,.jarray(unlist(parametersNames)),.jarray(thetas))
# return a function to run the model with parameters as arguments
salrun <- function(jarfile, simDuration, simBegin, timeStepDuration = 1) {
assign("inputData",inputData)
assign("outputDir",outputDir)
function(parameters) {
# loading the user's data
parametersNames = list()
for (i in 1:length(inputData$parameters)) {
parametersNames = c(parametersNames, inputData$parameters[[i]]$javapath)
}
# extracting the seed and the model parameters
seed=parameters[1]
thetas=parameters[2:length(parameters)]
outputFile = paste(outputDir,"output",seed,sep="")
if (!file.exists(paste(outputFile,".csv",sep=""))) {
# run
arguments=c('-q','-simDuration',simDuration, '-simBegin',simBegin,
'-timeStepDuration',timeStepDuration, '-groups',"data/input/fishTryRealBV_CC.xml",
'-env',"data/input/BNtryRealBasins.xml",'-observers',"data/input/obsTryRealABC.xml", '-RNGStatusIndex', format(seed,scientific=FALSE))
.jinit(classpath=jarfile)#, force.init=TRUE)
.jcall("miscellaneous.EasyABC","V","runSimulation",arguments, outputFile,.jarray(unlist(parametersNames)),.jarray(thetas))
}
# output
likelihood=as.double(as.matrix(read.csv(paste(outputFile,".csv",sep=""), skip=10, h=F, sep=";"))[1,2])
agestat=as.double(as.matrix(read.csv(paste(outputFile,".csv",sep=""), skip=11, h=F, sep=";"))[1,2])
maxlat=as.double(as.matrix(read.csv(paste(outputFile,".csv",sep=""), skip=12, h=F, sep=";"))[1,2])
if (maxlat>0)
c(likelihood,agestat,maxlat)
else
c(NA,NA,NA)
}
}
model = salrun(
jarfile = "GR3D-1.0-SNAPSHOT.jar",
simDuration = 400,
simBegin = 2)
/*
* Copyright (C) 2014 dumoulin
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.