11#ifndef ANTHOCNET_CORE_ANT_HISTORY_H
12#define ANTHOCNET_CORE_ANT_HISTORY_H
39 std::size_t
size()
const {
return entries_.size(); }
43 using Key = std::pair<NodeAddress, std::uint32_t>;
45 std::size_t maxEntries_;
46 std::set<Key> entries_;
47 std::deque<Key> insertionOrder_;
112 std::size_t
size()
const {
return best_.size(); }
124 std::vector<NodeAddress> firstHops;
126 using Key = std::pair<NodeAddress, std::uint32_t>;
128 std::size_t maxEntries_;
129 std::map<Key, Best> best_;
130 std::deque<Key> insertionOrder_;
AntHistoryTracker(std::size_t maxEntries)
maxEntries == 0 means unbounded.
bool seen(NodeAddress src, std::uint32_t seqNum) const
Read-only membership test.
bool record(NodeAddress src, std::uint32_t seqNum)
Record (src, seq).
Multipath acceptance filter for reactive forward ants ([1] §3.1, issue #96).
GenerationTracker(std::size_t maxEntries)
maxEntries == 0 means unbounded.
std::size_t size() const
Generations currently resident.
bool allowBroadcast(NodeAddress src, std::uint32_t seqNum, int maxBroadcasts)
Claim one broadcast of this generation at this node (#173).
bool accept(NodeAddress src, std::uint32_t seqNum, std::uint32_t hops, Time time, NodeAddress firstHop, double factor, double factorNewHop)
Decide whether to forward a reactive forward ant carrying hops/time and whose path's first hop after ...
static const std::size_t kMaxFirstHops
Cap on the per-generation set of admitted first hops (golden rule 5).
double Time
Simulation time, in seconds.
std::int32_t NodeAddress
Network-layer node address.
AntHistoryTracker: (src, seqNum) duplicate detection.