aima.core.logic.fol.inference.InferenceResultPrinter Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of aima-core Show documentation
Show all versions of aima-core Show documentation
AIMA-Java Core Algorithms from the book Artificial Intelligence a Modern Approach 3rd Ed.
The newest version!
package aima.core.logic.fol.inference;
import aima.core.logic.fol.inference.proof.Proof;
import aima.core.logic.fol.inference.proof.ProofPrinter;
/**
* @author Ciaran O'Reilly
*
*/
public class InferenceResultPrinter {
/**
* Utility method for outputting InferenceResults in a formatted textual
* representation.
*
* @param ir
* an InferenceResult
* @return a String representation of the InferenceResult.
*/
public static String printInferenceResult(InferenceResult ir) {
StringBuilder sb = new StringBuilder();
sb.append("InferenceResult.isTrue=" + ir.isTrue());
sb.append("\n");
sb.append("InferenceResult.isPossiblyFalse=" + ir.isPossiblyFalse());
sb.append("\n");
sb.append("InferenceResult.isUnknownDueToTimeout="
+ ir.isUnknownDueToTimeout());
sb.append("\n");
sb.append("InferenceResult.isPartialResultDueToTimeout="
+ ir.isPartialResultDueToTimeout());
sb.append("\n");
sb.append("InferenceResult.#Proofs=" + ir.getProofs().size());
sb.append("\n");
int proofNo = 0;
for (Proof p : ir.getProofs()) {
proofNo++;
sb.append("InferenceResult.Proof#" + proofNo + "=\n"
+ ProofPrinter.printProof(p));
}
return sb.toString();
}
}