1

誰かがこれが何をしているのか説明してもらえますか?

(\+ setof((P1,C),P^R^Bag,PS) -> ...
otherwise ->...

setof; のドキュメントを読みました。私の理解では、3 番目の引数は事実と統一されます。

ただし、上記のコード スニペットの意味がわかりません。

完全なスニペットは次のとおりです。


solve_task_bt(go(Target),Agenda,ClosedSet,F,G,NewPos,RR,BackPath) :-
  Agenda = [Current|Rest],
  Current = [c(F,G,P)|RPath],
  NewAgenda = Rest,
  Bag = search(P,P1,R,C),
  (\+ setof((P1,C),P^R^Bag,PS) -> solve_task_bt(go(Target),Rest,[Current|ClosedSet],F,G,NewPos,RR,BackPath);
    otherwise -> 
    setof((P1,C),P^R^Bag,PS),
    addChildren(PS,RPath,Current,NewAgenda,Target,Result),
    NewClosedSet = [Current|ClosedSet],
    NewestAgenda = Result,
    solve_task_bt(go(Target),NewestAgenda,NewClosedSet,F1,G1,Pos,P|RPath,BackPath)
    ).  % backtrack search

4

1 に答える 1