When ants hit a minimum sensitivy threshold (configurable), the ant is added to a dead list
and then removed from the model schedule and the environment in the model step.
The dead list is cleared every step
Nonlinear sensitivity using a logistic function is implemented.
Implemented check for ants to follow positive pheromone gradient
step() function has been improved.
Previously, self.prev_pos (now: self._prev_pos) was set non-uniformly;
sometimes in step() but also always in advance() which resulted in
unwanted behavior.
As self._prev_pos is now marked as private all assignments are done
simultaneously with self._next_pos in step(), not advance().
Accordingly, future functions should strive not to access
self._prev_pos outside of the agent if possible.
Gradient following behaviour was additionally not observed since the
sensitivity_max variable was set too low, resulting in the adjusted
pheromone concentration gradients to not be present.
We now have in main.py three functions to check theoretical decays vs
actual decays.
For this a custom testing environment is set up so no disruptions from
for example, finding a food source or an ant depositing pheromones on
the grid.
The functions are otherwise pretty self-explanatory:
check_pheromone_exponential_decay()
check_ant_sensitivity_linear_decay()
check_ant_pheromone_exponential_decay()
Besides this, with this merge we also finally have an upper limit for
ants on the grid using the num_max_agents model variable to check before
new ants are generated.
any use of the word 'chemical' has been replaced by 'pheromone' for
consistency
The agent step() function has been further improved.
Now, ants behave as roamers and follow a positive gradient in
pheromones until they find food, when they find food they will switch
what chemical they are dropping (A -> B) and will look for A.
When they return they will recruit new ants.
Currently, the sensitivity to the pheromone concentration is clamped
linear, meaning that:
{ 0 if concentration < lower_threshold
sens(concentration) = { concentration if lower_threshold < c < higher_threshold
{ higher_threshold else
A correct non-linear response is yet to be added.
Similarily next steps could include adding a sensitivity decay to ants
as described in the paper.
A proper setup for sane initial values such that interesting behaviour
can be observed can also still be implemented (consult the paper)
The visualization function in server.py can also still be adjusted to
automatically (?) adjust the normalization for color values.
This merge implements server.py for a visualization of the model.
For this implementation the mesa-provided CanvasHexGrid class needed to
be adjusted. Mesa's own function runs a visualization function on all
agents. For us it would be smarter to run the visualization function on
all grid locations, this is what CanvasHexGridMultiAgents does.
For now, concentrations are normalized using magic numbers. In the
future it might be smarter to somehow dynamically adjust these
normalizisation numbers to not threshold our visualization.
Initial implementation of step() accoriding to the rules of Schweitzer
et alii 1996.
A few neighbor fetching functions are now implemented in agent.py.
The MultiHexScalarFields implementation could be simplified as the ants
only drop their pheromones in advance() and not step(), thus they do not
interfere with each other.
We might need to look at the concentration decay for the scalar fields
again to correctly implement it. To me it is not clear whether we should
decrease the pheromone levels before the ants step() or after the ants
step() and before their advance()