The Trade Network Game Laboratory:
Demonstration Software

Combining Game Theory with Matching Theory

Last Updated: 17 March 2024

Site Maintained By:
Leigh Tesfatsion
Professor Emerita of Economics
Courtesy Research Professor of
    Electrical & Computer Engineering
Heady Hall 260
Iowa State University
Ames, Iowa 50011-1054
tesfatsi AT

ACE Website
ACE Software and Toolkits
ACE Interactive Demos
TNGLab Network Animation Screen Shot

TNGLab Overview

As carefully explained in Ref. [1], below, the Trade Network Game (TNG) is a framework for studying the endogenous formation and evolution of trade networks among strategically interacting traders (Buyers, Sellers, and Dealers) operating under variously specified market protocols. The TNG blends and extends standard matching theory and sequential game theory in that each trader must jointly determine over time both whom to seek trades with (partner selection) and how to behave in any trade interactions that take place (strategy selection).

More precisely, in the TNG, successive generations of resource-constrained traders choose and refuse trade partners on the basis of continually updated expected utility. This partner-seeking process requires the traders to talk back and forth with each other at event-triggered times. Once trade partners are determined, the partners engage in bilateral trade interactions modeled as 2-person games. The traders use genetic algorithm learning to evolve their trading strategies over time based on outcomes from their past trade interactions.

The TNG permits the resulting trade outcomes to be studied at four different levels: trader attributes (endogenous evolution of personality types); trade network formation (who is trading with whom, and with what regularity); expressed trade behavior (cooperative, predacious,...); and individual and social welfare measures (market efficiency, market power, individual utility levels,...).

Each TNG trader in a bilateral trade can either play C (cooperate) or D (defect). The TNG GUI Settings Screen permits the user to specify arbitrary payoffs for the four situations a trader could find himself in as a result of a bilateral trade: CC (Both Cooperate); DD (Both Defect); DC (Temptation, i.e. the trader defects against a cooperating partner); and CD (Sucker, i.e. the trader is cooperating but his partner defects against him).

Thus, the user can specify any two-player game to represent bilateral trade (stage-game play) for the TNG. These two-player games include Prisoner's Dilemma, Dead Lock, Chicken, Stag-Hunt, and Battle of the Sexes. For definitions and analysis of these two-player games, see Ref. [2], below.

At the start of each TNG experiment, each TNG trader is assigned a totally random strategy for engaging in iterated bilateral trades an indefinite number of times. The trader types then separately evolve their trade strategies over time using genetic algorithm (GA) learning. In particular, Buyer strategies are updated via a GA applied to the population of Buyers, Seller strategies are updated via a second GA applied to the population of Sellers, and Dealer strategies are updated via a third GA applied to the population of Dealers.

The TNG is divided into a total of GMax generations. Each generation, in turn, is divided into a total of IMax trade cycles. During each trade cycle, the TNG traders engage in three activities: matching (determination of trade partners); bilateral trades (game interactions); and updating (revision of expected utility assessments associated with potential trade partners).

At the end of each generation (i.e. at the end of each trade loop consisting of IMax trade cycles), the TNG traders use GA learning to update their trade strategies based on the net payoffs they accrued during this generation. The Total Net Payoff (TNP) earned by a trader during any generation G includes the sum of all of his trade payoffs (positive and negative) plus the sum of all of his (non-positive) refusal payoffs. A trader suffers a refusal payoff R any time one of his trade offers is refused by another trader; the non-positive level of the refusal payoff R is set by the user in the TNGLab GUI Settings Screen. The utility (or fitness) of each TNG trader in any generation G is measured by his average payoff per trade cycle, i.e., by TNP/IMax.

The TNG has been implemented in C++ with the support of SimBioSys, a C++ class framework for general evolutionary simulations. TNG/SimBioSys has further been incorporated into a modular extensible computational laboratory, referred to as the TNGLab, which is targeted for the Microsoft Windows desktop. The TNGLab has an easily operated GUI that can be used to run TNG experiments for research and teaching purposes. A description of all of the parameters whose values can be set by users via the TNGLab GUI Settings Screen is given in Ref. [3], below.

Trade network formation, trader behaviors, and trader welfare outcomes for each TNGLab run can be visualized during the run by means of run-time network animations and run-time chart and data table displays available through Results, Chart, and Animation Screens at the TNGLab GUI.

The run-time network animations make use of an underlying spring/coil physics to visualize trader interactions over time. Roughly summarized, non-transient interactions between a pair of traders A and B are visualized by means of a line connecting A and B. Dashed lines denote intermittent interactions, and solid lines denote persistent (continual) interactions. Moreover, the length of the line connecting A and B at any given time is inversely related to the frequency of their past transactions. These simple rules permit beautiful run-time visualizations of intricate trade network formations.

Detailed outputs for each TNGLab run are also automatically recorded and saved in a file called tng.out. This file should be in the TNGLab directory automatically created during installation, with default location under "Program Files." One thing that users have to be careful about is that the output file tng.out is overwritten with each new run. Consequently, in order to save the output in tng.out from a particular run, the contents of tng.out must be copied over into a differently named file.

The remaining sections of this TNGLab Home Page provide: (a) annotated pointers to sites where the TNGLab (with automatic installation program) and TNG/SimBioSys (source code) can be obtained as open-source freeware under the terms of an artistic license agreement; (b) annotated pointers to TNGLab Manuals and Tutorials; and (c) annotated pointers to research that has been conducted using the TNGLab and TNG/SimBioSys.

Overview References:

[1] David McFadzean, Deron Stewart, and Leigh Tesfatsion, "A Computational Laboratory for Evolutionary Trade Networks" (pdf,508KB), IEEE Transactions on Evolutionary Computation, Volume 5, Number 5, October 2001.

Note: This article constitutes the main manual for the TNGLab.

[2] Leigh Tesfatsion, "Game Theory: Basic Concepts and Terminology" (pdf,317KB)

[3] Leigh Tesfatsion, "TNGLab Parameter Guide" (pdf,19KB).

Note: This guide gives explanations and illustrative settings for the TNGLab parameter values that can be entered by users on the Settings Screen accessible through the TNGLab Graphical User Interface (GUI). The admissible range of values for each TNGLab parameter is also indicated.

TNGLab Demo/Developer Software Downloads

Software Release Disclaimer:
All software provided below is unsupported and provided as-is, without warranty of any kind. It is released as open-source freeware by the copyright holders (D. McFadzean, D. Stewart, and L. Tesfatsion) under the terms of the Artistic License Agreement.

Possible Need for OCX File:
Occasionally people attempting to install the TNG Lab on a local computer have reported receiving an error message saying they are missing a file called "comdlg32.ocx". If you find you need this file, a copy can be downloaded here (137KB). You should put this file in the following local computer directory: c:\windows\system32\

TNGLab Manuals and Tutorials

TNGLab Research Articles

Related Research on IPD with Partner Choice and Refusal

Copyright © Leigh Tesfatsion. All Rights Reserved.