SlideShare a Scribd company logo
Senior Project: Private/Public Domain Strategies Using a Genetic Programming System
John V. Kew II
Computer Science Department
California Polytechnic State University
1
Senior Project: Private/Public Domain Strategies Using a Genetic
Programming System
John V. Kew II
Computer Science Department
California Polytechnic State University
San Luis Obispo, CA 93407
jkew@calpoly.edu
24th April 2004
“The useful arts are reproductions or new
combinations by the wit of man, of the same
natural benefactors.”
- Ralph Waldo Emerson, Nature
Abstract
The system detailed in this paper is designed for analyz-
ing when it is better to hide or share information in a com-
petitive environment. This system can be used for simple
analysis of competitive or inventive processes, with a pri-
vate domain of information and public domain of infor-
mation, and can be used as a basis for exploring more spe-
cific public/private domain problems such as copyright,
business, or psychology.
The model emulates the creative process by grouping
solutions together in one or more “domains” representing
a set of information which can be used by an agent. The
intersection of these domains is the public set of informa-
tion which can be used by any agent in the system for the
purpose of crossbreeding and mutation. Variations on this
theme include delayed dispersal of information, falsifica-
tion of information, and selective dispersal. Only selec-
tive dispersal will be explored, however the model can be
easily modified to support these variations.
Individuals have no barriers to mutation and cross
breeding within their domains but are not able to cross
breed with other domains. The children of an individual
in a domain would remain in that domain but not part of
the public domain intersection.
Originally the system was designed to find a mixed
Nash equilibrium for the sharing of information on dif-
ferent types of problems. Achieving this goal would have
required enormous computing resources and time spent in
analysis. It was more profitable to analyze different par-
ticular strategies on different classes of problems.
1 Introduction
There are numerous economic models which take advan-
tage of genetic programming. A lot of economic decision-
making can be viewed as the trek through a particular
search space of possibilities by agents seeking equilib-
rium. Rather than developing a specific set of agents
which have set strategies at each decision point, a model
using genetic programming could develop these strategies
over the course of changing economic parameters[1] and
show how private control aids in the development of ideas.
This system hopes to describe a method of exploring the
benefits of information sharing on certain innovative or
competitive processes.
It is not entirely strange to use genetic programming in
investigating strategies of private control on the
success of solutions regarding a particular problem. Spec-
ulation on the effect of various policies is rampant among
economists, psychologists, and lawyers[2]. A computing
2
model which can describe these policies is not a broad
leap into wonderland. Use of genetic programming in
game theory is rampant, and this model simply adjusts
a classic payoff scheme to represent the search for a solu-
tion to a problem.
The model described is one which changes the classi-
cal GP system to simulate the propagation of ideas in an
environment where there is private control and a public
reservoir of solutions. This model could be used to evalu-
ate the relative success of lessor or greater control policies
on certain classes of problems or address aspects of policy
which might better facilitate the development of ideas.
The methods by which ideas are shared in this system
differs from existing sharing mechanisms in that specific
strategies can be assigned to each agent and modified dur-
ing the simulation. Most GP sharing methods are de-
signed to solve a specific problem quickly. This system
is designed to determine the best sharing method for a in-
dividuals or a group trying to solve a particular problem.
This model cannot prove or disprove the usefulness of
patents or copyright as the profit motive of intellectual
monopoly cannot be modeled without “profit”, and the
economic system surrounding it. It also can’t determine
specific effects of lying, managerial techniques or other
instances where information is hidden.
First described will be the classic genetic programming
model. Next, there will be a discussion of game theory as
it relates to this experiment. The Public/Private Domain
EP model will then be outlined along with issues discov-
ered during implementation followed by an address of the
assumptions made developing the model. The classes of
problems that can be represented by this model will be
looked at and lastly there will be an analysis of the exper-
iments performed with the system.
2 Background Information
One of the most difficult aspects of this system is stan-
dardizing the vocabulary used to describe it. Originally
this project was to deal directly with copyright and patent
issues. The terms used in the study of economics and in-
tellectual property must then be mapped to terms used
in genetic programming. Lack of a consistent vocabu-
lary would leave both economists and computer scientists
confused. The suggested model is also a very broad repre-
sentation of real-world intellectual property, making one
to one relationships between terms extremely difficult.
The vocabulary describing individuals and the problem
being solved will be mathematical. The vocabulary de-
scribing information dispersal and modification will be
taken from evolutionary game theory. This generaliza-
tion means that this paper could apply to any situation
where two or more groups hide information from each
other while developing an idea or process.
Game theory was the saving grace for this project. I
used Herbert Gintis’s book, Game Theory Evolving along
with Von Neumann’s Theory of Games and Economic Be-
havior extensively in this project. While my handle on
game theory is still rough the concepts explored in those
texts matched perfectly with concepts I was trying to ex-
plore with this project, but that didn’t have a standard
computer science or mathematical description. My sud-
den immersion in this field has given me the impetus to
explore more advanced issues in game theory.
2.1 Classical Evolutionary Programming
John R. Koza, a leader in genetic programming recently
wrote in the February 2003 issue of Scientific American:
Evolution is an immensely powerful cre-
ative process. From the intricate biochemistry
of individual cells to the elaborate structure
of the human unimaginable complexity. Evo-
lution achieves these fears with a few sim-
ple processes–mutation, sexual recombination
and natural selection–which it iterates for many
generations. Now computer programmers are
harnessing software versions of these same pro-
cesses to achieve machine intelligence. Called
genetic programming, this technique has de-
signed computer programs and electronic cir-
cuits that perform specified functions.
Evolutionary programming (EP) and genetic algo-
rithms (GA) utilize the same basic concept. The primary
difference between the two methods is in how the problem
is encoded. GAs typically encode problems using fixed
length tokens, where as in EP there are no limitations on
the representation[5]. Both are methods by which a solu-
tion to a problem can be sought out utilizing the processes
of natural selection and breeding.
3
A set of n random solutions, called individuals are ini-
tialized and their success is tested against the problem us-
ing some sort of fitness function. The solutions which
perform better than others are copied, randomly modi-
fied, and mixed with other successful solutions for the
next “generation” of individuals. The process then restarts
until a satisfactory solution is achieved. This process can
only be performed inside of a computer, but the solutions
generated by genetic programming systems have often
been surprising and innovative.
generation
W
W
W
W
W
W
L
L
L
L
L
Figure 1: Generic genetic/evolutionary programming
Figure 1 depicts a generic genetic programming pro-
cess. Individuals, or solutions, are boxes, the solid lines
represent a basic mutation from the parent and the dotted-
dashed lines represent a cross over operation between a
successful( [W]inner ) individual in the previous genera-
tion and a newer individual. Individuals which perform
badly ( [L]oser ) do not contribute material for the next
generation of individuals.
The dependent variables in this type of system include
the number of children produced by a successful individ-
ual, degree of mutation, probability of cross over, degree
of cross over, and number of individuals in each genera-
tion.
In a classic GP system, these probabilities are deter-
mined by a normal distribution, however sometimes re-
searchers have chosen different types of distributions to
change the search performance of the system on certain
types of problems.[3] Variables such as the population
size and selection size are chosen beforehand. The prob-
lem, solution characteristics, and fitness function are also
carefully developed beforehand. An GP system is halted
at a predetermined time or when the solution meets some
criteria.
2.2 Game Theory, Private Domain and
Public Domain
This project is an analysis of the creative process between
individuals with differing information sets. The goal is
to find some sort of useful strategy between those who
share information and those who hide information[5][6].
A simple game will help describe the game theory basis
for this experiment, and give an introduction to the evolu-
tionary aspects which will be part of the full experiment.
The first game described will be a boring card game.
The game is designed to experiment with some of the is-
sues that would arise with the full version. Some of the
math behind the card game will be described and then a
repeated version of the game will be shown along with
some analysis. The repeated version of the simple game
is a very rudimentary resemblance of the full version.
The main differences between them being the strategies
available to agents, the complexity, and type of problems
solved.
A simplified version could be described as such:
Two agents draw random card from a standard deck, keep-
ing each card face down on the table. When the game
is called, the cards are flipped over and the agent with
the highest card gets three dollars. If both agents draw
the same rank, they both get one dollar. Before calling
the game, the agents each have the option of turning their
card over. If the card shown is the highest of the two cards
drawn, both agents get a dollar. The deck is shuffled and
the game starts over.
Tables 1-3 describe the normal form of the game and
their payoffs. Agent one is represented by the columns
4
Share Hide
Share 1,1 1,1
Hide 1,1 1,1
Table 1: Same Card p=3/51
Share Hide
Share 1,1 0,3
Hide 1,1 0,3
Table 2: Agent 1’s Card is Greater p=24/51
Share Hide
Share 1,1 1,1
Hide 3,0 3,0
Table 3: Agent 1’s Card is Lesser p=24/51
in each situation and can decide to either share or hide
information. This is the only decision an agent can
make. Likewise, agent two is represented by the rows in
each table. p represents the probability of each possible
draw. There is a 3/51 probability that the two agents will
draw the same rank card. The payoffs in this situation
are all one dollar. There is a 24/51 probability that the
first agent’s card will be greater than the second agent’s
card, and vice versa. In the single round version of the
game, there are only two strategies available to each
agent. Assuming the other agent is equally likely to share
or hide their card, the payoffs to the agent using some
strategy si ∈ S (the set of strategies)is:
Π(si) =
pj ∈P
pj(
1
2
Πj(si, s−i) +
1
2
Πj(si, si))
Where P is the set of probabilities for each outcome.
Π(s) is the overall payoff using strategy s no matter
which cards are drawn and Πj(s, s ) is the payoff of any
particular move j by nature given some strategy s’ by the
other agent. For an agent that only shares, this results in:
Π(si) =
3
51
(
1
2
Π(si, s−i) +
1
2
Π(si, si))
+
24
51
(
1
2
Π(si, s−i) +
1
2
Π(si, si))
+
24
51
(
1
2
Π(si, s−i) +
1
2
Π(si, si))
=
3
51
(
1
2
+
1
2
) +
24
51
(
1
2
+
1
2
)
+
24
51
(
1
2
)
=
39
51
For an agent that only hides, this results in:
Π(s−i) =
3
51
(
1
2
+
1
2
) +
24
51
(
1
2
(3) +
1
2
(3))
+
24
51
(
1
2
)
=
3
51
+
24
51
(3) +
12
51
=
87
51
Replacing “1” with β and “3” with α the normal form is
found in tables 4-6 1
And by setting Π(si) ≥ Π(s−i) to find out how large α
needs to be with respect to β we get:
Π(si) ≥Π(s−i)
3
51
β +
24
51
β +
12
51
β ≥
3
51
β +
24
51
α +
12
51
β
39
51
β ≥
15
51
β +
24
51
α
β ≥α
In this game, when the other agent chooses one of the
two strategies with a 50 percent probability, it is more
sensible for an agent to hide as long as α ≥ β. Assuming
both agents, know this, however, both might always hide.
1These tables could have been combined into a single table with
equations for entries. While that form is common in game theory texts,
it was decided to keep this table simple with each probability a distinct
outcome.
5
Share Hide
Share β,β β,β
Hide β,β β,β
Table 4: Same Card p=3/51
Share Hide
Share β,β 0,α
Hide β,β 0,α
Table 5: Agent 1’s Card is Greater p=24/51
Share Hide
Share β,β β,β
Hide α,0 α,0
Table 6: Agent 1’s Card is Lesser p=24/51
The payoff equation for the agents when they both stay
with the same strategy is simpler:
Π(si) =
pj ∈P
pjΠj(si, si)
Similar evaluation for a two sharer scenario results in:
Π(si) =
3
51
β +
24
51
β +
24
51
β
=β
And for two agents who only hide information:
Π(s−i) =
3
51
β +
24
51
α
Again, the relationship between αandβ is expressed by:
Π(si) ≥Π(s−i)
β ≥
3
51
β +
24
51
α
48
51
β ≥
24
51
α
2β ≥α
With this game it is not worthwhile for both agents to
only hide verses only share unless α is twice the value of
β. This value is dependent upon the probabilities of each
event, details of which will not be further discussed.
This is a single round game, the rules of which mention
one particular characteristic which is not often present in
competitive systems. The rules state that the agents must
decide whether to share before they look at their card. The
agents do not know their own hand. In the full system,
agents are able to determine which solutions (or cards)
should be shared.
Furthermore, this game is boring because it is only
played once. A repeated version of the game, in a simple
genetic programming system, with different agents using
the three strategies always share, always hide, and share
half the time using different values for α and β should
prove more interesting.
3 Repeated Version of the Simple
Card Game
The following is a repeated version of the simple card
game introduced in the last section. One hundred agents
are generated with one of two strategies. Different runs
of the game will exhaust all possible two strategy combi-
nations of the five available strategies, including homoge-
neous match ups. In each run, two agents are then paired
up and they play the simple card game. Payoffs are cal-
culated, and every 100 generations reproduction occurs.
Five percent of the lowest scoring agents are replaced with
duplicates of the top five percent. A mutation in an agent
occurs with a one percent probability. These basic pa-
rameters will remain the same unless otherwise specified.
Different values for α are tried and the population of each
type of agent is recorded every generation.
6
3.1 Hiders vs. 50/50’s
0
20
40
60
80
100
120
0 1000 2000 3000 4000 5000 6000 7000 8000 9000 10000
Alpha = 0
Alpha = 1
Alpha = 2
Graph 1: Number of Hiders, β = 1
0
50
100
150
200
250
0 1000 2000 3000 4000 5000 6000 7000 8000 9000 10000
Alpha = 0
Alpha = 1
Alpha = 2
Graph 2: Average Payoff, β = 1
Graph 1 shows the population of each type of agent
over time. The point at which an agent who only hides is
more successful than an agent who hides half the time is
when α is equal to β. The average payoff graph (graph
2) largely reflects the higher payoff of the greater alpha,
however the slight inflection point 2
at the minima of hider
agents demonstrates the generally greater payoffs with an
even mix of agent types.
2Many attempts were made to graph these inflection points more
clearly. The best method was to rotate the line clockwise using its aver-
age slope as an axis. Unfortunately, there is no standard way to plot all
three experiments on the same graph this way, so the graphs were left as
is.
3.2 Sharers vs. 50/50’s
0
20
40
60
80
100
120
0 1000 2000 3000 4000 5000 6000 7000 8000 9000 10000
Alpha = 0
Alpha = 1
Alpha = 2
Graph 3: Number of Sharers, β = 1
0
50
100
150
200
250
0 1000 2000 3000 4000 5000 6000 7000 8000 9000 10000
Alpha = 0
Alpha = 1
Alpha = 2
Graph 4: Average Payoff, β = 1
Similarly to the hider agent vs 50/50 agent graphs pre-
viously, a homogeneous population of 50/50 agents will
form in competition with sharers if α is greater than or
equal to β.
7
3.3 Sharers vs. Hiders
0
20
40
60
80
100
120
0 1000 2000 3000 4000 5000 6000 7000 8000 9000 10000
Alpha = 0
Alpha = 1
Alpha = 2
Graph 5: Number of Sharers, β = 1
0
50
100
150
200
250
0 1000 2000 3000 4000 5000 6000 7000 8000 9000 10000
Alpha = 0
Alpha = 1
Alpha = 2
Graph 6: Average Payoff, β = 1
When sharers are matched up against hiders, hiders pre-
vail when α > β. More vivid is the effect of a large popu-
lation of sharers on the average payoffs. As the number of
sharers increases, the payoff increases, leveling off only
upon their descent.
3.4 Homogeneous Match-ups
0
50
100
150
200
0 1000 2000 3000 4000 5000 6000 7000 8000 9000 10000
Sharers
Hiders
Halfs
Graph 7: α = 0, β = 1
0
20
40
60
80
100
120
140
160
180
200
0 1000 2000 3000 4000 5000 6000 7000 8000 9000 10000
Sharers
Hiders
Halfs
Graph 8: α = 1, β = 1
0
50
100
150
200
250
0 1000 2000 3000 4000 5000 6000 7000 8000 9000 10000
Sharers
Hiders
Halfs
Graph 9: α = 2, β = 1
8
0
50
100
150
200
250
300
350
0 1000 2000 3000 4000 5000 6000 7000 8000 9000 10000
Sharers
Hiders
Halfs
Graph 10: α = 3, β = 1
These graphs verify the conclusion that if all agents
share the same strategy, it is only beneficial for both
agents to hide if α is two times β. Since there is only one
type of each agent, only the average payoffs are graphed.
The pivot point is when alpha equals two. When α is less
than two times β, sharers prevail. The payoffs of those
agents who hide only half the time remain centered be-
tween these two extremes.
3.5 Trigger Strategies
10
15
20
25
30
35
40
45
50
55
0 2000 4000 6000 8000 10000 12000 14000 16000
Number of Defectors
Graph 11: α = 2, 50 initial defectors
The great advantage of a repeated game is the ability
to develop strategies which are dependent upon the his-
tory of the repeated game. There are two simple strate-
gies which take advantage of the repeated game, the grim
trigger strategy and the friendly trigger strategy[5].
The grim trigger strategy states that if each agent en-
counters a defector, in this case, a normally sharing agent
who decides to temporarily hide, that agent will defect, or
hide, forever. In most games this results in a population of
defectors, unless the payoff for hiding is horrifically low.
The graph above is of a strategy significantly less se-
vere than grim trigger. The friendly trigger strategy, rather
than committing an agent to defect forever, will make an
agent defect for only a set number of generations. In this
case, upon competing against a defector, the agent will de-
fect for one round only, then return to sharing. All agents
in this simulation are naturally sharers, but of the one hun-
dred agents, fifty start out defecting. Alpha and beta are
at the pivot point (α = 2 β = 1) in a homogeneous envi-
ronment where hiding and sharing are equally beneficial.
Through experimentation, it turns out that in this game,
alpha is only moderately important, defectors still lose,
but a higher alpha delays their extinction. Much more
important in this experiment is the number of rounds an
agent chooses to defect. In this simple game, a number
higher than one could almost instantly lead to a system
consisting solely of defectors.
3.6 Analysis of the Repeated Game
Repeated games offer a birds eye view of a strategic
system and the ability to develop strategies incorporating
the histories of previous games. The analysis of the full
experiment will be similar to the analysis of the simple
game. Four major questions will be answered:
1. At what point is hiding information is more worth-
while than sharing information?
2. Which homogeneous environments are the most
effective at developing solutions to problems?
3. How do trigger strategies affect the population?
4. How does the problem being solved affect the out-
come?
5. Are homogeneous or heterogeneous populations
more profitable?
9
4 Public/Private Domain GP Model
The system developed is much more complex than the
simple game above. As in the game above, the full
model has multiple agents possessing different strategies
for sharing information and makes them compete in a
genetic programming environment (GPE). The problems
solved are not be a simple card game but rather an equa-
tion of variable complexity. Each problem can be solved
by some solution which would be modified inside a sep-
arate GPE which is under the control of the agent. Each
agent then controls a set of solutions and manages them
inside this private GPE. Each agent can decide to share a
certain portion of their solutions, the degree of sharing is
determined by the agent but using a strategy given to them
by a Meta-GPE.
Originally the Meta-GPE was designed to operate as
a full genetic programming environment for evolving
sharing strategies for agents. While it is fully functional
in this role, it became clear that given the relatively low
complexity of the problems solved, directly manipu-
lating the agent strategies was more illuminating. The
Meta-GPE controls the actual distribution of solutions
amongst resident agents itself, as well as the replication,
modification, and death of agents.
sn S1 S2
Agent-GPE n
Meta-GPE
s1 s2 s3
sn S1 S2
Agent-GPE 3
s1 s2 s3
sn S1 S2
Agent-GPE 2
s1 s2 s3
sn S1 S2
Agent-GPE 1
s1 s2 s3
Figure 2: Basic layout of Meta-GPE/Agent-GPE rela-
tionship
One real-world analogy of this system is that of
companies and engineers. The Meta-GPE is represented
by the market system, agents by companies, and solutions
by engineers and engineering data. Each agent, or rather
company, is it’s own GPE, with engineers and informa-
tion all striving as best they can to solve the problem
from the available knowledge base. If a company decides
to share information, it is placed in the public domain,
and becomes part of the resident knowledge of every
company.
S1 S2 S3
Agent-GPE n
Meta-GPE
s1 s2 s3
S1 S2 S3
Agent-GPE 3
s1 s2 s3
S1 S2 S3
Agent-GPE 2
s1 s2 s3
S1 S2 S3
Agent-GPE 1
s1 s2 s3
S3
Distribution of Shared Solutions
Figure 3: The sharing of public solutions at the object
level
Since agents (or rather companies) can independently
control the degree and aspect of their sharing, it is note-
worthy to mention lying. Agents may decide that the best
policy is to only share the worst solutions. It also turns
out that depending upon the problem, sharing the worst
solutions can give others the best opportunities to advance
beyond a plateau in problem.
This system changes the classical model in the follow-
ing ways:
1. Initial, random solutions will be grouped into one
or more private domains, or Agent-GPE, controlled
by a unique agent using some strategy for the sharing
or hiding of solutions.
2. Cross-over will not be able to occur between these
domains.
3. Cross breeding can occur with any solution in the
Agent-GPE, including those solutions which have
been added to the Agent-GPE via some other agent’s
sharing strategy.
4. After each generation, some set of solutions will
be placed in the “public domain” according to the
strategy used by the agent. Solutions in the public
10
domain are automatically added to all other Agent-
GPE’s for use in crossbreeding and development.
5. The set of agents and their strategies are them-
selves modified and changed in their own evolu-
tionary programming environment (Meta-GPE). The
performance of each Agent-GPE is monitored along-
side the most popular strategies used by agents.
Public Domain
Private Domains
Figure 4: Conceptual view of grouping individuals into
private domains
Figure 4 depicts the grouping of individuals into two
or more private domains, or Agent-GPEs. Groupings are
formed along hereditary lines, with all children of the
same parent belonging to the same group. The number of
groups, or private domains, in the system depends on the
number of initial agents in the system. Cross breeding
cannot occur between different groups, but would be able
to occur within a group.
Figure 5: Conceptual view of the periodic transfer of
solutions from private to a public domain
Figure 5 depicts the periodic transfer of old solutions
to a public domain. Solutions in the public domain can be
used for cross breeding by all individuals. Old solutions
still in the private domain can only be used for cross
breeding with individuals in the same private domain.
11
Public Domain
Figure 6: Full conceptual view of solution sharing (or
hiding)
Figure 6 depicts the complete model from a conceptual
standpoint, including later cross breeding with solutions
in the public domain.
If the private domain of an agent proves disproportion-
ately unsuccessful, the agent strategy can "die" to be re-
placed by a winning strategy. Originally, this agent was to
start anew using the public domain solutions as it’s base.
This was changed as the Meta-GPE usefulness as an evo-
lutionary system was degraded and it became more im-
portant for the Meta-GPE to manage strategies of agents
rather than adhere strictly to the company/patent analogy.
As is, a "new" agent uses the solutions of the dead agent.
Trigger strategies are not passed on. The analysis shows
how trigger strategies are more influential to agent success
than mixed sharing strategies.
4.1 Specifics of the Meta Genetic Program-
ming Environment
Each strategy that can be used by an agent has multiple
components. At its base is the probability as determined
by a normal curve that some solution is ripe for sharing.
The agent can modify the standard deviation of this curve
as well as its center with respect to the performance of
each solution. All solutions possessed by an agent are
tested against the problem. The best solution represents
the end of this range and the worst solution represents the
beginning.
The one exception to this is when a solution is more
than two standard deviations from the mean. During
evolution the population tends to become less diverse.
While this is a good thing, often there develops one or
two solutions in the population with extremely weak
scores. These scores drive down the selection curve from
it’s most representative shape. To compensate, these
extremely weak scoring solutions are excluded from the
selection process.
Create Initial Set of Agents
w/ Random Solutions and
Random Strategy
Agents Test Solutions
Agents select Solutions
to Share from Strategy
Selected Solutions are Injected into
the population of other agents
Solutions in Surviving Agents
are Crossbreed and Mutated
Agent Strategies are
Mutated and Agent
Reproduction occurs
based on average
agent performance.
Figure 7: Process diagram
The definition of an agent includes the standard
deviation, the position of its normal curve and any
trigger strategies that can be used by an agent. This
represents an agents strategy. The definition of an agent
also includes the set of solutions managed by the agent.
12
The Meta-GPE will keep track of all agents and their
respective strategies, evolve their strategies inside a GPE,
and redistribute solutions shared to all agents. Statistics
on the average performance, curve characteristics, and
solution set size will be recorded by the Meta-GPE. The
Meta-GPE will be written in C with standard C libraries.
It will communicate with the Agent-GPE using standard
UNIX file descriptors (which could be pipes, files, or a
network connection). This allows for the distribution of
the system across multiple machines and a better way of
managing resources.
S SSSSSSSS
Likely Shared
BestWorst
figure 8: The selection of solutions to share is based on
the normal curve [8]
4.2 Agent Strategies
Of the strategies available to an agent, the trigger strate-
gies are the most important. An agent can have any mean
and standard deviation in it’s solution sharing decisions,
but because the complexity of the problems solved is rel-
atively simple, trigger strategies similar to those described
in the simple game have a more demonstrable effect upon
an experiment.
The main strategies used (besides various sharing
strategies) are the grim strategy and the happy trigger
strategy. These strategies do not technically follow their
game theory cousins. The grim strategy is not like the
grim trigger strategy. All agents using the grim strategy
are selected at the beginning of the experiment and remain
that way. The grim strategy is not "triggered". One form
of this strategy is the “Sucker” strategy, or “grim but one”
strategy where all agents hide except for a single sharing
agent.
The happy trigger strategy was also not directly taken
from existing game theory. 3
The happy trigger strategy
was a late addition to the model.
An agent using the happy trigger strategy shares only
when the average score of the agent is below the average
score of all agents. That is, if an agent is doing better
than most of the other agents, it will not share. This has
several interesting effects on problem solving, which will
be described later.
4.3 Specifics of the Agent-Problem GPE
The GPE managed by each agent is relatively simple.
Many existing GPEs are used to solve equations. The
simplicity of using mathematical functions for testing the-
ories in genetic programming are hard to escape. Each
agent in this case uses the GALib library for it’s GPE. The
GALib[15] interface is used to add and acquire shared
agents into the agents knowledge base and evolve solu-
tions to some problem. The Agent-GPE receives informa-
tion from the Meta-GPE using xml over a file descriptor
that could either be a pipe or a network connection.
4.4 Implementation Issues
The system uses a unix process for each Agent-GPE
which communicates with the Meta-GPE using xml se-
rialized c++ objects over unix file descriptors. Network
communication using SOAP and a custom object repos-
itory were researched but not pursued after the realiza-
tion that each agent would step through generations too
quickly for a distributed architecture.
Instead, the Meta-GPE starts up each agent as a sepa-
rate process and just uses file descriptors. The c++ ob-
jects containing solutions and agent commands are seri-
alized into XML using the Eternity Persistence library.
Many modifications were required to make this library
work properly using file descriptors. Additionally, seri-
alization and deserialization took a large amount of com-
puting power.
3If the happy trigger has been used in other game theory problems, it
most likely doesn’t use the name "happy." The name “sucker” was also
an invention of the author.
13
These issues, and because of issues resulting from the
extreme simplicity of these problems, resulted in a config-
uration variable being added which cut into the size of the
solutions shared by each agent. Of all the solutions shared
by an agent, only a small percentage (one to ten percent)
are actually shared. This slows down the experiment to
the point where quantitative analysis of agent strategies
became useful.
Additionally, the population of agents, and the solution
population of each agent, was lowered to only ten individ-
uals. The mutation rate of each agent was also lowered.
Even with these modifications, agents in this experiment
solved problems in the test suite unexpectedly fast.
There is another issue that is apparent only in experi-
ments where there’s only a single sharing agent (sucker
strategy). In these experiments agents tend to be drawn
to the sharing agent and then get into a situation where
their score never changes before the 1000 generation is
reached.
Given the information at the time of writing, it is sup-
posed that this is due to the extremely small population
size of each agent, and the fact that agents left to share
with themselves reinforce their own homogeny.
Fortunatly the system doesn’t need to be modified to
support larger populations or more complex problems.
Unfortunately analysis requires simplicity in all these fac-
tors. Increasing the complexity of the experiments will
have to be relegated to future experiments.
5 Solution Sharing Model as Com-
pared to Existing Parallel Popula-
tion Models
There are existing methods for managing parallel popu-
lations and transferring certain members to and from the
populations. I’ll describe two here.
1. Hierarchal deterministic stepping stone
2. Overlapping populations
Hierarchal populations are a genetic programming de-
sign which uses multiple populations of individuals with
different performance characteristics. The best analogy is
that of our public education system. An individual might
start out at the lowest level, competing for survival only
among the lesser agents, and “graduate” to higher levels
depending upon their success. There are many variations
of this concept, but no standard toolset for their exploita-
tion [14].
Overlapping populations of individuals are used to
make effective use of two different environments, each
with specific mutation and breeding characteristics, by
sharing the certain individuals between their respective
populations. One environment might be good at basic hill
climbing, while the other might be good at getting out of
small ruts (using a higher mutation rate). The sharing of
individuals between these environments could potentially
reach a solution much faster (and more reliably) than a
single population alone [15].
The method described in this paper is essentially the
synthesis of these two methods. There’s been a decent
amount of research into the use of Meta-GPEs, and more
research should have been performed before reinventing
some of the methods discovered by others. 4
6 Summary of Major Assumptions
Three major assumptions have been made in this experi-
ment:
1. Functions can model a real-world problem space
2. Function optimization can model the innovative
process
3. Different types of innovative processes utilize
sharing differently
These assumptions will be described in detail in the
next sections.
4Part of the research problem was the lack of online resources at
the start. Many of the journals in which these articles appear are not
subscribed to by Cal Poly, and the two books on genetic algorithms at the
library are outdated by several years. It’s ironic that a research project
involving the use of sharing ran into problems with the accessibility of
related research.
14
6.1 Functions as a Model for Innovation
Can functions and a proposed solution to a function
accurately simulate a real-world problem and it’s associ-
ated solution?
Modeling forms of intellectual protectionism in an GP
system is such a leap from traditional analysis that several
assumptions must be justified. This section addresses the
first of three major assumptions that must be addressed.
This system will attempt to model the innovative
process using function optimization. Whether this rela-
tionship can be justified requires establishing a common
definition for ideas and solutions to functions that is
abstract enough for the simulation but accurate enough
so as to not lose sight of the process being modeled. The
Merriam-Websters dictionary defines an idea as:
1a: a transcendent entity that is a real pattern of which
existing things are imperfect representations (a derivative
of Plato’s definition) or c: a plan for action: Design.
Economists often describe a patentable idea using the
analogy of a recipe. An idea need not have a material con-
sequence, however an innovation should be a reasonable
solution to a problem that could be developed, deployed,
or produced. In common usage there are few notes on a
requirement for an idea to be communicated, but in the
economic and political sense there is social value placed
upon that communication.
Using these interpretations, we can outline a set of
criteria for the simulation that must be satisfied in order
to justify its role as demonstrative of this social process.
This particular list only applies to that component of the
simulation which models “ideas.”
1. Transcendence - The integrity of a simulated idea
must not be dependent upon the particulars of the
simulated “idea holder.” That is, ideas should have
the ability to be copied and transferred perfectly be-
tween individuals unless an artificial boundary (such
as intellectual protectionism) is constructed.
2. Modification - A simulated idea should have the
capability to be modified, for better or for worse and
the resulting idea should meet all criteria listed here.
3. Use - A simulated idea should attempt to solve
some problem. It should have an application. The
idea might not be a good solution, but it at least falls
within the domain of possible solutions.
The proposed system uses math functions to represent
the problem space of a field, and solutions to those func-
tions as particular ideas addressing the problem. Take,
for instance, the development of the wheel. For simplic-
ity we will exclude all other factors addressing the wheel
besides shape. It is generally agreed that the best shape
for a wheel is circular, however other shapes for a wheel
may have been in use at some time. These shapes might
have been square (roughly cut stone) or flat (planks for
sliding), but they are all shapes generally intended to fa-
cilitate movement. Using these simplifications, one might
be able to picture a unimodal graph of “mobility” vs. “de-
sign” in the development of the wheel. At one end of the
graph might appear such designs as the flat “wheel” lead-
ing to square “wheels” and at the other end of the graph
you might find oblong “wheels” (logs?) leading to pro-
gressively more circular shapes at the maxima. The line
representing this path of development can be understood
as a function. The particular shapes of “wheels” can be
understood as a solution to this function.
This type of model meets the criteria set above. So-
lutions to functions can be transferred perfectly and
“solved” repeatedly without degradation. Solutions to
functions can be modified and changed intentionally to
produce new functions. Functions have a set of possible
solutions. This set is infinite if the function is continuous.
6.2 Function Optimization as an Innovative
Process
The second major assumption is that a function space,
or a pathway through a function space can reasonably
describe the process by which ideas can evolve. There
are a few aspects of innovation which can be compared to
mathematical functions:
1. Incremental Modification - The process of devel-
oping an idea is often a piecemeal exploration of so-
lutions. Successive ideas are more often than not a
gradual modification of prior works. This is similar
15
to the stepping progress used to graph a function at a
set of n discrete points.
2. Periodic Jumps - Occasionally an unforeseen de-
velopment occurs that upsets the gradualists. Evolu-
tionary change can be overestimated, revolutionary
change can be underestimated. It’s by leaps that a so-
lution can advance beyond a plateau. This is similar
to finding random points on a graph and conducting
a gradual search from preferred points.
3. Diversification needs no coordination - The deci-
sion to diversify a solution does not require the coor-
dination of all parties. Most diversification occurs as
a result of an individual decision.
6.3 Classes of Functions and Fields of In-
vention
The wheel was mentioned earlier as a simple example of
an invention which could be represented by a simple uni-
modal graph. However this example only took into ac-
count the simple two dimensional shape of the wheel, not
the thickness, material at different points, whether there’s
an axle, or other possible wheel characteristics. The prob-
lem gets more complex the more attributes which are con-
sidered. Each attribute is another dimension, with only
one dimension being the end effectiveness of the wheel.
Very quickly, the wheel function is a complex problem
without a clear structure. Conceiving the entire shape of
the problem space and identifying the maxima instantly
is no small wonder. It is natural to adopt the plodding
incremental improvement of prior wheel solutions.
The field is complicated still by the diversification of
the problem itself. No longer would a simple log wheel
do for every purpose, but the ideal wheel for a wagon be-
comes significantly different than the ideal wheel for a
bike, or a car, or an eighteen wheeler. A seemingly sim-
ple problem can develop a grotesque problem space rather
quickly. Consideration of all variables is impossible, even
by computer.
Nevertheless, genetic algorithms can consider a reason-
ably broad set of variables quickly. While the solutions
developed might need to be shined for application, the
search for solutions can be broader and quicker than in
most development groups.
The set of equations used in this experiment should ap-
proximate reasonably complex problems that can suggest
useful sharing strategies for real-world issues.
One example of a real-world complex problem space
could be the development of nuclear weapons. The hur-
dles of producing nuclear weapons are immense, but once
certain problems are solved there is a point at which a
solution becomes fast at hand. It’s all the sub problems,
the refinement of uranium or plutonium, it’s procurement,
the ignition system, and delivery which makes a nuclear
weapon difficult to achieve for lessor developed countries.
Once some of these problems are solved, and enough vari-
ables are with in reach of the optima, development and
testing of successive versions proceeds much more speed-
ily. This problem space could be modeled as a very com-
plex surface, with a single extremely high optima com-
pared to the surrounding surface.
It’s in this type of problem space that sharing can be
useful or dreadful depending upon the agent’s perspec-
tive. For the United States, which already possess this
technology, sharing amongst agents is not desirable. For
most agents without the technology, sharing is necessary.
In fact, during the development of the atomic weapon in
the U.S. it was the eventual sharing of information be-
tween organizations that is often credited with making the
atomic bomb a reality. Because of this problem space, it is
likely that a happy trigger strategy would appear amongst
agents seeking atomic weapons. Pakistan helps Iran, Iran
helps Libya, the established nuclear states share nothing.
A fictitious problem space that exemplifies the prof-
itability of different strategies is the berry picker prob-
lem. A group of berry pickers all prefer squish berries, but
usually only find squash berries that grow nearby. There’s
only a limited number of squish berries to eat, so the berry
pickers have to choose some sharing strategy that would
get them to the squish berries first.
The berry pickers enter a dense field with only one
patch of berries somewhere in the field. There are no other
bunches of squish or squash berries in the field. This type
of problem is similar to test problem 6 in the test suite
used for this project. There is very little information about
where the berries are, and the berry pickers can only wan-
der aimlessly about hoping to run into this bunch. In this
type of situation, it is better for an agent to not share any
information. If a berry picker accidentally runs into the
bunch of berries, it is more profitable for them to keep
16
that information to themselves. It would have been better
for the common good if sharing was rampant, however.
A variation on this problem places the berry pickers
in a field with splotchy patches of berries. Every berry
picker is guaranteed some berries in this scenario, but not
many will be able to find the squish berries (of which there
are multiple bunches). Since squish berries grow nearby
squash berries, it is good for both the individual and the
group to share information. All pickers would desperately
love some information from their fellow picker on where
the best berries are. Since everyone wants information, it
only makes sense that agreements would be made to pro-
vide that information. While the happy trigger strategy
could develop from this scenario, squish berries come in a
multitude under this problem, so a picker would be more
likely to share information even after finding their first
batch of squish berries.
7 Set of Test Functions
The suite of test problems was organized from sev-
eral sources. Many were taken from the Matlab GEA
Toolbox[12] and others were derived from Yao, Xin and
Liu Yong’s paper, Fast Evolutionary Programming[3].
Attempts were made to develop several unimodal and
multimodal functions, along with specific search spaces
that genetic algorithms often fail to optimize.
Normally these functions are wrapped in summations
to increase their complexity. By modifying the func-
tions.h file new functions can be defined with a different
dimension. The functions tested here remained in three
dimensions so analysis could proceed more quickly.
[0] Simple Polynomial Function
This function has two optimum points at (10,5) and (-
10,-5) so agents can converge in two different directions.
This makes the problem hard for certain problems in
limited sharing environments.
Function Definition[-10:10]:
z = x2
+ xy − y2
17
[1] Simple Sine Based Multimodal Function
Function Definition[-10:10]:
z =
sin(x) ∗ sin(y)
x ∗ y
[2] De Jong’s function, inverted
Simple parametric, continuous, concave, unimodal[12]
Function Definition[-10:10]:
−z = x2
+ y2
18
[3] Rosenbrock’s valley, inverted
From Matlab GEA Toolbox: " Rosenbrock’s valley is
a classic optimization problem, also known as Banana
function. The global optimum is inside a long, narrow,
parabolic shaped flat valley. To find the valley is trivial,
however convergence to the global optimum is difficult
and hence this problem has been repeatedly used in
assess the performance of optimization algorithms."[12]
Agents using this problem converged too quickly,
despite it’s design. Analysis of experiments using this
problem was impossible and experiments using this
problem were disregarded.
Function Definition[-2:2]:
z = −100 ∗ (y − x2
)2
− (1 − x)2
[4] Schwefel’s Function, range adjusted
"Schwefel’s function is deceptive in that the global
minimum is geometrically distant, over the parameter
space, from the next best local minima. Therefore, the
search algorithms are potentially prone to convergence
in the wrong direction."[12][13]
Function Definition[-5:5]:
z =(x ∗ 100) ∗ sin(
2
√
x ∗ 100)+
(y ∗ 100) ∗ sin( 2
y ∗ 100)
19
[5] Ackely’s Path Function, inverted.[12]
a = 10 adjusts the "flatness"
b = .2 adjusts the height of each peak
c = pi adjusts the number of peaks
Function Definition[-5:5]:
z = − (−a ∗ exp(−b ∗ 2
(x2 + y2) ∗ 1/2)−
exp((cos(c ∗ x) + cos(c ∗ y)) ∗ 1/2) + a + exp(1))
[6] Easom’s Function
The Easom function is a unimodal test function, where
the global minimum has a small area relative to the
search space. Agents outside of this area have very little
information on it’s location. The function was inverted
for maximization.[12]
Function Definition[-9:15]:
z = cos(x) ∗ cos(y) ∗ exp(−((x − Π)2
+ (y − Π)2
))
20
8 Experiments
Thousands of experiments were performed using differ-
ent criteria and settings for agent sharing. All seven prob-
lems exhibited some general characteristics given certain
strategies, and some characteristics specific to their search
space. Shown here are some graphs from a small subset
of those experiments. Generally, a standard deviation of
20 was selected, along with a mean of 100, and a sharing
probability of 1/1000. This means that the best solutions
of an agent were set aside for sharing with in a standard
deviation of 20 percent.
All experiments only use ten agents, controlling ten so-
lutions each. 5
Despite the low population, several mea-
sures needed to be taken to slow optimization further. Be-
sides specific strategies such as the happy or grim strategy,
there was a .1 percent chance that a solution selected by
the agent was actually shared. This procedure slows down
the evolution, as the normal curve of an agent does not
have time to reach a reasonable setting before the prob-
lem is optimized by all agents. On more complex prob-
lems this probability can be increased.
The only function largely excluded from these results
is Rosenbrock’s function (3) which displayed extremely
fast optimization using all basic settings. Most of the data
from experiments using this function displayed little, if
any, useful information. In these experiments the Rosen-
brock function would be better restructured as a mini-
mization problem.
Several characteristics will be analysed in each major
experiment. For one, the average scores of all agents will
be used to evaluate the “community” benefit of a particu-
lar sharing methodology. The scores of individual agents
will be used to evaluate the “selfish” benefit of a particu-
lar sharing methodology. Third, the nature of the problem
space as it relates to the effectiveness of a strategy will be
explored.
Alongside the performance graph is a contour map of
the function with specific points overlayed representing
solutions shared in the experiment. The generations or
5A harddrive failure, followed by an equally depressing RAID con-
troller failure limited the number of tests that could have been re-run
with alternative settings. A decision was made to only re-run the data
which was most illuminating before the failures. High sharing systems
require an enormous amount of CPU horsepower, alongside a very large
amount of storage space.
agents from which these points were shared will change
depending upon the experiment and function. 6
8.1 Comparing Strategies
7
Graph 12: Performance for all Strategies on Problem 0
Typically experiments using strategies which shared
more converged on the right solution much faster than
those experiments with less sharing. There are some ex-
ceptions, however.
On hard unimodal problems (prb 1 and 6) it was much
better for the population of agents to all share than to hide,
but on hard multimodal problems (prb 5 and 4) agents
6Some scatter plots are divided into two ranges of generations, usu-
ally to distinguish between the solutions shared before and after coales-
cence. Unless otherwise specified, these will be the standard contour
maps. For various reasons involving formatting issues in the multicol
latex environment, they have no titles.
7The graphs hereafter follow a specific format. The titles on per-
formance graphs first state the problem number and then the part of se-
lection criteria for sharing solutions. Unless otherwise specified, this
criteria is always 20, 100, 10. This means that agents shared solutions
based on a normal curve with a standard deviation of 20 percent from
the center. A center of 100 means that the normal curve was moved up
to straddle to best solution. A center of 50 means that the normal curve
was centered exactly between the best and worst agents. The titles do
not include the strategy used, only the selection criteria.
21
would often converge around the wrong solution if there
was too much sharing. The grim strategy, where only one
agent doesn’t share had very similar characteristics. The
agent which did not share did not consistently have an
edge over other agents, although such a difference would
be expected over the long run depending upon the com-
plexity of the problem and the number of agents involved.
Graph 13: Performance for all Strategies on Problem 1
Graph 14: Performance for all Strategies on Problem 2
Two problems, problems 2 and 3, optimized extremely
quickly. In these problems the sharing strategy didn’t mat-
ter as much, as there was a clear path to the optimal solu-
tion, and each agent could use basic hill climbing to find
it.
Problem 3 optimized so quickly that the data generated
during experimentation was essentially useless. This data
contained very little information on how optimization was
effected by the sharing strategy. Because of this, problem
3 was removed from the analysis.
Graph 15: Performance for all Strategies on Problem 48
The sucker strategy only has one agent which shares
solutions. As a result, the other agents tend to converge
around that agent. While many agents might find better
solutions themselves, a group of agents usually splits off
to follow the sharing agent. This pattern is apparent on
all hard problems. The homogeny developed in a shar-
ing agent in these experiments is strange, and might be a
result of the low population size of each agent.
8When all agents maintained the exact score for 25 generations the
experiment was halted. This saved cpu time and the experiments which
reached this point were usually homogenous at the optima.
22
Graph 16: Performance for all Strategies on Problem 5
Typically the group of agents who didn’t share had the
slowest convergence of any group excluding those situa-
tions where a happy or sucker strategy drew a group away
from the best solution (There by often never finding the
solution at all).
Graph 17: Performance for all Strategies on Problem 6
Agents using the happy trigger strategy were surpris-
ingly effective at finding the right solution. While it
was common for less effective agents to converge on the
wrong solution, sometimes the agents would be able to
use the lesser sharing agents for diversification as the aver-
age score rose. The difference between the lesser and the
greater agents needs to be relatively small for the happy
trigger strategy to really pay off for all agents.
The happy trigger strategy was extremely valuable to
individual agents, however. Since a greater agent didn’t
need to share with the lessor agents, they often maintained
an advantage for a great length of time.
23
8.2 Function Optimization without Sharing
These experiments do not perform any sharing to provide
a control case. Agents do not group together in these ex-
periments. Only the performance graphs are shown.
Graph 18: Performance for agents on prb 0 w/o Sharing
Graph 19: Performance for agents on prb 1 w/o Sharing
Graph 20: Performance for agents on prb 2 w/o Sharing
Problems 0 and 2 are extremely simple problems,
with fast optimization times. The rest have some
difficulty in reaching the optimum, with some non-
sharing agents never finding the best solution at all.
Graph 21: Performance for agents on prb 4 w/o Sharing
24
Graph 22: Performance for agents on prb 5 w/o Sharing
Graph 23: Performance for agents on prb 6 w/o Sharing
One important observation about the non-sharing
graphs is that even when an optimum is reached, the
agents never coalesce into a single line, with only a single
solution. The agents have a tendency to mutate back and
forth around the optimal solution.
25
8.3 Normal Sharing Methodologies
Graph 24: Performance for agents on prb 0 w/ Work
These experiments use ten agents which all share infor-
mation regardless of performance. These experiments in-
volve a large number of shared solutions, and typically
optimize functions quickly.
The contour map has a scatter graph of solutions shared
during different periods of the experiment. In this case, an
attempt was made to differentiate between solutions be-
fore and after mass convergence on the optimum solution.
On this particular experiment, one agent found the op-
timum point immediately at (10,5). Most of the other
agents appear to have been converging on the other op-
timum point at (-10,-5) when the first agent finally shared
its solution at (10,5). A few agents converging on (10,5)
kept others from reaching (-10,-5) quickly.
This is an example of how sharing can get in the way of
finding a solution even if all agents are on the right track.
It shows that in certain classes of problems, indecision
and an over-abundance of information can delay success.
26
Graph 26: Performance for agents on prb 1 w/ Work
This experiment is interesting for several reasons. First,
the depressions around the optima tended to deter many
agents. Most agents would start outside these depres-
sions and never find the optima until a nearby solution
was shared.
Occasionally, when the parameters of the experiment
were modified so that only the worst solutions of agents
were shared, the population would actually converge
faster than similar runs when the best solutions were
shared. This demonstrates how lying, or misinformation
can often lead to a global optima faster than good faith
efforts to share the best solutions.
27
Graph 28: Performance for agents on prb 2 w/ Work
The optimization of problem 2 using normal sharing
methods is unremarkable, and is provided here as a refer-
ence for comparison with the optimization of this problem
using the happy trigger strategy analysed later.
All of the solutions shared here are very good, and the
population converges on the optima quickly.
28
Graph 30: Performance for agents on prb 4 w/ Work
Problem 4 is an extremely hard problem even for normal
sharing techniques. This problem displays similar behav-
ior to normal sharing on problem one in that the agents
started to converge on two different points.
Since there is only one optima in this problem, how-
ever, the agents that found and shared this optima eventu-
ally brought over the whole population to the proper solu-
tion.
29
Graph 32: Performance for agents on prb 5 w/ Work
This is another difficult problem, as it’s multimodal nature
again delays optimization. The red dot on the contour map
shows that early on a solution with in striking distance of
the optima was shared.
The solution shared wasn’t ideal, and while it managed
to carry over a few agents. The agent that shared the solu-
tion initially had not converged internally before the 100th
generation.
Several agents split off independently from the main
group to find the optima quickly, although one converged
on the wrong optima until the main group superceded it.
This is a common pattern in sharing experiments. Often
there are a handful of extremely successful agents, fol-
lowed by a group of lessor agents which feed off the best
shared solutions.
In a system where information is heavily shared, unless
an agent finds a successful solution independently, it will
most likely fall into a group of less successful agents that
reinforce their inferiority.
30
Graph 34: Performance for agents on prb 6 w/ Work
This problem demonstrates a more extreme version of the
reinforced inferiority problem. Most agents failed to find
an optimum solution by themselves, and so they tended to
converge on the same solutions. Their close proximity to
each other allowed all agents to find the optima at nearly
the same time, but their lack of diversification delayed this
event until the 60th generation.
The one agent which found the optima quickly ignored
all the solutions shared by the lesser agents, and therefore
didn’t get drawn into group think like the others.
Still, this experiment faired better than similar ones
where agents didn’t share at all. In many of the other
experiments a handful of agents would optimize and the
rest would never find a good solution at all. This prob-
lem exaggerates issues with convergence in sharing mech-
anisms.
31
8.4 Grim Strategies
Graph 36: Performance for agents on prb 1 w/ Grim
These experiments use a single agent which does not
share. This is the first agent (2) in the graphs, so a pat-
tern is sought that might identify it as a more successful
agent in a population of sharers.
The the overwhelming majority of experiments, how-
ever, systems using the grim strategy did not display
vastly different results than those using normal sharing
techniques. This is because only one agent is actually hid-
ing information.
While the effects of this strategy might be more appar-
ent in a system with fewer agents, or systems with higher
sharing on complex problems, these experiments did not
produce any identifiable advantage to a hider in a popula-
tion of sharers.
32
8.5 Sucker Strategies
Graph 38/39: Performance for agents on prb 0 w/ Sucker - Scatter graph of all solutions shared by agent
These experiments have all but one agent hiding solu-
tions. Only one agent shares solutions, so patterns based
around this situation are to be identified. There is, how-
ever, a potential bug with the system when using strategies
such as this.
In this problem, the solitary sharer has failed to find the
optimum point at all. This is fairly uncommon, as a sharer
has nearly the same chance of finding an optimum as the
other agents. In this case, the agent seems split between
the two optima. The contour map shows all solutions that
the agent attempted to share during the experiment.
An analysis of the data reveals that the last solutions
maintained by the agent were entirely composed of the so-
lutions (-6.30872, -3.54026) and (3.06628,-4.94651). The
agents population of solution appears to be changing pe-
riodically even though the agents score doesn’t change.
More information is needed to determine why this oc-
curs. It could indicate a bug in the system, however the
same thing occurs with hiding agents that are drawn to the
shared solutions. Most likely, the GaLib library doesn’t
function as well with the Bin2Dec genome type used and
only 10 solutions per agent. The sharing agent reinforces
a homogenous population and directs itself to a stagnated
solution. Because of this only two experiments will be
shown including this one, as the results may be unreli-
able. It is unfortunate that this problem was discovered
late in analysis.
Despite this significant issue, it is hoped that certain
characteristics can still be identified.
33
Graph 40: Performance for agents on prb 4 w/ Sucker
Agents tend to converge around the solutions provided by
the single sharing agent. While a few agents might opti-
mize quickly by themselves, many tend to fall behind the
sharer. If a solitary sharer (a sucker) is going to be the
only one sharing, it’s going to drag a lot of agents down
with it (Suckers Revenge).
While the coalescence described earlier is expected, it
would also be expected that agents captured by the sharer
would not adhere strictly to the sharing agents solutions.
Since there is a long period of time between shared solu-
tions other agents should have plenty of time to conduct
broad searches. Future experiments should increase the
complexity of problems to allow for a greater population
of solutions per agent.
34
8.6 Happy Trigger Strategies
Graph 42: Performance for agents on prb 0 w/ Happy
In these experiments agents only share if their average
score is below the average score of all agents. If an agent
is performing very well compared to other agents, it will
not help other agents. The effects of this strategy are sim-
ilar to the “Sucker” (Grim but one) strategy previously
shown, except that any agent, or set of agents, can become
the “sucker”
Once again, it appears as if the same issue appears with
sharing agents involving the stagnation of scores, though
to a much lesser degree.
In this experiment, agents very quickly reach an op-
tima. The solutions shared during each generation pro-
gressively improves along side the entire population of
agents.
35
Graph 44: Performance for agents on prb 2 w/ Happy
Comparing this experiment to the normal sharing ex-
periment strategy using problem 2, there’s a clear divi-
sion between agents who successfully found the optima,
and those who reinforced their own inferiority with shar-
ing. While the problem is extremely simple, the fact that
agents only shared solutions which were worse than aver-
age usually resulted in this split.
Despite this split, however, experiments using this
strategy often coalesced to an optima faster than most
other strategies (The normal sharing strategy usually had
all agents finding the optima first). Not only did this strat-
egy seem to benefit the lead agent, but it seems to benefit
the population as a whole.
36
Graph 46: Performance for agents on prb 5 w/ Happy
In this experiment several lesser agents developed a ho-
mogenous set of solutions through sharing, but one man-
aged to break off early and find the optima before it had a
chance to share.
Note that despite the fairly static scores in sharers, there
is still evolution occurring. This lends credibility to the
idea that these experiments are best performed on much
more complex problems with much larger solution popu-
lations for each agent.
37
Graph 48: Performance for agents on prb 6 w/ Happy
The interesting thing about this experiment is how the
lesser agents found better solutions in concert. One agent
kept the average score high, and all the sharing agents de-
pended upon the diversity of their group to find the op-
tima. When one of these lesser agents discovered a better
solution, they all migrated to a better solution set.
38
9 Conclusions
The model described, while admittedly abstract, describes
a method of experimenting with the control of information
in a competitive environment. The game theory approach
to this problem allows for many interesting applications
from psychology to copyright controls.
While conceived as a way for finding specific Nash
equilibria for different sharing strategies on different
problems this paper is just the initial forays into the
subject. The model requires complexity beyond what
could be performed at this time for hard numbers and
specific heuristics on the best sharing mechanisms.
Nevertheless several specific observations can be
made:
1. Sharing usually solves problems faster
2. On hard unimodal problems, sharing is good for
group but bad for the individual
3. On easy unimodal problems, sharing is not very
useful
4. On hard multimodal problems, limited sharing is
necessary for the group
5. On hard multimodal problems, too much sharing
can lead to convergence on the wrong solution
6. The happy trigger strategy is extremely beneficial
to individual agents, but can lead to convergence on
the wrong solution for less successful agents.
7. Using the happy trigger strategy, it is best for the
population if a very large number of agents are be-
low average, rather than just a few. These agents can
depend on the diversity of other lesser agents to find
an optimal solution eventually.
8. A agent doesn’t profit by sharing when all others
don’t, but can often force other agents to converge
on the wrong solution (Sucker’s Revenge).
10 Future Experiments
It is hoped that the techniques and simple conclusions
reached here will lead to a more detailed and lengthy set
of experiments with greater complexity and more interest-
ing strategies. This paper and the system constructed is a
good starting point for future projects.
Great efforts to design new and different experiments
need to be undertaken to come to a more complete set
of conclusions. More computing resources are also re-
quired given the required complexity. Analysis was con-
strained to problems that can be represented on a three
dimensional surface. While this allowed for great insight,
specific data requires analysis be performed without the
benefit of visualization aids.
Once specific information can be produced, and proba-
bilities generated, a game theory approach more similar to
the analysis of the simple game can be used in developing
heuristics.
11 Glossary
Agent: An individual of the Meta-GPE possessing a set
of solutions and a strategy for the sharing of those
solutions. The Agent strategy can be mutated by the
Meta-GPE.
Agent-GPE: The genetic programming environment for
each Agent, containing solutions to be modified and
crossbreed.
Cross Breeding: The combining of solutions to develop
a new child solution. Only the Agent-GPE employs
crossbreeding.
Happy Trigger: A sharing strategy where agents only
share if their score is less than the mean score of all
agents.
Grim Strategy: A sharing strategy where one or more
agents do not share. While derived from the grim
trigger strategy, it is not to be confused with it as the
grim strategy isn’t “triggered”
Individual: A member of some genetic programming en-
vironment which can be mutated and/or crossbreed,
killed, and reproduced.
39
Meta-GPE: The genetic programming environment for
the each problem being solved, containing Agents
whose strategies can be modified.
Mutation: The modification of a solution to develop a
new child solution. Both the Meta-GPE and Agent-
GPE employ mutation.
Nash Equilibria: The strategies, mixed or otherwise,
which are evolutionarily stable.
Normal Sharing: A sharing strategy where all agents
share at an equal level.
Private Domain: The set of Private Solutions.
Private Solution: A solution which is only used by a sin-
gle agent.
Problem: A mathematical function with a number of un-
known variables. One variable is selected to be max-
imized.
Problem Space: The set of all possible solutions to a par-
ticular problem.
Public Domain: The set of Public Solutions.
Public Solution: A solution which is shared between all
agents.
Solution: A set of values which satisfies the problem be-
ing solved. An individual of the Agent-GPE.
Sucker Strategy: A sharing strategy where only one agent
shares and all others hide.
Suckers Revenge: A situation where a solitary sharing
agent drags down other agents into developing un-
successful sets of homogenous populations of solu-
tions.
Strategy: The chance that any particular solution in an
Agent-GPE will be shared, as defined by the center
and standard deviation of the normal curve if (after
testing) all solutions of an agent are ranked with zero
being the worst solution and one being the best solu-
tion.
40
References
[1] Harrald, Paul G. Evolutionary Algorithms and Economic Models: A View. Evolutionary Programming V, Pro-
ceedings of the Fifth Annual Conference on Evolutionary Programming, p. 4, 1996
[2] Boldrin, Michele and Levine, David. The Case Against Intellectual Monopoly, (http://levine.sscnet.ucla.edu),
Draft Chapters 1 & 2, 2003.
[3] Yao, Xin and Liu, Yong. Fast Evolutionary Programming. Evolutionary Programming V, Proceedings of the Fifth
Annual Conference on Evolutionary Programming, p. 451, 1996
[4] US Patent and Trademark Office, Website
[5] Heitkoetter, Joerg and Beasley, David. The Hitch-Hikers Guide to Evolutionary Computation,
(http://www.faqs.org/faqs/ai-faq/genetic), 2001
[6] Gintis, Herbert. Game Theory Evolving, A Problem-Centered Introduction to Modeling Strategic Interaction,
Princeton University Press, 2000
[7] Neumann, John Von, Morgenstern, Oskar. Theory of Games and Economic Behavior, Princeton University Press,
1944
[8] David Eccles School of Business. Normal Curve Image. Self Administered Statistics Test,
(http://www.business.utah.edu/masters/stattest/normal_table.htm),
[9] Levent Koçkesen, Economics W4415, Columbia University, Lecture notes,
(http://www.columbia.edu/ lk290/gameug.htm),
[10] Boost File Descriptor Stream Wrapper, (http://www.josuttis.com/cppcode),
[11] Eternity Persistence Library, (http://www.winghands.it/prodotti/eternity/overview.html),
[12] Matlab GEA Toolbox, (http://www.geatbx.com/docu/fcnfun2.html),
[13] Schwefel, H.-P. Numerical optimization of computer models, Chichester: Wiley Sons, 1981.
[14] Abrams, J. Paul. A Hierarchal Genetic Algorithm for the Travelling Salesman Problem. 95.495 Honours Project,
Carleton University, School of Computer Science, Winter, 2003
[15] Matthew’s Genetic Algorithms Library (GAlib), (http://lancet.mit.edu/ga/),
41
Simple Game Source Code
/* simple.c
Simple Repeated Card Game
John V. Kew II
Includes the ability to use different combinations
of agents in competition, including homogenous
combinations. Also includes the ability to employ
trigger strategies.
Making a command-line interface just wasn’t worth it.
*/
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
/* Run Profiles
Basic settings for certian classes of
experiments. Global settings can be adjusted in all
experiments. Replace "int" with desired integer, and
order AGENT_ORDER depending upon the matchup desired.
Global Settings -
NUMAGENTS int
GENERATIONS int
SEXINTERVAL int
DEATHS int
MUTANTCHANCE int
ALPHA int
BETA int
ZETA int
Three Agents
TYPES 3.0
GRIM_TRIGGER 0
FRIENDLY_TRIGGER 0
AGENT_ORDER {Sharer,Half,Hider}
Two Agents
TYPES 2.0
GRIM_TRIGGER 0
FRIENDLY_TRIGGER 0
AGENT_ORDER {Sharer,Half,Hider}
42
Homogenous Population
TYPES 1.0
AGENT_ORDER {Sharer,Half,Hider}
GRIM_TRIGGER 0
FRIENDLY_TRIGGER 0
Grim Trigger -
GRIM_TRIGGER 1
FRIENDLY_TRIGGER 0
FT_DURATION 0
AGENT_ORDER {Sharer,Half,Hider}
TYPES 1.0
INITIAL_DEFECTORS int
Friendly Trigger -
FRIENDLY_TRIGGER 1
GRIM_TRIGGER 0
FT_DURATION int
AGENT_ORDER {Sharer,Half,Hider}
TYPES 1.0
INITIAL_DEFECTORS int
Card Tables:
static int samecard[2][2][2] = { { {BETA, BETA}, {BETA, BETA} },
{ {BETA, BETA}, {BETA, BETA} } };
static int greater[2][2][2] = { { {BETA, BETA}, {ZETA, ALPHA} },
{ {BETA, BETA}, {ZETA, ALPHA} } };
static int lessor[2][2][2] = { { {BETA, BETA}, {BETA, BETA} },
{ {ALPHA, ZETA}, {ALPHA, ZETA} } };
*/
#define NUMAGENTS 100 /* Number of Agents in System, int */
#define GENERATIONS 15000 /* Number of Generations, int */
#define SEXINTERVAL 100 /* Rate of Reproduction,
In Generations */
#define DEATHS 5 /* Number of Deaths per Rep. Interval */
#define MUTANTCHANCE 1 /* Percent chance of Mutation, int */
#define ALPHA 2 /* Alpha payoff rate, int - See Table*/
#define BETA 1 /* Beta payoff rate, int */
#define ZETA 0 /* Zeta payoff rate, int */
#define TYPES 1.0 /* Number of Agent Types, of type
double, used to control the nature of
the run */
43
#define GRIM_TRIGGER 0 /* Grim trigger to hider state, boolean,
GRIM_TRIGGER and FRIENDLY_TRIGGER are mutually
exclusive */
#define FRIENDLY_TRIGGER 1 /* Friendly trigger to hider state */
#define FT_DURATION 1 /* Duration of the friendly trigger */
#define AGENT_ORDER {Sharer,Half,Hider} /* Agent order, used in conjuction
with "TYPES" to control nature
of run */
#define INITIAL_DEFECTORS 50 /* Initial Sharers defecting as hiders
in trigger run */
/* Cutoffs for the draw probabilities */
#define SAMECUT 3
#define GREATERCUT 27
#define TOTALPROB 53.0
void q_sort(unsigned int [][], int, int);
int main() {
int i,j,agent,agentnum,draw,value,trigger;
int decision1,decision2;
int sharers = 0,hiders = 0,halfs = 0, triggered = 0;
double average_score = 0, last_ave = 0, total_pot = 0;
/* Agent[NUMAGENTS] = [type][payoff][trigger state/count] */
unsigned int pool[NUMAGENTS][3];
/* Card Tables */
static int samecard[2][2][2] = { { {BETA, BETA}, {BETA, BETA} },
{ {BETA, BETA}, {BETA, BETA} } };
static int greater[2][2][2] = { { {BETA, BETA}, {ZETA, ALPHA} },
{ {BETA, BETA}, {ZETA, ALPHA} } };
static int lessor[2][2][2] = { { {BETA, BETA}, {BETA, BETA} },
{ {ALPHA, ZETA}, {ALPHA, ZETA} } };
/* Ordering of the agent types */
enum type AGENT_ORDER;
srand(time(0));
/* Randomly Initialize Equal Proportions of Agents */
for (i = 0; i < NUMAGENTS; i++) {
pool[i][0] = (int) (TYPES*rand()/(RAND_MAX+1.0));
pool[i][1] = 0; /* Total Value of Game to Agent */
pool[i][2] = 0; /* The finger is off the trigger */
}
44
if (GRIM_TRIGGER || FRIENDLY_TRIGGER)
for (i = 0; i < INITIAL_DEFECTORS; i++)
pool[i][2] = 1;
for (i = 0; i < GENERATIONS; i++) {
halfs = 0;
sharers = 0;
hiders = 0;
triggered = 0;
for (j = 0; j < NUMAGENTS; j+=2) {
/* j is our first agent, agentnum is our second agent
- but moved to j+1 */
agentnum = j + 1 +
(int) (((double)(NUMAGENTS-1-j))*rand()/(RAND_MAX+1.0));
agent = pool[agentnum][0];
value = pool[agentnum][1];
trigger = pool[agentnum][2];
pool[agentnum][0] = pool[j+1][0];
pool[agentnum][1] = pool[j+1][1];
pool[agentnum][2] = pool[j+1][2];
pool[j+1][0] = agent;
pool[j+1][1] = value;
pool[j+1][2] = trigger;
/* Agent one decision making */
/* For the 50/50’s Decide what to do, and count the agent types */
if (pool[j][0] == Half) {
decision1 = (int) (2.0*rand()/(RAND_MAX+1.0));
halfs++;
} else {
if (pool[j][0] == Sharer) {
decision1 = 0;
sharers++;
} else if (pool[j][0] == Hider) {
decision1 = 1;
hiders++;
}
}
/* Agent two special case decision making */
if (pool[j+1][0] == Half) {
decision2 = (int) (2.0*rand()/(RAND_MAX+1.0));
halfs++;
} else {
if (pool[j+1][0] == Sharer) {
45
decision2 = 0;
sharers++;
} else if (pool[j+1][0] == Hider) {
decision2 = 1;
hiders++;
}
}
/* Trigger Decisions */
if (pool[j][2] != 0) {
triggered++;
decision1 = 1;
if (pool[j][2] > 0)
pool[j][2]--; /* decrement the FT Counter */
}
if (pool[j+1][2] != 0) {
triggered++;
decision2 = 1;
if (pool[j+1][2] > 0)
pool[j+1][2]--; /* decrement the FT Counter */
}
/* Draw the cards and play the game */
draw = 1 + (int) (TOTALPROB*rand()/(RAND_MAX+1.0));
if (draw <= SAMECUT) {
pool[j][1] += samecard[decision2][decision1][1];
pool[j+1][1] += samecard[decision2][decision1][0];
} else if (draw > SAMECUT && draw <= GREATERCUT) {
pool[j][1] += greater[decision2][decision1][1];
pool[j+1][1] += greater[decision2][decision1][0];
} else {
pool[j][1] += lessor[decision2][decision1][1];
pool[j+1][1] += lessor[decision2][decision1][0];
}
total_pot = pool[j][1] + pool[j+1][1];
if (GRIM_TRIGGER) {
if (decision1 == 1)
pool[j+1][2] = -1;
if (decision2 == 1)
pool[j][2] = -1;
}
if (FRIENDLY_TRIGGER) {
if (decision1 == 1)
46
pool[j+1][2] = FT_DURATION;
if (decision2 == 1)
pool[j][2] = FT_DURATION;
}
}
average_score = total_pot / NUMAGENTS;
total_pot = 0;
/* Reporting */
printf("%d %d %d %d %f %f %dn",i,sharers,hiders,halfs,average_score,
average_score - last_ave, triggered);
last_ave = average_score;
/* Reproduction of most successful agents */
if (i % SEXINTERVAL != 0)
continue;
q_sort(pool, 0, NUMAGENTS - 1);
for (j = 0; j < DEATHS; j++) {
pool[j][0] = pool[NUMAGENTS - 1 - j][0];
pool[j][1] = pool[NUMAGENTS - 1 - j][1];
pool[j][2] = pool[NUMAGENTS - 1 - j][2]; /* active defectors
replicate too */
if ((1 + (int) (100.0*rand()/(RAND_MAX+1.0))) == MUTANTCHANCE)
pool[j][0] = (int) ((TYPES)*rand()/(RAND_MAX+1.0));
}
}
return 0;
}
/* Quick sort code copied and modified from Michael Lamont’s
Knowledge Base at http://linux.wku.edu/~lamonml/kb.html and
distributed under the Open Publication License (the latest
version is presently available at http://www.opencontent.org/openpub/).
*/
void q_sort(unsigned int numbers[NUMAGENTS][3], int left, int right)
{
int pivot, l_hold, r_hold, pivot_data, more_data;
l_hold = left;
r_hold = right;
pivot = numbers[left][1];
pivot_data = numbers[left][0];
more_data = numbers[left][2];
while (left < right)
47
{
while ((numbers[right][1] >= pivot) && (left < right))
right--;
if (left != right)
{
numbers[left][1] = numbers[right][1];
numbers[left][0] = numbers[right][0];
numbers[left][2] = numbers[right][2];
left++;
}
while ((numbers[left][1] <= pivot) && (left < right))
left++;
if (left != right)
{
numbers[right][0] = numbers[left][0];
numbers[right][1] = numbers[left][1];
numbers[right][2] = numbers[left][2];
right--;
}
}
numbers[left][1] = pivot;
numbers[left][0] = pivot_data;
numbers[left][2] = more_data;
pivot = left;
left = l_hold;
right = r_hold;
if (left < pivot)
q_sort(numbers, left, pivot-1);
if (right > pivot)
q_sort(numbers, pivot+1, right);
}
48
Meta-GPE Source Code
#ifndef META_H
#define META_H
#include "eternity/eternity.hpp"
/* DEFAULT SETTINGS */
#define NUMAGENTS 100 /* Number of Agents in System, int */
#define GENERATIONS 100 /* Number of Generations, int */
#define SEXINTERVAL 100 /* Rate of Reproduction,
In Generations */
#define DEATHS 5 /* Number of Deaths per Rep. Interval */
#define MUTANTCHANCE 1 /* Percent chance of Mutation, int */
#define GRIM_TRIGGER 0 /* Grim trigger to hider state, boolean,
GRIM_TRIGGER and FRIENDLY_TRIGGER are
mutually exclusive */
#define FRIENDLY_TRIGGER 1 /* Friendly trigger to hider state */
#define FT_DURATION 1 /* Duration of the friendly trigger */
#define INITIAL_DEFECTORS 50 /* Initial Sharers defecting as hiders
in trigger run */
int create_agent(int fd[2],agent_control); /* send initial control file */
int step_agent(int fd[2],agent_control); /* send incremental control file */
solution_set collect_solutions(int fd[2]); /* get solutions from agent and put it in
big solution_set */
agent_stats agent_report(int fd[2]); /* get agent report, add to big stats */
void q_sort(vector< vector<double> > &numbers, int left, int right); /* sort
function */
static void sig_pipe(int);
static void sig_chld(int);
class meta_control {
public:
unsigned int dimen;
int loval;
int hival;
int prb;
unsigned int agent_popsize;
float agent_pmut;
float agent_pcross;
unsigned int initial_sdev;
unsigned int initial_mean;
unsigned int random_select;
49
unsigned int popsize;
unsigned int ngen;
unsigned int sex_interval;
unsigned int select_prob;
unsigned int deaths;
unsigned int mutant_chance;
unsigned int grim_trigger;
unsigned int friendly_trigger;
unsigned int ft_duration;
unsigned int initial_defectors;
int seed;
void xml_serialize( xml_archive &xml) {
if (xml.is_loading()) {
xml.read("dimen",dimen,0);
xml.read("loval",loval,0);
xml.read("hival",hival,0);
xml.read("prb",prb,0);
xml.read("select_prob", select_prob, 0);
xml.read("agent_popsize",agent_popsize,0);
xml.read("agent_pmut",agent_pmut,0);
xml.read("agent_pcross",agent_pcross,0);
xml.read("initial_sdev", initial_sdev,0);
xml.read("initial_mean", initial_mean,0);
xml.read("random_select", random_select,0);
xml.read("popsize",popsize,0);
xml.read("ngen",ngen,0);
xml.read("sex_interval",sex_interval,0);
xml.read("deaths",deaths,0);
xml.read("mutant_chance",mutant_chance,0);
xml.read("grim_trigger",grim_trigger,0);
xml.read("friendly_trigger",friendly_trigger,0);
xml.read("ft_duration",ft_duration,0);
xml.read("initial_defectors",initial_defectors,0);
xml.read("seed",seed,0);
} else {
xml.write("dimen",dimen);
xml.write("loval",loval);
xml.write("hival",hival);
xml.write("prb",prb);
xml.write("select_prob", select_prob);
xml.write("agent_popsize",agent_popsize);
xml.write("agent_pmut",agent_pmut);
xml.write("agent_pcross",agent_pcross);
50
xml.write("initial_sdev", initial_sdev);
xml.write("initial_mean", initial_mean);
xml.write("random_select", random_select);
xml.write("popsize",popsize);
xml.write("ngen",ngen);
xml.write("sex_interval",sex_interval);
xml.write("deaths",deaths);
xml.write("mutant_chance",mutant_chance);
xml.write("grim_trigger",grim_trigger);
xml.write("friendly_trigger",friendly_trigger);
xml.write("ft_duration",ft_duration);
xml.write("initial_defectors",initial_defectors);
xml.write("seed",seed);
}
}
};
#endif
#ifndef MAIN_C
#define MAIN_C
#include <iostream>
#include <list>
#include <vector>
#include <time.h>
#include <error.h>
#include <signal.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <sys/socket.h>
#include <sys/stat.h>
#include <unistd.h>
#include "agent.h"
#include "statistics.h"
#include "solution_set.h"
#include "boost/fdstream.hpp"
#include "meta.h"
using namespace std;
static void sig_pipe(int signo) {
cout << "SIGPIPE caught" << endl;
51
}
static void sig_chld(int signo) {
waitpid(-1,NULL,WNOHANG);
}
int create_agent(int fd[2], agent_control ac) {
int pid;
xml_archive out;
fd[0] = 0;
fd[1] = 0;
// create pipe
if (socketpair(AF_UNIX, SOCK_STREAM, 0, fd) < 0)
perror("Error Setting up Pipe");
if ( (pid = fork()) < 0 )
perror("Error forking");
else if (pid == 0) {
/* Advanced Programming in the Unix Enviroment pg 477 */
close(fd[0]);
if (fd[1] != STDIN_FILENO)
if (dup2(fd[1],STDIN_FILENO) != STDIN_FILENO)
perror("dup2 error in stdin redirect");
if (fd[1] != STDOUT_FILENO)
if (dup2(fd[1],STDOUT_FILENO) != STDOUT_FILENO)
perror("dup2 error in stdout redirect");
if (execl("agent", "agent", "load", "", NULL) < 0)
perror("Agent exec error");
} else {
close(fd[1]);
fd[1] = pid;
boost::fdostream outStream(fd[0]);
out.open("",archive::store, (std::iostream* ) &outStream);
ac.xml_serialize(out);
out.close();
}
return 1;
}
int step_agent(int fd[2], agent_control ac) {
xml_archive out;
boost::fdostream outStream(fd[0]);
out.open("",archive::store, (std::iostream* ) &outStream);
ac.xml_serialize(out);
outStream.clear();
out.close();
52
return 1;
}
solution_set collect_solutions(int fd[2]) {
solution_set ss;
xml_archive in;
xml_archive debug;
if (kill(fd[1],SIGALRM) < 0)
perror("Unable to signal Agent");
boost::fdistream inStream(fd[0]);
in.open("",archive::load, (std::iostream* ) &inStream);
ss.xml_serialize(in);
inStream.clear();
in.close();
ss.prune();
return ss;
}
agent_stats agent_report(int fd[2]) {
agent_stats as;
xml_archive in;
boost::fdistream inStream(fd[0]);
in.open("",archive::load, (std::iostream* ) &inStream);
as.xml_serialize(in);
inStream.clear();
in.close();
// cout << "(" << as.ave_score << ")" << endl;
return as;
}
int main(int argc, char **argv) {
int i,j,agent,agentnum,draw,value,trigger;
int fd[2];
int end_count = 50;
char datafile[25];
char agentfile[25];
char status[25];
int s;
ofstream ssdat;
ofstream afile;
ofstream stats;
double ave, last_ave;
vector < vector<double> > pool;
vector <double> a;
53
meta_control mc;
agent_control ac;
agent_stats as;
solution_set ss;
solution_set shared_set;
xml_archive archive;
xml_archive sharedata;
xml_archive debug;
bool cfgwrite;
bool happy_trigger;
char * cfg_file = 0;
ave = last_ave = 0;
mc.dimen = ac.dimen = 2;
mc.loval = ac.loval = -5;
mc.hival = ac.hival = 5;
mc.prb = ac.prb = 0;
mc.initial_sdev = 20;
mc.initial_mean = 50;
mc.random_select = 0;
mc.agent_popsize = ac.popsize = 100;
mc.agent_pmut = ac.pmut = .01;
mc.agent_pcross = ac.pcross = .6;
mc.select_prob = 100;
mc.popsize = NUMAGENTS;
mc.ngen = ac.ngen = GENERATIONS;
mc.sex_interval = SEXINTERVAL;
mc.deaths = DEATHS;
mc.mutant_chance = MUTANTCHANCE;
mc.grim_trigger = GRIM_TRIGGER;
mc.friendly_trigger = FRIENDLY_TRIGGER;
mc.ft_duration = FT_DURATION;
mc.initial_defectors = INITIAL_DEFECTORS;
mc.seed = ac.seed = 0;
if (argc < 2) {
cout << "Using a config file:" << endl;
cout << "meta load [file]" << endl;
cout << "Creating a default config file:" << endl;
cout << "meta write [file]" << endl;
return 0;
}
54
for(int i=1; i<argc; i++) {
if(strcmp(argv[i],"load") == 0) {
cfg_file = argv[++i];
cfgwrite = false;
continue;
} else
if(strcmp(argv[i],"write") == 0) {
cfg_file = argv[++i];
cfgwrite = true;
continue;
}
}
if (cfg_file == 0) {
cout << "A config file must be specified with either ";
cout << ""load" or "write"" << endl;
return 0;
}
if (cfgwrite) {
archive.open(cfg_file, archive::store);
mc.xml_serialize(archive);
archive.close();
} else {
archive.open(cfg_file, archive::load);
mc.xml_serialize(archive);
archive.close();
}
sprintf(datafile,"data/M-%d-%d-%d.txt", mc.prb, mc.popsize, mc.ngen);
ssdat.open(datafile);
cout << "Writing Shared Solution Data to " << datafile << endl;
sprintf(datafile,"data/S-%d-%d-%d.txt", mc.prb, mc.popsize, mc.ngen);
stats.open(datafile);
cout << "Writing Statistics to " << datafile << endl;
cout << "Agent Shared Solutions are in AS-" << mc.prb;
cout << "-" << mc.popsize << "-" << mc.ngen << "-[AGENT #]" << endl;
/* Setup Default Agent Control Object */
ac.dimen = mc.dimen;
ac.loval = mc.loval;
ac.hival = mc.hival;
ac.prb = mc.prb;
ac.popsize = mc.agent_popsize;
ac.pmut = mc.agent_pmut;
55
ac.pcross = mc.agent_pcross;
ac.ngen = mc.ngen;
ac.seed = mc.seed;
if (!mc.seed)
srand(time(0));
//reset pipe max to system max
// setup signal handlers
if (signal(SIGPIPE, sig_pipe) == SIG_ERR)
perror("Error Setting up SIGPIPE Handler");
if (signal(SIGCHLD, sig_chld) == SIG_ERR)
perror("Error Setting up SIGCHLD Handler");
cout << "Creating Agents" << endl;
for (i = 0; i < mc.popsize; i++) {
/* Create Agent */
a.push_back(i); /* Agent ID */
cout << "(" << a[0] << "," << i << ")";
a.push_back(0); /* Last Sucess Value of Agent */
a.push_back(0); /* The finger is off the trigger */
if (mc.random_select) {
a.push_back((int) (100.0*rand()/(RAND_MAX+1.0))); /* Position, in percent
value of normal curve */
a.push_back((int) (100.0*rand()/(RAND_MAX+1.0))); /* Standard Deviation of the
normal curve, int */
} else {
a.push_back(mc.initial_mean);
a.push_back(mc.initial_sdev);
}
a.push_back(0); /* 1st fd */
a.push_back(0); /* pid */
pool.push_back(a);
fd[0] = (int) a[5];
fd[1] = (int) a[6];
ac.id = (int) a[0];
ac.center = a[3];
ac.stddev = a[4];
ac.seed = time(0) + i;
if (!create_agent(fd,ac))
perror("Error spawning agent");
cout << ".[" << ac.id << "]";
pool[i][5] = fd[0];
pool[i][6] = fd[1];
a.clear();
}
56
a.clear();
a.resize(mc.popsize, 0);
cout << endl << "Setting Initial Defectors" << endl;
if (mc.grim_trigger || mc.friendly_trigger)
for (i = 0; i < mc.initial_defectors; i++)
if (mc.grim_trigger)
pool[i][2] = -1; /* Agent will defect permenantly */
else
pool[i][2] = mc.ft_duration;
if (mc.ft_duration == -2) /* Happy Trigger is set */
happy_trigger = true;
cout << "Starting Evolution" << endl;
for (i = 0; i < mc.ngen; i++) {
cout << "GENERATION " << i << " [";
stats << i << " ";
/* Test Agents */
/* Distribution of Solutions */
//ac.shared = shared_set;
for (j = 0; j < mc.popsize; j++) {
fd[0] = (int) pool[j][5];
fd[1] = (int) pool[j][6];
ac.id = (int) pool[j][0];
ac.center = pool[j][3];
ac.stddev = pool[j][4];
if (!step_agent(fd,ac))
perror("Error stepping agent");
cout << ".";
cout.flush();
}
/* Set Triggers */
/* Reporting */
cout << "]-R-[";
cout.flush();
shared_set.clear();
last_ave = ave;
ave = 0;
for (j = 0; j < mc.popsize; j++) {
ss.clear();
fd[0] = (int) pool[j][5];
fd[1] = (int) pool[j][6];
ac.id = (int) pool[j][0];
ac.center = pool[j][3];
57
ac.stddev = pool[j][4];
as = agent_report(fd);
ss = collect_solutions(fd);
/* Do something with the statistics */
/* get a listing of agent scores ordered by agent id */
pool[j][1] = a[((int) pool[j][0])] = as.ave_score;
ave += as.ave_score;
sprintf(agentfile,"data/AS-%d-%d-%d-%d.txt", mc.prb, mc.popsize, mc.ngen,
(int) ac.id);
afile.open(agentfile, ofstream::out | ofstream::app);
afile << "# Generation " << i << endl;
ss.write(afile);
afile.close();
/* add in solution set */
/* p/10000 only add solutions if not triggered */
if (pool[j][2] == 0 || (happy_trigger && i > 0 && as.ave_score <= last_ave) ){
shared_set.add_some_solutions(mc.select_prob,ss);
} else
if (mc.friendly_trigger)
pool[j][2]--; /* Decrement the friendly trigger */
cout << ".";
cout.flush();
}
ssdat << "# Generation " << i << endl;
shared_set.write(ssdat);
ave = ave / mc.popsize;
for (j = 0; j < mc.popsize; j++)
stats << a[j] << " ";
stats << ave << " " << shared_set.size() << endl;
cout << "][" << ave << "]-S-[" << shared_set.size() << "]";
/* The Shared Solutions are about the only thing that is easily shared
off of one file... this can be a very large file */
sharedata.open("current_shared_solutions.xml", archive::store);
shared_set.xml_serialize(sharedata);
sharedata.close();
/* Writing Shared Solutions to Data File*/
//ssdat << i << " " << shared_set.size() << " ";
ssdat.flush();
//ssdat << endl;
/* Notify agents that the solutions are available */
for (j = 0; j < mc.popsize; j++)
58
if (kill((int)pool[j][6],SIGALRM) < 0)
perror("Unable to signal Agent");
/* Reproduction of most successful agents, Death, and Mutation */
cout << "-S-";
if (i % mc.sex_interval != 0)
continue;
q_sort(pool, 0, mc.popsize - 1);
if (pool[0][1] == pool[mc.popsize - 1][1]) {
if (!end_count) {
cout << endl << "Worst Agent Score Equals Best Agent Score" << endl;
cout << "Killing agents:";
for (j = 0; j < mc.popsize; j++) {
if (kill((int)pool[j][6],SIGKILL) < 0)
perror("Unable to signal Agent");
cout << ".";
}
cout << endl;
break;
} else
end_count--;
} else if (end_count != 50)
end_count = 50;
cout << "M-";
for (j = 0; j < mc.deaths; j++) {
// Mark Agent Death
//sprintf(agentfile,"data/AS-%d-%d-%d-%d.txt", mc.prb, mc.popsize, mc.ngen, j);
//afile.open(agentfile, ofstream::out | ofstream::app);
//afile << "# AGENT DEATH" << i << endl;
//afile.close();
cout << "[" << pool[j][0] << "," << pool[mc.popsize - 1 - j][0] << "]";
cout << "[" << pool[j][1] << "," << pool[mc.popsize - 1 - j][1] << "]";
//pool[j][0] = i + pool[j][0]/1000; /* New Agent ID = gen.(deadid/1000) */
pool[j][1] = pool[mc.popsize - 1 - j][1]; /* Score */
//pool[j][2] = pool[mc.popsize - 1 - j][2]; /* active defectors */
pool[j][3] = pool[mc.popsize - 1 - j][3]; /* Curve Position */
pool[j][4] = pool[mc.popsize - 1 - j][4]; /* Std Dev*/
/* replicate too */
/* Insert Mutation Code Here */
if (((int) (100.0*rand()/RAND_MAX+1.0)+1) <= mc.mutant_chance) {
draw = 0;
if (pool[j][3] < 100 & pool[j][3] > 0)
draw = ((int) (3.0*rand()/RAND_MAX+1)) - 2;
59
pool[j][3] += draw;
cout << "[" << draw << ",";
draw = 0;
if (pool[j][4] < 100 & pool[j][4] > 0)
draw = ((int) (3.0*rand()/RAND_MAX+1)) - 2;
pool[j][4] += draw;
cout << draw << "]";
}
}
cout << "DONE" << endl;
cout.flush();
}
cout << endl;
ssdat.close();
stats.close();
return 0;
}
/* Quick sort code copied and modified from Michael Lamont’s
Knowledge Base at http://linux.wku.edu/~lamonml/kb.html and
distributed under the Open Publication License (the latest
version is presently available at http://www.opencontent.org/openpub/).
*/
void q_sort(vector< vector<double> > &numbers, int left, int right)
{
double pivot;
int l_hold, r_hold, i;
double data[7];
l_hold = left;
r_hold = right;
pivot = numbers[left][1];
for (i=0; i < 7; i++)
data[i] = numbers[left][i];
while (left < right)
{
while ((numbers[right][1] >= pivot) && (left < right))
right--;
if (left != right)
{
for (i=0; i < 7; i++)
numbers[left][i] = numbers[right][i];
left++;
}
60
while ((numbers[left][1] <= pivot) && (left < right))
left++;
if (left != right)
{
for (i=0; i < 7; i++)
numbers[right][i] = numbers[left][i];
right--;
}
}
for (i=0; i < 7; i++)
numbers[left][i] = data[i];
pivot = left;
left = l_hold;
right = r_hold;
if (left < pivot)
q_sort(numbers, left, (int) pivot-1);
if (right > pivot)
q_sort(numbers, (int) pivot+1, right);
}
#endif
61
Agent-GPE Source Code
#ifndef AGENT_H
#define AGENT_H
#define BITS 31
#define PI (3.1415926535897932384626433832795028841971693993751f)
#include <iostream>
#include "eternity/eternity.hpp"
#include "solution_set.h"
#include "functions.h"
#include <ga/ga.h>
using namespace eternity;
// These functions unfortunatly assume a relatively even distribution
// Periodically there will be a very, very low solution which will
// throw everything for a loop. Replace with one that only considers
// a max and min as less then 2 std deviations.
/* This function adjusts the mean given by the Meta-GPE for use
in selecting individuals from the Agent-GPE’s population. It assumes
that the given mean is from zero to 100
This function does not actually calculate a mean.
realMax = maximum of population
realMin = minimum of population
givenMean = mean if score range was 1-100
*/
float adjMean(float realMax, float realMin, float givenMean) {
//cout << (((realMax - realMin)/100)*givenMean + realMin) << " new mean" << endl;
return (((realMax - realMin)/100)*givenMean + realMin);
}
/* This function adjusts the given standard deviation to match the
current population */
float adjStddev(float realMax, float realMin, float givenStddev) {
//cout << (((realMax - realMin)/100)*givenStddev) << " new sd" << endl;
return (((realMax - realMin)/100)*givenStddev);
}
/* Excludes low scoring solutions more than two stddev from mean from selection.
62
As a population evolves, there’s a tendancy for solutions to have less
diversification. Ussually, however, there is a small number of individuals
who by mutation or breeding have extremely weak scores. This shifts the
center of the population down, and scews results. By excluding any individual
more than two standard deviations from the actual mean of the populations we
shift the center a little bit higher.
rMax = max of pop
rMin = min of pop
rMean = mean of pop
rStddev = stddev of pop
gMean = center to map to
*/
float adjMean95(float rMax, float rMin, float rMean, float rStddev, float gMean) {
float min, max;
if (rMin < (rMean - 2*rStddev))
min = (rMean - 2*rStddev);
else
min = rMin;
max = rMax;
return adjMean(max,min,gMean);
}
/* Excludes low scoring solutions more than two stddev from stddev of selection.
rMax = max of pop
rMin = min of pop
rMean = mean of pop
rStddev = stddev of pop
gMean = center to map to
*/
float adjStddev95(float rMax, float rMin, float rMean, float rStddev, float gStddev){
float min, max;
if (rMin < (rMean - 2*rStddev))
min = (rMean - 2*rStddev);
else
min = rMin;
max = rMax;
return adjStddev(max,min,gStddev);
}
class agent_control {
63
final
final
final
final
final
final
final
final
final
final
final
final
final
final
final
final
final
final
final
final
final
final
final
final
final
final
final
final
final
final

More Related Content

What's hot

IRJET- Deep Neural Network based Mechanism to Compute Depression in Socia...
IRJET-  	  Deep Neural Network based Mechanism to Compute Depression in Socia...IRJET-  	  Deep Neural Network based Mechanism to Compute Depression in Socia...
IRJET- Deep Neural Network based Mechanism to Compute Depression in Socia...
IRJET Journal
 
Memetic algorithms
Memetic algorithmsMemetic algorithms
Memetic algorithms
MohammedAlKazal
 
AI for drug discovery
AI for drug discoveryAI for drug discovery
AI for drug discovery
Deakin University
 
Neuroecon Seminar Pres
Neuroecon Seminar PresNeuroecon Seminar Pres
Neuroecon Seminar Pres
tkvaran
 
organic information design
organic information designorganic information design
organic information design
rosa qin
 
I0704047054
I0704047054I0704047054
I0704047054
IJERD Editor
 
T OWARDS A S YSTEM D YNAMICS M ODELING M E- THOD B ASED ON DEMATEL
T OWARDS A  S YSTEM  D YNAMICS  M ODELING  M E- THOD B ASED ON  DEMATELT OWARDS A  S YSTEM  D YNAMICS  M ODELING  M E- THOD B ASED ON  DEMATEL
T OWARDS A S YSTEM D YNAMICS M ODELING M E- THOD B ASED ON DEMATEL
ijcsit
 
On Machine Learning and Data Mining
On Machine Learning and Data MiningOn Machine Learning and Data Mining
On Machine Learning and Data Mining
butest
 
A SYSTEM OF SERIAL COMPUTATION FOR CLASSIFIED RULES PREDICTION IN NONREGULAR ...
A SYSTEM OF SERIAL COMPUTATION FOR CLASSIFIED RULES PREDICTION IN NONREGULAR ...A SYSTEM OF SERIAL COMPUTATION FOR CLASSIFIED RULES PREDICTION IN NONREGULAR ...
A SYSTEM OF SERIAL COMPUTATION FOR CLASSIFIED RULES PREDICTION IN NONREGULAR ...
ijaia
 
Supervised Multi Attribute Gene Manipulation For Cancer
Supervised Multi Attribute Gene Manipulation For CancerSupervised Multi Attribute Gene Manipulation For Cancer
Supervised Multi Attribute Gene Manipulation For Cancer
paperpublications3
 
pln_ecan_agi_16
pln_ecan_agi_16pln_ecan_agi_16
pln_ecan_agi_16
EEPCO
 
Human in the loop: Bayesian Rules Enabling Explainable AI
Human in the loop: Bayesian Rules Enabling Explainable AIHuman in the loop: Bayesian Rules Enabling Explainable AI
Human in the loop: Bayesian Rules Enabling Explainable AI
Pramit Choudhary
 
Data mining in support of fraud management
Data mining in support of fraud managementData mining in support of fraud management
Data mining in support of fraud management
Stefano Maria De' Rossi
 
Depression Detection in Tweets using Logistic Regression Model
Depression Detection in Tweets using Logistic Regression ModelDepression Detection in Tweets using Logistic Regression Model
Depression Detection in Tweets using Logistic Regression Model
ijtsrd
 
10 9242 it geo-spatial information for managing ambiguity(edit ty)
10 9242 it  geo-spatial information for managing ambiguity(edit ty)10 9242 it  geo-spatial information for managing ambiguity(edit ty)
10 9242 it geo-spatial information for managing ambiguity(edit ty)
IAESIJEECS
 
Are Evolutionary Algorithms Required to Solve Sudoku Problems
Are Evolutionary Algorithms Required to Solve Sudoku ProblemsAre Evolutionary Algorithms Required to Solve Sudoku Problems
Are Evolutionary Algorithms Required to Solve Sudoku Problems
csandit
 
A SURVEY ON QUESTION ANSWERING SYSTEMS: THE ADVANCES OF FUZZY LOGIC
A SURVEY ON QUESTION ANSWERING SYSTEMS: THE ADVANCES OF FUZZY LOGICA SURVEY ON QUESTION ANSWERING SYSTEMS: THE ADVANCES OF FUZZY LOGIC
A SURVEY ON QUESTION ANSWERING SYSTEMS: THE ADVANCES OF FUZZY LOGIC
cscpconf
 
Thomas
ThomasThomas
Thomas
Sunghun Kang
 

What's hot (18)

IRJET- Deep Neural Network based Mechanism to Compute Depression in Socia...
IRJET-  	  Deep Neural Network based Mechanism to Compute Depression in Socia...IRJET-  	  Deep Neural Network based Mechanism to Compute Depression in Socia...
IRJET- Deep Neural Network based Mechanism to Compute Depression in Socia...
 
Memetic algorithms
Memetic algorithmsMemetic algorithms
Memetic algorithms
 
AI for drug discovery
AI for drug discoveryAI for drug discovery
AI for drug discovery
 
Neuroecon Seminar Pres
Neuroecon Seminar PresNeuroecon Seminar Pres
Neuroecon Seminar Pres
 
organic information design
organic information designorganic information design
organic information design
 
I0704047054
I0704047054I0704047054
I0704047054
 
T OWARDS A S YSTEM D YNAMICS M ODELING M E- THOD B ASED ON DEMATEL
T OWARDS A  S YSTEM  D YNAMICS  M ODELING  M E- THOD B ASED ON  DEMATELT OWARDS A  S YSTEM  D YNAMICS  M ODELING  M E- THOD B ASED ON  DEMATEL
T OWARDS A S YSTEM D YNAMICS M ODELING M E- THOD B ASED ON DEMATEL
 
On Machine Learning and Data Mining
On Machine Learning and Data MiningOn Machine Learning and Data Mining
On Machine Learning and Data Mining
 
A SYSTEM OF SERIAL COMPUTATION FOR CLASSIFIED RULES PREDICTION IN NONREGULAR ...
A SYSTEM OF SERIAL COMPUTATION FOR CLASSIFIED RULES PREDICTION IN NONREGULAR ...A SYSTEM OF SERIAL COMPUTATION FOR CLASSIFIED RULES PREDICTION IN NONREGULAR ...
A SYSTEM OF SERIAL COMPUTATION FOR CLASSIFIED RULES PREDICTION IN NONREGULAR ...
 
Supervised Multi Attribute Gene Manipulation For Cancer
Supervised Multi Attribute Gene Manipulation For CancerSupervised Multi Attribute Gene Manipulation For Cancer
Supervised Multi Attribute Gene Manipulation For Cancer
 
pln_ecan_agi_16
pln_ecan_agi_16pln_ecan_agi_16
pln_ecan_agi_16
 
Human in the loop: Bayesian Rules Enabling Explainable AI
Human in the loop: Bayesian Rules Enabling Explainable AIHuman in the loop: Bayesian Rules Enabling Explainable AI
Human in the loop: Bayesian Rules Enabling Explainable AI
 
Data mining in support of fraud management
Data mining in support of fraud managementData mining in support of fraud management
Data mining in support of fraud management
 
Depression Detection in Tweets using Logistic Regression Model
Depression Detection in Tweets using Logistic Regression ModelDepression Detection in Tweets using Logistic Regression Model
Depression Detection in Tweets using Logistic Regression Model
 
10 9242 it geo-spatial information for managing ambiguity(edit ty)
10 9242 it  geo-spatial information for managing ambiguity(edit ty)10 9242 it  geo-spatial information for managing ambiguity(edit ty)
10 9242 it geo-spatial information for managing ambiguity(edit ty)
 
Are Evolutionary Algorithms Required to Solve Sudoku Problems
Are Evolutionary Algorithms Required to Solve Sudoku ProblemsAre Evolutionary Algorithms Required to Solve Sudoku Problems
Are Evolutionary Algorithms Required to Solve Sudoku Problems
 
A SURVEY ON QUESTION ANSWERING SYSTEMS: THE ADVANCES OF FUZZY LOGIC
A SURVEY ON QUESTION ANSWERING SYSTEMS: THE ADVANCES OF FUZZY LOGICA SURVEY ON QUESTION ANSWERING SYSTEMS: THE ADVANCES OF FUZZY LOGIC
A SURVEY ON QUESTION ANSWERING SYSTEMS: THE ADVANCES OF FUZZY LOGIC
 
Thomas
ThomasThomas
Thomas
 

Viewers also liked

Yourprezi
YourpreziYourprezi
Yourprezi
Eriika Meneses
 
Cellulosic ethanol at industrial scale with PROESAtm!
Cellulosic ethanol at industrial scale with PROESAtm! Cellulosic ethanol at industrial scale with PROESAtm!
Cellulosic ethanol at industrial scale with PROESAtm!
Michelle Marrone
 
Kinase effects on kinetochore strength
Kinase effects on kinetochore strengthKinase effects on kinetochore strength
Kinase effects on kinetochore strength
Jonathan Driver
 
El plàncton
El plànctonEl plàncton
El plàncton
missconxi
 
Hack your growth
Hack your growthHack your growth
Hack your growth
Niels De Keizer
 
덴마크 사람들처럼 저자강연회 카드뉴스
덴마크 사람들처럼 저자강연회 카드뉴스덴마크 사람들처럼 저자강연회 카드뉴스
덴마크 사람들처럼 저자강연회 카드뉴스
승희 박
 
MSCertificates
MSCertificatesMSCertificates
MSCertificates
Will Page
 
FINAL Hispania 2014 - Urban Planning & Design _ Rationale & Itinerary
FINAL Hispania 2014 - Urban Planning & Design _ Rationale & ItineraryFINAL Hispania 2014 - Urban Planning & Design _ Rationale & Itinerary
FINAL Hispania 2014 - Urban Planning & Design _ Rationale & Itinerary
John Holland
 
Stoffels_Interview
Stoffels_InterviewStoffels_Interview
Stoffels_Interview
Nicolas White
 
Fall Protection Program for Terminal 7D
Fall Protection Program for Terminal 7DFall Protection Program for Terminal 7D
Fall Protection Program for Terminal 7D
Dwayne Kipple
 
Ecosystem Forum 2015
Ecosystem Forum 2015Ecosystem Forum 2015
Ecosystem Forum 2015
Jonathan Leung
 
Sanering fajar fadhilah hasan
Sanering fajar fadhilah hasanSanering fajar fadhilah hasan
Sanering fajar fadhilah hasan
Fajarhasan
 
You Have Website Traffic. Now What?
You Have Website Traffic. Now What?You Have Website Traffic. Now What?
You Have Website Traffic. Now What?
Relevance
 

Viewers also liked (15)

Yourprezi
YourpreziYourprezi
Yourprezi
 
конференция
конференцияконференция
конференция
 
Cellulosic ethanol at industrial scale with PROESAtm!
Cellulosic ethanol at industrial scale with PROESAtm! Cellulosic ethanol at industrial scale with PROESAtm!
Cellulosic ethanol at industrial scale with PROESAtm!
 
Kinase effects on kinetochore strength
Kinase effects on kinetochore strengthKinase effects on kinetochore strength
Kinase effects on kinetochore strength
 
El plàncton
El plànctonEl plàncton
El plàncton
 
Hack your growth
Hack your growthHack your growth
Hack your growth
 
덴마크 사람들처럼 저자강연회 카드뉴스
덴마크 사람들처럼 저자강연회 카드뉴스덴마크 사람들처럼 저자강연회 카드뉴스
덴마크 사람들처럼 저자강연회 카드뉴스
 
MSCertificates
MSCertificatesMSCertificates
MSCertificates
 
FINAL Hispania 2014 - Urban Planning & Design _ Rationale & Itinerary
FINAL Hispania 2014 - Urban Planning & Design _ Rationale & ItineraryFINAL Hispania 2014 - Urban Planning & Design _ Rationale & Itinerary
FINAL Hispania 2014 - Urban Planning & Design _ Rationale & Itinerary
 
Stoffels_Interview
Stoffels_InterviewStoffels_Interview
Stoffels_Interview
 
Fall Protection Program for Terminal 7D
Fall Protection Program for Terminal 7DFall Protection Program for Terminal 7D
Fall Protection Program for Terminal 7D
 
Ecosystem Forum 2015
Ecosystem Forum 2015Ecosystem Forum 2015
Ecosystem Forum 2015
 
Sanering fajar fadhilah hasan
Sanering fajar fadhilah hasanSanering fajar fadhilah hasan
Sanering fajar fadhilah hasan
 
Velikaya otechestvennaya voyna
Velikaya otechestvennaya voynaVelikaya otechestvennaya voyna
Velikaya otechestvennaya voyna
 
You Have Website Traffic. Now What?
You Have Website Traffic. Now What?You Have Website Traffic. Now What?
You Have Website Traffic. Now What?
 

Similar to final

Genetic algorithm fitness function
Genetic algorithm fitness functionGenetic algorithm fitness function
Genetic algorithm fitness function
Prof Ansari
 
A conceptual design of analytical hierachical process model to the boko haram...
A conceptual design of analytical hierachical process model to the boko haram...A conceptual design of analytical hierachical process model to the boko haram...
A conceptual design of analytical hierachical process model to the boko haram...
Alexander Decker
 
Predictive job scheduling in a connection limited system using parallel genet...
Predictive job scheduling in a connection limited system using parallel genet...Predictive job scheduling in a connection limited system using parallel genet...
Predictive job scheduling in a connection limited system using parallel genet...
Mumbai Academisc
 
Prediction of Euro 50 Using Back Propagation Neural Network (BPNN) and Geneti...
Prediction of Euro 50 Using Back Propagation Neural Network (BPNN) and Geneti...Prediction of Euro 50 Using Back Propagation Neural Network (BPNN) and Geneti...
Prediction of Euro 50 Using Back Propagation Neural Network (BPNN) and Geneti...
AI Publications
 
Survey: Biological Inspired Computing in the Network Security
Survey: Biological Inspired Computing in the Network SecuritySurvey: Biological Inspired Computing in the Network Security
Survey: Biological Inspired Computing in the Network Security
Eswar Publications
 
Genetic algorithm
Genetic algorithmGenetic algorithm
Genetic algorithm
Respa Peter
 
Project Abstract
Project AbstractProject Abstract
Project Abstract
Mat Berretta Magari
 
Parallel evolutionary approach paper
Parallel evolutionary approach paperParallel evolutionary approach paper
Parallel evolutionary approach paper
Priti Punia
 
A Research Platform for Coevolving Agents.doc
A Research Platform for Coevolving Agents.docA Research Platform for Coevolving Agents.doc
A Research Platform for Coevolving Agents.doc
butest
 
A Research Platform for Coevolving Agents.doc
A Research Platform for Coevolving Agents.docA Research Platform for Coevolving Agents.doc
A Research Platform for Coevolving Agents.doc
butest
 
A Research Platform for Coevolving Agents.doc
A Research Platform for Coevolving Agents.docA Research Platform for Coevolving Agents.doc
A Research Platform for Coevolving Agents.doc
butest
 
DALL-E 2 - OpenAI imagery automation first developed by Vishal Coodye in 2021...
DALL-E 2 - OpenAI imagery automation first developed by Vishal Coodye in 2021...DALL-E 2 - OpenAI imagery automation first developed by Vishal Coodye in 2021...
DALL-E 2 - OpenAI imagery automation first developed by Vishal Coodye in 2021...
MITAILibrary
 
Applying Machine Learning to Agricultural Data
Applying Machine Learning to Agricultural DataApplying Machine Learning to Agricultural Data
Applying Machine Learning to Agricultural Data
butest
 
C H I 9 5 M O S A I C OF CREATIVITY - May 7 1 1 1995 P a p e.docx
C H I  9 5 M O S A I C OF CREATIVITY - May 7 1 1 1995 P a p e.docxC H I  9 5 M O S A I C OF CREATIVITY - May 7 1 1 1995 P a p e.docx
C H I 9 5 M O S A I C OF CREATIVITY - May 7 1 1 1995 P a p e.docx
jasoninnes20
 
The potential role of ai in the minimisation and mitigation of project delay
The potential role of ai in the minimisation and mitigation of project delayThe potential role of ai in the minimisation and mitigation of project delay
The potential role of ai in the minimisation and mitigation of project delay
Pieter Rautenbach
 
List the problems that can be efficiently solved by Evolutionary P.pdf
List the problems that can be efficiently solved by Evolutionary P.pdfList the problems that can be efficiently solved by Evolutionary P.pdf
List the problems that can be efficiently solved by Evolutionary P.pdf
infomalad
 
An Essay Concerning Human Understanding Of Genetic Programming
An Essay Concerning Human Understanding Of Genetic ProgrammingAn Essay Concerning Human Understanding Of Genetic Programming
An Essay Concerning Human Understanding Of Genetic Programming
Jennifer Roman
 
Efficient reasoning
Efficient reasoningEfficient reasoning
Efficient reasoning
unyil96
 
Mechanism Design Theory
Mechanism Design TheoryMechanism Design Theory
Mechanism Design Theory
Hamid Y. Javanbakht
 
Final Report
Final ReportFinal Report
Final Report
imu409
 

Similar to final (20)

Genetic algorithm fitness function
Genetic algorithm fitness functionGenetic algorithm fitness function
Genetic algorithm fitness function
 
A conceptual design of analytical hierachical process model to the boko haram...
A conceptual design of analytical hierachical process model to the boko haram...A conceptual design of analytical hierachical process model to the boko haram...
A conceptual design of analytical hierachical process model to the boko haram...
 
Predictive job scheduling in a connection limited system using parallel genet...
Predictive job scheduling in a connection limited system using parallel genet...Predictive job scheduling in a connection limited system using parallel genet...
Predictive job scheduling in a connection limited system using parallel genet...
 
Prediction of Euro 50 Using Back Propagation Neural Network (BPNN) and Geneti...
Prediction of Euro 50 Using Back Propagation Neural Network (BPNN) and Geneti...Prediction of Euro 50 Using Back Propagation Neural Network (BPNN) and Geneti...
Prediction of Euro 50 Using Back Propagation Neural Network (BPNN) and Geneti...
 
Survey: Biological Inspired Computing in the Network Security
Survey: Biological Inspired Computing in the Network SecuritySurvey: Biological Inspired Computing in the Network Security
Survey: Biological Inspired Computing in the Network Security
 
Genetic algorithm
Genetic algorithmGenetic algorithm
Genetic algorithm
 
Project Abstract
Project AbstractProject Abstract
Project Abstract
 
Parallel evolutionary approach paper
Parallel evolutionary approach paperParallel evolutionary approach paper
Parallel evolutionary approach paper
 
A Research Platform for Coevolving Agents.doc
A Research Platform for Coevolving Agents.docA Research Platform for Coevolving Agents.doc
A Research Platform for Coevolving Agents.doc
 
A Research Platform for Coevolving Agents.doc
A Research Platform for Coevolving Agents.docA Research Platform for Coevolving Agents.doc
A Research Platform for Coevolving Agents.doc
 
A Research Platform for Coevolving Agents.doc
A Research Platform for Coevolving Agents.docA Research Platform for Coevolving Agents.doc
A Research Platform for Coevolving Agents.doc
 
DALL-E 2 - OpenAI imagery automation first developed by Vishal Coodye in 2021...
DALL-E 2 - OpenAI imagery automation first developed by Vishal Coodye in 2021...DALL-E 2 - OpenAI imagery automation first developed by Vishal Coodye in 2021...
DALL-E 2 - OpenAI imagery automation first developed by Vishal Coodye in 2021...
 
Applying Machine Learning to Agricultural Data
Applying Machine Learning to Agricultural DataApplying Machine Learning to Agricultural Data
Applying Machine Learning to Agricultural Data
 
C H I 9 5 M O S A I C OF CREATIVITY - May 7 1 1 1995 P a p e.docx
C H I  9 5 M O S A I C OF CREATIVITY - May 7 1 1 1995 P a p e.docxC H I  9 5 M O S A I C OF CREATIVITY - May 7 1 1 1995 P a p e.docx
C H I 9 5 M O S A I C OF CREATIVITY - May 7 1 1 1995 P a p e.docx
 
The potential role of ai in the minimisation and mitigation of project delay
The potential role of ai in the minimisation and mitigation of project delayThe potential role of ai in the minimisation and mitigation of project delay
The potential role of ai in the minimisation and mitigation of project delay
 
List the problems that can be efficiently solved by Evolutionary P.pdf
List the problems that can be efficiently solved by Evolutionary P.pdfList the problems that can be efficiently solved by Evolutionary P.pdf
List the problems that can be efficiently solved by Evolutionary P.pdf
 
An Essay Concerning Human Understanding Of Genetic Programming
An Essay Concerning Human Understanding Of Genetic ProgrammingAn Essay Concerning Human Understanding Of Genetic Programming
An Essay Concerning Human Understanding Of Genetic Programming
 
Efficient reasoning
Efficient reasoningEfficient reasoning
Efficient reasoning
 
Mechanism Design Theory
Mechanism Design TheoryMechanism Design Theory
Mechanism Design Theory
 
Final Report
Final ReportFinal Report
Final Report
 

final

  • 1. Senior Project: Private/Public Domain Strategies Using a Genetic Programming System John V. Kew II Computer Science Department California Polytechnic State University 1
  • 2. Senior Project: Private/Public Domain Strategies Using a Genetic Programming System John V. Kew II Computer Science Department California Polytechnic State University San Luis Obispo, CA 93407 jkew@calpoly.edu 24th April 2004 “The useful arts are reproductions or new combinations by the wit of man, of the same natural benefactors.” - Ralph Waldo Emerson, Nature Abstract The system detailed in this paper is designed for analyz- ing when it is better to hide or share information in a com- petitive environment. This system can be used for simple analysis of competitive or inventive processes, with a pri- vate domain of information and public domain of infor- mation, and can be used as a basis for exploring more spe- cific public/private domain problems such as copyright, business, or psychology. The model emulates the creative process by grouping solutions together in one or more “domains” representing a set of information which can be used by an agent. The intersection of these domains is the public set of informa- tion which can be used by any agent in the system for the purpose of crossbreeding and mutation. Variations on this theme include delayed dispersal of information, falsifica- tion of information, and selective dispersal. Only selec- tive dispersal will be explored, however the model can be easily modified to support these variations. Individuals have no barriers to mutation and cross breeding within their domains but are not able to cross breed with other domains. The children of an individual in a domain would remain in that domain but not part of the public domain intersection. Originally the system was designed to find a mixed Nash equilibrium for the sharing of information on dif- ferent types of problems. Achieving this goal would have required enormous computing resources and time spent in analysis. It was more profitable to analyze different par- ticular strategies on different classes of problems. 1 Introduction There are numerous economic models which take advan- tage of genetic programming. A lot of economic decision- making can be viewed as the trek through a particular search space of possibilities by agents seeking equilib- rium. Rather than developing a specific set of agents which have set strategies at each decision point, a model using genetic programming could develop these strategies over the course of changing economic parameters[1] and show how private control aids in the development of ideas. This system hopes to describe a method of exploring the benefits of information sharing on certain innovative or competitive processes. It is not entirely strange to use genetic programming in investigating strategies of private control on the success of solutions regarding a particular problem. Spec- ulation on the effect of various policies is rampant among economists, psychologists, and lawyers[2]. A computing 2
  • 3. model which can describe these policies is not a broad leap into wonderland. Use of genetic programming in game theory is rampant, and this model simply adjusts a classic payoff scheme to represent the search for a solu- tion to a problem. The model described is one which changes the classi- cal GP system to simulate the propagation of ideas in an environment where there is private control and a public reservoir of solutions. This model could be used to evalu- ate the relative success of lessor or greater control policies on certain classes of problems or address aspects of policy which might better facilitate the development of ideas. The methods by which ideas are shared in this system differs from existing sharing mechanisms in that specific strategies can be assigned to each agent and modified dur- ing the simulation. Most GP sharing methods are de- signed to solve a specific problem quickly. This system is designed to determine the best sharing method for a in- dividuals or a group trying to solve a particular problem. This model cannot prove or disprove the usefulness of patents or copyright as the profit motive of intellectual monopoly cannot be modeled without “profit”, and the economic system surrounding it. It also can’t determine specific effects of lying, managerial techniques or other instances where information is hidden. First described will be the classic genetic programming model. Next, there will be a discussion of game theory as it relates to this experiment. The Public/Private Domain EP model will then be outlined along with issues discov- ered during implementation followed by an address of the assumptions made developing the model. The classes of problems that can be represented by this model will be looked at and lastly there will be an analysis of the exper- iments performed with the system. 2 Background Information One of the most difficult aspects of this system is stan- dardizing the vocabulary used to describe it. Originally this project was to deal directly with copyright and patent issues. The terms used in the study of economics and in- tellectual property must then be mapped to terms used in genetic programming. Lack of a consistent vocabu- lary would leave both economists and computer scientists confused. The suggested model is also a very broad repre- sentation of real-world intellectual property, making one to one relationships between terms extremely difficult. The vocabulary describing individuals and the problem being solved will be mathematical. The vocabulary de- scribing information dispersal and modification will be taken from evolutionary game theory. This generaliza- tion means that this paper could apply to any situation where two or more groups hide information from each other while developing an idea or process. Game theory was the saving grace for this project. I used Herbert Gintis’s book, Game Theory Evolving along with Von Neumann’s Theory of Games and Economic Be- havior extensively in this project. While my handle on game theory is still rough the concepts explored in those texts matched perfectly with concepts I was trying to ex- plore with this project, but that didn’t have a standard computer science or mathematical description. My sud- den immersion in this field has given me the impetus to explore more advanced issues in game theory. 2.1 Classical Evolutionary Programming John R. Koza, a leader in genetic programming recently wrote in the February 2003 issue of Scientific American: Evolution is an immensely powerful cre- ative process. From the intricate biochemistry of individual cells to the elaborate structure of the human unimaginable complexity. Evo- lution achieves these fears with a few sim- ple processes–mutation, sexual recombination and natural selection–which it iterates for many generations. Now computer programmers are harnessing software versions of these same pro- cesses to achieve machine intelligence. Called genetic programming, this technique has de- signed computer programs and electronic cir- cuits that perform specified functions. Evolutionary programming (EP) and genetic algo- rithms (GA) utilize the same basic concept. The primary difference between the two methods is in how the problem is encoded. GAs typically encode problems using fixed length tokens, where as in EP there are no limitations on the representation[5]. Both are methods by which a solu- tion to a problem can be sought out utilizing the processes of natural selection and breeding. 3
  • 4. A set of n random solutions, called individuals are ini- tialized and their success is tested against the problem us- ing some sort of fitness function. The solutions which perform better than others are copied, randomly modi- fied, and mixed with other successful solutions for the next “generation” of individuals. The process then restarts until a satisfactory solution is achieved. This process can only be performed inside of a computer, but the solutions generated by genetic programming systems have often been surprising and innovative. generation W W W W W W L L L L L Figure 1: Generic genetic/evolutionary programming Figure 1 depicts a generic genetic programming pro- cess. Individuals, or solutions, are boxes, the solid lines represent a basic mutation from the parent and the dotted- dashed lines represent a cross over operation between a successful( [W]inner ) individual in the previous genera- tion and a newer individual. Individuals which perform badly ( [L]oser ) do not contribute material for the next generation of individuals. The dependent variables in this type of system include the number of children produced by a successful individ- ual, degree of mutation, probability of cross over, degree of cross over, and number of individuals in each genera- tion. In a classic GP system, these probabilities are deter- mined by a normal distribution, however sometimes re- searchers have chosen different types of distributions to change the search performance of the system on certain types of problems.[3] Variables such as the population size and selection size are chosen beforehand. The prob- lem, solution characteristics, and fitness function are also carefully developed beforehand. An GP system is halted at a predetermined time or when the solution meets some criteria. 2.2 Game Theory, Private Domain and Public Domain This project is an analysis of the creative process between individuals with differing information sets. The goal is to find some sort of useful strategy between those who share information and those who hide information[5][6]. A simple game will help describe the game theory basis for this experiment, and give an introduction to the evolu- tionary aspects which will be part of the full experiment. The first game described will be a boring card game. The game is designed to experiment with some of the is- sues that would arise with the full version. Some of the math behind the card game will be described and then a repeated version of the game will be shown along with some analysis. The repeated version of the simple game is a very rudimentary resemblance of the full version. The main differences between them being the strategies available to agents, the complexity, and type of problems solved. A simplified version could be described as such: Two agents draw random card from a standard deck, keep- ing each card face down on the table. When the game is called, the cards are flipped over and the agent with the highest card gets three dollars. If both agents draw the same rank, they both get one dollar. Before calling the game, the agents each have the option of turning their card over. If the card shown is the highest of the two cards drawn, both agents get a dollar. The deck is shuffled and the game starts over. Tables 1-3 describe the normal form of the game and their payoffs. Agent one is represented by the columns 4
  • 5. Share Hide Share 1,1 1,1 Hide 1,1 1,1 Table 1: Same Card p=3/51 Share Hide Share 1,1 0,3 Hide 1,1 0,3 Table 2: Agent 1’s Card is Greater p=24/51 Share Hide Share 1,1 1,1 Hide 3,0 3,0 Table 3: Agent 1’s Card is Lesser p=24/51 in each situation and can decide to either share or hide information. This is the only decision an agent can make. Likewise, agent two is represented by the rows in each table. p represents the probability of each possible draw. There is a 3/51 probability that the two agents will draw the same rank card. The payoffs in this situation are all one dollar. There is a 24/51 probability that the first agent’s card will be greater than the second agent’s card, and vice versa. In the single round version of the game, there are only two strategies available to each agent. Assuming the other agent is equally likely to share or hide their card, the payoffs to the agent using some strategy si ∈ S (the set of strategies)is: Π(si) = pj ∈P pj( 1 2 Πj(si, s−i) + 1 2 Πj(si, si)) Where P is the set of probabilities for each outcome. Π(s) is the overall payoff using strategy s no matter which cards are drawn and Πj(s, s ) is the payoff of any particular move j by nature given some strategy s’ by the other agent. For an agent that only shares, this results in: Π(si) = 3 51 ( 1 2 Π(si, s−i) + 1 2 Π(si, si)) + 24 51 ( 1 2 Π(si, s−i) + 1 2 Π(si, si)) + 24 51 ( 1 2 Π(si, s−i) + 1 2 Π(si, si)) = 3 51 ( 1 2 + 1 2 ) + 24 51 ( 1 2 + 1 2 ) + 24 51 ( 1 2 ) = 39 51 For an agent that only hides, this results in: Π(s−i) = 3 51 ( 1 2 + 1 2 ) + 24 51 ( 1 2 (3) + 1 2 (3)) + 24 51 ( 1 2 ) = 3 51 + 24 51 (3) + 12 51 = 87 51 Replacing “1” with β and “3” with α the normal form is found in tables 4-6 1 And by setting Π(si) ≥ Π(s−i) to find out how large α needs to be with respect to β we get: Π(si) ≥Π(s−i) 3 51 β + 24 51 β + 12 51 β ≥ 3 51 β + 24 51 α + 12 51 β 39 51 β ≥ 15 51 β + 24 51 α β ≥α In this game, when the other agent chooses one of the two strategies with a 50 percent probability, it is more sensible for an agent to hide as long as α ≥ β. Assuming both agents, know this, however, both might always hide. 1These tables could have been combined into a single table with equations for entries. While that form is common in game theory texts, it was decided to keep this table simple with each probability a distinct outcome. 5
  • 6. Share Hide Share β,β β,β Hide β,β β,β Table 4: Same Card p=3/51 Share Hide Share β,β 0,α Hide β,β 0,α Table 5: Agent 1’s Card is Greater p=24/51 Share Hide Share β,β β,β Hide α,0 α,0 Table 6: Agent 1’s Card is Lesser p=24/51 The payoff equation for the agents when they both stay with the same strategy is simpler: Π(si) = pj ∈P pjΠj(si, si) Similar evaluation for a two sharer scenario results in: Π(si) = 3 51 β + 24 51 β + 24 51 β =β And for two agents who only hide information: Π(s−i) = 3 51 β + 24 51 α Again, the relationship between αandβ is expressed by: Π(si) ≥Π(s−i) β ≥ 3 51 β + 24 51 α 48 51 β ≥ 24 51 α 2β ≥α With this game it is not worthwhile for both agents to only hide verses only share unless α is twice the value of β. This value is dependent upon the probabilities of each event, details of which will not be further discussed. This is a single round game, the rules of which mention one particular characteristic which is not often present in competitive systems. The rules state that the agents must decide whether to share before they look at their card. The agents do not know their own hand. In the full system, agents are able to determine which solutions (or cards) should be shared. Furthermore, this game is boring because it is only played once. A repeated version of the game, in a simple genetic programming system, with different agents using the three strategies always share, always hide, and share half the time using different values for α and β should prove more interesting. 3 Repeated Version of the Simple Card Game The following is a repeated version of the simple card game introduced in the last section. One hundred agents are generated with one of two strategies. Different runs of the game will exhaust all possible two strategy combi- nations of the five available strategies, including homoge- neous match ups. In each run, two agents are then paired up and they play the simple card game. Payoffs are cal- culated, and every 100 generations reproduction occurs. Five percent of the lowest scoring agents are replaced with duplicates of the top five percent. A mutation in an agent occurs with a one percent probability. These basic pa- rameters will remain the same unless otherwise specified. Different values for α are tried and the population of each type of agent is recorded every generation. 6
  • 7. 3.1 Hiders vs. 50/50’s 0 20 40 60 80 100 120 0 1000 2000 3000 4000 5000 6000 7000 8000 9000 10000 Alpha = 0 Alpha = 1 Alpha = 2 Graph 1: Number of Hiders, β = 1 0 50 100 150 200 250 0 1000 2000 3000 4000 5000 6000 7000 8000 9000 10000 Alpha = 0 Alpha = 1 Alpha = 2 Graph 2: Average Payoff, β = 1 Graph 1 shows the population of each type of agent over time. The point at which an agent who only hides is more successful than an agent who hides half the time is when α is equal to β. The average payoff graph (graph 2) largely reflects the higher payoff of the greater alpha, however the slight inflection point 2 at the minima of hider agents demonstrates the generally greater payoffs with an even mix of agent types. 2Many attempts were made to graph these inflection points more clearly. The best method was to rotate the line clockwise using its aver- age slope as an axis. Unfortunately, there is no standard way to plot all three experiments on the same graph this way, so the graphs were left as is. 3.2 Sharers vs. 50/50’s 0 20 40 60 80 100 120 0 1000 2000 3000 4000 5000 6000 7000 8000 9000 10000 Alpha = 0 Alpha = 1 Alpha = 2 Graph 3: Number of Sharers, β = 1 0 50 100 150 200 250 0 1000 2000 3000 4000 5000 6000 7000 8000 9000 10000 Alpha = 0 Alpha = 1 Alpha = 2 Graph 4: Average Payoff, β = 1 Similarly to the hider agent vs 50/50 agent graphs pre- viously, a homogeneous population of 50/50 agents will form in competition with sharers if α is greater than or equal to β. 7
  • 8. 3.3 Sharers vs. Hiders 0 20 40 60 80 100 120 0 1000 2000 3000 4000 5000 6000 7000 8000 9000 10000 Alpha = 0 Alpha = 1 Alpha = 2 Graph 5: Number of Sharers, β = 1 0 50 100 150 200 250 0 1000 2000 3000 4000 5000 6000 7000 8000 9000 10000 Alpha = 0 Alpha = 1 Alpha = 2 Graph 6: Average Payoff, β = 1 When sharers are matched up against hiders, hiders pre- vail when α > β. More vivid is the effect of a large popu- lation of sharers on the average payoffs. As the number of sharers increases, the payoff increases, leveling off only upon their descent. 3.4 Homogeneous Match-ups 0 50 100 150 200 0 1000 2000 3000 4000 5000 6000 7000 8000 9000 10000 Sharers Hiders Halfs Graph 7: α = 0, β = 1 0 20 40 60 80 100 120 140 160 180 200 0 1000 2000 3000 4000 5000 6000 7000 8000 9000 10000 Sharers Hiders Halfs Graph 8: α = 1, β = 1 0 50 100 150 200 250 0 1000 2000 3000 4000 5000 6000 7000 8000 9000 10000 Sharers Hiders Halfs Graph 9: α = 2, β = 1 8
  • 9. 0 50 100 150 200 250 300 350 0 1000 2000 3000 4000 5000 6000 7000 8000 9000 10000 Sharers Hiders Halfs Graph 10: α = 3, β = 1 These graphs verify the conclusion that if all agents share the same strategy, it is only beneficial for both agents to hide if α is two times β. Since there is only one type of each agent, only the average payoffs are graphed. The pivot point is when alpha equals two. When α is less than two times β, sharers prevail. The payoffs of those agents who hide only half the time remain centered be- tween these two extremes. 3.5 Trigger Strategies 10 15 20 25 30 35 40 45 50 55 0 2000 4000 6000 8000 10000 12000 14000 16000 Number of Defectors Graph 11: α = 2, 50 initial defectors The great advantage of a repeated game is the ability to develop strategies which are dependent upon the his- tory of the repeated game. There are two simple strate- gies which take advantage of the repeated game, the grim trigger strategy and the friendly trigger strategy[5]. The grim trigger strategy states that if each agent en- counters a defector, in this case, a normally sharing agent who decides to temporarily hide, that agent will defect, or hide, forever. In most games this results in a population of defectors, unless the payoff for hiding is horrifically low. The graph above is of a strategy significantly less se- vere than grim trigger. The friendly trigger strategy, rather than committing an agent to defect forever, will make an agent defect for only a set number of generations. In this case, upon competing against a defector, the agent will de- fect for one round only, then return to sharing. All agents in this simulation are naturally sharers, but of the one hun- dred agents, fifty start out defecting. Alpha and beta are at the pivot point (α = 2 β = 1) in a homogeneous envi- ronment where hiding and sharing are equally beneficial. Through experimentation, it turns out that in this game, alpha is only moderately important, defectors still lose, but a higher alpha delays their extinction. Much more important in this experiment is the number of rounds an agent chooses to defect. In this simple game, a number higher than one could almost instantly lead to a system consisting solely of defectors. 3.6 Analysis of the Repeated Game Repeated games offer a birds eye view of a strategic system and the ability to develop strategies incorporating the histories of previous games. The analysis of the full experiment will be similar to the analysis of the simple game. Four major questions will be answered: 1. At what point is hiding information is more worth- while than sharing information? 2. Which homogeneous environments are the most effective at developing solutions to problems? 3. How do trigger strategies affect the population? 4. How does the problem being solved affect the out- come? 5. Are homogeneous or heterogeneous populations more profitable? 9
  • 10. 4 Public/Private Domain GP Model The system developed is much more complex than the simple game above. As in the game above, the full model has multiple agents possessing different strategies for sharing information and makes them compete in a genetic programming environment (GPE). The problems solved are not be a simple card game but rather an equa- tion of variable complexity. Each problem can be solved by some solution which would be modified inside a sep- arate GPE which is under the control of the agent. Each agent then controls a set of solutions and manages them inside this private GPE. Each agent can decide to share a certain portion of their solutions, the degree of sharing is determined by the agent but using a strategy given to them by a Meta-GPE. Originally the Meta-GPE was designed to operate as a full genetic programming environment for evolving sharing strategies for agents. While it is fully functional in this role, it became clear that given the relatively low complexity of the problems solved, directly manipu- lating the agent strategies was more illuminating. The Meta-GPE controls the actual distribution of solutions amongst resident agents itself, as well as the replication, modification, and death of agents. sn S1 S2 Agent-GPE n Meta-GPE s1 s2 s3 sn S1 S2 Agent-GPE 3 s1 s2 s3 sn S1 S2 Agent-GPE 2 s1 s2 s3 sn S1 S2 Agent-GPE 1 s1 s2 s3 Figure 2: Basic layout of Meta-GPE/Agent-GPE rela- tionship One real-world analogy of this system is that of companies and engineers. The Meta-GPE is represented by the market system, agents by companies, and solutions by engineers and engineering data. Each agent, or rather company, is it’s own GPE, with engineers and informa- tion all striving as best they can to solve the problem from the available knowledge base. If a company decides to share information, it is placed in the public domain, and becomes part of the resident knowledge of every company. S1 S2 S3 Agent-GPE n Meta-GPE s1 s2 s3 S1 S2 S3 Agent-GPE 3 s1 s2 s3 S1 S2 S3 Agent-GPE 2 s1 s2 s3 S1 S2 S3 Agent-GPE 1 s1 s2 s3 S3 Distribution of Shared Solutions Figure 3: The sharing of public solutions at the object level Since agents (or rather companies) can independently control the degree and aspect of their sharing, it is note- worthy to mention lying. Agents may decide that the best policy is to only share the worst solutions. It also turns out that depending upon the problem, sharing the worst solutions can give others the best opportunities to advance beyond a plateau in problem. This system changes the classical model in the follow- ing ways: 1. Initial, random solutions will be grouped into one or more private domains, or Agent-GPE, controlled by a unique agent using some strategy for the sharing or hiding of solutions. 2. Cross-over will not be able to occur between these domains. 3. Cross breeding can occur with any solution in the Agent-GPE, including those solutions which have been added to the Agent-GPE via some other agent’s sharing strategy. 4. After each generation, some set of solutions will be placed in the “public domain” according to the strategy used by the agent. Solutions in the public 10
  • 11. domain are automatically added to all other Agent- GPE’s for use in crossbreeding and development. 5. The set of agents and their strategies are them- selves modified and changed in their own evolu- tionary programming environment (Meta-GPE). The performance of each Agent-GPE is monitored along- side the most popular strategies used by agents. Public Domain Private Domains Figure 4: Conceptual view of grouping individuals into private domains Figure 4 depicts the grouping of individuals into two or more private domains, or Agent-GPEs. Groupings are formed along hereditary lines, with all children of the same parent belonging to the same group. The number of groups, or private domains, in the system depends on the number of initial agents in the system. Cross breeding cannot occur between different groups, but would be able to occur within a group. Figure 5: Conceptual view of the periodic transfer of solutions from private to a public domain Figure 5 depicts the periodic transfer of old solutions to a public domain. Solutions in the public domain can be used for cross breeding by all individuals. Old solutions still in the private domain can only be used for cross breeding with individuals in the same private domain. 11
  • 12. Public Domain Figure 6: Full conceptual view of solution sharing (or hiding) Figure 6 depicts the complete model from a conceptual standpoint, including later cross breeding with solutions in the public domain. If the private domain of an agent proves disproportion- ately unsuccessful, the agent strategy can "die" to be re- placed by a winning strategy. Originally, this agent was to start anew using the public domain solutions as it’s base. This was changed as the Meta-GPE usefulness as an evo- lutionary system was degraded and it became more im- portant for the Meta-GPE to manage strategies of agents rather than adhere strictly to the company/patent analogy. As is, a "new" agent uses the solutions of the dead agent. Trigger strategies are not passed on. The analysis shows how trigger strategies are more influential to agent success than mixed sharing strategies. 4.1 Specifics of the Meta Genetic Program- ming Environment Each strategy that can be used by an agent has multiple components. At its base is the probability as determined by a normal curve that some solution is ripe for sharing. The agent can modify the standard deviation of this curve as well as its center with respect to the performance of each solution. All solutions possessed by an agent are tested against the problem. The best solution represents the end of this range and the worst solution represents the beginning. The one exception to this is when a solution is more than two standard deviations from the mean. During evolution the population tends to become less diverse. While this is a good thing, often there develops one or two solutions in the population with extremely weak scores. These scores drive down the selection curve from it’s most representative shape. To compensate, these extremely weak scoring solutions are excluded from the selection process. Create Initial Set of Agents w/ Random Solutions and Random Strategy Agents Test Solutions Agents select Solutions to Share from Strategy Selected Solutions are Injected into the population of other agents Solutions in Surviving Agents are Crossbreed and Mutated Agent Strategies are Mutated and Agent Reproduction occurs based on average agent performance. Figure 7: Process diagram The definition of an agent includes the standard deviation, the position of its normal curve and any trigger strategies that can be used by an agent. This represents an agents strategy. The definition of an agent also includes the set of solutions managed by the agent. 12
  • 13. The Meta-GPE will keep track of all agents and their respective strategies, evolve their strategies inside a GPE, and redistribute solutions shared to all agents. Statistics on the average performance, curve characteristics, and solution set size will be recorded by the Meta-GPE. The Meta-GPE will be written in C with standard C libraries. It will communicate with the Agent-GPE using standard UNIX file descriptors (which could be pipes, files, or a network connection). This allows for the distribution of the system across multiple machines and a better way of managing resources. S SSSSSSSS Likely Shared BestWorst figure 8: The selection of solutions to share is based on the normal curve [8] 4.2 Agent Strategies Of the strategies available to an agent, the trigger strate- gies are the most important. An agent can have any mean and standard deviation in it’s solution sharing decisions, but because the complexity of the problems solved is rel- atively simple, trigger strategies similar to those described in the simple game have a more demonstrable effect upon an experiment. The main strategies used (besides various sharing strategies) are the grim strategy and the happy trigger strategy. These strategies do not technically follow their game theory cousins. The grim strategy is not like the grim trigger strategy. All agents using the grim strategy are selected at the beginning of the experiment and remain that way. The grim strategy is not "triggered". One form of this strategy is the “Sucker” strategy, or “grim but one” strategy where all agents hide except for a single sharing agent. The happy trigger strategy was also not directly taken from existing game theory. 3 The happy trigger strategy was a late addition to the model. An agent using the happy trigger strategy shares only when the average score of the agent is below the average score of all agents. That is, if an agent is doing better than most of the other agents, it will not share. This has several interesting effects on problem solving, which will be described later. 4.3 Specifics of the Agent-Problem GPE The GPE managed by each agent is relatively simple. Many existing GPEs are used to solve equations. The simplicity of using mathematical functions for testing the- ories in genetic programming are hard to escape. Each agent in this case uses the GALib library for it’s GPE. The GALib[15] interface is used to add and acquire shared agents into the agents knowledge base and evolve solu- tions to some problem. The Agent-GPE receives informa- tion from the Meta-GPE using xml over a file descriptor that could either be a pipe or a network connection. 4.4 Implementation Issues The system uses a unix process for each Agent-GPE which communicates with the Meta-GPE using xml se- rialized c++ objects over unix file descriptors. Network communication using SOAP and a custom object repos- itory were researched but not pursued after the realiza- tion that each agent would step through generations too quickly for a distributed architecture. Instead, the Meta-GPE starts up each agent as a sepa- rate process and just uses file descriptors. The c++ ob- jects containing solutions and agent commands are seri- alized into XML using the Eternity Persistence library. Many modifications were required to make this library work properly using file descriptors. Additionally, seri- alization and deserialization took a large amount of com- puting power. 3If the happy trigger has been used in other game theory problems, it most likely doesn’t use the name "happy." The name “sucker” was also an invention of the author. 13
  • 14. These issues, and because of issues resulting from the extreme simplicity of these problems, resulted in a config- uration variable being added which cut into the size of the solutions shared by each agent. Of all the solutions shared by an agent, only a small percentage (one to ten percent) are actually shared. This slows down the experiment to the point where quantitative analysis of agent strategies became useful. Additionally, the population of agents, and the solution population of each agent, was lowered to only ten individ- uals. The mutation rate of each agent was also lowered. Even with these modifications, agents in this experiment solved problems in the test suite unexpectedly fast. There is another issue that is apparent only in experi- ments where there’s only a single sharing agent (sucker strategy). In these experiments agents tend to be drawn to the sharing agent and then get into a situation where their score never changes before the 1000 generation is reached. Given the information at the time of writing, it is sup- posed that this is due to the extremely small population size of each agent, and the fact that agents left to share with themselves reinforce their own homogeny. Fortunatly the system doesn’t need to be modified to support larger populations or more complex problems. Unfortunately analysis requires simplicity in all these fac- tors. Increasing the complexity of the experiments will have to be relegated to future experiments. 5 Solution Sharing Model as Com- pared to Existing Parallel Popula- tion Models There are existing methods for managing parallel popu- lations and transferring certain members to and from the populations. I’ll describe two here. 1. Hierarchal deterministic stepping stone 2. Overlapping populations Hierarchal populations are a genetic programming de- sign which uses multiple populations of individuals with different performance characteristics. The best analogy is that of our public education system. An individual might start out at the lowest level, competing for survival only among the lesser agents, and “graduate” to higher levels depending upon their success. There are many variations of this concept, but no standard toolset for their exploita- tion [14]. Overlapping populations of individuals are used to make effective use of two different environments, each with specific mutation and breeding characteristics, by sharing the certain individuals between their respective populations. One environment might be good at basic hill climbing, while the other might be good at getting out of small ruts (using a higher mutation rate). The sharing of individuals between these environments could potentially reach a solution much faster (and more reliably) than a single population alone [15]. The method described in this paper is essentially the synthesis of these two methods. There’s been a decent amount of research into the use of Meta-GPEs, and more research should have been performed before reinventing some of the methods discovered by others. 4 6 Summary of Major Assumptions Three major assumptions have been made in this experi- ment: 1. Functions can model a real-world problem space 2. Function optimization can model the innovative process 3. Different types of innovative processes utilize sharing differently These assumptions will be described in detail in the next sections. 4Part of the research problem was the lack of online resources at the start. Many of the journals in which these articles appear are not subscribed to by Cal Poly, and the two books on genetic algorithms at the library are outdated by several years. It’s ironic that a research project involving the use of sharing ran into problems with the accessibility of related research. 14
  • 15. 6.1 Functions as a Model for Innovation Can functions and a proposed solution to a function accurately simulate a real-world problem and it’s associ- ated solution? Modeling forms of intellectual protectionism in an GP system is such a leap from traditional analysis that several assumptions must be justified. This section addresses the first of three major assumptions that must be addressed. This system will attempt to model the innovative process using function optimization. Whether this rela- tionship can be justified requires establishing a common definition for ideas and solutions to functions that is abstract enough for the simulation but accurate enough so as to not lose sight of the process being modeled. The Merriam-Websters dictionary defines an idea as: 1a: a transcendent entity that is a real pattern of which existing things are imperfect representations (a derivative of Plato’s definition) or c: a plan for action: Design. Economists often describe a patentable idea using the analogy of a recipe. An idea need not have a material con- sequence, however an innovation should be a reasonable solution to a problem that could be developed, deployed, or produced. In common usage there are few notes on a requirement for an idea to be communicated, but in the economic and political sense there is social value placed upon that communication. Using these interpretations, we can outline a set of criteria for the simulation that must be satisfied in order to justify its role as demonstrative of this social process. This particular list only applies to that component of the simulation which models “ideas.” 1. Transcendence - The integrity of a simulated idea must not be dependent upon the particulars of the simulated “idea holder.” That is, ideas should have the ability to be copied and transferred perfectly be- tween individuals unless an artificial boundary (such as intellectual protectionism) is constructed. 2. Modification - A simulated idea should have the capability to be modified, for better or for worse and the resulting idea should meet all criteria listed here. 3. Use - A simulated idea should attempt to solve some problem. It should have an application. The idea might not be a good solution, but it at least falls within the domain of possible solutions. The proposed system uses math functions to represent the problem space of a field, and solutions to those func- tions as particular ideas addressing the problem. Take, for instance, the development of the wheel. For simplic- ity we will exclude all other factors addressing the wheel besides shape. It is generally agreed that the best shape for a wheel is circular, however other shapes for a wheel may have been in use at some time. These shapes might have been square (roughly cut stone) or flat (planks for sliding), but they are all shapes generally intended to fa- cilitate movement. Using these simplifications, one might be able to picture a unimodal graph of “mobility” vs. “de- sign” in the development of the wheel. At one end of the graph might appear such designs as the flat “wheel” lead- ing to square “wheels” and at the other end of the graph you might find oblong “wheels” (logs?) leading to pro- gressively more circular shapes at the maxima. The line representing this path of development can be understood as a function. The particular shapes of “wheels” can be understood as a solution to this function. This type of model meets the criteria set above. So- lutions to functions can be transferred perfectly and “solved” repeatedly without degradation. Solutions to functions can be modified and changed intentionally to produce new functions. Functions have a set of possible solutions. This set is infinite if the function is continuous. 6.2 Function Optimization as an Innovative Process The second major assumption is that a function space, or a pathway through a function space can reasonably describe the process by which ideas can evolve. There are a few aspects of innovation which can be compared to mathematical functions: 1. Incremental Modification - The process of devel- oping an idea is often a piecemeal exploration of so- lutions. Successive ideas are more often than not a gradual modification of prior works. This is similar 15
  • 16. to the stepping progress used to graph a function at a set of n discrete points. 2. Periodic Jumps - Occasionally an unforeseen de- velopment occurs that upsets the gradualists. Evolu- tionary change can be overestimated, revolutionary change can be underestimated. It’s by leaps that a so- lution can advance beyond a plateau. This is similar to finding random points on a graph and conducting a gradual search from preferred points. 3. Diversification needs no coordination - The deci- sion to diversify a solution does not require the coor- dination of all parties. Most diversification occurs as a result of an individual decision. 6.3 Classes of Functions and Fields of In- vention The wheel was mentioned earlier as a simple example of an invention which could be represented by a simple uni- modal graph. However this example only took into ac- count the simple two dimensional shape of the wheel, not the thickness, material at different points, whether there’s an axle, or other possible wheel characteristics. The prob- lem gets more complex the more attributes which are con- sidered. Each attribute is another dimension, with only one dimension being the end effectiveness of the wheel. Very quickly, the wheel function is a complex problem without a clear structure. Conceiving the entire shape of the problem space and identifying the maxima instantly is no small wonder. It is natural to adopt the plodding incremental improvement of prior wheel solutions. The field is complicated still by the diversification of the problem itself. No longer would a simple log wheel do for every purpose, but the ideal wheel for a wagon be- comes significantly different than the ideal wheel for a bike, or a car, or an eighteen wheeler. A seemingly sim- ple problem can develop a grotesque problem space rather quickly. Consideration of all variables is impossible, even by computer. Nevertheless, genetic algorithms can consider a reason- ably broad set of variables quickly. While the solutions developed might need to be shined for application, the search for solutions can be broader and quicker than in most development groups. The set of equations used in this experiment should ap- proximate reasonably complex problems that can suggest useful sharing strategies for real-world issues. One example of a real-world complex problem space could be the development of nuclear weapons. The hur- dles of producing nuclear weapons are immense, but once certain problems are solved there is a point at which a solution becomes fast at hand. It’s all the sub problems, the refinement of uranium or plutonium, it’s procurement, the ignition system, and delivery which makes a nuclear weapon difficult to achieve for lessor developed countries. Once some of these problems are solved, and enough vari- ables are with in reach of the optima, development and testing of successive versions proceeds much more speed- ily. This problem space could be modeled as a very com- plex surface, with a single extremely high optima com- pared to the surrounding surface. It’s in this type of problem space that sharing can be useful or dreadful depending upon the agent’s perspec- tive. For the United States, which already possess this technology, sharing amongst agents is not desirable. For most agents without the technology, sharing is necessary. In fact, during the development of the atomic weapon in the U.S. it was the eventual sharing of information be- tween organizations that is often credited with making the atomic bomb a reality. Because of this problem space, it is likely that a happy trigger strategy would appear amongst agents seeking atomic weapons. Pakistan helps Iran, Iran helps Libya, the established nuclear states share nothing. A fictitious problem space that exemplifies the prof- itability of different strategies is the berry picker prob- lem. A group of berry pickers all prefer squish berries, but usually only find squash berries that grow nearby. There’s only a limited number of squish berries to eat, so the berry pickers have to choose some sharing strategy that would get them to the squish berries first. The berry pickers enter a dense field with only one patch of berries somewhere in the field. There are no other bunches of squish or squash berries in the field. This type of problem is similar to test problem 6 in the test suite used for this project. There is very little information about where the berries are, and the berry pickers can only wan- der aimlessly about hoping to run into this bunch. In this type of situation, it is better for an agent to not share any information. If a berry picker accidentally runs into the bunch of berries, it is more profitable for them to keep 16
  • 17. that information to themselves. It would have been better for the common good if sharing was rampant, however. A variation on this problem places the berry pickers in a field with splotchy patches of berries. Every berry picker is guaranteed some berries in this scenario, but not many will be able to find the squish berries (of which there are multiple bunches). Since squish berries grow nearby squash berries, it is good for both the individual and the group to share information. All pickers would desperately love some information from their fellow picker on where the best berries are. Since everyone wants information, it only makes sense that agreements would be made to pro- vide that information. While the happy trigger strategy could develop from this scenario, squish berries come in a multitude under this problem, so a picker would be more likely to share information even after finding their first batch of squish berries. 7 Set of Test Functions The suite of test problems was organized from sev- eral sources. Many were taken from the Matlab GEA Toolbox[12] and others were derived from Yao, Xin and Liu Yong’s paper, Fast Evolutionary Programming[3]. Attempts were made to develop several unimodal and multimodal functions, along with specific search spaces that genetic algorithms often fail to optimize. Normally these functions are wrapped in summations to increase their complexity. By modifying the func- tions.h file new functions can be defined with a different dimension. The functions tested here remained in three dimensions so analysis could proceed more quickly. [0] Simple Polynomial Function This function has two optimum points at (10,5) and (- 10,-5) so agents can converge in two different directions. This makes the problem hard for certain problems in limited sharing environments. Function Definition[-10:10]: z = x2 + xy − y2 17
  • 18. [1] Simple Sine Based Multimodal Function Function Definition[-10:10]: z = sin(x) ∗ sin(y) x ∗ y [2] De Jong’s function, inverted Simple parametric, continuous, concave, unimodal[12] Function Definition[-10:10]: −z = x2 + y2 18
  • 19. [3] Rosenbrock’s valley, inverted From Matlab GEA Toolbox: " Rosenbrock’s valley is a classic optimization problem, also known as Banana function. The global optimum is inside a long, narrow, parabolic shaped flat valley. To find the valley is trivial, however convergence to the global optimum is difficult and hence this problem has been repeatedly used in assess the performance of optimization algorithms."[12] Agents using this problem converged too quickly, despite it’s design. Analysis of experiments using this problem was impossible and experiments using this problem were disregarded. Function Definition[-2:2]: z = −100 ∗ (y − x2 )2 − (1 − x)2 [4] Schwefel’s Function, range adjusted "Schwefel’s function is deceptive in that the global minimum is geometrically distant, over the parameter space, from the next best local minima. Therefore, the search algorithms are potentially prone to convergence in the wrong direction."[12][13] Function Definition[-5:5]: z =(x ∗ 100) ∗ sin( 2 √ x ∗ 100)+ (y ∗ 100) ∗ sin( 2 y ∗ 100) 19
  • 20. [5] Ackely’s Path Function, inverted.[12] a = 10 adjusts the "flatness" b = .2 adjusts the height of each peak c = pi adjusts the number of peaks Function Definition[-5:5]: z = − (−a ∗ exp(−b ∗ 2 (x2 + y2) ∗ 1/2)− exp((cos(c ∗ x) + cos(c ∗ y)) ∗ 1/2) + a + exp(1)) [6] Easom’s Function The Easom function is a unimodal test function, where the global minimum has a small area relative to the search space. Agents outside of this area have very little information on it’s location. The function was inverted for maximization.[12] Function Definition[-9:15]: z = cos(x) ∗ cos(y) ∗ exp(−((x − Π)2 + (y − Π)2 )) 20
  • 21. 8 Experiments Thousands of experiments were performed using differ- ent criteria and settings for agent sharing. All seven prob- lems exhibited some general characteristics given certain strategies, and some characteristics specific to their search space. Shown here are some graphs from a small subset of those experiments. Generally, a standard deviation of 20 was selected, along with a mean of 100, and a sharing probability of 1/1000. This means that the best solutions of an agent were set aside for sharing with in a standard deviation of 20 percent. All experiments only use ten agents, controlling ten so- lutions each. 5 Despite the low population, several mea- sures needed to be taken to slow optimization further. Be- sides specific strategies such as the happy or grim strategy, there was a .1 percent chance that a solution selected by the agent was actually shared. This procedure slows down the evolution, as the normal curve of an agent does not have time to reach a reasonable setting before the prob- lem is optimized by all agents. On more complex prob- lems this probability can be increased. The only function largely excluded from these results is Rosenbrock’s function (3) which displayed extremely fast optimization using all basic settings. Most of the data from experiments using this function displayed little, if any, useful information. In these experiments the Rosen- brock function would be better restructured as a mini- mization problem. Several characteristics will be analysed in each major experiment. For one, the average scores of all agents will be used to evaluate the “community” benefit of a particu- lar sharing methodology. The scores of individual agents will be used to evaluate the “selfish” benefit of a particu- lar sharing methodology. Third, the nature of the problem space as it relates to the effectiveness of a strategy will be explored. Alongside the performance graph is a contour map of the function with specific points overlayed representing solutions shared in the experiment. The generations or 5A harddrive failure, followed by an equally depressing RAID con- troller failure limited the number of tests that could have been re-run with alternative settings. A decision was made to only re-run the data which was most illuminating before the failures. High sharing systems require an enormous amount of CPU horsepower, alongside a very large amount of storage space. agents from which these points were shared will change depending upon the experiment and function. 6 8.1 Comparing Strategies 7 Graph 12: Performance for all Strategies on Problem 0 Typically experiments using strategies which shared more converged on the right solution much faster than those experiments with less sharing. There are some ex- ceptions, however. On hard unimodal problems (prb 1 and 6) it was much better for the population of agents to all share than to hide, but on hard multimodal problems (prb 5 and 4) agents 6Some scatter plots are divided into two ranges of generations, usu- ally to distinguish between the solutions shared before and after coales- cence. Unless otherwise specified, these will be the standard contour maps. For various reasons involving formatting issues in the multicol latex environment, they have no titles. 7The graphs hereafter follow a specific format. The titles on per- formance graphs first state the problem number and then the part of se- lection criteria for sharing solutions. Unless otherwise specified, this criteria is always 20, 100, 10. This means that agents shared solutions based on a normal curve with a standard deviation of 20 percent from the center. A center of 100 means that the normal curve was moved up to straddle to best solution. A center of 50 means that the normal curve was centered exactly between the best and worst agents. The titles do not include the strategy used, only the selection criteria. 21
  • 22. would often converge around the wrong solution if there was too much sharing. The grim strategy, where only one agent doesn’t share had very similar characteristics. The agent which did not share did not consistently have an edge over other agents, although such a difference would be expected over the long run depending upon the com- plexity of the problem and the number of agents involved. Graph 13: Performance for all Strategies on Problem 1 Graph 14: Performance for all Strategies on Problem 2 Two problems, problems 2 and 3, optimized extremely quickly. In these problems the sharing strategy didn’t mat- ter as much, as there was a clear path to the optimal solu- tion, and each agent could use basic hill climbing to find it. Problem 3 optimized so quickly that the data generated during experimentation was essentially useless. This data contained very little information on how optimization was effected by the sharing strategy. Because of this, problem 3 was removed from the analysis. Graph 15: Performance for all Strategies on Problem 48 The sucker strategy only has one agent which shares solutions. As a result, the other agents tend to converge around that agent. While many agents might find better solutions themselves, a group of agents usually splits off to follow the sharing agent. This pattern is apparent on all hard problems. The homogeny developed in a shar- ing agent in these experiments is strange, and might be a result of the low population size of each agent. 8When all agents maintained the exact score for 25 generations the experiment was halted. This saved cpu time and the experiments which reached this point were usually homogenous at the optima. 22
  • 23. Graph 16: Performance for all Strategies on Problem 5 Typically the group of agents who didn’t share had the slowest convergence of any group excluding those situa- tions where a happy or sucker strategy drew a group away from the best solution (There by often never finding the solution at all). Graph 17: Performance for all Strategies on Problem 6 Agents using the happy trigger strategy were surpris- ingly effective at finding the right solution. While it was common for less effective agents to converge on the wrong solution, sometimes the agents would be able to use the lesser sharing agents for diversification as the aver- age score rose. The difference between the lesser and the greater agents needs to be relatively small for the happy trigger strategy to really pay off for all agents. The happy trigger strategy was extremely valuable to individual agents, however. Since a greater agent didn’t need to share with the lessor agents, they often maintained an advantage for a great length of time. 23
  • 24. 8.2 Function Optimization without Sharing These experiments do not perform any sharing to provide a control case. Agents do not group together in these ex- periments. Only the performance graphs are shown. Graph 18: Performance for agents on prb 0 w/o Sharing Graph 19: Performance for agents on prb 1 w/o Sharing Graph 20: Performance for agents on prb 2 w/o Sharing Problems 0 and 2 are extremely simple problems, with fast optimization times. The rest have some difficulty in reaching the optimum, with some non- sharing agents never finding the best solution at all. Graph 21: Performance for agents on prb 4 w/o Sharing 24
  • 25. Graph 22: Performance for agents on prb 5 w/o Sharing Graph 23: Performance for agents on prb 6 w/o Sharing One important observation about the non-sharing graphs is that even when an optimum is reached, the agents never coalesce into a single line, with only a single solution. The agents have a tendency to mutate back and forth around the optimal solution. 25
  • 26. 8.3 Normal Sharing Methodologies Graph 24: Performance for agents on prb 0 w/ Work These experiments use ten agents which all share infor- mation regardless of performance. These experiments in- volve a large number of shared solutions, and typically optimize functions quickly. The contour map has a scatter graph of solutions shared during different periods of the experiment. In this case, an attempt was made to differentiate between solutions be- fore and after mass convergence on the optimum solution. On this particular experiment, one agent found the op- timum point immediately at (10,5). Most of the other agents appear to have been converging on the other op- timum point at (-10,-5) when the first agent finally shared its solution at (10,5). A few agents converging on (10,5) kept others from reaching (-10,-5) quickly. This is an example of how sharing can get in the way of finding a solution even if all agents are on the right track. It shows that in certain classes of problems, indecision and an over-abundance of information can delay success. 26
  • 27. Graph 26: Performance for agents on prb 1 w/ Work This experiment is interesting for several reasons. First, the depressions around the optima tended to deter many agents. Most agents would start outside these depres- sions and never find the optima until a nearby solution was shared. Occasionally, when the parameters of the experiment were modified so that only the worst solutions of agents were shared, the population would actually converge faster than similar runs when the best solutions were shared. This demonstrates how lying, or misinformation can often lead to a global optima faster than good faith efforts to share the best solutions. 27
  • 28. Graph 28: Performance for agents on prb 2 w/ Work The optimization of problem 2 using normal sharing methods is unremarkable, and is provided here as a refer- ence for comparison with the optimization of this problem using the happy trigger strategy analysed later. All of the solutions shared here are very good, and the population converges on the optima quickly. 28
  • 29. Graph 30: Performance for agents on prb 4 w/ Work Problem 4 is an extremely hard problem even for normal sharing techniques. This problem displays similar behav- ior to normal sharing on problem one in that the agents started to converge on two different points. Since there is only one optima in this problem, how- ever, the agents that found and shared this optima eventu- ally brought over the whole population to the proper solu- tion. 29
  • 30. Graph 32: Performance for agents on prb 5 w/ Work This is another difficult problem, as it’s multimodal nature again delays optimization. The red dot on the contour map shows that early on a solution with in striking distance of the optima was shared. The solution shared wasn’t ideal, and while it managed to carry over a few agents. The agent that shared the solu- tion initially had not converged internally before the 100th generation. Several agents split off independently from the main group to find the optima quickly, although one converged on the wrong optima until the main group superceded it. This is a common pattern in sharing experiments. Often there are a handful of extremely successful agents, fol- lowed by a group of lessor agents which feed off the best shared solutions. In a system where information is heavily shared, unless an agent finds a successful solution independently, it will most likely fall into a group of less successful agents that reinforce their inferiority. 30
  • 31. Graph 34: Performance for agents on prb 6 w/ Work This problem demonstrates a more extreme version of the reinforced inferiority problem. Most agents failed to find an optimum solution by themselves, and so they tended to converge on the same solutions. Their close proximity to each other allowed all agents to find the optima at nearly the same time, but their lack of diversification delayed this event until the 60th generation. The one agent which found the optima quickly ignored all the solutions shared by the lesser agents, and therefore didn’t get drawn into group think like the others. Still, this experiment faired better than similar ones where agents didn’t share at all. In many of the other experiments a handful of agents would optimize and the rest would never find a good solution at all. This prob- lem exaggerates issues with convergence in sharing mech- anisms. 31
  • 32. 8.4 Grim Strategies Graph 36: Performance for agents on prb 1 w/ Grim These experiments use a single agent which does not share. This is the first agent (2) in the graphs, so a pat- tern is sought that might identify it as a more successful agent in a population of sharers. The the overwhelming majority of experiments, how- ever, systems using the grim strategy did not display vastly different results than those using normal sharing techniques. This is because only one agent is actually hid- ing information. While the effects of this strategy might be more appar- ent in a system with fewer agents, or systems with higher sharing on complex problems, these experiments did not produce any identifiable advantage to a hider in a popula- tion of sharers. 32
  • 33. 8.5 Sucker Strategies Graph 38/39: Performance for agents on prb 0 w/ Sucker - Scatter graph of all solutions shared by agent These experiments have all but one agent hiding solu- tions. Only one agent shares solutions, so patterns based around this situation are to be identified. There is, how- ever, a potential bug with the system when using strategies such as this. In this problem, the solitary sharer has failed to find the optimum point at all. This is fairly uncommon, as a sharer has nearly the same chance of finding an optimum as the other agents. In this case, the agent seems split between the two optima. The contour map shows all solutions that the agent attempted to share during the experiment. An analysis of the data reveals that the last solutions maintained by the agent were entirely composed of the so- lutions (-6.30872, -3.54026) and (3.06628,-4.94651). The agents population of solution appears to be changing pe- riodically even though the agents score doesn’t change. More information is needed to determine why this oc- curs. It could indicate a bug in the system, however the same thing occurs with hiding agents that are drawn to the shared solutions. Most likely, the GaLib library doesn’t function as well with the Bin2Dec genome type used and only 10 solutions per agent. The sharing agent reinforces a homogenous population and directs itself to a stagnated solution. Because of this only two experiments will be shown including this one, as the results may be unreli- able. It is unfortunate that this problem was discovered late in analysis. Despite this significant issue, it is hoped that certain characteristics can still be identified. 33
  • 34. Graph 40: Performance for agents on prb 4 w/ Sucker Agents tend to converge around the solutions provided by the single sharing agent. While a few agents might opti- mize quickly by themselves, many tend to fall behind the sharer. If a solitary sharer (a sucker) is going to be the only one sharing, it’s going to drag a lot of agents down with it (Suckers Revenge). While the coalescence described earlier is expected, it would also be expected that agents captured by the sharer would not adhere strictly to the sharing agents solutions. Since there is a long period of time between shared solu- tions other agents should have plenty of time to conduct broad searches. Future experiments should increase the complexity of problems to allow for a greater population of solutions per agent. 34
  • 35. 8.6 Happy Trigger Strategies Graph 42: Performance for agents on prb 0 w/ Happy In these experiments agents only share if their average score is below the average score of all agents. If an agent is performing very well compared to other agents, it will not help other agents. The effects of this strategy are sim- ilar to the “Sucker” (Grim but one) strategy previously shown, except that any agent, or set of agents, can become the “sucker” Once again, it appears as if the same issue appears with sharing agents involving the stagnation of scores, though to a much lesser degree. In this experiment, agents very quickly reach an op- tima. The solutions shared during each generation pro- gressively improves along side the entire population of agents. 35
  • 36. Graph 44: Performance for agents on prb 2 w/ Happy Comparing this experiment to the normal sharing ex- periment strategy using problem 2, there’s a clear divi- sion between agents who successfully found the optima, and those who reinforced their own inferiority with shar- ing. While the problem is extremely simple, the fact that agents only shared solutions which were worse than aver- age usually resulted in this split. Despite this split, however, experiments using this strategy often coalesced to an optima faster than most other strategies (The normal sharing strategy usually had all agents finding the optima first). Not only did this strat- egy seem to benefit the lead agent, but it seems to benefit the population as a whole. 36
  • 37. Graph 46: Performance for agents on prb 5 w/ Happy In this experiment several lesser agents developed a ho- mogenous set of solutions through sharing, but one man- aged to break off early and find the optima before it had a chance to share. Note that despite the fairly static scores in sharers, there is still evolution occurring. This lends credibility to the idea that these experiments are best performed on much more complex problems with much larger solution popu- lations for each agent. 37
  • 38. Graph 48: Performance for agents on prb 6 w/ Happy The interesting thing about this experiment is how the lesser agents found better solutions in concert. One agent kept the average score high, and all the sharing agents de- pended upon the diversity of their group to find the op- tima. When one of these lesser agents discovered a better solution, they all migrated to a better solution set. 38
  • 39. 9 Conclusions The model described, while admittedly abstract, describes a method of experimenting with the control of information in a competitive environment. The game theory approach to this problem allows for many interesting applications from psychology to copyright controls. While conceived as a way for finding specific Nash equilibria for different sharing strategies on different problems this paper is just the initial forays into the subject. The model requires complexity beyond what could be performed at this time for hard numbers and specific heuristics on the best sharing mechanisms. Nevertheless several specific observations can be made: 1. Sharing usually solves problems faster 2. On hard unimodal problems, sharing is good for group but bad for the individual 3. On easy unimodal problems, sharing is not very useful 4. On hard multimodal problems, limited sharing is necessary for the group 5. On hard multimodal problems, too much sharing can lead to convergence on the wrong solution 6. The happy trigger strategy is extremely beneficial to individual agents, but can lead to convergence on the wrong solution for less successful agents. 7. Using the happy trigger strategy, it is best for the population if a very large number of agents are be- low average, rather than just a few. These agents can depend on the diversity of other lesser agents to find an optimal solution eventually. 8. A agent doesn’t profit by sharing when all others don’t, but can often force other agents to converge on the wrong solution (Sucker’s Revenge). 10 Future Experiments It is hoped that the techniques and simple conclusions reached here will lead to a more detailed and lengthy set of experiments with greater complexity and more interest- ing strategies. This paper and the system constructed is a good starting point for future projects. Great efforts to design new and different experiments need to be undertaken to come to a more complete set of conclusions. More computing resources are also re- quired given the required complexity. Analysis was con- strained to problems that can be represented on a three dimensional surface. While this allowed for great insight, specific data requires analysis be performed without the benefit of visualization aids. Once specific information can be produced, and proba- bilities generated, a game theory approach more similar to the analysis of the simple game can be used in developing heuristics. 11 Glossary Agent: An individual of the Meta-GPE possessing a set of solutions and a strategy for the sharing of those solutions. The Agent strategy can be mutated by the Meta-GPE. Agent-GPE: The genetic programming environment for each Agent, containing solutions to be modified and crossbreed. Cross Breeding: The combining of solutions to develop a new child solution. Only the Agent-GPE employs crossbreeding. Happy Trigger: A sharing strategy where agents only share if their score is less than the mean score of all agents. Grim Strategy: A sharing strategy where one or more agents do not share. While derived from the grim trigger strategy, it is not to be confused with it as the grim strategy isn’t “triggered” Individual: A member of some genetic programming en- vironment which can be mutated and/or crossbreed, killed, and reproduced. 39
  • 40. Meta-GPE: The genetic programming environment for the each problem being solved, containing Agents whose strategies can be modified. Mutation: The modification of a solution to develop a new child solution. Both the Meta-GPE and Agent- GPE employ mutation. Nash Equilibria: The strategies, mixed or otherwise, which are evolutionarily stable. Normal Sharing: A sharing strategy where all agents share at an equal level. Private Domain: The set of Private Solutions. Private Solution: A solution which is only used by a sin- gle agent. Problem: A mathematical function with a number of un- known variables. One variable is selected to be max- imized. Problem Space: The set of all possible solutions to a par- ticular problem. Public Domain: The set of Public Solutions. Public Solution: A solution which is shared between all agents. Solution: A set of values which satisfies the problem be- ing solved. An individual of the Agent-GPE. Sucker Strategy: A sharing strategy where only one agent shares and all others hide. Suckers Revenge: A situation where a solitary sharing agent drags down other agents into developing un- successful sets of homogenous populations of solu- tions. Strategy: The chance that any particular solution in an Agent-GPE will be shared, as defined by the center and standard deviation of the normal curve if (after testing) all solutions of an agent are ranked with zero being the worst solution and one being the best solu- tion. 40
  • 41. References [1] Harrald, Paul G. Evolutionary Algorithms and Economic Models: A View. Evolutionary Programming V, Pro- ceedings of the Fifth Annual Conference on Evolutionary Programming, p. 4, 1996 [2] Boldrin, Michele and Levine, David. The Case Against Intellectual Monopoly, (http://levine.sscnet.ucla.edu), Draft Chapters 1 & 2, 2003. [3] Yao, Xin and Liu, Yong. Fast Evolutionary Programming. Evolutionary Programming V, Proceedings of the Fifth Annual Conference on Evolutionary Programming, p. 451, 1996 [4] US Patent and Trademark Office, Website [5] Heitkoetter, Joerg and Beasley, David. The Hitch-Hikers Guide to Evolutionary Computation, (http://www.faqs.org/faqs/ai-faq/genetic), 2001 [6] Gintis, Herbert. Game Theory Evolving, A Problem-Centered Introduction to Modeling Strategic Interaction, Princeton University Press, 2000 [7] Neumann, John Von, Morgenstern, Oskar. Theory of Games and Economic Behavior, Princeton University Press, 1944 [8] David Eccles School of Business. Normal Curve Image. Self Administered Statistics Test, (http://www.business.utah.edu/masters/stattest/normal_table.htm), [9] Levent Koçkesen, Economics W4415, Columbia University, Lecture notes, (http://www.columbia.edu/ lk290/gameug.htm), [10] Boost File Descriptor Stream Wrapper, (http://www.josuttis.com/cppcode), [11] Eternity Persistence Library, (http://www.winghands.it/prodotti/eternity/overview.html), [12] Matlab GEA Toolbox, (http://www.geatbx.com/docu/fcnfun2.html), [13] Schwefel, H.-P. Numerical optimization of computer models, Chichester: Wiley Sons, 1981. [14] Abrams, J. Paul. A Hierarchal Genetic Algorithm for the Travelling Salesman Problem. 95.495 Honours Project, Carleton University, School of Computer Science, Winter, 2003 [15] Matthew’s Genetic Algorithms Library (GAlib), (http://lancet.mit.edu/ga/), 41
  • 42. Simple Game Source Code /* simple.c Simple Repeated Card Game John V. Kew II Includes the ability to use different combinations of agents in competition, including homogenous combinations. Also includes the ability to employ trigger strategies. Making a command-line interface just wasn’t worth it. */ #include <stdio.h> #include <stdlib.h> #include <time.h> /* Run Profiles Basic settings for certian classes of experiments. Global settings can be adjusted in all experiments. Replace "int" with desired integer, and order AGENT_ORDER depending upon the matchup desired. Global Settings - NUMAGENTS int GENERATIONS int SEXINTERVAL int DEATHS int MUTANTCHANCE int ALPHA int BETA int ZETA int Three Agents TYPES 3.0 GRIM_TRIGGER 0 FRIENDLY_TRIGGER 0 AGENT_ORDER {Sharer,Half,Hider} Two Agents TYPES 2.0 GRIM_TRIGGER 0 FRIENDLY_TRIGGER 0 AGENT_ORDER {Sharer,Half,Hider} 42
  • 43. Homogenous Population TYPES 1.0 AGENT_ORDER {Sharer,Half,Hider} GRIM_TRIGGER 0 FRIENDLY_TRIGGER 0 Grim Trigger - GRIM_TRIGGER 1 FRIENDLY_TRIGGER 0 FT_DURATION 0 AGENT_ORDER {Sharer,Half,Hider} TYPES 1.0 INITIAL_DEFECTORS int Friendly Trigger - FRIENDLY_TRIGGER 1 GRIM_TRIGGER 0 FT_DURATION int AGENT_ORDER {Sharer,Half,Hider} TYPES 1.0 INITIAL_DEFECTORS int Card Tables: static int samecard[2][2][2] = { { {BETA, BETA}, {BETA, BETA} }, { {BETA, BETA}, {BETA, BETA} } }; static int greater[2][2][2] = { { {BETA, BETA}, {ZETA, ALPHA} }, { {BETA, BETA}, {ZETA, ALPHA} } }; static int lessor[2][2][2] = { { {BETA, BETA}, {BETA, BETA} }, { {ALPHA, ZETA}, {ALPHA, ZETA} } }; */ #define NUMAGENTS 100 /* Number of Agents in System, int */ #define GENERATIONS 15000 /* Number of Generations, int */ #define SEXINTERVAL 100 /* Rate of Reproduction, In Generations */ #define DEATHS 5 /* Number of Deaths per Rep. Interval */ #define MUTANTCHANCE 1 /* Percent chance of Mutation, int */ #define ALPHA 2 /* Alpha payoff rate, int - See Table*/ #define BETA 1 /* Beta payoff rate, int */ #define ZETA 0 /* Zeta payoff rate, int */ #define TYPES 1.0 /* Number of Agent Types, of type double, used to control the nature of the run */ 43
  • 44. #define GRIM_TRIGGER 0 /* Grim trigger to hider state, boolean, GRIM_TRIGGER and FRIENDLY_TRIGGER are mutually exclusive */ #define FRIENDLY_TRIGGER 1 /* Friendly trigger to hider state */ #define FT_DURATION 1 /* Duration of the friendly trigger */ #define AGENT_ORDER {Sharer,Half,Hider} /* Agent order, used in conjuction with "TYPES" to control nature of run */ #define INITIAL_DEFECTORS 50 /* Initial Sharers defecting as hiders in trigger run */ /* Cutoffs for the draw probabilities */ #define SAMECUT 3 #define GREATERCUT 27 #define TOTALPROB 53.0 void q_sort(unsigned int [][], int, int); int main() { int i,j,agent,agentnum,draw,value,trigger; int decision1,decision2; int sharers = 0,hiders = 0,halfs = 0, triggered = 0; double average_score = 0, last_ave = 0, total_pot = 0; /* Agent[NUMAGENTS] = [type][payoff][trigger state/count] */ unsigned int pool[NUMAGENTS][3]; /* Card Tables */ static int samecard[2][2][2] = { { {BETA, BETA}, {BETA, BETA} }, { {BETA, BETA}, {BETA, BETA} } }; static int greater[2][2][2] = { { {BETA, BETA}, {ZETA, ALPHA} }, { {BETA, BETA}, {ZETA, ALPHA} } }; static int lessor[2][2][2] = { { {BETA, BETA}, {BETA, BETA} }, { {ALPHA, ZETA}, {ALPHA, ZETA} } }; /* Ordering of the agent types */ enum type AGENT_ORDER; srand(time(0)); /* Randomly Initialize Equal Proportions of Agents */ for (i = 0; i < NUMAGENTS; i++) { pool[i][0] = (int) (TYPES*rand()/(RAND_MAX+1.0)); pool[i][1] = 0; /* Total Value of Game to Agent */ pool[i][2] = 0; /* The finger is off the trigger */ } 44
  • 45. if (GRIM_TRIGGER || FRIENDLY_TRIGGER) for (i = 0; i < INITIAL_DEFECTORS; i++) pool[i][2] = 1; for (i = 0; i < GENERATIONS; i++) { halfs = 0; sharers = 0; hiders = 0; triggered = 0; for (j = 0; j < NUMAGENTS; j+=2) { /* j is our first agent, agentnum is our second agent - but moved to j+1 */ agentnum = j + 1 + (int) (((double)(NUMAGENTS-1-j))*rand()/(RAND_MAX+1.0)); agent = pool[agentnum][0]; value = pool[agentnum][1]; trigger = pool[agentnum][2]; pool[agentnum][0] = pool[j+1][0]; pool[agentnum][1] = pool[j+1][1]; pool[agentnum][2] = pool[j+1][2]; pool[j+1][0] = agent; pool[j+1][1] = value; pool[j+1][2] = trigger; /* Agent one decision making */ /* For the 50/50’s Decide what to do, and count the agent types */ if (pool[j][0] == Half) { decision1 = (int) (2.0*rand()/(RAND_MAX+1.0)); halfs++; } else { if (pool[j][0] == Sharer) { decision1 = 0; sharers++; } else if (pool[j][0] == Hider) { decision1 = 1; hiders++; } } /* Agent two special case decision making */ if (pool[j+1][0] == Half) { decision2 = (int) (2.0*rand()/(RAND_MAX+1.0)); halfs++; } else { if (pool[j+1][0] == Sharer) { 45
  • 46. decision2 = 0; sharers++; } else if (pool[j+1][0] == Hider) { decision2 = 1; hiders++; } } /* Trigger Decisions */ if (pool[j][2] != 0) { triggered++; decision1 = 1; if (pool[j][2] > 0) pool[j][2]--; /* decrement the FT Counter */ } if (pool[j+1][2] != 0) { triggered++; decision2 = 1; if (pool[j+1][2] > 0) pool[j+1][2]--; /* decrement the FT Counter */ } /* Draw the cards and play the game */ draw = 1 + (int) (TOTALPROB*rand()/(RAND_MAX+1.0)); if (draw <= SAMECUT) { pool[j][1] += samecard[decision2][decision1][1]; pool[j+1][1] += samecard[decision2][decision1][0]; } else if (draw > SAMECUT && draw <= GREATERCUT) { pool[j][1] += greater[decision2][decision1][1]; pool[j+1][1] += greater[decision2][decision1][0]; } else { pool[j][1] += lessor[decision2][decision1][1]; pool[j+1][1] += lessor[decision2][decision1][0]; } total_pot = pool[j][1] + pool[j+1][1]; if (GRIM_TRIGGER) { if (decision1 == 1) pool[j+1][2] = -1; if (decision2 == 1) pool[j][2] = -1; } if (FRIENDLY_TRIGGER) { if (decision1 == 1) 46
  • 47. pool[j+1][2] = FT_DURATION; if (decision2 == 1) pool[j][2] = FT_DURATION; } } average_score = total_pot / NUMAGENTS; total_pot = 0; /* Reporting */ printf("%d %d %d %d %f %f %dn",i,sharers,hiders,halfs,average_score, average_score - last_ave, triggered); last_ave = average_score; /* Reproduction of most successful agents */ if (i % SEXINTERVAL != 0) continue; q_sort(pool, 0, NUMAGENTS - 1); for (j = 0; j < DEATHS; j++) { pool[j][0] = pool[NUMAGENTS - 1 - j][0]; pool[j][1] = pool[NUMAGENTS - 1 - j][1]; pool[j][2] = pool[NUMAGENTS - 1 - j][2]; /* active defectors replicate too */ if ((1 + (int) (100.0*rand()/(RAND_MAX+1.0))) == MUTANTCHANCE) pool[j][0] = (int) ((TYPES)*rand()/(RAND_MAX+1.0)); } } return 0; } /* Quick sort code copied and modified from Michael Lamont’s Knowledge Base at http://linux.wku.edu/~lamonml/kb.html and distributed under the Open Publication License (the latest version is presently available at http://www.opencontent.org/openpub/). */ void q_sort(unsigned int numbers[NUMAGENTS][3], int left, int right) { int pivot, l_hold, r_hold, pivot_data, more_data; l_hold = left; r_hold = right; pivot = numbers[left][1]; pivot_data = numbers[left][0]; more_data = numbers[left][2]; while (left < right) 47
  • 48. { while ((numbers[right][1] >= pivot) && (left < right)) right--; if (left != right) { numbers[left][1] = numbers[right][1]; numbers[left][0] = numbers[right][0]; numbers[left][2] = numbers[right][2]; left++; } while ((numbers[left][1] <= pivot) && (left < right)) left++; if (left != right) { numbers[right][0] = numbers[left][0]; numbers[right][1] = numbers[left][1]; numbers[right][2] = numbers[left][2]; right--; } } numbers[left][1] = pivot; numbers[left][0] = pivot_data; numbers[left][2] = more_data; pivot = left; left = l_hold; right = r_hold; if (left < pivot) q_sort(numbers, left, pivot-1); if (right > pivot) q_sort(numbers, pivot+1, right); } 48
  • 49. Meta-GPE Source Code #ifndef META_H #define META_H #include "eternity/eternity.hpp" /* DEFAULT SETTINGS */ #define NUMAGENTS 100 /* Number of Agents in System, int */ #define GENERATIONS 100 /* Number of Generations, int */ #define SEXINTERVAL 100 /* Rate of Reproduction, In Generations */ #define DEATHS 5 /* Number of Deaths per Rep. Interval */ #define MUTANTCHANCE 1 /* Percent chance of Mutation, int */ #define GRIM_TRIGGER 0 /* Grim trigger to hider state, boolean, GRIM_TRIGGER and FRIENDLY_TRIGGER are mutually exclusive */ #define FRIENDLY_TRIGGER 1 /* Friendly trigger to hider state */ #define FT_DURATION 1 /* Duration of the friendly trigger */ #define INITIAL_DEFECTORS 50 /* Initial Sharers defecting as hiders in trigger run */ int create_agent(int fd[2],agent_control); /* send initial control file */ int step_agent(int fd[2],agent_control); /* send incremental control file */ solution_set collect_solutions(int fd[2]); /* get solutions from agent and put it in big solution_set */ agent_stats agent_report(int fd[2]); /* get agent report, add to big stats */ void q_sort(vector< vector<double> > &numbers, int left, int right); /* sort function */ static void sig_pipe(int); static void sig_chld(int); class meta_control { public: unsigned int dimen; int loval; int hival; int prb; unsigned int agent_popsize; float agent_pmut; float agent_pcross; unsigned int initial_sdev; unsigned int initial_mean; unsigned int random_select; 49
  • 50. unsigned int popsize; unsigned int ngen; unsigned int sex_interval; unsigned int select_prob; unsigned int deaths; unsigned int mutant_chance; unsigned int grim_trigger; unsigned int friendly_trigger; unsigned int ft_duration; unsigned int initial_defectors; int seed; void xml_serialize( xml_archive &xml) { if (xml.is_loading()) { xml.read("dimen",dimen,0); xml.read("loval",loval,0); xml.read("hival",hival,0); xml.read("prb",prb,0); xml.read("select_prob", select_prob, 0); xml.read("agent_popsize",agent_popsize,0); xml.read("agent_pmut",agent_pmut,0); xml.read("agent_pcross",agent_pcross,0); xml.read("initial_sdev", initial_sdev,0); xml.read("initial_mean", initial_mean,0); xml.read("random_select", random_select,0); xml.read("popsize",popsize,0); xml.read("ngen",ngen,0); xml.read("sex_interval",sex_interval,0); xml.read("deaths",deaths,0); xml.read("mutant_chance",mutant_chance,0); xml.read("grim_trigger",grim_trigger,0); xml.read("friendly_trigger",friendly_trigger,0); xml.read("ft_duration",ft_duration,0); xml.read("initial_defectors",initial_defectors,0); xml.read("seed",seed,0); } else { xml.write("dimen",dimen); xml.write("loval",loval); xml.write("hival",hival); xml.write("prb",prb); xml.write("select_prob", select_prob); xml.write("agent_popsize",agent_popsize); xml.write("agent_pmut",agent_pmut); xml.write("agent_pcross",agent_pcross); 50
  • 51. xml.write("initial_sdev", initial_sdev); xml.write("initial_mean", initial_mean); xml.write("random_select", random_select); xml.write("popsize",popsize); xml.write("ngen",ngen); xml.write("sex_interval",sex_interval); xml.write("deaths",deaths); xml.write("mutant_chance",mutant_chance); xml.write("grim_trigger",grim_trigger); xml.write("friendly_trigger",friendly_trigger); xml.write("ft_duration",ft_duration); xml.write("initial_defectors",initial_defectors); xml.write("seed",seed); } } }; #endif #ifndef MAIN_C #define MAIN_C #include <iostream> #include <list> #include <vector> #include <time.h> #include <error.h> #include <signal.h> #include <sys/types.h> #include <sys/wait.h> #include <sys/socket.h> #include <sys/stat.h> #include <unistd.h> #include "agent.h" #include "statistics.h" #include "solution_set.h" #include "boost/fdstream.hpp" #include "meta.h" using namespace std; static void sig_pipe(int signo) { cout << "SIGPIPE caught" << endl; 51
  • 52. } static void sig_chld(int signo) { waitpid(-1,NULL,WNOHANG); } int create_agent(int fd[2], agent_control ac) { int pid; xml_archive out; fd[0] = 0; fd[1] = 0; // create pipe if (socketpair(AF_UNIX, SOCK_STREAM, 0, fd) < 0) perror("Error Setting up Pipe"); if ( (pid = fork()) < 0 ) perror("Error forking"); else if (pid == 0) { /* Advanced Programming in the Unix Enviroment pg 477 */ close(fd[0]); if (fd[1] != STDIN_FILENO) if (dup2(fd[1],STDIN_FILENO) != STDIN_FILENO) perror("dup2 error in stdin redirect"); if (fd[1] != STDOUT_FILENO) if (dup2(fd[1],STDOUT_FILENO) != STDOUT_FILENO) perror("dup2 error in stdout redirect"); if (execl("agent", "agent", "load", "", NULL) < 0) perror("Agent exec error"); } else { close(fd[1]); fd[1] = pid; boost::fdostream outStream(fd[0]); out.open("",archive::store, (std::iostream* ) &outStream); ac.xml_serialize(out); out.close(); } return 1; } int step_agent(int fd[2], agent_control ac) { xml_archive out; boost::fdostream outStream(fd[0]); out.open("",archive::store, (std::iostream* ) &outStream); ac.xml_serialize(out); outStream.clear(); out.close(); 52
  • 53. return 1; } solution_set collect_solutions(int fd[2]) { solution_set ss; xml_archive in; xml_archive debug; if (kill(fd[1],SIGALRM) < 0) perror("Unable to signal Agent"); boost::fdistream inStream(fd[0]); in.open("",archive::load, (std::iostream* ) &inStream); ss.xml_serialize(in); inStream.clear(); in.close(); ss.prune(); return ss; } agent_stats agent_report(int fd[2]) { agent_stats as; xml_archive in; boost::fdistream inStream(fd[0]); in.open("",archive::load, (std::iostream* ) &inStream); as.xml_serialize(in); inStream.clear(); in.close(); // cout << "(" << as.ave_score << ")" << endl; return as; } int main(int argc, char **argv) { int i,j,agent,agentnum,draw,value,trigger; int fd[2]; int end_count = 50; char datafile[25]; char agentfile[25]; char status[25]; int s; ofstream ssdat; ofstream afile; ofstream stats; double ave, last_ave; vector < vector<double> > pool; vector <double> a; 53
  • 54. meta_control mc; agent_control ac; agent_stats as; solution_set ss; solution_set shared_set; xml_archive archive; xml_archive sharedata; xml_archive debug; bool cfgwrite; bool happy_trigger; char * cfg_file = 0; ave = last_ave = 0; mc.dimen = ac.dimen = 2; mc.loval = ac.loval = -5; mc.hival = ac.hival = 5; mc.prb = ac.prb = 0; mc.initial_sdev = 20; mc.initial_mean = 50; mc.random_select = 0; mc.agent_popsize = ac.popsize = 100; mc.agent_pmut = ac.pmut = .01; mc.agent_pcross = ac.pcross = .6; mc.select_prob = 100; mc.popsize = NUMAGENTS; mc.ngen = ac.ngen = GENERATIONS; mc.sex_interval = SEXINTERVAL; mc.deaths = DEATHS; mc.mutant_chance = MUTANTCHANCE; mc.grim_trigger = GRIM_TRIGGER; mc.friendly_trigger = FRIENDLY_TRIGGER; mc.ft_duration = FT_DURATION; mc.initial_defectors = INITIAL_DEFECTORS; mc.seed = ac.seed = 0; if (argc < 2) { cout << "Using a config file:" << endl; cout << "meta load [file]" << endl; cout << "Creating a default config file:" << endl; cout << "meta write [file]" << endl; return 0; } 54
  • 55. for(int i=1; i<argc; i++) { if(strcmp(argv[i],"load") == 0) { cfg_file = argv[++i]; cfgwrite = false; continue; } else if(strcmp(argv[i],"write") == 0) { cfg_file = argv[++i]; cfgwrite = true; continue; } } if (cfg_file == 0) { cout << "A config file must be specified with either "; cout << ""load" or "write"" << endl; return 0; } if (cfgwrite) { archive.open(cfg_file, archive::store); mc.xml_serialize(archive); archive.close(); } else { archive.open(cfg_file, archive::load); mc.xml_serialize(archive); archive.close(); } sprintf(datafile,"data/M-%d-%d-%d.txt", mc.prb, mc.popsize, mc.ngen); ssdat.open(datafile); cout << "Writing Shared Solution Data to " << datafile << endl; sprintf(datafile,"data/S-%d-%d-%d.txt", mc.prb, mc.popsize, mc.ngen); stats.open(datafile); cout << "Writing Statistics to " << datafile << endl; cout << "Agent Shared Solutions are in AS-" << mc.prb; cout << "-" << mc.popsize << "-" << mc.ngen << "-[AGENT #]" << endl; /* Setup Default Agent Control Object */ ac.dimen = mc.dimen; ac.loval = mc.loval; ac.hival = mc.hival; ac.prb = mc.prb; ac.popsize = mc.agent_popsize; ac.pmut = mc.agent_pmut; 55
  • 56. ac.pcross = mc.agent_pcross; ac.ngen = mc.ngen; ac.seed = mc.seed; if (!mc.seed) srand(time(0)); //reset pipe max to system max // setup signal handlers if (signal(SIGPIPE, sig_pipe) == SIG_ERR) perror("Error Setting up SIGPIPE Handler"); if (signal(SIGCHLD, sig_chld) == SIG_ERR) perror("Error Setting up SIGCHLD Handler"); cout << "Creating Agents" << endl; for (i = 0; i < mc.popsize; i++) { /* Create Agent */ a.push_back(i); /* Agent ID */ cout << "(" << a[0] << "," << i << ")"; a.push_back(0); /* Last Sucess Value of Agent */ a.push_back(0); /* The finger is off the trigger */ if (mc.random_select) { a.push_back((int) (100.0*rand()/(RAND_MAX+1.0))); /* Position, in percent value of normal curve */ a.push_back((int) (100.0*rand()/(RAND_MAX+1.0))); /* Standard Deviation of the normal curve, int */ } else { a.push_back(mc.initial_mean); a.push_back(mc.initial_sdev); } a.push_back(0); /* 1st fd */ a.push_back(0); /* pid */ pool.push_back(a); fd[0] = (int) a[5]; fd[1] = (int) a[6]; ac.id = (int) a[0]; ac.center = a[3]; ac.stddev = a[4]; ac.seed = time(0) + i; if (!create_agent(fd,ac)) perror("Error spawning agent"); cout << ".[" << ac.id << "]"; pool[i][5] = fd[0]; pool[i][6] = fd[1]; a.clear(); } 56
  • 57. a.clear(); a.resize(mc.popsize, 0); cout << endl << "Setting Initial Defectors" << endl; if (mc.grim_trigger || mc.friendly_trigger) for (i = 0; i < mc.initial_defectors; i++) if (mc.grim_trigger) pool[i][2] = -1; /* Agent will defect permenantly */ else pool[i][2] = mc.ft_duration; if (mc.ft_duration == -2) /* Happy Trigger is set */ happy_trigger = true; cout << "Starting Evolution" << endl; for (i = 0; i < mc.ngen; i++) { cout << "GENERATION " << i << " ["; stats << i << " "; /* Test Agents */ /* Distribution of Solutions */ //ac.shared = shared_set; for (j = 0; j < mc.popsize; j++) { fd[0] = (int) pool[j][5]; fd[1] = (int) pool[j][6]; ac.id = (int) pool[j][0]; ac.center = pool[j][3]; ac.stddev = pool[j][4]; if (!step_agent(fd,ac)) perror("Error stepping agent"); cout << "."; cout.flush(); } /* Set Triggers */ /* Reporting */ cout << "]-R-["; cout.flush(); shared_set.clear(); last_ave = ave; ave = 0; for (j = 0; j < mc.popsize; j++) { ss.clear(); fd[0] = (int) pool[j][5]; fd[1] = (int) pool[j][6]; ac.id = (int) pool[j][0]; ac.center = pool[j][3]; 57
  • 58. ac.stddev = pool[j][4]; as = agent_report(fd); ss = collect_solutions(fd); /* Do something with the statistics */ /* get a listing of agent scores ordered by agent id */ pool[j][1] = a[((int) pool[j][0])] = as.ave_score; ave += as.ave_score; sprintf(agentfile,"data/AS-%d-%d-%d-%d.txt", mc.prb, mc.popsize, mc.ngen, (int) ac.id); afile.open(agentfile, ofstream::out | ofstream::app); afile << "# Generation " << i << endl; ss.write(afile); afile.close(); /* add in solution set */ /* p/10000 only add solutions if not triggered */ if (pool[j][2] == 0 || (happy_trigger && i > 0 && as.ave_score <= last_ave) ){ shared_set.add_some_solutions(mc.select_prob,ss); } else if (mc.friendly_trigger) pool[j][2]--; /* Decrement the friendly trigger */ cout << "."; cout.flush(); } ssdat << "# Generation " << i << endl; shared_set.write(ssdat); ave = ave / mc.popsize; for (j = 0; j < mc.popsize; j++) stats << a[j] << " "; stats << ave << " " << shared_set.size() << endl; cout << "][" << ave << "]-S-[" << shared_set.size() << "]"; /* The Shared Solutions are about the only thing that is easily shared off of one file... this can be a very large file */ sharedata.open("current_shared_solutions.xml", archive::store); shared_set.xml_serialize(sharedata); sharedata.close(); /* Writing Shared Solutions to Data File*/ //ssdat << i << " " << shared_set.size() << " "; ssdat.flush(); //ssdat << endl; /* Notify agents that the solutions are available */ for (j = 0; j < mc.popsize; j++) 58
  • 59. if (kill((int)pool[j][6],SIGALRM) < 0) perror("Unable to signal Agent"); /* Reproduction of most successful agents, Death, and Mutation */ cout << "-S-"; if (i % mc.sex_interval != 0) continue; q_sort(pool, 0, mc.popsize - 1); if (pool[0][1] == pool[mc.popsize - 1][1]) { if (!end_count) { cout << endl << "Worst Agent Score Equals Best Agent Score" << endl; cout << "Killing agents:"; for (j = 0; j < mc.popsize; j++) { if (kill((int)pool[j][6],SIGKILL) < 0) perror("Unable to signal Agent"); cout << "."; } cout << endl; break; } else end_count--; } else if (end_count != 50) end_count = 50; cout << "M-"; for (j = 0; j < mc.deaths; j++) { // Mark Agent Death //sprintf(agentfile,"data/AS-%d-%d-%d-%d.txt", mc.prb, mc.popsize, mc.ngen, j); //afile.open(agentfile, ofstream::out | ofstream::app); //afile << "# AGENT DEATH" << i << endl; //afile.close(); cout << "[" << pool[j][0] << "," << pool[mc.popsize - 1 - j][0] << "]"; cout << "[" << pool[j][1] << "," << pool[mc.popsize - 1 - j][1] << "]"; //pool[j][0] = i + pool[j][0]/1000; /* New Agent ID = gen.(deadid/1000) */ pool[j][1] = pool[mc.popsize - 1 - j][1]; /* Score */ //pool[j][2] = pool[mc.popsize - 1 - j][2]; /* active defectors */ pool[j][3] = pool[mc.popsize - 1 - j][3]; /* Curve Position */ pool[j][4] = pool[mc.popsize - 1 - j][4]; /* Std Dev*/ /* replicate too */ /* Insert Mutation Code Here */ if (((int) (100.0*rand()/RAND_MAX+1.0)+1) <= mc.mutant_chance) { draw = 0; if (pool[j][3] < 100 & pool[j][3] > 0) draw = ((int) (3.0*rand()/RAND_MAX+1)) - 2; 59
  • 60. pool[j][3] += draw; cout << "[" << draw << ","; draw = 0; if (pool[j][4] < 100 & pool[j][4] > 0) draw = ((int) (3.0*rand()/RAND_MAX+1)) - 2; pool[j][4] += draw; cout << draw << "]"; } } cout << "DONE" << endl; cout.flush(); } cout << endl; ssdat.close(); stats.close(); return 0; } /* Quick sort code copied and modified from Michael Lamont’s Knowledge Base at http://linux.wku.edu/~lamonml/kb.html and distributed under the Open Publication License (the latest version is presently available at http://www.opencontent.org/openpub/). */ void q_sort(vector< vector<double> > &numbers, int left, int right) { double pivot; int l_hold, r_hold, i; double data[7]; l_hold = left; r_hold = right; pivot = numbers[left][1]; for (i=0; i < 7; i++) data[i] = numbers[left][i]; while (left < right) { while ((numbers[right][1] >= pivot) && (left < right)) right--; if (left != right) { for (i=0; i < 7; i++) numbers[left][i] = numbers[right][i]; left++; } 60
  • 61. while ((numbers[left][1] <= pivot) && (left < right)) left++; if (left != right) { for (i=0; i < 7; i++) numbers[right][i] = numbers[left][i]; right--; } } for (i=0; i < 7; i++) numbers[left][i] = data[i]; pivot = left; left = l_hold; right = r_hold; if (left < pivot) q_sort(numbers, left, (int) pivot-1); if (right > pivot) q_sort(numbers, (int) pivot+1, right); } #endif 61
  • 62. Agent-GPE Source Code #ifndef AGENT_H #define AGENT_H #define BITS 31 #define PI (3.1415926535897932384626433832795028841971693993751f) #include <iostream> #include "eternity/eternity.hpp" #include "solution_set.h" #include "functions.h" #include <ga/ga.h> using namespace eternity; // These functions unfortunatly assume a relatively even distribution // Periodically there will be a very, very low solution which will // throw everything for a loop. Replace with one that only considers // a max and min as less then 2 std deviations. /* This function adjusts the mean given by the Meta-GPE for use in selecting individuals from the Agent-GPE’s population. It assumes that the given mean is from zero to 100 This function does not actually calculate a mean. realMax = maximum of population realMin = minimum of population givenMean = mean if score range was 1-100 */ float adjMean(float realMax, float realMin, float givenMean) { //cout << (((realMax - realMin)/100)*givenMean + realMin) << " new mean" << endl; return (((realMax - realMin)/100)*givenMean + realMin); } /* This function adjusts the given standard deviation to match the current population */ float adjStddev(float realMax, float realMin, float givenStddev) { //cout << (((realMax - realMin)/100)*givenStddev) << " new sd" << endl; return (((realMax - realMin)/100)*givenStddev); } /* Excludes low scoring solutions more than two stddev from mean from selection. 62
  • 63. As a population evolves, there’s a tendancy for solutions to have less diversification. Ussually, however, there is a small number of individuals who by mutation or breeding have extremely weak scores. This shifts the center of the population down, and scews results. By excluding any individual more than two standard deviations from the actual mean of the populations we shift the center a little bit higher. rMax = max of pop rMin = min of pop rMean = mean of pop rStddev = stddev of pop gMean = center to map to */ float adjMean95(float rMax, float rMin, float rMean, float rStddev, float gMean) { float min, max; if (rMin < (rMean - 2*rStddev)) min = (rMean - 2*rStddev); else min = rMin; max = rMax; return adjMean(max,min,gMean); } /* Excludes low scoring solutions more than two stddev from stddev of selection. rMax = max of pop rMin = min of pop rMean = mean of pop rStddev = stddev of pop gMean = center to map to */ float adjStddev95(float rMax, float rMin, float rMean, float rStddev, float gStddev){ float min, max; if (rMin < (rMean - 2*rStddev)) min = (rMean - 2*rStddev); else min = rMin; max = rMax; return adjStddev(max,min,gStddev); } class agent_control { 63