|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
ObjectBeliefNetworkImpl
public class BeliefNetworkImpl
Encapsulates information necessary to specify a belief network. A belief network consists of a Directed graph whose nodes are the Variables defining the structure of the network, and a mapping from Variable to Table representing the CPT of that variable.
Nested Class Summary |
---|
Nested classes/interfaces inherited from interface BeliefNetwork |
---|
BeliefNetwork.Auditor |
Field Summary | |
---|---|
static boolean |
FLAG_DEBUG
|
UserObject |
userobject
|
UserObject |
userobject2
|
Constructor Summary | |
---|---|
BeliefNetworkImpl()
|
|
BeliefNetworkImpl(BeliefNetworkImpl toCopy)
|
|
BeliefNetworkImpl(boolean construct)
Creates an empty network. |
|
BeliefNetworkImpl(DirectedGraph structure)
|
|
BeliefNetworkImpl(DirectedGraph structure,
Map tables)
Creates a belief network. |
|
BeliefNetworkImpl(Map mapVariablesToPotentials)
Creates a BeliefNetwork by inducing the graph structure from a mapping from the Variable to its CPT. |
Method Summary | |
---|---|
boolean |
add(Object obj)
|
boolean |
addAll(Collection p)
|
boolean |
addAuditor(BeliefNetwork.Auditor auditor)
|
boolean |
addEdge(Object vertex1,
Object vertex2)
Adds the directed edge to the graph(Optional operation). |
boolean |
addEdge(Variable from,
Variable to,
boolean expandCPT)
Adds an edge to the belief network. |
boolean |
addVariable(Variable newNode,
boolean createCPT)
Adds a new node to the graph, with no parents. |
boolean |
addVertex(Object vertex)
Adds vertex to the graph(Optional operation). |
boolean |
checkValidProbabilities()
|
void |
clear()
|
Object |
clone()
As of 061002, this method simply calls deepClone(). |
void |
cloneAllCPTShells()
|
boolean |
contains(Object vertex)
Returns whether or not a particular Object is a vertex in the graph. |
boolean |
containsAll(Collection p)
|
boolean |
containsEdge(Object vertex1,
Object vertex2)
Returns whether or not a particular edge is in the graph. |
int |
countUserEnumProperties()
|
BeliefNetwork |
deepClone()
Call this method to perform a deep clone on a BeliefNetworkImpl (i.e., will clone the structure, Tables and all Variable objects. |
int |
degree(Object vertex)
Returns the degree of the vertex. |
boolean |
equals(Object p)
|
Collection |
findVariables(EnumProperty property,
EnumValue value)
|
BeliefNetwork |
fireAudit(Variable from,
Variable to,
Collection targets,
BeliefNetwork.Auditor.Deed deed)
|
boolean |
forAll(EnumProperty property,
EnumValue value)
|
Variable |
forID(String id)
Returns the variable with the id supplied |
boolean |
getAutoCPTInvalidation()
|
Copier |
getCopier()
|
EvidenceController |
getEvidenceController()
|
int |
getMaxDomainCardinality()
|
int |
getMaxTheoreticalCPTSize()
|
int |
getMinDomainCardinality()
|
int |
getMinTheoreticalCPTSize()
|
Map |
getProperties()
|
int |
getTheoreticalCPTSize(FiniteVariable fVar)
|
Collection |
getUserEnumProperties()
|
UserObject |
getUserObject()
|
UserObject |
getUserObject2()
|
int |
hashCode()
|
boolean |
hasPath(Object vertex1,
Object vertex2)
Determines if there is a directed path from vertex1 to vertex2. |
void |
identifierChanged(String oldID,
Variable var)
|
Set |
inComing(Object vertex)
Constructs an Iterator over the vertices adjacent to edges entering the specified vertex. |
int |
inDegree(Object vertex)
Returns the number of edges entering the vertex. |
void |
induceGraph(Map mapVariablesToCPTShells)
|
void |
induceGraph(Map mapVariablesToCPTShells,
NodeLinearTask task)
|
boolean |
insertState(FiniteVariable var,
int index,
Object instance)
|
boolean |
isAcyclic()
Determines whether or not the graph is acyclic. |
boolean |
isEmpty()
|
boolean |
isSinglyConnected()
Determines whether or not the graph is a singly connected. |
boolean |
isWeaklyConnected()
Determines whether or not the graph is weakly connected. |
boolean |
isWeaklyConnected(Object vertex1,
Object vertex2)
Determines if there is an undirected path from vertex1 to vertex2. |
Iterator |
iterator()
|
boolean |
maintainsAcyclicity(Object vertex1,
Object vertex2)
Check whether adding the proposed edge would keep the graph acyclic. |
void |
makeUserEnumProperties(Map inputParams)
|
boolean |
mayContain(Object obj)
|
static Map |
minimalProperties(Map properties)
|
FiniteVariable |
newFiniteVariable(Map properties)
|
int |
numEdges()
|
int |
outDegree(Object vertex)
Returns the number of edges leaving the vertex. |
Set |
outGoing(Object vertex)
Constructs an Iterator over the vertices adjacent to edges leaving the specified vertex. |
EnumProperty[] |
propertiesAsArray()
|
static void |
putAll(Map from,
Map to)
|
boolean |
remove(Object obj)
|
boolean |
removeAll(Collection p)
|
boolean |
removeAuditor(BeliefNetwork.Auditor auditor)
|
boolean |
removeEdge(Object vertex1,
Object vertex2)
Removes the directed edge from the graph(Optional operation). |
boolean |
removeEdge(Variable from,
Variable to)
Removes an edge from the network. |
boolean |
removeEdge(Variable from,
Variable to,
boolean forget)
Removes an edge from the network. |
boolean |
removeEdgeNoCPTChanges(Variable from,
Variable to)
Removes an edge from the network. |
Object |
removeState(FiniteVariable var,
int index)
|
boolean |
removeVariable(Variable var)
Removes a variable from the network. |
boolean |
removeVertex(Object vertex)
Removes vertex from the graph(Optional operation). |
void |
replaceAllPotentials(Map mapVariablesToPotentials)
|
void |
replaceVariables(Map variablesOldToNew)
|
void |
replaceVariables(Map variablesOldToNew,
NodeLinearTask task)
|
void |
replaceVertex(Object oldVertex,
Object newVertex)
|
void |
replaceVertices(Map verticesOldToNew,
NodeLinearTask task)
|
boolean |
retainAll(Collection p1)
|
BeliefNetwork |
seededClone(Map variablesOldToNew)
Call this method to clone a BeliefNetworkImpl when for whatever reason you have already cloned all the Variables it contains, and you have a mapping from the Variables it contains to Variables that you would like the cloned BeliefNetworkImpl to contain. |
void |
setAutoCPTInvalidation(boolean flag)
|
void |
setEvidenceController(EvidenceController EC)
|
void |
setScalars(double scalar)
|
void |
setUserEnumProperties(Collection userProperties)
|
void |
setUserEnumPropertiesModified(boolean flag)
|
void |
setUserObject(UserObject obj)
|
void |
setUserObject2(UserObject obj)
|
BeliefNetwork |
shallowClone()
|
int |
size()
Returns the number of vertices in the graph. |
Collection |
tables()
|
boolean |
thereExists(EnumProperty property,
EnumValue value)
|
boolean |
thereExistsModifiedUserEnumProperty()
|
Object[] |
toArray()
|
Object[] |
toArray(Object[] p)
|
List |
topologicalOrder()
|
String |
toString()
|
Set |
vertices()
Constructs an Iterator over all vertices. |
void |
writeToVCGFile(File file)
|
Methods inherited from class Object |
---|
getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static boolean FLAG_DEBUG
public UserObject userobject
public UserObject userobject2
Constructor Detail |
---|
public BeliefNetworkImpl(boolean construct)
public BeliefNetworkImpl(BeliefNetworkImpl toCopy)
public BeliefNetworkImpl()
public BeliefNetworkImpl(Map mapVariablesToPotentials)
public BeliefNetworkImpl(DirectedGraph structure, Map tables)
structure
- A directed graph specifying the structure of the
network.tables
- - A mapping from the Variable to its CPT.public BeliefNetworkImpl(DirectedGraph structure)
Method Detail |
---|
public FiniteVariable newFiniteVariable(Map properties)
newFiniteVariable
in interface BeliefNetwork
public static Map minimalProperties(Map properties)
public UserObject getUserObject()
public void setUserObject(UserObject obj)
public UserObject getUserObject2()
public void setUserObject2(UserObject obj)
public Map getProperties()
getProperties
in interface PropertySuperintendent
public static void putAll(Map from, Map to)
public boolean forAll(EnumProperty property, EnumValue value)
forAll
in interface BeliefNetwork
public boolean thereExists(EnumProperty property, EnumValue value)
thereExists
in interface BeliefNetwork
public Collection findVariables(EnumProperty property, EnumValue value)
findVariables
in interface BeliefNetwork
public void setAutoCPTInvalidation(boolean flag)
setAutoCPTInvalidation
in interface BeliefNetwork
public boolean getAutoCPTInvalidation()
getAutoCPTInvalidation
in interface BeliefNetwork
public int countUserEnumProperties()
countUserEnumProperties
in interface BeliefNetwork
public EnumProperty[] propertiesAsArray()
propertiesAsArray
in interface BeliefNetwork
public void setUserEnumProperties(Collection userProperties)
setUserEnumProperties
in interface BeliefNetwork
public Collection getUserEnumProperties()
getUserEnumProperties
in interface BeliefNetwork
public boolean thereExistsModifiedUserEnumProperty()
thereExistsModifiedUserEnumProperty
in interface BeliefNetwork
public void setUserEnumPropertiesModified(boolean flag)
setUserEnumPropertiesModified
in interface BeliefNetwork
public void makeUserEnumProperties(Map inputParams)
makeUserEnumProperties
in interface BeliefNetwork
public final boolean add(Object obj)
add
in interface Collection
public final boolean remove(Object obj)
remove
in interface Collection
public boolean retainAll(Collection p1)
retainAll
in interface Collection
public Object[] toArray(Object[] p)
toArray
in interface Collection
public Object[] toArray()
toArray
in interface Collection
public boolean removeAll(Collection p)
removeAll
in interface Collection
public void clear()
clear
in interface Collection
public int hashCode()
hashCode
in interface Collection
hashCode
in class Object
public boolean addAll(Collection p)
addAll
in interface Collection
public boolean containsAll(Collection p)
containsAll
in interface Collection
public boolean equals(Object p)
equals
in interface Collection
equals
in class Object
public Iterator iterator()
iterator
in interface Iterable
iterator
in interface Collection
public boolean isEmpty()
isEmpty
in interface Collection
public List topologicalOrder()
topologicalOrder
in interface DirectedGraph
public void replaceVertex(Object oldVertex, Object newVertex)
replaceVertex
in interface DirectedGraph
public void replaceVertices(Map verticesOldToNew, NodeLinearTask task)
replaceVertices
in interface DirectedGraph
public boolean maintainsAcyclicity(Object vertex1, Object vertex2)
DirectedGraph
Check whether adding the proposed edge would keep the graph acyclic.
Precondition: the graph is acyclic.
maintainsAcyclicity
in interface DirectedGraph
public Set vertices()
DirectedGraph
vertices
in interface DirectedGraph
public Set inComing(Object vertex)
DirectedGraph
inComing
in interface DirectedGraph
public Set outGoing(Object vertex)
DirectedGraph
outGoing
in interface DirectedGraph
public int degree(Object vertex)
DirectedGraph
degree
in interface DirectedGraph
public int inDegree(Object vertex)
DirectedGraph
inDegree
in interface DirectedGraph
public int outDegree(Object vertex)
DirectedGraph
outDegree
in interface DirectedGraph
public boolean containsEdge(Object vertex1, Object vertex2)
DirectedGraph
containsEdge
in interface DirectedGraph
public boolean contains(Object vertex)
DirectedGraph
contains
in interface DirectedGraph
contains
in interface Collection
public int size()
DirectedGraph
size
in interface DirectedGraph
size
in interface Collection
public int numEdges()
numEdges
in interface DirectedGraph
public boolean isAcyclic()
DirectedGraph
isAcyclic
in interface DirectedGraph
public boolean isWeaklyConnected()
DirectedGraph
isWeaklyConnected
in interface DirectedGraph
public boolean isWeaklyConnected(Object vertex1, Object vertex2)
DirectedGraph
isWeaklyConnected
in interface DirectedGraph
public boolean hasPath(Object vertex1, Object vertex2)
DirectedGraph
hasPath
in interface DirectedGraph
public boolean isSinglyConnected()
DirectedGraph
isSinglyConnected
in interface DirectedGraph
public boolean addVertex(Object vertex)
DirectedGraph
addVertex
in interface DirectedGraph
public boolean removeVertex(Object vertex)
DirectedGraph
removeVertex
in interface DirectedGraph
public boolean addEdge(Object vertex1, Object vertex2)
DirectedGraph
addEdge
in interface DirectedGraph
public boolean removeEdge(Object vertex1, Object vertex2)
DirectedGraph
removeEdge
in interface DirectedGraph
public boolean mayContain(Object obj)
mayContain
in interface BeliefNetwork
public void setScalars(double scalar)
setScalars
in interface BeliefNetwork
public void identifierChanged(String oldID, Variable var)
identifierChanged
in interface BeliefNetwork
public EvidenceController getEvidenceController()
getEvidenceController
in interface BeliefNetwork
public void setEvidenceController(EvidenceController EC)
setEvidenceController
in interface BeliefNetwork
public void replaceAllPotentials(Map mapVariablesToPotentials)
replaceAllPotentials
in interface BeliefNetwork
public void cloneAllCPTShells()
cloneAllCPTShells
in interface BeliefNetwork
public boolean insertState(FiniteVariable var, int index, Object instance)
insertState
in interface BeliefNetwork
public Object removeState(FiniteVariable var, int index)
removeState
in interface BeliefNetwork
public String toString()
toString
in class Object
public Copier getCopier()
getCopier
in interface BeliefNetwork
public final Object clone()
clone
in interface BeliefNetwork
clone
in interface DirectedGraph
clone
in class Object
public final BeliefNetwork deepClone()
deepClone
in interface BeliefNetwork
public BeliefNetwork seededClone(Map variablesOldToNew)
Call this method to clone a BeliefNetworkImpl when for whatever reason you have already cloned all the Variables it contains, and you have a mapping from the Variables it contains to Variables that you would like the cloned BeliefNetworkImpl to contain.
NOTE: If the BeliefNetworkImpl points to a HuginNet "userobject", this method will clone that HuginNet also. You are not resposible for cloning the HuginNet yourself if you call this method.
seededClone
in interface BeliefNetwork
variablesOldToNew
- A mapping from variables this BeliefNetworkImpl contains
to the new ones you would like the cloned BeliefNetworkImpl to contain.public void replaceVariables(Map variablesOldToNew)
public void replaceVariables(Map variablesOldToNew, NodeLinearTask task)
replaceVariables
in interface BeliefNetwork
public BeliefNetwork shallowClone()
shallowClone
in interface BeliefNetwork
public boolean addAuditor(BeliefNetwork.Auditor auditor)
addAuditor
in interface BeliefNetwork
public boolean removeAuditor(BeliefNetwork.Auditor auditor)
removeAuditor
in interface BeliefNetwork
public BeliefNetwork fireAudit(Variable from, Variable to, Collection targets, BeliefNetwork.Auditor.Deed deed)
fireAudit
in interface BeliefNetwork
public boolean addEdge(Variable from, Variable to, boolean expandCPT)
addEdge
in interface BeliefNetwork
public boolean removeEdge(Variable from, Variable to)
public boolean removeEdge(Variable from, Variable to, boolean forget)
BeliefNetwork
removeEdge
in interface BeliefNetwork
public boolean removeEdgeNoCPTChanges(Variable from, Variable to)
public boolean addVariable(Variable newNode, boolean createCPT)
addVariable
in interface BeliefNetwork
public int getMaxTheoreticalCPTSize()
getMaxTheoreticalCPTSize
in interface BeliefNetwork
public int getMinTheoreticalCPTSize()
getMinTheoreticalCPTSize
in interface BeliefNetwork
public int getTheoreticalCPTSize(FiniteVariable fVar)
getTheoreticalCPTSize
in interface BeliefNetwork
public int getMaxDomainCardinality()
getMaxDomainCardinality
in interface BeliefNetwork
public int getMinDomainCardinality()
getMinDomainCardinality
in interface BeliefNetwork
public boolean removeVariable(Variable var)
removeVariable
in interface BeliefNetwork
public void induceGraph(Map mapVariablesToCPTShells)
induceGraph
in interface BeliefNetwork
public void induceGraph(Map mapVariablesToCPTShells, NodeLinearTask task)
public boolean checkValidProbabilities()
checkValidProbabilities
in interface BeliefNetwork
public Collection tables()
tables
in interface BeliefNetwork
public Variable forID(String id)
forID
in interface BeliefNetwork
public void writeToVCGFile(File file) throws IOException
IOException
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |