26 lines
1.1 KiB
Python
26 lines
1.1 KiB
Python
class Voter:
|
|
'''
|
|
This class acts to replicate sensor information with the network to come to a consensus
|
|
of an activity occurrance. This is based upon research by Song et al. available at:
|
|
https://ieeexplore.ieee.org/document/5484586
|
|
|
|
The main advantage of this approach, as apposed to techniques such as by using zookeeper
|
|
or consul, is it can be completely decentralised and so works without a central server,
|
|
or needing to elect a central server. Additionally, it does not require all nodes
|
|
to run a Zookeeper/Consul server instance, which were not designed for these constrained
|
|
combat environments, which will fail if half the nodes fail, and also use a lot of resources
|
|
for handling services not required by this task.
|
|
|
|
The original approach in the paper requires some previous training before sensing, so
|
|
that there is a probability of a given action based upon the previous set of actions.
|
|
'''
|
|
def __init__(self, on_vote):
|
|
'''
|
|
on_vote: Callback to get the required vote to broadcast.
|
|
'''
|
|
self.on_vote = on_vote
|
|
|
|
def submit_vote(self):
|
|
pass
|
|
|
|
def |