我最近开始学习作业的序言。
该问题要求找到从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.