Package ai.libs.jaicore.logic.fol.util
Class ForwardChainer
- java.lang.Object
-
- ai.libs.jaicore.basic.algorithm.AAlgorithm<ForwardChainingProblem,java.util.Collection<java.util.Map<VariableParam,LiteralParam>>>
-
- ai.libs.jaicore.logic.fol.util.ForwardChainer
-
- All Implemented Interfaces:
ai.libs.jaicore.basic.algorithm.IAlgorithm<ForwardChainingProblem,java.util.Collection<java.util.Map<VariableParam,LiteralParam>>>,ai.libs.jaicore.basic.Cancelable,ai.libs.jaicore.basic.ILoggingCustomizable,java.lang.Iterable<ai.libs.jaicore.basic.algorithm.events.AlgorithmEvent>,java.util.concurrent.Callable<java.util.Collection<java.util.Map<VariableParam,LiteralParam>>>,java.util.Iterator<ai.libs.jaicore.basic.algorithm.events.AlgorithmEvent>
public class ForwardChainer extends ai.libs.jaicore.basic.algorithm.AAlgorithm<ForwardChainingProblem,java.util.Collection<java.util.Map<VariableParam,LiteralParam>>>
This algorithm answers the question for which groundings G of the variables in $premise, G[$premise] follows from $factbase. This method does NOT adopt the closed world assumption, i.e. !L in the premise can only be followed if L is provably wrong in the factbase.
-
-
Constructor Summary
Constructors Constructor Description ForwardChainer(ForwardChainingProblem problem)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.Collection<java.util.Map<VariableParam,LiteralParam>>call()booleandoesConclusionContainAGroundLiteralThatIsNotInFactBase(java.util.Collection<Literal> factbase, java.util.Collection<Literal> conclusion)booleandoesCWADeductionFail(java.util.Collection<Literal> factbase, java.util.Collection<Literal> conclusion)java.util.List<java.util.Map<VariableParam,LiteralParam>>getGroundingsUnderWhichALiteralAppearsInFactBase(java.util.Collection<Literal> factbase, Literal l, int maxSubstitutions)java.util.Collection<java.util.Map<VariableParam,LiteralParam>>getSubstitutionsThatEnableForwardChaining(java.util.Collection<Literal> factbase, java.util.Collection<Literal> conclusion)NextBindingFoundEventnextBinding()ai.libs.jaicore.basic.algorithm.events.AlgorithmEventnextWithException()booleanverifyThatGroundingEnablesConclusion(java.util.Collection<Literal> factbase, java.util.Collection<Literal> conclusion, java.util.Map<VariableParam,LiteralParam> grounding)-
Methods inherited from class ai.libs.jaicore.basic.algorithm.AAlgorithm
activate, announceTimeoutDetected, avoidReinterruptionOnShutdownOnCurrentThread, cancel, checkAndConductTermination, checkTermination, computeTimeoutAware, getActivationTime, getConfig, getId, getInput, getLoggerName, getNumCPUs, getRemainingTimeToDeadline, getState, getTimeout, getTimeoutPrecautionOffset, hasNext, hasThreadBeenInterruptedDuringShutdown, interruptThreadAsPartOfShutdown, isCanceled, isShutdownInitialized, isStopCriterionSatisfied, isTimeouted, iterator, next, post, registerActiveThread, registerListener, resolveShutdownInterruptOnCurrentThread, setConfig, setLoggerName, setMaxNumThreads, setNumCPUs, setState, setTimeout, setTimeout, setTimeoutPrecautionOffset, shutdown, terminate, unregisterActiveThread, unregisterThreadAndShutdown
-
-
-
-
Constructor Detail
-
ForwardChainer
public ForwardChainer(ForwardChainingProblem problem)
-
-
Method Detail
-
nextWithException
public ai.libs.jaicore.basic.algorithm.events.AlgorithmEvent nextWithException() throws java.lang.InterruptedException, ai.libs.jaicore.basic.algorithm.AlgorithmExecutionCanceledException, ai.libs.jaicore.basic.algorithm.exceptions.AlgorithmTimeoutedException- Throws:
java.lang.InterruptedExceptionai.libs.jaicore.basic.algorithm.AlgorithmExecutionCanceledExceptionai.libs.jaicore.basic.algorithm.exceptions.AlgorithmTimeoutedException
-
call
public java.util.Collection<java.util.Map<VariableParam,LiteralParam>> call() throws java.lang.InterruptedException, ai.libs.jaicore.basic.algorithm.AlgorithmExecutionCanceledException, ai.libs.jaicore.basic.algorithm.exceptions.AlgorithmTimeoutedException
- Throws:
java.lang.InterruptedExceptionai.libs.jaicore.basic.algorithm.AlgorithmExecutionCanceledExceptionai.libs.jaicore.basic.algorithm.exceptions.AlgorithmTimeoutedException
-
nextBinding
public NextBindingFoundEvent nextBinding() throws java.lang.InterruptedException, ai.libs.jaicore.basic.algorithm.AlgorithmExecutionCanceledException, ai.libs.jaicore.basic.algorithm.exceptions.AlgorithmTimeoutedException
- Throws:
java.lang.InterruptedExceptionai.libs.jaicore.basic.algorithm.AlgorithmExecutionCanceledExceptionai.libs.jaicore.basic.algorithm.exceptions.AlgorithmTimeoutedException
-
getSubstitutionsThatEnableForwardChaining
public java.util.Collection<java.util.Map<VariableParam,LiteralParam>> getSubstitutionsThatEnableForwardChaining(java.util.Collection<Literal> factbase, java.util.Collection<Literal> conclusion)
-
doesConclusionContainAGroundLiteralThatIsNotInFactBase
public boolean doesConclusionContainAGroundLiteralThatIsNotInFactBase(java.util.Collection<Literal> factbase, java.util.Collection<Literal> conclusion)
-
doesCWADeductionFail
public boolean doesCWADeductionFail(java.util.Collection<Literal> factbase, java.util.Collection<Literal> conclusion)
- Parameters:
factbase-conclusion-- Returns:
- true iff the conclusion contains a positive ground literal that is NOT in the factbase or a negative ground literal that positively occurs in the factbase
-
getGroundingsUnderWhichALiteralAppearsInFactBase
public java.util.List<java.util.Map<VariableParam,LiteralParam>> getGroundingsUnderWhichALiteralAppearsInFactBase(java.util.Collection<Literal> factbase, Literal l, int maxSubstitutions)
-
verifyThatGroundingEnablesConclusion
public boolean verifyThatGroundingEnablesConclusion(java.util.Collection<Literal> factbase, java.util.Collection<Literal> conclusion, java.util.Map<VariableParam,LiteralParam> grounding)
-
-