Pages

Recent Posts

Thursday, December 28, 2017

The "Blank Slate" Problem For Agent-Based Models

I have taken a stab at building up an agent-based simulator over the holidays. The state of progress would look rather unimpressive, but that is about what I expected. The difficulty with building a complex software package is that it needs to be set up in a way that it can be continuously tested. Unfortunately, the structure used requires a fair amount of software plumbing to be put in place. Once the framework is set up, we then run into the steepest problem: it is very hard to define behaviour for agents without other agents already in the model (the economy is a "blank slate"). Once we have minimal set of agents, it will be a lot easier to develop new behaviour, as the new agents will have an existing set of relative prices to work with.

The decision to use a client-server architecture generates a fair amount of programming overhead. The system simulation is divided into two distinct components.

The server keeps tracks of the "laws of physics" for the simulation: the inventory of each agent, the state of buy/sell orders on the market, and production functions.

The clients communicate with the server, and handle all decision-making. The decisions will include sending orders to the markets, and undertaking production decisions.

Since the simulator all runs within a single process, the client-server design presumably looks somewhat loopy. However, testing in a multi-process environment is a pain, so I will not add in network communications until later. Building the framework to cleanly handle both networked and non-networked modes was the biggest challenge I dealt with in the design so far.

The key advantage of the client-server architecture is flexibility. Each client (an agent) can be designed completely independently from other agents as well as the server. All that is required is that it interacts with other agents using the rules set by the server. Another advantage of the client-server design is that it would be possible for others to build components in other computer languages if so desired.

No Mathematical Model!

One of the side effects of the design is that we do not really have a mathematical model of the simulation (other than observing that it is implemented on a digital computer). The clients and server communicate via text messages that require parsing, and each will have to build out its own internal representation of the model.

From the server's perspective, the system state is just the physical inventories of the agents, their cash balances, and the existing set of orders on exchanges. It will also track some transaction history, so that agents can use that information in their decision making.

However, that state information tells us very little about the behaviour of the simulation. We need to augment it with the state of the client decision-making processes. The server will know nothing about that information.

This could distress some of an academic bent. There is no mathematical model to work with, and no way to prove anything about behaviour. If you wanted to develop a mathematical model of the simulation, you would actually need to abstract away the simulation details and come up with a reduced form version of the simulation behaviour -- just like simulating real-world economies.

This is intentional. If we force the state information to take a certain form, we are effectively forcing the agents to follow certain rules of behaviour. This limits the flexibility of the simulation, and we do not know whether any behavioural patterns are the result of the simplifying assumptions, or agent behaviour. As a classic example, take the "equilibrium" assumption of mainstream economics. That assumption has locked mainstream models into a theoretical dead end, and makes it extremely difficult to relate economic models to actual behaviour.

State of the Simulator

The client-server architecture does not do a lot at present; it covers the transmission of the system time as well as the bulk of exchange order processing.

Although transmitting the simulation time sounds laughably easy to do, there are hidden difficulties. The simulator is expected to run in real-time mode, with clock time corresponding to simulation time (with an acceleration factor). The clients may be running on different machines than the server. Meanwhile, there are events that will be associated with particular simulation times, such as the end of a production process. Therefore, the handling of time is trickier than it would be in a straight mathematical model.

The exchange order handling is largely done; I just want to add a feature that prevents agents from trying to sell more of a commodity than they have in inventory. (Buying too much is less of an issue; I think it should be possible to have an automated reaction by the exchange for dealing with over-levered agents.)

The main remaining server components are the production functions as well as shipping commodities between exchanges. These should be actually very straightforward to implement. The production functions will be a set of possible operations to produce commodities using commodity inputs (as discussed further below).

After that, almost all work would be on client behaviour.

The Blank Slate Problem

When the simulation starts up, there are no orders on the exchanges. An agent might to make decisions in the complete absence of any external pricing information. How is supposed to do that?

This is exactly the same problem that bedevils mainstream macroeconomic models. It is possible to pin down the relative price between wages and the one (composite) commodity, but there is nothing to pin down the initial price level.

One possible approach is to "seed" initial price information by making design decisions. It is extremely likely that this will result in wildly different outcomes depending on the initial seed values. However, we would have to force certain agents to insert bids and offers into the exchange at initialisation. Those agents might immediately withdraw those orders, leaving the simulation without any market prices once again.

Another approach is to be neo-Chartalist, and have the government set at least some initial prices by making bids at arbitrary prices. The government is able and willing to leave those bids in place, and so provides an initial pool of pricing information that private agents can use for decision-making.

(The labour market will be aggregated, and wages will be sticky. Once it is implemented, the labour market might do a very good job of pinning down an initial price level.)

Capital is a Commodity

Everything in the simulation is a commodity, and traded on markets -- including capital. (This might make Sraffians happy.) The objective is to eliminate non-arms length transactions between agents (firms). (The labour and retail markets would be added later, and act in an aggregated fashion, and outside the exchange system.)

As a side effect, capital is permanent; it is assumed to be maintained to be "good as new" at all times. (It would be possible to de-construct capital goods to provide raw materials if there is a glut of capital; this would be another option in the menu of production function choices.)

Otherwise, we would need to set prices for used capital goods (that have a limited life span). The question is why any firm would offer a non-negligible price for such goods. The main reason an agent would try selling capital goods is that they are facing liquidity constraints; why bail them out with a reasonable bid for what they are selling?

Who Needs Land, Anyway?

One of the complaints raised by some heterodox economists is that standard models ignore land; they want land, capital, and labour as being the base factors of production.

The simulation side-steps the issue by having the backstory of being set in space. In space, land is not a factor of production.

The Financial System

The decision to make everything exchange-based makes the financial system a lot easier to handle. We just assume that the exchanges are government-backed, and that agents are allowed to incur margin debt based on the market value of their inventories. The "money" in the system is the agent's cash balance at the exchange, which would normally be expected to be negative (borrowing against inventory, including capital).

Adding a banking system poses a great many issues. Banking is a non-arm's length business, and it is unclear how to set it up. One possible system is a keiretsu (or chaebol) where banks are embedded within a grouping of industrial firms. Firms would be expected to deal with their captive bank, and the bank would also interact with the aggregated household sector following simple rules.

The architecture of the system allows multiple currencies, but that is unlikely to be implemented for some time.

Concluding Remarks

After the holidays, I will probably get back to working on a report on inflation-linked bonds. However, I hope to have put together the core server systems of the agent-based simulator, so that I can start puttering around with agent behaviour when I am bored.

5 comments:

If you are looking for agents- Can I be an agent in your model? I can provide a relevant set of relative prices for the goods and services I consume. Usually. I went to a hospital recently though, and apparently their prices have little to do with relevance or reality or whatever, but we could skip that part if you like.

Since the idea is that the simulator also functions as a video game, you in fact could function as an agent...

Actually, I am right now acting as an agent as part of building up the simulator functionality. I need to send queries to the server, so that I can build out the server response function. Once the server is functioning, I can try building AI agents.

My functionality has always been debatable (as have my responses been). No one has ever suggested I had AI though (or really much natural type intelligence either). I would probably be a really bad and atypical agent anyways. I respectfully withdraw my request because any economic model based on my particular behavior would be fairly dysfunctional.

Sounds great. Something I have pondered is that given a such framework it is possible to test agents that optimize and creates equilibrium and also rule of thumb agent environments. That would be cool!

As a somewhat related note: how do you plan agents to value assets and trade them in the basic system? Should it work differently than goods market? I think valuing assets is a difficult part. Do you think there are other ways than following the rules of microeconomics on this front?

In the simple case where all the agents are homogeneous they will all price assets in the same way. I think that will tame down the cycles as there cannot be neither herding nor, I think, debt driven bubbles?

The clients can attempt to do whatever they want. In real time mode, they need to keep up with the simulation, but if we are in “academic mode”, they could take as long as they want.

Since the idea is that everything is on an exchange, financial assets would go there. If I attempted it, I would go with various government bonds. No problem for coming up with valuation rules...

Within the real economy, agents should not be homogeneous, as that would result in every agent being a vertically-integrated conglomerate. They could completely ignore market prices for anything other than final outputs. It could be done, but the simulation would feel very strange.

In financial markets, if everyone had the same valuation rules, prices would stick near fair value, and just move back and forth as agents hit bids/offers. (Things would blow up if everyone followed trend-folloeing strategies.) This is reasonable for Treasury bills, but would look strange for equities. It would be easy to take the valuation strategies used by investors, and stick them into clients.

Until the real economy behaviour is fleshed out, equity markets would be fairly bizarre, since there is nothing to pin down valuation limits. That’s well in the future, since I am still working on getting orders to work.

Note: Posts may be moderated, and there may be a considerable delay before they appear.

Although I welcome people who disagree with me, please be civil.

Please note that my spam comment filter appears to dislike long "anonymous" posts. I get no warning about this, and only go through my "spambox" infrequently. The best bet it to keep comments short, and if you think the spam filter struck, let me know with a short comment.

Contact Form

Subscribe To

Navigation

Disclaimer

See my "Disclaimer" page for my privacy policy as well as advertising affiliate information. This blog contains general discussions of economic and financial market trends for a general audience. These are not investment recommendations tailored to the particular needs of an investor. The author may discuss strategies which are wildly inappropriate for retail investors. Any mention of corporate securities are for illustrative purposes only; the author does not make recommendations to buy or sell such securities (and frankly, has no expertise to do so). No warranties are made with regards to the correctness of data or analysis, and some data may be under copyright protection of the original data provider. Past performance is not a predicton of future performance (which should make some bond bulls fairly nervous).