Beispiel #1
0
        // We assume that the formula is in QBF
        // (But no other assumption)
        public static bool QBFSAT(FormulaNode formula)
        {
            // First convert the formula to PNF
            formula = formula.NNF().PNF();
            // Then convert it to QBCNF
            QBCNFormula qbcnf = ConvertToCNF(formula);

            return(QBFSolver.Solve(qbcnf));
        }
Beispiel #2
0
        public static void Main(string[] args)
        {
            if (args.Length > 0)
            {
                if (args[0] == "_test")
                {
                    SatisfiabilityTests.Run();
                }
                else if (args[0] == "_longtest")
                {
                    SatisfiabilityTests.RunLongTests();
                }
                else
                {
                    RunFormula(args[0]);
                }
                return;
            }

            TitleScreen();
            while (true)
            {
                Console.WriteLine("Please enter a formula: (to quit, enter 'quit')");
                string input = Console.ReadLine();
                if (input == "quit")
                {
                    break;
                }

                threadFormula = input.Trim();
                if (threadFormula == "")
                {
                    continue;
                }
                Thread ctlthread = new Thread(RunFormulaThread);
                ctlthread.Start();
                while (ctlthread.IsAlive)
                {
                    if (Console.KeyAvailable && Console.ReadKey(true).Key == ConsoleKey.Escape)
                    {
                        ctlthread.Abort();
                        QBFSolver.AbortSolver();
                        Console.WriteLine("ABORTED");
                        PrintLine();
                    }
                }
            }
        }