Branch data Line data Source code
1 : : /****************************************************************************** 2 : : * This file is part of the cvc5 project. 3 : : * 4 : : * Copyright (c) 2009-2026 by the authors listed in the file AUTHORS 5 : : * in the top-level source directory and their institutional affiliations. 6 : : * All rights reserved. See the file COPYING in the top-level source 7 : : * directory for licensing information. 8 : : * **************************************************************************** 9 : : * 10 : : * Branch and bound for arithmetic 11 : : */ 12 : : 13 : : #include "cvc5_private.h" 14 : : 15 : : #ifndef CVC5__THEORY__ARITH__BRANCH_AND_BOUND__H 16 : : #define CVC5__THEORY__ARITH__BRANCH_AND_BOUND__H 17 : : 18 : : #include <map> 19 : : 20 : : #include "expr/node.h" 21 : : #include "proof/proof_node_manager.h" 22 : : #include "proof/trust_node.h" 23 : : #include "smt/env_obj.h" 24 : : #include "theory/arith/inference_manager.h" 25 : : #include "theory/arith/pp_rewrite_eq.h" 26 : : #include "theory/theory_state.h" 27 : : #include "util/rational.h" 28 : : 29 : : namespace cvc5::internal { 30 : : namespace theory { 31 : : namespace arith { 32 : : 33 : : /** 34 : : * Class is responsible for constructing branch and bound lemmas. It is 35 : : * agnostic to the state of solver; instead is simply given (variable, value) 36 : : * pairs in branchIntegerVariable below and constructs the appropriate lemma. 37 : : */ 38 : : class BranchAndBound : protected EnvObj 39 : : { 40 : : public: 41 : : BranchAndBound(Env& env, 42 : : TheoryState& s, 43 : : InferenceManager& im, 44 : : PreprocessRewriteEq& ppre); 45 : 28696 : ~BranchAndBound() {} 46 : : /** 47 : : * Branch variable, called when integer var has given value 48 : : * in the current model, returns a split to eliminate this model. 49 : : * 50 : : * @param var The variable to branch on 51 : : * @param value Its current model value 52 : : */ 53 : : std::vector<TrustNode> branchIntegerVariable(TNode var, Rational value); 54 : : 55 : : private: 56 : : /** Are proofs enabled? */ 57 : : bool proofsEnabled() const; 58 : : /** Reference to the state */ 59 : : TheoryState& d_astate; 60 : : /** Reference to the inference manager */ 61 : : InferenceManager& d_im; 62 : : /** Reference to the preprocess rewriter for equality */ 63 : : PreprocessRewriteEq& d_ppre; 64 : : /** Proof generator. */ 65 : : std::unique_ptr<EagerProofGenerator> d_pfGen; 66 : : }; 67 : : 68 : : } // namespace arith 69 : : } // namespace theory 70 : : } // namespace cvc5::internal 71 : : 72 : : #endif