You are on page 1of 8

The International Workshop on Agent-Based Modeling and Simulation for Policy Development

Agents Based Modeling and Simulation of


Indonesian Rice Price System from
Decentralized Bilateral Exchange
Mohamad Ivan Fanany (Faculty of Computer Science, Universitas Indonesia)

AbstractThis paper presents an agents based modeling and


simulation of Indonesian rice price system. I view Indonesian rice
prices as individual subjective estimates of payoff-maximizing
exchange ratios, and hence are as private information of
individual agents who are trading in Indonesian rice market. In
our model, those agents i.e., farmers, small rice-stock traders
(small traders), big rice-stock traders (big traders), and BULOG
(Indonesian logistics national company) presumably produce,
exchange, and consume two goods: imported rice and national
rice. We treat this system as complex, dynamic, nonlinear system
in which agents have limited information. The system evolves
rapidly from an initial random seeding of private prices towards
what may be termed a private but common price structure. This
model provides a general, decentralized disequilibrium
adjustment mechanism that renders market equilibrium
dynamically stable in a highly simplified production and
exchange economy. Through this study, I seek to find and
analyze patterns and determining policies that will help the rice
prices moves through time towards the market clearing price
system for the underlying general equilibrium system, thus our
economy may enjoy rice price stability.
Index Termsagents based modeling, Indonesian rice price,
decentralized bilateral exchange

I. INTRODUCTION

urrently, Indonesia holds about 9% of total world rice


production thus the third largest world rice producer after
China (30%) and India (21%) [1]. Even though, the later
countries are net rice exporter, Indonesia has become net rice
importer since 1980s. Indonesia continuously steps up efforts
to promote its national rice production and to manage national
rice stock for emergency and rice stabilization. Recently,
much complains emerges in public news and media about the
growing reliance of Indonesian rice security policy on import
as shortcut measure and inappropriate pills to reduce
escalating rice prices while disregarding national rice
production capability and Indonesian farmers welfare.
Currently, Indonesia spends about 110 trillion rupiahs for food
import while spends only about 38.2 trillion rupiahs for
national agriculture development [2]. On the other hand,
according to a study [3], 80% of farmers high revenue in
developed countries are due to their governments support
whereas the world low price of rice is not truly reflecting
market efficiency but is already distorted by governments
support and subsidies. This resulting unfair market that is hard
for ordinary farmers in Indonesia to compete.

To face, analyze, and take appropriate decisions on


anticipating this growingly complex and dynamics Indonesian
rice market, a careful simulation and modeling involving
simultaneous exchanges of imported rice and national rice is
needed. The model should provide at least important
parameters and strategies of a roadmap toward stabilizing rice
prices that will be a benefit to Indonesian consumers and
farmers. In this paper, I study the simulation of a particular
economic modelbarter economy. It is a simple economic
model where agents exchange goods without money or other
real-life factors such as firms, taxes, capital or material.
Despite the simplicity, I believe that understanding the
dynamics of the barter economy will be a benefit toward
understanding our real rice market which will help in making
appropriate decisions on controlling the rice price volatility.
One of the important questions in economics has for a long
time been how to match the demand and supply of all goods in
a market of a perfect competition, so that there is neither
excess demand nor supply. Or from another point of view,
how to find the market-clearing prices that would result in
match. The long-run behavior of prices is not well understood
and the issue of which are the main drivers of booms and
slumps remains controversial. For example, the long-run
decline in real agricultural prices is often attributed to weak
demand combined with the production and productivity
increases. Food price volatility is frequently thought of as the
result of droughts and other supply shocks. However, shocks
in the demand for commodities can also trigger price surges.
Macroeconomic policies also play a vital role in determining
price behavior. Speculation is also thought to contribute to
price surges. Nevertheless, on the whole, economist suggests
that none of these factors by itself appears to explain price
behavior satisfactorily. But it was studied that the sources of
volatility of agricultural commodity prices are complex
relations of the volatility of oil prices, interest rates, and
exchanges rates. Most of these factors have been thought of as
crucial in giving rise to the recent price surge. In addition to
these factors, we also need to assess the existence of periodic
form of volatility. Past volatility can be a significant predictor
of current volatility giving rise to periods with either high or
low price volatility. Such volatility patterns are commonly
found in markets where prices are partly driven by speculative
forces [4].
In this paper, I study the particular model which was
formulated by Herbert Gintis [5]. The resulting result of

The International Workshop on Agent-Based Modeling and Simulation for Policy Development
Gintis work is that in a decentralized agents based economy,
where trading agents have neither money nor prices as public
information and with little central control, a system of
approximately equilibrium prices emerges in the long run.
This study provides means to analyze related models by
changing agent as well as market behavior. This model in our
view can be applied to Indonesian rice prices. For this study, I
tune and modify the implementation of an extensible and
scalable agent-based simulation of barter economics [6] which
is based on a multi-agent library MASON (Multi-Agent
Simulator of Neighborhoods) as the underlying simulation
platform [7].

simulation. Gintis original formulation thus becomes a


special case that is implemented as the default behavior.
C. Barter strategies
The trading behavior in Gintiss original model could be
described as purely adaptive; the agents do not take history
into account, nor do they try to maximize their score by
actively adjusting their price levels. By providing an interface
that lets the agent have access to slightly more information
compared to the original formulation, a new set of adaptive
and rational behaviors could be created. In particular, agents
having different behaviors could co-exist in the same market.
The barter strategy interface and an implementation of Gintis
original barter rule is as follows:

II. PROCESS OVERVIEW


A. Phases
Gintis carried out the following process in each period to
evolve economy over time. It begins with a synchronized
production phaseeach agent starts with an empty inventory
of goods and then produces a fixed amount of a single good.
The production phase is followed by an unsynchronized
exchange-consumption-production phase. Here the agents first
seek exchange partners and then try to agree on the amounts of
exchanged goods according to their strategies. A strategy for
an agent is a price vector for the various goods it produces or
consumes. Agents only give away a quantity of their own
production good and only if the value of what they receive in
exchange are at least as great as the value of what they give
away, according to their private price vector. After a
successful trade, an agent consumes an optimal consumption
bundle and produces more of his production good if his
inventory becomes empty after the consumption.
The final phase is reproduction-mutation, which only
happens after a certain number of periods (for example every
10 period). In this phase, a fraction of low-scoring agents
imitate the strategies (the private prices) of high scoring agents
and with a small probability, each strategy undergoes a small
mutation. This phase can also be seen as the learning phase.
Repeating this process for a long enough time, Gintis showed
that the prices converge approximately to the market-clearing
values thus equilibrium is reached.
B. Generalization and extension of barter economy
The goal of agents based modeling is not to provide as
accurate representation of some real world system as possible,
but rather to enrich our understanding of them. Creating an
all-in-one general model does not take us closer to that goal,
as it becomes harder to grasp what is causing what if the
parameter space grows too large. Agents based modeling
provides easy and safe ways to extend the application by way
of simple, yet flexible interfaces. Generalizing over different
market models could not be done in a way that would allow
for orthogonal extensions. The more general the market
model, the less behavior is pre-defined and the more is left to
custom extensions. Those extensions then become dependent
on each other. A user should be able to change the behavior of
the agents, either for all or for some fraction so that agents
with different behaviors could cooperate in the same

public class OriginalBarterStrategy{


public boolan acceptOffer(TradeAgentProxy me,
int offersGood, double offersAmount,
double requestsAmount) {
return !(me.getDemand(offeredGood) == 0 ||
me.getExchangeFor(offeredGood) == 0 ||
me.getInventory(me.getProduceGood()) == 0 ||
me.getPrice(offeredGood) * offeredAmount <
me.getPrice(me.getProduceGood()) *
requestedAmount);
}
}
D. Improvement strategies
Agents improve by being chosen as the worst performing in
a pair. The worse agent then copies the prices from the better
performing agent and possibly adjusts the price up or down by
a fixed factor. Currently, it is has not yet been generalized to
let the user implement new ways for the market to handle
selection. The improvement strategy is implemented on the
agent side, letting the agent have full control over what to do
when it is being selected for improvement. The barter and
improvement strategies can be implemented in the same class
if the need for a strongly optimizing agent arises. The
implemented improvement strategy is as follows:
public class CopyAndMutateImprovementStrategy{
private int numGoods;
private double mutationRate;
private double mutationDelta;
...
public double[]improve(TradeAgentProxy betterAgent,
TradeAgentProxy me) {
double[] new Prices = new double[numGoods];
double[] priceMutation = getMutationVector();
for (int good = 0; good < numGoods; good++) {
newPrices[good] = betterAgent.getPrice(good) *
priceMutation[good];
}
return newPrices;
}

The International Workshop on Agent-Based Modeling and Simulation for Policy Development

he will maximize utility subject to the income constraint

}
E. Replacement/mutation strategies
After a fixed number of periods, a reproduction period is
added, in which a fraction of low-performing agents of each
producer type are permitted to imitate the behavior of
high-performing types by switching to the price structure used
by the higher-performing types. The implemented
reproduction strategy is as follows:
public class OriginalReplacementStrategy{
public void getNextGeneration(
List<TradeAgent> producers, BarterParams params,
MarsenneTwisterFast random ) {
long replacements = Math.max(1, Math.round(
producers.size() * params.getReplacementRate()));
for (int i = 0; i<replacements; i++) {
int j = random.nextInt(producers.size());
int k = random.nextInt(producers.size());
if (producers.get(j).getScore() >
producers.get(k).getScore()) {
producers.get(k).improve(producers.get(j));
} else {
producers.get(j).improve(producers.get(k));
}
}

!
! !"
= !! !! + + !" !" .

(2)

The optimum is given by

!!
= !! ,
!

(3)

where
=

!
!" !"
! !!! !!!

(3)

At the start of each period, each agent has an inventory


!
consisting only on an amount !"
of his production good.
Once in each period, agent "shops," choosing random
producer of each of his non-produced consumption goods and
attempt a trade with each. When he is not shopping, agent i is
"selling," by which is meant that waits to be approached by
the current shopper, and all sellers of a particular good are
equally likely to be approached. When shopper contacts
seller ! , offers to trade good (his production good) for
good (the production good of seller if, according to his
own prices !! , the trade is profitable. The amount traded will
then be greatest amount acceptable to both parties. After a
successful trade, both parties consume any portion of their
inventories that gives positive utility, and if an agent's
production good is depleted, the agent produces a new supply
of the production good. When each agent has completed his
turn as a shopper, the period is ended.
B. Evensen's modifications

}
F. Scalability
It is interesting to see how increasing the number of goods
or agents influences the simulation performance. Asymptotic
time complexity of barter economics system is (! +
) where is number of goods, is number of agents per
good, is the maximum number of barter attempts, is
number of periods to run. [6]

III. METHODS
A. Convergence to Private but Common Prices
The original Gintis implementation is as follows. Suppose
each agent produces a certain quantity of one good but
consumes a subset of goods in each period, the particular
goods being re-specified randomly at the start of each period,
except that the agent does not consume his own production
good. Assume each agent consumes in fixed proportions
(!! , , !" ) such that the utility !! ! , , ! in period is
given by,
!"
(1)
min , , = min
,
!

!!

!"#

where !! , . . , !! are the < goods the agent consumes in


that period. If agent produces good g, uses prices ! =
!
!! , , !" and has an inventory !"
of his production good,

Evensen founds three bugs in the original Gintis


implementation. These bugs, however, has no effect on the
price convergence property of the model that could lead to
different convergence behavior. The first bug is related to the
way how agents consume goods. He thought that it is not wise
for agents to consume the whole amount of one particular
good and only a small fraction of some other good. To
maximize the score, agents should try to acquire equal
proportions of all goods. In the original implementation, all
agents will on average score lower because they waste
everything they produce to buy a single or a few other goods
instead of getting a little bit of everything and thus a better
score.
The second bug is related to the calculation of the amount
of their produce-good that they are willing to exchange for
other goods. The calculation is correct for the offerer agent but
is wrong for the responder agent because it accepts the trade
when it values what it receives in trade at least as much as
what it gives up.
The third bug is related to the simulation flow. After each
trading period, Gintis first resets the demand and supply for all
agents. Then, if it happens to be a reproduce period, lower
scoring agents get a chance to copy, or "imitate", the prices of
better scoring agents. After each such period, a bunch of
agents who just got new price vectors will perform trades

The International Workshop on Agent-Based Modeling and Simulation for Policy Development
according to the old price vector, because the demand and
supply will not be recalculated until the next period. This also
means trades with negative profit, as did the second bug.
C. Modifications to Indonesian rice price structure
Based on data from BPS (National Statistic Bureau)
Indonesian rice production in average is about 32 millions ton,
where as import and export are about 1.89 millions and 8
thousand tons respectively. This make Indonesian food
self-supply rate about 94.5%. Indonesian government sets
incentives on rice price (HPP: harga pembelian pemerintah)
for domestic rice price. Indonesian rice price is 85% higher
than world rice price. Setting this incentives too high will only
opens higher risks on smuggling and speculations. It is almost
impossible for Indonesian government to fully control the rice
price in the country and prevent rice speculations if
government does not have tools of rice import and export
through tariffs application as protection system. Beside,
government also do not have capability to fully control the
price because rice stocks held by BULOG is relatively low,
i.e., about 0.5 million tons. Thus practically, the rice price in
Indonesia is controlled by trader/miller, especially big traders.
In this study, I want to simulate and model the barter
economy interactions between four main players/contributors
in Indonesian rice markets: Farmers, small traders, big traders
and BULOG, on exchanging simultaneously domestic rice and
imported rice. I ignore the exported rice since the amount is
relatively small hence considered insignificant. Our
assumptions and constraints are as follows. Farmers mainly
produce domestic rice but at the same time also consume and
exchange their rice to other agents. In addition, farmers may
also consume imported rice. Small traders, big traders, and
BULOG also produce both domestic and imported rice either
by buying from other agents or by importing rice. For these
three agents other than farmers I assume that they may
consume the rice by selling it to people which is not included
as one of any agents in this study. The consumption or
volumes of domestic and imported rice for each agent are
made as close as possible to reflect the rice stock census from
BPS.

double requestsAmount) {
return !(me.getDemand(offeredGood) > 0 &&
me.getExchangeFor(offeredGood) > 0;
}
}
In the fourth experiment, I change improvement strategy from
copy and mutate to mean improvement strategy which is set as
follows.
public class MeanImprovementStrategy{
public double[] improve(TradeAgentProxy betterAgent,
TradeAgentProxy myself,
BarterParams params, MersenneTwisterFast random) {
int numGoods = params.getNumGoods();
double[] newPrices = new double[numGoods];
for(int good = 0; good < numGoods; good++) {
newPrices[good] = (betterAgent.getPrice(good) +
myself.getPrice(good)) * 0.5;
}
return newPrices;
}
}

V. RESULTS AND DISCUSSION


A. Results of the first experiment

IV. EXPERIMENTS
In this study, I perform 4 experiments. In the first
experiment, I set the composition of domestic rice and
imported rice consumptions to be the same. Original barter
strategy and improvement strategy (copy and mutate strategy)
are applied. The first experiment is treated as a reference for
other three experiments. In the second experiment, I set the
composition of domestic rice and imported rice consumptions
to reflect the actual data from BPS, i.e., 32.0: 1.89, while still
using the original barter and improvement strategy. In the
third experiment, I retain the consumption rate as the second
experiment, but instead of using the original barter strategy, I
use generous barter strategy set as follows.
public class GenerousBarterStrategy{
public boolan acceptOffer(TradeAgentProxy me,
int offersGood, double offersAmount,

Fig. 1. Average Score of agents trading or exchanging


domestic and imported rice. The scores converge to relatively
equilibrium score after about 5000 period

The International Workshop on Agent-Based Modeling and Simulation for Policy Development

B. Results of the second experiment

Fig 3. Low scoring and high scoring agents (from [6])

Fig. 5. Average Score of agents trading or exchanging


domestic and imported rice. The scores converge to relatively
equilibrium score after about 22500 periods.

Fig. 2. Volatile average rice price stabilizes after about 5000


periods.

Fig. 6. Volatile average rice price stabilizes after about 22500


periods.

Fig. 4. Agents scoring status. All reach high scoring for just
about 5000 periods.

The International Workshop on Agent-Based Modeling and Simulation for Policy Development

Fig. 9. It took very long and difficult way to volatile average


rice price to stabilize, i.e., after about more than 120000
period.
D. Results of the fourth experiment and discussions
Fig. 7. Agents scoring status recorded in several discrete
periods. All reach high scoring after about 22500 periods.

C. Results of the third experiment

Fig. 8. The scores converge to relatively equilibrium score


after extremely long, i.e., 125000 period. In addition a price
spike seems needed on the domestic rice price to trigger the
imported rice price spike that will lead to the equilibrium.

In the first experiment, if the composition of domestic rice


and imported rice is about the same, the price stabilizes very
fast. Of course this is really does not reflect the real condition
and it is unlikely that the two are produced and consumed
equally since Indonesia is one of main rice producer. It needs
only about 5000 period to stabilize.
In the second experiment, when I divide the rice
composition to the numbers given by BPS, the convergence
took about more than 20000 periods. The lesson learned from
this is that it takes quite a lot of time for the two prices to
converge.
In the third experiment, when I change the original barter
strategy to generous barter strategy, the convergence took
extremely long time to converge, i.e., about 120000 period.
The lesson learned from this is that all agents seems better to
be more reserved in exchanges than to be more generous given
unbalanced goods composition. In addition a price spike
seems needed on the domestic rice price to trigger the
imported rice price spike that will lead to the equilibrium. I
believe more experiments should be performed to confirm
these two lessons.
In the fourth experiment, when I change the original
improvement strategy (copy and mutate) to mean
improvement strategy, the convergence took faster time. The
lesson might be in case of imbalance composition mean
improvement strategy which take more information from all
agents is better than the copy and mutate strategy which takes
information from only a high performing agent.
As conclusion, the agents based modeling and simulation
especially the decentralized bilateral exchanges is really
helpful and very potential in extracting anticipated patterns
toward stabilizing the rice price in Indonesia. Further more in
depth study should be promoted and encouraged.

The International Workshop on Agent-Based Modeling and Simulation for Policy Development
[6]

[7]

Fig. 10. The scores converge to relatively equilibrium score


faster, i.e., 15000 period.

Fig. 6. Volatile average rice price stabilizes faster after about


15000 period.

REFERENCES
[1]

[2]

[3]

[4]

[5]

Hussein Sawit, Indonesia dalam tatanan perubahan


perdagangan beras dunia," http://bulog.co.id/old_website
/karyailmiah.php, Majalah Pangan, 2006
Elisha Kartini, 110 Triliun Rupiah untuk Impor Pangan
Vs 38.2 Triliun Pembiayaan Pertanian, (wawancara),"
http://www.csoforum.net/multimedia/bahan-bacaan/435110-triliun-rupiah-untuk-impor-pangan-vs-382-triliun-pe
mbiayaan-pertanian.html
Hussein Sawit, I.W. Rusastra, "Globalisasi dan
Ketahanan Pangan di Indonesia", bagian laporan
penelitian Road Map Memperkuat Ketahanan Pangan,
PEM UI, Jakarta, 2005.
George Rapsomanikis, Alexander Sarris, "Commodity
Market Review 2009-2010" FAO Trade and Markets
Division.
Herbert Gintis, "The Emergence of a Price System from
Decentralized Bilateral Exchange", Contributions to
Theoretical Economics, 6(1):1302-1302, 2006.

Pelle Evensen, Mait M a rdin, "An Extensible and


Scalable Agent-Based Simulation of Barter Economics,"
Master of Science Thesis, University of Gothenburg,
Dept. of Computer Science and Engineering, Sweden,
March 2009
Sean Luke, Claudio Cioffi-Revilla, Liviu Panait, and
Keith Sullivan, MASON: A New Multi-Agent
Simulation Toolkit. In Proceedings of the 2004
Swarmfest Workshop, 2004.

You might also like