Loading...
 

ABE minimal setup

Due to the rather complex nature of most interesting study landscapes, setting up ABE appropriately can be quite demanding. It is considerably less hard, if a “running” ABE is required for testing or getting-started purposes only. However, even the setup of a “minimal ABE” requires a couple of steps, that are covered in this page.

The minimum requirements for a “running ABE” are:

  • A stand grid containing numeric Ids for “polygons” (such a grid is likely already used, e.g. for stand initialization, see landscape setup.
  • A file stating the “ownership” structure of the landscape, i.e. it links each polygon of the stand grid to a management unit and a managing agent (see ABE spatial setup)
  • A Javascsript file that contains the code of ABE. This file needs to include at least a basic definition of an agent, a stand treatment program, and some initialization code.
  • Set up ABE in the project file


The following R code shows how a minimal "abeDataFile" can be created from a GIS raster:

creating the “abedata.csv”-file from a stand grid (R)
n <- raster("path/to/standgrid.txt")
ids <- unique(n) ## 
abedata <- data.frame(id=ids[ids>0], stp="stp", agent="agent", unit="unit")
write.table(abedata, file="path/to/abedata.csv", row.names=F)



The minimal Javascript for defining the STP and agent are given below:

minimal ABE javascript code
// minimal  stand treatment program
var stp = { U: [100,110,120], // short/normal/long rotation age
            options: {}, // no options
			activity: { type: 'custom',  …. }
};

// register the stand treatment program stp with the name 'stp'
fmengine.addManagement(stp , 'stp');

// minimal agent type
var base_agent = {
	scheduler: { enabled: false },

	stp: {  'stp': 'stp', 'default': 'stp'	},
	newAgent: function() { return {  scheduler: this.scheduler }; },
	onSelect: function() { return 'stp'; },
	run: function() { console.log('base-agent run called'); }
};

// register the agent-factory object base_agent under the name agenttype
fmengine.addAgentType(base_agent, 'agenttype');
// use the 'agenttype' agent-factory and create an agent named 'agent'
fmengine.addAgent('agenttype', 'agent');


In the project file, ABE must be enabled:

XML for the section "management"
<!--  ABE section in the project file  -->
<abeEnabled>true</abeEnabled>
<abe>	
	<file>abe/abe.js</file>
	<agentDataFile>abe/abedata.csv</agentDataFile>
</abe>

citation

Rammer, W., Seidl, R., 2015. Coupling human and natural systems: Simulating adaptive management agents in dynamically changing forest landscapes. Global Environmental Change, 35, 475-485.

Created by werner. Last Modification: Friday 23 of September, 2016 12:23:10 CEST by werner.