I'm confused about the inner workings of ASP. Say I'm modelling a country's. For example, say we have
city(london).
city(manchester).
city(leeds).
city(newcastle).
city(sheffield).
road(a1).
road(b1).
connects(a1, london,sheffield).
connects(b1, sheffield, newcastle).
closed(b1).
etc. What I'm wondering is the following. Say I want to work out whether there is a route between two cities. So, I define a predicate like this:
is_road(A, B) :- connects(R, A, B),
-closed(R).
road(A,B) :- is_road(A,B).
road(A,C) :- is_road(A,B),
road(B,C).
Then does ASP work out all the routes or does it just work out there is a route between two cities and stop there? This has become important for me because I'm trying to define a predicate for a slow road, and how I do this depends on whether ASP has access to all the possible routes or not. My intuition tells me that it should because ASP works by grounding and solving (so surely all the correct variable instantiations should show up, but the algorithm ASP uses to compute answer sets is somewhat mysterious.
To clarify Say there's a road from London to Sheffield and Sheffield to Newcastle. Then there is a route from London to Newcastle by using those two roads. But another route would be going back to London then going back to Newcastle, or if there also a road from Sheffield to Leeds and Leeds to Newcastle, then a third route would be to go to Sheffield then go to Newcastle via Leeds.
Thank you for any help.