uaa.feral.social.waterUse
Class SocialDistancingModified

java.lang.Object
  extended by uaa.feral.social.waterUse.WaterUseBehaviors
      extended by uaa.feral.social.waterUse.SocialDistancingModified
All Implemented Interfaces:
GeneralModel, WaterUseModel

public class SocialDistancingModified
extends WaterUseBehaviors

Modified version of the social distancing model

Author:
Mark Altaweel

Constructor Summary
SocialDistancingModified(Community community)
          Main constructor for object
 
Method Summary
 void adjustViewsOfOtherSources(Person person, HydrologicalUnit hu)
          Method to determine perception of other sources
 void askAgents()
          Method that allows agents to get water and update values associated with water (quantity and quality) and perceptions of water
 void checkPerson(Person p)
          Method that checks to see if the person agent has previously been used in the model
 void collectWater(Person person, HydrologicalUnit hu)
          Method that calls a method to update quantity extracted by an agent
 double[] createValues(int size, double initValue)
          Method used in initializing model values associated with agents
 int[] createValues(int size, int initValue)
          Method used in intializing model values associated with agents
 void degradeWaterQuality()
          Method degrades municipal quality
 void determineSize(HydrologicalSetting hs)
          Method determines the size or number of water sources from a given system
 void initializeWater()
          Method launched when model first starts.
 void initialValues()
          Method that initializes data values and data containers used
 void moveToMunicipalWaterSource(Person p)
          Method to move to a municipal water source
 void moveToNaturalWaterSource(Person p)
          Method to move to non-municipal water sources
 void moveToWaterSource(Person p)
          Method that calls the methods that move an agent to a given water source location.
 double noisyQuantity(HydrologicalUnit hu)
          Method to make the hydrological quantity noisy
 void organizeWaterForPeople(Person person)
          Method associates a person agent with different water use quantities and data holders
 double[] preferenceWeighted(Person person, double[] belief)
          Method to weight preferences for certain water sources
 void removeAgent(Person p)
          Method to remove agent from the models data
 void returnHome(Person p)
          Method moves the agents home (i.e the location of their community)
 void runModel()
          Method to run the model that is called by the community
 HydrologicalUnit selectWaterSource(Person person)
          Method that selects a hydrological source for an agent to use
 void setupModelData(java.lang.String file)
          Method to setup model data used by a given water use model
 void source(Person p)
          Method that calls the method for an agent to search for a water source
 void updatePeople()
          Method updates the people from the community
 void updateQuantityBelief(Person person, HydrologicalUnit hu)
          Method updates the belief of an agent on how much water there is for a given water source
 void updateQuantityChangeBelief(Person person, HydrologicalUnit hu)
          Method that updates an agents belief about quantity changes in the water source used
 void updateQuantityHistory(HydrologicalUnit hu, Person person, double quantity)
          Method that updates the history kept by an agent about quantities (latest historical values based on length of historical memory)
 void updateQuantityMaximum(HydrologicalUnit hu, Person person, double waterToCollect)
          Method to see if the water collected is an amount among the record high amounts of water collected in agent memory
 void updateQuantityMinimum(HydrologicalUnit hu, Person person, double waterToCollect)
          Method that checks to see if the water quantity is among the minimum amounts kept in memory by an agent
 void updateQuantityRecord(HydrologicalUnit hu, Person person, double quantity)
          Method that calls methods that updates different quantity related values (history, minimum, maximum, quantity belief, and quantity change belief)
 void updateSourcePreferences(Person p)
          Method updates an agents preference for water sources
 void visitWeightedPreference(Person p)
          Method to give weights to sources visited
 double[] weightWaterByDistance(Person person, int size)
          Weight water sources by distance
 
Methods inherited from class uaa.feral.social.waterUse.WaterUseBehaviors
CreateWaterUseModel, getScenarioData, isDegradeQualityMode, isLargeSimulation, isUpdatePreferences, setDegradeQualityMode, setLargeSimulation, setScenarioData, setUpdatePreferences
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SocialDistancingModified

public SocialDistancingModified(Community community)
Main constructor for object

Parameters:
community - a community that will implement model
Method Detail

degradeWaterQuality

public void degradeWaterQuality()
Method degrades municipal quality


initializeWater

public void initializeWater()
Method launched when model first starts. It initializes data and sets the model for further functions


initialValues

public void initialValues()
Method that initializes data values and data containers used


noisyQuantity

public double noisyQuantity(HydrologicalUnit hu)
Method to make the hydrological quantity noisy

Parameters:
hu - the hydrological unit used by an agent
Returns:
a double quantity value

updatePeople

public void updatePeople()
Method updates the people from the community


returnHome

public void returnHome(Person p)
Method moves the agents home (i.e the location of their community)

Parameters:
p -

moveToMunicipalWaterSource

public void moveToMunicipalWaterSource(Person p)
Method to move to a municipal water source

Parameters:
p - a person agent

runModel

public void runModel()
Method to run the model that is called by the community

Specified by:
runModel in interface GeneralModel
Overrides:
runModel in class WaterUseBehaviors

moveToNaturalWaterSource

public void moveToNaturalWaterSource(Person p)
Method to move to non-municipal water sources

Parameters:
p - a person agent

moveToWaterSource

public void moveToWaterSource(Person p)
Method that calls the methods that move an agent to a given water source location. This method has been changed from Daniel's original version

Parameters:
p - a person agent

askAgents

public void askAgents()
Method that allows agents to get water and update values associated with water (quantity and quality) and perceptions of water


createValues

public int[] createValues(int size,
                          int initValue)
Method used in intializing model values associated with agents

Parameters:
size - the size of an array
initValue - the initial values in the array
Returns:
a int array

createValues

public double[] createValues(int size,
                             double initValue)
Method used in initializing model values associated with agents

Parameters:
size - the size of the array
initValue - the initial values in the arrray
Returns:
a double array

checkPerson

public void checkPerson(Person p)
Method that checks to see if the person agent has previously been used in the model

Parameters:
p - a person agent

organizeWaterForPeople

public void organizeWaterForPeople(Person person)
Method associates a person agent with different water use quantities and data holders

Parameters:
person - a person agent

weightWaterByDistance

public double[] weightWaterByDistance(Person person,
                                      int size)
Weight water sources by distance

Parameters:
size - number of water sources
Returns:
weighted values in array

source

public void source(Person p)
Method that calls the method for an agent to search for a water source

Parameters:
p - a person agent

updateSourcePreferences

public void updateSourcePreferences(Person p)
Method updates an agents preference for water sources

Parameters:
p - a person agent

selectWaterSource

public HydrologicalUnit selectWaterSource(Person person)
Method that selects a hydrological source for an agent to use

Parameters:
person - a person agent
Returns:
a hydrological unit selected by the agent

collectWater

public void collectWater(Person person,
                         HydrologicalUnit hu)
Method that calls a method to update quantity extracted by an agent

Parameters:
person - a person agent
hu - a hydroloigical unit source

updateQuantityRecord

public void updateQuantityRecord(HydrologicalUnit hu,
                                 Person person,
                                 double quantity)
Method that calls methods that updates different quantity related values (history, minimum, maximum, quantity belief, and quantity change belief)

Parameters:
hu - the hydrological unit
person - a person agent
hydrological - unit quantity to update

adjustViewsOfOtherSources

public void adjustViewsOfOtherSources(Person person,
                                      HydrologicalUnit hu)
Method to determine perception of other sources

Parameters:
person - a person object
hu - a hydrological unit

updateQuantityBelief

public void updateQuantityBelief(Person person,
                                 HydrologicalUnit hu)
Method updates the belief of an agent on how much water there is for a given water source

Parameters:
person - a person agent
hu - a hydrological unit

updateQuantityChangeBelief

public void updateQuantityChangeBelief(Person person,
                                       HydrologicalUnit hu)
Method that updates an agents belief about quantity changes in the water source used

Parameters:
person - a person agent
hu - a hydrological unit

preferenceWeighted

public double[] preferenceWeighted(Person person,
                                   double[] belief)
Method to weight preferences for certain water sources

Parameters:
person - an agent that will update his/her preference for water sources
belief - belief values associated with water source
Returns:
a double array of weighted water preferences

updateQuantityHistory

public void updateQuantityHistory(HydrologicalUnit hu,
                                  Person person,
                                  double quantity)
Method that updates the history kept by an agent about quantities (latest historical values based on length of historical memory)

Parameters:
hu - a hydrological unit
person - person agent
quantity - the quantity to update in memory

updateQuantityMinimum

public void updateQuantityMinimum(HydrologicalUnit hu,
                                  Person person,
                                  double waterToCollect)
Method that checks to see if the water quantity is among the minimum amounts kept in memory by an agent

Parameters:
hu - a hydrological unit
person - a person agent
waterToCollect - amount of water collected

updateQuantityMaximum

public void updateQuantityMaximum(HydrologicalUnit hu,
                                  Person person,
                                  double waterToCollect)
Method to see if the water collected is an amount among the record high amounts of water collected in agent memory

Parameters:
hu - the hydrological unit
person - a person agent
waterToCollect - the amount of water collected

setupModelData

public void setupModelData(java.lang.String file)
Description copied from interface: GeneralModel
Method to setup model data used by a given water use model

Specified by:
setupModelData in interface GeneralModel
Overrides:
setupModelData in class WaterUseBehaviors
Parameters:
file - the file to use for model data

determineSize

public void determineSize(HydrologicalSetting hs)
Method determines the size or number of water sources from a given system

Parameters:
hs - a hydrological system

visitWeightedPreference

public void visitWeightedPreference(Person p)
Method to give weights to sources visited

Parameters:
p - a person agent

removeAgent

public void removeAgent(Person p)
Method to remove agent from the models data

Parameters:
p - a person agent