Pascal Seppecher
email: pascal.seppecher@unice.fr.

Jamel A Java Agent-based MacroEconomic Laboratory

Keywords:

This paper presents a computational macroeconomic model which closely associates Keynesian thinking and an agent-based approach. This model is original because we do not introduce any causality between macroeconomic variables. Instead of postulate macroeconomic properties, we want to understand them by the methodic reconstruction of the conditions of their emergence, starting from their most elementary foundations: the interactions between individual agents. This model is the model of a dynamic out-of-equilibrium economy composed of two principal sets of agents (firms and households) associated with two main functions (production and consumption). The agents are not representative agents or aggregates but autonomous individuals in direct and indirect interactions, each of them pursuing its own purposes, acting according to their individual state and their local environment, without worrying about the general equilibrium of the system and without any overriding control.

Introduction

This paper presents a computational macroeconomic model1 which closely associates Keynesian thinking and an agent-based approach. This model is original because we do not introduce any causality between macroeconomic variables. Instead of postulate macroeconomic properties, we want to understand them by the methodic reconstruction of the conditions of their emergence2 , starting from their most elementary foundations. In a classic way, we locate this foundations at the level of the interactions between individual agents. "To build up a causal model, we must start not from equilibrium relations but from the rules and motives governing human behavior. We therefore have to specify to what kind of economy the model applies, for various kinds of economies have different rules [. . . ] Our present purpose is to find the simplest kind of model that will reflect conditions in the modern capitalist world. [. . . ] Our model, therefore, depicts a system in which production is organized by individual firms and consumption by individual households, interacting with each other without any overriding control." (Robinson 1962, p. 34) Taking Robinson seriously, we can give a more precise description of the model we want to build: it is the model of a dynamic out-ofequilibrium economy composed of two principal sets of agents (firms and households) associated with two main functions (production and consumption); these functions operate within the framework of capitalist economies (private property of the means of production, monetary exchanges, wage earning); agents are autonomous individuals in direct and indirect interactions (and not representative agents or aggregates), each of them pursuing its own purposes, acting according to their individual state and their local environment, unconcerned about the general equilibrium of the system and without any overriding control (neither from a planner, nor from an auctioneer).

In section 2 we trace the outlines of the model. The following sections detail the construction of the model following a bottom-up approach: the section 3 presents the real and monetary objects that the agents manipulate when interacting; the section 4 is devoted to the description of the markets, that are nothing but places where agents establish direct and decentralized relationships; the section 5 presents the different types of agents that populate the model and gives a description of their behavior functions.

Outlines

The model we have built operates at a level of abstraction that is lower that of classical macroeconomic models because it takes into account several elements of real world complexity:

• the large number of agents, their heterogeneity, their autonomy,

• the decentralization of interactions between the agents,

• the asynchronous parallelism of real and monetary processes that the agents implement.

We focus on these aspects of the model and on their consequences on the macroeconomic dynamics of the system, on its capacity to endure through time maintaining some stability. The model we want to build is not a forecasting model but a research model; so we are not trying to make a complete model and we reject all elements of complexity that do not seem essential for our purpose, while preserving the capacities of the model to be extended later. This section gives an overview of the model, describes the main simplifying hypothesis we have adopted, justifies our technical approach.

2.1 A model of a monetary production economy

A closed economy

All things (money, labor powers, commodities) that circulate in the model are endogenous. There is no exchange with the rest of the world.

Money

The money that circulates in the model is credit money. It is a token money, a number written in the account book of the bank. Payments are made by way of checks or credit transfers, thus the bank is the only agent that can directly manipulate money.

Commodities

All firms produce the same type of good, which is a non-perishable consumption good that firms can be stored without depletion. However, it is assumed that households immediately consume the goods upon purchase.

Productive capital

In contrast to money and commodities, the productive capital of firms -the machines -is given. There is no productive investment, no innovation, no growth.

Time

The model operates sequentially. Each loop of the program corresponds to a basic period of the model. Its duration is defined as the lapse of time between two consecutive payment of income (wages and dividends) to households. So, we will consider that the duration an elementary period equals one month.

That does not mean that all events in a period are simultaneous. The internal structure of a period is also sequential and we distinguish, within a basic period t, 8 stages (t + 0 7 , t + 1 7 ,. . . to t + 7 7 ) each of them corresponding to a specific state of the system. The sequence diagram of monetary flows (figure 1, page 6) gives a graphical representation of the sequence of monetary states and transitions within the period t.

If the interval of time between two successive payments of income is fixed by the structure of the model, the two other important durations -production time, credit term -are exogenous parameters, given in a number of basic periods.

Decentralization

To model the decentralized characteristic of market economies, we populate the model with multiple, heterogenous, autonomous, competitive agents.

Multiplicity

The model contains three types of agents: households, firms, and a bank. The number of agents of each type is given.

Households: Usually, households are the most numerous agents.

The main functions of households are work and consumption. To consume, households must get an income; to get an income, they must have a job or be a owner of a firm or bank. The unemployed households receive no income. Whatever the circumstances, a household does not disappear.

Firms: Firms are usually less numerous than households, since each firm can employ several households. The main function of firms is production. Each firm has a single owner, a household selected at random from the set of all households that populate the simulation. Each firm borrows money, hires or fires workers, produces and sells goods, pays back loans and pays dividends to its owner. A firm can be bankrupt and then disappears. One year later, the bankrupt firm is automatically replaced by a new identical firm (same size and productivity).

Bank:

The bank differs from households and firms since it is a single agent, that represents the whole banking sector. Indeed, in an economy with endogenous money, the banking sector is usually considered as accommodating: because the willingness of firms to produce is at the origin of the money creation3 , the disaggregation of the banking sector seems to be not essential to the study of macroeconomic dynamics of modeled economy. The bank can be bankrupt and the disappears. As the bank is a representative bank for the whole banking sector, its presence is essential; its failure means then a systemic crisis and the simulation breaks off.

Households

Scale:

We have seen that the model can contain only one single bank, on the contrary it tolerates theoretically any number of firms and households. As the model is situated at a high level of abstraction, it cannot claim to be a model of decision and prevision, so it is useless to populate the model with a realistic number of agents. Experience proves that with hundreds of firms and thousands of households, it is feasible to manage very speedy simulations presenting results robust enough.

Heterogeneity

Agents are heterogenous first because there divided in three classes (households, firms, bank) with different functions. Nonetheless, it is heterogeneity with one class of agents that is important to model the decentralized character of market economies.

We do not focus on the exogenous characteristics of agents -initial allocations, behavior parameters -but on the endogenous heterogeneity that results from agent activity : different states (employed or unemployed, good or bad debtor. . . ) or different levels (inventory stocks, liquidities, debts. . . ).

Autonomy

Agents are modeled as simple reactive agents. Agents do not have access to any macroeconomic information (such as average level of prices or wages, inflation rate or unemployment rate. . . ). Each agent adjusts its behavior regarding effective disequilibria between its internal state and its goals. The goals of agents are defined relating to exogenous normal levels and there are no learning processes. Reaction functions of agents are partly stochastic.

Competition

Social networks have a restricted place in the model. Social relations are limited to the relations employer-employed and provider-customer between the households and the firms and to the relation creditordebtor between the bank and the firms. Morever, relations employeremployed and provider-customer are weak relations, frequently challenged on the goods market and the labor market. There is no direct relation between agents of a same class -no class solidarity -all relations between households and between firms consist merely of relations of competition through markets.

A computational model

Considering the complexity of the projected model, we have decided to build the model from scratch instead of to use an existing agent-based simulation platform. We have written the code of the model using the programming language Java.

A high level language

Java is a high level object-oriented programming language. According to Axtell (2004, p. 12), the use of higher level languages like Java "surely pushes back [agent-based models] frontiers by further generations". While slower than C++, Java is easier to use thanks to a radical simplification of the memory management.

A cross-platform language

Java is a cross-platform language: the same program is able to run on all operating systems that support Java. In this sense, the Java language is universal; this is an important property since the programming language of the model is its "natural theoretical language"4 .

Graphical user interface

Several java libraries are available that make easy the building of graphical user interface. Particularly, the free library JFreeChart provide a wide variety of charts adapted to the dynamic presentation of economic data.

Web application

Java allows to create "applets"-applications that can be embedded in a web page and executed in any web browser.

Notations

We use, to designate the variables of the model, a notation system derived from the one of [START_REF] Godley | Monetary economics, An Integrated Approach to Credit, Money, Income, Production and Wealth[END_REF]: capital letters denote values at current prices, the lower case denotes volumes, greek letters denote ratios and elasticities. Stars denote targeted values.

Objects of real and monetary spheres

The model is formed by two coupled systems, one representing the real sphere, the other the monetary sphere. The rules of functioning of these two systems are imposed upon the agents. The implementation of the model in a oriented object language and the encapsulation of the real and monetary data within objects ensures compliance with physical constraints -rules of production, transfer, and destruction of goods -and with monetary constraints -rules of creation, transfer, and destruction of money. Firms and households interact by manipulating objects of the real and monetary spheres while the bank operates only in the monetary sphere. The interaction diagram (figure 2, page 10) gives a representation of the real and monetary interactions projected onto two parallel plans.

Objects of real sphere

The objects of the real sphere represent physical objects and processes that play a role in the production of goods.

The real sphere comprises 5 classes of objects:

• the LaborPower,

• the Factory,

• the Machine,

• the ProductionProcess,

• the Goods.

Labor power

A LaborPower object represents the labor power of a household. This labor power can have two different states: available and exhausted.

In the current version of the model, there is no other distinction between different labor powers from different households.

At the beginning of each period, all labor powers are available. When a household works responding to the call of its employer, the expend() method of its labor power is called. If the labor power of the household is available at this moment, the labor power can be expended: the state of the labor power change to exhausted. On contrary, if the labor power is already exhausted when its method expend() is called, then an error is generated that interrupts the simulation 5 . Thus, a labor power can be expended only once in a period.

Machines and production processes

A Machine object represents a machine, that is a unit of physical capital. Each machine k is described by two parameters:

• d p k the production cycle time; • pr k the average productivity.

In the current version of the model, the production cycle time and the average productivity of each machine are exogenous parameters.

In addition, each machine contains an object of type Production-Process, that represents the production process associated to the machine. An object of type ProductionProcess encapsulate an integer p k,t , that represents the progress of the production process.

Every time a household works -that is every time it is called to expend its labor force onto a machine -the progress of the production process associated to the machine is incremented6 :

p k,t = p k,t-1 + 1 if the machine k is activated, p k,t-1 else. ( 1
)
As well as labor forces can be expended only once in a period, a production progress can be incremented only one in a period. Requiring several successive expenditures of labor power, the internal production process of a machine spreads over several periods (at least equal to d p k ). In fact, this detail of the Machine object implementation is an essential characteristic of the model that relates the real and the monetary spheres; it is because production takes time that firms need bank credit to finance production processes7 .

When the process of production is completed, an object of type Goods representing the new product is created. At period t, the volume of production of the machine k is:

q k,t = pr k d p k if p k,t =d p k , 0 else. (2)
The process of production is then cancelled. A new process will be created when a household will expend its labor force on this machine.

Factory

A Factory object represents a factory, that is the department of the firm in charge of the production. A Factory object is essentially composed of a collection of machines. In the present version of the model, the number of machines embedded in each factory is an exogenous parameter8 . During the production phase, the firm transfers to the factory the list of workers -agents of type household -employed by the firm.

"During the lengthy process of production the business world is increasing outgoings in terms of money -paying out in money for wages and other expenses of production -in the expectation of recouping the outlay by disposing of the product for money at a later date." [START_REF] Keynes | The collected writings of John Maynard Keynes[END_REF](Keynes [1971], p. 33) ], p. 33) As the number of workers can be lower than the number of machines -either because the current level of production is lower than the full capacity of production of the firm, or because some jobs offered on the labor market remain vacant -the factory has to distribute the available workforce onto existing machines.

We assume that the direction of the factory has for first goal to terminate the current production processes before launching a new one. For this purpose, machines are sorted by priority. The machines whose processes of production are most advanced are prioritized. The machines whose processes of production have the same state of progress are sorted by decreasing productivity.

Commodities

An object of type Goods represents a heap of commodities. It associates two properties, the quantity of commodities in the heap and their total value. There is no difference of utility or quality between commodities: all objects of type Goods represent different volumes of the same consumption good.

Encapsulation of the volume and the value within the object Good allows to define rigorously the conditions of creation and transfer of these magnitudes. We have just seen how the volume of commodities that is produced by a given machine is determined: by the repeated expenditure of labor powers on this machine. The value of commodities produced by a given machine equals to the sum of wages payed in the process of production 9 .

Objects of monetary sphere

The objects of the monetary sphere represent the objects that play a role in the creation and the circulation of money. The monetary sphere comprises four classes of objects:

• the Account,

• the Deposit,

• the Loan,

• the Cheque. 9 See Lavoie (2003, p. 151-152).

Current account

An Account object represents the account of a non-bank agent -a household or a firm -at the bank. An Account object is composed of a money deposit and a list of loans.

Deposit

A Deposit object represents a money deposit of a non bank agenta household or a firm -at the bank. A Deposit object encapsulates an integer that represents the amount of the deposit. This object is endowed with one single method credit() that admits a parameter v. A call to this method allows to increase the value of the deposit (credit if v > 0) or to decrease it (debit if v < 0). The amount of a deposit cannot be negative: if one tries to debit an amount higher than the deposit amount, then an error is generated and the simulation breaks off10 .

The non bank agents have no direct access to the object Deposit which is encapsulated within an object of type Account. Thus, an agent cannot freely change the amount of the deposit, which is under the protection of the bank. The bank is the only agent that can have direct access to deposits and each agent must pass through the bank for its monetary operations.

All the money in the model exists only as deposits: the money supply equals the sum of the deposits of non bank agents.

Bank loans

A Loan object represents the debt of a non-bank agent to the bank11 . Each loan l encapsulates four parameters:

• r l the rate of interest;

• L l the principal;

• d l the due date;

• q l the loan quality.

When the bank lends to an agent, a new Loan object is created for the loan amount and this amount is immediately credited on the borrower deposit. In the same time, the Loan object is added at the list of credits related to the borrower account.

Each month, at the end of the period, the bank goes through its collection of loans. For each loan, the bank computes the amount of the interest and debits the related deposit of this amount. For each due loan, the due amount is debited from the borrower deposit and the Loan object is cancelled.

Thus, each loan results in a creation of money and each repayment results in destruction of money12 .

Checks

The abstract class13 Check represents a written order to the bank to pay a stated sum. A Check object encapsulates an integer that represents an amount of the check. A Check object encapsulates an integer that represents an amount of the check. Un objet de type Cheque comprises an abstract method: transferTo().

Two concrete classes inherit from the abstract class check:

• A RegularCheck object represents a check from a non-bank agent;

• A BankCheck object represents a check from the bank.

The implementation of the method transferTo() depends on the type of the check :

• When one calls the method transferTo() of a RegularCheck, the amount of the check is credited to the account of the payee agent and simultaneously debited from the account of the drawer agent.

• When one calls the method transferTo() of a BankCheck, the amount of the check is credited to the account of the payee agent but no other account is debited.

Regular checks, allowing to transfer money from a deposit to an other, are the main means of payment used in the model. However, in this model, a deposit represents a debt of the bank to a non-bank agent. Since the bank cannot be indebted to itself, the bank cannot hold money14 and when the bank makes a payment it is never a transfer but a creation of money. For this reason, we have introduced bank checks in the model.

Markets

Markets by themselves are neither autonomous agents, nor objects subordinated to agents. Markets are the place where the different agents get in touch.

Agent-based techniques allow to model two different kinds of markets: centralized markets as considered in the Walrassian approach, or decentralized markets as in the real world. This is a fundamental concern when implementing an agent-based model of an economic system. [START_REF] Axtell | Multi-Agent Systems Macro: A Prospectus[END_REF] shows how assumptions of centralized markets which are the bases of general equilibrium theory lead to unrealistic conclusions.

"Walrasian markets in their Arrow-Debreu conception are an ideal type, in the terminology of the philosophy of science, a caricature of reality that abstracts from many details of real markets in order to provide a home for our intuitions and a point of departure for deeper exploration of market processes. Unfortunately, the embodiment of this ideal type in [computable general equilibrium] software, especially when utilised for policy purposes, institutionalises a series of propositions that more behaviourally realistic and decentralised models reveal to be false, namely, that markets do not disperse wealth, yield allocations that are determined solely by preferences and endowments and are not history-dependent." (Axtell 2005, p. 209) In this work, markets are modeled as places where agents meet in a direct and decentralized way15 . In a radical approach -following [START_REF] Gintis | The Emergence of a Price System from Decentralized Bilateral Exchange[END_REF] -the informations about the markets the agents can access are limited to a minimum. "Rather than using analytically tractable but empirically implausible adjustment mechanisms and informational assumptions (such as Walrasian tâtonnement and prices as public information), we treat the economy as complex system in which agents have extremely limited information, there is no aggregate price-adjustment mechanism institution, and out of equilibrium exchange occurs in every period [. . . ] Agents in this economy have no knowledge of excess demand or supply for any good. Nor is there an 'auctioneer' [START_REF] Walras | Elements of Pure Economics[END_REF] calling out prices, collecting information concerning aggregate demand, and dynamically 'correcting' the price structure, with the aim of moving the system towards market clearing." (Gintis 2006, p. 2-3)

Abstract market

The abstract class 16 Market represents a market, i.e. an institution that allows a collection of agents (offerors) to post offers and an other collection of agents (seekers) to reply to theses offers. We assume that markets proceed sequentially. At the sequence opening, offerors enter the market and make offers which associate a monetary amount to some real quantity. All offerers post their bids simultaneously and independently (they have no knowledge of the offers of their competitors).

The seekers enter the market successively in a random order. Each seeker consults a limited number of offers and selects the one which satisfies his objectives the most. The seeker deals directly with the selected offeror. After each transaction, the situations of the offerer and the seeker are considered. If the seeker is completely satisfied, or if the offeror has nothing left to offer, then they are removed from the market. The market sequence ends when one of the two lists (offerors and seekers) is exhausted. It is unlikely that both lists exhaust simultaneously: in most cases some agents remain unsatisfied.

In the current version of the model, this abstract definition of a prices prior to the occurence of the market, and no auctioneer announces prices on the market." (Duménil and Lévy 1991, p. 372) 16 See note 13, page 15.

market is used in two concrete cases described in the following subsections.

Goods market

The concrete class GoodsMarket represents the market for goods. It inherits methods and properties from the abstract Market class.

In the goods market, the set of firms constitutes the collection of offerors while the set of households constitutes the list of seekers. Firms enter the market as providers of goods. They offer a fixed quantity of goods at a fixed price. The price is freely determined by the firms before they post the bid: firms are price-makers. Thus, in a given time period, the number of different prices (although there is only one kind of good) may be as high as the total number of firms.

Households enter the market as purchasers of goods. Each consumer has a fixed budget17 that he intends to spend entirely. To that aim, he consults a limited number of offers randomly selected. The probability for an offer to be selected in this process is proportional to the volume of goods proposed in the offer18 . The consumer systematically choose the best price among the selected offers. He deals directly with the chosen provider and buys as many goods as possible within the limits of his budget and of the volume proposed in the offer. If the budget is exhausted by the deal, the consumer is removed from the list of seekers in the considered sequence of the market. If the volume offered is exhausted by the deal, the provider is removed from the collection of offerors. Then a new consumer enters the process and so on until either the total budget of all consumers or the total volume of goods offered by providers are exhausted.

Labor market

The concrete class LaborMarket represents the labor market. It inherits methods and properties from the abstract Market class.

We have seen that, in our model of abstract market, the offeror is the agent that posts an offer associating a price and a volume. Thus, on the labor market as on the goods market, the offerors are the firms.

In the labor market, the set of firms constitutes the collection of offerors while the set of households constitutes the list of seekers. Firms enter the market as employers. They offer a fixed number of jobs at a fixed wage. The wage offered is freely determined by the firms before they post the bid: firms are wage-makers. Thus, in a given time period, the number of different wages offered (although there is only one kind of job) may be as high as the total number of firms 19 .

Households enter the market as job seekers. Each job seeker decides of its reservation wage20 , i.e. the lowest wage which it will accepts a job. The job seeker examines a limited number of offers21 and selects the offer with the highest wage. If this wage is higher than its reservation wage, the job seeker is immediately recruited. If this wage is lower than its reservation wage, the job seeker refuses the job and remains jobless during the current period. Anyway, the jobseeker is removed from the list of job seekers and another is selected for executing the same procedure of job search. After each hiring, the employer updates its offer. When all vacancies are filled, the employer is removed from the list of employers.

The market is closed when one of the lists (employers or job seekers) is exhausted. If the list of employers is the first to be exhausted, this means that some job seekers will experience involuntary unemployment. If the list of job seekers is the first to be exhausted, this means that some employers will experience labor shortage.

Agents

The model contains three types of agents:

• the bank, which provides and manages the means of payment, and distributes dividends to its shareholder,

• the firms, which borrow money, employ workers, produce and sell goods, reimburse their credits, and distribute dividends;

• the households, which work, consume, and save.

Agents differ from real and monetary objects and from markets as they act in an autonomous way: they have their own goals and they make decisions in order to achieve them.

A general design for agents behavior

Starting from the notions of procedural rationality [START_REF] Simon | The Science of the artificial[END_REF] and reactive agent [START_REF] Ferber | Introduction aux concepts et méthodologies de conception multi-agents[END_REF] we can develop a simple and realistic scheme of the behavior of economic agents. This scheme is completely compatible with post-Keynesian analysis.

". . . we need only assume, in contrast to neoclassical theory, a very limited amount of rationality on the part of economic agents. Agents act on the basis of their budget constraints. Otherwise, the essential rationality principle is that of adjustment. Agents react to what they perceive as disequilibria, or to the disequilibria that they take note of, by making successive corrections. There is no need to assume optimization, perfect information, rational expectations, or generalized price-clearing mechanisms." (Lavoie and Godley 2001, p. 307-308) In such behavioral models, stocks and inventories have a double role: they make it possible to absorb shocks and they measure the degree of disequilibrium the agent has to control.

"It is inventories on the one hand, and money stocks on the other, which provide the essential flexible elements -the 'buffers' -which enable the whole system to function in a world of uncertainty (. . . ) This 'buffering' does not merely enable the system to function, it also generates a kind of auto pilot whereby unexpected (and unwanted) stocks of money and inventories result in a corrective mechanism which comes into play during subsequent periods." (Lavoie and Godley 2001, p. 292) On this basis, we define a set of guidelines for the modeling of the agents' behavior:

• At each point in time, the state of every agent is defined by a given number of numerical variables (state variables). All agents periodically adjust their behavior in order to reduce the gap (i.e. the disequilibrium) between the value of their state variables and the normal values for these variables.

• They maintain stocks (real or monetary ones) which they can use to cope with unexpected variations of their environment.

• Generally, they can act on the level of their stocks by increasing or reducing their consumption of the respective resource.

• If such direct action is not possible, they use an indirect way by acting on different variables which can have an influence on the level of their stocks. In that case, as they do not know the exact level of the required adjustment, they randomly decide whether to adjust their behavior or not and the level of the adjustment (within fixed bounds). The probability for an agent to decide to adjust his behavior increases when the disequilibrium is large (reaction to stress) and decreases when the level of the projected adjustment is high (conservative behavior).

Thus we build reactive agents who use procedures combining oriented search and trial and error methods. These procedures are very different from the Walrasian tâtonnement since agents do not have any information about the general (macroeconomic) state of the market and it is only through action that markets and market prices come into being. The model is always in disequilibrium:

"In contrast to neo-classical economics, the adjustment processes towards the steady state will be based on simple reaction functions to disequilibria. There will be no need to assume that firms maximize profit or that agents optimize some utility function, nor will be any need to assume that agents have perfect information or know perfectly how the macroeconomic system behaves. In other words, there is no need nor no room for the rational expectations hypothesis.

Still agents in our model are rational: they display a kind of procedural rationality, sometimes misleadingly called weak rationality or bounded rationality, or more appropriately named reasonable rationality. They set themselves norms and targets, and act in line with these and the expectations that they may hold about the future. These norms, held by agents, produce a kind of autopilot. Mistakes, or mistaken expectations, bring about piled-up (or depleted) stocksreal inventories, money balances, or wealth -that signal a required change in behavior." (Godley and Lavoie 2007, p 16)

Bank

In the model there is one bank represented by a Bank object. This object represents the whole banking system. It is essentially constituted by a list of accounts (Account objects) which are themselves made of a monetary deposit and a list of credits. Thus, the Bank object controls all credits and deposits contained in the model. Non-bank agents cannot manipulate directly credits and deposits: they have to pass orders to the bank.

Variables and parameters

As the unique representative of the whole banking system, the bank is -in the current version of the model -rather an institution in charge of managing the monetary sphere than a proper agent. The behavior of the bank is extremely simple and its scope of action is bound to maintain its capital at the normal level. The state of the bank is defined by two variables : the sum of the deposits of the non-bank agents (M B,t ) and the sum of the loans of the non-bank agents (L B,t ) (table 1, page 23),

The behavior of the bank is defined by a set of exogenous parameters representing normal values (table 2, page 23). The bank acts modifying the value of some variables that it controls directly (table 3, page 23).

Bank capital

The bank capital (K B,t ) is the excess of the total debt of the nonbanking sector over the total deposits of the non-banking sector. It represents the net worth of the bank.

L B,t Assets = M B,t Liabilities + K B,t Net Worth (3)
Lavoie emphasizes that the origin of the bank capital is twofold: "It includes the funds initially put up by the owners of the bank when starting business (how that initial fund came about is rather mysterious however), plus the retained earnings of the bank." (Lavoie 2000, p. 8) In the current version of the model, with a single bank that represents the whole banking sector, the entire bank capital is formed by the retained earnings of the bank. However, this capital is not money.

L B,t the total outstanding loans.

M B,t the total deposits.

Table 3: Control variables of the bank

Because we have defined the money supply as the total deposits of non-bank agents22 , the bank cannot hold money. In our model, the money is a debt for the bank, and the bank cannot be in debt to itself, thus the bank capital is not money. On the contrary, it is the share of bank profits that the owner of the bank cannot use as a means of payment:

"The own capital of the bank constitutes a liability to itself. It represents the funds which the firm owes to its owners. In general, the own funds play a role similar to deposits that would be in the hands of the owners. The own funds, just like the deposits or the credits, are an accounting entry, but in contrast to deposits, they cannot be drawn down by the owners." (Lavoie 2000, p. 8) Before to be available as money, bank profits must be distributed as dividends.

Dividends payment

The payment of dividends to the owner of the bank constitutes the first phase of the period. This phase takes place between the time (t + 0 7 ) and the time (t + 1 7 ) on the sequence diagram of the figure 1, page 6.

Step 1: Observation The bank calculates the level of capital targeted for the period (K * B,t ). This objective is proportional to the total assets of the bank.

K * B,t = κ * B L B,t (4)
The ratio (κ * B ) is an exogenous parameter, that represents the liquidity preference of the bank (Lavoie 2000, p. 8-9).

Step 2: Decision The bank examines the gap between the effective level of capital (K B,t+ 0 7

) and the targeted level (K * B,t ). If the effective level is lower than the targeted level, no dividend is distributed. If the effective level is higher than the targeted level, the bank decides to distribute a share (µ K B ) of the surplus as dividends (D B,t ).

Step 3: Implementation The dividend is paid with a bank check 23 . We have see that when a non-bank agent deposits a bank check object on its account, there is an equivalent creation of money.

Then the bank seems to be endowed with an unlimited power of money creation for the benefit of its owner. Nonetheless, this money creation is only possible within the limits of the bank capital (K B,t+ 0 7

). Indeed, when the bank pays a dividend (D B,t ), the sum is deposited on the account of the owner of the bank. Thus the total liabilities of the bank are increased, while the total assets of the bank remain unchanged.

M B,t+ 1 7 = M B,t+ 0 7 + D B,t (5)
L B,t+

1 7 = L B,t+ 0 7 (6)
Therefore, the bank capital is altered by this operation:

K B,t+ 1 7 = L B,t+ 1 7 -M B,t+ 1 7 = L B,t+ 0 7 -(M B,t+ 0 7 + D B,t ) = K B,t+ 0 7 -D B,t (7)
Thus, the dividends distributed by the bank are definitely debited from the bank capital. We have seen that the bank stops to distribute dividends if its capital is lower than a fraction of its total assets. Indeed, if the bank capital became negative -i.e. if the total liabilities exceeded the total assets -then the bank would be bankrupt and the simulation would break off. Consequently, the dividends distributed by the bank is always limited by the capital accumulated during the previous periods.

Production financing

This phase takes place between the time (t + 1 7 ) and the time (t + 2 7 ) of the period t. The new loans, destined to finance the production, are granted for a time period of d B months at the normal rate r B . When financing the production, the bank is fully accommodating: it satisfies the demand for credit by firms. The total amount of new credits (NL B,t ) does not depend on the willingness of the bank but on the financial needs of the firms and is not limited by the level of capital targeted by the bank: "[. . . ] at the very moment in time when a new loan has been granted, the bank is in a more risky position. This situation is however only a temporary one. For the larger stock of loans and deposits will allow the bank to rake up additional net interest revenues (unless the new loans are being defaulted in unusual proportions) [. . . ] These additional revenues, when they are due and integrated to the retained earnings, will thus bring the [asset to own funds] ratio back to its initial level. At the end of the year, the balance sheet of the bank has increased in size, but the liquidity preference of the bank may remain the same." (Lavoie 2000, p. 10) The total amount of new loans (NL B,t ) added to the total outstanding debt of non-bank agents is equal to the rise of total deposits of non-bank agents 24 .

L B,t+ 2 7 = L B,t+ 1 7 + NL B,t (8)
M B,t+

3 7 = M B,t+ 2 7 + NL B,t (9)
We easily show that this phase does not alter the capital of the bank. We observe that there is no budget constraint that limits the amount of new loans. In accordance with the endogenous money theory, "credits make deposits".

"An agent opening a bank deposit doesn't lose his own liquidity, since he is usually able to make use of his deposit as a means of payment at any moment and without notice. At the same time a bank, when making a new loan, is granting additional liquidity without subtracting any liquidity from any of its own depositors. therefor, as Hawtrey concluded, when a bank makes a loan to a customer, it is not transmitting liquidity from one agent to another one but creating new liquidity [. . . ] " (Graziani 2003, p. 82-83) 24 See the description of the Loan object, page 14.

Payment management

The next phases -from the time (t + 3 7 ) to the time (t + 5 7 ) of the period t -involve firms and households in the processes of production and consumption of goods. During these phases that involve real and monetary transactions, the bank just plays the role of a payment agent (payment of wages and consumption expenditures). In this role, the bank has no autonomy: it simply processes money transfers orders from non-bank agents, as long as their accounts have a positive balance.

Each time a non-bank agent directs a payment to another non-bank agent, its account is debited with the corresponding amount while the payee account is credited with the same amount. The total deposits is not altered by this operation and the bank capital remains unchanged.

Interest payment

At the end of the period, the bank attempts to obtain the interest payment on the debts. This phase takes place between the time (t + 5 7 ) and the time (t + 6 7 ) of the period t. For each outstanding loan, the bank calculates the interest due. The interest is directly debited from the borrower's account.

M B,t+ 6 7 = M B,t+ 5 7 -INT P B,t (11)
Thus the interest payment results in an equal reduction in the total liabilities of the bank.

When a debtor cannot pay the interest due, the bank is always accommodating: the unpaid interest due are added to the principal amount of the debtor debt, increasing the total assets of the bank.

L B,t+ 6 7 = L B,t+ 5 7 + INT NP B,t (12)
Either debited from the borrower's account or added to its outstanding debt, the interest increases immediately the capital of the bank.

K B,t+ 6 7 = L B,t+ 6 7 -M B,t+ 6 7 = (L B,t+ 5 7 + INT NP B,t ) -(M B,t+ 5 7 -INT P B,t ) = K B,t+ 5 7 + INT NP B,t + INT P B,t (13)

Repayment of loans

Then the bank attempts to recover the debts due. This phase takes place between the time (t + 6 7 ) and the time (t + 7 7 ) of the period t. Normally, the borrowers have enough money to repay the bank. As for the interest payment, the debt repayment process is initiated by the bank which debits the due amounts (RL B,t ) directly from the accounts of the borrowers. But as for the interest payment, sometimes some borrowers does not have enough money to repay the bank at the due date. In this case, the behavior of the bank depends on the quality of the loan: goodDebt: When a borrower is unable to repay at the due date d B a loan rated goodDebt, the bank automatically grants him more time: the credit term change from d B to dB ; the quality of the loan is downgraded to doubtfulDebt;

doubtfulDebt: At the end of each period, the bank attempts to recover, even partially, the loans rated doubtfulDebt without waiting the term. If at the term dB the borrower is unable to repay a loan rated doubtfulDebt, the bank reduces the borrower to bankruptcy.

On the asset side of the bank balance sheet, bankruptcies result in the cancellation of all debts (NPL B,t ) of the bankrupt agents.

M B,t+ 7 7 = M B,t+ 6 7 -RL B,t (14)
L B,t+

7 7 = L B,t+ 6 7 -RL B,t -NPL B,t (15)
While the normal repayment of loans (RL B,t ) does not alter the capital of the bank, the debt cancellation (NPL B,t ) results in an equivalent destruction of bank capital 25 .

K B,t+ 7 7 = L B,t+ 7 7 -M B,t+ 7 7 = (L B,t+ 6 7 -RL B,t -NPL B,t ) -(M B,t+ 6 7 -RL B,t ) = L B,t+ 6 7 -M B,t+ 6 7 -NPL B,t = K B,t+ 6 7 -NPL B,t (16)
25 "[The own funds] would be reduced whenever a borrower defaults on a loan. In that case, a similar amount would be deducted from the loan assets and the own funds liabilities when the bad loans need to be written off (i.e., when the accountants of the bank consider that the borrowers are unable to service the interest payments on their loan and are unable to ever pay back the loan)." (Lavoie 2000, p. 7) If K B,t+ 7 7 < 0, the bank capital is insufficient to cover the bankruptcy of the debtor and the bank itself goes bankrupt26 . Since in the current version of the model the bank is a unique bank that represents the whole banking sector, the crisis is systemic and the simulation breaks off.

Firms

A firm is represented by a Firm object. This object is essentially composed of Factory object, i.e. a collection of machines27 , and a Payroll object, i.e. a list of employees together with their labor contract.

In each period, a firm decides about its production plan and asks the bank to finance this plan. The firm takes on labor, pays wages, produces and offers its production on the market of goods. It repays the debts due and pays a share of its profits to its owner.

Most of these actions require non-trivial decisions28 :

• How much to produce?

• What price to charge?

• What wage to offer?

• How much profits to retain for production financing and how much distribute?

The behavior of the firms is modeled as a sequence of simple adjustment procedures. The state of a given firm is defined by a set of variables (table 4 page 30). The firm compares the value of some of these variables with a set of normal values shared by all the firms of the sector which are exogenous parameters (table 5 page 31). Depending on the gap between these state variables and the normal values, the firm adjusts its control variables (table 6 page 31) upward or downward.

in fi i,t
the volume of inventory of the firm (finished goods only).

IN i,t the total value of inventories of the firm (finished and unfinished goods).

pr i,t the average monthly production of the firm at full capacity utilization (equal to the sum of the monthly productivities p k of the machines owned by the firm).

ρ i,t the job vacancy rate on the last three months.

w i,t the effective workforce (the number of workers employed by the firm).

ŵi,t the workforce required at full capacity utilization (equal to the number of machines owned by the firm).

M i,t the available balance of the firm (equal to the amount of money on its bank account).

L i,t the debt of the firm. λ F the ratio marketing capacity to production capacity.

Table 5: Normal (exogenous) values of the firms sector

w * i,t
the level of production decided (the number of posts).

W i,t the wage offered.

P i,t the price offered.

sa * i,t
the quantity of commodities offered.

D i,t the amount of the dividends to pay to the owner.

Table 6: Control variables of the firm i

Dividends payment

For a firm, the payment of the dividends to its owner constitutes the first phase of the period. This phase takes place between the time (t + 1 7 ) and the time (t + 2 7 ) on the sequence diagram of the figure 1, page 6.

We define a procedure based on the adjustment principle, the payment of the dividend (D i,t ) enabling to control the level of capital of the firm.

Step 1 : Observation The firm begins by calculating the amount of its own capital -formed by the earnings retained during the previous periods. The value of its inventory of finished and unfinished goods (IN i,t+ 1

7

) is accounted on the assets side of the balance sheet of the firm, together with the value of its money deposit at the bank (M i,t+ 1 7

). The value of the debt (L i,t+ 1 7

) and the own capital (K i,t+ 1 7 ) are accounted on the liabilities side of the balance sheet of the firm.

IN i,t+ 1 7 + M i,t+ 1 7 Assets = L i,t+ 1 7 + K i,t+ 1 7
Liabilities and owner's equity

Thus:

K i,t+ 1 7 = IN i,t+ 1 7 + M i,t+ 1 7 -L i,t+ 1 7 (18)
Then the firm determines the own capital targeted for the period (K * i,t ). This target is proportional to the total assets.

K * i,t = κ * F (IN i,t+ 1 7 + M i,t+ 1 7 ) (19)
Step 2 : Proposition The firm examines the gap between the effective level of own capital (K i,t+ 1 7

) and the targeted level (K * i,t ). If the effective level is lower than the targeted level, no dividend is distributed. If the effective level is higher than the targeted level, the accounting department of the firm proposes to distribute a share (µ K F ) of the surplus as dividends ( Di,t ).

Di,t = 0 si K i,t+ 1 7 -K * i,t ≤ 0, µ K F (K i,t+ 1 7 -K * i,t ) sinon. ( 20
)
Step 3 : Decision The firm accepts the proposition of the accounting department, under the limit of the amount of money available on its account at this time (M i,t+ 1

7

).

D i,t = Di,t if Di,t ≤ M i,t+ 1 7 M i,t+ 1 7 else. ( 21
)
Step 4 : Payment The dividend is paid by a check.

M i,t+ 2 7 = M i,t+ 1 7 -D i,t (22)
The dividend paid is debited from the own capital of the firm.

K i,t+ 2 7 = IN i,t+ 2 7 + M i,t+ 2 7 -L i,t+ 2 7 = IN i,t+ 1 7 + (M i,t+ 1 7 -D i,t ) -L i,t+ 1 7 = (IN i,t+ 1 7 + M i,t+ 1 7 -L i,t+ 1 7 ) -D i,t = K i,t+ 1 7 -D i,t (23)

Production and employ determination

Then the firms have to decide about their level of production. This phase takes place between the time (t + 1 7 ) and the time (t + 2 7 ) of the period.

Because of the complexity of the system and because of the agents' uncertainty with regard to the future the firms do not have any information about the general supply and demand conditions they are facing.

"When the decision to produce is made, demand on the next market is, in fact, unknown. A classical-inspired construction would have agents estimate demand using the knowledge of disequilibrium in the present." (Duménil and Lévy 1987, p. 142) Moreover, because the market economy is decentralized, we have decided that firms cannot have access to any information on the previous states of the aggregate supply and demand 29 . The firm has to build its own representation of the current state of the supply and the demand from its personal experience. Because inventories are used as buffers to damp unexpected disequilibria between supply and demand at the firm level, their state plays an essential role in the production decision 30 . "This difference between supply and demand is equal, for accounting reasons, to the size of the new stock of inventories. In a decentralised economy, each enterprise is ignorant of the general industrial situation concerning supply and demand. Therefore, the degree of stockpiling, as experienced by individual sellers in the movement of their own inventories, is one of the best indicators of disequilibrium." (Duménil and Lévy 1987, p. 137) Each firm determines its level of production by deciding the workforce to employ. We define a procedure based upon the principle of adjustment31 : the number of employees targeted (w * i,t ) is determined

• an endogenous uncertainty, resulting from the complexity of the economy modeled, that forbids the access to future data (individual or aggregated),

• an exogenous uncertainty, resulting from our radical approach of market economies, that prohibits the access to past or present aggregated data.

The prohibition of access to past or present aggregated data is only a working hypothesis that we can drop at anytime, while the impossibility of access to future individual or aggregated data is an essential property of the model. 30 See [START_REF] Godley | Monetary economics, An Integrated Approach to Credit, Money, Income, Production and Wealth[END_REF]:

"Firms hold a buffer of finished goods, which can be called upon whenever demand exceeds production. Sales are always equal to demand because it is assumed that inventories are always large enough to absorb any discrepancy between production and demand. In this approach it is necessary to track the evolution of inventories from period to period, and to pay meticulous attention to the way in which they are measured, in particular to how they are valued." (Godley and Lavoie 2007, p. 64-65) See also [START_REF] Cyert | A Behavioral Theory of The Firm[END_REF]:

"In most models of ouput determination, we introduce expectations with respect to future sales and relate output to such predictions. Our studies indicates, to the contrary, that organizations use only gross expectations about future sales in the output decision. They may, and frequently do, forecast sales and develop some long-run production plans on paper, but the actual production decisions are more frequently dominated by day-to-day and weekto-week feedback data from inventory, recent sales, and sales staff." (Cyert and March 2003, p. 167) by an upward or downward variation (δ w i,t ) of the previous number of employees targeted (w * i,t-1 ).

Step 1: Observation The department of production of the firm calculates the normal level of inventories (i.e. the quantity of finished goods in * i,t ). This level is a multiple of the average production of the firm at the full capacity of production.

in * i,t = in * F . pr i,t (24)
This normal level is compared to the effective level of the inventories (finished goods) observed at this time (in fi i,t+ 2

7

).

Step 2: Proposition If the production department detects a dis-

equilibrium (if in * i,t = in fi i,t+ 2

7

) it proposes to the firm management an adjustment of the employed workforce ( δw i,t ). To determine the orientation of the adjustment, the firm considers the gap between the effective level of inventories at this time and the normal level of inventories (in

fi i,t+ 2 7 -in * i,t
). An effective level that is lower than the normal level is interpreted as a sign of excess demand and leads the production department to put forward a rise in the level of employment. Conversely an effective level that is higher than the normal level is interpreted as a sign of excess supply and leads the production department to put forward a cut in the level of employment. The scale of the adjustment is chosen at random in the interval [0, ν w F ].

δw i,t = αν w F if in fi i,t+ 2 7 -in * i,t < 0, -αν w F else. (25)
The variable α is a random variable determined at each use on a uniform distribution over the interval [0, 1].

Step 3: Decision The production department submits its proposition of adjustment to the firm management, which accepts or rejects it.

δ w i,t =      δw i,t si αβ < in fi i,t+ 2 7 -in * i,t in * i,t , 0 sinon. ( 26
)
The variable β is a random variable determined at each use on a uniform distribution over the interval [0, 1]. One can see that the higher α is high -i.e. the more significant is the proposed adjustment -the higher is the probability for the adjustment to be rejected is high. Conversely, more the disequilibrium observed is high, more the probability for the adjustment to be accepted is high.

Step 4: Adjustment of the target The firm adjusts its target of workforce (w * i,t ), within the limits of the interval [0, ŵi,t ] defined by the production capacity of the firm.

w * i,t =      0 if (1 + δ w i,t )w * i,t-1 < 0, ŵi,t if (1 + δ w i,t )w * i,t-1 > ŵi,t , (1 + δ w i,t )w * i,t-1 else. ( 27
)
Step 5: Implementation When its workforce target (w * i,t ) is determined, the firm compares this target with the effective number of employees at this time (w i,t+ 2 7

). If a workforce surplus is detected

(if w * i,t < w i,t+ 2 7
), the firm lays off the excess employees immediately; then the most recently hired workers are the first laid off ("Last in first out"). On the contrary, if the firm observes a lack of workforce (if

w * i,t > w i,t+ 2 7
), the firm will have to hire new workers.

Pricing

Immediately after the determination of the level of production -but still between the time (t + 2 7 ) and the time (t + 3 7 ) of the period t -each firm determines the price level at which the product will be offered on the goods market.

According to Lavoie (2004, p. 44), all post-Keynesian models are based upon the principle of prices determined by cost-plus pricing. Deliberately, we move away on this point from post-Keynesian models for defining a procedure more closer to the classical framework: "In the classical framework, price adjustments follow the observation of actual disequilibrium between supply and demand (to a degree which varies according to circumstances, as mentioned by Smith in the above quotation) on markets which do not clear." (Duménil and Lévy 1987, p. 137) So, as for the determination of the level of production, the firms base their pricing decision on the observation of the level of inventories32 .

We define a procedure based on the adjustment principle: the new price (P i,t ) is determined by an upward or downward variation (δ P i,t ) of the previous price (P i,t-1 ).

Step 1: Observation As for the procedure of determination of the production level, the price department measure the gap between the effective level of its inventory of finished goods(in fi i,t+ 2

7

) and the normal level (in * i,t ).

Step 2: Proposition If a disequilibrium is detected, an adjustment of the price ( δP i,t ) is proposed. An effective level lower than the normal level is interpreted as the sign of the excess of demand over supply and leads the price department to put forward a rise in the price. Inversely an effective level higher than the normal level is interpreted as a sign of the excess of supply over demand and leads the price department to put forward a cut in the price. The scale of the adjustment is chosen at random in the interval [0, ν

P F ]. δP i,t = αν P F if in fi i,t+ 2 7 -in * i,t < 0, -αν P F else. (28)
The variable α is a random variable determined at each use on a uniform distribution over the interval [0, 1].

Step 3: Decision The price department submits its proposition of adjustment to the firm management, which accepts or rejects it.

δ P i,t =      δP i,t if αβ < in fi i,t+ 2 7 -in * i,t in * i,t , 0 else. (29)
The variable β is a random variable determined at each use on a uniform distribution over the interval [0, 1].

Step 4: Adjustment of the price Then the firm adjusts its price.

P i,t = (1 + δ P i,t )P i,t-1 (30)
The new price is the price at which the product will be offered on the goods market during the sales phase.

Wage determination

Then each firm determines the wage it will offer on the labor market. We define a procedure based on the adjustment principle: the new wage offered is determined by an upward or downward variation (δ W i,t ) of the previous price (W i,t-1 ). The adjustment of the wage is eventually limited by the legal minimum wage ( WF ).

Step 1: Observation The human resources manager of the firm begins by calculating the rate of vacancies observed during the last 4 previous months (ρ i,t ). Then it measure the gap between this rate and the normal rate of vacancies (ρ * F ).

Step 2: Proposition If a disequilibrium is detected, an adjustment of the wage offered ( δW i,t ) is proposed. An effective level lower than the normal level is interpreted as a sign of excess demand of jobs over and leads the human resources manager to put forward a cut in the wage offered. Conversely an effective level higher than the normal level is interpreted as a sign of excess supply of jobs and leads the human resources manager to put forward a cut in the wage offered. The scale of the adjustment is chosen at random in the interval

[-ν Wdown F , 0] (downward adjustment) or in the interval [0, ν Wup F ] (up- ward adjustment). δW i,t = -αν Wdown F if ρ i,t -ρ * F < 0, αν Wup F else. ( 31
)
The variable α is a random variable determined at each use on a uniform distribution over the interval [0, 1].

Step 3: Decision The human resources manager submits its proposition of adjustment to the firm management, which accepts or rejects it.

δ W i,t = δW i,t if αβ < ρ i,t -ρ * F ρ * F , 0 else. ( 32
)
The variable β is a random variable determined at each use on a uniform distribution over the interval [0, 1].

Step 4: Adjustment of wages Then the firm adjusts the wage offered, within the limit fixed by the legal minimum wage ( WF ).

W i,t = (1 + δ W i,t )W i,t-1 if (1 + δ W i,t )W i,t-1 > WF , WF else. ( 33
)
The new wage is the wage at which the vacancies will be offered on the labor market during the recruitment phase.

Borrowing

Then the firms have to finance the production process. This phase constitutes the transition between the state (t+ 2 7 ) and the state (t+ 3 7 ) of the model.

Since the wage offered is now determined, the accounting manager of the firm can estimate the wage bill (WB * i,t ) it will pay if all vacancies are filled. The accounting manager compares this estimation with its available balance (M i,t+ 2

7

) to calculate its need for external financing (NL * i,t ). If the available balance is higher than the anticipated wage bill then the firm does not need external financing. On the contrary, if the available balance is lower than the anticipated wage bill then the firm seeks external financing.

NL * i,t = 0 if M i,t+ 2 7 ≥ WB * i,t , WB * i,t -M i,t+ 2 7 else. ( 34
)
We have seen 33 that the bank is, in this circumstance, fully accommodating: it grants a new loan for an amount (NL i,t ) equal to the need of financing expressed by the firm.

NL i,t = NL * i,t (35)
L i,t+ 3 7 = L i,t+ 2 7 + NL i,t (36)
33 See the description of the behavior of the bank when financing the production, page 25.

The available balance of the firm is increased by the new loan.

M i,t+ 3 7 = M i,t+ 2 7 + NL i,t (37)
Nonetheless, the own capital of the firm remains unchanged.

K i,t+ 3 7 = IN i,t+ 3 7 + M i,t+ 3 7 -L i,t+ 3 7 = IN i,t+ 2 7 + (M i,t+ 2 7 + NL i,t ) -(L i,t+ 2 7 + NL i,t ) = IN i,t+ 2 7 + M i,t+ 2 7 -L i,t+ 2 7 = K i,t+ 2 7
(38)

Workforce recruitment

The firm has now money available to pay the targeted workforce (w * i,t ). If the number of workers effectively employed is lower than the targeted workforce, the firm tries to recruit new workers. In this case, the firm posts on the labor market an offer stating the number of vacancies (equal to w * i,t -w i,t+

) and the wage offered (W i,t ). The firm hires the households who respond to its offer, in order of arrival. If the number of applicants is lower than the number of jobs offered, some jobs remain unfilled 34 .

Each hire results in a specific labor contract that attaches the employee to the firm. The duration of the contract is selected at random in the interval d w F . The wage is the wage offered (W i,t ) and is fixed the contract duration. The contract can be breached at any time by the firm if it decides to reduce the level of production.

Production

When the workforce is recruited, the firm can pass to the phase of production. This phase constitutes the transition between the state (t + 3 7 ) and the state (t + 4 7 ) of the model. This phase begins with the payment of wages to the workers employed by the firm 35 . The firm traverses the list of its employees (a Payroll object) and gives to each employee a check over the contracted amount. The sum of these checks forms the total wage bill of the period (WB i,t ).

M i,t+ 4 7 = M i,t+ 3 7 -WB i,t (39)
As the firm has calculated its need of external finance in order to cover exactly the cost of the workforce for the current period, its available balance after the payment of the wage bill is normally equal to zero. However, it is possible that the firm does not reach its recruitment target; in this case, the money reserved to the payment of the lacking workers remains unused on the firm account.

In return for the wages the firm consumes the labor power of its employees in the process of production. The firm transfers the payroll to its factory, the factory employs these workers on the machines and the production process progresses36 .

Because production takes time, the product is not available immediately -it is an unfinished good. The product exits the factory under the form of a volume of finished goods only at the end of a process that takes several periods37 . Thus the payment of the wage bill (WB i,t ) results in an increase of the value of the unfinished goods inventory (IN un i,t ). If one ore more production processes come to the end, there is production of some quantity of finished goods, i.e. of commodities. The volume of the commodities produced (y i,t ) is determined by the productivity of the machines used while the value of the commodities produced (Y i,t ) is equal to the sum of the wages paid for the progress of the related processes of production. The finished goods produced in the period are added to the inventory of the firm, to the commodities produced during the previous periods but still unsold.

in fi i,t+ 4 7 = in fi i,t+ 3 7 + y i,t (40)
IN fi i,t+ 4 7 = IN fi i,t+ 3 7 + Y i,t (41)
The value of the inventory of unfinished goods (IN un i,t ) undergoes two opposite movements: it is increased by the payment of wages (WB i,t )

• As the firm uses its inventory to damp variation of production and demand, it never sells more then a fraction of the available volume of commodities (in fi i,t+ 4

7

).

• The marketing capacity of a firm is limited to a multiple (λ F ) of its production capacity ( pr i,t ).

The volume of commodities that the firm offers on the goods market (sa * i,t ) is defined by these two constraints.

sa * i,t = µ in F in fi i,t+ 4 7 if µ in F in fi i,t+ 4 7 < λ F pr i,t , λ F pr i,t else. ( 45
)
The firm posts its offer on the goods market 38 . This offer contains two informations: the volume of goods offered (sa * i,t ) and the unit price (P i,t ). In return for this offer, customers (households) express a demand for some quantity of goods. The firm satisfies all these demands in the limit of the volume offered (sa * i,t ) and deposits the cheques received in payment.

The effective volume of sales (sa i,t ) -possibly lower to the volume offered sa * i,t -determines the new state of the inventory of commodities (in fi i,t+ 5 7 ).

in fi i,t+ 5 7 = in fi i,t+ 4 7 -sa i,t (46)
The value of commodities in inventory (in fi i,t+ 5

7

) is reduced in proportion of the reduction of the volume of this inventory.

IN fi

i,t+ ).

M i,t+ 5 7 = M i,t+ 4 7 + sa i,t P i,t (48)
The capital of the firm undergoes two opposite and simultaneous movements: the first is negative and caused by the diminution of the value 38 See the description of the goods market, page 18.

of the inventory while the second is positive and caused by the augmentation of the available balance.

K i,t+

While the phase of production results in a transformation of moneycapital into commodity-capital, the phase of sales results in an inverse transformation of commodity-capital in money-capital. However, because there is no reason to the proceeds of the sales to be equal to the value of the commodities sold, the firm capital undergoes a change between the time (t + 4 7 ) and the time (t + 5 7 ). This change constitutes the total profit (or the loss) of the firm in the period (F T i,t ).

F T i,t = K i,t+
In order for the firm to realize profits, the unit price (P i,t ) must be higher than the unit cost of the commodities sold (UC i,t+ 4

7

).

UC i,t+

It may happen that the firm has not enough money to pay back the loan at the due date. We have see that in a such case the bank is always accommodating. However, the loan quality is then downgraded, with the consequence that the firm cannot distribute dividends until this debt is totally paid back 40 . Finally, if a firm is unable to pay back a loan rated doubtfulDebt at the due date, it is declared bankrupt by the bank. Then the firm disappears, together with its debt, its machinery, and its inventories.

The possibility of firm exit leads to the question of firm entry. Indeed, in the current simplified version of the model, there is no endogenous mechanism of new firm creation from the willingness of the agents. Thus, the bankruptcies lead necessarily to a progressive and irreversible reduction of the number of firms with the progress of the simulations. That is the reason why, each time a firm exits the simulation, a similar firm (same number of machines, same productivity) is created 12 months later. So we are sure that the number of firms present in the model is a constant on the long term.

Households

A household is represented by a Household object. Each household is endowed with a LaborPower object that represents its labor power 41 .

40 Indeed, we have seen that the bank tries to obtain the reimbursement of a loan rated doubtfulDebt at each end of period, without waiting the term. Consequently, all possible profits realized by the firm are allocated first to the reimbursement of the loan and until the loan is totally paid back, no money is available on the account of the firm at the beginning of the period, at the time to distribute dividends.

41 See the description of the laborPower object, page 11.

In each time period, jobless households search for a job on the labor market. Employed households receive a wage and spend their labor force onto the machines of their employer. Subsequently, the households expend a share of their available balance in the purchase of commodities on the goods market. In a period, each household has to make a decision about two questions:

• What lowest wage it would accept?

• How much to spend on the goods market and how much to save?

As for the firms, the behavior of the households is modeled as a sequence of simple adjustment procedures. The state of a given household is defined by a set of variables (table 7, page 47). The household compares the value of some of these variables with a set of normal values shared by all households which are given as exogenous parameters (table 7, page 47). Depending on the gap between these state variables and the normal values, the household adjusts its control variables (table 9 page 48) upward or downward. D j,t the dividend received by the household for the period.

W j,t the wage received by the household for the period. Y a j,t the annual income, i.e. the total of the incomes (wages et dividends) received during the last 12 months. S j,t the liquid savings of the household.

M j,t the available balance of the houshold.

d u j,t
the number of consecutive periods without job.

Table 7: State variables of the household j

Dividend payments

Each firm and the bank is owned by a household. These households are selected at random, at the beginning of the simulation, to represent the owners of each firm and of the bank. They will remain the owner of their firm for the whole existence of this firm and, in the case of the bank, for the full length of the simulation. the consumption target.

Table 9: Control variables of the household j

An owner of a firm or of the bank distinguishes itself from other households as it receives, at the beginning of the period, a dividend paid by the firm or the bank. This phase takes place between the time (t + 0 7 ) and the time (t + 2 7 ) of the period. This dividend (D j,t ) makes up into the income of the houshold. It takes the form of a check that the household deposits immediately on its account.

M j,t+

2 7 = M j,t+ 0 7 + D j,t (60)

Reservation wage and job search

Between the time (t + 3 7 ) and the time (t + 4 7 ) of the period, the households have to update their reservation wage (W * j,t ), i.e. the lowest wage at which they will accept a job. The length of unemployment of the household (d u j,t ) plays a central role in the procedure of adjustment of the reservation wage 42 . 42 In the current version of the model, unemployed households do not get any assistance or benefit. If we introduce unemployment benefits in a new version of the model, the we will have to modify the procedure of adjustment of the reservation wage to take into account the level of these benefits. We will also have to complete this behavior for taking

Step 1: Observation The household begins by examining its situation. If the household is employed, its reservation wage is defined as the last wage received.

W * j,t = W j,t-1 (61)
An employed household does not search for a job and the procedure terminates.

If the household is jobless, it calculates the length of unemployment (d u j,t ), i.e. the number of periods since its last job.

Step 2: Decision The jobless household then decides to maintain its reservation wage or to adjust it downward. The decision of adjustment depends on the length of unemployment (d u j,t ) and on the household resistance (d r H ). The scale of the adjustment is chosen at random in the interval [0, ν W

* H ]. δ W * j,t = βν W * H if α < d u j,t d r H , 0 else. (62)
The variables α and β are random variables determined at each use on a uniform distribution over the interval [0, 1]. We see that the probability of an adjustment rises with the unemployment length.

Step 3: Adjustment of the reservation wage In the case of a positive decision, the household adjusts downward its reservation wage (W * j,t ).

W * j,t = (1 -δ W * j,t )W * j,t-1 (63)
The variable α is a random variable determined at each use on a uniform distribution over the interval [0, 1].

Step 4: Job search Each jobless household is registered on the labor market 43 . A jobless household consults a limited number of job offers, selected at random in the list of offers posted by employers on the labor market. The household chooses from this selection the offer with the highest wage. If this wage is higher or equal to its reservation into account the level of available balance of the household (precautionary saving).

43 See the description of the labor market, page 18.

wage, the household accepts the job and is immediately hired 44 , else it refuses the job and remains jobless in this period.

The recruitment of a household by a firm results in a labor contract that specifies the amount of the wage and the contract duration. The wage is the wage offered by the firm on the labor market. The duration of the contract is selected at random. A household never leaves a job at its own initiative 45 . However, it can be fired at any time if the employer decides to reduce the level of the production.

Work

After the job search phase, but still between the time (t + 3 7 ) and the time (t + 4 7 ) of the period, the employed households have to work for their employers.

Each employed household receives the wage (W j,t ) specified in its job contract as a check that it deposits immediately on its bank account.

M j,t+ 4 7 = M j,t+ 3 7

+ W j,t (64)
In return for this wage 46 , the household supplies its labor power to the firm, which consumes it in the production process 47 .

Saving and consumption

The next phase of the period -between the time (t + 4 7 ) and the time (t + 5 7 ) -is dedicated to household consumption and saving. Each household has to determine its spending target (C * j,t ). We assume that the households try to maintain a "normal" level of con- 44 We have seen that the firm accepts all applicants, in the limit of its vacancies. See the description of the recruitment procedure by the firms, page 40. 45 In the current version of the model, the behavior of the households is very simple, with a perfectly loyal behavior of workers. This behavior can be complexified in a future version by integrating "voice" and "exit" behaviors inspired from the work of [START_REF] Hirschman | Exit, Voice, and Loyalty: Responses to Decline in Firms, Organizations, and States[END_REF].

46 If one tries to make a household work while this household has not been paid in the period, then an error is generated and the simulation breaks off. This usually never happens, since the firms make sure that all wages are paid before making their employees work. But the encapsulation of this control within the Household object guarantees that no one works for free in the modeled economy, independently from the implementation of the behavior of the firms.

47 See the section dedicated to the objects of the real sphere, page 9.

sumption: each household sets aside a precautionary reserve to smooth consumption in the future if the income drops 48 .

Step 1: Observation The household begins by calculating its saving target (S * j,t ), proportional to the income of the last 12 months (Y a j,t ).

S * j,t = s H Y a j,t (65)
Then the household calculates its effective saving (S j,t+ 4 7

), i.e. its available balance (M j,t+ 4 7

) minus its average monthly income calculated on the 12 last months. Step 2: Decision The household compares its effective saving (S j,t+ 4 7

) to its target (S * j,t ). If the effective saving is lower than the target, it decides to spend only a fraction of its average monthly income. Else, it decides to spend the total of its average monthly income, plus a fraction (µ S H ) of the excess saving. -S * j,t ) else.

(67)

Step 3: Spending Then the household goes to the goods market where it attempts to realize its consumption target with a limited number of providers 49 . Two factors can frustrate the household and limit its effective spending (C j,t ).

48 These savings are deposited on the current account of the household, on which the bank pays no interest. It is true that if the household is the owner of a firm or of the bank, then its total savings include not only money deposit but also the capital of the owned firm or of the bank. Nonetheless, in the current version of the model, for the sake of simplicity, the household behavior does not take into account the capital owned and only the liquid saving is considered. Consequently, although the saving behavior is defined in the same way for a jobless household, for an employed household, and for a rentier household, the effective rate of savings of the rentiers will be very higher than those of other households on average.

49 See the section devoted to the goods market, page 18.

First, the available balance can be lower than the consumption target (M j,t+ 4 7 < C * j,t ). As in the current version the model, the households have no access to the credit, the spending cannot be higher than the available balance.

Second, shortage situations can sometimes occur on the goods market, then some households cannot spend the totality of their budget.

The household pays its purchases with checks on its bank account. The commodity bought is immediately consumed (it disappears). The effective saving of the household is equal to the available balance after the consumption.

M j,t+

Conclusion

As stated by [START_REF] Cohen | Simulation of the Firm[END_REF], the computer frees us from the limits of the traditional mathematical tools and allows to model macroeconomies as complex dynamic systems with a high level of realism.

"The main advantage of using computer simulation as a tool in economics is to provide a concrete procedure for formulating and testing hypotheses. A frequent objection raised against traditional mathematical models of economic systems is that these models are too unrealistic for their intended purposes. This is often true, because adding realism requires adding complexity as well. Since traditional mathematical models are intended for analytical solution, their complexity and realism must be severely limited. Computer models, however, can be made as complex and realistic as our theories permit, for analytical solutions to these models are unnecessary. No matter how complicated the formulation of the model, simulation techniques enable us to trace the consequences inherent in it. Hence, microeconomic theories can be cast into precise models without distortion of the meaning embodied in these theories, and the description of the world implied by such theories can be readily determined." (Cohen 1960, p. 2) For a long time, the project of Cohen seemed idealistic. But now, with the growing capacity of computers and the development of high level programming languages like Java, it appears not only feasible, but highly desirable. So, following the bottom-up approach, we have put in place, all the software components that our project requires. We started by building the simplest objects, representing real and monetary objects from the real world. Then we have constructed the markets, not as singular agents in charge of the system equilibrium, but as passive institutions, simple places where agents establish direct relationships. Finally, we have developed the three types of agents that populate the model. We have designed these agents as simple automats endowed with some autonomy, thanks to a set of adjustment procedures. All these elementary components are the models of objects or agents of the real word. Thus the resulting macroeconomic model is designed as a model populated with numerous interacting models.

Within this model based only on simple and realistic assumptions about agents, one can carry out several macroeconomic experimentations leading to the emergence of macroproperties and macrobehaviors unobservable within classical models based on the representative agent framework (Seppecher 2010a[START_REF] Seppecher | Entreprises adaptatives, détermination des prix et répartition du revenu dans un modèle macroéconomique multiagents avec monnaie endogène[END_REF][START_REF] Seppecher | Entreprises adaptatives, détermination des prix et répartition du revenu dans un modèle macroéconomique multiagents avec monnaie endogène[END_REF]. For this reason, we consider that the model provides the core around which it could be feasible to develop models more complex and highly realistic for a wide range of applications.

Figure 1 :

 1 Figure 1: Sequence diagram of monetary flows

FFigure 2 :

 2 Figure 2: Interaction diagram, real and monetary flows

d

  B the normal term of a loan. dB the maximal term of a loan. κ * B the normal capital adequacy ratio.

  distribute the excess of capital. Table 2: Normal values (exogenous) of the bank K * B,t the capital stock targeted. D B,t the dividend paid to the bank owner.

FF

  the monthly maximal flexibility of the price of goods. ν w F the monthly maximal flexibility of the level of production, as a percentage of the full capacity utilisation. the propensity to offer for sale the commodities in inventory.

  flexibility of the reservation wage.

  spend the excess of savings.

Table 1 :

 1 State variables of the bank r B the normal interest rate.

r B the penalty rate.

Table 4 :

 4 State variables of the firm i

	d w F	the labour contract lenght.
	κ * F	the normal capital to asset ratio.
	in * F	the normal level of inventory (finished goods), as un
		number of periods of production at full capacity utiliza-
		tion.
	ρ * F	the normal ratio of vacancies.
	WF	the legal minimum wage.

Table 8 :

 8 Normal (exogenous) values of the households sector

	W * j,t	the reservation wage.
	S * j,t	the saving target.
	C * j,t

The interested reader will find in[START_REF] Seppecher | Entreprises adaptatives, détermination des prix et répartition du revenu dans un modèle macroéconomique multiagents avec monnaie endogène[END_REF] a description (in French) of a first version of this model. This model is implemented as a Java application (Jamel ). This application, together with several scenarios, is executable on the webpage http://hp.gredeg.cnrs.fr/Pascal_Seppecher/jamel/index.php.

We follow here[START_REF] Epstein | Agent-Based Computational Models And Generative Social Science[END_REF] and[START_REF] Tesfatsion | Agent-Based Computational Economics[END_REF].

See LeBourva (1959, p. 721).

"The quasi resolution of conflict, uncertainty avoidance, problemistic search, and organizational learning are central phenomena with which our models must deal. On our judgment, the natural theoritical language for describing a process involving these phenomena is the language of a computer program."(Cyert and March 1963, p. 125)

This usually never happens, because a firm does not call an employed more than one time by period. But if, by an error of programming, a firm try to call an employed twice, the existence of this control will detect and block this violation of real sphere rules. So, we are certain that each household can expend its labor power only once in a period. We see that the data encapsulation within objects allows to model real constraints independently from the implementation of the agents. As in the real world, this constraints are outside of the agents.

In the current version of the model, processes of production consume no raw material, nor energy.

See Keynes (1923[START_REF] Keynes | The collected writings of John Maynard Keynes[END_REF]):

This hypothesis, justified only by the decreasing abstraction method, and destined to be relaxed as soon as possible.

Usually, an agent never goes to an expenditure without making sure that the required sum is available on its account. Such an interruption of the simulation is a priori impossible but the existence of this control guarantees that each agent complies with its monetary constraint, independently from its implementation: an error of programming cannot lead to an undue creation of money.

In the current version of the model, the firms are the only agents to borrow. Nonetheless, nothing in the implementation of the monetary sphere stands in the way of the construction of a model in which households (or other agents of another type) could also have access to bank credit.

See page 25.

In oriented-object programming, an abstract class is a class of objects that cannot be instantiated, because its implementation is incomplete. An abstract class specifies common (abstract) methods that are to be implemented by specialized (concrete) descendent classes.

See page 22.

See also[START_REF] Duménil | The dynamics of competition: a restoration of the classical analysis[END_REF]: "We call this generalized adjustment in the modeling of the behavior of economic agents "Disequilibrium Microeconomics." In this framework, the services of the auctioneer are not required. No agent computes any equilibrium

We will see later how households fix the budget they intend to use for buying consumption goods (see page 50).

 18 Weighted roulette wheel selection, see[START_REF] Chinneck | Heuristics for Discrete Search: Genetic Algorithms and Simulated Annealing[END_REF].

An other consequence is that several levels of wage coexist generally in one firm, depending of the date of recruitment of the workers.

We will see (page 48) how households determine this reservation wage.

The offers examined are selected at random using the roulette wheel procedure: the probability for an offer to be selected is proportional to the number of jobs offered.

See the description of the Deposit object, page 14.

See the description of the BankCheck object, page 15.

"When there is too large a proportion of bad loans, own funds, i.e., the net worth of the bank, can become negative, in which case the bank becomes insolvent."(Lavoie 2000, p. 7)

See the description the Factory object, page 12.

See Godley and Lavoie (2007, p. 2): "Rejecting as chimerical the concept of the neoclassical production function, post-Keynesians hold that, in an uncertain world, firms, operating under conditions of imperfect competition and increasing returns, must decide how much to produce and how many workers to employ, what prices to charge, how much to invest, and how to obtain finance."

The description of the markets, page 16. Thus there is two levels of uncertainty in the model:

See the description of the general design of the agent behavior, page 20.

We drop this hypothesis inSeppecher (2010b) and[START_REF] Seppecher | Entreprises adaptatives, détermination des prix et répartition du revenu dans un modèle macroéconomique multiagents avec monnaie endogène[END_REF].

See the description of the labor market, page 18.

The firm has to pay the workers before employing them on machines because households refuse to work if they do not perceive a wage in the current period. See the note 46, page 50.

See the description of the objects of the real sphere, page 9.

However, because several production processes are normally in progress with different advancements the act to produce and the availability of the product seems generally simultaneous. On the other hand, when there is a change in the level of production, the duration of the production cycle by a delay in the change of the production of finished goods.

and reduced by the value of the commodities produced.

The value of the commodities produced (Y i,t ) does not affect the total value of the inventories of the firm (IN t+ 4 7

), but is simply transferred from the inventory of unfinished goods to the inventory of finished goods.

Thus, the increase of the total value of inventories during the production phase is equal to the wage bill (WB i,t ). The payment of the wage bill in the production process results for the capital of the firm in two opposite movements which exactly offset each other.

Thus, the capital of the firm remains a constant during the production phase, but we observe a change in its composition with a transfer of value from the money-form to the commodity-form for an amount equal to the wage bill.

Sales

When the production phase is finished, the firm attempts to sell the product on the goods market. This phase constitutes the transition between the state (t + 4 7 ) and the state (t + 5 7 ) of the model. We suppose that the firm tries to sell the maximum of goods with two constraints:

= sa i,t ϕ i,t UC i,t+ 4 7

(53)

Payment of interest

After the goods market has closed, the firm has to pay the interests to the bank. This phase constitutes the transition between the state (t + 5 7 ) and the state (t + 6 7 ) of the model. The bank debits directly the amount of interest payment (INT i,t ) from the account of the firm 39 . The firm has no autonomy in this phase.

We have seen that when a debtor agent is unable to pay the interest due, the bank is always accommodating. In such a case, the debt of the firm is simply increased by the amount of the unpaid interest

No matter if the interest is debited from the account of the firm or if its effective payment is delayed, the corresponding amount is immediately deducted from the capital of the firm.

Repayment of loans and bankruptcies

Next, the firm has to pay back the loans due (RL i,t ). This phase takes place between the time (t + 6 7 ) and the time (t + 7 7 ) of the period t. Again, the firm has no autonomy and the bank debits directly the amount due from account of the firm.

39 See the description of the payment of the interest from the point of view of the bank, page 27.