This project includes a helper script to compile and run the Java application from the command line.
- Java JDK installed (
javacandjavaavailable in PATH)
From the project root:
./run.shTo start a new run immediately at startup (without opening the New Run settings form), use:
./run.sh -nTo auto-save a plot screenshot after a run finishes and then exit the app, use:
./run.sh -n -p=out/plot.pngThe script will:
- Compile
src/PopGUserInterface.javainto theout/directory. - Run the main class
popg.PopGUserInterface.
You can pass a JSON file path to preload default input values.
./run.sh path/to/defaults.jsonYou can combine it with -n to load defaults and immediately execute the New
Run flow:
./run.sh path/to/defaults.json -nYou can also combine defaults, auto-run, and screenshot capture:
./run.sh path/to/defaults.json -n -p=out/plot.pngIf the file can be read, any recognized fields in the JSON will override the
built-in defaults from initInputVals().
From the project root:
./build.shThis generates PopG.jar in the project root.
java -jar PopG.jarYou can pass the same optional arguments as run.sh:
java -jar PopG.jar -n
java -jar PopG.jar path/to/defaults.json
java -jar PopG.jar path/to/defaults.json -n
java -jar PopG.jar path/to/defaults.json -n -p=out/plot.pngCLI options:
-n: start a New Run immediately at startup.-p=path/to/file.png: after a run finishes, save a plot screenshot to the given path and close the application. Requires-n.
Supported JSON keys (all optional):
popSize: initial population size.fitGenAA: fitness value for genotypeAA.fitGenAa: fitness value for genotypeAa.fitGenaa: fitness value for genotypeaa.mutAa: mutation rate from alleleAtoa.mutaA: mutation rate from alleleatoA.migRate: migration rate between populations.initFreq: initial frequency of alleleA.genRun: number of generations to simulate.numPop: number of populations in the simulation.genSeed: whether to generate a random seed automatically.randSeed: explicit random seed value (used whengenSeedisfalse).
{
"popSize": 250,
"fitGenAA": 0.95,
"fitGenAa": 1.0,
"fitGenaa": 1.05,
"mutAa": 0.001,
"mutaA": 0.002,
"migRate": 0.01,
"initFreq": 0.4,
"genRun": 200,
"numPop": 15,
"genSeed": false,
"randSeed": 42
}