forked from aashimasingh/Roomba-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
analyzePathOnScenarios.py
34 lines (30 loc) · 1.15 KB
/
analyzePathOnScenarios.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File created by jacob williams
import dataPrep
import options
def nodeNumToIJ(nodeNum, rowJump):
i = int(nodeNum/rowJump)
j = int(nodeNum % rowJump)
return i, j
def ijToNode(i, j, rowJump):
return int(i*rowJump + j)
def analyzePathAcrossScenarios(followedPathLst, amountVacuumed):
totalVacuumed = 0
totalLeftBehind = 0
totalOverVacuumed = 0
for tple in followedPathLst:
i, j = nodeNumToIJ(tple[0], len(dataPrep.data[0]))
if tple[0] in dataPrep.charging_nodes:
continue
if tple[1] == options.charging_end_label:
continue
for scenario in range(len(dataPrep.data)):
nodeDirtAmount = dataPrep.data[scenario][i][j]
if nodeDirtAmount - amountVacuumed[tple[0]] >= 0:
totalLeftBehind += nodeDirtAmount - amountVacuumed[tple[0]]
totalVacuumed += amountVacuumed[tple[0]]
else:
totalOverVacuumed += amountVacuumed[tple[0]] - nodeDirtAmount
totalVacuumed += nodeDirtAmount
return totalVacuumed, \
totalLeftBehind, \
totalOverVacuumed