private SymbolValuePair findUnitClause(List<Sentence> clauseList, Model model,
List<Symbol> symbols)
{
for (int i = 0; i < clauseList.Count; i++)
{
Sentence clause = (Sentence)clauseList[i];
if ((clause is Symbol)
&& (!(model.getAssignedSymbols().Contains(clause))))
{
// System.Console.WriteLine("found unit clause - assigning");
return new SymbolValuePair(new Symbol(((Symbol)clause)
.getValue()), true);
}
if (clause is UnarySentence)
{
UnarySentence sentence = (UnarySentence)clause;
Sentence negated = sentence.getNegated();
if ((negated is Symbol)
&& (!(model.getAssignedSymbols().Contains(negated))))
{
// System.Console.WriteLine("found unit clause type 2 -
// assigning");
return new SymbolValuePair(new Symbol(((Symbol)negated)
.getValue()), false);
}
}
}
return new SymbolValuePair();// failed to find any unit clause;
}