Complexity of Cooperation Web Site

Alliance_Sim.doc


Note: The source code for the programs is in HTML format. To get a plain ASCII text copy of the code, you can either save the page as "text" (and strip off the extraneous text in the header and footer) or save as "source" or "HTML" and extract the text between the <pre> and </pre> tags.

Documentation, Alliance_Sim program

v 3.13

Programs written by Scott Bennett for Professor Robert Axelrod

University of Michigan

Department of Political Science

Documentation for Alliance_Sim v3.13 dated December 10, 1991.

Additional notes added 8/18/92.

Table of Contents - Alliance_Sim

Summary

Related Programs

Version History

Definitions

Program Overview

Program Implementation

Propensity

Alliance Structure Energy Calculation

Frustration

Adjacent and One-Point Optima

Input to Alliance_Sim

History File

Run Number File

Output of Alliance_Sim

Screen

File

Formatting Alliance_Sim Output Files

Notes to Programmers

Summary

Alliance_Sim simulates an "energy landscape" of potential alliances. This landscape is formed by the propensities of countries to like or dislike one another. Given that different countries have different underlying conflicts and sources of tension with one another, and given that countries are free to ally with whoever they like, it is expected that alliances will form to minimize the internal friction between members. The friction inherent in any alliance is represented as the "energy" of the alliance. Estimating the overall relations between all pairs of countries within an alliance as a single real number value, ranging from -infinity to infinity (negative feelings to positive feelings) a mathematical estimation of this "energy" in any particular alliance can be performed. Given these estimates, the landscape can be examined for local optima and the expected dynamics of alliance structures over time.

Related Programs

The Propensity_Maker program series is designed to process raw data input files into the format required by Alliance_Sim. Documentation for all versions of the program, designed to be variants for the prediction of international alliances, are in the document "Full_Propensity_Maker.doc".

Alliance_Sim_Big is a related program that has been developed to allow more than 18 actors (the Alliance_Sim limit) by doing a non-exhaustive search of the potential alliance space. Documentation for that program is in the document "Alliance_Sim_Big.v1.41.doc".

Propensity_Maker_ANES is designed to process raw data input files into the format required by Alliance_Sim_Big, for the case of national election voting. Documentation for the program is in the document "Propensity_Maker_ANES.v1.0.doc".

Version History

v1.1 implemented an initial (slow) version of the algorithm, which worked on a data set of up to 14 countries.

v1.2 added a quicker sorting and ranking procedure to the algorithm.

v1.3 formatted output to be displayed by Microsoft Word in a useful format. A display of all alliances tied for global optimum was added to the output.

v1.4 reworked the main algorithm for a speed increase of about 50%.

v1.5 modified output, sorting alliances by rank before printing them. Alliance energy calculation time was cut in half by the use of complements.

v1.6 implements history files, and modifies the structure to allow 15 countries.

v2.0 modifies the input and output file format, and adds some output.

v2.1 adds output of the name of the program (Alliance_Sim) to the history file output to allow runs of this to be distinguished from other simulations.

v2.2 added a calculation for frustration. Frustration was calculated as (the payoff from an ideal alliance) minus (the payoff from the actual alliance structure).

v2.3 allowed 16 countries.

v3.0 was a major change. Algorithms were re-written for speedup and memory reduction; runs now take between 1/3 and 1/2 the time of v2.3; up to 18 countries can be accomodated. Frustration was changed to drop the "ideal" component of payoff; rather, frustration is now the portion of energy coming from a country. Rank was dropped.

v3.1 was another major change. The polarity of the landscape was switched so that downhill (lower energy) was better. The algorithm then minimizes energy. Energy was also changed so that it sums for country i <> country j, that is, it does not add in energy due to the diagonal of countries with themselves, but still allows for non-symmetric matrices. Distance was changed to 0 within, 1 between alliances. Output section for adjacent and one-point optima was added. v3.11 did some bug fixes.

v3.13 made an input and frustration calculation change. The input now reads the size of countries from the raw data lines in the propensity file if they are there, and modifies the frustration for a country i to be the sum over other countries j of the propensity(i,j) * distance * size(j).

v3.13 added an input check for the user-supplied filename so that if the program was running in as a compiled program it would not crash the machine.

Definitions:

An alliance is defined as a group of countries who join together. v3.13 of Alliance_Sim allows up to 18 countries in its simulated system. In this documentation, countries will be designated as country i and country j.

Propensity is a measure of how much any two countries "like" each other, of how much fundamental conflict or friction exists between them, and as a bottom line how likely they are to ally with each other given an opportunity. A high propensity indicates high positive feelings.

An alliance structure is the complete representation of the membership of all countries in a system in alliances. An alliance structure in v3.13 of Alliance_Sim consists of exactly two alliances. Whatever countries are not in one alliance are in the other. The two alliances will be referred to as alliance A and alliance B.

An alliance structure can be represented as a series of 0s and 1s. For example, the structure 0 0 1 would indicate that countries 1 and 2 were in one alliance, and country 3 was in the second alliance. This string of 0s and 1s can be represented as an integer number, using the 0s and 1s as binary bits. Thus, structure 1 0 0 can also be represented by "4". This integer is an index to the structure.

Given n countries in the simulation, there are 2n possible representations of alliance structures. However, there are only 2(n-1) different alliance structures -- one-half of the alliance structures are complements of another. A complement to an alliance structure is the structure with each bit of the representation switched. For example, the structure 1 0 0 is the complement of structure 0 1 1. These are different bit string representations, with indices 4 and 3, but are the same underlying structure, with country 1 in one alliance and countries 2 and 3 in the other.

Energy is a measure of how much all countries in a given alliance structure like their alliance partners overall and dislike the countries in the other alliance. It is a measure of the "frustration" present in the alliance structure -- how much countries are forced in that structure to be allied with countries which they do not like. Energy is a function of the propensities of all pairs of countries. Given that all pairs of countries have some propensity to ally with each other, the energy inherent in any potential alliance structure can be calculated. Complementary alliance structures have identical energies. In v3.13 of Alliance_Sim, lower energy means less frustration, and an alliance structure with an energy lower than a second alliance structure is downhill from it.

A neighbor of an alliance structure is an alliance structure which can be reached by the switch of either zero or one country from one alliance to another. Given n countries in the simulation, there will be exactly n+1 neighbors to any alliance structure: the structure itself, and n structures reached by one switch. The best neighbor is that neighbor with the least energy. This is equivalent to the neighbor found by following the steepest slope (gradient) in the direction of lower energy from the structure. If more than one neighbor had the same best energy, the best of those was determined by a randomized tie-breaking procedure.

A local optimum is an alliance structure which has no neighbors with a lower energy; that is, it is its own best neighbor.

The global optimum is that alliance structure with the lowest energy of all structures. The global optimum is also a local optimum.

The basin of attraction of any alliance structure is that group of alliance structures which, if their best neighbors were repeatedly followed until a local optimum was reached, would lead to that structure. Every local optimum has a basin of attraction. If a structure is not an optimum, there are no structures in its basin of attraction.

The basin size of any alliance structure is the number of alliance structures which "chain" to that structure as their local optimum. For any structure other than a local optimum, the basin size is 0.

Program Overview

1. Propensity * Size for all pairs of countries in the simulation are read in from an input file.

2. The energy of each potential alliance structure is calculated from those propensities (using a recursive procedure).

3. From each alliance structure, all neighbors are examined to see which has the lowest energy; this is noted as the best neighbor. If neighboring structures have the same energy, the tie is broken randomly. From this best neighbor structure, its best neigboring structures are repeatedly traced (recursively) (forming a "chain") through the complete set of structures until an optimum is reached. This is noted as the local optimum of the initial alliance structure. The procedure is repeated until the local optimum of each alliance structure is determined.

4. For each optimum, the number of alliance structures which lead to that optimum via the best neighbor chain are counted; this is noted as the "basin_size" of that optimum.

5. The global_optimum is calculated as the lowest energy optimum.

6. Frustration of each country is calculated.

7. Program output is reported.

Program implementation

Alliance_Sim was written using the Symantec Corporporation's Think Pascal v3.0 language and environment.

For 16 countries, a run of the program on a Macintosh IIx within Think Pascal, with all debugging options enabled, takes about 1 hour and 20 minutes. Running the compiled program as a standalone application for 16 countries takes about 25 minutes.

The program consists of approximately 2300 lines of computer code.

The program requires a machine with 3500K free memory.

Propensity

The "propensity" of two countries to ally is a representation of how much the two countries "like" each other, of how much fundamental conflict or friction exists between them, and at the bottom line how likely they are to ally with each other given an opportunity. A high propensity indicates that two countries like each other and are likely to coordinate relations through an alliance; a lower propensity indicates greater dislike and a lower likelihood of alliance given a choice by the two countries.

In landscape theory, propensities between countries affect other third countries in proportion to the size of the two countries.

The propensity of countries with themselves is not included in any calculation of energy in Alliance_Sim, and is arbitrary.

Propensities are read from an input file (see section on input files). An n x n matrix of propensities can be directly entered by a user in this file, or can be calculated based on the estimation of a number of underlying sources of conflict between countries. This calculation can be performed by the program Propensity Maker. Propensity_Maker includes both conflict factors and size in its propensity matrix, and it should be noted that Alliance_Sim expects that the propensity matrix in the input file already includes size as well as the "raw" dislike between countries. This input matrix will thus be referred to as a "size times propensity matrix."

Distance

The distance between two countries i and j in alliance configuration X in v3.13 of Alliance_Sim is defined as

Distance (i,j,X) = {0 when i and j are in the same alliance in configuration X

1 when i and j are in different alliances in configuration X}

Frustration

Frustration is conceived of as the total dissatisfaction of one country with a given alliance configuration. The frustration of one country will contribute to the overall energy (defined below) of an alliance structure in Alliance_Sim. This is the propensity between the country and all other countries, multiplied by the distance between the countries, multiplied by the size of the other country.

The frustration of country i at alliance structure X is defined as:

Frustration (i,X) =

A more satisfied country has a lower frustration.

Note: since frustration depends only on the sizes of other countries, it is not to be expected that there will be any relation between i's frustration and i's size. [This is the opposite of frustration as defined in version 2.2 and 2.3 of Alliance_Sim.]

Alliance Structure Energy Calculation

Given the definition of frustration, above, the energy of an alliance structure can be defined (given a total of n countries) as

Energy (X) =

The energy of an alliance structure X is thus equal to

Energy (X) =

Given the distance function defined above, lower (better) values emerge from "friendly" countries being together. Assuming Britain and France have a propensity of 20 (they like each other), their being in the same alliance contributes 0 to the energy of the alliance structure; being in different alliances would contribute 20 to the energy of the structure, which would be worse.

This energy formula "double counts" pairs of countries. That is, both the propensity of i with j and j with i are added into the energy. This double counting exists in the simulation to allow the possibility of non-symmetric propensities.

This energy formula does not calculate any contribution to energy due to country i with itself. Including this contribution would result in a constant increase for all alliance structures, and hence would have no effect on the landscape, except for its absolute "height".

Note that the input to Alliance_Sim expects that the propensity matrix in the input file already includes size as well as the "raw" dislike between countries. That is, Alliance_Sim does not read in size and multiply it by the propensities, but only multiplies the input matrix by the distance between countries in particular alliance structures. Therefore, Alliance_Sim reads in a size times propensity matrix.

Tie-Breaking

It is possible for two alliance structures to have equal energy. If the best neighbor of a structure could be any of several adjacent points which have equal energy (a somewhat flat local environment), Alliance_Sim randomly determines which of those adjacent points is best. However, the program also stores a record of which of these points is determined to be best. This is done so that if another structure has these same points as potential best neighbors, or one of these and another with the same energy, the point designated as better is consistent across these choices. It would be possible without maintaining a record of this that A could be better than B, B better than C, but C better than A if tie-breaking was performed repeatedly on a dyadic only basis. Alliance_Sim takes care of this problem by, any time two points are seen as equal possible best neighbors to an alliance structure, determining among all the potential alliance structures with that energy a randomly determined best to worst order and storing it. Whenever structures have possible best neighbors with an energy on this list, then, the random order is consistent.

This order is also set to be the same for complement alliances. That is, if alliance 1000 is randomly determined to be the best alliance in the non-complement set with some energy, alliance 0111 is set to be the best alliance among the complement set with that energy. This is acceptable because with n >= 3 countries, no structure will ever be adjacent to both X and complement(X).

Adjacent and One-Point Optima

When one optima is adjacent to another, the two points are really in the same basin of attraction. When optima have a basin size of one, they are either extremely unstable and hence unlikely final points, or are on a flat landscape. These situations are pointed out to the user in the output of the Alliance_Sim. Additionally, Alliance_Sim attempts to assess whether these point are on a valley floor, on a saddle point, or on a local plateau.

-- A saddle point optimum is a point which has some adjacent points with a higher energy, no adjacent points with lower energy (if it did, it would not be an optimum), and some equal energy adjacent points. In turn, at least one of these equal energy adjacent points has a lower point adjacent to it.

-- An optimum on a valley floor has no lower energy points adjacent to it, all adjacent points being higher or equal.

-- An optimum on a plateau has no higher energy adjacent point, only equal energy adjacent points (lower energy adjacent points are impossible), and at least one of these adjacent equal points has a lower energy adjacent point. Thus, if this point is moved off of, energy could become lower.

If the program cannot determine which of these situations describes an optima, "unknown" is reported as the condition of the point.

Only the immediately adjacent points of each optimum's adjacent points are evaluated - that is, only a one-ply search is made of the condition of the surrounding "neigborhood" of an optimum. This is what results in the "unknown" situation, when there are equal adjacent points to an optimum's adjacent point which are not assessed. Only a one ply search was implemented in the program because of programming considerations.

Input to Alliance_Sim

When Alliance_Sim begins executing, it prompts the user for the name of an input file. This name can be up to 32 characters long. By convention this file is usually called "xxxxxxxxxxxxxxx.prop", where the actual name is the name of a user created file or a file created by Propensity_Maker. The ".prop" as the final part of the file name identifies the file as a file of propensity data, that is, containing propensity * size matrix input.

Alliance_Sim then prompts the user for the name of an output file, up to 32 characters long. By convention, this file is usually called "xxxxxxxxx.out", where xxxxxxxx is a name of the user's choice, up to 28 characters long. The ".out" as the final part of the file name identifies the file as a file of output information generated by the Alliance_Sim program.

Alliance_Sim then takes the rest of its input from the input file. The input file is a flat text file with the following lines:

Line 1 to Line 12: Header lines, any text here is fine.

Line 13: A line of ***** (at least 2 asterisks) which separates the following comment lines (which are copied into the final output) from the header lines (which are not).

Line 14 to ????. Up to 25 comment lines can be put here which Alliance_Sim will read and put at the top of the output, and will put into the history file. After the last which the user wants in the output must be another line of ***** (at least 2 asterisks) which marks the end of the comment. Without the **** line the program will fail, as it does not know when the comment ends.

Next Line: Name of / path to the run number file, in quotation marks (see below).

Next Line: Name of / path to the history file, in quotation marks (see below).

Next Line: Integer for the number of countries in this run of the simulation.

Next n lines, where n is the number of countries in this run: name of one country, up to 8 characters long, not in quotation marks. Names cannot have spaces in them.

Next comes the size * propensity matrix to be read in. This consists of:

Next line: A line which is ignored by the input program, but which usually consists of integers 1..n simply to function as headers for the columns of the propensity matrix.

Next n lines: Each line has an index 1..n, and then the real number propensity*size of that country with all of the other countries in the simulation run. First is one integer 1..n marking the number of the country. This usually corresponds with the number on the first line of the matrix (the header of integers) which form the columns to the index row for easier data entry. Next come n real numbers which represent the propensity*size of the indexed country to ally with country 1..n (the column). Fractional numbers should start with a 0, e.g. one-half should be represented by "0.5" rather than just ".5".

Next line: a line of **** which separates the propensity matrix from the next section.

Next line: a line which can either be:

1) a line of '0's and '1's which represent an initial starting alliance structure from which Alliance_Sim will calculate a path to its local optimum.

2) a blank line, in which case Alliance_Sim will not calculate any path from any starting structure to a local optimum.

Next line: a line of **** which separates the starting structure from the next section.

Next section, up to end-of-file: the lines in this section are intended for the raw data from which propensities were generated. The size information from the raw data is necessary for the calculation of frustration, and the format of these lines should be followed exactly:

The first three lines are header lines consisting of two lines of labels for the columns of the raw data and a single line of "---------" (at least two "-" characters, in column 1 and 2 of the input file).

Next there are n lines, where n is the number of countries processed in this run of Alliance_Sim, each of which is identical to a raw data input line to the Propensity_Maker program. Each line has three pieces of required information:

an integer number for each country, a tab character, the 8 character name of the country, a tab character, the real number size of the country, a tab character.

Each line can also have additional (optional) raw data information which will be copied into the program output. These include the integer lists of ethnic, border, and war history conflicts of that country separated by tabs, the real number proportions of the country of different religions, a tab, and finally information on EEC membership, government type, and / or Soviet allegience depending on what version of Propensity_Maker was run.

If the Propensity_Maker program is used to create the xxxxxxx.prop file, these lines are output to the propensity file identically to the way they are required as input to Propensity_Maker.

There cannot be any blank lines at the end of the text, before the end of file marker.

History File

The history file is a flat text file, and contains one entry for each run of the Alliance_Sim program, and all other simulations which have been run on the computer using the same history file. Each entry (one for each run) has several parts: first, the run number, second, the name of the program (in this case, Alliance_Sim), third, the version of Alliance_Sim used for that run, fourth, the random seed of that run, and fifth, the comment line(s) in the file which was read as input to Alliance_Sim. Each time Alliance_Sim is run, an entry is added to this file.

Run Number File

The run number file is a flat text file containing one integer value. This is the number of the last run of a simulation program on the disk which was performed. Each time Alliance_Sim (or any other simulation using the same run number file) is run, this value is read in, incremented, and then written out to the file again, destroying the old value. This provides a unique identifying number for each execution/run of all simulation programs on the computer.

Output of Alliance_Sim

Alliance_Sim produces output on the computer screen, and to the output file specified by the user. Most of the output to the file and to the screen are identical, but the file output contains some additional information.

Output sent to both screen and file:

Line 1: Alliance_Sim version, and date and time of the Alliance_Sim run.

Line 2: Run number of the Alliance_Sim run.

Line 3: Name of the input file

Next section: Comment lines copied from the input file.

Next section: If the propensity matrix was generated by the Propensity_Maker program using raw data, that raw data is printed here.

Next section: Initial Size * Propensity Matrix. This is a square matrix with as many rows and columns as there were countries in the Alliance_Sim run. Down the left side are the numbers of countries (1 to n) followed by the names of the countries corresponding to those numbers. Across the top, only the country numbers are given. Each row-column intersection is the size * propensity of those two countries to ally.

Next section: Global Optimum Alliance Structure. The index number, the bit representation of the structure, and its energy are reported for the global optimum (lowest energy) structure. Following this the two alliances of the structure are reported with the bit representation converted into country names. Finally, if any other alliances tied for the highest energy their structures are reported. The complement alliance (which always has the same energy) is not reported here. Only fundamentally distinct structures which tie for lowest energy are reported.

Next section: Permuted Size * Propensity Matrix. The order of the countries in the size * propensity matrix is changed so that all of the countries in alliance A are listed first, followed by all of the countries in alliance B. All members of the same alliance are thus displayed adjacent to one another.

Next section: Local optima. Information is reported for all structures which were local optima. For each of these structures, the index, bit representation, energy, and basin size are reported on one line, followed by the alliance representations displayed as country names. This section reports local optima which are not complement alliances.

Next section: Frustration. One line is reported for each country, and one column is reported for each non-complement optimum. The number at a row-column intersection is the frustration of a country at an optimum. A header line above the table lists the index numbers of the alliance structures being reported in the columns. The first column (first optimum reported) contains frustrations at the initial configuration specified in the input file to Alliance_Sim, if one was given. If no starting configuration was input, a column of "--" is outputted. The second column reports frustration at the global optimum; subsequent columns report frustration at all other optima in order of energy, low energy to high energy, that is, better energy to worse energy.

Next section: Path to optimum. If the input file contained a starting alliance structure, the path by which that structure is expected to move to its local optimum is printed here. The path contains a list of intermediate alliances expected to be passed through by repeatedly following the highest neighbor of the starting configuration: their index, structure in 0/1 format, and energy.

Final section: This section warns the user if any optima are adjacent to other optima, or if any of them had a basin size of 1, and if so, whether the point is on a valley floor, on a saddle point, on a local plateau, or is in a situation which cannot be determined, i.e. "unknown" .

Output sent to file only:

Following the above sections, the output file contains a list of the best 50 alliances, in energy order, low energy to high. Alliances with the first country in the first alliance are reported; complements of these alliances are not reported. There is one line of output per reported alliance structure. Each line has the structure index, its bit representation, energy, index of the local optimum reached by following the best neighbor, and the basin size of that structure. There are 2n-1 lines of output in this section.

Output file size: a typical output file is approximately 6-8K in size, although this can increase in the case of a run which finds many optima.

Formatting Alliance_Sim Output Files

The output from the Alliance_Sim program is written to a flat text file. It is possible for a user to format that file by adjusting the ruler lines in a word processor such as Microsoft Word so that the output can be printed in a readable fashion -- that is, formatting can be done to adjust tab spacing and create columns for structures such as matrices which are most readable when in straight lines. It is possible for a user to do such formatting manually, but a Microsoft Word file has been created with four predefined styles to make such formatting easier. After an Alliance_Sim output file has been opened in Microsoft Word, the styles in this file can be imported and used to format the document. The details of importing and using styles are most fully described in the Microsoft Word manual, but in brief the steps for importing and using this set of styles is as follows:

1. Open the Alliance_Sim output file by using the "OPEN" command under the FILE menu.

2. Under the FORMAT menu, select DEFINE STYLES.

3. While the DEFINE STYLES screen is still open, select OPEN from the FILE menu. When the list of files appear, double click on the file which contains the styles to import, in this case "Alliance_Sim_Styles.doc".

4. The styles in that file will appear in the list of available styles on the DEFINE STYLES menu. Click OK to return to the main document.

5. Highlight the text you want to apply a particular style to. Make sure the ruler line is on, then click and hold the downward pointing arrow under the "1" inch marker on the ruler. Select the style you want, and release the mouse button. The style will be applyed to the section you highlighted.

Once the styles are imported and the document formatted, it can be saved as a Word document so that the formatting will be preserved.

The styles defined for Alliance_Sim output formatting, which are in the file "Alliance_Sim_Styles.doc", and their appropriate uses, are as follows:

AS_Main_Style: apply this style to the whole document. It properly formats all of the listings of potential alliance structures and optima.

AS_Prop_Matrix_Style: apply this style to the Propensity * Size matrix and permuted Propensity * Size matrix. It creates narrow columns so that propensities will form a square matrix. It will properly format the matrix for up to 16 countries; for more the the user may have to manually adjust the page width or column spacing to accomodate all of them.

AS_Frustration_Matrix_Style: apply this style to the frustration matrix.

AS_Raw_Data_Style: apply this style to raw data which was prepared for the Propensity_Maker program. It adjusts the spacing of various columns to accomodate the different types of input seen in raw data input to Propensity_Maker.

Notes to Programmers

For programmers modifying the Alliance_Sim source code:

1) There is a constant set at the beginning of Alliance_Sim_Type_Unit which is called "TEST". For normal operation, this is set to false. When TEST=false, the history file and run number file are processed as described in the above documentation. When TEST=true, however, NO output is written to the history file, and no changes are made to the run number file. The run number for TEST=true runs is run 0. This boolean is set up for purposes of testing only. Make sure you set it back to false after testing is completed or run numbers will not change and nothing will be added to the history file.

2) There is a constant set at the beginning of Alliance_Sim_Type_Unit which is called "FILES_FROM_LIST". When FILES_FROM_LIST = false, the default setting, the program prompts users for input and output files as described in the documentation above. When FILES_FROM_LIST = true, the user is not prompted for file names. Rather, the names are found directly in the code, above the main program loop in Alliance_Sim_Main_Unit, in an array. The main program loops from 1 to n times, where you can set the n, to use the first n input and output files listed in that array. This allows you to do several runs at once without risking spelling errors or having to watch the program for completion.

3) When you make modifications, change the VERSION constant at the beginning of Alliance_Sim_Type_Unit. Also note changes at the top of Alliance_Sim_Main_Unit where version history is documented.

4) Warning: The program will fail if it runs out of memory, as no error checking is done for these situations. This is only likely to occur when two simultaneous circumstances arise: 1) the maximum possible number of countries are being run, and 2) there a lot of tied points. The reason for this is that the tie-breaking procedure stores a list of all optima with a given equal energy when a structure must decide between them (i.e. there are tied best adjacent points). These points are stored so that if another structure has to decide between those two points, or one of those and another with the same energy, which of the equal energy points is randomly designated as better is consistent. That is, it would be possible without maintaining a list that A would be better than B, B better than C, but C better than A. It is only in the case of a large number of tied points, and a large number of structures with that energy, that much information must be stored. And it is only when the simulation is already pushing memory limits by using the most possible countries that this structure would be a problem.

5) Warning: The program currently uses a number of bit functions to process alliance information. No physical representation of 01001001 etc. is kept in memory. When/if the simulation is changed to allow multipolarity, many algorithms may need to be fundamentally rewritten, or else user designed "three-bit" functions could be written, at the cost of some speed.

6) One ugly kludge in the program involves the calculation of frustration. Actor i's frustration at some optima depends only on the sizes of the other actors, not i's size. However, the initial propensity*size matrix which is read includes the sizes of both i and j in propensity(i,j). To calculate frustratation for i, a division of the value from the propensity*size matrix by size(i) is necessary. This size is taken from the raw data at the end of the input file.

The matrix read by the program is a propensity*size matrix for historical reasons, i.e. the first specification of the program did it this way, so everything that followed did to. The cleaner way would have been to have the Propensity_Maker programs just output raw propensity, and have the Alliance_Sim program calculate P(ij)*S(i)*S(j), and for i's frustration calculate just P(ij)*S(j). Alternatively, size could be listed with the actor names. At this point, however, changing the setup would require modifying several versions of Propensity_Maker as well as Alliance_Sim and Alliance_Sim_Big, and so we judged it to be not worth it. However, this does mean that the raw data has to be in the input file in the proper format so that size can be read from it. Actually, as the input requirement specifies, only the first three pieces of information need to be there (id number, name, and size), so input file size could be reduced by cutting out information beyond them. Typically the raw data won't be that big, so this (hopefully) shouldn't be too much of a problem.

Who ever claimed that my programming was perfect, anyway?


Back to Chapter 4
Back to Chapter 5
Back to Complexity of Cooperation Home Page

University of Michigan Program for the Study of Complex Systems
Contact http@maria.physics.lsa.umich.edu.
Revised November 4, 1996.