use of com.sri.ai.praise.core.inference.byinputrepresentation.interfacebased.core.exactbp.anytime.gabriel.aebptree.AEBPFactorTreeNode in project aic-praise by aic-sri-international.
the class AEBP method expand.
private void expand() {
// Get next factor (and it's children variables)
AEBPFactorTreeNode nextTreeNodeToAddToTheTree = getNextNodeToPutOnTheTree.next();
// Add new factor to model
model.ExpandModel(nextTreeNodeToAddToTheTree.getRoot());
// Add new factor to the tree
tree.addNodeToTheTree(nextTreeNodeToAddToTheTree, model.getMapFromNodeToPartition(), cleverTrueBruteForceFalse);
}
use of com.sri.ai.praise.core.inference.byinputrepresentation.interfacebased.core.exactbp.anytime.gabriel.aebptree.AEBPFactorTreeNode in project aic-praise by aic-sri-international.
the class BFS method next.
@Override
public AEBPFactorTreeNode next() {
if (!hasNext()) {
throw new NoSuchElementException();
}
AEBPFactorTreeNode next = queue.remove();
for (Variable variableNeighbour : model.getEntireGraph().getNeighbors(next.getRoot())) {
AEBPVariableTreeNode variableTreeNode;
if (fromNodeToPartition.get(variableNeighbour) == null) {
variableTreeNode = new AEBPVariableTreeNode(variableNeighbour, next, isExhausted);
next.addChild(variableTreeNode);
fromNodeToPartition.put(variableNeighbour, variableTreeNode);
} else {
variableTreeNode = (AEBPVariableTreeNode) fromNodeToPartition.get(variableNeighbour);
}
for (Factor factorNeighbour : model.getEntireGraph().getNeighbors(variableNeighbour)) {
if (!visited.contains(factorNeighbour)) {
AEBPFactorTreeNode factorTreeNode = new AEBPFactorTreeNode(factorNeighbour, variableTreeNode, isExhausted);
// variableTreeNode.addChild(factorTreeNode);
visited.add(factorNeighbour);
queue.add(factorTreeNode);
}
}
}
return next;
}
Aggregations