// denotes the body of rule r and /\_r is the t-norm associated
// with r
ArrayList<FuzzyExpression> args = new ArrayList<FuzzyExpression>();
args.add(r.convertBodyExpression());
args.add(r.convertToFuzzyExpression());
FuzzyExpression ruleBodyCompletion = new FuzzyMultiExpression(args, r.getRuleTNorm());
if (ruleMap.containsKey(l)) {
// Add the body completion of the new rule to the body completion of the other rules
// with this literal in the head using the minimum
ruleMap.put(l, new FuzzyBinaryExpression(ruleMap.get(l), ruleBodyCompletion, new TM()));
} else {
// Add the body completion
ruleMap.put(l, ruleBodyCompletion);
}
}
}
// Now create the fuzzy literals corresponding to each fasp literal:
// These are of the form a = (B(r_1) /\_{r_1} r_1) /\_m ... /\_m (B(r_n) /\_{r_n} r_n)
// 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())));