blog
Class WorldInProgress

java.lang.Object
  extended by blog.AbstractPartialWorld
      extended by blog.DefaultPartialWorld
          extended by blog.WorldInProgress
All Implemented Interfaces:
PartialWorld, java.lang.Cloneable

public class WorldInProgress
extends DefaultPartialWorld

PartialWorld implementation that maintains a list of uninstantiated VarWithDistrib objects, and allows variables to be instantiated using a special method of an iterator over this list. This is useful for rejection sampling.

The list of uninstantiated basic variables only includes variables whose arguments necessarily exist in this partial world. Thus, as more number variables are instantiated and more objects necessarily exist, more variables will be added to the list. The list is not represented explicitly -- if integers or natural numbers serve as variable arguments, then the full list is infinite. Thus, the WorldInProgress class does not allow random access to the list. It only allows iteration, and additional variables are added lazily to the explicit list as needed.

The hypothetical "full" list is ordered in such a way that every one of its elements has a finite index. This is achieved by interleaving variables that have integer arguments with variables that have non-guaranteed arguments.


Nested Class Summary
 class WorldInProgress.UninstVarIterator
          Inner class for iterating over the list of uninstantiated variables.
 
Nested classes/interfaces inherited from interface blog.PartialWorld
PartialWorld.EmptyPartialWorld
 
Field Summary
 
Fields inherited from class blog.AbstractPartialWorld
assertedIdToPOPApp, basicVarToValue, bayesNet, commIdToPOPApp, derivedVarToValue, dirtyVars, idTypes, listeners, objToUsesAsArg, objToUsesAsValue, popAppToAssertedIds, popAppToCommIds, varToLogProb, varToUninstParent
 
Fields inherited from interface blog.PartialWorld
EMPTY_INST, UNDET
 
Constructor Summary
WorldInProgress(Model model, Evidence evidence, int intBound, int depthBound)
          Creates a new WorldInProgress with no instantiated random variables.
 
Method Summary
 boolean isComplete()
          Returns true if every basic random variable whose arguments necessarily exist in this world is instantiated.
 void setValue(VarWithDistrib var, java.lang.Object value)
           
 WorldInProgress.UninstVarIterator uninstVarIterator()
          Returns an iterator over the basic random variables whose arguments necessarily exist in this world, but which are not yet instantiated.
 
Methods inherited from class blog.DefaultPartialWorld
clone
 
Methods inherited from class blog.AbstractPartialWorld
addDerivedVar, addIdentifierForPOPApp, addListener, assertedIdToPOPAppMap, assertIdentifier, assertIdentifier, basicVarToValueMap, cloneFields, derivedVarToValueMap, getAssertedIdentifiers, getAssertedIdsForPOPApp, getBayesNet, getDerivedVars, getIdTypes, getInstantiatedVars, getInverseTuples, getLogProbOfValue, getPOPAppSatisfied, getProbOfValue, getSatisfiers, getValue, getVarsWithArg, getVarsWithValue, isOverloaded, objToUsesAsArgMap, objToUsesAsValueMap, popAppToAssertedIdsMap, print, removeDerivedVar, removeIdentifier, removeListener, setValue, toString, truncateList, truncateNumberList, updateBayesNet, updateParentsAndProbs, varToLogProbMap, varToUninstParentMap
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

WorldInProgress

public WorldInProgress(Model model,
                       Evidence evidence,
                       int intBound,
                       int depthBound)
Creates a new WorldInProgress with no instantiated random variables.

Parameters:
intBound - maximum absolute value of integers (or natural numbers) to allow as arguments of RVs that are included in the uninstantiated RV list. To allow unbounded integers, pass -1 for this parameter.
depthBound - maximum depth of non-guaranteed objects to allow as arguments of RVs that are included in the uninstantiated RVs list. Objects generated by the empty tuple have depth 0; other non-guaranteed objects have depth one greater than the maximum depth of their generating objects. To allow unbounded depths, pass -1 for this parameter.
Method Detail

setValue

public void setValue(VarWithDistrib var,
                     java.lang.Object value)

uninstVarIterator

public WorldInProgress.UninstVarIterator uninstVarIterator()
Returns an iterator over the basic random variables whose arguments necessarily exist in this world, but which are not yet instantiated.


isComplete

public boolean isComplete()
Returns true if every basic random variable whose arguments necessarily exist in this world is instantiated.