[英]how to separate the values in min() predicate prolog
I have a predicate like我有一个像
cheapest(X,Y,T):-
findall([Ci,Cj],trip_cost(X,Y,[Ci,Cj]),K),
aggregate_all(min(A,B),
member([B,A], K),
T).
It gives the result like它给出了这样的结果
min(8,[a,b,m])
I want to make it work with predicate like我想让它像谓词一样工作
cheapest(X,Y,T,C):-
findall([Ci,Cj],trip_cost(X,Y,[Ci,Cj]),K),
aggregate_all(min(A,B),
member([B,A], K),
T).
and want result like并希望结果像
T=[a,b,m]
C=8
cheapest(X,Y,T,C):-
cheapest(X,Y,min(C,T)).
I can't test it yet since there is no knowledgebase.我还不能测试它,因为没有知识库。
Or similar without the need of cheapest/3
:或类似而不需要
cheapest/3
:
cheapest(X,Y,T,C):-
findall([Ci,Cj],trip_cost(X,Y,[Ci,Cj]),K),
aggregate_all(min(A,B),
member([B,A], K),
TT),
TT = min(C,T).
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.