<!DOCTYPE article PUBLIC "-//NLM//DTD JATS (Z39.96) Journal Archiving and Interchange DTD v1.0 20120330//EN" "JATS-archivearticle1.dtd">
<article xmlns:xlink="http://www.w3.org/1999/xlink">
  <front>
    <journal-meta />
    <article-meta>
      <title-group>
        <article-title>Simulation of Minority Game in TuCSoN</article-title>
      </title-group>
      <contrib-group>
        <contrib contrib-type="author">
          <string-name>Enrico Oliva Mirko Viroli Andrea Omicini</string-name>
          <email>andrea.omicini@unibo.it</email>
          <email>enrico.oliva@unibo.it</email>
          <email>mirko.viroli@unibo.it</email>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>I. APPLICATION DOMAIN</string-name>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <aff id="aff0">
          <label>0</label>
          <institution>Agent Coordination Artifact</institution>
        </aff>
      </contrib-group>
      <fpage>6</fpage>
      <lpage>9</lpage>
    </article-meta>
  </front>
  <body>
    <sec id="sec-1">
      <title>-</title>
      <p>
        Minority Game (MG) is a mathematical model that takes
inspiration from the “El Farol Bar” problem introduced by
Brian Arthur (
        <xref ref-type="bibr" rid="ref1">1</xref>
        ). It is based on a simple scenario where at each
step a set of agents perform a boolean vote which conceptually
splits them in two classes: the agents in the smaller class win.
In this game, a rational agent keeps track of previous votes
and victories, and has the goal of winning throughout the steps
of the game—for which a rational strategy has to be figured
out.
      </p>
      <p>
        One of the most important applications of MG is in the
market models: (
        <xref ref-type="bibr" rid="ref2">2</xref>
        ) use MG as a coarse-grained model for
financial markets to study their fluctuation phenomena and
statistical properties. Even though the model is coarse-grained
and provides an over-simplified micro-scale description, it
anyway captures the most relevant features of system interaction,
and generates collective properties that are quite similar to
those of the real system.
      </p>
      <p>
        Another point of view, presented e.g. by (
        <xref ref-type="bibr" rid="ref3">3</xref>
        ), considers the
MG as a point in space of a Resource Allocation Game (RAG).
In this work a generalisation of MG is presented that relaxes
the constraints on the number of resources, studying how the
system behaves within a given range.
      </p>
      <p>MG can be considered a social simulation that aims to
reproduce a simplified human scenario. In principle, a logic-based
approach based on BDI agent makes it easier to explicitly
model a variety of diverse social behaviours.</p>
      <p>
        As showed by (
        <xref ref-type="bibr" rid="ref4">4</xref>
        ), a multiagent system (MAS) can be used
to realise a MG simulation—there, BDI agents provide for
rationality and planning. An agent-based simulation is
particularly useful when the simulated systems include autonomous
entities that are diverse, thus making it difficult to exploit the
traditional framework of mathematical equations.
      </p>
      <p>
        In order to implement MG simulations we adopt the
TuCSoN infrastructure for agent coordination (
        <xref ref-type="bibr" rid="ref5">5</xref>
        ), which
introduces tuple centres as artifact representatives. A tuple centre
is a programmable coordination medium living in the MAS
environment, used by agents interacting by exchanging tuples
(logic tuples in the case of TuCSoN logic tuple centres). As
we are not concerned much with the mere issues of agent
intelligence, we rely here on a weak form of rationality,
through logic-based agents adopting pre-compiled plans called
operating instructions (
        <xref ref-type="bibr" rid="ref6">6</xref>
        ).
Tuning
      </p>
      <p>Player</p>
      <p>Monitor
Fig. 1. TuCSoN Simulation Framework for MG</p>
    </sec>
    <sec id="sec-2">
      <title>II. LOGIC ARCHITECTURE</title>
      <p>
        The architecture proposed for MAS simulation is based on
TuCSoN (
        <xref ref-type="bibr" rid="ref5">5</xref>
        ), which is an infrastructure for the coordination of
MASs. TuCSoN provides agents with an environment made
of logic tuple centres, which are logic-based programmable
tuple spaces. The language used to program the coordination
behaviour of tuple centres is ReSpecT, which specifies how
a tuple centre has to react to an observable event (e.g. when
a new tuple is inserted) and has to accordingly change the
tuple-set state (
        <xref ref-type="bibr" rid="ref7">7</xref>
        ). Tuple centres are a possible incarnation of
the coordination artifact notion (
        <xref ref-type="bibr" rid="ref8">8</xref>
        ), representing a device that
persists independently of agent life-cycle and provides services
to let agents participate to social activities.
      </p>
      <p>In our simulation framework we adopt logic-based agents,
namely, agents built using a logic programming style, keeping
a knowledge base (KB) of facts and acting according to
some rule—rules and facts thus forming a logic theory. The
implementation is based on tuProlog technology1 for
JavaProlog integration, and relies on its inference capabilities for
agent rationality. Agents roughly follow the BDI architecture,
as the KB models agent beliefs while rules model agent
intentions.</p>
      <p>Three kinds of agents are used in our simulation: player
agents, monitor agents and tuning agents (as depicted in
Figure 1): all the agents share the same coordination artifact.
The agent types differ because of their role and behaviour:
player agents play MG, the monitor agent is an observer
1http://tuprolog.alice.unibo.it
of interactions which visualises the progress of the system,
the tuning agent can change some rules or parameters of
coordination, and drives the simulation to new states. Note
that the main advantage of allowing a dynamic tuning of
parameters instead of running different simulations lays in
the possibility of tackling emergent aspects which would not
necessarily appear in new runs.</p>
      <p>The main control loop of a player agent is a sequence of
actions: observing the world, updating its KB, scheduling next
intention, elaborating and executing a plan. To connect agent
mental states with interactions we use the concept of action
preconditions and perception effects as usual.</p>
    </sec>
    <sec id="sec-3">
      <title>III. MINORITY GAME PERFORMANCE</title>
      <p>To track the performance of an MG system, the most
interesting quantity is variance, defined as σ2 = [A(t) − A(t)]2: it
shows the variability of the bets around the average value A(t).
In particular, the normalised version of variance ρ = σ2/N is
considered. Figure 3 shows a typical evolution of the game.</p>
      <p>Generally speaking, variance is the inverse of global
efficiency: as variance decreases agent coordination improves,
making more agents winning. Variance is interestingly affected
by the parameters of the model, such as number of agents (N ),
memory (m) and number of strategies (s): in particular, the
fluctuation of variance is shown to depend only on the ratio
α = 2m/N between agent memory and the number N of
agents.</p>
      <p>The results of observations suggest that the behaviour of
MG can be classified in two phases: an information-rich
asymmetric phase, and an unpredictable or symmetric phase.
A phase transition is located where σ2/N attains its minimum
(αc = 1/2), and it separates the symmetric phase with α &lt; αc
from an asymmetric phase with α &gt; αc.</p>
      <p>All these cases have been observed with the TuCSoN
Agent msiemnutalaltsiotanteframework described in next section.</p>
      <p>IV. THE SIMULATION FRAMEEWfOfeRcKts</p>
      <p>The construction of MG simulations with MASs is based
on the TuCSoN framework and on tuProlog as an inferential
engine to program logic agents. The main innovative aspect
of this MG simulation is the possibility of studying the
reconditions</p>
      <sec id="sec-3-1">
        <title>Preconditions</title>
        <p>Beliefs
Desires
Intentions</p>
      </sec>
      <sec id="sec-3-2">
        <title>Effects</title>
      </sec>
      <sec id="sec-3-3">
        <title>Action</title>
      </sec>
      <sec id="sec-3-4">
        <title>Perception</title>
        <p>evolution of the system with particular and different kinds of
agent behaviour at the micro level, imposed as coordination
parameters which are changed on-the-fly.</p>
        <sec id="sec-3-4-1">
          <title>A. Operating Instructions</title>
          <p>
            Each agent has an internal plan, structured as an algebraic
composition of allowed actions (with their preconditions) and
perceptions (with their effects), that enables the agent to use
the coordination artifact to play the MG. This plan can be
seen as Operating Instructions (
            <xref ref-type="bibr" rid="ref6">6</xref>
            ), a formal description based
on Labelled Transition System (LTS) that the agent reads to
understand what its step-by-step behaviour should be. Through
an inference process, the agent accordingly chooses the next
action to execute, thus performing the cycle described in
Section 2.
          </p>
          <p>Operating instructions are expressed by the following
theory:
firststate(agent(first,[])).
definitions([
def(first,[],...),
def(main,[S],
[act(out(play(X)),pre(choice(S,X))),
per(in(result(Y)),eff(res(Y))),
agent(main,[S])]</p>
          <p>The first part of operating instructions is expressed by
term first, where the agent reads the game parameters that
are stored in the KB, and randomly creates its own set of
strategies.</p>
          <p>In the successive part main, the agent executes its main
cycle. It first puts tuple play(X) in the tuple space, where
X = ±1 is agent vote. The precondition of this action
choice(S,X) is used to bind in the KB X with the
value currently chosen by the agent according to strategy S.
Then, the agent gets the whole result of the game in tuple
result(Y) and applies it to its KB. After this perception,
the cycle is iterated again.</p>
        </sec>
        <sec id="sec-3-4-2">
          <title>B. Tuple Centre Behaviour</title>
          <p>The interaction protocol between agents and the
coordination artifact is then simply structured as follows. First each
agent puts the tuple for its vote. When the tuples for all agents
have been received, the tuple centre checks them, computes the
result of the game—either 1 or −1 is winning—and prepares
a result tuple to be read by agents.</p>
          <p>The ReSpecT program for this behaviour is loaded in the
tuple centre by a configuration agent at bootstrap, through
operation set_spec(). The following ReSpecT reaction
is fired when an agent inserts tuple play(X), and triggers
the whole behaviour:
reaction(out(play(X)),(
in_r(count(Y)),
Z is Y+1,
in_r(sum(M)),
V is M+X,
out_r(sum(V)),
out_r(count(Z))
)).</p>
          <p>This reaction considers the bet (X) counts the bets (Z)
and computes the partial result of the game (V). When
all the agents have played, the artifact produces the tuple
winner(R,NS,NumberOfLoss,MemorySize,last/more) which
is the main tuple of MG coordination.
reaction(out_r(count(X)),(
rd_r(numag(Num)),
X=:=Num,
in_r(totcount(T)),
P is T+1,
rd_r(game(G)),
in_r(sum(A)),
out_r(sum(0)),
rd_r(countsession(CS)),
in_r(count(Y)),
out_r(count(0)),
%%calculate variance
in_r(qsum(SQ)),
NSQ is A*A+SQ,
out_r(qsum(NSQ)),
%%calculate mean
in_r(totsum(R)),
NewS is R+A,
out_r(totsum(NewS)),
rd_r(numloss(NumberOfLoss)),
rd_r(mem(MemorySize)),
out_r(winner(A,P,CS,NumberOfLoss,MemorySize,G)),
out_r(totcount(P))
)).</p>
          <p>The winner tuple contain the result of game (R), the
number of step (NS), two tuning parameters (NumberOfLoss
and MemorySize) and one constant to communicate agents
whether they have to stop or to play further (last/more).
Figure 5 reports the graphical interface of the monitor agent
that during its life-time reads the tuple winner and draws
variance.</p>
        </sec>
        <sec id="sec-3-4-3">
          <title>C. Tuning the Simulation</title>
          <p>In classical MG simulation there are a number of parameters
that can affect the system behaviour, which are explicitly
represented in the tuple centre in form of tuples: the number of
agents numag(X), memory size mem(X), and the number of
strategies numstr(X). In our framework, we have introduced
as a further parameter the number of wrong moves after
which the single agent should be recalculate own strategy,
represented as a tuple numloss(X). Such a threshold is
seemingly useful to break the symmetry in the strategy space
when the system is in a pathological state, i.e., when all
agents have the same behaviour and the game oscillates from
minimum to maximum value.</p>
          <p>In our framework, it is possible to explore the possibility
to dynamically tune up the coordination rules by changing
numloss and mem coordination parameters, which are stored
as tuples in the coordination artifact. The simulation
architecture built in this way, in fact, allows for on-the-fly change of
some game configuration parameters—such as the dimension
of agent memory—with no need to stop the simulation and
re-program the agents.</p>
          <p>By changing the parameters, the tuning agent can drive the
system from an equilibrium state to another, by controlling
agent strategies, the dimension of memory, or the number of
losses that an agent can accept before discarding a strategy.
This agent observes system variance, and decides whether and
how to change tuning parameters: reference variance is
calculated by first making agents playing the game randomly—
see Figure 4. The new value of parameters is stored in
tuple centre through tuples numloss(NumberOfLoss) and
mem(MemorySize), the rules of coordination react and
update the information that will be read by the agents.</p>
        </sec>
        <sec id="sec-3-4-4">
          <title>D. Simulation Results</title>
          <p>The result of the tuned simulation in Figures 6 and 7 shows
how the system changes its equilibrium state and achieves
a better value of variance.2 In this simulation the tuning
agent is played by a human that observes the evolution of
the system and acts through the tuning interface to change
the coordination parameters, such as threshold of losses and
memory, hopefully finding new and better configurations. The
introduction of the threshold of losses in the agent behaviour
is useful when the game is played by few agents: these
parameters enable system evolution and a better agent cooperative
behaviour.</p>
        </sec>
      </sec>
    </sec>
    <sec id="sec-4">
      <title>V. PERSPECTIVES</title>
      <p>In this paper, we aim at introducing new perspectives on
agent-based simulation by adopting a novel MAS meta-model
based on agents and artifacts, and by applying it to Minority
Game simulation. We implement and study MG over the
TuCSoN coordination infrastructure, and show some benefits
of the artifact model in terms of flexibility and controllability
of the simulation. In particular, in this work we focus on the
possibility to build a feedback loop on the rules of coordination
driving a system to a new and better equilibrium state.</p>
      <p>We foresee some new perspectives in the use of the
TuCSoN simulation framework in a industrial environment.
The first one is to use the system to drive manufacturing in
case of limited resources. In this scenario each agent is a
halfprocessed item, whose production has to be completed as faster
as possible, and whose access to the resources is regulated by
dedicated resource artifacts. Another possible perspective is
to evaluate the product demand and production in order to
drive industry through market fluctuation. In our framework
we could model a market scenario by minority rules, and
then try to evaluate demand. Furthermore, all such applications
would benefit from using a logic-based approach rather than
an equation-based approach.</p>
      <p>2In Figure 6, the first phase of equilibrium is followed by a second one
obtained by changing the threshold parameter S = 5. Finally, a third phase
is obtained changing the dimension of the memory to m = 5.</p>
    </sec>
    <sec id="sec-5">
      <title>VI. ACKNOWLEDGEMENTS</title>
      <p>The first author of this paper would like to thank Dr.
Peter McBurney and the Department of Computer Science at
University of Liverpool for their scientific support and their
hospitality during his stay in Liverpool, when this paper was
mostly written.</p>
    </sec>
  </body>
  <back>
    <ref-list>
      <ref id="ref1">
        <mixed-citation>
          [1]
          <string-name>
            <given-names>W. B.</given-names>
            <surname>Arthur</surname>
          </string-name>
          , “
          <article-title>Inductive reasoning and bounded rationality (the El Farol problem</article-title>
          ),
          <source>” American Economic Review</source>
          , vol.
          <volume>84</volume>
          , no.
          <issue>2</issue>
          , pp.
          <fpage>406</fpage>
          -
          <lpage>411</lpage>
          , May
          <year>1994</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref2">
        <mixed-citation>
          [2]
          <string-name>
            <given-names>D.</given-names>
            <surname>Challet</surname>
          </string-name>
          ,
          <string-name>
            <given-names>M.</given-names>
            <surname>Marsili</surname>
          </string-name>
          , and Y.-C. Zhang, “
          <article-title>Modeling market mechanism with minority game,” Physica A: Statistical and Theoretical Physics</article-title>
          , vol.
          <volume>276</volume>
          , no.
          <issue>1-2</issue>
          , pp.
          <fpage>284</fpage>
          -
          <lpage>315</lpage>
          , Feb.
          <year>2000</year>
          . [Online]. Available: http://dx.doi.org/10.1016/S0378-
          <volume>4371</volume>
          (
          <issue>99</issue>
          )
          <fpage>00446</fpage>
          -X
        </mixed-citation>
      </ref>
      <ref id="ref3">
        <mixed-citation>
          [3]
          <string-name>
            <given-names>H. V. D.</given-names>
            <surname>Parunak</surname>
          </string-name>
          ,
          <string-name>
            <given-names>S.</given-names>
            <surname>Brueckner</surname>
          </string-name>
          ,
          <string-name>
            <given-names>J.</given-names>
            <surname>Sauter</surname>
          </string-name>
          , and
          <string-name>
            <given-names>R.</given-names>
            <surname>Savit</surname>
          </string-name>
          , “
          <article-title>Effort profiles in multi-agent resource allocation</article-title>
          ,” pp.
          <fpage>248</fpage>
          -
          <lpage>255</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref4">
        <mixed-citation>
          [4]
          <string-name>
            <given-names>W.</given-names>
            <surname>Renz</surname>
          </string-name>
          and
          <string-name>
            <given-names>J.</given-names>
            <surname>Sudeikat</surname>
          </string-name>
          , “
          <article-title>Modeling Minority Games with BDI agents - a case study,” in Multiagent System Technologies, ser</article-title>
          . LNCS,
          <string-name>
            <given-names>T.</given-names>
            <surname>Eymann</surname>
          </string-name>
          , F. Klu¨gl, W. Lamersdorf,
          <string-name>
            <given-names>M.</given-names>
            <surname>Klusch</surname>
          </string-name>
          , and
          <string-name>
            <given-names>M. N.</given-names>
            <surname>Huhns</surname>
          </string-name>
          , Eds. Springer,
          <year>2005</year>
          , vol.
          <volume>3550</volume>
          , pp.
          <fpage>71</fpage>
          -
          <lpage>81</lpage>
          , 3rd German Conference (MATES
          <year>2005</year>
          ), Koblenz, Germany,
          <fpage>11</fpage>
          -
          <lpage>13</lpage>
          Sept.
          <year>2005</year>
          . Proceedings. [Online]. Available: http: //www.springerlink.com/link.asp?id=y62q174g56788gh8
        </mixed-citation>
      </ref>
      <ref id="ref5">
        <mixed-citation>
          [5]
          <string-name>
            <given-names>A.</given-names>
            <surname>Omicini</surname>
          </string-name>
          and
          <string-name>
            <given-names>F.</given-names>
            <surname>Zambonelli</surname>
          </string-name>
          , “
          <article-title>Coordination for Internet application development</article-title>
          ,”
          <source>Autonomous Agents and MultiAgent Systems</source>
          , vol.
          <volume>2</volume>
          , no.
          <issue>3</issue>
          , pp.
          <fpage>251</fpage>
          -
          <lpage>269</lpage>
          , Sept.
          <year>1999</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref6">
        <mixed-citation>
          [6]
          <string-name>
            <given-names>M.</given-names>
            <surname>Viroli</surname>
          </string-name>
          and
          <string-name>
            <given-names>A.</given-names>
            <surname>Ricci</surname>
          </string-name>
          , “
          <article-title>Instructions-based semantics of agent mediated interaction</article-title>
          ,
          <source>” in 3rd International Joint Conference on Autonomous Agents and Multiagent Systems (AAMAS</source>
          <year>2004</year>
          ),
          <string-name>
            <given-names>N. R.</given-names>
            <surname>Jennings</surname>
          </string-name>
          ,
          <string-name>
            <given-names>C.</given-names>
            <surname>Sierra</surname>
          </string-name>
          ,
          <string-name>
            <given-names>L.</given-names>
            <surname>Sonenberg</surname>
          </string-name>
          , and M. Tambe, Eds., vol.
          <volume>1</volume>
          . New York, USA: ACM,
          <fpage>19</fpage>
          -
          <issue>23</issue>
          <year>July 2004</year>
          , pp.
          <fpage>102</fpage>
          -
          <lpage>109</lpage>
          . [Online]. Available: http://portal.acm.org/citation.cfm?id=
          <volume>1018409</volume>
          .
          <fpage>1018737</fpage>
        </mixed-citation>
      </ref>
      <ref id="ref7">
        <mixed-citation>
          [7]
          <string-name>
            <given-names>A.</given-names>
            <surname>Omicini</surname>
          </string-name>
          and E. Denti, “Formal ReSpecT,” Electronic Notes in Theoretical Computer Science, vol.
          <volume>48</volume>
          , pp.
          <fpage>179</fpage>
          -
          <lpage>196</lpage>
          ,
          <year>June 2001</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref8">
        <mixed-citation>
          [8]
          <string-name>
            <given-names>A.</given-names>
            <surname>Omicini</surname>
          </string-name>
          ,
          <string-name>
            <given-names>A.</given-names>
            <surname>Ricci</surname>
          </string-name>
          ,
          <string-name>
            <given-names>M.</given-names>
            <surname>Viroli</surname>
          </string-name>
          ,
          <string-name>
            <given-names>C.</given-names>
            <surname>Castelfranchi</surname>
          </string-name>
          , and L. Tummolini, “
          <article-title>Coordination artifacts: Environment-based coordination for intelligent agents</article-title>
          ,
          <source>” in 3rd International Joint Conference on Autonomous Agents and Multiagent Systems (AAMAS</source>
          <year>2004</year>
          ),
          <string-name>
            <given-names>N. R.</given-names>
            <surname>Jennings</surname>
          </string-name>
          ,
          <string-name>
            <given-names>C.</given-names>
            <surname>Sierra</surname>
          </string-name>
          ,
          <string-name>
            <given-names>L.</given-names>
            <surname>Sonenberg</surname>
          </string-name>
          , and M. Tambe, Eds., vol.
          <volume>1</volume>
          . New York, USA: ACM,
          <fpage>19</fpage>
          -
          <issue>23</issue>
          <year>July 2004</year>
          , pp.
          <fpage>286</fpage>
          -
          <lpage>293</lpage>
          . [Online]. Available: http://portal.acm.org/citation.cfm?id=
          <volume>1018409</volume>
          .
          <fpage>1018752</fpage>
        </mixed-citation>
      </ref>
      <ref id="ref9">
        <mixed-citation>
          [9]
          <string-name>
            <given-names>N. R.</given-names>
            <surname>Jennings</surname>
          </string-name>
          ,
          <string-name>
            <given-names>C.</given-names>
            <surname>Sierra</surname>
          </string-name>
          ,
          <string-name>
            <given-names>L.</given-names>
            <surname>Sonenberg</surname>
          </string-name>
          , and M. Tambe, Eds.,
          <source>3rd International Joint Conference on Autonomous Agents and Multiagent Systems (AAMAS</source>
          <year>2004</year>
          ). New York, USA: ACM,
          <fpage>19</fpage>
          -
          <issue>23</issue>
          <year>July 2004</year>
          .
        </mixed-citation>
      </ref>
    </ref-list>
  </back>
</article>