AI-Logic-AnswerSet
view release on metacpan or search on metacpan
lib/AI/Logic/AnswerSet.pm view on Meta::CPAN
my @predicates = ("node,"edge");
my @numbers = (4,15);
my @operators = (">","<");
my @stats = AI::Logic::AnswerSet::statistics(\@res,\@predicates,\@numbers,\@operators);
Now the functions returns the answer sets that satisfy the condition, i.e., an answer set
is returned only if the number of occurrences of the predicate "node" is higher than 4, and the number of occurrences of the predicate "edge" less than 15.
=head3 getFacts
Get the logic program facts from a file or a string.
my @facts = AI::Logic::AnswerSet::getFacts($inputFile);
or
my $code = "a(X):-b(X). b(1). b(2).";
my @facts = AI::Logic::AnswerSet::getFacts($code);
DLV code can be freely exploited, with the only constraint of putting a space between rules
or facts.
( run in 0.976 second using v1.01-cache-2.11-cpan-49f99fa48dc )