uaa.feral.social.waterUse
Class SocialDistancing

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

public class SocialDistancing
extends WaterUseBehaviors

Social distancing model based on UAA-Northwestern water use model by Daniel Stouffer.

Author:
Daniel Stouffer and Mark Altaweel

Constructor Summary
SocialDistancing(Community community)
          Main constructor for object
 
Method Summary
 double ageWeighted(double[] timeSeries)
          Method used to weight certain agents
 void askAgents()
          Method that allows agents to get water and update values associated with water (quantity and quality) and perceptions of water
 void bayesianPreference(HydrologicalUnit hu, Person p)
          Method that calculates water source preferences
 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 degradeWaterQuantity()
          Method degrades water quantity by .05 percent
 void determineSize(HydrologicalSetting hs)
          Method determines the size or number of water sources from a given system
 double getAcceptableDistanceLevel()
           
 java.util.List<HydrologicalUnit> getWaterSourceContexts()
           
 double getWeightFactor()
           
 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 resetValues()
          Method to reset data values to different quantities
 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 setAcceptableDistanceLevel(double acceptableDistanceLevel)
           
 void setupModelData(java.lang.String file)
          Method to setup model data used by a given water use model
 void setWaterSourceContexts(java.util.List<HydrologicalUnit> waterSourceContexts)
           
 void setWeightFactor(double weightFactor)
           
 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

SocialDistancing

public SocialDistancing(Community community)
Main constructor for object

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

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

degradeWaterQuantity

public void degradeWaterQuantity()
Method degrades water quantity by .05 percent


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


resetValues

public void resetValues()
Method to reset data values to different quantities


organizeWaterForPeople

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

Parameters:
person - 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

bayesianPreference

public void bayesianPreference(HydrologicalUnit hu,
                               Person p)
Method that calculates water source preferences

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

visitWeightedPreference

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

Parameters:
p - a person agent

moveToMunicipalWaterSource

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

Parameters:
p - a person agent

moveToNaturalWaterSource

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

Parameters:
p - a person agent

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

getWeightFactor

public double getWeightFactor()

setWeightFactor

public void setWeightFactor(double weightFactor)

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

updatePeople

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


determineSize

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

Parameters:
hs - a hydrological system

returnHome

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

Parameters:
p -

askAgents

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


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

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

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

ageWeighted

public double ageWeighted(double[] timeSeries)
Method used to weight certain agents

Parameters:
timeSeries - time series values
Returns:
a weight value

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

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

removeAgent

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

Parameters:
p - a person agent

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

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

getWaterSourceContexts

public java.util.List<HydrologicalUnit> getWaterSourceContexts()

setWaterSourceContexts

public void setWaterSourceContexts(java.util.List<HydrologicalUnit> waterSourceContexts)

getAcceptableDistanceLevel

public double getAcceptableDistanceLevel()

setAcceptableDistanceLevel

public void setAcceptableDistanceLevel(double acceptableDistanceLevel)