/// <summary> /// Logs the clauses and the solution to the log file. /// </summary> /// <param name="clauses">The clauses.</param> /// <param name="type">The solver type.</param> /// <param name="solution">The solution.</param> public static void Log(List <Clause> clauses, SolverType type, Dictionary <string, bool> solution) { if (LogCLauses) { List <string> lines = new List <string>(); lines.Add("Type: " + type.ToString()); string solution_str = solution == null ? string.Empty : string.Join(" ", solution.OrderBy(x => x.Value).ThenBy(x => int.Parse(x.Key.Replace("b", string.Empty))) .Select(x => string.Format("{0}{1}", x.Value ? string.Empty : "-", x.Key))); List <string> clause_strings = new List <string>(); foreach (Clause clause in clauses) { clause_strings.Add(clause.ToString()); } lines.Add("Solution: " + solution_str); lines.Add("Clauses:"); lines.Add(string.Join(Environment.NewLine, clause_strings)); string clauseLog = string.Format("{0}.satlog", FileName); File.AppendAllLines(clauseLog, lines); } }
/// <summary> /// Returns a debug string for the SolverParameter. /// </summary> /// <returns>The debug string is returned.</returns> public string DebugString() { return(m_solverType.ToString()); }