Instructions for Running
TNG Program (Version 105c)

Last Updated: 16 January 2023

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

TNG Homepage
TNG Program Version 105c (Zip, 139K)


        Original Documentation for Running the 
            TNG Program (Version 105c)
          on an IBM Compatible PC with DOS



   The trade network game (TNG) consists of a collection of traders
that evolves over time.  See Tesfatsion (1997), cited below, for a
detailed introduction to the TNG. The C++ program that implements
the TNG is supported by the abstract base classes for a general
evolutionary simulation framework, SimBioSys, developed by David
McFadzean.  See McFadzean (1995), cited below, for a detailed
description of SimBioSys.

   The TNG program makes use of three special classes derived from
the SimBioSys abstract base classes:

      tngSimulation:  manages the overall simulation;
      tngPopulation:  manages the evolution of the traders;
      tngTradeBot:    simulates a single trader, either a pure buyer,
                      a pure seller, or a buyer-seller.

   The TNG program constructs a single instance of tngSimulation,
which in turn constructs a single instance of tngPopulation; and
tngPopulation then constructs a collection of tngTradeBot instances
called "tradebots."



   The TNG program is a C++ framework for implementation of the
Trade Network Game.  The TNG program has been released as freeware
by its copyright holders David McFadzean and Leigh Tesfatsion under
the terms of the Artistic License Agreement residing at

The following article constitutes the manual for the TNG program.
Please cite this article if the TNG program is used:

    D. McFadzean and L. Tesfatsion, "A C++ Platform for the
    Evolution of Trade Networks," _Computational Economics_
    14 (1999), 109-134.

Please cite the following article if only the TNG model is used:

    L. Tesfatsion, "A Trade Network Game with Endogenous Partner
    Selection," pp. 249-269 in H. Amman, B. Rustem, and A. B. Whinston
    (eds.), _Computational Approaches to Economic Problems_, Kluwer
    Academic Publishers, 1997.

Please cite the following source if only SimBioSys is used:

    David McFadzean, _SimBioSys: A Class Framework for Evolutionary
    Simulations_, Master's Thesis, Department of Computer Science,
    University of Calgary, Alberta, Canada, 1995.

For information regarding how to obtain a copy of these and other related
source materials, see




1: Download in binary mode to a directory on the hard
drive of your pc, say "tngTest," and unzip this file using
pkunzip.exe by typing

        pkunzip -d

on the DOS command line.  [The -d option preserves the directory
structure of the zipped files.]

2: The list of unzipped files should include: an executable file,
tng105c.exe; a configuration file, tng.ini; a directory SOURCE
containing source (c and cpp extension) and header (h extension)
files; a test case output file called sample.out; and this
readme.txt file.


1: From within the tngTest directory, type "tng105c" at the DOS command
line to print output to screen, or follow the command "tng105c" with an
output redirection pointer (a "greater than" sign) and some filename,
say "tng.out", to redirect the output to the local file tng.out.
The command "tng105c" activates the executable file tng105c.exe.

2: Under default parameter and print out settings, the activation of
tng105c.exe causes the following output to be printed: the date and time
of the current run; the current parameter settings in the configuration
file tng.ini; the minimum, maximum, and average fitness scores of
each generation of tradebots (for subpopulations of distinct trader
types as well as for the population as a whole); and detailed trade
history information for the final generation of tradebots.  For the
default parameter settings in tng.ini, this output should agree with
the test case output in sample.out.

   CAUTION: The random number generator incorporated in
   is designed to be portable across all 32-bit hardware.  In general
   however, random number generators can be machine dependent.  If
   you recompile the TNG program on your own machine, you may no
   longer be able to replicate the test case output in sample.out.

3: The parameter settings in tng.ini can be directly changed by the
user.  Changing these parameter settings does not require program
recompilation; the TNG program automatically picks up parameter
settings from tng.ini at the start of each experiment.  The comment
statements in tng.ini concerning admissible parameter ranges should
be read carefully before making any changes in the default parameter

4: Currently many print statements in the TNG program are commented
out in the TNG cpp source files tngSim.cpp and tngBot.cpp in the SOURCE
directory.  If more output is desired, the header files tngSim.h and
tngBot.h in the SOURCE directory indicate where the print statements
are located in the source files tngSim.cpp and tngBot.cpp.  Delete
the comment character "//" before any print statement whose output
is desired.  Then recompile the TNG program before running the next
experiment.  This recompilation will require the user to have access
to a C++ compiler for the pc such as Borland C++ (version 3.1 or
above).  For example, using the Borland C++ compiler, you will have
to make a project that includes all of the c and cpp source files in
the directory SOURCE.

   CAUTION: Proceed slowly with the inclusion of additional print
   statements.  The TNG program is capable of generating an
   immense amount of information!

5: More generally, if **any** change is made in the TNG source files,
the TNG program will need to be recompiled in order to incorporate
this change.

Copyright © David McFadzean and Leigh Tesfatsion. All Rights Reserved.