|
|
pl:prolog:pllib:road-map_path-finding [2019/06/27 15:50] |
pl:prolog:pllib:road-map_path-finding [2019/06/27 15:50] (aktualna) |
| ====== Road-map path-finding ====== |
| {{tag>map problem_solving knowledge_base}} |
| ===== Description ===== |
| A road-map path-finding problem. |
| |
| **Source**: PROLOG programming for artificial intelligence, 3rd Edition, Harlow, 2001, ISBN 0-201-40375-7. |
| ===== Download ===== |
| Program source code: {{road-map_path-finding.pl}} |
| ===== Listing ===== |
| <code prolog> |
| % A road-map path-finding problem |
| |
| % The interesting probem is path from s to t |
| |
| s( X, Y, C) :- c( X, Y, C); c( Y, X, C). |
| |
| c( s, a, 2). c( a, b, 2). c( b, c, 2). c( c, d, 3). |
| |
| c( d, t, 3). c( t, g, 2). c( g, f, 2). c( f, e, 5). |
| |
| c( e, s, 2). |
| |
| goal(t). |
| |
| % heuristic estimates are the direct distances to t |
| |
| h( s, 7). h( a, 5). h( b, 4). h( c, 4). h( d, 3). |
| |
| h( e, 7). h( f, 4). h( g, 2). h( t, 0). |
| </code> |
| ===== Comments ===== |
| |