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