The improvement of Party Model Essay

Submitted By JiaYuexin
Words: 445
Pages: 2

Computer Simulation of Party Model 1. Backgrounds The Party Model is a computer simulation applying Multi-­‐Agent Model aiming at the study of human behavior. It simulates a cocktail party at which people gather in different groups chatting. Once the ratio of the opposite sex exceeds a certain value, the person will feel awkward so as to change a group.

In the original model, the number of the guests and groups are fixed. To improve it, let’s say a group can be created by any person according to a certain probability. What’s more, an empty group will disappear after a period of time. 2. Rules Set a parameter “independency” to indicate the probability of creating a new group. Set a parameter “tolerance” to indicate the ratio of opposite sex one can bear.

Code: to go

ask turtles with [random 100 < independency * 100 ]

[

set num-­‐groups num-­‐groups + 1

];; Create a group

if num-­‐groups > 0

[

ask one-­‐of turtles

[

if group = -­‐1

[

let i random num-­‐groups

set group i

let j count turtles with [group = ([group] of myself) and color = ([color] of myself)]

ifelse color = blue

[setxy i

j ]

[setxy i

( j + 1 ) * -­‐1]

]

let gp group

let samegroup count turtles with [group = ([group] of myself)]

let samesex count turtles with [group = gp and color = [color] of myself]

let ratio (samegroup -­‐ samesex) / samegroup

if ratio > tolerance

[

let i random num-­‐groups

set group i

let j count turtles with [group = ([group] of myself) and color = ([color] of myself)]

ifelse color = blue

[setxy i j

]

[setxy i ( j + 1 ) * -­‐1 ]

]

]

]

update-­‐group

update-­‐plot end

to update-­‐plot ;; to update the diagram