An open API service indexing awesome lists of open source software.

https://github.com/mike42/forestry


https://github.com/mike42/forestry

Last synced: 3 months ago
JSON representation

Awesome Lists containing this project

README

          

forestry
--------

Daisyworld-style artificial life simulation for evaluating sustainable forestry
management practices.

This has only been tested on Debian GNU/Linux, but would in theory work on any
UNIX. You will need a C++ compiler, OpenCV libraries, and (optionally) gnuplot:

sudo apt-get install libopencv-dev gnuplot

Currently best way to run is:

make && bin/Release/forestry > data.dat && gnuplot plot.gnuplot

Command-line usage
------------------
The basic experiment parameters are tuned to produce a stable planet, but the
following ones will help you experiment with the forestry and monitor its output:

forestry [--help | --usage | --clear amount | --daisyworld | --empty ]
[--display-window | --display-invisible[=until] | --display-file prefix ]
[--random-seed r] [--num-frames n ]
[--display-skip s] [--display-temp-only] [frame1 frame2 frame3]

Modes:
--help --usage
Shows above block of options

--clear amount [frame1 frame2 frame3]
-c amount [frame1 frame2 frame3]
The portion of trees to clear in the designated area, between 0 and 1.
Add up to three frame numbers on the command-line, to clear each world at.
In --display-window, this will create up to 4 windows, one as a control,
and three being cleared at the frames set in the other arguments.

--daisyworld
-d
Run a daisyworld-style simulation, with no forest clearance at all

--empty
-e
Simulate an empty planet only. Use --num-frames to tell it how many
frames you want.

Simulation options:
--random-seed n
-r n
Set the number to seed the random number generator with. If not specified,
it is seeded from a system-provided random device.

--num-frames number
-n number
Number of frames to simulate. After this, the simulation will stop. If not specified,
the simulation will stop when there are no more daisies surviving in any of the
simulated worlds.

Display options:
--display-invisible[=n]
-i
Hide the first n frames, or display no output at all if -i is specified. Used in
conjunction with --random-seed, --num-frames and other display options to
extract a specific section of interest from a run.

--display-temp-only
Do not render the daisies over the coloured heat-map.

--display-skip frames
-s frames
Set a frame-skip on the output, so that the simulation runs faster.

--display-window
-w
Show rendered frames in a window

--display-file prefix
-f prefix
Save rendered frames to files, named with the specified prefix. This
may produce several gigabytes of data, so consider combining it with options
such as --display-invisible 50, --num-frames 100 --display-skip 1

Remember that a simulation can be repeated if you pass it a seed!

Example simulations
-------------------
The example/ directory contains shell scripts which were used to collect data,
and are a good source of examples.

Plots
-----
The plot/ directory contains piles of gnuplot files which were used to render the data files.

Output tips
-----------

To generate a capture video from PNG output:

avconv -f image2 -r 200 -i frame-0-%5d.png daisyworld.mp4

To reduce it to an acceptable file-size (as the above is 200FPS and will be a few hundred MB):

avconv -i daisyworld.mp4 -r:v 18 -b:v 2000k daisyworld-small.mp4

To re-plot data as it is printed:

bin/Release/forestry | tee data.dat

And in another terminal, run the plotter:

while true; do (gnuplot plot/population-plot.gnuplot && gnuplot plot/temperature-plot.gnuplot ); sleep 3; done

Evince (the GNOME PDF viewer) will re-render the plot as it changes.