Beispiel #1
0
            public IQueryResult ComputeSatisfiability(Query query)
            {
                // FIXME: Optimise the case where only the query expression has changed
                Printer.ClearDeclarations();
                foreach (var constraint in query.Constraints.Constraints)
                {
                    Printer.AddDeclarations(constraint);
                }
                Printer.AddDeclarations(query.QueryExpr);


                Printer.PrintCommentLine("Query " + UseCounter + " Begin");
                PrintDeclarationsAndConstraints(query.Constraints);
                Printer.PrintCommentLine("Query Expr:" + query.QueryExpr.Origin.ToString());
                Printer.PrintAssert(query.QueryExpr.Condition);
                Printer.PrintCheckSat();

                var result = UnderlyingImpl.ComputeSatisfiability(query);

                Printer.PrintCommentLine("Result : " + result.Satisfiability);

                Printer.PrintExit();
                Printer.PrintCommentLine("End of Query " + (UseCounter));
                ++UseCounter;
                return(result);
            }
Beispiel #2
0
            protected virtual void OutputHandler(object sendingProcess, DataReceivedEventArgs stdoutLine)
            {
                // The event handler might get called more than once.
                // In fact for Z3 we get called twice, first with the result
                // and then again with a blank line (why?)
                if (String.IsNullOrEmpty(stdoutLine.Data) || ReceivedResult)
                {
                    return;
                }

                switch (stdoutLine.Data)
                {
                case "sat":
                    SolverResult   = Result.SAT;
                    ReceivedResult = true;
                    break;

                case "unsat":
                    SolverResult   = Result.UNSAT;
                    ReceivedResult = true;
                    break;

                case "unknown":
                    SolverResult   = Result.UNKNOWN;
                    ReceivedResult = true;
                    ++InternalStatistics.SolverRepliedUnknownCount;
                    break;

                default:
                    SolverResult = Result.UNKNOWN;
                    Console.Error.WriteLine("ERROR: Solver output \"" + stdoutLine.Data + "\" not parsed correctly");
                    SolverErrorMsg = SolverErrorMsg + stdoutLine.Data;
                    ReceivedError  = true;
                    if (!PersistentProcess)
                    {
                        return;
                    }


                    break;
                }

                if (PersistentProcess)
                {
                    ReceivedResultEvent.Signal();
                }
                else
                {
                    Printer.PrintExit();
                }
            }