LCOV - code coverage report
Current view: top level - buildbot/coverage/build/src/decision - decision_engine.h (source / functions) Hit Total Coverage
Test: coverage.info Lines: 2 3 66.7 %
Date: 2025-01-09 12:37:31 Functions: 2 4 50.0 %
Branches: 0 0 -

           Branch data     Line data    Source code
       1                 :            : /******************************************************************************
       2                 :            :  * Top contributors (to current version):
       3                 :            :  *   Andrew Reynolds, Aina Niemetz, Kshitij Bansal
       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                 :            :  * Decision engine.
      14                 :            :  */
      15                 :            : 
      16                 :            : #include "cvc5_private.h"
      17                 :            : 
      18                 :            : #ifndef CVC5__DECISION__DECISION_ENGINE_H
      19                 :            : #define CVC5__DECISION__DECISION_ENGINE_H
      20                 :            : 
      21                 :            : #include "expr/node.h"
      22                 :            : #include "prop/cnf_stream.h"
      23                 :            : #include "prop/sat_solver.h"
      24                 :            : #include "prop/sat_solver_types.h"
      25                 :            : #include "smt/env_obj.h"
      26                 :            : 
      27                 :            : namespace cvc5::internal {
      28                 :            : namespace decision {
      29                 :            : 
      30                 :            : class DecisionEngine : protected EnvObj
      31                 :            : {
      32                 :            :  public:
      33                 :            :   /** Constructor */
      34                 :            :   DecisionEngine(Env& env, prop::CDCLTSatSolver* ss, prop::CnfStream* cs);
      35                 :      50379 :   virtual ~DecisionEngine() {}
      36                 :            : 
      37                 :            :   /** Presolve, called at the beginning of each check-sat call */
      38                 :      12198 :   virtual void presolve() {}
      39                 :            : 
      40                 :            :   /**
      41                 :            :    * Gets the next decision based on strategies that are enabled. This sets
      42                 :            :    * stopSearch to true if no further SAT variables need to be assigned in
      43                 :            :    * this SAT context.
      44                 :            :    */
      45                 :            :   prop::SatLiteral getNext(bool& stopSearch);
      46                 :            : 
      47                 :            :   /** Is the DecisionEngine in a state where it has solved everything? */
      48                 :            :   virtual bool isDone() = 0;
      49                 :            :   /**
      50                 :            :    * Adds assertions lems to satisfy that persist in the user context.
      51                 :            :    * All input assertions and relevant lemmas are added via this call.
      52                 :            :    * @param lems The lemmas to add.
      53                 :            :    */
      54                 :            :   virtual void addAssertions(const std::vector<TNode>& lems) = 0;
      55                 :            :   /**
      56                 :            :    * Adds assertions lems to satisfy that persist in the SAT context.
      57                 :            :    * By default, only skolem definitions from input and lemmas are added via
      58                 :            :    * this call.
      59                 :            :    * @param lems The lemmas to add.
      60                 :            :    */
      61                 :          0 :   virtual void addLocalAssertions(const std::vector<TNode>& lems) {}
      62                 :            : 
      63                 :            :  protected:
      64                 :            :   /** Get next internal, the engine-specific implementation of getNext */
      65                 :            :   virtual prop::SatLiteral getNextInternal(bool& stopSearch) = 0;
      66                 :            :   /** Pointer to the SAT solver */
      67                 :            :   prop::CDCLTSatSolver* d_satSolver;
      68                 :            :   /** Pointer to the CNF stream */
      69                 :            :   prop::CnfStream* d_cnfStream;
      70                 :            : };
      71                 :            : 
      72                 :            : /**
      73                 :            :  * Instance of the above class which does nothing. This is used when
      74                 :            :  * the decision mode is set to internal.
      75                 :            :  */
      76                 :            : class DecisionEngineEmpty : public DecisionEngine
      77                 :            : {
      78                 :            :  public:
      79                 :            :   DecisionEngineEmpty(Env& env);
      80                 :            :   bool isDone() override;
      81                 :            :   void addAssertions(const std::vector<TNode>& lems) override;
      82                 :            : 
      83                 :            :  protected:
      84                 :            :   prop::SatLiteral getNextInternal(bool& stopSearch) override;
      85                 :            : };
      86                 :            : 
      87                 :            : }  // namespace decision
      88                 :            : }  // namespace cvc5::internal
      89                 :            : 
      90                 :            : #endif /* CVC5__DECISION__DECISION_ENGINE_H */

Generated by: LCOV version 1.14