|
AntHocNet 2.6.1
Paper-faithful ant-colony ad hoc routing: the shared core and its adapters
|
#include <anthocnet/core/pheromone_engine.h>
Public Member Functions | |
| PheromoneEngine (const Config &config) | |
| double | evaporate (double phValue) const |
| phValue - (1 - alpha) * phValue | |
| double | reinforce (double phValue, double phUpdate) const |
| gamma * phValue + (1 - gamma) * phUpdate | |
| void | updateRegular (PheromoneTable &table, NodeAddress dest, NodeAddress neighbor, double phUpdate) const |
| Reinforce the (dest, neighbor) regular link travelled by an ant. | |
| void | evaporateAll (PheromoneTable &table, double dtSeconds, const std::map< NodeAddress, double > *rateMultiplier=nullptr) const |
| Time-proportional aging of every regular AND virtual link by alpha^(dt/interval), pruning links below minPheromone. | |
| void | updateVirtual (PheromoneTable &table, const AntMessage &hello) const |
| Reinforce the virtual links advertised by a hello. | |
| void | updateVirtual (PheromoneTable &table, const AntMessage &hello, double hopCost) const |
Same, adding hopCost (the cost of the link to the hello's sender, in the metric's units) instead of the unloaded hop time (#181). | |
| void | cleanNeighbor (PheromoneTable &table, NodeAddress neighbor) const |
| Prune a vanished neighbour from both tables. | |
| bool | hasRegularDestination (const PheromoneTable &table, NodeAddress dest) const |
| True if any neighbour still holds usable pheromone for this dest. | |
Definition at line 23 of file pheromone_engine.h.
|
inlineexplicit |
Definition at line 25 of file pheromone_engine.h.
| double anthocnet::core::PheromoneEngine::evaporate | ( | double | phValue | ) | const |
phValue - (1 - alpha) * phValue
| double anthocnet::core::PheromoneEngine::reinforce | ( | double | phValue, |
| double | phUpdate | ||
| ) | const |
gamma * phValue + (1 - gamma) * phUpdate
| void anthocnet::core::PheromoneEngine::updateRegular | ( | PheromoneTable & | table, |
| NodeAddress | dest, | ||
| NodeAddress | neighbor, | ||
| double | phUpdate | ||
| ) | const |
Reinforce the (dest, neighbor) regular link travelled by an ant.
Aging of other links is handled separately by evaporateAll (ADR-0012).
| void anthocnet::core::PheromoneEngine::evaporateAll | ( | PheromoneTable & | table, |
| double | dtSeconds, | ||
| const std::map< NodeAddress, double > * | rateMultiplier = nullptr |
||
| ) | const |
Time-proportional aging of every regular AND virtual link by alpha^(dt/interval), pruning links below minPheromone.
Driven by the maintenance tick. One clock for both tables (#262) keeps them commensurable for virtual-vs-regular comparisons. rateMultiplier (#572), when given, scales the decay per destination: a destination in the map ages as if m times the elapsed time had passed, in both tables (they must stay commensurable, #262). nullptr, or a destination absent from the map, ages exactly as before.
| void anthocnet::core::PheromoneEngine::updateVirtual | ( | PheromoneTable & | table, |
| const AntMessage & | hello | ||
| ) | const |
Reinforce the virtual links advertised by a hello.
Aging is handled by evaporateAll, same as the regular table (#262).
| void anthocnet::core::PheromoneEngine::updateVirtual | ( | PheromoneTable & | table, |
| const AntMessage & | hello, | ||
| double | hopCost | ||
| ) | const |
Same, adding hopCost (the cost of the link to the hello's sender, in the metric's units) instead of the unloaded hop time (#181).
| void anthocnet::core::PheromoneEngine::cleanNeighbor | ( | PheromoneTable & | table, |
| NodeAddress | neighbor | ||
| ) | const |
Prune a vanished neighbour from both tables.
| bool anthocnet::core::PheromoneEngine::hasRegularDestination | ( | const PheromoneTable & | table, |
| NodeAddress | dest | ||
| ) | const |
True if any neighbour still holds usable pheromone for this dest.