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
9b730593
Commit
9b730593
authored
Oct 08, 2022
by
Binara
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
refactoring get_fare fuction
parent
2cc6a52b
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
28 additions
and
20 deletions
+28
-20
routeplanner/AL.py
routeplanner/AL.py
+28
-20
No files found.
routeplanner/AL.py
View file @
9b730593
...
...
@@ -13,6 +13,7 @@ class PathPlanner():
self
.
goal
=
goal
self
.
type
=
type
self
.
range
=
0
self
.
cost
=
0
self
.
closedSet
=
self
.
create_closedSet
()
if
goal
!=
None
and
start
!=
None
else
None
self
.
openSet
=
self
.
create_openSet
()
if
goal
!=
None
and
start
!=
None
else
None
self
.
cameFrom
=
self
.
create_cameFrom
()
if
goal
!=
None
and
start
!=
None
else
None
...
...
@@ -221,31 +222,38 @@ class PathPlanner():
return
self
.
range
def
get_fare
(
self
,
path
):
cost
=
0
currentRouteNo
=
self
.
map
.
routeNo
[
self
.
start
]
temp
=
0
for
x
in
path
:
if
self
.
map
.
routeNo
[
x
]
==
currentRouteNo
:
print
(
'path is(x) ='
+
str
(
x
)
+
' ,temp ='
+
str
(
temp
)
+
' ,cost ='
+
str
(
cost
))
#print('path is(x) =' + str(x)+ ' ,temp =' + str(temp
))
temp
+=
1
else
:
if
(
currentRouteNo
==
177
):
cost
=
cost
+
route_177
.
get
(
temp
)
temp
=
0
currentRouteNo
=
self
.
map
.
routeNo
[
x
]
elif
(
currentRouteNo
==
176
)
:
cost
=
cost
+
route_176
.
get
(
temp
)
temp
=
0
else
:
print
(
"eeeeeeeeeeeeeeeeeeee"
)
self
.
func
(
currentRouteNo
,
temp
)
currentRouteNo
=
self
.
map
.
routeNo
[
x
]
elif
(
currentRouteNo
==
8717
):
cost
=
cost
+
route_8717
.
get
(
temp
)
temp
=
0
currentRouteNo
=
self
.
map
.
routeNo
[
x
]
print
(
'cost = '
,
self
.
cost
)
#cost = cost + route_177.get(temp)
return
self
.
cost
def
func
(
self
,
no
,
nodes
):
print
(
'fuction'
)
if
(
no
==
177
):
self
.
cost
=
self
.
cost
+
route_177
.
get
(
nodes
)
elif
(
no
==
176
):
self
.
cost
=
self
.
cost
+
route_176
.
get
(
nodes
)
elif
(
no
==
8717
):
self
.
cost
=
self
.
cost
+
route_8717
.
get
(
nodes
)
else
:
temp
=
0
cost
=
cost
+
route_177
.
get
(
temp
)
return
cost
pass
# Get route
def
main
(
a
,
start
,
destination
):
...
...
@@ -268,7 +276,7 @@ def main( a, start, destination):
else
:
print
(
path
)
print
(
'distance ='
,
planner
.
get_traveled_distance
())
#
print(planner.get_fare(path))
print
(
planner
.
get_fare
(
path
))
...
...
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