Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
2
2022-020
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
O.V.B Sewmina
2022-020
Commits
03e16a5e
Commit
03e16a5e
authored
Oct 09, 2022
by
Binara
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
file name changed
parent
3ed8b311
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
49 additions
and
40 deletions
+49
-40
.vscode/settings.json
.vscode/settings.json
+5
-4
TravelTimePrediction/TravelTimePredictionNN.py
TravelTimePrediction/TravelTimePredictionNN.py
+4
-1
TravelTimePrediction/__pycache__/TravelTimePredictionNN.cpython-310.pyc
...iction/__pycache__/TravelTimePredictionNN.cpython-310.pyc
+0
-0
TravelTimePrediction/__pycache__/testingWeather.cpython-310.pyc
...TimePrediction/__pycache__/testingWeather.cpython-310.pyc
+0
-0
pathplanner/AL.py
pathplanner/AL.py
+27
-5
pathplanner/__pycache__/helpers.cpython-310.pyc
pathplanner/__pycache__/helpers.cpython-310.pyc
+0
-0
pathplanner/__pycache__/test.cpython-310.pyc
pathplanner/__pycache__/test.cpython-310.pyc
+0
-0
pathplanner/helpers.py
pathplanner/helpers.py
+5
-21
pathplanner/test.py
pathplanner/test.py
+8
-9
No files found.
.vscode/settings.json
View file @
03e16a5e
{
"python.analysis.extraPaths"
:
[
"./TravelTimePrediction/TrainData"
]
}
\ No newline at end of file
"python.analysis.extraPaths"
:
[
"./TravelTimePrediction/TrainData"
,
"./TravelTimePrediction"
]
}
TravelTimePrediction/TravelTimePredictionNN.py
View file @
03e16a5e
...
...
@@ -196,6 +196,9 @@ weather =testingWeather.weather(city) #Get weather in travel area
Distance
=
14.7
#Distance data come from seminas ----- data come from the Seminas data/member of route planning
#- ToDO
# callTimePrediction arguments should be dis, stops, hour, day
# Get Prediction USing this Method after Seminas Calling
def
CallTimePrediction
(
distance
,
BuStops
,
TodayDate
):
FnewDate
=
GetDateCode
(
TodayDate
)
...
...
@@ -203,7 +206,7 @@ def CallTimePrediction(distance,BuStops,TodayDate):
CallTimePrediction
(
14.7
,
8
,
'Sunday'
)
# Get Train Data
...
...
TravelTimePrediction/__pycache__/TravelTimePredictionNN.cpython-310.pyc
0 → 100644
View file @
03e16a5e
File added
TravelTimePrediction/__pycache__/testingWeather.cpython-310.pyc
View file @
03e16a5e
No preview for this file type
route
planner/AL.py
→
path
planner/AL.py
View file @
03e16a5e
...
...
@@ -217,7 +217,7 @@ class PathPlanner():
#traveled_distance
lastNode
=
self
.
start
for
n
in
self
.
path
[
1
:]:
self
.
range
=
self
.
range
+
distance
(
lastNode
,
n
)
self
.
range
+=
distance
(
lastNode
,
n
)
lastNode
=
n
return
self
.
range
...
...
@@ -260,13 +260,35 @@ def main( val, start, destination):
path
=
planner
.
path
if
path
==
False
:
print
(
"No path Found
"
,
path
)
print
(
"No path Found
"
)
return
False
else
:
print
(
path
)
print
(
'distance = '
,
planner
.
get_traveled_distance
()
/
10
)
print
(
'path = '
,
path
)
dist
=
planner
.
get_traveled_distance
()
/
10
print
(
'distance = '
,
dist
)
fare
=
planner
.
get_fare
(
path
)
print
(
'trip RS.'
,
fare
)
main
(
1
,
1
,
18
)
\ No newline at end of file
####--------------- calling functions of travelTimePredictions (Shiwantha) ---------------
from
datetime
import
datetime
# get current datetime
dateTime
=
datetime
.
now
()
import
sys
#adding Folder_2/subfolder to the system path
sys
.
path
.
insert
(
0
,
'TravelTimePrediction'
)
#importing the hello
from
TravelTimePredictionNN
import
CallTimePrediction
#dis, stops, hour, day
CallTimePrediction
(
dist
,
len
(
path
),(
dateTime
.
hour
),(
dateTime
.
strftime
(
'
%
A'
)))
main
(
1
,
8
,
18
)
# from test import test
# test(map)
\ No newline at end of file
route
planner/__pycache__/helpers.cpython-310.pyc
→
path
planner/__pycache__/helpers.cpython-310.pyc
View file @
03e16a5e
No preview for this file type
pathplanner/__pycache__/test.cpython-310.pyc
0 → 100644
View file @
03e16a5e
File added
route
planner/helpers.py
→
path
planner/helpers.py
View file @
03e16a5e
...
...
@@ -44,7 +44,7 @@ route_8717 = {
}
map_test
=
{
0
:
{
'pos'
:
(
6.911034627182109
,
79.84918916006576
),
'connections'
:
[
1
,
16
],
'name'
:
'Kollupitiya'
,
'type'
:
0
,
'routeNo'
:
177
,
'hValue'
:
1
},
0
:
{
'pos'
:
(
6.911034627182109
,
79.84918916006576
),
'connections'
:
[
1
,
16
],
'name'
:
'Kollupitiya'
,
'type'
:
0
,
'routeNo'
:
177
,
'hValue'
:
5
},
1
:
{
'pos'
:
(
6.911751932322411
,
79.86194701315071
),
'connections'
:
[
0
,
2
],
'name'
:
'Viharamahadevi Park'
,
'type'
:
0
,
'routeNo'
:
177
,
'hValue'
:
1
},
2
:
{
'pos'
:
(
6.911385550864001
,
79.87682791026592
),
'connections'
:
[
1
,
3
],
'name'
:
'House Of Fashion'
,
'type'
:
0
,
'routeNo'
:
177
,
'hValue'
:
1
},
3
:
{
'pos'
:
(
6.911031363415147
,
79.88498429384545
),
'connections'
:
[
2
,
4
],
'name'
:
'Castle Street'
,
'type'
:
0
,
'routeNo'
:
177
,
'hValue'
:
1
},
...
...
@@ -73,18 +73,13 @@ class Map:
self
.
intersections
=
nx
.
get_node_attributes
(
G
,
"pos"
)
self
.
routeNo
=
nx
.
get_node_attributes
(
G
,
"routeNo"
)
self
.
type
=
nx
.
get_node_attributes
(
G
,
"type"
)
self
.
name
=
nx
.
get_node_attributes
(
G
,
"name"
)
self
.
roads
=
[
list
(
G
[
node
])
for
node
in
G
.
nodes
()]
def
save
(
self
,
filename
):
with
open
(
filename
,
'wb'
)
as
f
:
pickle
.
dump
(
self
.
_graph
,
f
)
def
load_map_graph
(
map_dict
):
G
=
nx
.
Graph
()
for
node
in
map_dict
.
keys
():
G
.
add_node
(
node
,
pos
=
map_dict
[
node
][
'pos'
],
type
=
map_dict
[
node
][
'type'
],
routeNo
=
map_dict
[
node
][
'routeNo'
])
G
.
add_node
(
node
,
pos
=
map_dict
[
node
][
'pos'
],
type
=
map_dict
[
node
][
'type'
],
routeNo
=
map_dict
[
node
][
'routeNo'
]
,
name
=
map_dict
[
node
][
'name'
]
)
for
node
in
map_dict
.
keys
():
for
con_node
in
map_dict
[
node
][
'connections'
]:
G
.
add_edge
(
node
,
con_node
)
...
...
@@ -93,22 +88,11 @@ def load_map_graph(map_dict):
def
load_map_b
(
map_dict
):
# G = nx.Graph()
# for node in map_dict.keys():
# #nodeValue =
# if map_dict[node]['type'] != 1:
# continue
# else:
# G.add_node(node, pos=map_dict[node]['pos'], type=map_dict[node]['type'],routeNo=map_dict[node]['routeNo'])
G
=
nx
.
Graph
()
for
node
in
map_dict
.
keys
():
G
.
add_node
(
node
,
pos
=
map_dict
[
node
][
'pos'
],
type
=
map_dict
[
node
][
'type'
],
routeNo
=
map_dict
[
node
][
'routeNo'
])
# for node in map_dict.keys():
# for con_node in map_dict[node]['connections']:
# if map_dict[con_node]['type'] != 1:
# continue
# else:
# G.add_edge(node, con_node)
for
node
in
map_dict
.
keys
():
for
con_node
in
map_dict
[
node
][
'connections'
]:
if
map_dict
[
node
][
'type'
]
!=
1
:
...
...
route
planner/test.py
→
path
planner/test.py
View file @
03e16a5e
from
helpers
import
load_map_test
MAP_
ANSWERS
=
[
(
5
,
34
,
[
5
,
16
,
37
,
12
,
34
]),
(
5
,
5
,
[
5
]),
(
8
,
24
,
[
8
,
14
,
16
,
37
,
12
,
17
,
10
,
24
])
ANSWERS
=
[
(
1
,
5
,
34
,
[
5
,
16
,
37
,
12
,
34
]),
(
1
,
5
,
5
,
[
5
]),
(
1
,
8
,
24
,
[
8
,
14
,
16
,
37
,
12
,
17
,
10
,
24
])
]
def
test
(
shortest_path_function
):
map
=
load_map_test
(
)
print
(
'test started ---------------'
)
correct
=
0
for
start
,
goal
,
answer_path
in
MAP_
ANSWERS
:
for
map
,
start
,
goal
,
answer_path
in
ANSWERS
:
path
=
shortest_path_function
(
map
,
start
,
goal
)
.
path
if
path
==
answer_path
:
correct
+=
1
...
...
@@ -19,8 +18,8 @@ def test(shortest_path_function):
"Correct: "
,
answer_path
)
else
:
print
(
"Error Testing faild !!!"
)
if
correct
==
len
(
MAP_
ANSWERS
):
if
correct
==
len
(
ANSWERS
):
print
(
"All tests pass "
)
else
:
print
(
"Only passed"
,
correct
,
"/"
,
len
(
MAP_
ANSWERS
),
"test cases"
)
print
(
"Only passed"
,
correct
,
"/"
,
len
(
ANSWERS
),
"test cases"
)
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment