|
From: Mark R. D. <mdi...@la...> - 2002-10-21 16:56:13
|
Also, to give you an idea of how this looks in an Ant script here is one
of my scripts (Note: my Model uses a Modified ParameterFileLoader class
that loads single property values from a standard java properties file):
<?xml version="1.0" encoding="UTF-8"?>
<project basedir="." default="pva_analysis" name="PVA Batch Example">
<!-- define my custom tasks here -->
<taskdef name="batch" classname="org.mrd.ant.Batch">
<classpath>
<fileset dir="../../lib">
<include name="**/*.jar"/>
</fileset>
<pathelement path="../../classes"/>
</classpath>
</taskdef>
<taskdef name="beta" classname="org.mrd.ant.distributions.Beta">
<classpath>
<fileset dir="../../lib">
<include name="**/*.jar"/>
</fileset>
<pathelement path="../../classes"/>
</classpath>
</taskdef>
<!-- Define the batch targets here -->
<target name="pva_analysis">
<tstamp>
<format pattern="yyyy_MM_dd-hh_mm_ss" property="time"/>
</tstamp>
<property name="pva_survivalMean" value="0.98"/>
<property name="pva_survivalVar" value="0.015"/>
<property name="pva_reproductionMean" value="0.55"/>
<property name="pva_reproductionVar" value="0.05"/>
<batch iterations="5" name="run">
<!-- the iteration number gets stored under the property
"run" -->
<beta name="run_survial" mean="${pva_survivalMean}"
std="${pva_survivalVar}"/>
<beta name="run_reproduction" mean="${pva_reproductionMean}"
std="${pva_reproductionVar}"/>
<antcall target="createProperties"/>
<antcall target="execute"/>
</batch>
</target>
<target name="createProperties">
<mkdir dir="./results/${time}/run_${run}"/>
<propertyfile comment="PVA simulation Run # ${run}"
file="./results/${time}/run_${run}/cagn.properties">
<!-- Add parameters here to put into properties file -->
<entry key="ModelInitialPairs" value="100"/>
<entry key="ModelMaxIterations" value="500"/>
<entry key="PairSurvivalProbability" value="${run_survial}"/>
<entry key="PairReproductionProbability"
value="${run_reproduction}"/>
</propertyfile>
</target>
<target description="Running Simulation" name="execute">
<java classname="org.mrd.examples.simple.Main"
dir="./results/${time}/run_${run}" failonerror="false" fork="true">
<arg value="-i"/>
<arg value="'./cagn.properties'"/>
<arg value="-h"/>
<arg value="'../../../habitatspace.pgm'"/>
<arg value="-l"/>
<arg value="'../../../logconfig.xml'"/>
<arg value="-b"/>
<arg value="'../pva_results.txt'"/>
<arg value="-r"/>
<arg value="'run_results.txt'"/>
<classpath>
<pathelement location="../../classes"/>
<!--pathelement location="G:\repast1.4\repast\src\src"/-->
<fileset dir="../../lib">
<include name="**/*.jar"/>
</fileset>
</classpath>
<jvmarg value="-Xms128m"/>
<jvmarg value="-Xmx256m"/>
</java>
</target>
</project>
|