示例#1
0
 public AssignmentEntry(String variable, CNFTruth truth, CNFClause clause, bool decided, int depth)
 {
     Variable      = variable;
     Truth         = truth;
     RelatedClause = clause;
     Decided       = decided;
     Depth         = depth;
 }
 public bool Push(String var_name, bool decided, CNFClause clause, CNFTruth truth, int depth)
 {
     return(Push(new AssignmentEntry(
                     variable: var_name,
                     decided: decided,
                     clause: clause,
                     truth: truth,
                     depth: depth)));
 }
        public override bool Equals(object obj)
        {
            // This isn't nothing.
            if (obj is null)
            {
                return(false);
            }
            // We can only be equal to things we can assign to CNFClauses.
            if (!typeof(CNFClause).IsAssignableFrom(obj.GetType()))
            {
                return(false);
            }

            // Cast it to a Clause.
            CNFClause other_clause = (CNFClause)obj;

            // We can't be equal if we're different lengths.
            if (other_clause.Count != this.Count)
            {
                return(false);
            }

            // For each variable in the clause
            foreach (KeyValuePair <String, CNFStates> var in this)
            {
                // If they don't have one of our variables, then we can't be the same.
                if (!other_clause.ContainsKey(var.Key))
                {
                    return(false);
                }

                // If they have our variable, it's state has to be the same to be the same clause.
                if (other_clause[var.Key] != var.Value)
                {
                    return(false);
                }
            }

            // If all of those conditions are true, then we're the same.
            return(true);
        }
 public CNFClause(CNFClause copy_source) : base(copy_source)
 {
 }
示例#5
0
 public ImplicationResult(String new_variable, CNFTruth new_truth, CNFClause new_clause)
 {
     Variable = new_variable;
     Clause   = new_clause;
     Truth    = new_truth;
 }
 public bool AddKnownVariable(String var_name, CNFTruth truth, CNFClause clause)
 {
     return(Push(var_name, false, clause, truth, 0));
 }
示例#7
0
 public ConflictException(CNFClause clause1, CNFClause clause2, String variable) : base()
 {
     Clause1  = clause1;
     Clause2  = clause2;
     Variable = variable;
 }