prolog - Check if any solution exists -
i have code in form
plan([],_). plan([ item | remainingitems ], groups) :- dostuff(groups, item, updatedgroups), rulesobeyed(updatedgroups), plan(remainingitems, updatedgroups).
dostuff have 1 possible sub tree, rulesobeyed can have endless based on number of groups rules can obeyed in several ways. results in plan returns same solutions on , over.
is there way like
solution_exists(rulesobeyed(updatedgroups))
so not take possible solutions rulesobeyed account?
the solution use once/1
- or \+ \+
false posted.
Comments
Post a Comment