Class 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.
    • 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.InterruptedException
        ai.libs.jaicore.basic.algorithm.AlgorithmExecutionCanceledException
        ai.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.InterruptedException
        ai.libs.jaicore.basic.algorithm.AlgorithmExecutionCanceledException
        ai.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.InterruptedException
        ai.libs.jaicore.basic.algorithm.AlgorithmExecutionCanceledException
        ai.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)