Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Search results for query: *

  1. misoijnr

    A* search refactor on finding the shortest routes in prolog

    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...
  2. misoijnr

    member predicate

    how should i avoid singleton variables from the above code, seems am getting that error
  3. misoijnr

    member predicate

    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...
  4. misoijnr

    member predicate

    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...
  5. misoijnr

    member predicate

    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...
  6. misoijnr

    member predicate

    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...
  7. misoijnr

    member predicate

    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...
  8. misoijnr

    member predicate

    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...
  9. misoijnr

    member predicate

    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?
  10. misoijnr

    member predicate

    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
  11. misoijnr

    member predicate

    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])...
  12. misoijnr

    member predicate

    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 ?-...
  13. misoijnr

    member predicate

    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...
  14. misoijnr

    member predicate

    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...
  15. misoijnr

    member predicate

    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...
  16. misoijnr

    member predicate

    kahleen, what did u make of the above re-written predicates? do u have a different version of writing it? thanks
  17. misoijnr

    member predicate

    thanks kahleen. enjoy your trip
  18. misoijnr

    member predicate

    hi kahleen,i have re-writen like below, any sugestion to optimise it? member(X,[X|Xs]). member(X,[_|Ys]) :- member(X,Ys). node(NodeID) :- member(NodeID, [lat,long]). node_tag(NodeID) :- member(NodeID,[X,Y]]). way(WayID) :- member(WayID, NodeID). way_tag(WayID):-member(WayID,[X1,Y1])...
  19. misoijnr

    member predicate

    i re-wrote the predicat to look like this, but somethng wrong somewhere member(X,[X|Xs]). member(X,[_|Ys]) :- member(X,Ys). node(NodeID) :- member(NodeID, [lat,long]). node_tag(NodeID) :- member(NodeID,[X,Y]]). way(WayID) :- member(WayID, Nodelist). way_tag(WayID):-member(WayID,[X1,Y1])...
  20. misoijnr

    member predicate

    hi kahleen, did u manage to check my problem? would appreciate your comment thanks

Part and Inventory Search

Back
Top