org.cfpm.caves.za
Class FactBaseScourer

java.lang.Object
  extended by org.cfpm.caves.za.FactBaseScourer

public class FactBaseScourer
extends java.lang.Object

Goes through all the facts and updates agents and households accordingly. Used to outsource procedural / slow stuff from Jess to Java

Author:
Ruth, Scott

Field Summary
(package private)  jess.Rete engine
          reference to the Jess engine
(package private)  SouthAfricaModel model
          reference to the model
 
Constructor Summary
FactBaseScourer(SouthAfricaModel model)
          Creates a new fact base scourer for the given model
 
Method Summary
private  void computeKinshipProportion(java.util.HashMap<NetworkNode,java.util.ArrayList<NetworkNode>> network)
          internal helper method applied to the friendship network
private  void computeReciprocalLinkProportion(java.util.HashMap<NetworkNode,java.util.ArrayList<NetworkNode>> network)
          internal helper method applied to the friendship network
(package private)  void evolveTags(java.util.ArrayList<jess.Fact> friendships)
          evolves the tags of agents so that -- according to their tag evolution propensity -- they become more similar to their best friends
 void update()
          Runs through the fact base and sorts facts needed for updates into several array lists: friends, endorsements, payments and employments.
(package private)  void updateExpectedIncome(java.util.ArrayList<jess.Fact> employments)
          Update each household's expected income from the employment facts, once every month.
(package private)  void updateFriends(java.util.ArrayList<jess.Fact> endorsements)
          Maintain the friendship network.
(package private)  void updateHouseholdCash(java.util.ArrayList<jess.Fact> payments)
          Updates each household's cash from the payments made and received the previous tick.
(package private)  void updateKnownPersons(java.util.ArrayList<jess.Fact> endorsements)
          updates the list of known persons for every agent by turning every endorsed agent into a known person (if they are not already known).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

model

SouthAfricaModel model
reference to the model


engine

jess.Rete engine
reference to the Jess engine

Constructor Detail

FactBaseScourer

public FactBaseScourer(SouthAfricaModel model)
Creates a new fact base scourer for the given model

Method Detail

update

public void update()
Runs through the fact base and sorts facts needed for updates into several array lists: friends, endorsements, payments and employments. Then passes these lists on to the different update procedures: evolving tags, updating known persons, updating the friendship network, updating the households' cash, updating the households' expected income.


evolveTags

void evolveTags(java.util.ArrayList<jess.Fact> friendships)
evolves the tags of agents so that -- according to their tag evolution propensity -- they become more similar to their best friends

Parameters:
friendships - list of facts with "is-friend" endorsements

updateKnownPersons

void updateKnownPersons(java.util.ArrayList<jess.Fact> endorsements)
updates the list of known persons for every agent by turning every endorsed agent into a known person (if they are not already known).

Parameters:
endorsements - list of endorsement facts

updateFriends

void updateFriends(java.util.ArrayList<jess.Fact> endorsements)
Maintain the friendship network.

Parameters:
endorsements - list of "is-friend" endorsements

updateHouseholdCash

void updateHouseholdCash(java.util.ArrayList<jess.Fact> payments)
Updates each household's cash from the payments made and received the previous tick. Updates the spending commitments too.

Parameters:
payments - list of payment facts

updateExpectedIncome

void updateExpectedIncome(java.util.ArrayList<jess.Fact> employments)
Update each household's expected income from the employment facts, once every month.

Parameters:
employments - list of employment facts

computeReciprocalLinkProportion

private void computeReciprocalLinkProportion(java.util.HashMap<NetworkNode,java.util.ArrayList<NetworkNode>> network)
internal helper method applied to the friendship network


computeKinshipProportion

private void computeKinshipProportion(java.util.HashMap<NetworkNode,java.util.ArrayList<NetworkNode>> network)
internal helper method applied to the friendship network