Hi, i have come up with the codes below search.pl preprocess.pl and preprocess1.pl and i have data in luven.pl
I have used A* algorith to search for routes between two nodes.
Can someone refactor for me and come up with a simpler way of doing it, since i find mine cluttered.
The codes are in...
hi kahleen,
i am re-writing the get_path predicate below to take into account iterative deepening also to avoid loop or for loop detection, also, am trying to include lenght as a cost to the search space. however, can i use the edge facts i generated earlier ? check the code below, it tries to...
i have noted the error, thanks,
if you have time, re-edit the code for me to do the following, then i can continue from there:
-Use leuven.pl to preprocess another file with- Node Id and Its names, way_tag with nodes, names and way with node id, way id, name of the way and edge with way name...
i have tried but cant spot where i need to correct the error-
ERROR: find_path/1: Undefined procedure: start_algorithm/1
the code is this
find_path(Path) :-
init, % call init to consult the 2 files we need
start_algorithm(Path).
start_algorithm(Path) :-
% node_tag(ID...
i have replaced. where do i set the parameter values?
and how do i replace the node Ids with name of node_tag? i.e user enters the start name and laste name and the prolog program returns the nodes(name_tags) between the start and end nodes and also list the way names .i.e go from way1 then...
do i need to define start_algorithm/1 as dynamic? check this error
% leuven.pl compiled 5.02 sec, 2,000,452 bytes
% graph.pl compiled 0.23 sec, 1,506,752 bytes
ERROR: find_path/1: Undefined procedure: start_algorithm/1
and how do i improve the code to retunr the total distance between the start...
that has worked,
but still, when i enter start node and end node, it gives continous result nodes.
how do i limit only to nodes in the same e.g way(80362707, [937819764, 937819761, 937819774, 937819762, 937819764]).
from leuven.pl is a way with list of nodes within it.
so that it does not...
hi, i have rerun the code above,
but error
% leuven.pl compiled 4.31 sec, 2,000,216 bytes
ERROR: process/1: Undefined procedure: edge/3
Exception: (6) start ?
is it missing something while checking if duplicates exist? on the \+edge above?
it is working but generates a lot of nodes continuously, i think there should be use cut, to give only the path from start node to end node through directly connected and in one way only. this is where it get complicated for me.
how do we avoid duplicates?
thanx
good, i have seen that.
i am trying to use this code, but seems something is wrong, it cant print the path after i enter start and end nodes:
path([B | Rest], B, [B | Rest], Length, Length).
path([A | Rest], B, Path, CurrentLength, Length) :-
edge(A, C, X),
\+member(C, [A | Rest])...
i used this, but i get error below-
get_path(X, Y, Path) :-
path([X], Y, Path, 0, Length),
reverse(Path, DirectPath),
printPath(DirectPath),
fail.
1 ?- start_algorithm.
Enter start node ID: 231994501.
Enter end node ID: 249394762.
ERROR: path/5: Undefined procedure: edge/3
2 ?-...
thanks for your quick reply,
for the getPath predicate, can this work?
get_path(A, B) :-
path([A], B, Path, 0, Length),
reverse(Path, DirectPath),
printPath(DirectPath),
nl,
fail.
i think i have enough information now to proceed, but will be coming back to ask few things...
thanx kahleen, i managed to create the file graph.pl
one more question,
i dont want to loose the names of places from leuven.pl,
how do i generate a new file like graph.pl but with edge as the way and contains names of lets call it destination?
last question, what is the code of accepting user...
This is what i intend to make the predicates do:
-Find the neighbouring nodes for any node
- look at the waylists and find those nodes next to it in the list.
-If a node is not on a waylist, then there is no way connected to this node, hence it is (in theory) unreachable.
-calculate distance...
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.