JTP API Documentation

jtp.context
Class IterativeDeepening

java.lang.Object
  |
  +--java.beans.beancontext.BeanContextChildSupport
        |
        +--jtp.util.PropertyImporter
              |
              +--jtp.context.IterativeDeepening
All Implemented Interfaces:
BeanContextChild, BeanContextServiceRevokedListener, BeanContextServicesListener, EventListener, Reasoner, Serializable

public class IterativeDeepening
extends PropertyImporter
implements Reasoner

An asking control reasoner that ensures that an iterative deepening search method is used to prove queries.

The maximum depth to which a search for a proof will be performed can be set with setMaxDepth(int). In an iterative deepening search approach, a bounded depth-first search is conducted at a depth of 1, then 2, then 3, and so on up to the maximum depth.

The query passed to process(java.lang.Object) is subsequently passed to the TheoremProver for processing. The Theorem Prover actually constructs a proof tree (but the depth of the proof tree is determined by the IterativeDeepning instance). It is the entry point to the Asking Control Dispatcher, and thus to all the general-purpose and domain-specific asking Reasoners in the system.

See Also:
Serialized Form

Field Summary
 
Fields inherited from class java.beans.beancontext.BeanContextChildSupport
beanContext, beanContextChildPeer, pcSupport, rejectedSetBCOnce, vcSupport
 
Constructor Summary
IterativeDeepening()
           
 
Method Summary
 boolean acceptable(Object o)
          All goals are acceptable to this reasoner.
 int getMaxDepth()
          Returns the maximum depth to which a search for a proof of a query will be performed.
 int getStartingDepth()
          Returns the depth of the initial bounded depth-first search for a proof to a query.
 Reasoner getTheoremProver()
          Returns the Theorem Prover.
 Tracer getTracer()
           
 boolean getTrimDeepSolutions()
          When true, proofs that have a proof tree with a depth greater than the depth of the current bounded depth-first search are discarded.
 boolean getTrimShallowSolutions()
          When true, proofs that have a proof tree with a depth less than the depth of the current bounded depth-first search are discarded.
 ReasoningStepIterator process(Object goal)
          This method attempts to find proof for the goal.
 void setMaxDepth(int v)
          Sets the maximum depth to which a search for a proof of a query will be performed.
 void setStartingDepth(int v)
          Sets the depth of the initial bounded depth-first search for a proof to a query.
 void setTheoremProver(Reasoner v)
          Sets the Theorem Prover which actually constructs proofs of queries and provides access to the AskingControlDispatcher and all of the child asking Reasoners of the system.
 void setTracer(Tracer v)
           
 void setTrimDeepSolutions(boolean v)
          Sets a flag determining whether or not to discard deep solutions.
 void setTrimShallowSolutions(boolean v)
          Sets a flag determining whether or not to discard shallow solutions.
 
Methods inherited from class jtp.util.PropertyImporter
getImportedProperties, initializeBeanContextResources, setImportedProperties
 
Methods inherited from class java.beans.beancontext.BeanContextChildSupport
addPropertyChangeListener, addVetoableChangeListener, firePropertyChange, fireVetoableChange, getBeanContext, getBeanContextChildPeer, isDelegated, releaseBeanContextResources, removePropertyChangeListener, removeVetoableChangeListener, serviceAvailable, serviceRevoked, setBeanContext, validatePendingSetBeanContext
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

IterativeDeepening

public IterativeDeepening()
Method Detail

getTracer

public Tracer getTracer()

setTracer

public void setTracer(Tracer v)

getTheoremProver

public Reasoner getTheoremProver()
Returns the Theorem Prover.

Returns:
Theorem Prover
See Also:
setTheoremProver(jtp.Reasoner)

setTheoremProver

public void setTheoremProver(Reasoner v)
Sets the Theorem Prover which actually constructs proofs of queries and provides access to the AskingControlDispatcher and all of the child asking Reasoners of the system. At this time, the argument must be an instance of ModelEliminationReasoner.

Parameters:
v - an asking Reasoner to be used as the Theorem Prover

getMaxDepth

public int getMaxDepth()
Returns the maximum depth to which a search for a proof of a query will be performed.

Returns:
maximum depth to which inferencing occurs

setMaxDepth

public void setMaxDepth(int v)
Sets the maximum depth to which a search for a proof of a query will be performed.

Parameters:
v - maximum depth to which inferencing occurs

getStartingDepth

public int getStartingDepth()
Returns the depth of the initial bounded depth-first search for a proof to a query. The default value is 1.

Returns:
initial depth of search

setStartingDepth

public void setStartingDepth(int v)
Sets the depth of the initial bounded depth-first search for a proof to a query. The default value is 1.

Parameters:
v - initial depth of search

getTrimShallowSolutions

public boolean getTrimShallowSolutions()
When true, proofs that have a proof tree with a depth less than the depth of the current bounded depth-first search are discarded. When false, they are returned.

Returns:
true if shallow solutions are discarded; false otherwise

setTrimShallowSolutions

public void setTrimShallowSolutions(boolean v)
Sets a flag determining whether or not to discard shallow solutions.

Parameters:
v - true if shallow solutions are to be discarded; false otherwise
See Also:
getTrimShallowSolutions()

getTrimDeepSolutions

public boolean getTrimDeepSolutions()
When true, proofs that have a proof tree with a depth greater than the depth of the current bounded depth-first search are discarded. When false, they are returned.

Returns:
true if deep solutions are discarded; false otherwise

setTrimDeepSolutions

public void setTrimDeepSolutions(boolean v)
Sets a flag determining whether or not to discard deep solutions.

Parameters:
v - true if deep solutions are to be discarded; false otherwise
See Also:
getTrimDeepSolutions()

process

public ReasoningStepIterator process(Object goal)
                              throws ReasoningException
Description copied from interface: Reasoner
This method attempts to find proof for the goal. It returns an enumeration of reasoning steps that correspond to alternative proofs for the goal. Consequently, the items of the enumeration can actually belong to different models of the goal sentence, and have incompatible variable assignments.

Example. A reasoner that performs unification of the goal with facts in a knowledge base can return the following enumeration for the goal (parent joe ?x):

  1. A reasoning step proving (parent joe fred) with variable assignment ?x=fred,
  2. A reasoning step proving (parent joe mary) with variable assignment ?x=mary.

Specified by:
process in interface Reasoner
Parameters:
goal - the goal: either a query or an assertion
Returns:
an iterator over completed proofs of the goal
ReasoningException

acceptable

public boolean acceptable(Object o)
All goals are acceptable to this reasoner.

Specified by:
acceptable in interface Reasoner
Returns:
true

JTP API Documentation