我无法理解如何做某事
想象一下,我有 3 头驴,每头驴都有最喜欢的布,并在它最喜欢的游乐场玩耍。
如果我给这些驴子限制哪个操场可能是它最喜欢的操场,例如操场 A、B 或 C,或者甚至通过诸如 Donkey humphey 最喜欢的布绝对不是T 恤我该怎么做。
IE 到目前为止我的想法是
cloth(tshirt).
cloth(socks).
cloth(hat).
playground(a).
playground(b).
playground(c).
donkey(alphred).
donkey(pumba).
donkey(sylvester).
%Would mapping be something like this?
donkeys(Donkey, Playground, Clothing) v donkeys(Donkey, Playground, Clothing) donkeys(Donkey, Playground, Clothing) :- donkey(Donkey), playground(Playground), cloth(Clothing).
%how would i add constraints based off this, such as alphreds favorite cloth is a tshirt but he hates playground b?
cloth(tshirt) :- donkey(alphred).
~playground(b) :- donkey(alphred).
%how do i also make sure no two donkeys have the same cloth and playground in the answer set?
我使用 dlv 作为我的答案集求解器