示例#1
0
文件: cp.py 项目: nicolasAmat/SMPT
    def prove(self, results, concurrent_pids):
        """ Prover.
        """
        model = None

        if self.minizinc:
            sat = self.prove_minizinc()
        else:
            sat = self.prove_smt()

        if sat and self.show_model:
            model = self.solver.get_marking(self.ptnet)

        if sat:
            verdict = Verdict.CEX
        else:
            verdict = Verdict.INV

        # Kill the solver
        self.solver.kill()

        # Quit if the solver has aborted
        if self.solver.aborted:
            return

        # Put the result in the queue
        results.put([verdict, model])

        # Terminate concurrent methods
        if not concurrent_pids.empty():
            send_signal_pids(concurrent_pids.get(), STOP)
示例#2
0
    def prove(self, result, concurrent_pids):
        """ Prover.
        """
        log.info("[STATE-EQUATION] RUNNING")

        if self.ptnet_reduced is None:
            verdict = self.prove_without_reduction()
        else:
            verdict = self.prove_with_reduction()

        # Kill the solver
        self.solver.kill()
        if self.traps is not None:
            self.traps.solver.kill()

        # Quit if the solver has aborted, or if unknow result (and mcc mode disabled)
        if self.solver.aborted or (not self.mcc
                                   and verdict == Verdict.UNKNOWN):
            return

        # Put the result in the queue
        if verdict != Verdict.UNKNOWN:
            result.put([verdict, None])

        # Terminate concurrent methods
        if not concurrent_pids.empty():
            send_signal_pids(concurrent_pids.get(), STOP)
示例#3
0
    def prove(self, result, concurrent_pids):
        """ Prover.
        """
        log.info("[BMC] RUNNING")

        if self.ptnet_reduced is None:
            order = self.prove_without_reduction()
        else:
            order = self.prove_with_reduction()

        # Kill the solver
        self.solver.kill()

        # Quit if the solver has aborted
        if self.solver.aborted:
            return

        # Put the result in the queue
        model = None
        if order == -1:
            verdict = Verdict.INV
            if self.additional_techniques is not None:
                self.additional_techniques.put('K-INDUCTION')
        else:
            verdict = Verdict.CEX
            if self.additional_techniques is not None:
                self.additional_techniques.put('BMC')
            if self.show_model:
                model = self.solver.get_marking(self.ptnet, order)
        result.put([verdict, model])

        # Terminate concurrent methods
        if not concurrent_pids.empty():
            send_signal_pids(concurrent_pids.get(), STOP)
示例#4
0
    def prove(self, result, concurrent_pids):
        """ Prover.
        """
        log.info("[INDUCTION] RUNNING")

        if self.ptnet_reduced is None:
            induction = self.prove_without_reduction()
        else:
            induction = self.prove_with_reduction()

        # Kill the solver
        self.solver.kill()

        # Quit if the solver has aborted or induction is None
        if self.solver.aborted or induction is None:
            return

        if induction:
            verdict = Verdict.CEX
        else:
            verdict = Verdict.INV

        # Put the result in the queue
        result.put([verdict, None])

        # Terminate concurrent methods
        if not concurrent_pids.empty():
            send_signal_pids(concurrent_pids.get(), STOP)
示例#5
0
    def prove(self, result, concurrent_pids):
        """ Prover.
        """
        log.info("[ENUMERATIVE] RUNNING")

        if self.ptnet_reduced is None:
            self.prove_without_reduction()
        else:
            self.prove_with_reduction()

        # Kill the solver
        self.solver.kill()

        # Quit if the solver has aborted
        if self.solver.aborted:
            return

        # Put the result in the queue
        verdict, model = Verdict.INV, None
        if self.solver.check_sat():
            verdict = Verdict.CEX
            model = self.solver.get_marking(self.ptnet)
        result.put([verdict, model])

        # Terminate concurrent methods
        if not concurrent_pids.empty():
            send_signal_pids(concurrent_pids.get(), STOP)
示例#6
0
    def stop(self):
        """ Stop the methods.
        """
        # Kill methods
        send_signal_pids([proc.pid for proc in self.processes], KILL)
        del self.methods

        # Kill solvers
        while not self.solver_pids.empty():
            send_signal_group_pid(self.solver_pids.get(), KILL)
示例#7
0
文件: pdr.py 项目: nicolasAmat/SMPT
    def exit_helper(self, verdict, result_output, concurrent_pids):
        """ Helper function to put the result to the output queue,
            and stop the concurrent method if there is one.
        """
        # Kill the solver
        self.solver.kill()

        # Quit if the solver has aborted
        if self.solver.aborted:
            return

        # Put the result in the queue
        result_output.put([verdict, None])

        # Terminate concurrent methods
        if not concurrent_pids.empty():
            send_signal_pids(concurrent_pids.get(), STOP)
示例#8
0
    def prove(self, result, concurrent_pids):
        """ Prover.
        """
        log.info("[RANDOM-WALK] RUNNING")

        log.info("[RANDOM-WALK] Walk")
        sat = self.solver.check_sat(self.formula.walk_filename)

        # Kill the solver
        self.solver.kill()

        # Quit if the solver has aborted
        if not sat or self.solver.aborted:
            return

        # Put the result in the queue
        result.put([Verdict.CEX, None])

        # Terminate concurrent methods
        if not concurrent_pids.empty():
            send_signal_pids(concurrent_pids.get(), STOP)
示例#9
0
 def kill(self):
     """" Kill the process.
     """
     if self.solver is not None:
         send_signal_pids([self.solver.pid], KILL)