LCOV - code coverage report
Current view: top level - buildbot/coverage/build/src/prop - cryptominisat.h (source / functions) Hit Total Coverage
Test: coverage.info Lines: 0 1 0.0 %
Date: 2024-10-24 11:38:43 Functions: 0 1 0.0 %
Branches: 0 0 -

           Branch data     Line data    Source code
       1                 :            : /******************************************************************************
       2                 :            :  * Top contributors (to current version):
       3                 :            :  *   Mathias Preiner, Aina Niemetz, Liana Hadarean
       4                 :            :  *
       5                 :            :  * This file is part of the cvc5 project.
       6                 :            :  *
       7                 :            :  * Copyright (c) 2009-2024 by the authors listed in the file AUTHORS
       8                 :            :  * in the top-level source directory and their institutional affiliations.
       9                 :            :  * All rights reserved.  See the file COPYING in the top-level source
      10                 :            :  * directory for licensing information.
      11                 :            :  * ****************************************************************************
      12                 :            :  *
      13                 :            :  * SAT Solver.
      14                 :            :  *
      15                 :            :  * Implementation of the cryptominisat sat solver for cvc5 (bit-vectors).
      16                 :            :  */
      17                 :            : 
      18                 :            : #include "cvc5_private.h"
      19                 :            : 
      20                 :            : #ifndef CVC5__PROP__CRYPTOMINISAT_H
      21                 :            : #define CVC5__PROP__CRYPTOMINISAT_H
      22                 :            : 
      23                 :            : #ifdef CVC5_USE_CRYPTOMINISAT
      24                 :            : 
      25                 :            : #include "prop/sat_solver.h"
      26                 :            : 
      27                 :            : // Cryptominisat has name clashes with the other Minisat implementations since
      28                 :            : // the Minisat implementations export var_Undef, l_True, ... as macro whereas
      29                 :            : // Cryptominisat uses static const. In order to avoid these conflicts we
      30                 :            : // forward declare CMSat::SATSolver and include the cryptominisat header only
      31                 :            : // in cryptominisat.cpp.
      32                 :            : namespace CMSat {
      33                 :            :   class SATSolver;
      34                 :            : }
      35                 :            : 
      36                 :            : namespace cvc5::internal {
      37                 :            : namespace prop {
      38                 :            : 
      39                 :            : class CryptoMinisatSolver : public SatSolver
      40                 :            : {
      41                 :            :   friend class SatSolverFactory;
      42                 :            : 
      43                 :            :  public:
      44                 :            :   ~CryptoMinisatSolver() override;
      45                 :            : 
      46                 :            :   ClauseId addClause(SatClause& clause, bool removable) override;
      47                 :            :   ClauseId addXorClause(SatClause& clause, bool rhs, bool removable) override;
      48                 :            : 
      49                 :          0 :   bool nativeXor() override { return true; }
      50                 :            : 
      51                 :            :   SatVariable newVar(bool isTheoryAtom = false, bool canErase = true) override;
      52                 :            : 
      53                 :            :   SatVariable trueVar() override;
      54                 :            :   SatVariable falseVar() override;
      55                 :            : 
      56                 :            :   void markUnremovable(SatLiteral lit);
      57                 :            : 
      58                 :            :   void interrupt() override;
      59                 :            : 
      60                 :            :   SatValue solve() override;
      61                 :            :   SatValue solve(long unsigned int&) override;
      62                 :            :   SatValue solve(const std::vector<SatLiteral>& assumptions) override;
      63                 :            :   void getUnsatAssumptions(std::vector<SatLiteral>& assumptions) override;
      64                 :            : 
      65                 :            :   bool ok() const override;
      66                 :            :   SatValue value(SatLiteral l) override;
      67                 :            :   SatValue modelValue(SatLiteral l) override;
      68                 :            : 
      69                 :            :   uint32_t getAssertionLevel() const override;
      70                 :            : 
      71                 :            :  private:
      72                 :            :   class Statistics
      73                 :            :   {
      74                 :            :    public:
      75                 :            :     IntStat d_statCallsToSolve;
      76                 :            :     IntStat d_xorClausesAdded;
      77                 :            :     IntStat d_clausesAdded;
      78                 :            :     TimerStat d_solveTime;
      79                 :            :     Statistics(StatisticsRegistry& registry, const std::string& prefix);
      80                 :            :   };
      81                 :            : 
      82                 :            :   /**
      83                 :            :    * Private to disallow creation outside of SatSolverFactory.
      84                 :            :    * Function init() must be called after creation.
      85                 :            :    */
      86                 :            :   CryptoMinisatSolver(StatisticsRegistry& registry,
      87                 :            :                       const std::string& name = "");
      88                 :            :   /**
      89                 :            :    * Initialize SAT solver instance.
      90                 :            :    * Note: Split out to not call virtual functions in constructor.
      91                 :            :    */
      92                 :            :   void init();
      93                 :            : 
      94                 :            :   /**
      95                 :            :    * Set time limit per solve() call.
      96                 :            :    */
      97                 :            :   void setTimeLimit(ResourceManager* resmgr);
      98                 :            : 
      99                 :            :   /**
     100                 :            :    * Set CryptoMiniSat's maximum time limit based on the already elapsed time
     101                 :            :    * of the --tlimit-per limit.
     102                 :            :    */
     103                 :            :   void setMaxTime();
     104                 :            : 
     105                 :            :   std::unique_ptr<CMSat::SATSolver> d_solver;
     106                 :            :   unsigned d_numVariables;
     107                 :            :   bool d_okay;
     108                 :            :   SatVariable d_true;
     109                 :            :   SatVariable d_false;
     110                 :            : 
     111                 :            :   Statistics d_statistics;
     112                 :            :   ResourceManager* d_resmgr;
     113                 :            : };
     114                 :            : 
     115                 :            : }  // namespace prop
     116                 :            : }  // namespace cvc5::internal
     117                 :            : 
     118                 :            : #endif  // CVC5_USE_CRYPTOMINISAT
     119                 :            : #endif  // CVC5__PROP__CRYPTOMINISAT_H

Generated by: LCOV version 1.14