|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--models.SimpleCondorcetModel
The world is set in state 0, each individual is given (noisy) access to the world. With probability (1-e) they are given 0, with probability e they are given 1. After their initial assignments, each individual then polls her neighbors, and updates her belief based on what the majority of her neighbors think. (Each individual stays the same in case of tie.) This is equivalent to myopic best-response in a game of pure coordination. In fact, this is how the model in instantiate here, although the results are translated to conform to the model described above.
Constructor Summary | |
SimpleCondorcetModel()
Does nothing |
|
SimpleCondorcetModel(int n)
Sets up a group of individuals of size n. |
Method Summary | |
int |
countTruth()
Returns the count of individuals who believe the truth (strategy 0). |
void |
createPlayers(Individual[] is,
MutationRule mr,
LearningRule lr,
ConnectionRule cr)
Sets up the individuals |
int |
detectState()
Detects if the individuals are in one of three states, unanimity on the truth (strategy 0), majority on the truth or none |
Individual[] |
getIndividuals()
Returns the set of individuals for the model. |
MersenneTwister |
getRandom()
Returns the random number generator for the model. |
int[] |
incrementSequence(int[] s,
int n)
This is used for enumerations, it takes a sequence of numbers and a maximum for each value and increments to the next in the sequence. |
static void |
main(java.lang.String[] args)
Main, runs a model. |
void |
resetPlayers(int s,
double e)
Resets the players beliefs |
int |
runmodel(double mr,
boolean tr,
int g,
int v)
Runs the model. |
void |
setIndividuals(Individual[] i)
Sets the list of individuals for the model. |
void |
setRandom(MersenneTwister r)
Sets the random number generator. |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public SimpleCondorcetModel()
public SimpleCondorcetModel(int n)
n
- Method Detail |
public void setIndividuals(Individual[] i)
i
- An array of individualspublic Individual[] getIndividuals()
public void setRandom(MersenneTwister r)
r
- the mersennetwister random number generatorpublic MersenneTwister getRandom()
public int[] incrementSequence(int[] s, int n)
s
- The sequencen
- The maximum numberpublic void createPlayers(Individual[] is, MutationRule mr, LearningRule lr, ConnectionRule cr)
is
- The network of individuals (already appropriately connected)mr
- The mutation rulelr
- The learning rulecr
- The connection rulepublic void resetPlayers(int s, double e) throws ModelError
s
- The number of possible belief statese
- The probability of believing belief state 0 (i.e. the truth)
ModelError
public int detectState() throws ModelError
ModelError
public int countTruth() throws ModelError
ModelError
public int runmodel(double mr, boolean tr, int g, int v) throws ModelError
mr
- The mutation ratetr
- A boolean saying if "truerate" is set (if true no convergence detection)g
- The maximum number of generationsv
- Is the verbosity level (>2 means it prints something out for every gen)
ModelError
public static void main(java.lang.String[] args)
args
- The command line arguments
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |