swipl(prolog编译器)Giver未定义的过程错误,但规则已定义

时间:2018-10-31 14:25:07

标签: prolog runtime-error dijkstra swi-prolog

我最近开始学习作业的序言。

该问题要求找到从A到B的时间优化路线。

我定义了如下的边缘和规则

bus(12,panbazar,chandmari,10,12.5,7,8).
bus(22,chandmari,paltanbazar,17.5,18,9,10).
bus(32,chandmari,paltanbazar,13,14.5,11,12).

#边缘定义

edge1(A, B, Departure, Arrival, Dist, Cost) :-
    bus(_, A, B, Departure, Arrival, Dist, Cost),
    Time is Arrival-Departure, Time > 0.

edge(A, B, Time, Dist, Cost) :-
    bus(_, A, B, Departure, Arrival, Dist, Cost),
    Time is Arrival-Departure, Time > 0.

此处的总线规则代表bus(BusId, From, To, Departure, Arrival, Distance, Cost)

以swipl edge(chandmari, Q, W, E, R)查询时。返回结果

,但在查询edge1(chandmari, Q,W,E,R,T)时。我收到以下错误。

ERROR: Undefined procedure: edge1/6
ERROR:     However, there are definitions for:
ERROR:         edge/5
false.

0 个答案:

没有答案