A very simple standalone ABM example in Julia that can be used as a starting point for a new ABM implementation.
All model-specific code is contained in lower-case .jl files. All other files contain modules that are more or less general and can be reused.
The main parts of the model:
setup_world.jl
functions to create the world in different configurationsmodel.jl
data structures and processes that make up the model itselfanalysis.jl
observations and data outputsetup.jl
create a runnable modelparams.jl
model parametersdraw_gui.jl
draw the model to a canvasrun_gui.jl
ties everything together, creates model from commandline parameters and runs it with GUIrun_cmdl.jl
ties everything together, creates model from commandline parameters and runs without gui
In order to implement a new model only a few of the included files have to be changed:
model.jl
for the model itselfsetup.jl
for model-specific setup and initialisationparams.jl
to define model parametersanalysis.jl
for output
And for the GUI version:
draw_gui.jl
to display the modelrun_gui.jl
for model-specific graphs
Run as julia run_gui.jl
or julia run_cmdl.jl
. Run with --help
to see commandline options.
draw_vector.jl
contains currently unused code to draw the world as an SVG image using Luxor.
In order to run the model the following packages have to be installed:
- MiniEvents (not registered yet, for now install as
add https://github.com/mhinsch/MiniEvents.jl
) - MiniObserve (not registered yet, for now install as
add https://github.com/mhinsch/MiniObserve.jl
) - DataStructures
- Distributions
- ArgParse
- Parameters
- MacroTools
- StaticArrays
- SimpleDirectMediaLayer (for GUI only)