Demo models‎ > ‎MacroABM‎ > ‎

The Class Hierarchy of 'Agents'

Here we outline the class hierarchy of the Macro model.  Please see https://docs.oracle.com/javase/tutorial/java/IandI/subclasses.html for a general introduction to inheritance and class hierarchy in Java and object-oriented programming languages in general.  The class hierarchy of MacroABM is shown in Figure 1.

Figure 1. The Class Hierarchy of Agents: Agent is the superclass, which has Bank and Firm subclasses, of which the Firm class also has subclasses of KFirm and CFirm.  Note that both KFirm and CFirm objects each have a BalanceSheetKFirm and BalanceSheetCFirm object respectively.


The superclass on the class hierarchy of agents is the Agent class (the file called 'Agent.java' found in the jasmine.model package).  This is an abstract class (see https://docs.oracle.com/javase/tutorial/java/IandI/abstract.html), which contains 'protected' fields specifying the reference to the Model cand the Collector manager classes.  As is typical of JAS-mine projects (see http://www.jas-mine.net/home/documentation/focus/model-collector-observer), the Model class deals mainly with specification issues, creating objects, relations between objects, and defining the order of events that take place in the simulation.  The Collector class collects the data and compute the statistics both for use by the simulation objects and for post-mortem analysis of the model outcome, after the simulation has completed.

The Firm class (the file called 'Firm.java' found in the jasmine.model package) is also an abstract class, which is derived from the Agent class, meaning that it 'inherits' the 'protected' fields (the references to the model and collector) from the Agent class.  We also say that the Firm is a subclass of the Agent class, which is itself the superclass.  The Firm class contains 'protected' fields representing all the variables that both Capital- and Consumption-good Firms have in common.  These include financial variables such as the amount of liquid assets, debt and profit that each firm agent has.  In addition, there are production-side variables such as the price of goods produced, the cost to produce each good, the labour demand, demand for goods and quantity of sales.  There are also fields describing the state of the firm, such as its market share, size, and whether it is a new entrant or a firm about to exit the simulation.

The KFirm class (the file called 'KFirm.java' found in the jasmine.model package) represents the Capital-good producing firm.  It is a concrete class (i.e. not an abstract class), meaning it can be created or 'instantiated'.  It is derived from the Firm class, meaning that it 'inherits' all the 'protected' fields both the Agent and Firm classes.  On top of these variables, the KFirm class defines Capital-good specific firm variables such as the set of client CFirms it produces machines for and their orders, the current machine it produces, the 'technology' (productivity of the machine and the firm, related to both its innovative activities and its imitation of other KFirms), its research and development expenditure, its demand for labour to be used only for research and development, and also the labour demand it uses only for production.  In addition, the KFirm class has a 'BalanceSheetKFirm' accounting object (the file called 'BalanceSheetKFirm.java' found in the jasmine.object package), that collects all the financial information of the KFirm such as stock and flow variables, and performs the computation related to it.

The CFirm class (the file called 'CFirm.java' found in the jasmine.model package) represents the Consumption-good producing firm.  Like the KFirm class, it is a concrete class, meaning that it can be created or 'instantiated'.  It is derived from the Firm class, meaning that it 'inherits' all the 'protected' fields both the Agent and Firm classes.  On top of these variables, the CFirm class defines Consumption-good specific firm variables such as the set of potential KFirms that the CFirm is aware of as potential suppliers of machines.  The CFirm also has fields describing the age and quantity of their stock of machines, and whether they desire to scrap any of their machines.  Other fields include productivity of the CFirm, the mark-up rate it applies to the consumption goods it produces, its unfilled demand (if any), the firm's competitiveness, investment in new machines and whether these are to expand or to replace older machine vintages, and the inventory of consumption goods.  Financial fields include the firm's credit demand, loans both for production and investment or debt repayment, net worth (equity) to sales ratio which is used by banks to determine how much to lend the firm, its stock of bad debt that the firm is unable to repay, and the external funding during the current time-step.  Another set of fields relate to expected demand and desired amounts of production, investment, inventories and capital stock.  Lastly, similar to the KFirm, the CFirm class has a 'BalanceSheetCFirm' accounting object (the file called 'BalanceSheetCFirm.java' found in the jasmine.object package), that collects all the financial information of the CFirm such as stock and flow variables, and performs the computation related to it.

The Bank class (the file called 'Bank.java' found in the jasmine.model package), represents the single Bank agent that participates in the model, advancing loans to CFirms objects and taking deposits from both CFirms and KFirms.  Like the KFirm and CFirm, it is a concrete class, meaning that it can be created or 'instantiated', however it is derived directly from the Agent class, not the Firm class, as it is clearly not a firm (and therefore does not need the same fields as firms).  The Bank class inherits the 'protected' fields from the Agent class such as the model and collector references.  In addition, the Bank class specifies new fields describing the state of the bank, including its debt, equity, the amount of credit it has supplied to CFirms, the total amount of remaining credit that it can supply, its reserves, cash, deposits (from the CFirms and KFirms), its monetary base, profit, bad debt, deposit revenues and debt interest.  Furthermore, it stores information about CFirms' credit ratings (i.e. their net worth (equity) to sales ratio).



Previous: The JAS-mine File Structure        Next: Parameters