Reasoner
Class ConstraintPropagator

java.lang.Object
  |
  +--Reasoner.ConstraintPropagator

public class ConstraintPropagator
extends java.lang.Object

Performs the position and attitude reasoning over the constraints in a set of object inferences. It breaks the object inferences into disjoint partitions with no interaction and proceeds to solve them independently. Partitions are processed from most to least cardinality to solve the harder, most constraining constraints earlier. Backtracking enforces a systematic approach to dealing with paths that fail to solve all constraints.

The system-level selective non-interpenetration constraint is enforced to prevent the objects in solutions between otherwise independent partitions from occupying the same space.

Version:
Created 3 October 2003
Author:
Dan Tappan
See Also:
SimulationEngine

Nested Class Summary
private  class ConstraintPropagator.Adjacency
          Maintains an adjacency link from a source object inference to a target object inference with respect to a constraint node.
private  class ConstraintPropagator.Partition
          Maintains the contents of a partition of object inferences that reference each other and no object inferences in other partitions.
 
Field Summary
static java.lang.String ARGUMENT_SELF_PIPPER
           
static java.lang.String FIELD_ANYWHERE
           
static java.lang.String FIELD_INTERIOR
           
private  MonteCarloRunSet m_monte_carlo_run_set
           
private  java.util.ArrayList m_partitions
           
private  java.lang.String RELATION_IN
           
 
Constructor Summary
ConstraintPropagator(MonteCarloRunSet monte_carlo_run_set)
          Creates a new constraint propagator to find a solution set from a Monte Carlo run set.
 
Method Summary
private  void buildPartition(ConstraintPropagator.Adjacency adjacency, java.util.ArrayList adjacencies, ConstraintPropagator.Partition partition)
          Recursively builds a partition with all interconnected adjacencies.
private  void buildPartitions(MonteCarloRunSet monte_carlo_run_set)
          Partitions the object inferences into subsets that can be solved independently.
 boolean propagate(int max_partition_iterations, int max_partition_backtracks)
          Propagates the constraints in each partition.
private  void sortPartitions()
          Sorts the partitions from largest to smallest.
 java.lang.String toString()
          Returns a string representation of this class.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

FIELD_ANYWHERE

public static final java.lang.String FIELD_ANYWHERE
See Also:
Constant Field Values

FIELD_INTERIOR

public static final java.lang.String FIELD_INTERIOR
See Also:
Constant Field Values

ARGUMENT_SELF_PIPPER

public static final java.lang.String ARGUMENT_SELF_PIPPER
See Also:
Constant Field Values

RELATION_IN

private final java.lang.String RELATION_IN
See Also:
Constant Field Values

m_partitions

private java.util.ArrayList m_partitions

m_monte_carlo_run_set

private MonteCarloRunSet m_monte_carlo_run_set
Constructor Detail

ConstraintPropagator

public ConstraintPropagator(MonteCarloRunSet monte_carlo_run_set)
                     throws java.lang.Exception
Creates a new constraint propagator to find a solution set from a Monte Carlo run set.

Parameters:
monte_carlo_run_set - - the Monte Carlo run set containing the object-inference constraints to solve
Throws:
java.lang.Exception - - if propagation fails
Method Detail

buildPartition

private void buildPartition(ConstraintPropagator.Adjacency adjacency,
                            java.util.ArrayList adjacencies,
                            ConstraintPropagator.Partition partition)
Recursively builds a partition with all interconnected adjacencies.

Parameters:
adjacency - - the adjacency to follow
adjacencies - - the list of adjacencies followed from adjacency
partition - - the partition to add to
See Also:
buildPartitions(Reasoner.MonteCarloRunSet)

buildPartitions

private void buildPartitions(MonteCarloRunSet monte_carlo_run_set)
                      throws java.lang.Exception
Partitions the object inferences into subsets that can be solved independently.

Parameters:
monte_carlo_run_set - - the Monte Carlo run set containing the object-inference constraints to solve
Throws:
java.lang.Exception - - if an object inference referenced by another is not present in the run set

propagate

public boolean propagate(int max_partition_iterations,
                         int max_partition_backtracks)
                  throws java.lang.Exception
Propagates the constraints in each partition.

Returns:
whether propagation succeeded
Throws:
java.lang.Exception - - if propagation fails

sortPartitions

private void sortPartitions()
Sorts the partitions from largest to smallest. This sets the constraint-satisfaction sequence so the partitions that have more constraints, and are therefore more difficult to solve, are considered earlier. This also sorts the contents of each partition to group them.


toString

public java.lang.String toString()
Returns a string representation of this class.

Overrides:
toString in class java.lang.Object
Returns:
the String representation