Skip to content
Snippets Groups Projects

pydtn agkmeans and version 1.0

Merged Hunter McConnell (rtm534) requested to merge summer2022 into develop
3 files
+ 41
65
Compare changes
  • Side-by-side
  • Inline
Files
3
+ 10
17
@@ -2,33 +2,28 @@
example module for displaying sim results graphically
"""
__all__ = [
'display'
]
__author__ = "Hunter McConnell <hunter.mcconnell@usask.ca>"
import sys
import matplotlib.pyplot as plt
from multiprocessing import Pool
import matplotlib.pyplot as plt
from shed import Simulation, run_simulation
from pydtnsim import Network, RandomTraffic, Node, EpidemicNode, CSVTrace
from pydtnsim import Node, EpidemicNode
from pydtnsim.community import BubbleKCliqueNode, BubbleLouvainNode
from pydtnsim.community import HCBFKCliqueNode, HCBFLouvainNode
# run the sim on each taxi dataset, then plot the results together
def main():
""" Run a set of sims on taxi datasets, plot the results together"""
pool = Pool()
traces = [
'../../processed/taxi10',
'../../processed/taxi20',
'../../processed/taxi50',
#'../../processed/taxi100',
# '../../processed/taxi100',
]
node_types = [
@@ -57,23 +52,23 @@ def main():
# graph the results
figure, (ax1, ax2) = plt.subplots(2, sharex=True)
_, (ax1, ax2) = plt.subplots(2, sharex=True)
ax1.set_ylabel("Delivery Ratio")
ax2.set_ylabel("Delivery Cost")
x = [
10,
20,
50,
#100,
# 100,
]
for node, stats in results.items():
test = list(zip(*sorted(stats.items())))
y1 = [stat["delivery-ratio"] for stat in test[1]]
y2 = [stat["delivery-cost"] for stat in test[1]]
#y3 = [stat["latency"] for stat in test[1]]
# y3 = [stat["latency"] for stat in test[1]]
ax1.plot(x, y1, 'o-', label=node)
ax2.plot(x, y2, 'o-', label=node)
@@ -82,8 +77,6 @@ def main():
plt.legend()
plt.show()
if __name__ == '__main__':
#sys.exit(main(parse_args(sys.argv[1:])))
sys.exit(main())
\ No newline at end of file
# sys.exit(main(parse_args(sys.argv[1:])))
sys.exit(main())
Loading