NetLogo User Community Models
David Ricardo (1772-1823) and Karl Marx (1818-1883) in an agent-based model? What blasphemy!
Maybe not. The model is a tool to reason about the consequences of their thoughts on *machines*.
### David Ricardo
(1821). [*On the Principles of Political Economy and Taxation*](https://www.econlib.org/library/Ricardo/ricP.html). London: John Murray, third edition (first edition: 1817). From the [Chapter 31, On Machinery](https://www.econlib.org/library/Ricardo/ricP.html?chapter_num=32#book-reader):
(rif.31.3) *These were my opinions, and they continue unaltered, as far as regards the landlord and the capitalist; but I am convinced, that the substitution of machinery for human labour, is often very injurious to the interests of the class of labourers.*
(rif.31.4) *My mistake arose from the supposition, that whenever the net income of a society increased, its gross income would also increase; I now, however, see reason to be satisfied that the one fund, from which landlords and capitalists derive their revenue, may increase, while the other, that upon which the labouring class mainly depend, may diminish, and therefore it follows, if I am right, that the same cause which may increase the net revenue of the country, may at the same time render the population redundant, and deteriorate the condition of the labourer.*
(rif.31.25) *The statements which I have made will not, I hope, lead to the inference that machinery should not be encouraged. To elucidate the principle, I have been supposing, that improved machinery is suddenly discovered, and extensively used; but the truth is, that these discoveries are gradual, and rather operate in determining the employment of the capital which is saved and accumulated, than in diverting capital from its actual employment.*
An in-depth and updated analysis of Ricardo's thought is in [Hollander (2019)](http://www.aeaweb.org/articles?id=10.1257/jep.33.2.229).
**A comment: in our eyes, the problem lies in the loss of gradualism, with the acceleration of change, and quality of change through artificial intelligence.**
### Karl Marx
(1857-8) *Grundrisse der Kritik der politischen Ökonomie or Fundamentals of Political Economy Criticism*
*(…) once adopted into the production process of capital, the means of labour passes through different metamorphoses, whose culmination is the machine, or rather, an automatic system of machinery (system of machinery: the automatic one is merely its most complete, most adequate form, and alone transforms machinery into a system), set in motion by an automaton, a moving power that moves itself; this automaton consisting of numerous mechanical and intellectual organs, so that the workers themselves are cast merely as its conscious linkages.*
*In no way does the machine appear as the individual worker's means of labour. Its distinguishing characteristic is not in the least, as with the means of labour, to transmit the worker's activity to the object; this activity, rather, is posited in such a way that it merely transmits the machine's work, the machine's action, on to the raw material -- supervises it and guards against interruptions.*
But in Karl Marx & Friedrich Engels, (1845-6), [*The German Ideology*](https://www.marxists.org/archive/marx/works/download/Marx_The_German_Ideology.pdf):
*For as soon as the distribution of labour comes into being, each man has a particular, exclusive sphere of activity, which is forced upon him and from which he cannot escape. He is a hunter, a fisherman, a herdsman, or a critical critic, and must remain so if he does not want to lose his means of livelihood; while in communist society, where nobody has one exclusive sphere of activity but each can become accomplished in any branch he wishes, society regulates the general production and thus makes it possible for me to do one thing today and another tomorrow, to hunt in the morning, fish in the afternoon, rear cattle in the evening, criticise after dinner, just as I have a mind, without ever becoming hunter, fisherman, herdsman or critic.*
**A comment again: apparently, benefits are coming from the machines, but with increasingly poorer workers.**
### Our experience
Our centuries-old experience shows that machines have replaced workers, but meanwhile, new products and activities have occupied more workers. Why worry?
The difference lies in the extraordinary acceleration of the change process. Artificial Intelligence (AI) will allow us to replace workers at all levels, while the "reserve" of human needs to be fulfilled will be more and more limited. The least developed countries will have a very different development path if compared to the experience of the richer countries but, with the acceleration of the change process, will encounter the same problems.
### Why a simulation model?
The idea is that of offering a tool helping us in *thought experiment* where we try to substitute the workers with simple robots or with sophisticated artificial intelligences. We have to reason about production, investments, income, consumptions simultaneously.
I have written the model paying attention to its understandability, and I also hope of having been capable of offering a simple structure, allowing modifications and addenda.
I hope to stimulate everyone contributions to attain a larger simulation model about the economies of the future.
Why to contribute? Look at the [stone soup](https://www.extremelinux.info/stonesoup/stonesoup.html) story.
## WHAT IS IT?
Using our (your) choice of essential parameters, the model generates (i) a sequence of production steps of items less or more complex; (ii) consumptions; (iii) profits; (iv) investments with makers substitutions.
Hit the button **setup** and then that marked **continuous** (or that marked **single step**): the simulation starts.
## A QUICK PRESENTATION OF THE MODEL
We introduce a production model with makers as workers, robots, and AIs (Artificial Intelligences, as very complex and powerful robots). In every tick, the workers are also consumers, choosing the cheapest assets, and buying it if they have a sufficient disposable income, coming from their wages. Their wages are the costs that the entrepreneurs change on the products.
Similarly, also robots and AIs generate costs to be charged on the products.
Workers, robots, and AIs have different costs and different productivities.
The entrepreneurs have a gross disposable income, also considering the expenses to cover multiannual costs, coming from the difference between the price of sold goods and the related costs.
They buy both cheap goods, for consumptions, and the most expensive ones, to make investments.
With the investments, they replace workers with robots or AIs. The investment process works only if the model runs in the long term way.
A maker, in each tick, has a given probability of starting a new product; the number of makers, acting in sequence, necessary to create a product originates from its complexity.
We can imagine products with complexity zero and price zero, as productive residues.
## HOW THE MODEL WORKS
First of all, let us define the *time unit*, conventionally a *tick* in NetLogo jargon: within a tick each *maker* (a maker can be a worker, blue; a robot, red; an AI unit, green) acts once or more; she/it can also be idle.
The following subtitles are also procedure calls in the **go** procedure (activated by the **continuous** or by **single step**the buttons). The calls occur in this sequence in each *time unit* (*tick*).
The number of production actions is related to the *probStartingAProd* value (probability of starting the production of a new unit of a given commodity) and to the complexity level of the product (*meanProductComplexity*, stating the mean of a Poisson-distributed random integer value, representing the number of steps that a given commodity requires for its production).
Goods under production can bounce among the makers in the same tick: this is why a maker can act more than once in a time unit. In this version of the model, makers have no specializations; we can introduce this feature later (see below EXTENDING THE MODEL).
We mimic the production sequence showing the links left by the goods under production while bouncing among their makers. The links have the same color as the maker from which the product is coming.
*produce* calls two other procedures for each maker:
With probability *probStartingAProd*, the procedure starts a new product as an action of a specific maker, setting the related complexity as a random realization of a [Poisson distribution](https://en.wikipedia.org/wiki/Poisson_distribution) with mean *meanProductComplexity*.
We calculate the *price* of the product multiplying its complexity (the number of production steps) by the *pricePerStep*, as set in the interface.
The procedure interacts with the makers in random order. For each maker, it chooses one of the products in the local queue of items under development, if any. Then it calculates the number of executions of the recipe (1) steps. This number comes from the maker productivity (input boxes in the interface: *workerProductivity*, *robotProductivity*, *AIProductivity*).
The procedure also calculate the increse of the cost of the product. It uses one of the values in the interface: *workerCost*, *robotCost*, *AICost*; these costs are variable ones, we account for them only if the maker is active. If the maker is a worker, her cost is also her wage.
Then, the procedure moves this product to one of the other makers, randomly. If we equal the complexity level (step number) of the product, the procedure heere below immediately removes it.
A simple procedure that detetcts the finished products, when their productive sequence matches their complexity. This procedure also deletes links left on screen by the specific item production flow.
The product will move to the upper right corner, waiting for consumers.
The procedure asks each worker (being the more significant part of the consumers in the model), to buy the cheaper unsold finished product. The workers, acting in random order, buy if their *disposableIncome*, coming from the sum of the wages, is higher than the price of the product.
We subtract the price from the *disposableIncome* of the buyer, and we add the difference between price and cost to the *currentProfits* value. The profits are related to entrepreneurs as a whole.
In the next step, the procedure asks the unemployeds, if any, to buy the cheaper unsold finished product. The unemployeds, acting in random order, buy if their *disposableIncome*, coming from the sum of the *unemploymentCompensation* received by tick, is higher than the price of the product. As above, we subtract the price from the *disposableIncome* of the unemployed. Then we add the difference between price and cost to the *currentProfits* value.
As a final step, the procedure calculates the *entrepreneurBuyingProb* multiplying the *entrepreneursRelativeBuyingRate* (set in the interface) times the workers buying frequency per tick (time step).
Why? It is a way to avoid excessive implausible consumptions of the entrepreneurs.
Now, we apply the consumption calculation to the entrepreneurs, but using their *disposableGrossProfits*, coming from the profits, see below, instead of the *disposableIncome* (worker case).
### prepareInvestments (*if longTerm*)
This step works if we put **longTerm** to **on** in the interface (using the web version, if we flag the box **longTerm**).
To prepare the accumulation of assets necessary to aggregate a robot or an AI (*investmentProvisions*), the procedure order to the entrepreneurs to buy a product, choosing the more expensive one into the ist of the unsold items.
The operation succeeds if the *disposableGrossProfits* of the entrepreneur is higher than the price of the product. Second condition: the quantity *investmentProvisions* of the entrepreneur is less than the threshold setting the maximum accumulation (*invProvisionsT*).
The procedure: (i) adds the difference between price and cost of the product to *currentProfits*; (ii) decreases the *disposableGrossProfits* of the entrepreneur by the amount of the price (charging this expense, related to a multiannual fix cost, immediately); (iii) increases the *investmentProvisions* total of the entrepreneur by the price of the item she buys.
### invest (if *longTerm*)
This step works if we put **longTerm** to **on** in the interface (using the web version, flag the box **longTerm**).
Each entrepreneur, when has accumulated a quantity assets sufficient to aggregate a robot or an AI (the thresholds, in the interface, are *newRobotThreshold* or *newAIThreshold*), uses the required part of her *investmentProvisions* to assemble a robot or an AI that will substitute a worker at random (procedures *turnWorkerRobot* or *turnWorkerAI* where, after each substitution, we add a new unemployed).
We have an *investmentProb*, i.e., the probability of checking if to invest in a tick. Then, we have to decide if we are looking for a new AI, comparing a random (0,1] value with the *investInAI?* rate. If not AI, we will search to aggregate a robot. In both cases, we need a quantity of assets higher than the robot or AI thresholds.
In each unit of time, or *tick*, the procedure asks the unemployeds to add the individual *unemploymentCompensation* (>= 0, set in the interface) to their *disposableIncome*.
The second step in each tick: the procedure calculates the *totalUnemployedCompensations* of the specific time interval.
Here we delete the sold products, mainly to accelerate execution (shorter lists) and to clean memory.
The last operation has no economic effect; instead, the next one as a substantial economic effect.
We also delete the unsold product if they are older than the *productIdleSurvivalTime* (all products are in some way perishable, for economic or technical reasons); in this case, we subtract the costs of the lost products from profits.
First of all, the procedure deduces *totalUnemploydCompensations* from the *currentProfits*.
Then the procedure updates *profits* (the total, for all the entrepreneurs) adding *currentProfits*, which can also be a negative value.
As a second step, the procedure updates the *disposableGrossProfits* of each entrepreneur, subdividing the *currentProfits* in equal parts.
## HOW TO USE IT
The simulation runs on a web page, but if you want to execute it locally (mainly, for speediness reasons) download the program from the top-right button "NetLogo." To run it, you need to install the NetLogo shell, from http://ccl.northwestern.edu/netlogo/
On the top left zone of the interface we have a chooser, named ***settings***.
Some (suggested) possibilities are:
* **80 workers 20 robots, short t.**
* **80 workers 20 AIs, short t.**
* **60 workers 40 AIs, short t.**
* **60 workers 10 AIs, short t.**
* **60 workers 40 AIs, low prices, short t.**
* **80 workers 20 robots, AI pref., 0.0 unemplC., long t.**
* **80 workers 20 robots, AI pref., 0.005 unemplC., long t.**
* **80 workers 20 AIs, AI pref., 0.0 unemplC., long t.**
* **80 workers 20 AIs, AI pref., 0.005 unemplC., long t.**
* **80 ws., 10 robs., 10 AIs, AI pref., 0.005 uC., long t.**
* **80 ws., 10 robs., 10 AIs, rob. pref., 0.005 uC., long t.**
* **80 ws., 10 robs., 10 AIs, rob. pref., 0.005 uC., low p., long t.**
Choose a predefined configuration, then hit **setup** and then **continuous** (or, to observe the model tick per tick, **one step**).
Use "none" configuration to set the parameters on your own but also to repeat a predefined configuration without changing its parameters, but with a different random sequence. [Technicality: the seed of the random numbers is always the same using a preset configuration; with "none" it is generated by NetLogo. The NetLogo User Manual reports that "If you don't set the random seed yourself, NetLogo sets it to a value based on the current date and time."]
## THINGS TO NOTICE
Comparing the predefined short term setting you can verify the following dynamics.
* Case 1) **80 workers 20 robots, short t.**
Increasing profits and stable workers' income.
* Case 2) **80 workers 20 AIs, short t.**
Quite low profits and stable workers' income.
* Case 3) **60 workers 40 AIs, short t.**
Falling profits and stable (low) workers' income.
* Case 4) **60 workers 10 AIs, short t.**
Increasing profits and stable (medium) workers' income.
* Case 5) **60 workers 40 AIs, low prices, short t.**
Stable profits and increasing workers' income.
Not so obvious framework emerging ...
In the long term perspective ...
* Case 6) **80 workers 20 robots, AI pref., 0.0 unemplC., long t.**
* Case 7) **80 workers 20 robots, AI pref., 0.005 unemplC., long t.**
* Case 8) **80 workers 20 AIs, AI pref., 0.0 unemplC., long t.**
* Case 9) **80 workers 20 AIs, AI pref., 0.005 unemplC., long t.**
* Case 10) **80 ws., 10 robs., 10 AIs, AI pref., 0.005 uC., long t.**
* Case 11) **80 ws., 10 robs., 10 AIs, rob. pref., 0.005 uC., long t.**
* Case 12) **80 ws., 10 robs., 10 AIs, rob. pref., 0.005 uC., low p., long t.**
An interesting framework is emerging, sensitive to initial conditions.
## THINGS TO TRY
Search for new combinations in maker numbers and parameter values (moving sliders, switches, etc.) within the model.
In case, set the chooser ***settings*** as **none**.
## EXTENDING THE MODEL
Always in the spirit of the [stone soup](https://www.extremelinux.info/stonesoup/stonesoup.html) story, please feel free to modify the model.
* AIs can substitute robots when no more workers are active as makers;
* producers reduce production without demand;
* introduce a whole population with workers, and not active people (partially looking for work, so unemployed) to explore different solutions of unemployment compensation and must of all the role of a basic income policy;
* add specialized capabilities to the makers, with differentiated step in the production recipes (1) of each product;
* use investments also to replace the tools used by the workers, if any, increasing their productivity (and wage?);
* introduce the development of new products, e.g., increasing the *probStartingAProd* in successive steps of the time.
## RELATED MODELS
A production model, useful to reason on the construction and the effects of the *production recipes*, already exists as a project within Pietro Terna's [SLAPP](https://terna.github.io/SLAPP/) simulation shell.
(1) A recipe is [a complete description of a production process](https://www.santafe.edu/research/results/working-papers/the-production-recipes-approach-to-modeling-techno).
## COPYRIGHT AND LICENSE
![CC BY-NC-SA 3.0](http://ccl.northwestern.edu/images/creativecommons/byncsa.png)
This work is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License. To view a copy of this license, visit https://creativecommons.org/licenses/by-nc-sa/3.0/ or send a letter to Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA.
(back to the NetLogo User Community Models)