parallel termite solution in C and open MP

This project received 4 bids from talented freelancers with an average bid price of $191 CAD.

Get free quotes for a project like this
Project Budget
$30 - $250 CAD
Total Bids
Project Description

it should be done till 23th Aug

Termite Simulation

1 Introduction

Our company, Termite Simulation, Inc., have developed software that can simulate thousands

of termites wandering about a rectangular grid whilst picking up and dropping wood

chips. Our initial simulations gave interesting results: Despite the fact that all termites followed

the same basic set of rules, their collective behavior appeared coordinated. The termites

started aggregating the wood chips into piles. In a sense, the aggregation of many simple and

independent agents can give rise to a seemingly complex global behavior.

configuration after 1000 time steps. Initially, the wood chips (marked by the symbol O) are

distributed uniformly at random. After a while, the termites (marked by the symbol +) begin

to assemble the wood chips into larger piles. Note that the grid is periodic in the sense that

it wraps around in both the north–south and the east–west directions.

To give you a better understanding of what we mean, study Figure 1. On the left side

you see a small grid with many scattered wood chips marked by the symbol O. You also see a

small number of termites marked by the symbol +. This is the initial state of our simulation.

After we let the simulation run for 1000 time steps, we get the configuration shown on the

right. Notice that the wood chips have become more ordered and have begun to form large

piles. If we were to let the simulation continue even further, then the number of piles tends

to decrease and the size of each pile tends to increase.

As we briefly mentioned above, the termites follow a small set of basic rules. The rules are

local in the sense that they describe how one termite acts based purely on local information.

The termites act independently and do not take orders or directions from other termites or

any other entity. The simulation proceeds in discrete time steps. The basic rules are as follows

and are also applied in the following order:

1. The termite randomly chooses to either stay on the same course as before, turn left, or

turn right.

2. If the termite is carrying a wood chip and there is a wood chip directly in front of the

termite, then the termite drops the wood chip and turns 180 degrees.

3. If the termite is not carrying a wood chip and there is a wood chip where the termite

is currently located, then the termite picks up the wood chip and turns 180 degrees.

4. The termite moves one step forward (if possible).

Note that a termite never performs both actions 2 and 3 in the same time step since that

would imply that it picked up the wood chip it just dropped. The movement action 4 cannot

be applied in the following situations:

1. The cell ahead is occupied by another termite; only one termite is allowed to occupy a

cell at any point in time.

2. The termite is carrying a wood chip but the cell ahead already contains a wood chip;

only one wood chip is allowed to occupy a cell at any point in time.

In these situations, the termite simply stays in its current cell.

Note that two termites are not allowed in the same cell at the same time. Therefore, there

is a risk that two (or more) termites simultaneously try to move to the same cell. One of

them will succeed and the others will fail and stay in their original cells. We currently believe

that the precise details of how these conflicts are resolved will not significantly influence the

quality of the simulations. In the current version of our software, the termites are processed

sequentially in an arbitrary order and the conflicts are resolved using a “first-come, firstserved”


Skills Required

Looking to make some money?

  • Set your budget and the timeframe
  • Outline your proposal
  • Get paid for your work

Hire Freelancers who also bid on this project

    • Forbes
    • The New York Times
    • Time
    • Wall Street Journal
    • Times Online