Commit 7845ba84 authored by patrick.lambert's avatar patrick.lambert
Browse files

some test from Rougier et al

parent 7ed954df
......@@ -21,30 +21,37 @@ import fr.cemagref.simaqualife.pilot.Pilot;
public class EasyABC {
public static void runSimulation(String[] batchArgs, String outputfilename, String[] paramNames, double[] paramValues) throws Exception {
try {
Pilot pilot = new Pilot();
BatchRunner runner = new BatchRunner(pilot);
pilot.init();
runner.parseArgs(batchArgs, false, true, false);
pilot.load();
ReflectUtils.setFieldValueFromPath(pilot.getAquaticWorld().getAquaNismsGroupsList().get(0), "processes.processesAtEnd.0.fileNameOutput", outputfilename);
for (int i = 0; i < paramNames.length; i++) {
ReflectUtils.setFieldValueFromPath(pilot.getAquaticWorld().getAquaNismsGroupsList().get(0), paramNames[i], paramValues[i]);
}
pilot.run();
// For forcing resources releasing (like shp files)
System.gc();
} catch (Throwable e) {
System.out.println(e.getMessage());
e.printStackTrace();
}
}
public static void runSimulation(String[] batchArgs, String outputfilename, String[] paramNames, double[] paramValues)
throws Exception {
try {
Pilot pilot = new Pilot();
BatchRunner runner = new BatchRunner(pilot);
pilot.init();
runner.parseArgs(batchArgs, false, true, false);
pilot.load();
ReflectUtils.setFieldValueFromPath(pilot.getAquaticWorld().getAquaNismsGroupsList().get(0),
"processes.processesAtEnd.0.fileNameOutput", outputfilename);
for (int i = 0; i < paramNames.length; i++) {
ReflectUtils.setFieldValueFromPath(pilot.getAquaticWorld().getAquaNismsGroupsList().get(0), paramNames[i],
paramValues[i]);
}
pilot.run();
// For forcing resources releasing (like shp files)
System.gc();
} catch (Throwable e) {
System.out.println(e.getMessage());
e.printStackTrace();
}
}
public static void main(String[] args) throws Exception {
runSimulation("-simDuration 400 -simBegin 2 -timeStepDuration 1 -groups data/input/fishTryRealBV_CC.xml -env data/input/BNtryRealBasins.xml -observers data/input/obsTryReal.xml".split("\\ "),
"data/output/tsointsoin", new String[]{"processes.processesEachStep.5.tempMinRep", "processes.processesEachStep.4.tempMinMortGenInRiv",
"processes.processesEachStep.5.ratioS95_S50", "processes.processesEachStep.3.pHomingAfterEquil"},
new double[]{10, 8, 2, 0.7});
}
public static void main(String[] args) throws Exception {
runSimulation(
"-simDuration 400 -simBegin 2 -timeStepDuration 1 -groups data/input/fishTryRealBV_CC.xml -env data/input/BNtryRealBasins.xml -observers data/input/obsTryRealABC.xml"
.split("\\ "),
"data/output/tsointsoin",
new String[] { "processes.processesEachStep.5.tempMinRep", "processes.processesEachStep.4.tempMinMortGenInRiv",
"processes.processesEachStep.5.ratioS95_S50", "processes.processesEachStep.3.pHomingAfterEquil" },
new double[] { 10, 8, 2, 0.7 });
}
}
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