}}\preformatted{agent$new(
identifier = NA,
first_name = NA,
last_name = NA,
@@ -89,34 +89,34 @@ Used to created new winik objects.
\subsection{Arguments}{
\if{html}{\out{
}}
\describe{
-\item{\code{identifier}}{The winik's identifier}
+\item{\code{identifier}}{The agent's identifier}
-\item{\code{first_name}}{The winik's first name}
+\item{\code{first_name}}{The agent's first name}
-\item{\code{last_name}}{The winik's last naem}
+\item{\code{last_name}}{The agent's last naem}
-\item{\code{age}}{The age of the winik}
+\item{\code{age}}{The age of the agent}
-\item{\code{mother_id}}{The identifier of the winik's monther}
+\item{\code{mother_id}}{The identifier of the agent's monther}
-\item{\code{father_id}}{The identifier of the winik' father}
+\item{\code{father_id}}{The identifier of the agent' father}
-\item{\code{partner}}{The identifier of the winik's partner}
+\item{\code{partner}}{The identifier of the agent's partner}
-\item{\code{children}}{An ordered list of of the children from this winik}
+\item{\code{children}}{An ordered list of of the children from this agent}
-\item{\code{gender}}{The gender of the winik}
+\item{\code{gender}}{The gender of the agent}
-\item{\code{profession}}{The winik's profession}
+\item{\code{profession}}{The agent's profession}
-\item{\code{alive}}{Boolean whether the winik is alive or not}
+\item{\code{alive}}{Boolean whether the agent is alive or not}
-\item{\code{health}}{A percentage value of the winik's current health}
+\item{\code{health}}{A percentage value of the agent's current health}
}
\if{html}{\out{
}}
}
\subsection{Returns}{
-A new winik object
+A new agent object
A function that returns true or false whether the villager dies
This is run each day
}
@@ -126,13 +126,13 @@ This is run each day
\if{latex}{\out{\hypertarget{method-is_alive}{}}}
\subsection{Method \code{is_alive()}}{
\subsection{Usage}{
-\if{html}{\out{
}}\preformatted{winik$is_alive()}\if{html}{\out{
}}
+\if{html}{\out{
}}\preformatted{agent$is_alive()}\if{html}{\out{
}}
}
\subsection{Returns}{
-A boolean whether the winik is alive (true for yes)
+A boolean whether the agent is alive (true for yes)
Gets the number of days from the last birth. This is also
-the age of the most recently born winik
+the age of the most recently born agent
}
}
\if{html}{\out{
}}
@@ -140,12 +140,12 @@ the age of the most recently born winik
\if{latex}{\out{\hypertarget{method-get_days_since_last_birth}{}}}
\subsection{Method \code{get_days_since_last_birth()}}{
\subsection{Usage}{
-\if{html}{\out{
}}\preformatted{winik$get_days_since_last_birth()}\if{html}{\out{
}}
+\if{html}{\out{
}}\preformatted{agent$get_days_since_last_birth()}\if{html}{\out{
}}
}
\subsection{Returns}{
The number of days since last birth
-Connects a child to the winik. This method ensures that the
+Connects a child to the agent. This method ensures that the
'children' vector is ordered.
}
}
@@ -154,19 +154,19 @@ Connects a child to the winik. This method ensures that the
\if{latex}{\out{\hypertarget{method-add_child}{}}}
\subsection{Method \code{add_child()}}{
\subsection{Usage}{
-\if{html}{\out{
}}\preformatted{winik$add_child(child)}\if{html}{\out{
}}
+\if{html}{\out{
}}\preformatted{agent$add_child(child)}\if{html}{\out{
}}
}
\subsection{Arguments}{
\if{html}{\out{
}}
\describe{
-\item{\code{child}}{The Winik object representing the child}
+\item{\code{child}}{The agent object representing the child}
}
\if{html}{\out{
}}
}
\subsection{Returns}{
None
-Returns a data.frame representation of the winik
+Returns a data.frame representation of the agent
}
}
\if{html}{\out{
}}
@@ -176,16 +176,16 @@ Returns a data.frame representation of the winik
I hope there's a more scalable way to do this in R; Adding every new attribute to this
function isn't practical
\subsection{Usage}{
-\if{html}{\out{
}}\preformatted{winik$as_table()}\if{html}{\out{
}}
+\if{html}{\out{
}}\preformatted{agent$as_table()}\if{html}{\out{
}}
}
\subsection{Details}{
The village_state holds a copy of all of the villagers at each timestep; this method is used to turn
-the winik properties into the object inserted in the village_state.
+the agent properties into the object inserted in the village_state.
}
\subsection{Returns}{
-A data.frame representation of the winik
+A data.frame representation of the agent
}
}
\if{html}{\out{
}}
@@ -194,7 +194,7 @@ A data.frame representation of the winik
\subsection{Method \code{clone()}}{
The objects of this class are cloneable with this method.
\subsection{Usage}{
-\if{html}{\out{
}}\preformatted{winik$clone(deep = FALSE)}\if{html}{\out{
}}
+\if{html}{\out{
}}\preformatted{agent$clone(deep = FALSE)}\if{html}{\out{
}}
}
\subsection{Arguments}{
diff --git a/man/agent_manager.Rd b/man/agent_manager.Rd
new file mode 100644
index 0000000..0be48e8
--- /dev/null
+++ b/man/agent_manager.Rd
@@ -0,0 +1,293 @@
+% Generated by roxygen2: do not edit by hand
+% Please edit documentation in R/agent_manager.R
+\docType{class}
+\name{agent_manager}
+\alias{agent_manager}
+\title{agent Manager}
+\description{
+A class that abstracts the management of aggregations of agent classes. Each village should have
+an instance of a agent_manager to interface the agents inside.
+}
+\section{Methods}{
+
+\describe{
+\item{\code{add_agent()}}{Adds a single agent to the manager.}
+\item{\code{get_average_age()}}{Returns the average age, in years, of all the agents.}
+\item{\code{get_living_agents()}}{Gets a list of all the agents that are currently alive.}
+\item{\code{get_states()}}{Returns a data.frame consisting of all of the managed agents.}
+\item{\code{get_agent()}}{Retrieves a particular agent from the manager.}
+\item{\code{get_agent_index()}}{Retrieves the index of a agent.}
+\item{\code{initialize()}}{Creates a new manager instance.}
+\item{\code{load()}}{Loads a csv file defining a population of agents and places them in the manager.}
+\item{\code{remove_agent()}}{Removes a agent from the manager}
+}
+Creates a new agent manager instance.
+}
+
+\section{Public fields}{
+\if{html}{\out{
}}
+\describe{
+\item{\code{agents}}{A list of agents objects that the agent manager manages.}
+
+\item{\code{agent_class}}{A class describing agents. This is usually the default villager supplied 'agent' class}
+}
+\if{html}{\out{
}}
+}
+\section{Methods}{
+\subsection{Public methods}{
+\itemize{
+\item \href{#method-new}{\code{agent_manager$new()}}
+\item \href{#method-get_agent}{\code{agent_manager$get_agent()}}
+\item \href{#method-get_living_agents}{\code{agent_manager$get_living_agents()}}
+\item \href{#method-add_agent}{\code{agent_manager$add_agent()}}
+\item \href{#method-remove_agent}{\code{agent_manager$remove_agent()}}
+\item \href{#method-get_states}{\code{agent_manager$get_states()}}
+\item \href{#method-get_agent_index}{\code{agent_manager$get_agent_index()}}
+\item \href{#method-connect_agents}{\code{agent_manager$connect_agents()}}
+\item \href{#method-get_living_population}{\code{agent_manager$get_living_population()}}
+\item \href{#method-get_average_age}{\code{agent_manager$get_average_age()}}
+\item \href{#method-add_children}{\code{agent_manager$add_children()}}
+\item \href{#method-load}{\code{agent_manager$load()}}
+\item \href{#method-clone}{\code{agent_manager$clone()}}
+}
+}
+\if{html}{\out{
}}
+\if{html}{\out{
}}
+\if{latex}{\out{\hypertarget{method-new}{}}}
+\subsection{Method \code{new()}}{
+\subsection{Usage}{
+\if{html}{\out{
}}\preformatted{agent_manager$new(agent_class = villager::agent)}\if{html}{\out{
}}
+}
+
+\subsection{Arguments}{
+\if{html}{\out{
}}
+\describe{
+\item{\code{agent_class}}{The class that's being used to represent agents being managed
+Given the identifier of a agent, sort through all of the managed agents and return it
+if it exists.}
+}
+\if{html}{\out{
}}
+}
+}
+\if{html}{\out{
}}
+\if{html}{\out{
}}
+\if{latex}{\out{\hypertarget{method-get_agent}{}}}
+\subsection{Method \code{get_agent()}}{
+Return the R6 instance of a agent with identiifier 'agent_identifier'.
+\subsection{Usage}{
+\if{html}{\out{
}}\preformatted{agent_manager$get_agent(agent_identifier)}\if{html}{\out{
}}
+}
+
+\subsection{Arguments}{
+\if{html}{\out{
}}
+\describe{
+\item{\code{agent_identifier}}{The identifier of the requested agent.}
+}
+\if{html}{\out{
}}
+}
+\subsection{Returns}{
+An R6 agent object
+Returns a list of all the agents that are currently alive.
+}
+}
+\if{html}{\out{
}}
+\if{html}{\out{
}}
+\if{latex}{\out{\hypertarget{method-get_living_agents}{}}}
+\subsection{Method \code{get_living_agents()}}{
+\subsection{Usage}{
+\if{html}{\out{
}}\preformatted{agent_manager$get_living_agents()}\if{html}{\out{
}}
+}
+
+\subsection{Returns}{
+A list of living agents
+Adds a agent to the manager.
+}
+}
+\if{html}{\out{
}}
+\if{html}{\out{
}}
+\if{latex}{\out{\hypertarget{method-add_agent}{}}}
+\subsection{Method \code{add_agent()}}{
+\subsection{Usage}{
+\if{html}{\out{
}}\preformatted{agent_manager$add_agent(new_agent)}\if{html}{\out{
}}
+}
+
+\subsection{Arguments}{
+\if{html}{\out{
}}
+\describe{
+\item{\code{new_agent}}{The agent to add to the manager}
+}
+\if{html}{\out{
}}
+}
+\subsection{Returns}{
+None
+Removes a agent from the manager
+}
+}
+\if{html}{\out{
}}
+\if{html}{\out{
}}
+\if{latex}{\out{\hypertarget{method-remove_agent}{}}}
+\subsection{Method \code{remove_agent()}}{
+\subsection{Usage}{
+\if{html}{\out{
}}\preformatted{agent_manager$remove_agent(agent_identifier)}\if{html}{\out{
}}
+}
+
+\subsection{Arguments}{
+\if{html}{\out{
}}
+\describe{
+\item{\code{agent_identifier}}{The identifier of the agent being removed}
+}
+\if{html}{\out{
}}
+}
+\subsection{Returns}{
+None
+Returns a data.frame of agents
+}
+}
+\if{html}{\out{
}}
+\if{html}{\out{
}}
+\if{latex}{\out{\hypertarget{method-get_states}{}}}
+\subsection{Method \code{get_states()}}{
+\subsection{Usage}{
+\if{html}{\out{
}}\preformatted{agent_manager$get_states()}\if{html}{\out{
}}
+}
+
+\subsection{Details}{
+Each row of the data.frame represents a agent object
+}
+
+\subsection{Returns}{
+A single data.frame of all agents
+Returns the index of a agent in the internal agent list
+}
+}
+\if{html}{\out{
}}
+\if{html}{\out{
}}
+\if{latex}{\out{\hypertarget{method-get_agent_index}{}}}
+\subsection{Method \code{get_agent_index()}}{
+\subsection{Usage}{
+\if{html}{\out{
}}\preformatted{agent_manager$get_agent_index(agent_identifier)}\if{html}{\out{
}}
+}
+
+\subsection{Arguments}{
+\if{html}{\out{
}}
+\describe{
+\item{\code{agent_identifier}}{The identifier of the agent being located}
+}
+\if{html}{\out{
}}
+}
+\subsection{Returns}{
+The index in the list, or R's default return value
+Connects two agents together as mates
+}
+}
+\if{html}{\out{
}}
+\if{html}{\out{
}}
+\if{latex}{\out{\hypertarget{method-connect_agents}{}}}
+\subsection{Method \code{connect_agents()}}{
+\subsection{Usage}{
+\if{html}{\out{
}}\preformatted{agent_manager$connect_agents(agent_a, agent_b)}\if{html}{\out{
}}
+}
+
+\subsection{Arguments}{
+\if{html}{\out{
}}
+\describe{
+\item{\code{agent_a}}{A agent that will be connected to agent_b}
+
+\item{\code{agent_b}}{A agent that will be connected to agent_a
+Returns the total number of agents that are alive}
+}
+\if{html}{\out{
}}
+}
+}
+\if{html}{\out{
}}
+\if{html}{\out{
}}
+\if{latex}{\out{\hypertarget{method-get_living_population}{}}}
+\subsection{Method \code{get_living_population()}}{
+\subsection{Usage}{
+\if{html}{\out{
}}\preformatted{agent_manager$get_living_population()}\if{html}{\out{
}}
+}
+
+\subsection{Returns}{
+The numnber of living agents
+Returns the averag age, in years, of all of the agents
+}
+}
+\if{html}{\out{
}}
+\if{html}{\out{
}}
+\if{latex}{\out{\hypertarget{method-get_average_age}{}}}
+\subsection{Method \code{get_average_age()}}{
+\subsection{Usage}{
+\if{html}{\out{
}}\preformatted{agent_manager$get_average_age()}\if{html}{\out{
}}
+}
+
+\subsection{Details}{
+This is an \emph{example} of the kind of logic that the manager might handle. In this case,
+the manager is performing calculations about its aggregation (agents). Note that the 364 days needs to
+work better
+}
+
+\subsection{Returns}{
+The average age in years
+Takes all of the agents in the manager and reconstructs the children
+}
+}
+\if{html}{\out{
}}
+\if{html}{\out{
}}
+\if{latex}{\out{\hypertarget{method-add_children}{}}}
+\subsection{Method \code{add_children()}}{
+\subsection{Usage}{
+\if{html}{\out{
}}\preformatted{agent_manager$add_children()}\if{html}{\out{
}}
+}
+
+\subsection{Details}{
+This is typically called when loading agents from disk for the first time.
+When children are created during the simulation, the family connections are made
+through the agent class and added to the manager via add_agent.
+}
+
+\subsection{Returns}{
+None
+Loads agents from disk.
+}
+}
+\if{html}{\out{
}}
+\if{html}{\out{
}}
+\if{latex}{\out{\hypertarget{method-load}{}}}
+\subsection{Method \code{load()}}{
+\subsection{Usage}{
+\if{html}{\out{
}}\preformatted{agent_manager$load(file_name)}\if{html}{\out{
}}
+}
+
+\subsection{Arguments}{
+\if{html}{\out{
}}
+\describe{
+\item{\code{file_name}}{The location of the file holding the agents.}
+}
+\if{html}{\out{
}}
+}
+\subsection{Details}{
+Populates the agent manager with a set of agents defined in a csv file.
+}
+
+\subsection{Returns}{
+None
+}
+}
+\if{html}{\out{
}}
+\if{html}{\out{
}}
+\if{latex}{\out{\hypertarget{method-clone}{}}}
+\subsection{Method \code{clone()}}{
+The objects of this class are cloneable with this method.
+\subsection{Usage}{
+\if{html}{\out{
}}\preformatted{agent_manager$clone(deep = FALSE)}\if{html}{\out{
}}
+}
+
+\subsection{Arguments}{
+\if{html}{\out{
}}
+\describe{
+\item{\code{deep}}{Whether to make a deep clone.}
+}
+\if{html}{\out{
}}
+}
+}
+}
diff --git a/man/data_writer.Rd b/man/data_writer.Rd
index fcd2ed3..3d50778 100644
--- a/man/data_writer.Rd
+++ b/man/data_writer.Rd
@@ -9,12 +9,12 @@ A class responsible for the simulation data to disk.
}
\details{
This class can be subclasses to provide advanced data writing to other data sources. This should also
-be subclassed if the winik and resource classes are subclasses, to write any addional fields to the data source.
+be subclassed if the agent and resource classes are subclasses, to write any addional fields to the data source.
}
\section{Methods}{
\describe{
-\item{\code{write()}}{Writes the winik and resources to disk.}
+\item{\code{write()}}{Writes the agent and resources to disk.}
}
Create a new data writer.
}
@@ -24,7 +24,7 @@ Create a new data writer.
\describe{
\item{\code{results_directory}}{The folder where the simulation resulst are written to}
-\item{\code{winik_filename}}{The location where the winiks are written to}
+\item{\code{agent_filename}}{The location where the agents are written to}
\item{\code{resource_filename}}{The location where the resources are written to}
}
@@ -46,7 +46,7 @@ Creates a new data writer object that has optional paths for data files.
\subsection{Usage}{
\if{html}{\out{
}}\preformatted{data_writer$new(
results_directory = "results",
- winik_filename = "winiks.csv",
+ agent_filename = "agents.csv",
resource_filename = "resources.csv"
)}\if{html}{\out{
}}
}
@@ -56,14 +56,14 @@ Creates a new data writer object that has optional paths for data files.
\describe{
\item{\code{results_directory}}{The directory where the results file is written to}
-\item{\code{winik_filename}}{The name of the file for the winik data}
+\item{\code{agent_filename}}{The name of the file for the agent data}
\item{\code{resource_filename}}{The name of the file for the resource data}
}
\if{html}{\out{
}}
}
\subsection{Returns}{
-A new winik object
+A new agent object
Writes a village's state to disk.
}
}
@@ -71,7 +71,7 @@ Writes a village's state to disk.
\if{html}{\out{
}}
\if{latex}{\out{\hypertarget{method-write}{}}}
\subsection{Method \code{write()}}{
-Takes a state an the name of a village and writes the winiks and resources to disk
+Takes a state an the name of a village and writes the agents and resources to disk
\subsection{Usage}{
\if{html}{\out{
}}
}
diff --git a/man/model_data.Rd b/man/model_data.Rd
index 57dc257..1361c6b 100644
--- a/man/model_data.Rd
+++ b/man/model_data.Rd
@@ -2,11 +2,11 @@
% Please edit documentation in R/model_data.R
\name{model_data}
\alias{model_data}
-\title{R6 Class representing data that's external from resources and winiks}
+\title{R6 Class representing data that's external from resources and agents}
\description{
-R6 Class representing data that's external from resources and winiks
+R6 Class representing data that's external from resources and agents
-R6 Class representing data that's external from resources and winiks
+R6 Class representing data that's external from resources and agents
}
\details{
It contains a single variable, 'events' for when the data holds a list of events
diff --git a/man/village.Rd b/man/village.Rd
index bbbfb5b..f6814ab 100644
--- a/man/village.Rd
+++ b/man/village.Rd
@@ -35,7 +35,7 @@ different village variables. This class can be subclassed to include more variab
\item{\code{model_data}}{Optional data that models may need}
-\item{\code{winik_mgr}}{The manager that handles all of the winiks}
+\item{\code{agent_mgr}}{The manager that handles all of the agents}
\item{\code{resource_mgr}}{The manager that handles all of the resources
Initializes a village}
@@ -62,7 +62,7 @@ time.
name,
initial_condition,
models = list(),
- winik_class = villager::winik,
+ agent_class = villager::agent,
resource_class = villager::resource
)}\if{html}{\out{