// such that H(r_i) = a for i = 1..n, hence we add them as two implications.
for (GroundLiteral l : ruleMap.keySet()) {
FuzzyExpression litExp = l.convertToFuzzyExpression();
FuzzyExpression bodyExp = ruleMap.get(l);
// Add the first implication of the equivalence
literalList.add(new FuzzyLiteral(1.0, 1.0, new FuzzyBinaryExpression(litExp, bodyExp, new IW())));
// The second implication of the equivalence
literalList.add(new FuzzyLiteral(1.0, 1.0, new FuzzyBinaryExpression(bodyExp, litExp, new IW())));
} // Finally add l = 0 for each non-naf literal occurring nowhere in a rule head.
// TODO: untested!
for (GroundLiteral l : getLiterals()) {
if (l.isNaf()) {
l = new GroundLiteral(l.getPredicate(), l.isNegated(), false, null);
}
if (!ruleMap.containsKey(l)) // We'll add IW(l,0) = 1, which is equivalent to l = 0 as IW(l,0) = 1-l
{
literalList.add(new FuzzyLiteral(1.0, 1.0, new FuzzyBinaryExpression(
l.convertToFuzzyExpression(), new FuzzyConstantExpression(0), new IW())));
}
}