FuzzyLiteral flit = (FuzzyLiteral) l;
FuzzyExpression newExp = flit.getExpression().accept(dnegElim);
newLiterals.add(new FuzzyLiteral(flit.getLowerBound(),
flit.getUpperBound(), newExp));
}
newClauses.add(new FuzzyClause(newLiterals));
}
// overwrite the old clauses with the simplified ones ...
clauses = newClauses;
// DEBUG output for checking DoubleNegationEliminator
//System.out.println("After DoubleNegationEliminator");
//for (FuzzyClause c : clauses) {
// System.out.println(c);
//}
// optimization
//HashMap trivialAssignments = new HashMap();
HashMap trivialAssignments = new HashMap();
if (FiniteReductionConfig.optimizeClauses) {
boolean changed = true;
while (changed) {
// System.out.println("...");
DomainFinder.simplify(clauses);
changed = DomainFinder.eliminateTriviallySatisfiableClauses(clauses, trivialAssignments);
//System.out.println("Eliminated trivially satisfiable clause");
}
//System.out.println("Optimized the clauses");
}
for (FuzzyClause c : clauses) {
ficonv.addFuzzyClause(c);
}
//System.out.println("Solver running...");
//solution = solver.getModel();
//solution = solver.getModel(varOrders);
//System.out.println("Solver found a model");
TailorSolver solv = new TailorSolver("/home/jeroen/programming/tailorV0.3.2/tailor.jar",
"/home/jeroen/programming/minion-0.10/bin/minion");
solv.read(ficonv.convertToCSPProblem());
System.out.println("Ok, read file. Now solving ...");
CSPSolution cspSolution = solv.solve();
solution = ficonv.convertCSPSolutionToFuzzyModel(cspSolution);
System.out.println("Solving ended!");
if (solution != null) {
solution.putAll(trivialAssignments);
checkModel(clauses, solution);
printSolution(solution);
Map<GroundLiteral, Double> interp = new HashMap<GroundLiteral, Double>();
for (String s : solution.keySet()) {
GroundLiteral lit = parseLiteral(s);
interp.put(lit, solution.get(s));
}
i = new FaspInterpretation(interp);
if (prog.isAnswerSet(i)) {
anssetfound = true;
//System.out.println("Woot! Answer Set!");
} else {
//System.out.println("Model is not an answer set");
//printSolution(solution);
// Find a loop
//System.out.println("Searching loop");
List<Set<GroundLiteral>> loops = prog.findCycles(i);
for (Set<GroundLiteral> loop : loops) {
// For evaluation:
printLoop(loop);
// Compute loop formula
FuzzyClause loopForm = prog.computeLoopFormula2(loop);
// For evaluation:
//System.out.println("Loop formula: " + loopForm);
clauses = prog.createCompletion2();
clauses.add(loopForm);
for (FuzzyClause c : loopClauses) {