public boolean containsAll (Collection collection) { return subVarSet.containsAll (collection); }
public boolean containsAll (Collection collection) { return subVarSet.containsAll (collection); }
public boolean containsAll (Collection collection) { return subVarSet.containsAll (collection); }
private boolean findSuperClique(List l, VarSet c) { for (Iterator it = l.iterator(); it.hasNext();) { VarSet c2 = (VarSet) it.next(); if (c2.containsAll(c)) { return true; } } return false; }
private boolean findSuperClique(List l, VarSet c) { for (Iterator it = l.iterator(); it.hasNext();) { VarSet c2 = (VarSet) it.next(); if (c2.containsAll(c)) { return true; } } return false; }
private boolean findSuperClique(List l, VarSet c) { for (Iterator it = l.iterator(); it.hasNext();) { VarSet c2 = (VarSet) it.next(); if (c2.containsAll(c)) { return true; } } return false; }
/** Returns a cluster in the tree that contains exactly the given * variables, or null if no such cluster exists. */ public VarSet findCluster(Variable[] vars) { List l = Arrays.asList(vars); for (Iterator it = getVerticesIterator(); it.hasNext();) { VarSet c2 = (VarSet) it.next(); if (c2.containsAll(l) && l.containsAll(c2)) return c2; } return null; }
/** Returns a cluster in the tree that contains exactly the given * variables, or null if no such cluster exists. */ public VarSet findCluster(Variable[] vars) { List l = Arrays.asList(vars); for (Iterator it = getVerticesIterator(); it.hasNext();) { VarSet c2 = (VarSet) it.next(); if (c2.containsAll(l) && l.containsAll(c2)) return c2; } return null; }
/** Returns a cluster in the tree that contains exactly the given * variables, or null if no such cluster exists. */ public VarSet findCluster(Variable[] vars) { List l = Arrays.asList(vars); for (Iterator it = getVerticesIterator(); it.hasNext();) { VarSet c2 = (VarSet) it.next(); if (c2.containsAll(l) && l.containsAll(c2)) return c2; } return null; }
/** Returns a list of all factors in the graph whose domain is exactly the specified Collection of Variables. */ public List allFactorsOf (Collection c) { // Rather than iterating over all factors, just iterate over ones that we know contain c.get(0) // (could possibly make more efficient by picking the var with smallest degree). Variable v0 = (Variable) c.iterator ().next (); List factors = factorsByVar[getIndex (v0)]; List ret = new ArrayList (); for (Iterator it = factors.iterator(); it.hasNext();) { Factor f = (Factor) it.next (); VarSet varSet = f.varSet (); if (varSet.size() == c.size ()) { if (c.containsAll (varSet) && varSet.containsAll (c)) { ret.add (f); } } } return ret; }
/** * Returns the marginal of this distribution over the given variables. */ public Factor marginalize (Variable vars[]) { assert varSet ().containsAll (Arrays.asList (vars)); // Perhaps throw exception instead return marginalizeInternal (createBlankSubset (vars)); }
public Factor slice (Assignment assn) { if (assn.varSet ().containsAll (vars)) { // special case return new ConstantFactor (value (assn)); } else { throw new UnsupportedOperationException (); } }
/** * Returns the marginal of this distribution over the given variables. */ public Factor marginalize (Variable vars[]) { assert varSet ().containsAll (Arrays.asList (vars)); // Perhaps throw exception instead return marginalizeInternal (createBlankSubset (vars)); }
public Factor slice (Assignment assn) { if (assn.varSet ().containsAll (vars)) { // special case return new ConstantFactor (value (assn)); } else { throw new UnsupportedOperationException (); } }
/** * Returns the marginal of this distribution over the given variables. */ public Factor marginalize (Variable vars[]) { assert varSet ().containsAll (Arrays.asList (vars)); // Perhaps throw exception instead return marginalizeInternal (createBlankSubset (vars)); }
public Factor slice (Assignment assn) { if (assn.varSet ().containsAll (vars)) { // special case return new ConstantFactor (value (assn)); } else { throw new UnsupportedOperationException (); } }
/** * Returns a cluster in the tree that contains all the vars in a * collection. */ public VarSet findParentCluster(Collection vars) { int best = Integer.MAX_VALUE; VarSet retval = null; // xxx Inefficient for (Iterator it = getVerticesIterator(); it.hasNext();) { VarSet c = (VarSet) it.next(); if (c.containsAll(vars) && c.weight() < best) { retval = c; best = c.weight(); } } return retval; }
public Factor marginalize (Collection vars) { assert varSet ().containsAll (vars); // Perhaps throw exception instead return marginalizeInternal (createBlankSubset (vars)); }
public Factor marginalize (Collection vars) { assert varSet ().containsAll (vars); // Perhaps throw exception instead return marginalizeInternal (createBlankSubset (vars)); }
public Factor marginalize (Collection vars) { assert varSet ().containsAll (vars); // Perhaps throw exception instead return marginalizeInternal (createBlankSubset (vars)); }