/** * Construct a clause from the given literals. Note: literals the are always * 'False' (i.e. False or ~True) are not added to the instantiated clause. * * @param literals */ public Clause(ICollection <Literal> literals) { foreach (Literal l in literals) { if (l.isAlwaysFalse()) { // Don't add literals of the form // False | ~True continue; } if (this.literals.Add(l)) { // Only add to caches if not already added if (l.isPositiveLiteral()) { this.cachedPositiveSymbols.Add(l.getAtomicSentence()); } else { this.cachedNegativeSymbols.Add(l.getAtomicSentence()); } } } cachedSymbols.AddAll(cachedPositiveSymbols); cachedSymbols.AddAll(cachedNegativeSymbols); // Make immutable this.literals = CollectionFactory.CreateReadOnlySet <Literal>(this.literals); cachedSymbols = CollectionFactory.CreateReadOnlySet <PropositionSymbol>(cachedSymbols); cachedPositiveSymbols = CollectionFactory.CreateReadOnlySet <PropositionSymbol>(cachedPositiveSymbols); cachedNegativeSymbols = CollectionFactory.CreateReadOnlySet <PropositionSymbol>(cachedNegativeSymbols); }
public ISet <Clause> getFactors() { if (null == factors) { calculateFactors(null); } return(CollectionFactory.CreateReadOnlySet <Clause>(factors)); }
public ISet <Clause> getNonTrivialFactors() { if (null == nonTrivialFactors) { calculateFactors(null); } return(CollectionFactory.CreateReadOnlySet <Clause>(nonTrivialFactors)); }
protected void addChild(INode childNode) { children = CollectionFactory.CreateSet <INode>(children); children.Add(childNode); children = CollectionFactory.CreateReadOnlySet <INode>(children); }
static BooleanDomain() { // Keep consistent order _possibleValues = CollectionFactory.CreateSet <bool>(); _possibleValues.Add(true); _possibleValues.Add(false); // Ensure cannot be modified _possibleValues = CollectionFactory.CreateReadOnlySet <bool>(_possibleValues); }
public FiniteIntegerDomain(params int[] pValues) { // Keep consistent order possibleValues = CollectionFactory.CreateSet <int>(); foreach (int v in pValues) { possibleValues.Add(v); } // Ensure cannot be modified possibleValues = CollectionFactory.CreateReadOnlySet <int>(possibleValues); indexPossibleValues(possibleValues); }
public ArbitraryTokenDomain(bool ordered, params object[] pValues) { this.ordered = ordered; // Keep consistent order possibleValues = CollectionFactory.CreateSet <object>(); foreach (object v in pValues) { possibleValues.Add(v); } // Ensure cannot be modified possibleValues = CollectionFactory.CreateReadOnlySet <object>(possibleValues); indexPossibleValues(possibleValues); }
public FullJointDistributionModel(double[] values, params IRandomVariable[] vars) { if (null == vars) { throw new IllegalArgumentException("Random Variables describing the model's representation of the World need to be specified."); } distribution = new ProbabilityTable(values, vars); representation = CollectionFactory.CreateSet <IRandomVariable>(); for (int i = 0; i < vars.Length; ++i) { representation.Add(vars[i]); } representation = CollectionFactory.CreateReadOnlySet <IRandomVariable>(representation); }
public AbstractNode(IRandomVariable var, params INode[] parents) { if (null == var) { throw new IllegalArgumentException("Random Variable for Node must be specified."); } this.variable = var; this.parents = CollectionFactory.CreateSet <INode>(); if (null != parents) { foreach (INode p in parents) { ((AbstractNode)p).addChild(this); this.parents.Add(p); } } this.parents = CollectionFactory.CreateReadOnlySet <INode>(this.parents); this.children = CollectionFactory.CreateReadOnlySet <INode>(CollectionFactory.CreateSet <INode>()); }
// // START-ProbabilityDistribution public ISet <IRandomVariable> getFor() { return(CollectionFactory.CreateReadOnlySet <IRandomVariable>(randomVarInfo.GetKeys())); }
/** * Constructor. * * @param conjunctionOfClauses * a collection of clauses that represent a conjunction. */ public ConjunctionOfClauses(ICollection <Clause> conjunctionOfClauses) { this.clauses.AddAll(conjunctionOfClauses); // Make immutable this.clauses = CollectionFactory.CreateReadOnlySet <Clause>(this.clauses); }
public ISet <PropositionSymbol> getAssignedSymbols() { return(CollectionFactory.CreateReadOnlySet <PropositionSymbol>(assignments.GetKeys())); }
/// <summary> /// Returns an unmodifiable view of the object's key set /// </summary> /// <returns>an unmodifiable view of the object's key set</returns> public virtual ISet <object> GetKeys() { return(CollectionFactory.CreateReadOnlySet <object>(attributes.GetKeys())); }
public ISet <Literal> getLiterals() { return(CollectionFactory.CreateReadOnlySet <Literal>(literals)); }
public ISet <Clause> getAllClauses() { return(CollectionFactory.CreateReadOnlySet <Clause>(clauses)); }
/// <summary> /// Get a set of the actual actions. /// </summary> /// <returns>a set of the actual actions.</returns> public static ISet <CellWorldAction> Actions() { return(CollectionFactory.CreateReadOnlySet <CellWorldAction>(_actions)); }