The big feature of 0.5 is core support for matching models. A matching model doesn’t step through the agents one by one, but matches them together in a group of some number. This is especially useful for game-theoretic models, where agents are paired together and play a strategy against one another.
A matching model can be built by setting model.order=='match-n'
, where n is the size of the matched group. Agents will still run their step function if one is specified, but the main model logic will go in a new match function. There are also new hooks to control the matching process more precisely.
The second important improvement is a series of new GUI hooks that allow panels to be inserted at any point in the control panel. See CpanelTop
, CpanelAboveItemParams
, CpanelAboveParams
, CpanelAbovePlotList
, CpanelAboveShocks
, and CpanelBottom
.
Third, the plot-selector interface with the textCheck
elements has been spun out into a new tkinter control, checkGrid
, that can be used to get and set lists of boolean parameters in user code.
All of these features are shown off in a new Axelrod tournament model from the classic Axelrod (1980) paper, included in the sample models. In the Axelrod model, agents are paired off and play 200 rounds of a repeated prisoner’s dilemma against each other in order to compare how well various strategies do against a variety of others. This model also uses CpanelAbovePlotList
to insert a checkGrid
in the control panel that toggles the various available strategies.
See below for a full list of API changes.
API Changes in Version 0.5
- ⚠️ CobbDouglasEliminated the second
__init__
argument and allowed exponents to be specified in the first argument. - ⚠️ CESEliminated the third
__init__
argument and allowed coefficients to be specified in the first argument. - ⚠️ DataChanged
data.reporters
from adict
of functions to a dict ofItem
objects in order to organize more reporter metadata. Code calling reporters directly from theData
object, e.g.data.reporters[name](model)
should now call them as follows:data.reporters[name].func(model)
. - ⚠️ terminatePass the model data as the second argument.
- ⚠️ orderRun the hook at the beginning of each stage rather than each period, and convert to a modified key function.
- ⚠️ dataCollectMoved to before data collection rather than after, as it was functionally equivalent to
modelPostStep
otherwise. - addPrimitiveAdded the
order
argument. - textCheckAdded the
desc
parameter. - removeReporterIntroduced.
- checkGridIntroduced.
- Cpanel
GUI.checks
is now a checkGrid widget rather than a dict. - Helipad
model.order
can now be set to a list of values corresponding to the number of stages, and also supports matching models. - CpanelAboveItemParamsIntroduced.
- CpanelAboveParamsIntroduced.
- CpanelBottomIntroduced.
- CpanelTopIntroduced.
- CpanelAboveShocksIntroduced.
- matchAcceptIntroduced.
- matchSelectIntroduced.
- matchIntroduced.