From 81c8c1d1e53b1723355bff0d87eb321584f3aca2 Mon Sep 17 00:00:00 2001 From: Kunal Sheth Date: Wed, 24 Dec 2025 16:35:10 -0800 Subject: [PATCH 01/43] Add missing statistics prints for `. A` and PM Dumps on execution branch for direct lemma additions without matching. --- src/dreal/solver/context_impl.cc | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/dreal/solver/context_impl.cc b/src/dreal/solver/context_impl.cc index 36864f0c8..721732179 100644 --- a/src/dreal/solver/context_impl.cc +++ b/src/dreal/solver/context_impl.cc @@ -362,7 +362,7 @@ optional Context::Impl::CheckSatCore(const ScopedVector& stack, #ifdef DREAL_EXPERIMENTAL_GENERATE_HEURISTICS_CSV std::chrono::duration_cast(std::chrono::seconds(20)) #else - std::min( // based on information from WORTH_IT_regression_4.ipynb + std::min( // based on i̶n̶f̶o̶r̶m̶a̶t̶i̶o̶n̶ ̶f̶r̶o̶m̶ ̶W̶O̶R̶T̶H̶_̶I̶T̶_̶r̶e̶g̶r̶e̶s̶s̶i̶o̶n̶_̶4̶.̶i̶p̶y̶n̶b̶ vibes std::chrono::duration_cast(100 * tscs_elapsed), std::chrono::duration_cast(DREAL_EXPERIMENTAL_PATTERN_MATCH_TIMEOUT) ) @@ -396,11 +396,12 @@ optional Context::Impl::CheckSatCore(const ScopedVector& stack, // const bool valid_under = (actual_log2_worth_it < 1) && (predicted_is_worth_it < 0.5); // const bool underestimated = (actual_log2_worth_it > 1) && (predicted_is_worth_it < 0.5); } else { - // std::cerr << std::setprecision(3); + if (DREAL_EXPERIMENTAL_PM_DUMP_ALL_ENABLED) pm_dump_all(explanation, {}); + std::cerr << std::setprecision(3); // std::cerr << "P(is W.I.)=" << predicted_is_worth_it; - // std::cerr << ".\tA 1 s " << explanation.size() << " d.\t"; - // std::cerr << "T " << tscs_elapsed.count() << " m.\t"; - // std::cerr << "F c = " << is_full_constrained << '\n'; + std::cerr << ".\tA 1 s " << explanation.size() << " d.\t"; + std::cerr << "T " << tscs_elapsed.count() << " m.\t"; + std::cerr << "F c = " << is_full_constrained << '\n'; sat_solver->AddLearnedClauseDirect(explanation, box); } //////////////////////////////////////////////////////////////////////////////// From 92d82dfd7b31765c7fdb95baff69a0491b3a31f0 Mon Sep 17 00:00:00 2001 From: Kunal Sheth Date: Sat, 27 Dec 2025 01:07:00 -0800 Subject: [PATCH 02/43] Fix segfault on certain SAR-ADC problems: when Integral constraint's time_t is a constant/real-const. --- src/dreal/contractor/odes/contractor_odes.cc | 50 ++++++++++++++++--- .../dreal/symbolic/odes/symbolic_odes.cc | 4 +- 2 files changed, 46 insertions(+), 8 deletions(-) diff --git a/src/dreal/contractor/odes/contractor_odes.cc b/src/dreal/contractor/odes/contractor_odes.cc index dcbedb166..bf4509833 100644 --- a/src/dreal/contractor/odes/contractor_odes.cc +++ b/src/dreal/contractor/odes/contractor_odes.cc @@ -286,7 +286,16 @@ namespace dreal // Special Case: Time = [0, 0] // Intersect X_0 and X_t and return - if (cs->mutable_box()[get_variable(icc->get_time_t())].ub() == 0.0) { + + // dReal3: + // if (cs->mutable_box()[get_variable(icc->get_time_t())].ub() == 0.0) { + // Kunal Fix: + const auto &icct = icc->get_time_t(); + if ( + (is_variable(icct) && cs->mutable_box()[get_variable(icct)].ub() == 0.0) || + is_constant(icct, 0.0) + ) { + for (unsigned i = 0; i < m_vars_0.size(); ++i) { auto& iv_0_i = cs->mutable_box()[m_vars_0[i]]; auto& iv_t_i = cs->mutable_box()[m_vars_t[i]]; @@ -324,8 +333,23 @@ namespace dreal } capd::IVector X_0 = extract_ivector(cs->mutable_box(), m_vars_0); capd::IVector X_t = extract_ivector(cs->mutable_box(), m_vars_t); - ibex::Interval const& ibex_T = cs->mutable_box()[get_variable(icc->get_time_t())]; - capd::interval T(ibex_T.lb(), ibex_T.ub()); + + // dReal3 code: + // ibex::Interval const& ibex_T = + // is_constant(icc->get_time_t()) + // cs->mutable_box()[get_variable(icc->get_time_t())]; + // capd::interval T(ibex_T.lb(), ibex_T.ub()); + // Kunal's Fix: + capd::interval T; + const auto& icct = icc->get_time_t(); + if (is_variable(icct)) { + const auto& iv = cs->box()[get_variable(icct)]; + T = capd::interval(iv.lb(), iv.ub()); + } + else if (is_real_constant(icct)) T = capd::interval(get_lb_of_real_constant(icct), get_ub_of_real_constant(icct)); + else if (is_constant(icct)) T = capd::interval(get_constant_value(icct)); + else DREAL_UNREACHABLE(); + // DREAL_LOG_INFO("X_0 : ", X_0); // DREAL_LOG_INFO("X_t : ", X_t); // DREAL_LOG_INFO("T : ", T); @@ -408,7 +432,8 @@ namespace dreal // SAT update_box_with_ivector(cs->mutable_box(), m_vars_t, X_t); // TODO(soonhok): Here we still assume that time_0 = zero. - cs->mutable_box()[get_variable(icc->get_time_t())] = ibex::Interval(T.leftBound(), T.rightBound()); + if (is_variable(icct)) + cs->mutable_box()[get_variable(icc->get_time_t())] = ibex::Interval(T.leftBound(), T.rightBound()); DREAL_LOG_DEBUG("contractor_capd_full::prune: get non-empty set after filtering"); } else { @@ -539,8 +564,21 @@ namespace dreal (m_dir == ode_direction::FWD) ? icc->get_pars_0() : icc->get_pars_t(); capd::IVector X_0 = extract_ivector(b, vars_0); capd::IVector X_t = extract_ivector(b, vars_t); - ibex::Interval const& ibex_T = b[get_variable(icc->get_time_t())]; - capd::interval T(ibex_T.lb(), ibex_T.ub()); + + // dReal3 code: + // ibex::Interval const& ibex_T = b[get_variable(icc->get_time_t())]; + // capd::interval T(ibex_T.lb(), ibex_T.ub()); + // Kunal's Fix: + capd::interval T; + const auto& icct = icc->get_time_t(); + if (is_variable(icct)) { + const auto& iv = b[get_variable(icct)]; + T = capd::interval(iv.lb(), iv.ub()); + } + else if (is_real_constant(icct)) T = capd::interval(get_lb_of_real_constant(icct), get_ub_of_real_constant(icct)); + else if (is_constant(icct)) T = capd::interval(get_constant_value(icct)); + else DREAL_UNREACHABLE(); + Rect2Set rs(X_0); (*m_timeMap)(0.0, rs); // Rewind to 0.0 m_timeMap->stopAfterStep(true); diff --git a/src/third_party/com_github_robotlocomotion_drake/dreal/symbolic/odes/symbolic_odes.cc b/src/third_party/com_github_robotlocomotion_drake/dreal/symbolic/odes/symbolic_odes.cc index a1d222281..a816b2ca2 100644 --- a/src/third_party/com_github_robotlocomotion_drake/dreal/symbolic/odes/symbolic_odes.cc +++ b/src/third_party/com_github_robotlocomotion_drake/dreal/symbolic/odes/symbolic_odes.cc @@ -204,8 +204,8 @@ namespace dreal::drake::symbolic vec_0_{std::move(vec_0)}, vec_t_{std::move(vec_t)}, flow_{flow} { - DREAL_ASSERT(is_variable(time_0_) || is_constant(time_0_)); - DREAL_ASSERT(is_variable(time_t_) || is_constant(time_t_)); + DREAL_ASSERT(is_variable(time_0_) || is_constant(time_0_) || is_real_constant(time_0_)); + DREAL_ASSERT(is_variable(time_t_) || is_constant(time_t_) || is_real_constant(time_t_)); if (vec_0_.size() != vec_t_.size()) throw DREAL_RUNTIME_ERROR("vec_0.size() != vec_t.size()"); From 64c5cae702e37841fe6d4cd82bc4e3199f6edbf7 Mon Sep 17 00:00:00 2001 From: Kunal Sheth Date: Sat, 27 Dec 2025 01:09:28 -0800 Subject: [PATCH 03/43] Expand concept of "dummy" Variables in dreal/drake ASTs with negative IDs. --- .../dreal/symbolic/symbolic_variable.cc | 7 +++++++ .../dreal/symbolic/symbolic_variable.h | 6 +++++- .../dreal/symbolic/test/symbolic_variable_test.cc | 2 +- 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/src/third_party/com_github_robotlocomotion_drake/dreal/symbolic/symbolic_variable.cc b/src/third_party/com_github_robotlocomotion_drake/dreal/symbolic/symbolic_variable.cc index 727208468..e0e74afbd 100644 --- a/src/third_party/com_github_robotlocomotion_drake/dreal/symbolic/symbolic_variable.cc +++ b/src/third_party/com_github_robotlocomotion_drake/dreal/symbolic/symbolic_variable.cc @@ -35,6 +35,13 @@ Variable::Variable(string name, const Type type) assert(id_ > 0); } +Variable::Variable(const Id dummy_id, const Type type) + : id_{dummy_id}, + type_{type}, + name_{make_shared("%_DUMMY"+std::to_string(-dummy_id)+"_%")} { + assert(dummy_id < 0); +} + Variable::Variable(string name, const Type type, bool) : Variable{std::move(name), type} {} diff --git a/src/third_party/com_github_robotlocomotion_drake/dreal/symbolic/symbolic_variable.h b/src/third_party/com_github_robotlocomotion_drake/dreal/symbolic/symbolic_variable.h index 603f41814..dfbd8b4cc 100644 --- a/src/third_party/com_github_robotlocomotion_drake/dreal/symbolic/symbolic_variable.h +++ b/src/third_party/com_github_robotlocomotion_drake/dreal/symbolic/symbolic_variable.h @@ -15,7 +15,7 @@ namespace symbolic { /** Represents a symbolic variable. */ class Variable { public: - typedef size_t Id; + typedef int Id; /** Supported types of symbolic variables. */ // TODO(soonho-tri): refines the following descriptions. @@ -49,6 +49,10 @@ class Variable { * type by default.*/ explicit Variable(std::string name, Type type = Type::CONTINUOUS); + /** Constructs a dummy variable with an ID. If not specified, it has CONTINUOUS + * type by default.*/ + explicit Variable(Id dummy_id, Type type = Type::CONTINUOUS); + /** Constructs a variable with @p name and @p type. @p model_variable is * ignored. */ [[deprecated("This is only for backward-compatibility.")]] Variable( diff --git a/test/third_party/com_github_robotlocomotion_drake/dreal/symbolic/test/symbolic_variable_test.cc b/test/third_party/com_github_robotlocomotion_drake/dreal/symbolic/test/symbolic_variable_test.cc index 72d1be560..eca059a38 100644 --- a/test/third_party/com_github_robotlocomotion_drake/dreal/symbolic/test/symbolic_variable_test.cc +++ b/test/third_party/com_github_robotlocomotion_drake/dreal/symbolic/test/symbolic_variable_test.cc @@ -57,7 +57,7 @@ TEST_F(VariableTest, GetName) { TEST_F(VariableTest, MoveCopyPreserveId) { Variable x{"x"}; - const size_t x_id{x.get_id()}; + const int x_id{x.get_id()}; const size_t x_hash{x.get_hash()}; const Variable x_copied{x}; const Variable x_moved{std::move(x)}; From e37594d4d61334f524c35d9b81734d16819cd338 Mon Sep 17 00:00:00 2001 From: Kunal Sheth Date: Sat, 27 Dec 2025 01:10:25 -0800 Subject: [PATCH 04/43] Make std::vector order-able for use as key in std::set. --- .../dreal/symbolic/symbolic_variable.h | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/third_party/com_github_robotlocomotion_drake/dreal/symbolic/symbolic_variable.h b/src/third_party/com_github_robotlocomotion_drake/dreal/symbolic/symbolic_variable.h index dfbd8b4cc..ce8ea462f 100644 --- a/src/third_party/com_github_robotlocomotion_drake/dreal/symbolic/symbolic_variable.h +++ b/src/third_party/com_github_robotlocomotion_drake/dreal/symbolic/symbolic_variable.h @@ -111,6 +111,17 @@ struct less { } }; +/* Provides std::less. */ +template <> +struct less> { + bool operator()(const vector& vars1, + const vector& vars2) const { + return std::lexicographical_compare(vars1.begin(), vars1.end(), + vars2.begin(), vars2.end(), + std::less{}); + } +}; + /* Provides std::equal_to. */ template <> struct equal_to { From 5f3bf4b788cbef92f6e4ec4230e74cdb505ecdf9 Mon Sep 17 00:00:00 2001 From: Kunal Sheth Date: Sat, 27 Dec 2025 01:11:42 -0800 Subject: [PATCH 05/43] Include variable sort/type (but not name) in alpha-hashing. --- .../dreal/symbolic/symbolic_expression_cell.cc | 2 +- .../dreal/symbolic/symbolic_formula_cell.cc | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/third_party/com_github_robotlocomotion_drake/dreal/symbolic/symbolic_expression_cell.cc b/src/third_party/com_github_robotlocomotion_drake/dreal/symbolic/symbolic_expression_cell.cc index 7b3018d04..cb20cad49 100644 --- a/src/third_party/com_github_robotlocomotion_drake/dreal/symbolic/symbolic_expression_cell.cc +++ b/src/third_party/com_github_robotlocomotion_drake/dreal/symbolic/symbolic_expression_cell.cc @@ -317,7 +317,7 @@ double BinaryExpressionCell::Evaluate(const Environment& env) const { ExpressionVar::ExpressionVar(const Variable& v) : ExpressionCell{ExpressionKind::Var, hash_value{}(v), - 41, + hash_combine(41, v.get_type()), true, false, {v}}, diff --git a/src/third_party/com_github_robotlocomotion_drake/dreal/symbolic/symbolic_formula_cell.cc b/src/third_party/com_github_robotlocomotion_drake/dreal/symbolic/symbolic_formula_cell.cc index e2766bccf..6e1e38820 100644 --- a/src/third_party/com_github_robotlocomotion_drake/dreal/symbolic/symbolic_formula_cell.cc +++ b/src/third_party/com_github_robotlocomotion_drake/dreal/symbolic/symbolic_formula_cell.cc @@ -186,7 +186,7 @@ Formula FormulaFalse::Substitute(const ExpressionSubstitution&, ostream& FormulaFalse::Display(ostream& os) const { return os << "False"; } FormulaVar::FormulaVar(const Variable& v) - : FormulaCell{FormulaKind::Var, hash_value{}(v), 41, false, false, {v}}, + : FormulaCell{FormulaKind::Var, hash_value{}(v), hash_combine(41, v.get_type()), false, false, {v}}, var_{v} { // Dummy symbolic variable (ID = 0) should not be used in constructing // symbolic formulas. From 74513c0e9bd03597717db91d2db5be53c19dfc4c Mon Sep 17 00:00:00 2001 From: Kunal Sheth Date: Sat, 27 Dec 2025 01:13:23 -0800 Subject: [PATCH 06/43] Fix bugs in alpha-hashing for commutative AST nodes (`alpha_hash_map(..)`, `alpha_hash_set(..)`) --- .../dreal/symbolic/symbolic_expression_cell.cc | 18 ++++++++---------- .../dreal/symbolic/symbolic_formula_cell.cc | 7 +++---- 2 files changed, 11 insertions(+), 14 deletions(-) diff --git a/src/third_party/com_github_robotlocomotion_drake/dreal/symbolic/symbolic_expression_cell.cc b/src/third_party/com_github_robotlocomotion_drake/dreal/symbolic/symbolic_expression_cell.cc index cb20cad49..b24da2de4 100644 --- a/src/third_party/com_github_robotlocomotion_drake/dreal/symbolic/symbolic_expression_cell.cc +++ b/src/third_party/com_github_robotlocomotion_drake/dreal/symbolic/symbolic_expression_cell.cc @@ -516,11 +516,10 @@ Expression ExpressionNaN::Differentiate(const Variable&) const { ostream& ExpressionNaN::Display(ostream& os) const { return os << "NaN"; } -size_t alpha_hash_map(const map &map) { - size_t seed{}; - for (const auto& [k,v] : map) - seed = hash_combine(seed, k.get_al_hash(), v); - return seed; +size_t alpha_hash_map(const map& map) { + std::multiset hashes; + for (const auto& [k,v] : map) hashes.insert(hash_combine(k.get_al_hash(), v)); + return hash_range(hashes.cbegin(), hashes.cend()); } ExpressionAdd::ExpressionAdd(const double constant, @@ -782,11 +781,10 @@ ExpressionAddFactory& ExpressionAddFactory::AddMap( return *this; } -size_t alpha_hash_map(const map &map) { - size_t seed{}; - for (const auto& [k,v] : map) - seed = hash_combine(seed, k.get_al_hash(), v.get_al_hash()); - return seed; +size_t alpha_hash_map(const map& map) { + std::multiset hashes; + for (const auto& [k,v] : map) hashes.insert(hash_combine(k.get_al_hash(), v.get_al_hash())); + return hash_range(hashes.cbegin(), hashes.cend()); } ExpressionMul::ExpressionMul(const double constant, diff --git a/src/third_party/com_github_robotlocomotion_drake/dreal/symbolic/symbolic_formula_cell.cc b/src/third_party/com_github_robotlocomotion_drake/dreal/symbolic/symbolic_formula_cell.cc index 6e1e38820..59ef5a6fc 100644 --- a/src/third_party/com_github_robotlocomotion_drake/dreal/symbolic/symbolic_formula_cell.cc +++ b/src/third_party/com_github_robotlocomotion_drake/dreal/symbolic/symbolic_formula_cell.cc @@ -77,10 +77,9 @@ bool RelationalFormulaCell::Less(const FormulaCell& f) const { } size_t alpha_hash_set(const set &set) { - size_t seed{}; - for (const auto& v : set) - seed = hash_combine(seed, v.get_al_hash()); - return seed; + std::multiset hashes; + for (const auto&k : set) hashes.insert(k.get_al_hash()); + return hash_range(hashes.cbegin(), hashes.cend()); } NaryFormulaCell::NaryFormulaCell(const FormulaKind k, set formulas) From 8b6c14ec6302d79400a8b53f714b6dad743d047b Mon Sep 17 00:00:00 2001 From: Kunal Sheth Date: Sat, 27 Dec 2025 01:24:52 -0800 Subject: [PATCH 07/43] Reorganize pattern matching folder. - Move trie implementation to own subfolder. - Move stats struct to independent header file. --- src/dreal/solver/sat_solver.h | 2 +- src/dreal/solver/sat_solver_interval_logic.cc | 2 +- .../util/pattern_matching/matching_stats_t.h | 24 +++++++++++++++++++ .../pattern_matching_heuristic.h | 6 ++--- .../util/pattern_matching/substitutions_map.h | 8 +++---- .../{ => trie_based}/pattern_matching_trie.h | 17 ++----------- .../pattern_matching_trie_expr.cc | 0 .../pattern_matching_trie_form.cc | 0 .../pattern_matching_trie_general.cc | 10 ++++---- src/dreal/util/predicate_normalizer.cc | 2 +- src/dreal/util/predicate_normalizer.h | 8 +++---- test/dreal/util/test/pattern_matching_test.cc | 5 +--- 12 files changed, 46 insertions(+), 38 deletions(-) create mode 100644 src/dreal/util/pattern_matching/matching_stats_t.h rename src/dreal/util/pattern_matching/{ => trie_based}/pattern_matching_trie.h (97%) rename src/dreal/util/pattern_matching/{ => trie_based}/pattern_matching_trie_expr.cc (100%) rename src/dreal/util/pattern_matching/{ => trie_based}/pattern_matching_trie_form.cc (100%) rename src/dreal/util/pattern_matching/{ => trie_based}/pattern_matching_trie_general.cc (97%) diff --git a/src/dreal/solver/sat_solver.h b/src/dreal/solver/sat_solver.h index 0f59b7f1e..976de2dfc 100644 --- a/src/dreal/solver/sat_solver.h +++ b/src/dreal/solver/sat_solver.h @@ -73,7 +73,7 @@ class SatSolver : public CaDiCaL::Learner { // void AddLearnedClause(PredicateNormalizer& pn, const std::vector& conflicting_conjunction, const Box& box); - PatternMatchingTrie::matching_stats_t AddLearnedClausePattern( + matching_stats_t AddLearnedClausePattern( PredicateNormalizer& pn, const std::vector& base_conflict, const Box& base_box, std::chrono::duration timeout); diff --git a/src/dreal/solver/sat_solver_interval_logic.cc b/src/dreal/solver/sat_solver_interval_logic.cc index faec691c3..151dd0061 100644 --- a/src/dreal/solver/sat_solver_interval_logic.cc +++ b/src/dreal/solver/sat_solver_interval_logic.cc @@ -136,7 +136,7 @@ namespace dreal } }*/ - PatternMatchingTrie::matching_stats_t SatSolver::AddLearnedClausePattern( + matching_stats_t SatSolver::AddLearnedClausePattern( PredicateNormalizer& pn, const std::vector& base_conflict, const Box& base_box, const std::chrono::duration timeout diff --git a/src/dreal/util/pattern_matching/matching_stats_t.h b/src/dreal/util/pattern_matching/matching_stats_t.h new file mode 100644 index 000000000..f2f9b9624 --- /dev/null +++ b/src/dreal/util/pattern_matching/matching_stats_t.h @@ -0,0 +1,24 @@ +// +// Created by Kunal Sheth on 12/27/25. +// + +#ifndef DREAL4_CMAKE_MATCHING_STATS_T_H +#define DREAL4_CMAKE_MATCHING_STATS_T_H + +typedef struct +{ + struct + { + unsigned bc_structure; + unsigned bc_indices; + unsigned bc_type; + unsigned bc_box; + unsigned bc_bij; + unsigned bc_const; + } misses; + + unsigned partial_matches; + unsigned matches; +} matching_stats_t; + +#endif //DREAL4_CMAKE_MATCHING_STATS_T_H \ No newline at end of file diff --git a/src/dreal/util/pattern_matching/pattern_matching_heuristic.h b/src/dreal/util/pattern_matching/pattern_matching_heuristic.h index 7e358b76c..153e74662 100644 --- a/src/dreal/util/pattern_matching/pattern_matching_heuristic.h +++ b/src/dreal/util/pattern_matching/pattern_matching_heuristic.h @@ -6,7 +6,7 @@ #define PATTERN_MATCHING_HEURISTIC_H #include -#include "pattern_matching_trie.h" +#include "matching_stats_t.h" namespace dreal { @@ -31,7 +31,7 @@ namespace dreal PredicateHeuristic::predicate_stats_t smallest_literal_stats; uint64_t estimated_matching_cost; double pattern_match_ms; - PatternMatchingTrie::matching_stats_t pattern_matching_stats; + matching_stats_t pattern_matching_stats; }; // todo: I have no idea why, but passing const ref instead of copying BREAKS it?!?!?! @@ -44,4 +44,4 @@ namespace dreal }; } -#endif //PATTERN_MATCHING_HEURISTIC_H +#endif //PATTERN_MATCHING_HEURISTIC_H \ No newline at end of file diff --git a/src/dreal/util/pattern_matching/substitutions_map.h b/src/dreal/util/pattern_matching/substitutions_map.h index cad1cb22f..e31b9579a 100644 --- a/src/dreal/util/pattern_matching/substitutions_map.h +++ b/src/dreal/util/pattern_matching/substitutions_map.h @@ -16,7 +16,7 @@ namespace dreal std::unordered_map fwd; std::unordered_map bwd; std::vector>> insertion_stack{1}; - const Box &box; + const Box& box; public: const std::unordered_map& get_map() const { return fwd; } @@ -25,7 +25,7 @@ namespace dreal // substitutions_map(); // explicit substitutions_map(Box b); // explicit substitutions_map(size_t reserve); - substitutions_map(const Box &b, size_t reserved_size); + substitutions_map(const Box& b, size_t reserved_size); // "forward" takes the matched and maps it to original // "backward" takes original and maps it to matched @@ -46,7 +46,7 @@ namespace dreal } // [[nodiscard]] static Box apply_substitution( - // const Box& b, const substitutions_map& subs, bool backward = false + // const Box& b, const substitutions_map& subs, bool backward = false // ); void push(); @@ -70,4 +70,4 @@ namespace dreal }; } -#endif //substitutions_mapH +#endif //substitutions_mapH \ No newline at end of file diff --git a/src/dreal/util/pattern_matching/pattern_matching_trie.h b/src/dreal/util/pattern_matching/trie_based/pattern_matching_trie.h similarity index 97% rename from src/dreal/util/pattern_matching/pattern_matching_trie.h rename to src/dreal/util/pattern_matching/trie_based/pattern_matching_trie.h index 16f872ef7..f3e1aa3c4 100644 --- a/src/dreal/util/pattern_matching/pattern_matching_trie.h +++ b/src/dreal/util/pattern_matching/trie_based/pattern_matching_trie.h @@ -11,26 +11,13 @@ #include "dreal/symbolic/symbolic.h" #include "dreal/util/box.h" +#include "dreal/util/pattern_matching/matching_stats_t.h" namespace dreal { class PatternMatchingTrie { public: - typedef struct - { - struct - { - unsigned bc_type; - unsigned bc_box; - unsigned bc_bij; - unsigned bc_const; - } misses; - - unsigned partial_matches; - unsigned matches; - } matching_stats_t; - static std::string matching_stats_csv_header(const std::string& prefix) { std::ostringstream s; s << prefix << "misses,"; @@ -367,7 +354,7 @@ namespace dreal ); }; - // inline std::ostream& operator<<(std::ostream& os, const PatternMatchingTrie::matching_stats_t& stats) { + // inline std::ostream& operator<<(std::ostream& os, const matching_stats_t& stats) { // os << "matching_stats_t {\n" // << " misses {\n" // << " bc_type: " << stats.misses.bc_type << ",\n" diff --git a/src/dreal/util/pattern_matching/pattern_matching_trie_expr.cc b/src/dreal/util/pattern_matching/trie_based/pattern_matching_trie_expr.cc similarity index 100% rename from src/dreal/util/pattern_matching/pattern_matching_trie_expr.cc rename to src/dreal/util/pattern_matching/trie_based/pattern_matching_trie_expr.cc diff --git a/src/dreal/util/pattern_matching/pattern_matching_trie_form.cc b/src/dreal/util/pattern_matching/trie_based/pattern_matching_trie_form.cc similarity index 100% rename from src/dreal/util/pattern_matching/pattern_matching_trie_form.cc rename to src/dreal/util/pattern_matching/trie_based/pattern_matching_trie_form.cc diff --git a/src/dreal/util/pattern_matching/pattern_matching_trie_general.cc b/src/dreal/util/pattern_matching/trie_based/pattern_matching_trie_general.cc similarity index 97% rename from src/dreal/util/pattern_matching/pattern_matching_trie_general.cc rename to src/dreal/util/pattern_matching/trie_based/pattern_matching_trie_general.cc index b339a9f76..d06975023 100644 --- a/src/dreal/util/pattern_matching/pattern_matching_trie_general.cc +++ b/src/dreal/util/pattern_matching/trie_based/pattern_matching_trie_general.cc @@ -12,10 +12,12 @@ #include #include +#include "dreal/util/pattern_matching/matching_stats_t.h" + namespace dreal { void handle_misses_reason( - PatternMatchingTrie::matching_stats_t& stats, + matching_stats_t& stats, const substitutions_map::substitution_status& status ) { // TYPE_MISS, BOX_MISS, BIJ_MISS, CONST_MISS @@ -25,7 +27,7 @@ namespace dreal if (status == substitutions_map::CONST_MISS) stats.misses.bc_const++; } - std::pair, substitutions_map>>, PatternMatchingTrie::matching_stats_t> + std::pair, substitutions_map>>, matching_stats_t> PatternMatchingTrie::find_matches( const std::vector& literals, const Box& box, const std::chrono::duration timeout @@ -111,7 +113,7 @@ namespace dreal return {result, stats}; } - std::pair>, PatternMatchingTrie::matching_stats_t> + std::pair>, matching_stats_t> PatternMatchingTrie::find_matches( const Formula& f, substitutions_map& substitutions @@ -136,7 +138,7 @@ namespace dreal return {match_vec, stats}; } - std::pair>, PatternMatchingTrie::matching_stats_t> + std::pair>, matching_stats_t> PatternMatchingTrie::find_matches( const Expression& e, substitutions_map& substitutions diff --git a/src/dreal/util/predicate_normalizer.cc b/src/dreal/util/predicate_normalizer.cc index e878881e7..2945ef568 100644 --- a/src/dreal/util/predicate_normalizer.cc +++ b/src/dreal/util/predicate_normalizer.cc @@ -21,7 +21,7 @@ namespace dreal { - std::pair, substitutions_map>>, PatternMatchingTrie::matching_stats_t> + std::pair, substitutions_map>>, matching_stats_t> PredicateNormalizer::FindSimilar( const std::vector& ordered_clause, const Box &box, const std::chrono::duration timeout diff --git a/src/dreal/util/predicate_normalizer.h b/src/dreal/util/predicate_normalizer.h index 02bc1f2ca..5a057af5f 100644 --- a/src/dreal/util/predicate_normalizer.h +++ b/src/dreal/util/predicate_normalizer.h @@ -17,7 +17,7 @@ #include #include -#include +#include "pattern_matching/trie_based/pattern_matching_trie.h" #include "predicate_heuristic.h" #include "dreal/symbolic/symbolic.h" @@ -30,10 +30,8 @@ namespace dreal Formula Convert(const Formula& f); [[nodiscard]] std::pair< - std::vector, substitutions_map>>, PatternMatchingTrie:: - matching_stats_t - > - FindSimilar( + std::vector, substitutions_map>>, matching_stats_t + > FindSimilar( const std::vector& ordered_clause, const Box& b, std::chrono::duration timeout = std::chrono::microseconds{-1} ) const; diff --git a/test/dreal/util/test/pattern_matching_test.cc b/test/dreal/util/test/pattern_matching_test.cc index 8502b773f..48477d21d 100644 --- a/test/dreal/util/test/pattern_matching_test.cc +++ b/test/dreal/util/test/pattern_matching_test.cc @@ -14,12 +14,9 @@ limitations under the License. */ #include +#include #include - -#include "dreal/solver/filter_assertion.h" - #include - #include "dreal/symbolic/symbolic.h" namespace dreal From ddc6a45040176cb72203e57faa987b72d1bf253f Mon Sep 17 00:00:00 2001 From: Kunal Sheth Date: Sat, 27 Dec 2025 01:28:35 -0800 Subject: [PATCH 08/43] Implement DeBruijn/Hashing-based pattern matcher. --- .../map_based/DeBruijnCanonicalizer.cc | 397 ++++++++++++++++++ .../map_based/DeBruijnCanonicalizer.h | 113 +++++ .../util/pattern_matching/substitutions_map.h | 2 +- src/dreal/util/predicate_normalizer.h | 1 + test/dreal/util/test/pattern_matching_test.cc | 32 +- 5 files changed, 522 insertions(+), 23 deletions(-) create mode 100644 src/dreal/util/pattern_matching/map_based/DeBruijnCanonicalizer.cc create mode 100644 src/dreal/util/pattern_matching/map_based/DeBruijnCanonicalizer.h diff --git a/src/dreal/util/pattern_matching/map_based/DeBruijnCanonicalizer.cc b/src/dreal/util/pattern_matching/map_based/DeBruijnCanonicalizer.cc new file mode 100644 index 000000000..ec4f178dd --- /dev/null +++ b/src/dreal/util/pattern_matching/map_based/DeBruijnCanonicalizer.cc @@ -0,0 +1,397 @@ +// +// Created by Kunal Sheth on 12/24/25. +// + +#include "DeBruijnCanonicalizer.h" + +#include "dreal/version.h" +#include "dreal/smt2/term.h" +#include "dreal/symbolic/symbolic_expression_cell.h" +#include "dreal/symbolic/odes/symbolic_odes_cell.h" +#include "dreal/util/assert.h" +#include "dreal/util/exception.h" +#include "dreal/util/logging.h" + +namespace dreal +{ +#define RECURSE(sub) VisitExpression(this, (sub), canon_var_seq); +#define RECURSEF(sub) VisitFormula(this, (sub), canon_var_seq); + + template + void DeBruijnCanonicalizer::insert_unary(const Expression& e, std::vector& canon_var_seq) const { + RECURSE(get_argument(e)); + } + + template + void DeBruijnCanonicalizer::insert_binary(const Expression& e, std::vector& canon_var_seq) const { + RECURSE(get_first_argument(e)); + RECURSE(get_second_argument(e)); + } + + template + void DeBruijnCanonicalizer::insert_binary(const Formula& f, std::vector& canon_var_seq) const { + RECURSE(get_lhs_expression(f)); + RECURSE(get_rhs_expression(f)); + } + + template + void DeBruijnCanonicalizer::insert_nary(const Formula& f, std::vector& canon_var_seq) const { + const auto& ops = get_operands(f); + using OSet = std::set; + std::vector order; + order.reserve(ops.size()); + for (/*copy*/ auto it = ops.cbegin(); it != ops.cend(); ++it) order.emplace_back(it); + std::sort(order.begin(), order.end(), + [](const auto& A, const auto& B) { return A->get_al_hash() < B->get_al_hash(); }); + for (const auto& it : order) + RECURSEF(*it); + } + + void add_variable_to_seq(const Variable& v, std::vector& canon_var_seq) { + // if (std::find(canon_var_seq.cbegin(), canon_var_seq.cend(), v) == canon_var_seq.cend()) + canon_var_seq.emplace_back(v); + } + +#define INSERT_DECL(name) \ +template \ +void DeBruijnCanonicalizer::name ( \ + const Expression &e, \ + std::vector& canon_var_seq \ +) const + + INSERT_DECL(VisitVariable) { add_variable_to_seq(get_variable(e), canon_var_seq); } + + INSERT_DECL(VisitConstant) { DREAL_ASSERT(e.GetVariables().size() == 0); } + INSERT_DECL(VisitRealConstant) { DREAL_ASSERT(e.GetVariables().size() == 0); } + + INSERT_DECL(VisitAddition) { + const auto& a = to_addition(e); + using ECMap = std::map; + const ECMap& m = a->get_expr_to_coeff_map(); + + std::vector order; + order.reserve(m.size()); + for (/*copy*/auto it = m.cbegin(); it != m.cend(); ++it) order.emplace_back(it); + std::sort(order.begin(), order.end(), + [](const auto& A, const auto& B) { return A->first.get_al_hash() < B->first.get_al_hash(); }); + + for (const auto& it : order) { + const auto& [expr, coeff] = *it; + RECURSE(expr); + // RECURSE(coeff); // double. + } + } + + INSERT_DECL(VisitMultiplication) { + const auto& a = to_multiplication(e); + using BEMap = std::map; + const BEMap& m = a->get_base_to_exponent_map(); + + std::vector order; + order.reserve(m.size()); + for (/*copy*/ auto it = m.cbegin(); it != m.cend(); ++it) order.emplace_back(it); + std::sort(order.begin(), order.end(), + [](const auto& A, const auto& B) { return A->first.get_al_hash() < B->first.get_al_hash(); }); + + for (const auto& it : order) { + const auto& [expr, coeff] = *it; + RECURSE(expr); + RECURSE(coeff); + } + } + + INSERT_DECL(VisitDivision) { insert_binary(e, canon_var_seq); } + INSERT_DECL(VisitLog) { insert_unary(e, canon_var_seq); } + INSERT_DECL(VisitAbs) { insert_unary(e, canon_var_seq); } + INSERT_DECL(VisitExp) { insert_unary(e, canon_var_seq); } + INSERT_DECL(VisitSqrt) { insert_unary(e, canon_var_seq); } + INSERT_DECL(VisitPow) { insert_binary(e, canon_var_seq); } + INSERT_DECL(VisitSin) { insert_unary(e, canon_var_seq); } + INSERT_DECL(VisitCos) { insert_unary(e, canon_var_seq); } + INSERT_DECL(VisitTan) { insert_unary(e, canon_var_seq); } + INSERT_DECL(VisitAsin) { insert_unary(e, canon_var_seq); } + INSERT_DECL(VisitAcos) { insert_unary(e, canon_var_seq); } + INSERT_DECL(VisitAtan) { insert_unary(e, canon_var_seq); } + INSERT_DECL(VisitAtan2) { insert_binary(e, canon_var_seq); } + INSERT_DECL(VisitSinh) { insert_unary(e, canon_var_seq); } + INSERT_DECL(VisitCosh) { insert_unary(e, canon_var_seq); } + INSERT_DECL(VisitTanh) { insert_unary(e, canon_var_seq); } + INSERT_DECL(VisitMin) { insert_binary(e, canon_var_seq); } + INSERT_DECL(VisitMax) { insert_binary(e, canon_var_seq); } + INSERT_DECL(VisitIfThenElse) { + const auto& ite = to_if_then_else(e); + RECURSEF(ite->get_conditional_formula()); + RECURSE(ite->get_then_expression()); + RECURSE(ite->get_else_expression()); + } + + INSERT_DECL(VisitUninterpretedFunction) { + throw DREAL_RUNTIME_ERROR("DeBruin Canonicalization not implemented for uninterpreted functions yet."); + } + +#undef INSERT_DECL +#define INSERT_DECL(name) \ +template \ +void DeBruijnCanonicalizer::name ( \ + const Formula &f, \ + std::vector& canon_var_seq \ +) const + + INSERT_DECL(VisitFalse) { DREAL_ASSERT(f.GetFreeVariables().size() == 0); } + INSERT_DECL(VisitTrue) { DREAL_ASSERT(f.GetFreeVariables().size() == 0); } + + INSERT_DECL(VisitVariable) { add_variable_to_seq(get_variable(f), canon_var_seq); } + + INSERT_DECL(VisitEqualTo) { insert_binary(f, canon_var_seq); } + INSERT_DECL(VisitNotEqualTo) { insert_binary(f, canon_var_seq); } + INSERT_DECL(VisitGreaterThan) { insert_binary(f, canon_var_seq); } + INSERT_DECL(VisitGreaterThanOrEqualTo) { insert_binary(f, canon_var_seq); } + INSERT_DECL(VisitLessThan) { insert_binary(f, canon_var_seq); } + INSERT_DECL(VisitLessThanOrEqualTo) { insert_binary(f, canon_var_seq); } + INSERT_DECL(VisitConjunction) { insert_nary(f, canon_var_seq); } + INSERT_DECL(VisitDisjunction) { insert_nary(f, canon_var_seq); } + INSERT_DECL(VisitNegation) { RECURSEF(get_operand(f)); } + + INSERT_DECL(VisitForall) { + throw DREAL_RUNTIME_ERROR("DeBruin Canonicalization not implemented for quantifiers yet."); + } + + INSERT_DECL(VisitForallT) { + const auto& a = to_forallT(f); + RECURSE(a->get_lb()); + RECURSE(a->get_ub()); + RECURSEF(a->get_bound_f()); + } + + INSERT_DECL(VisitIntegral) { + const auto& i = to_integral(f); + RECURSE(i->get_time_0()); + RECURSE(i->get_time_t()); + for (const auto& v0 : i->get_vec_0()) + RECURSE(v0); + for (const auto& vt : i->get_vec_t()) + RECURSE(vt); + } + +#undef INSERT_DECL + + + const Variables& GetVars(const Formula& f) { return f.GetFreeVariables(); } + const Variables& GetVars(const Expression& e) { return e.GetVariables(); } + + void Visit(const DeBruijnCanonicalizer* const v, const Expression& e, std::vector& cvs) { return VisitExpression(v, e, cvs); } + void Visit(const DeBruijnCanonicalizer* const v, const Formula& f, std::vector& cvs) { return VisitFormula(v, f, cvs); } + + template + std::tuple::DeBruijnIndices, std::vector> DeBruijnCanonicalizer::canonicalize_atom(const T& atom) const { + std::vector canonical_variable_sequence; + canonical_variable_sequence.reserve(GetVars(atom).size() * 2); + + Visit(this, atom, canonical_variable_sequence); + + DeBruijnIndices indices; + std::vector concrete_vars; + indices.reserve(canonical_variable_sequence.size()); + concrete_vars.reserve(GetVars(atom).size()); + + Variable::Id next_dummy_idx = 0; + + std::unordered_map as; + FormulaSubstitution fs; + ExpressionSubstitution es; + as.reserve(GetVars(atom).size()); + fs.reserve(GetVars(atom).size()); + es.reserve(GetVars(atom).size()); + + for (const auto& v : canonical_variable_sequence) { + Variable dummy; + const auto it = as.find(v); + if (it == as.cend()) { + dummy = Variable(--next_dummy_idx, v.get_type()); + as.emplace(v, dummy); + if (v.get_type() == Variable::Type::BOOLEAN) fs.emplace(v, dummy); + else es.emplace(v, dummy); + concrete_vars.emplace_back(v); + DREAL_ASSERT(concrete_vars.size() == -dummy.get_id()); + } + else dummy = it->second; + indices.emplace_back(-dummy.get_id() - 1); + } + + const auto structure = atom.Substitute(es, fs); + return {std::move(structure), std::move(indices), std::move(concrete_vars)}; + } + + template + void DeBruijnCanonicalizer::insert(const T& atom) { + auto [structure, indices, concrete_vars] = canonicalize_atom(atom); + const auto [it, _] = structure_to_indices_to_concrete.try_emplace(std::move(structure)); + const auto& canon_structure = it->first; // canonicalizes underlying FormulaCell ptr if it already existed in the map. + + DeBruijnEquivalenceClass& concretes = it->second[indices]; + DREAL_ASSERT(it->second.size() == 1); // We shouldn't need this middle layer... indices should be baked into the dummy variable names. todo: remove. + + auto [concrete_it, was_inserted] = concretes.try_emplace(concrete_vars, atom); + + if (!was_inserted) { + DREAL_ASSERT(atom.EqualTo(concrete_it->second)); + // throw DREAL_RUNTIME_ERROR( + // "DeBruijn concrete instantiation already exists: {} <-> {}", + // atom.to_string(), canon_structure.to_string() + // ); + } + + canonicalization_cache.try_emplace(atom, canon_structure, std::move(indices), std::move(concrete_vars)); + } + + template + void DeBruijnCanonicalizer::find_matches( + const T& atom, substitutions_map& subs, const matches_vec& matches, const misses_vec& misses + ) const { + const auto init_size = subs.size(); + + const auto cache_it = canonicalization_cache.find(atom); + const auto& [structure, indices, concrete_vars] = ( + cache_it == canonicalization_cache.cend() ? canonicalize_atom(atom) : cache_it->second + ); + + const auto indices_to_concrete_it = structure_to_indices_to_concrete.find(structure); + if (indices_to_concrete_it == structure_to_indices_to_concrete.cend()) return misses(substitutions_map::STRUCTURE_MISS); + const auto& indices_to_concrete = indices_to_concrete_it->second; + const auto concrete_it = indices_to_concrete.find(indices); + if (concrete_it == indices_to_concrete.cend()) return misses(substitutions_map::INDICES_MISS); + const auto& concrete = concrete_it->second; + + for (const auto& [match_vars, match] : concrete /*structure_to_indices_to_concrete[structure][indices]*/) { + subs.push(); + + auto status = substitutions_map::SUCCESS; + DREAL_ASSERT(concrete_vars.size() == match_vars.size()); + for (int i = 0; i < concrete_vars.size(); ++i) { + status = subs.attempt_substitution(match_vars[i], concrete_vars[i]); + if (status != substitutions_map::SUCCESS) { + misses(status); + break; + } + } + if (status == substitutions_map::SUCCESS) matches(match, subs); + + subs.pop(); + } + + DREAL_ASSERT(subs.size() == init_size); + return; + } + + template + void handle_misses_reason( + matching_stats_t& stats, + const substitutions_map::substitution_status& status + ) { + // TYPE_MISS, BOX_MISS, BIJ_MISS, CONST_MISS + if (status == substitutions_map::STRUCTURE_MISS) ++stats.misses.bc_structure; + else if (status == substitutions_map::INDICES_MISS) ++stats.misses.bc_indices; + else if (status == substitutions_map::TYPE_MISS) ++stats.misses.bc_type; + else if (status == substitutions_map::BOX_MISS) ++stats.misses.bc_box; + else if (status == substitutions_map::BIJ_MISS) ++stats.misses.bc_bij; + else if (status == substitutions_map::CONST_MISS) ++stats.misses.bc_const; + else + DREAL_UNREACHABLE(); + } + + template + std::pair>, matching_stats_t> DeBruijnCanonicalizer::find_matches(const T& f, const Box& box) { + substitutions_map s(box, GetVars(f).size()); + + matching_stats_t stats = {0}; + std::vector> match_vec; + + find_matches( + f, s, + [&](const auto& m, const auto& s) { + ++stats.matches; + match_vec.emplace_back(m, s); + }, + [&](const auto& reason) { handle_misses_reason(stats, reason); } + ); + + return {std::move(match_vec), std::move(stats)}; + } + + template + std::pair, substitutions_map>>, matching_stats_t> DeBruijnCanonicalizer::find_matches( + const std::vector& literals, const Box& box, std::chrono::duration timeout) const { + matching_stats_t stats = {0}; + std::vector matches_vec; + std::vector, substitutions_map>> result; + matches_vec.reserve(literals.size()); + + const auto start_time = std::chrono::steady_clock::now(); + + const misses_vec misses = [&](const auto& reason) { handle_misses_reason(stats, reason); }; + + bool did_time_out = false; + + const auto ibegin = literals.begin(); + const auto iend = literals.end(); + // std::unordered_set seen_truncateds; // lexo-compare for nary goes one by one... + // seen_truncateds.reserve(1024 * literals.size()); + std::function< + std::function(typeof(ibegin)) + > match_next_literal = [&](const auto& it1) { + return [&, /*copy*/ it1](const auto& f, auto& s2) { + if (did_time_out || std::chrono::steady_clock::now() - start_time > timeout) { + did_time_out = true; + return; + } + + matches_vec.emplace_back(f); + + // avoid re-finding 1000s of permutations of the same clause on fedor_13.smt2, etc. + // copy required. do NOT modify matches_vec... that needs to be a pure stack + std::set matches_vec_set(matches_vec.begin(), matches_vec.end()); + // const auto [_, successful_emplace] = seen_truncateds.emplace( + // make_conjunction_SKIP_CHECKS_KUNAL_HACK(std::move(matches_vec_set)) + // ); + // if (!successful_emplace) { + // matches_vec.pop_back(); + // return; + // } + + auto it2 = it1; + ++it2; + // stats.partial_matches++; + if (it2 == iend) { + DREAL_ASSERT(matches_vec.size() == literals.size()); + if (DREAL_EXPERIMENTAL_THEORY_AUDIT_ENABLED) + for (const auto& lit : matches_vec) + DREAL_ASSERT(std::find(literals.begin(), literals.end(), substitutions_map::apply_substitution(lit, s2, false)) != literals.end()); + ++stats.matches; + result.emplace_back(matches_vec, s2); + } + else find_matches(*it2, s2, match_next_literal(it2), misses); + matches_vec.pop_back(); + }; + }; + + size_t sub_preallocations = 0; + for (const auto& literal : literals) sub_preallocations += GetVars(literal).size(); + substitutions_map substitutions(box, sub_preallocations); + find_matches(*ibegin, substitutions, match_next_literal(ibegin), misses); + + DREAL_ASSERT(result.size() == stats.matches); + if (did_time_out) + DREAL_LOG_INFO("Pattern matching timed out after {} usec.", timeout.count()); + return {result, stats}; + } + + template + DeBruijnCanonicalizer::DeBruijnCanonicalizer() { + canonicalization_cache.max_load_factor(0.25); + structure_to_indices_to_concrete.max_load_factor(0.25); + } + + // Force template code generation into this translation unit. + template class DeBruijnCanonicalizer; + template class DeBruijnCanonicalizer; +} diff --git a/src/dreal/util/pattern_matching/map_based/DeBruijnCanonicalizer.h b/src/dreal/util/pattern_matching/map_based/DeBruijnCanonicalizer.h new file mode 100644 index 000000000..ee3460c51 --- /dev/null +++ b/src/dreal/util/pattern_matching/map_based/DeBruijnCanonicalizer.h @@ -0,0 +1,113 @@ +// +// Created by Kunal Sheth on 12/24/25. +// + +#ifndef DREAL4_CMAKE_DEBRUIJNCANONICALIZER_H +#define DREAL4_CMAKE_DEBRUIJNCANONICALIZER_H + +#include "DeBruijnCanonicalizer.h" + +#include "dreal/symbolic/symbolic.h" +#include "dreal/util/exception.h" +#include "dreal/util/pattern_matching/matching_stats_t.h" +#include "dreal/util/pattern_matching/substitutions_map.h" + +namespace dreal +{ + template + class DeBruijnCanonicalizer + { + private: + using DeBruijnIndices = std::vector; + using DeBruijnEquivalenceClass = std::map, T>; + + std::unordered_map>> canonicalization_cache; + std::unordered_map> structure_to_indices_to_concrete; + + std::tuple> + canonicalize_atom(const T& atom) const; + + using matches_vec = std::function; + using misses_vec = std::function; + void find_matches( + const T& f, substitutions_map& substitutions, const matches_vec& matches, const misses_vec& misses + ) const; + + public: + DeBruijnCanonicalizer(); + + void insert(const T& atom); + + [[nodiscard]] std::pair, substitutions_map>>, matching_stats_t> + find_matches( + const std::vector& literals, + const Box& b, std::chrono::duration timeout = std::chrono::microseconds{-1} + ) const; + + + [[nodiscard]] std::pair>, matching_stats_t> find_matches( + const T& f, const Box& box + ); + + +#define INSERT_DECL(name) void name ( \ + const Expression &e, \ + std::vector& canon_var_seq \ +) const + INSERT_DECL(VisitVariable); + INSERT_DECL(VisitConstant); + INSERT_DECL(VisitRealConstant); + INSERT_DECL(VisitAddition); + INSERT_DECL(VisitMultiplication); + INSERT_DECL(VisitDivision); + INSERT_DECL(VisitLog); + INSERT_DECL(VisitAbs); + INSERT_DECL(VisitExp); + INSERT_DECL(VisitSqrt); + INSERT_DECL(VisitPow); + INSERT_DECL(VisitSin); + INSERT_DECL(VisitCos); + INSERT_DECL(VisitTan); + INSERT_DECL(VisitAsin); + INSERT_DECL(VisitAcos); + INSERT_DECL(VisitAtan); + INSERT_DECL(VisitAtan2); + INSERT_DECL(VisitSinh); + INSERT_DECL(VisitCosh); + INSERT_DECL(VisitTanh); + INSERT_DECL(VisitMin); + INSERT_DECL(VisitMax); + INSERT_DECL(VisitIfThenElse); + INSERT_DECL(VisitUninterpretedFunction); +#undef INSERT_DECL + +#define INSERT_DECL(name) void name ( \ +const Formula &f, \ +std::vector& canon_var_seq \ +) const + INSERT_DECL(VisitFalse); + INSERT_DECL(VisitTrue); + INSERT_DECL(VisitVariable); + INSERT_DECL(VisitEqualTo); + INSERT_DECL(VisitNotEqualTo); + INSERT_DECL(VisitGreaterThan); + INSERT_DECL(VisitGreaterThanOrEqualTo); + INSERT_DECL(VisitLessThan); + INSERT_DECL(VisitLessThanOrEqualTo); + INSERT_DECL(VisitConjunction); + INSERT_DECL(VisitDisjunction); + INSERT_DECL(VisitNegation); + INSERT_DECL(VisitForall); + INSERT_DECL(VisitForallT); + INSERT_DECL(VisitIntegral); +#undef INSERT_DECL + + private: + void insert_nary(const Formula& f, std::vector& canon_var_seq) const; + void insert_binary(const Formula& f, std::vector& canon_var_seq) const; + + void insert_binary(const Expression& f, std::vector& canon_var_seq) const; + void insert_unary(const Expression& f, std::vector& canon_var_seq) const; + }; +} +#endif //DREAL4_CMAKE_DEBRUIJNCANONICALIZER_H diff --git a/src/dreal/util/pattern_matching/substitutions_map.h b/src/dreal/util/pattern_matching/substitutions_map.h index e31b9579a..efd39190d 100644 --- a/src/dreal/util/pattern_matching/substitutions_map.h +++ b/src/dreal/util/pattern_matching/substitutions_map.h @@ -55,7 +55,7 @@ namespace dreal typedef enum { - SUCCESS, TYPE_MISS, BOX_MISS, BIJ_MISS, CONST_MISS + SUCCESS, STRUCTURE_MISS, INDICES_MISS, TYPE_MISS, BOX_MISS, BIJ_MISS, CONST_MISS } substitution_status; substitution_status attempt_substitution(const Variable& a, const Variable& aP); diff --git a/src/dreal/util/predicate_normalizer.h b/src/dreal/util/predicate_normalizer.h index 5a057af5f..50c42a8b7 100644 --- a/src/dreal/util/predicate_normalizer.h +++ b/src/dreal/util/predicate_normalizer.h @@ -21,6 +21,7 @@ #include "predicate_heuristic.h" #include "dreal/symbolic/symbolic.h" +#include "pattern_matching/map_based/DeBruijnCanonicalizer.h" namespace dreal { diff --git a/test/dreal/util/test/pattern_matching_test.cc b/test/dreal/util/test/pattern_matching_test.cc index 48477d21d..0025e1e24 100644 --- a/test/dreal/util/test/pattern_matching_test.cc +++ b/test/dreal/util/test/pattern_matching_test.cc @@ -13,8 +13,8 @@ See the License for the specific language governing permissions and limitations under the License. */ -#include #include +#include #include #include #include "dreal/symbolic/symbolic.h" @@ -85,10 +85,13 @@ namespace dreal const T1& pattern, const std::vector& matches, const std::vector& misses1, const std::vector& misses2 = {} ) { - PatternMatchingTrie trie; + // PatternMatchingTrie trie; + // PatternMatchingTrie &trie2 = trie; + DeBruijnCanonicalizer trie; + DeBruijnCanonicalizer trie2; for (const auto& match : matches) trie.insert(match); for (const auto& miss : misses1) trie.insert(miss); - for (const auto& miss : misses2) trie.insert(miss); + for (const auto& miss : misses2) trie2.insert(miss); std::set found; for (const auto& [form, subs] : trie.find_matches(pattern, Box{}).first) { // check substitutions are correct and injective: @@ -115,13 +118,14 @@ namespace dreal for (const auto& miss : misses1) { EXPECT_EQ(found.count(miss), 0); std::cout << pattern << " MISSES " << miss << std::endl; - // EXPECT_NE(miss.get_al_hash(), pattern.get_al_hash()); + // EXPECT_NE(miss.get_al_hash(), pattern.get_al_hash()); // Close!! but not quite for valid reasons... } } // tests. TEST_F(PatternMatchingTest, SimpleClauseFinder) { - PatternMatchingTrie trie; + // PatternMatchingTrie trie; + DeBruijnCanonicalizer trie; std::set literals{ y1 == sin(x1), y2 == sin(x2), @@ -145,7 +149,6 @@ namespace dreal } TEST_F(PatternMatchingTest, ForallTExpressions) { - PatternMatchingTrie trie; auto pattern = forallT(flow1, 0, t1, (x1 < 2) && (y1 > 3)); std::vector matches{ @@ -176,7 +179,6 @@ namespace dreal } TEST_F(PatternMatchingTest, IntegralExpressions) { - PatternMatchingTrie trie; auto pattern = integral(t0, t1, {x1, x2}, {y1, y2}, flow2); std::vector matches{ @@ -208,7 +210,6 @@ namespace dreal } TEST_F(PatternMatchingTest, ComplicatedIteExpression) { - PatternMatchingTrie trie; auto fs_monster = if_then_else( if_then_else(Formula{b1}, x1, x2) < 5, if_then_else(Formula{b2}, y1, y2), @@ -282,7 +283,6 @@ namespace dreal } TEST_F(PatternMatchingTest, SimpleIteExpression) { - PatternMatchingTrie trie; auto pattern = if_then_else(x1 > x2, y1 * 2, tanh(z1 / 3 + 4)); std::vector matches{ @@ -301,7 +301,6 @@ namespace dreal } TEST_F(PatternMatchingTest, ComplicatedBooleanFormulas) { - PatternMatchingTrie trie; auto epattern = (x1 < x2) || (x2 > x1) || !((y1 <= y2) && (y2 >= y1)); auto pattern = !(b1 && b2) || !(b2 || b3) && (b4 || epattern); @@ -361,7 +360,6 @@ namespace dreal // aims to find Continuation-Passing-Style related bugs in lambda capture of iterator references/objects // like those found in `NaryOpMatchHelper` by `ComplicatedBooleanFormulas` test. - PatternMatchingTrie trie; auto epattern = (x1 / x2) + max(x2, x1) + -(atan2(y1, y2) * min(y2, y1)); auto pattern = -(z1 * z2) + -(z2 + z3) * (z4 + epattern); @@ -407,8 +405,6 @@ namespace dreal } TEST_F(PatternMatchingTest, SimpleBooleanFormulas) { - PatternMatchingTrie trie; - auto pattern = (b1 || !b2 || !b3) && b2 && b3; std::vector matches{ (b1 || !b2 || !b3) && b2 && b3, @@ -434,7 +430,6 @@ namespace dreal TEST_F(PatternMatchingTest, ComplicatedMultiplicationExpression) { GTEST_SKIP(); // broken after adding alpha hashing due to order of construction - PatternMatchingTrie trie; std::vector es{ tanh(4 * x1 + 3), atan2((y2 - y1), (x2 - x1)), @@ -497,7 +492,6 @@ namespace dreal } TEST_F(PatternMatchingTest, SimpleMultiplicationExpression) { - PatternMatchingTrie trie; auto pattern = 3 * pow(x1, 4) * pow(5, x2); std::vector matches{ @@ -516,7 +510,6 @@ namespace dreal } TEST_F(PatternMatchingTest, ComplicatedAdditionExpression) { - PatternMatchingTrie trie; auto pattern = 10 + 15 * x1 + 13.5 * tan(y1) + 8 + 45 * (z1 / pow(z1, x1)); std::vector matches{ @@ -538,7 +531,6 @@ namespace dreal } TEST_F(PatternMatchingTest, SimpleRealConstantAdditionExpression) { - PatternMatchingTrie trie; auto pattern = 3 + rc(4, true) * x1 + 5 * x2; std::vector matches{ @@ -558,7 +550,6 @@ namespace dreal } TEST_F(PatternMatchingTest, SimpleAdditionExpression) { - PatternMatchingTrie trie; auto pattern = 3 + 4 * x1 + 5 * x2; std::vector matches{ @@ -576,7 +567,6 @@ namespace dreal } TEST_F(PatternMatchingTest, BinaryExpression) { - PatternMatchingTrie trie; auto pattern = x1 / pow(1 + y1, z1); std::vector matches{ @@ -598,7 +588,6 @@ namespace dreal } TEST_F(PatternMatchingTest, SimpleRealConstantExpression) { - PatternMatchingTrie trie; auto pattern = tan(x1 / rc(0.5)); std::vector matches{ @@ -617,7 +606,7 @@ namespace dreal } TEST_F(PatternMatchingTest, BinaryAndUnaryOpsComplete) { - PatternMatchingTrie trie; + DeBruijnCanonicalizer trie; std::vector es{ // for coverage... make sure we didn't mess up call of the unary/binary op helper functions. x1 / x2, log(x1), abs(x1), exp(x1), sqrt(x1), pow(x1, x2), sin(x1), cos(x1), tan(x1), asin(x1), acos(x1), atan(x1), atan2(x1, x2), sinh(x1), cosh(x1), tanh(x1), min(x1, x2), max(x1, x2) @@ -648,7 +637,6 @@ namespace dreal } TEST_F(PatternMatchingTest, UnaryExpression) { - PatternMatchingTrie trie; auto pattern = tan(x1); std::vector matches{ From d01dec5f2c3ee80e889705498f344db665beb5d0 Mon Sep 17 00:00:00 2001 From: Kunal Sheth Date: Sat, 27 Dec 2025 01:31:55 -0800 Subject: [PATCH 09/43] Add temporary implementation for quantifiers in DeBruijnCanonicalizer.cc for unit tests. --- .../pattern_matching/map_based/DeBruijnCanonicalizer.cc | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/dreal/util/pattern_matching/map_based/DeBruijnCanonicalizer.cc b/src/dreal/util/pattern_matching/map_based/DeBruijnCanonicalizer.cc index ec4f178dd..478991346 100644 --- a/src/dreal/util/pattern_matching/map_based/DeBruijnCanonicalizer.cc +++ b/src/dreal/util/pattern_matching/map_based/DeBruijnCanonicalizer.cc @@ -153,7 +153,11 @@ void DeBruijnCanonicalizer::name ( \ INSERT_DECL(VisitNegation) { RECURSEF(get_operand(f)); } INSERT_DECL(VisitForall) { - throw DREAL_RUNTIME_ERROR("DeBruin Canonicalization not implemented for quantifiers yet."); + // todo: not sure if this is right... investigate later. + // throw DREAL_RUNTIME_ERROR("DeBruin Canonicalization not implemented for quantifiers yet."); + const auto& a = to_forall(f); + for (const auto & v : a->get_quantified_variables()) RECURSE(v); + RECURSEF(a->get_quantified_formula()); } INSERT_DECL(VisitForallT) { From 49d5738b4084d3e815d91b2cd23c6ba5d1422a16 Mon Sep 17 00:00:00 2001 From: Kunal Sheth Date: Sat, 27 Dec 2025 01:33:06 -0800 Subject: [PATCH 10/43] FIX descending ordering of explanation literals before pattern matching. --- src/dreal/solver/context_impl.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/dreal/solver/context_impl.cc b/src/dreal/solver/context_impl.cc index 721732179..b306fd1e9 100644 --- a/src/dreal/solver/context_impl.cc +++ b/src/dreal/solver/context_impl.cc @@ -321,7 +321,7 @@ optional Context::Impl::CheckSatCore(const ScopedVector& stack, // ordering the literals like this makes pattern matching fast. // todo: abstract this away better. should not happen at the top-level like it is now. std::sort(explanation.begin(), explanation.end(), [](const Formula &a, const Formula &b) { - return a.GetFreeVariables().size() < b.GetFreeVariables().size(); // descending + return a.GetFreeVariables().size() > b.GetFreeVariables().size(); // descending }); //////////////////////////////////////////////////////////////////////////////// From 0af74c619ba9cf1a17107bf0f41bc2599c5835d4 Mon Sep 17 00:00:00 2001 From: Kunal Sheth Date: Sat, 27 Dec 2025 01:58:59 -0800 Subject: [PATCH 11/43] Remove unnecessary 'indices' indirection layer in DeBruijnCanonicalizer.cc. --- .../map_based/DeBruijnCanonicalizer.cc | 34 +++++++++++-------- .../map_based/DeBruijnCanonicalizer.h | 3 +- 2 files changed, 22 insertions(+), 15 deletions(-) diff --git a/src/dreal/util/pattern_matching/map_based/DeBruijnCanonicalizer.cc b/src/dreal/util/pattern_matching/map_based/DeBruijnCanonicalizer.cc index 478991346..59d840ffe 100644 --- a/src/dreal/util/pattern_matching/map_based/DeBruijnCanonicalizer.cc +++ b/src/dreal/util/pattern_matching/map_based/DeBruijnCanonicalizer.cc @@ -61,8 +61,8 @@ void DeBruijnCanonicalizer::name ( \ INSERT_DECL(VisitVariable) { add_variable_to_seq(get_variable(e), canon_var_seq); } - INSERT_DECL(VisitConstant) { DREAL_ASSERT(e.GetVariables().size() == 0); } - INSERT_DECL(VisitRealConstant) { DREAL_ASSERT(e.GetVariables().size() == 0); } + INSERT_DECL(VisitConstant) { DREAL_ASSERT(e.GetVariables().empty()); } + INSERT_DECL(VisitRealConstant) { DREAL_ASSERT(e.GetVariables().empty()); } INSERT_DECL(VisitAddition) { const auto& a = to_addition(e); @@ -137,8 +137,8 @@ void DeBruijnCanonicalizer::name ( \ std::vector& canon_var_seq \ ) const - INSERT_DECL(VisitFalse) { DREAL_ASSERT(f.GetFreeVariables().size() == 0); } - INSERT_DECL(VisitTrue) { DREAL_ASSERT(f.GetFreeVariables().size() == 0); } + INSERT_DECL(VisitFalse) { DREAL_ASSERT(f.GetFreeVariables().empty()); } + INSERT_DECL(VisitTrue) { DREAL_ASSERT(f.GetFreeVariables().empty()); } INSERT_DECL(VisitVariable) { add_variable_to_seq(get_variable(f), canon_var_seq); } @@ -229,11 +229,13 @@ void DeBruijnCanonicalizer::name ( \ template void DeBruijnCanonicalizer::insert(const T& atom) { auto [structure, indices, concrete_vars] = canonicalize_atom(atom); - const auto [it, _] = structure_to_indices_to_concrete.try_emplace(std::move(structure)); + // const auto [it, _] = structure_to_indices_to_concrete.try_emplace(std::move(structure)); + const auto [it, _] = structure_to_concrete.try_emplace(std::move(structure)); const auto& canon_structure = it->first; // canonicalizes underlying FormulaCell ptr if it already existed in the map. - DeBruijnEquivalenceClass& concretes = it->second[indices]; - DREAL_ASSERT(it->second.size() == 1); // We shouldn't need this middle layer... indices should be baked into the dummy variable names. todo: remove. + // DeBruijnEquivalenceClass& concretes = it->second[indices]; + DeBruijnEquivalenceClass& concretes = it->second; + // DREAL_ASSERT(it->second.size() == 1); // We shouldn't need this middle layer... indices should be baked into the dummy variable names. odot: remove. auto [concrete_it, was_inserted] = concretes.try_emplace(concrete_vars, atom); @@ -259,11 +261,14 @@ void DeBruijnCanonicalizer::name ( \ cache_it == canonicalization_cache.cend() ? canonicalize_atom(atom) : cache_it->second ); - const auto indices_to_concrete_it = structure_to_indices_to_concrete.find(structure); - if (indices_to_concrete_it == structure_to_indices_to_concrete.cend()) return misses(substitutions_map::STRUCTURE_MISS); - const auto& indices_to_concrete = indices_to_concrete_it->second; - const auto concrete_it = indices_to_concrete.find(indices); - if (concrete_it == indices_to_concrete.cend()) return misses(substitutions_map::INDICES_MISS); + // const auto indices_to_concrete_it = structure_to_indices_to_concrete.find(structure); + // if (indices_to_concrete_it == structure_to_indices_to_concrete.cend()) return misses(substitutions_map::STRUCTURE_MISS); + // const auto& indices_to_concrete = indices_to_concrete_it->second; + // const auto concrete_it = indices_to_concrete.find(indices); + // if (concrete_it == indices_to_concrete.cend()) return misses(substitutions_map::INDICES_MISS); + // const auto& concrete = concrete_it->second; + const auto concrete_it = structure_to_concrete.find(structure); + if (concrete_it == structure_to_concrete.cend()) return misses(substitutions_map::STRUCTURE_MISS); const auto& concrete = concrete_it->second; for (const auto& [match_vars, match] : concrete /*structure_to_indices_to_concrete[structure][indices]*/) { @@ -353,7 +358,7 @@ void DeBruijnCanonicalizer::name ( \ // avoid re-finding 1000s of permutations of the same clause on fedor_13.smt2, etc. // copy required. do NOT modify matches_vec... that needs to be a pure stack - std::set matches_vec_set(matches_vec.begin(), matches_vec.end()); + // std::set matches_vec_set(matches_vec.begin(), matches_vec.end()); // const auto [_, successful_emplace] = seen_truncateds.emplace( // make_conjunction_SKIP_CHECKS_KUNAL_HACK(std::move(matches_vec_set)) // ); @@ -392,7 +397,8 @@ void DeBruijnCanonicalizer::name ( \ template DeBruijnCanonicalizer::DeBruijnCanonicalizer() { canonicalization_cache.max_load_factor(0.25); - structure_to_indices_to_concrete.max_load_factor(0.25); + // structure_to_indices_to_concrete.max_load_factor(0.25); + structure_to_concrete.max_load_factor(0.25); } // Force template code generation into this translation unit. diff --git a/src/dreal/util/pattern_matching/map_based/DeBruijnCanonicalizer.h b/src/dreal/util/pattern_matching/map_based/DeBruijnCanonicalizer.h index ee3460c51..c04835f1c 100644 --- a/src/dreal/util/pattern_matching/map_based/DeBruijnCanonicalizer.h +++ b/src/dreal/util/pattern_matching/map_based/DeBruijnCanonicalizer.h @@ -22,7 +22,8 @@ namespace dreal using DeBruijnEquivalenceClass = std::map, T>; std::unordered_map>> canonicalization_cache; - std::unordered_map> structure_to_indices_to_concrete; + // std::unordered_map> structure_to_indices_to_concrete; + std::unordered_map structure_to_concrete; std::tuple> canonicalize_atom(const T& atom) const; From ca64aec5e558387b0d6b293fe9841a3dc79754e1 Mon Sep 17 00:00:00 2001 From: Kunal Sheth Date: Sat, 27 Dec 2025 02:57:29 -0800 Subject: [PATCH 12/43] Set DRPM max size and max time via CLI instead of compile-time. --- src/dreal/dreal_main.cc | 27 +++++++++++++++++++++++++++ src/dreal/solver/config.cc | 8 ++++++++ src/dreal/solver/config.h | 9 +++++++++ src/dreal/solver/context_impl.cc | 5 ++--- src/dreal/version.h | 6 ------ 5 files changed, 46 insertions(+), 9 deletions(-) diff --git a/src/dreal/dreal_main.cc b/src/dreal/dreal_main.cc index 20849708e..5bd4854e5 100644 --- a/src/dreal/dreal_main.cc +++ b/src/dreal/dreal_main.cc @@ -234,6 +234,18 @@ void MainProgram::AddOptions() { 1 /* Number of args expected. */, 0 /* Delimiter if expecting multiple args. */, "Set a seed for the random number generator.", "--random-seed"); + + opt_.add("0" /* Default */, false /* Required? */, + 1 /* Number of args expected. */, + 0 /* Delimiter if expecting multiple args. */, + "Set maximum lemma size to pattern match. (default = 0)", "--drpm-max-size", positive_int_option_validator); + + const string kDefaultDrpmMaxTime{fmt::format("{}", Config::kDefaultDrpmMaxTime)}; + opt_.add(kDefaultDrpmMaxTime.c_str() /* Default */, false /* Required? */, + 1 /* Number of args expected. */, + 0 /* Delimiter if expecting multiple args. */, + fmt::format("Set pattern matching timeout in seconds. (default = {})", kDefaultDrpmMaxTime).c_str(), + "--drpm-max-time", positive_double_option_validator); } bool MainProgram::ValidateOptions() { @@ -431,6 +443,21 @@ void MainProgram::ExtractOptions() { DREAL_LOG_DEBUG("MainProgram::ExtractOptions() --random-seed = {}", config_.random_seed()); } + + if (opt_.isSet("--drpm-max-size")) { + int drpm{0}; + opt_.get("--drpm-max-size")->getInt(drpm); + config_.mutable_drpm_max_size().set_from_command_line(drpm); + DREAL_LOG_DEBUG("MainProgram::ExtractOptions() --drpm-max-size= {}", + config_.drpm_max_size()); + } + if (opt_.isSet("--drpm-max-time")) { + double drpm{0}; + opt_.get("--drpm-max-time")->getDouble(drpm); + config_.mutable_drpm_max_time().set_from_command_line(drpm); + DREAL_LOG_DEBUG("MainProgram::ExtractOptions() --drpm-max-time = {}", + config_.drpm_max_time()); + } } int MainProgram::Run() { diff --git a/src/dreal/solver/config.cc b/src/dreal/solver/config.cc index 52fe63f37..b639adbb7 100644 --- a/src/dreal/solver/config.cc +++ b/src/dreal/solver/config.cc @@ -124,6 +124,14 @@ uint32_t Config::random_seed() const { return random_seed_.get(); } OptionValue& Config::mutable_random_seed() { return random_seed_; } +int Config::drpm_max_size() const { return drpm_max_size_.get(); } + +OptionValue& Config::mutable_drpm_max_size() { return drpm_max_size_; } + +double Config::drpm_max_time() const { return drpm_max_time_.get(); } + +OptionValue& Config::mutable_drpm_max_time() { return drpm_max_time_; } + std::ostream& operator<<(std::ostream& os, const Config::SatDefaultPhase& sat_default_phase) { switch (sat_default_phase) { diff --git a/src/dreal/solver/config.h b/src/dreal/solver/config.h index 85f678702..c7f55db0b 100644 --- a/src/dreal/solver/config.h +++ b/src/dreal/solver/config.h @@ -154,6 +154,11 @@ class Config { /// Returns a mutable OptionValue for `random_seed`. OptionValue& mutable_random_seed(); + int drpm_max_size() const; + OptionValue& mutable_drpm_max_size(); + double drpm_max_time() const; + OptionValue& mutable_drpm_max_time(); + /// Returns if it's smtlib2_compliant mode. bool smtlib2_compliant() const; @@ -167,6 +172,7 @@ class Config { static constexpr double kDefaultNloptFtolAbs{1e-6}; static constexpr int kDefaultNloptMaxEval{100}; static constexpr double kDefaultNloptMaxTime{0.01}; + static constexpr double kDefaultDrpmMaxTime{0.222}; private: // NOTE: Make sure to match the default values specified here with the ones @@ -230,6 +236,9 @@ class Config { // Seed for Random Number Generator. OptionValue random_seed_{0}; + OptionValue drpm_max_size_{0}; + OptionValue drpm_max_time_{0.222}; + // Brancher to use. By default it uses `BranchLargestFirst`. OptionValue brancher_{BranchLargestFirst}; }; diff --git a/src/dreal/solver/context_impl.cc b/src/dreal/solver/context_impl.cc index b306fd1e9..d880c623b 100644 --- a/src/dreal/solver/context_impl.cc +++ b/src/dreal/solver/context_impl.cc @@ -344,8 +344,7 @@ optional Context::Impl::CheckSatCore(const ScopedVector& stack, if (true // && explanation.size() < 384 /* stack overflows around size=960 on x86 */ // && tscs_elapsed > std::chrono::milliseconds(3) - && explanation.size() < DREAL_EXPERIMENTAL_PATTERN_MATCH_SIZE_THRESH /* stack overflows around size=960 on x86 */ - // && tscs_elapsed > std::chrono::milliseconds(3) + && explanation.size() < config().drpm_max_size() /* stack overflows around size=960 on x86 */ ) { #endif #ifdef DREAL_EXPERIMENTAL_PATTERN_MATCH_SOME @@ -364,7 +363,7 @@ optional Context::Impl::CheckSatCore(const ScopedVector& stack, #else std::min( // based on i̶n̶f̶o̶r̶m̶a̶t̶i̶o̶n̶ ̶f̶r̶o̶m̶ ̶W̶O̶R̶T̶H̶_̶I̶T̶_̶r̶e̶g̶r̶e̶s̶s̶i̶o̶n̶_̶4̶.̶i̶p̶y̶n̶b̶ vibes std::chrono::duration_cast(100 * tscs_elapsed), - std::chrono::duration_cast(DREAL_EXPERIMENTAL_PATTERN_MATCH_TIMEOUT) + std::chrono::duration_cast(std::chrono::duration(config().drpm_max_time())) ) #endif ); diff --git a/src/dreal/version.h b/src/dreal/version.h index 5eb88ea63..1828c1ae9 100644 --- a/src/dreal/version.h +++ b/src/dreal/version.h @@ -12,8 +12,6 @@ // #define DREAL_EXPERIMENTAL_PATTERN_MATCH_SOME // #define DREAL_EXPERIMENTAL_PATTERN_MATCH_NONE -#define DREAL_EXPERIMENTAL_PATTERN_MATCH_SIZE_THRESH 16 - #define DREAL_EXPERIMENTAL_SAT_MODEL_PARTIAL_CONSTRAINTS // #define DREAL_EXPERIMENTAL_SAT_MODEL_FULL_CONSTRAINTS @@ -23,10 +21,6 @@ // #define DREAL_EXPERIMENTAL_GENERATE_HEURISTICS_CSV -// this is an *upper* limit for calculated timeout, 100 * TSCS -// should be taken from data reflected in WORTH_IT_regression_*.ipynb -#define DREAL_EXPERIMENTAL_PATTERN_MATCH_TIMEOUT (std::chrono::milliseconds(222)) - // check that options are required and mutually exclusive #ifdef DREAL_EXPERIMENTAL_PATTERN_MATCH_ALL constexpr int pattern_matching_mode = 2; From da6734fcc2a1ca8e2877cbdff6ddd9460a1e8d44 Mon Sep 17 00:00:00 2001 From: Kunal Sheth Date: Sat, 27 Dec 2025 03:12:04 -0800 Subject: [PATCH 13/43] Remove 'DREAL_EXPERIMENTAL_PATTERN_MATCH_' macros. --- src/dreal/solver/context_impl.cc | 16 ---------------- src/dreal/version.h | 14 -------------- 2 files changed, 30 deletions(-) diff --git a/src/dreal/solver/context_impl.cc b/src/dreal/solver/context_impl.cc index d880c623b..80a021077 100644 --- a/src/dreal/solver/context_impl.cc +++ b/src/dreal/solver/context_impl.cc @@ -204,11 +204,6 @@ optional Context::Impl::CheckSatCore(const ScopedVector& stack, #endif //////////////////////////////////////////////////////////////////////////////// -// #ifndef DREAL_EXPERIMENTAL_PATTERN_MATCH_NONE -// static_assert(pattern_matching_mode != 0); -// sat_solver->AddBox(pn_, box); -// #endif - //////////////////////////////////////////////////////////////////////////////// for (const auto & variable : box.variables()) { if (variable.get_type() == Variable::Type::CONTINUOUS) kunal_paper_data.box_continuous_count++; @@ -339,22 +334,11 @@ optional Context::Impl::CheckSatCore(const ScopedVector& stack, const std::chrono::duration ranking_elapsed2 = ranking_end2 - ranking_start2; #endif -#ifdef DREAL_EXPERIMENTAL_PATTERN_MATCH_ALL - static_assert(pattern_matching_mode == 2); if (true // && explanation.size() < 384 /* stack overflows around size=960 on x86 */ // && tscs_elapsed > std::chrono::milliseconds(3) && explanation.size() < config().drpm_max_size() /* stack overflows around size=960 on x86 */ ) { -#endif -#ifdef DREAL_EXPERIMENTAL_PATTERN_MATCH_SOME - static_assert(pattern_matching_mode == 1); - if (predicted_is_worth_it >= 0.5 && explanation.size() < 96) { -#endif -#ifdef DREAL_EXPERIMENTAL_PATTERN_MATCH_NONE - static_assert(pattern_matching_mode == 0); - if (false) { -#endif const auto alcp_start = std::chrono::high_resolution_clock::now(); const auto alcp_result = sat_solver->AddLearnedClausePattern( pn_, explanation, box, diff --git a/src/dreal/version.h b/src/dreal/version.h index 1828c1ae9..8f3cea85b 100644 --- a/src/dreal/version.h +++ b/src/dreal/version.h @@ -8,10 +8,6 @@ #define DREAL_VERSION_MINOR 00 #define DREAL_VERSION_REVISION 1 -#define DREAL_EXPERIMENTAL_PATTERN_MATCH_ALL -// #define DREAL_EXPERIMENTAL_PATTERN_MATCH_SOME -// #define DREAL_EXPERIMENTAL_PATTERN_MATCH_NONE - #define DREAL_EXPERIMENTAL_SAT_MODEL_PARTIAL_CONSTRAINTS // #define DREAL_EXPERIMENTAL_SAT_MODEL_FULL_CONSTRAINTS @@ -22,16 +18,6 @@ // #define DREAL_EXPERIMENTAL_GENERATE_HEURISTICS_CSV // check that options are required and mutually exclusive -#ifdef DREAL_EXPERIMENTAL_PATTERN_MATCH_ALL -constexpr int pattern_matching_mode = 2; -#endif -#ifdef DREAL_EXPERIMENTAL_PATTERN_MATCH_SOME -constexpr int pattern_matching_mode = 1; -#endif -#ifdef DREAL_EXPERIMENTAL_PATTERN_MATCH_NONE -constexpr int pattern_matching_mode = 0; -#endif - #ifdef DREAL_EXPERIMENTAL_SAT_MODEL_PARTIAL_CONSTRAINTS constexpr int partial_model_mode = 1; #endif From 4ce0ebe6d114d673cbfcfb9d16d90f3cf578640c Mon Sep 17 00:00:00 2001 From: Kunal Sheth Date: Sat, 27 Dec 2025 03:12:21 -0800 Subject: [PATCH 14/43] Improve --version printout clarity. --- src/dreal/solver/context.cc | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/dreal/solver/context.cc b/src/dreal/solver/context.cc index 39d128db9..78c3ebda6 100644 --- a/src/dreal/solver/context.cc +++ b/src/dreal/solver/context.cc @@ -120,13 +120,11 @@ string Context::version() { oss << DREAL_VERSION_MINOR << '.'; oss << DREAL_VERSION_REVISION << '.'; - oss << "patmat" << pattern_matching_mode << '.'; oss << "parmod" << partial_model_mode << '.'; - oss << "audit" << - static_cast(DREAL_EXPERIMENTAL_PM_DUMP_ALL_ENABLED) << - static_cast(DREAL_EXPERIMENTAL_THEORY_AUDIT_ENABLED) << - static_cast(DREAL_EXPERIMENTAL_SAT_AUDIT_ENABLED); + oss << "audit_pm_dump" << (DREAL_EXPERIMENTAL_PM_DUMP_ALL_ENABLED ? 1 : 0) << '.'; + oss << "audit_theory" << (DREAL_EXPERIMENTAL_THEORY_AUDIT_ENABLED ? 1 : 0) << '.'; + oss << "audit_sat" << (DREAL_EXPERIMENTAL_SAT_AUDIT_ENABLED ? 1 : 0); #ifdef DREAL_EXPERIMENTAL_GENERATE_HEURISTICS_CSV oss << ".GENERATE_CSV"; From 3c1de59c55f9b24766c4cb48acd3ab0fb5dbcb69 Mon Sep 17 00:00:00 2001 From: Kunal Sheth Date: Sat, 27 Dec 2025 03:31:57 -0800 Subject: [PATCH 15/43] Cleanup macros in version.h. --- src/dreal/solver/context.cc | 4 ++-- src/dreal/solver/context.h | 3 --- src/dreal/solver/context_impl.cc | 17 +++++------------ src/dreal/solver/sat_solver.cc | 2 +- src/dreal/solver/sat_solver.h | 9 ++------- src/dreal/solver/sat_solver_interval_logic.cc | 2 +- src/dreal/solver/sat_solver_model_logic.cc | 3 +-- src/dreal/util/predicate_normalizer.h | 7 +++++++ src/dreal/version.h | 18 ++++++++---------- 9 files changed, 27 insertions(+), 38 deletions(-) diff --git a/src/dreal/solver/context.cc b/src/dreal/solver/context.cc index 78c3ebda6..5def1db57 100644 --- a/src/dreal/solver/context.cc +++ b/src/dreal/solver/context.cc @@ -17,10 +17,10 @@ #include +#include "dreal/version.h" #include "dreal/solver/context_impl.h" #include "dreal/util/exception.h" #include "dreal/util/logging.h" -#include "dreal/version.h" using std::make_unique; using std::string; @@ -120,7 +120,7 @@ string Context::version() { oss << DREAL_VERSION_MINOR << '.'; oss << DREAL_VERSION_REVISION << '.'; - oss << "parmod" << partial_model_mode << '.'; + oss << "full_models" << (DREAL_EXPERIMENTAL_SAT_MODEL_FULL_CONSTRAINTS ? 1 : 0) << '.'; oss << "audit_pm_dump" << (DREAL_EXPERIMENTAL_PM_DUMP_ALL_ENABLED ? 1 : 0) << '.'; oss << "audit_theory" << (DREAL_EXPERIMENTAL_THEORY_AUDIT_ENABLED ? 1 : 0) << '.'; diff --git a/src/dreal/solver/context.h b/src/dreal/solver/context.h index 594fba1d0..cb287aea1 100644 --- a/src/dreal/solver/context.h +++ b/src/dreal/solver/context.h @@ -17,8 +17,6 @@ #include #include -#include -#include #include #include "dreal/smt2/logic.h" @@ -27,7 +25,6 @@ #include "dreal/util/box.h" #include "dreal/util/optional.h" #include "dreal/util/scoped_vector.h" -#include "dreal/version.h" namespace dreal { diff --git a/src/dreal/solver/context_impl.cc b/src/dreal/solver/context_impl.cc index 80a021077..b21970be3 100644 --- a/src/dreal/solver/context_impl.cc +++ b/src/dreal/solver/context_impl.cc @@ -31,6 +31,7 @@ #include +#include "dreal/version.h" #include "dreal/solver/auditor.h" #include "dreal/solver/filter_assertion.h" #include "dreal/util/assert.h" @@ -38,7 +39,6 @@ #include "dreal/util/if_then_else_eliminator.h" #include "dreal/util/interrupt.h" #include "dreal/util/logging.h" -#include "dreal/version.h" namespace dreal { @@ -230,22 +230,15 @@ optional Context::Impl::CheckSatCore(const ScopedVector& stack, } #endif -#ifdef DREAL_EXPERIMENTAL_SAT_MODEL_FULL_CONSTRAINTS - static_assert(partial_model_mode == 0); - constexpr bool request_fully_constrained = true; -#endif -#ifdef DREAL_EXPERIMENTAL_SAT_MODEL_PARTIAL_CONSTRAINTS - static_assert(partial_model_mode == 1); - const bool request_fully_constrained = recent_under_constrained_deltasat > 0; -#endif + const bool request_fully_constrained = + DREAL_EXPERIMENTAL_SAT_MODEL_FULL_CONSTRAINTS || + recent_under_constrained_deltasat > 0; const auto optional_model_and_fully_constrained = sat_solver->CheckSat(request_fully_constrained); if (optional_model_and_fully_constrained) { const auto& [optional_model, is_full_constrained] = *optional_model_and_fully_constrained; if (request_fully_constrained) DREAL_ASSERT(is_full_constrained); -#ifdef DREAL_EXPERIMENTAL_SAT_MODEL_FULL_CONSTRAINTS - DREAL_ASSERT(request_fully_constrained && is_full_constrained); -#endif + if (DREAL_EXPERIMENTAL_SAT_MODEL_FULL_CONSTRAINTS) DREAL_ASSERT(request_fully_constrained && is_full_constrained); const vector>& boolean_model{optional_model.first}; const vector>& theory_model{optional_model.second}; diff --git a/src/dreal/solver/sat_solver.cc b/src/dreal/solver/sat_solver.cc index 287ab8004..ed63b71ac 100644 --- a/src/dreal/solver/sat_solver.cc +++ b/src/dreal/solver/sat_solver.cc @@ -17,11 +17,11 @@ #include #include -#include #include #include #include "auditor.h" +#include "dreal/version.h" #include "dreal/util/assert.h" #include "dreal/util/exception.h" #include "dreal/util/logging.h" diff --git a/src/dreal/solver/sat_solver.h b/src/dreal/solver/sat_solver.h index 976de2dfc..cf66fc550 100644 --- a/src/dreal/solver/sat_solver.h +++ b/src/dreal/solver/sat_solver.h @@ -24,6 +24,7 @@ #include #include "cadical.hpp" +#include "dreal/version.h" #include "dreal/solver/config.h" #include "dreal/symbolic/symbolic.h" @@ -32,7 +33,6 @@ #include "dreal/util/scoped_unordered_map.h" #include "dreal/util/scoped_unordered_set.h" #include "dreal/util/tseitin_cnfizer.h" -#include "dreal/version.h" namespace dreal { @@ -88,12 +88,7 @@ class SatSolver : public CaDiCaL::Learner { /// @returns a witness, satisfying model if the problem is satisfiable. /// @returns nullopt if UNSAT. optional> CheckSat( -#ifdef DREAL_EXPERIMENTAL_SAT_MODEL_FULL_CONSTRAINTS - bool request_fully_constrained = true -#endif -#ifdef DREAL_EXPERIMENTAL_SAT_MODEL_PARTIAL_CONSTRAINTS - bool request_fully_constrained = false -#endif + bool request_fully_constrained = DREAL_EXPERIMENTAL_SAT_MODEL_FULL_CONSTRAINTS ); // TODO(soonho): Push/Pop cnfizer and predicate_abstractor? diff --git a/src/dreal/solver/sat_solver_interval_logic.cc b/src/dreal/solver/sat_solver_interval_logic.cc index 151dd0061..305285e77 100644 --- a/src/dreal/solver/sat_solver_interval_logic.cc +++ b/src/dreal/solver/sat_solver_interval_logic.cc @@ -4,11 +4,11 @@ #include #include -#include #include "auditor.h" #include "filter_assertion.h" #include "sat_solver.h" +#include "dreal/version.h" namespace dreal { diff --git a/src/dreal/solver/sat_solver_model_logic.cc b/src/dreal/solver/sat_solver_model_logic.cc index f4d555e05..6f9d9cdc9 100644 --- a/src/dreal/solver/sat_solver_model_logic.cc +++ b/src/dreal/solver/sat_solver_model_logic.cc @@ -1,5 +1,4 @@ -#include - +#include "dreal/version.h" #include "dreal/solver/sat_solver.h" namespace dreal { diff --git a/src/dreal/util/predicate_normalizer.h b/src/dreal/util/predicate_normalizer.h index 50c42a8b7..14c8a0ca1 100644 --- a/src/dreal/util/predicate_normalizer.h +++ b/src/dreal/util/predicate_normalizer.h @@ -19,6 +19,7 @@ #include #include "pattern_matching/trie_based/pattern_matching_trie.h" +#include #include "predicate_heuristic.h" #include "dreal/symbolic/symbolic.h" #include "pattern_matching/map_based/DeBruijnCanonicalizer.h" @@ -60,7 +61,13 @@ namespace dreal Formula VisitIntegral(const Formula& f); std::unordered_map cache; + +#ifdef DREAL_EXPERIMENTAL_PM_USE_TRIE_IMPL PatternMatchingTrie trie; +#endif +#ifdef DREAL_EXPERIMENTAL_PM_USE_MAP_IMPL + DeBruijnCanonicalizer trie; +#endif friend Formula drake::symbolic::VisitFormula< Formula, PredicateNormalizer>(PredicateNormalizer*, const Formula&); diff --git a/src/dreal/version.h b/src/dreal/version.h index 8f3cea85b..5464df804 100644 --- a/src/dreal/version.h +++ b/src/dreal/version.h @@ -8,8 +8,10 @@ #define DREAL_VERSION_MINOR 00 #define DREAL_VERSION_REVISION 1 -#define DREAL_EXPERIMENTAL_SAT_MODEL_PARTIAL_CONSTRAINTS -// #define DREAL_EXPERIMENTAL_SAT_MODEL_FULL_CONSTRAINTS +#define DREAL_EXPERIMENTAL_SAT_MODEL_FULL_CONSTRAINTS false + +// #define DREAL_EXPERIMENTAL_PM_USE_TRIE_IMPL +#define DREAL_EXPERIMENTAL_PM_USE_MAP_IMPL #define DREAL_EXPERIMENTAL_THEORY_AUDIT_ENABLED false #define DREAL_EXPERIMENTAL_PM_DUMP_ALL_ENABLED false @@ -18,15 +20,11 @@ // #define DREAL_EXPERIMENTAL_GENERATE_HEURISTICS_CSV // check that options are required and mutually exclusive -#ifdef DREAL_EXPERIMENTAL_SAT_MODEL_PARTIAL_CONSTRAINTS -constexpr int partial_model_mode = 1; -#endif -#ifdef DREAL_EXPERIMENTAL_SAT_MODEL_FULL_CONSTRAINTS -constexpr int partial_model_mode = 0; +#ifdef DREAL_EXPERIMENTAL_PM_USE_TRIE_IMPL +constexpr int pm_impl_mode = 0; #endif - -#ifdef DREAL_EXPERIMENTAL_GENERATE_HEURISTICS_CSV -static_assert(pattern_matching_mode == 2); +#ifdef DREAL_EXPERIMENTAL_PM_USE_MAP_IMPL +constexpr int pm_impl_mode = 1; #endif #endif //VERSION_H From 4828a92675ebaa7edde501293d4c7b4e37fc0a88 Mon Sep 17 00:00:00 2001 From: Kunal Sheth Date: Sat, 27 Dec 2025 04:21:05 -0800 Subject: [PATCH 16/43] =?UTF-8?q?Fix=20compile=20error=20on=20CentOS?= =?UTF-8?q?=E2=80=94=20bad=20call=20to=20std::find,=20since=20`=3D=3D`=20d?= =?UTF-8?q?oes=20not=20work=20on=20ASTs.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../pattern_matching/map_based/DeBruijnCanonicalizer.cc | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/dreal/util/pattern_matching/map_based/DeBruijnCanonicalizer.cc b/src/dreal/util/pattern_matching/map_based/DeBruijnCanonicalizer.cc index 59d840ffe..770380563 100644 --- a/src/dreal/util/pattern_matching/map_based/DeBruijnCanonicalizer.cc +++ b/src/dreal/util/pattern_matching/map_based/DeBruijnCanonicalizer.cc @@ -372,9 +372,12 @@ void DeBruijnCanonicalizer::name ( \ // stats.partial_matches++; if (it2 == iend) { DREAL_ASSERT(matches_vec.size() == literals.size()); - if (DREAL_EXPERIMENTAL_THEORY_AUDIT_ENABLED) - for (const auto& lit : matches_vec) - DREAL_ASSERT(std::find(literals.begin(), literals.end(), substitutions_map::apply_substitution(lit, s2, false)) != literals.end()); + if (DREAL_EXPERIMENTAL_THEORY_AUDIT_ENABLED) { + for (int i = 0; i < literals.size(); ++i) { + const auto& subs_lit = substitutions_map::apply_substitution(matches_vec[i], s2, false); + DREAL_ASSERT(literals[i].EqualTo(subs_lit)); + } + } ++stats.matches; result.emplace_back(matches_vec, s2); } From ad6cdb1df39ddf8c8e734a52a6c8d0ba84f4f474 Mon Sep 17 00:00:00 2001 From: Kunal Sheth Date: Sat, 27 Dec 2025 04:28:05 -0800 Subject: [PATCH 17/43] Add pattern matching implementation to version string. --- src/dreal/solver/context.cc | 7 +++++++ src/dreal/util/predicate_normalizer.h | 2 ++ 2 files changed, 9 insertions(+) diff --git a/src/dreal/solver/context.cc b/src/dreal/solver/context.cc index 5def1db57..0d5974f5d 100644 --- a/src/dreal/solver/context.cc +++ b/src/dreal/solver/context.cc @@ -120,6 +120,13 @@ string Context::version() { oss << DREAL_VERSION_MINOR << '.'; oss << DREAL_VERSION_REVISION << '.'; +#ifdef DREAL_EXPERIMENTAL_PM_USE_TRIE_IMPL + oss << "PM_trie."; +#endif +#ifdef DREAL_EXPERIMENTAL_PM_USE_MAP_IMPL + oss << "PM_map."; +#endif + oss << "full_models" << (DREAL_EXPERIMENTAL_SAT_MODEL_FULL_CONSTRAINTS ? 1 : 0) << '.'; oss << "audit_pm_dump" << (DREAL_EXPERIMENTAL_PM_DUMP_ALL_ENABLED ? 1 : 0) << '.'; diff --git a/src/dreal/util/predicate_normalizer.h b/src/dreal/util/predicate_normalizer.h index 14c8a0ca1..d49c93a1c 100644 --- a/src/dreal/util/predicate_normalizer.h +++ b/src/dreal/util/predicate_normalizer.h @@ -64,9 +64,11 @@ namespace dreal #ifdef DREAL_EXPERIMENTAL_PM_USE_TRIE_IMPL PatternMatchingTrie trie; + static_assert(pm_impl_mode == 0); #endif #ifdef DREAL_EXPERIMENTAL_PM_USE_MAP_IMPL DeBruijnCanonicalizer trie; + static_assert(pm_impl_mode == 1); #endif friend Formula drake::symbolic::VisitFormula< From ee096bed21416a807f0cb555b69fcffdd7b6883e Mon Sep 17 00:00:00 2001 From: Kunal Sheth Date: Sat, 27 Dec 2025 21:15:49 -0800 Subject: [PATCH 18/43] Implement substitution_tree.cc data structure for more efficient alpha-bijection checking. --- .../map_based/DeBruijnCanonicalizer.cc | 30 +----- .../map_based/DeBruijnCanonicalizer.h | 4 +- .../substitution_tree/substitution_tree.cc | 91 +++++++++++++++++++ .../substitution_tree/substitution_tree.h | 52 +++++++++++ .../dreal/symbolic/symbolic_variable.h | 11 --- 5 files changed, 150 insertions(+), 38 deletions(-) create mode 100644 src/dreal/util/pattern_matching/substitution_tree/substitution_tree.cc create mode 100644 src/dreal/util/pattern_matching/substitution_tree/substitution_tree.h diff --git a/src/dreal/util/pattern_matching/map_based/DeBruijnCanonicalizer.cc b/src/dreal/util/pattern_matching/map_based/DeBruijnCanonicalizer.cc index 770380563..85e27a3a2 100644 --- a/src/dreal/util/pattern_matching/map_based/DeBruijnCanonicalizer.cc +++ b/src/dreal/util/pattern_matching/map_based/DeBruijnCanonicalizer.cc @@ -156,7 +156,8 @@ void DeBruijnCanonicalizer::name ( \ // todo: not sure if this is right... investigate later. // throw DREAL_RUNTIME_ERROR("DeBruin Canonicalization not implemented for quantifiers yet."); const auto& a = to_forall(f); - for (const auto & v : a->get_quantified_variables()) RECURSE(v); + for (const auto& v : a->get_quantified_variables()) + RECURSE(v); RECURSEF(a->get_quantified_formula()); } @@ -237,15 +238,7 @@ void DeBruijnCanonicalizer::name ( \ DeBruijnEquivalenceClass& concretes = it->second; // DREAL_ASSERT(it->second.size() == 1); // We shouldn't need this middle layer... indices should be baked into the dummy variable names. odot: remove. - auto [concrete_it, was_inserted] = concretes.try_emplace(concrete_vars, atom); - - if (!was_inserted) { - DREAL_ASSERT(atom.EqualTo(concrete_it->second)); - // throw DREAL_RUNTIME_ERROR( - // "DeBruijn concrete instantiation already exists: {} <-> {}", - // atom.to_string(), canon_structure.to_string() - // ); - } + concretes.insert(concrete_vars, atom); canonicalization_cache.try_emplace(atom, canon_structure, std::move(indices), std::move(concrete_vars)); } @@ -271,22 +264,7 @@ void DeBruijnCanonicalizer::name ( \ if (concrete_it == structure_to_concrete.cend()) return misses(substitutions_map::STRUCTURE_MISS); const auto& concrete = concrete_it->second; - for (const auto& [match_vars, match] : concrete /*structure_to_indices_to_concrete[structure][indices]*/) { - subs.push(); - - auto status = substitutions_map::SUCCESS; - DREAL_ASSERT(concrete_vars.size() == match_vars.size()); - for (int i = 0; i < concrete_vars.size(); ++i) { - status = subs.attempt_substitution(match_vars[i], concrete_vars[i]); - if (status != substitutions_map::SUCCESS) { - misses(status); - break; - } - } - if (status == substitutions_map::SUCCESS) matches(match, subs); - - subs.pop(); - } + concrete.find_matches(concrete_vars, subs, matches, misses); DREAL_ASSERT(subs.size() == init_size); return; diff --git a/src/dreal/util/pattern_matching/map_based/DeBruijnCanonicalizer.h b/src/dreal/util/pattern_matching/map_based/DeBruijnCanonicalizer.h index c04835f1c..b593f3467 100644 --- a/src/dreal/util/pattern_matching/map_based/DeBruijnCanonicalizer.h +++ b/src/dreal/util/pattern_matching/map_based/DeBruijnCanonicalizer.h @@ -11,6 +11,7 @@ #include "dreal/util/exception.h" #include "dreal/util/pattern_matching/matching_stats_t.h" #include "dreal/util/pattern_matching/substitutions_map.h" +#include "dreal/util/pattern_matching/substitution_tree/substitution_tree.h" namespace dreal { @@ -19,7 +20,8 @@ namespace dreal { private: using DeBruijnIndices = std::vector; - using DeBruijnEquivalenceClass = std::map, T>; + // using DeBruijnEquivalenceClass = std::map, T>; + using DeBruijnEquivalenceClass = substitution_tree; std::unordered_map>> canonicalization_cache; // std::unordered_map> structure_to_indices_to_concrete; diff --git a/src/dreal/util/pattern_matching/substitution_tree/substitution_tree.cc b/src/dreal/util/pattern_matching/substitution_tree/substitution_tree.cc new file mode 100644 index 000000000..3630d4950 --- /dev/null +++ b/src/dreal/util/pattern_matching/substitution_tree/substitution_tree.cc @@ -0,0 +1,91 @@ +// +// Created by Kunal Sheth on 12/27/25. +// + +#include "substitution_tree.h" + +#include + +#include "dreal/util/assert.h" +#include "dreal/util/pattern_matching/substitutions_map.h" + +namespace dreal +{ +#define get_map(variant) std::get>(variant) + + template + template + void substitution_tree::insert(const It& begin, const It& end, std::map& parents_next, const Leaf& leaf) { + const Variable& var = *begin; + It next = begin; + ++next; + if (next == end) { + const auto [it, success] = parents_next.try_emplace(var, leaf); + if (!success) + DREAL_ASSERT(std::get(it->second.next).EqualTo(leaf)); + } + else { + insert(next, end, get_map(parents_next[var].next/*constructs if necessary*/), leaf); + } + } + + template + void substitution_tree::insert(const std::vector& concrete_vars, const Leaf& leaf) { + if (concrete_vars.empty()) { + DREAL_ASSERT(!root.has_value()); + root.emplace(leaf); + } + else { + if (!root.has_value()) root.emplace(); + insert(concrete_vars.begin(), concrete_vars.end(), get_map(root->next), leaf); + } + } + + template + template + void substitution_tree::find_matches( + const It& begin, const It& end, substitutions_map& subs, const Node& parent, + const matches_vec& matches, const misses_vec& misses + ) const { + if (begin == end) { + matches(std::get(parent.next), subs); + return; + } // else { + + const auto init_size = subs.size(); + + const Variable& concrete_var = *begin; + It next = begin; + ++next; + for (const auto& [matched_var, child] : get_map(parent.next)) { + subs.push(); + auto status = subs.attempt_substitution(matched_var, concrete_var); + if (status == substitutions_map::SUCCESS) { + find_matches(next, end, subs, child, matches, misses); + } + else /*if (status != substitutions_map::SUCCESS)*/ { + misses(status); // terminate descent path. + } + subs.pop(); + } + + DREAL_ASSERT(subs.size() == init_size); + } + + template + void substitution_tree::find_matches( + const std::vector& concrete_vars, substitutions_map& subs, + const matches_vec& matches, const misses_vec& misses + ) const { + if (concrete_vars.empty()) { + matches(std::get(root->next), subs); + } + else { + find_matches(concrete_vars.begin(), concrete_vars.end(), subs, *root, matches, misses); + } + } + + // Force template code generation into this translation unit. + template class substitution_tree; + template class substitution_tree; +} diff --git a/src/dreal/util/pattern_matching/substitution_tree/substitution_tree.h b/src/dreal/util/pattern_matching/substitution_tree/substitution_tree.h new file mode 100644 index 000000000..d062c0662 --- /dev/null +++ b/src/dreal/util/pattern_matching/substitution_tree/substitution_tree.h @@ -0,0 +1,52 @@ +// +// Created by Kunal Sheth on 12/27/25. +// + +#ifndef DREAL4_CMAKE_SUBSTITUTION_TREE_H +#define DREAL4_CMAKE_SUBSTITUTION_TREE_H +#include + +#include "dreal/symbolic/symbolic.h" +#include "dreal/util/pattern_matching/substitutions_map.h" + + +namespace dreal +{ + template + class substitution_tree + { + private: + class Node + { + public: + Node() : next(std::map{}) {} + explicit Node(const Leaf& leaf) : next(leaf) {} + + Node(const Node& other) = delete; + Node(Node&& other) noexcept = delete; + + std::variant< + std::map, + const Leaf> next; + }; + + std::optional root; + + template + static void insert(const It& begin, const It& end, std::map& parents_next, const Leaf& leaf); + + using matches_vec = std::function; + using misses_vec = std::function; + + public: + void insert(const std::vector& concrete_vars, const Leaf& leaf); + + template + void find_matches(const It& begin, const It& end, substitutions_map& subs, const Node& parent, + const matches_vec& matches, const misses_vec& misses) const; + void find_matches(const std::vector& concrete_vars, substitutions_map& subs, const matches_vec& matches, const misses_vec& misses) const; + }; +} + + +#endif //DREAL4_CMAKE_SUBSTITUTION_TREE_H diff --git a/src/third_party/com_github_robotlocomotion_drake/dreal/symbolic/symbolic_variable.h b/src/third_party/com_github_robotlocomotion_drake/dreal/symbolic/symbolic_variable.h index ce8ea462f..dfbd8b4cc 100644 --- a/src/third_party/com_github_robotlocomotion_drake/dreal/symbolic/symbolic_variable.h +++ b/src/third_party/com_github_robotlocomotion_drake/dreal/symbolic/symbolic_variable.h @@ -111,17 +111,6 @@ struct less { } }; -/* Provides std::less. */ -template <> -struct less> { - bool operator()(const vector& vars1, - const vector& vars2) const { - return std::lexicographical_compare(vars1.begin(), vars1.end(), - vars2.begin(), vars2.end(), - std::less{}); - } -}; - /* Provides std::equal_to. */ template <> struct equal_to { From 7aa02bd564e4b2104afef3bea20640c6c6240a49 Mon Sep 17 00:00:00 2001 From: Kunal Sheth Date: Sat, 27 Dec 2025 22:30:40 -0800 Subject: [PATCH 19/43] Switch `substitutions_map` bijection data structure from std::unordered_map to flat vector for better cache performance. --- .../map_based/DeBruijnCanonicalizer.h | 2 +- .../pattern_matching/substitutions_map.cc | 156 ++++-------------- .../util/pattern_matching/substitutions_map.h | 43 ++--- .../trie_based/pattern_matching_trie_expr.cc | 2 + .../trie_based/pattern_matching_trie_form.cc | 2 + .../pattern_matching_trie_general.cc | 1 + 6 files changed, 52 insertions(+), 154 deletions(-) diff --git a/src/dreal/util/pattern_matching/map_based/DeBruijnCanonicalizer.h b/src/dreal/util/pattern_matching/map_based/DeBruijnCanonicalizer.h index b593f3467..e3d9ad73a 100644 --- a/src/dreal/util/pattern_matching/map_based/DeBruijnCanonicalizer.h +++ b/src/dreal/util/pattern_matching/map_based/DeBruijnCanonicalizer.h @@ -21,7 +21,7 @@ namespace dreal private: using DeBruijnIndices = std::vector; // using DeBruijnEquivalenceClass = std::map, T>; - using DeBruijnEquivalenceClass = substitution_tree; + using DeBruijnEquivalenceClass = substitution_tree; std::unordered_map>> canonicalization_cache; // std::unordered_map> structure_to_indices_to_concrete; diff --git a/src/dreal/util/pattern_matching/substitutions_map.cc b/src/dreal/util/pattern_matching/substitutions_map.cc index 3936116f4..dc154cd61 100644 --- a/src/dreal/util/pattern_matching/substitutions_map.cc +++ b/src/dreal/util/pattern_matching/substitutions_map.cc @@ -11,152 +11,68 @@ namespace dreal { - substitutions_map::substitutions_map(const Box& b, const size_t reserved_size): box(b) { - fwd.max_load_factor(0.25); - bwd.max_load_factor(0.25); + substitutions_map::substitutions_map(const Box& b, const size_t reserved_size) : box(b) { reserve(reserved_size); } - // substitutions_map::substitutions_map(const size_t reserved_size) : substitutions_map() { - // reserve(reserved_size); - // } - - // "forward" takes the matched and maps it to original - // "backward" takes original and maps it to matched - // Box substitutions_map::apply_substitution( - // const Box& b, const substitutions_map& subs, bool backward - // ) { - // Box new_b; - // const auto& map = backward ? subs.bwd : subs.fwd; - // for (const auto& [a,aP] : map) { - // // if (new_b.has_variable(aP)) continue; - // const auto& ba = b[a]; - // new_b.Add(aP, ba.lb(), ba.ub()); - // } - // return new_b; - // } - void substitutions_map::push() { - insertion_stack.emplace_back(); + index_stack.emplace_back(mapping.size()); } void substitutions_map::pop() { - for (const auto& [a,aP] : insertion_stack.back()) { - DREAL_ASSERT(fwd.count(a) == 1); - DREAL_ASSERT(bwd.count(aP) == 1); - fwd.erase(a); - bwd.erase(aP); - } - insertion_stack.pop_back(); + DREAL_ASSERT(!index_stack.empty()); + DREAL_ASSERT(index_stack.back() <= mapping.size()); + mapping.resize(index_stack.back()); + index_stack.pop_back(); } substitutions_map::substitution_status substitutions_map::attempt_substitution( const Variable& a, const Variable& aP ) { if (a.get_type() != aP.get_type()) return TYPE_MISS; - if (box[a] != box[aP]) { - // todo: subset / superset ? - return BOX_MISS; - } + if (box[a] != box[aP]) return BOX_MISS; // todo: subset / superset ? - const auto it_a = fwd.find(a); - const auto it_aP = bwd.find(aP); - const bool has_a = it_a != fwd.end(); - const bool has_aP = it_aP != bwd.end(); - - if (!has_a && !has_aP) { // do insert - fwd.try_emplace(a, aP); - bwd.try_emplace(aP, a); - insertion_stack.back().emplace_back(a, aP); - return SUCCESS; - } - - if ( - has_a && has_aP && - it_a->second.equal_to(aP) && - it_aP->second.equal_to(a) - ) { - return SUCCESS; - } - - DREAL_LOG_TRACE( - "Substitution failed. New 'a' {} is {}, while new 'aP' {} is {}.", - a.get_name(), - has_aP ? it_aP->second.get_name() : "unmapped", - aP.get_name(), - has_a ? it_a->second.get_name() : "unmapped" - ); - return BIJ_MISS; - } + for (const auto& [mA, mAP] : mapping) { + const bool eqA = mA.equal_to(a); + const bool eqAP = mAP.equal_to(aP); - // this is literally the hottest function in the entire code rn, when we pattern match aggressively. -KS - // ended up being actually slower?? a little. - /* - bool substitutions_map::attempt_substitution(const Variable& a, const Variable& aP) { - if (a.get_type() != aP.get_type()) return false; - - // Attempt to find 'a' and 'aP' just once - const auto [a_iterator, a_was_inserted] = fwd.try_emplace(a, aP); - if (a_was_inserted) { - // Only try to insert into bwd if we successfully inserted into fwd - const auto [aP_iterator, aP_was_inserted] = bwd.try_emplace(aP, a); - if (aP_was_inserted) { - insertion_stack.back().emplace_back(a, aP); - return true; - } - else { - // Rollback fwd insertion if bwd insertion failed - fwd.erase(a_iterator); - return false; + if (eqA && eqAP) return SUCCESS; + if (eqA || eqAP) { + DREAL_LOG_TRACE("Substitution failed. Attempted ({} <=> {}) conflicts with existing ({} <=> {}).", + a.get_name(), aP.get_name(), mA.get_name(), mAP.get_name()); + return BIJ_MISS; } } - else { - // Check if existing values match - const auto aP_iterator = bwd.find(aP); - if ( - aP_iterator != bwd.end() && - a_iterator->second.equal_to(aP) && - aP_iterator->second.equal_to(a) - ) { - return true; - } - DREAL_LOG_TRACE( - "Substitution failed. New 'a' {} is already {}, while new 'aP' {} is already {}.", - a.get_name(), aP_iterator != bwd.end() ? aP_iterator->second.get_name() : "", - aP.get_name(), a_iterator->second.get_name() - ); - return false; - } - DREAL_UNREACHABLE(); + mapping.emplace_back(a, aP); + return SUCCESS; } - */ size_t substitutions_map::size() const { - DREAL_ASSERT(fwd.size() == bwd.size()); - return fwd.size(); + return mapping.size(); } void substitutions_map::reserve(const size_t n) { - fwd.reserve(n); - bwd.reserve(n); - insertion_stack.reserve(n); + mapping.reserve(n); + index_stack.reserve(n); } - bool operator==(const substitutions_map& lhs, const substitutions_map& rhs) { - if (lhs.fwd.size() != rhs.fwd.size()) return false; - if (lhs.bwd.size() != rhs.bwd.size()) return false; - - for (const auto& [a, aP] : lhs.fwd) { - const auto it = rhs.fwd.find(a); - if (it == rhs.fwd.end() || it->second != a) return false; - } - - for (const auto& [aP, a] : lhs.bwd) { - const auto it = rhs.bwd.find(aP); - if (it == rhs.bwd.end() || it->second != aP) return false; + // "forward" takes the matched and maps it to original + // "backward" takes original and maps it to matched + template + T substitutions_map::apply_substitution(const T& f, const substitutions_map& subs, bool backward) { + ExpressionSubstitution esub; + FormulaSubstitution fsub; + for (const auto& [fst,snd] : subs.mapping) { + const auto& a = backward ? snd : fst; + const auto& aP = backward ? fst : snd; + if (a.get_type() == Variable::Type::BOOLEAN) fsub.emplace(a, Formula{aP}); + else esub.emplace(a, aP); } - - return true; + return f.Substitute(esub, fsub); } + + // Force template code generation into this translation unit. + template Expression substitutions_map::apply_substitution(const Expression& f, const substitutions_map& subs, bool backward); + template Formula substitutions_map::apply_substitution(const Formula& f, const substitutions_map& subs, bool backward); } diff --git a/src/dreal/util/pattern_matching/substitutions_map.h b/src/dreal/util/pattern_matching/substitutions_map.h index efd39190d..c56ea8a7e 100644 --- a/src/dreal/util/pattern_matching/substitutions_map.h +++ b/src/dreal/util/pattern_matching/substitutions_map.h @@ -6,48 +6,25 @@ #define substitutions_mapH #include #include -#include namespace dreal { - class substitutions_map : public std::enable_shared_from_this + class substitutions_map { private: - std::unordered_map fwd; - std::unordered_map bwd; - std::vector>> insertion_stack{1}; + std::vector> mapping; + std::vector index_stack; const Box& box; public: - const std::unordered_map& get_map() const { return fwd; } - const std::vector>& get_current_frame() const { return insertion_stack.back(); } + [[nodiscard]] const std::vector>& get_map() const { return mapping; } - // substitutions_map(); - // explicit substitutions_map(Box b); - // explicit substitutions_map(size_t reserve); substitutions_map(const Box& b, size_t reserved_size); // "forward" takes the matched and maps it to original // "backward" takes original and maps it to matched template - [[nodiscard]] static T apply_substitution( - const T& f, const substitutions_map& subs, bool backward - ) { - ExpressionSubstitution esub; - FormulaSubstitution fsub; - const auto& map = backward ? subs.bwd : subs.fwd; - for (const auto& [a,aP] : map) { - if (a.get_type() == Variable::Type::BOOLEAN) - fsub.emplace(a, Formula{aP}); - else - esub.emplace(a, aP); - } - return f.Substitute(esub, fsub); - } - - // [[nodiscard]] static Box apply_substitution( - // const Box& b, const substitutions_map& subs, bool backward = false - // ); + [[nodiscard]] static T apply_substitution(const T& f, const substitutions_map& subs, bool backward); void push(); @@ -60,14 +37,14 @@ namespace dreal substitution_status attempt_substitution(const Variable& a, const Variable& aP); - size_t size() const; + [[nodiscard]] size_t size() const; void reserve(size_t n); - friend bool operator==(const substitutions_map& lhs, const substitutions_map& rhs); - - friend bool operator!=(const substitutions_map& lhs, const substitutions_map& rhs) { return !(lhs == rhs); } + // very expensive, don't want to accidentally call somewhere. + // friend bool operator==(const substitutions_map& lhs, const substitutions_map& rhs); + // friend bool operator!=(const substitutions_map& lhs, const substitutions_map& rhs) { return !(lhs == rhs); } }; } -#endif //substitutions_mapH \ No newline at end of file +#endif //substitutions_mapH diff --git a/src/dreal/util/pattern_matching/trie_based/pattern_matching_trie_expr.cc b/src/dreal/util/pattern_matching/trie_based/pattern_matching_trie_expr.cc index 0db122f1c..687c7f1b1 100644 --- a/src/dreal/util/pattern_matching/trie_based/pattern_matching_trie_expr.cc +++ b/src/dreal/util/pattern_matching/trie_based/pattern_matching_trie_expr.cc @@ -9,6 +9,8 @@ #include #include +#include "dreal/util/exception.h" + namespace dreal { #define VISIT_DECL(name) \ diff --git a/src/dreal/util/pattern_matching/trie_based/pattern_matching_trie_form.cc b/src/dreal/util/pattern_matching/trie_based/pattern_matching_trie_form.cc index f0adac530..5c376b346 100644 --- a/src/dreal/util/pattern_matching/trie_based/pattern_matching_trie_form.cc +++ b/src/dreal/util/pattern_matching/trie_based/pattern_matching_trie_form.cc @@ -9,6 +9,8 @@ #include "dreal/symbolic/odes/symbolic_odes_cell.h" #include #include + +#include "dreal/util/exception.h" #include "dreal/util/iterators.h" namespace dreal diff --git a/src/dreal/util/pattern_matching/trie_based/pattern_matching_trie_general.cc b/src/dreal/util/pattern_matching/trie_based/pattern_matching_trie_general.cc index d06975023..55751eef2 100644 --- a/src/dreal/util/pattern_matching/trie_based/pattern_matching_trie_general.cc +++ b/src/dreal/util/pattern_matching/trie_based/pattern_matching_trie_general.cc @@ -12,6 +12,7 @@ #include #include +#include "dreal/util/exception.h" #include "dreal/util/pattern_matching/matching_stats_t.h" namespace dreal From fd6a3e5817b734e34240cf2ba3de1f6ef9c6f27c Mon Sep 17 00:00:00 2001 From: Kunal Sheth Date: Sat, 27 Dec 2025 22:33:14 -0800 Subject: [PATCH 20/43] Re-enable the `ComplicatedMultiplicationExpression` pattern matching unit test. (Fixed alpha-hashing bug that was previously causing it to fail.) --- test/dreal/util/test/pattern_matching_test.cc | 2 -- 1 file changed, 2 deletions(-) diff --git a/test/dreal/util/test/pattern_matching_test.cc b/test/dreal/util/test/pattern_matching_test.cc index 0025e1e24..08bed8711 100644 --- a/test/dreal/util/test/pattern_matching_test.cc +++ b/test/dreal/util/test/pattern_matching_test.cc @@ -428,8 +428,6 @@ namespace dreal } TEST_F(PatternMatchingTest, ComplicatedMultiplicationExpression) { - GTEST_SKIP(); // broken after adding alpha hashing due to order of construction - std::vector es{ tanh(4 * x1 + 3), atan2((y2 - y1), (x2 - x1)), From 21b79558aa766b1f6eba23bef8f829d7c26d7b42 Mon Sep 17 00:00:00 2001 From: Kunal Sheth Date: Mon, 29 Dec 2025 03:32:40 -0800 Subject: [PATCH 21/43] =?UTF-8?q?Make=20returning=20of=20substitution=5Fma?= =?UTF-8?q?ps=20alongside=20alpha-equivalent=20Formula/Expressions=20optio?= =?UTF-8?q?nal=E2=80=94=20to=20avoid=20unnecessary=20copying=20in=20produc?= =?UTF-8?q?tion.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/dreal/solver/auditor.cc | 4 +- src/dreal/solver/auditor.h | 2 +- src/dreal/solver/sat_solver_interval_logic.cc | 2 +- .../map_based/DeBruijnCanonicalizer.cc | 19 ++++--- .../map_based/DeBruijnCanonicalizer.h | 12 ++-- .../trie_based/pattern_matching_trie.h | 32 +++++------ .../pattern_matching_trie_general.cc | 57 +++++-------------- src/dreal/util/predicate_normalizer.cc | 27 ++++----- src/dreal/util/predicate_normalizer.h | 9 +-- test/dreal/util/test/pattern_matching_test.cc | 13 +++-- 10 files changed, 74 insertions(+), 103 deletions(-) diff --git a/src/dreal/solver/auditor.cc b/src/dreal/solver/auditor.cc index f29e17ae6..16245ba92 100644 --- a/src/dreal/solver/auditor.cc +++ b/src/dreal/solver/auditor.cc @@ -137,7 +137,7 @@ namespace dreal void pm_dump_all( const std::vector& base_conflict, - const std::vector, substitutions_map>>& all_matches + const std::vector, std::optional>>& all_matches ) { DREAL_ASSERT(DREAL_EXPERIMENTAL_PM_DUMP_ALL_ENABLED); @@ -160,7 +160,7 @@ namespace dreal for (const auto& a : match_conflict) match_conflict_str.emplace_back(a.to_string()); std::map subs_strs; - for (const auto& [a,b] : subs.get_map()) subs_strs[a.get_name()] = b.get_name(); + for (const auto& [a,b] : subs->get_map()) subs_strs[a.get_name()] = b.get_name(); all_matches_json.emplace_back(match_conflict_str, subs_strs); } diff --git a/src/dreal/solver/auditor.h b/src/dreal/solver/auditor.h index 1508e98dd..71cbfdf1f 100644 --- a/src/dreal/solver/auditor.h +++ b/src/dreal/solver/auditor.h @@ -26,7 +26,7 @@ namespace dreal void pm_dump_all( const std::vector& base_conflict, - const std::vector, substitutions_map>>& all_matches + const std::vector, std::optional>>& all_matches ); } diff --git a/src/dreal/solver/sat_solver_interval_logic.cc b/src/dreal/solver/sat_solver_interval_logic.cc index 305285e77..62551cb23 100644 --- a/src/dreal/solver/sat_solver_interval_logic.cc +++ b/src/dreal/solver/sat_solver_interval_logic.cc @@ -146,7 +146,7 @@ namespace dreal const auto [ all_related_conflicts, match_statistics - ] = pn.FindSimilar(base_conflict, base_box, timeout); + ] = pn.FindSimilar(base_conflict, base_box, DREAL_EXPERIMENTAL_PM_DUMP_ALL_ENABLED, timeout); if (all_related_conflicts.empty()) { DREAL_LOG_INFO("Clause did not match with itself... Adding regularly."); return match_statistics; diff --git a/src/dreal/util/pattern_matching/map_based/DeBruijnCanonicalizer.cc b/src/dreal/util/pattern_matching/map_based/DeBruijnCanonicalizer.cc index 85e27a3a2..9fd939963 100644 --- a/src/dreal/util/pattern_matching/map_based/DeBruijnCanonicalizer.cc +++ b/src/dreal/util/pattern_matching/map_based/DeBruijnCanonicalizer.cc @@ -287,17 +287,20 @@ void DeBruijnCanonicalizer::name ( \ } template - std::pair>, matching_stats_t> DeBruijnCanonicalizer::find_matches(const T& f, const Box& box) { + std::pair>>, matching_stats_t> DeBruijnCanonicalizer::find_matches( + const T& f, const Box& box, const bool return_subs_maps + ) const { substitutions_map s(box, GetVars(f).size()); matching_stats_t stats = {0}; - std::vector> match_vec; + std::vector>> match_vec; find_matches( f, s, [&](const auto& m, const auto& s) { ++stats.matches; - match_vec.emplace_back(m, s); + if (return_subs_maps) match_vec.emplace_back(m, s); + else match_vec.emplace_back(m, std::nullopt); }, [&](const auto& reason) { handle_misses_reason(stats, reason); } ); @@ -306,11 +309,12 @@ void DeBruijnCanonicalizer::name ( \ } template - std::pair, substitutions_map>>, matching_stats_t> DeBruijnCanonicalizer::find_matches( - const std::vector& literals, const Box& box, std::chrono::duration timeout) const { + std::pair, std::optional>>, matching_stats_t> DeBruijnCanonicalizer::find_matches( + const std::vector& literals, const Box& box, const bool return_subs_maps, std::chrono::duration timeout + ) const { matching_stats_t stats = {0}; std::vector matches_vec; - std::vector, substitutions_map>> result; + std::vector, std::optional>> result; matches_vec.reserve(literals.size()); const auto start_time = std::chrono::steady_clock::now(); @@ -357,7 +361,8 @@ void DeBruijnCanonicalizer::name ( \ } } ++stats.matches; - result.emplace_back(matches_vec, s2); + if (return_subs_maps) result.emplace_back(matches_vec, s2); + else result.emplace_back(matches_vec, std::nullopt); } else find_matches(*it2, s2, match_next_literal(it2), misses); matches_vec.pop_back(); diff --git a/src/dreal/util/pattern_matching/map_based/DeBruijnCanonicalizer.h b/src/dreal/util/pattern_matching/map_based/DeBruijnCanonicalizer.h index e3d9ad73a..7093957c4 100644 --- a/src/dreal/util/pattern_matching/map_based/DeBruijnCanonicalizer.h +++ b/src/dreal/util/pattern_matching/map_based/DeBruijnCanonicalizer.h @@ -41,16 +41,16 @@ namespace dreal void insert(const T& atom); - [[nodiscard]] std::pair, substitutions_map>>, matching_stats_t> + [[nodiscard]] std::pair, std::optional>>, matching_stats_t> find_matches( - const std::vector& literals, - const Box& b, std::chrono::duration timeout = std::chrono::microseconds{-1} + const std::vector& literals, const Box& b, bool return_subs_maps, + std::chrono::duration timeout = std::chrono::microseconds{-1} ) const; - [[nodiscard]] std::pair>, matching_stats_t> find_matches( - const T& f, const Box& box - ); + [[nodiscard]] std::pair>>, matching_stats_t> find_matches( + const T& f, const Box& box, bool return_subs_maps + ) const; #define INSERT_DECL(name) void name ( \ diff --git a/src/dreal/util/pattern_matching/trie_based/pattern_matching_trie.h b/src/dreal/util/pattern_matching/trie_based/pattern_matching_trie.h index f3e1aa3c4..01a25ae66 100644 --- a/src/dreal/util/pattern_matching/trie_based/pattern_matching_trie.h +++ b/src/dreal/util/pattern_matching/trie_based/pattern_matching_trie.h @@ -29,34 +29,32 @@ namespace dreal using e_matches_vec = std::function; using f_matches_vec = std::function; - [[nodiscard]] std::pair, substitutions_map>>, matching_stats_t> + [[nodiscard]] std::pair, std::optional>>, matching_stats_t> find_matches( - const std::vector& literals, - const Box& b, std::chrono::duration timeout = std::chrono::microseconds{-1} + const std::vector& literals, const Box& b, bool return_subs_maps, + std::chrono::duration timeout = std::chrono::microseconds{-1} ) const; - [[nodiscard]] std::pair>, matching_stats_t> find_matches( - const Formula& f, - substitutions_map& substitutions + [[nodiscard]] std::pair>>, matching_stats_t> find_matches( + const Formula& f, substitutions_map& substitutions, bool return_subs_maps ) const; - [[nodiscard]] std::pair>, matching_stats_t> find_matches( - const Formula& f, const Box& box + [[nodiscard]] std::pair>>, matching_stats_t> find_matches( + const Formula& f, const Box& box, bool return_subs_maps ) const { substitutions_map s(box, f.GetFreeVariables().size()); - return find_matches(f, s); + return find_matches(f, s, return_subs_maps); } - [[nodiscard]] std::pair>, matching_stats_t> find_matches( - const Expression& e, - substitutions_map& substitutions + [[nodiscard]] std::pair>>, matching_stats_t> find_matches( + const Expression& e, substitutions_map& substitutions, bool return_subs_maps ) const; - [[nodiscard]] std::pair>, matching_stats_t> find_matches( - const Expression& e, const Box& b + [[nodiscard]] std::pair>>, matching_stats_t> find_matches( + const Expression& e, const Box& b, bool return_subs_maps ) const { substitutions_map s(b, e.GetVariables().size()); - return find_matches(e, s); + return find_matches(e, s, return_subs_maps); } // ended up being completely useless :( @@ -80,12 +78,12 @@ namespace dreal class TrieNode { public: - TrieNode(): id{init_id()}, children{4} {} + TrieNode() : id{init_id()}, children{4} {} explicit TrieNode( const std::optional& leaf, const std::optional& terminal_expression = {} - ): leaf{leaf}, terminal_expression{terminal_expression}, id{init_id()}, children{4} {} + ) : leaf{leaf}, terminal_expression{terminal_expression}, id{init_id()}, children{4} {} TrieNode(const TrieNode& other) = delete; // these should never be copied. diff --git a/src/dreal/util/pattern_matching/trie_based/pattern_matching_trie_general.cc b/src/dreal/util/pattern_matching/trie_based/pattern_matching_trie_general.cc index 55751eef2..4bbe081da 100644 --- a/src/dreal/util/pattern_matching/trie_based/pattern_matching_trie_general.cc +++ b/src/dreal/util/pattern_matching/trie_based/pattern_matching_trie_general.cc @@ -28,14 +28,14 @@ namespace dreal if (status == substitutions_map::CONST_MISS) stats.misses.bc_const++; } - std::pair, substitutions_map>>, matching_stats_t> + std::pair, std::optional>>, matching_stats_t> PatternMatchingTrie::find_matches( - const std::vector& literals, const Box& box, + const std::vector& literals, const Box& box, const bool return_subs_maps, const std::chrono::duration timeout ) const { matching_stats_t stats = {0}; std::vector matches_vec; - std::vector, substitutions_map>> result; + std::vector, std::optional>> result; matches_vec.reserve(literals.size()); const auto start_time = std::chrono::steady_clock::now(); @@ -87,7 +87,8 @@ namespace dreal // ) == 1); // } stats.matches++; - result.emplace_back(matches_vec, s2); + if (return_subs_maps) result.emplace_back(matches_vec, s2); + else result.emplace_back(matches_vec, std::nullopt); } else recMatchForm(*it2, f_root, s2, match_next_literal(it2), partial_matches, misses); matches_vec.pop_back(); @@ -114,20 +115,20 @@ namespace dreal return {result, stats}; } - std::pair>, matching_stats_t> + std::pair>>, matching_stats_t> PatternMatchingTrie::find_matches( - const Formula& f, - substitutions_map& substitutions + const Formula& f, substitutions_map& substitutions, const bool return_subs_maps ) const { const auto init_size = substitutions.size(); DREAL_LOG_TRACE("Finding matches for formula {}", fmt::streamed(f)); matching_stats_t stats = {0}; - std::vector> match_vec; + std::vector>> match_vec; recMatchForm( f, f_root, substitutions, PM_CONT_LAMBDA(m, s) { stats.matches++; - match_vec.emplace_back(m, s); + if (return_subs_maps) match_vec.emplace_back(m, s); + else match_vec.emplace_back(m, std::nullopt); }, PM_CONT_LAMBDA(n, s) { stats.partial_matches++; @@ -139,20 +140,20 @@ namespace dreal return {match_vec, stats}; } - std::pair>, matching_stats_t> + std::pair>>, matching_stats_t> PatternMatchingTrie::find_matches( - const Expression& e, - substitutions_map& substitutions + const Expression& e, substitutions_map& substitutions, const bool return_subs_maps ) const { const auto init_size = substitutions.size(); DREAL_LOG_TRACE("Finding matches for expression {}", fmt::streamed(e)); matching_stats_t stats = {0}; - std::vector> match_vec; + std::vector>> match_vec; recMatchExpr( e, e_root, substitutions, PM_CONT_LAMBDA(m, s) { stats.matches++; - match_vec.emplace_back(m, s); + if (return_subs_maps) match_vec.emplace_back(m, s); + else match_vec.emplace_back(m, std::nullopt); }, PM_CONT_LAMBDA(n, s) { stats.partial_matches++; @@ -164,34 +165,6 @@ namespace dreal return {match_vec, stats}; } - // uint64_t PatternMatchingTrie::estimate_branches(const Formula& f) { - // const auto it = f_branch_est_cache.find(f); - // if (it != f_branch_est_cache.end()) return it->second; - // - // uint64_t branches = 1; - // const f_est_continuation_vec partial_matches = EST_CONT_LAMBDA(n) { - // DREAL_LOG_ERROR("Unterminated partial matching?"); - // DREAL_UNREACHABLE(); // everything should AT LEAST match itself !?!?! - // }; - // recEstForm(f, f_root, branches, partial_matches); - // f_branch_est_cache.emplace(f, branches); - // return branches; - // } - // - // uint64_t PatternMatchingTrie::estimate_branches(const Expression& e) { - // const auto it = e_branch_est_cache.find(e); - // if (it != e_branch_est_cache.end()) return it->second; - // - // uint64_t branches = 1; - // const e_est_continuation_vec partial_matches = EST_CONT_LAMBDA(n) { - // DREAL_LOG_ERROR("Unterminated partial matching?"); - // DREAL_UNREACHABLE(); // everything should AT LEAST match itself !?!?! - // }; - // recEstExpr(e, e_root, branches, partial_matches); - // e_branch_est_cache.emplace(e, branches); - // return branches; - // } - void PatternMatchingTrie::insert(const Formula& f) { // if (f_already_inserted.count(f)) return; // was relevant during c_unique() attempt. recAddForm(f, f_root, f); diff --git a/src/dreal/util/predicate_normalizer.cc b/src/dreal/util/predicate_normalizer.cc index 2945ef568..7705803dd 100644 --- a/src/dreal/util/predicate_normalizer.cc +++ b/src/dreal/util/predicate_normalizer.cc @@ -21,17 +21,17 @@ namespace dreal { - std::pair, substitutions_map>>, matching_stats_t> + std::pair, std::optional>>, matching_stats_t> PredicateNormalizer::FindSimilar( - const std::vector& ordered_clause, const Box &box, + const std::vector& ordered_clause, const Box& box, const bool return_subs_maps, const std::chrono::duration timeout - ) const { + ) const { if (DREAL_LOG_DEBUG_ENABLED) { - std::ostringstream s; - s << "!("; - for (const auto& lit : ordered_clause) s << '(' << lit << ") and "; - s << ")"; - DREAL_LOG_DEBUG("Finding matches for: {}", s.str()); + std::ostringstream s; + s << "!("; + for (const auto& lit : ordered_clause) s << '(' << lit << ") and "; + s << ")"; + DREAL_LOG_DEBUG("Finding matches for: {}", s.str()); } // todo `std::reverse()` and compare performance. @@ -42,16 +42,9 @@ namespace dreal is_equal_to(atom) || is_less_than(atom) || is_less_than_or_equal_to(atom) || is_forall(atom) || is_integral(atom) || is_forallT(atom)); } - return trie.find_matches(ordered_clause, box, timeout); + return trie.find_matches(ordered_clause, box, return_subs_maps, timeout); } - // ended up being completely friggen useless lol :( - // uint64_t PredicateNormalizer::EstimateMatchingCost(const std::set& f) { - // uint64_t branches = 1; - // for (const auto & lit : f) branches += trie.estimate_branches(lit); - // return branches; - // } - Formula PredicateNormalizer::Convert(const Formula& f) { const auto it = cache.find(f); if (it == cache.cend()) { @@ -103,7 +96,7 @@ namespace dreal trie.insert(!f); heuristic.collect_statistics(f); heuristic.collect_statistics(!f); - const auto *const fa = to_forallT(f); + const auto* const fa = to_forallT(f); return forallT(fa->get_flow(), fa->get_lb(), fa->get_ub(), Convert(fa->get_bound_f())); } diff --git a/src/dreal/util/predicate_normalizer.h b/src/dreal/util/predicate_normalizer.h index d49c93a1c..513ac4566 100644 --- a/src/dreal/util/predicate_normalizer.h +++ b/src/dreal/util/predicate_normalizer.h @@ -32,15 +32,12 @@ namespace dreal Formula Convert(const Formula& f); [[nodiscard]] std::pair< - std::vector, substitutions_map>>, matching_stats_t + std::vector, std::optional>>, matching_stats_t > FindSimilar( - const std::vector& ordered_clause, - const Box& b, std::chrono::duration timeout = std::chrono::microseconds{-1} + const std::vector& ordered_clause, const Box& b, + bool return_subs_maps, std::chrono::duration timeout = std::chrono::microseconds{-1} ) const; - // useless heuristic - // uint64_t EstimateMatchingCost(const std::set& f); - PredicateHeuristic heuristic; // todo: make private? private: diff --git a/test/dreal/util/test/pattern_matching_test.cc b/test/dreal/util/test/pattern_matching_test.cc index 08bed8711..18b491b24 100644 --- a/test/dreal/util/test/pattern_matching_test.cc +++ b/test/dreal/util/test/pattern_matching_test.cc @@ -93,7 +93,9 @@ namespace dreal for (const auto& miss : misses1) trie.insert(miss); for (const auto& miss : misses2) trie2.insert(miss); std::set found; - for (const auto& [form, subs] : trie.find_matches(pattern, Box{}).first) { + for (const auto& [form, op_subs] : trie.find_matches(pattern, Box{}, true).first) { + EXPECT_TRUE(op_subs.has_value()); // trie.find_matches(..., return_subs_maps=true) + const auto& subs = *op_subs; // check substitutions are correct and injective: EXPECT_TRUE(substitutions_map::apply_substitution(form, subs, false).EqualTo(pattern)); EXPECT_TRUE(substitutions_map::apply_substitution(pattern, subs, true).EqualTo(form)); @@ -134,11 +136,13 @@ namespace dreal }; for (const auto& lit : literals) trie.insert(lit); const auto [related_clauses, stats] = trie.find_matches( - {y1 == sin(x1), y1 == atan(x1)}, Box{} + {y1 == sin(x1), y1 == atan(x1)}, Box{}, false ); EXPECT_EQ(stats.misses.bc_bij, 2); EXPECT_EQ(stats.matches, 2); EXPECT_EQ(related_clauses.size(), 2); + EXPECT_EQ(related_clauses[0].second, std::nullopt); // trie.find_matches(..., return_subs_maps=false) + EXPECT_EQ(related_clauses[1].second, std::nullopt); // EXPECT_EQ(trie.estimate_branches(y1 == sin(x1)), 12); // todo: make less brittle... depends on hash values. @@ -622,12 +626,13 @@ namespace dreal pattern.Substitute({{x1, p1}, {x2, p2}}), }; for (const auto& match : matches) { - const auto found = trie.find_matches(match, Box{}).first; + const auto found = trie.find_matches(match, Box{}, false).first; EXPECT_EQ(found.size(), 1); + EXPECT_EQ(found[0].second, std::nullopt); // trie.find_matches(..., return_subs_maps=false) std::cout << pattern << " MATCHES " << match << std::endl; } for (const auto& miss : misses) { - const auto found = trie.find_matches(miss, Box{}).first; + const auto found = trie.find_matches(miss, Box{}, false).first; EXPECT_EQ(found.size(), 0); std::cout << pattern << " MISSES " << miss << std::endl; } From 1ec5b67512a346277023dc5dc9ddea671e2e4ce1 Mon Sep 17 00:00:00 2001 From: Kunal Sheth Date: Mon, 29 Dec 2025 05:07:31 -0800 Subject: [PATCH 22/43] Add missing includes for Linux build. --- .../util/pattern_matching/substitution_tree/substitution_tree.h | 2 ++ .../util/pattern_matching/trie_based/pattern_matching_trie.h | 1 + 2 files changed, 3 insertions(+) diff --git a/src/dreal/util/pattern_matching/substitution_tree/substitution_tree.h b/src/dreal/util/pattern_matching/substitution_tree/substitution_tree.h index d062c0662..e51a0b695 100644 --- a/src/dreal/util/pattern_matching/substitution_tree/substitution_tree.h +++ b/src/dreal/util/pattern_matching/substitution_tree/substitution_tree.h @@ -5,6 +5,8 @@ #ifndef DREAL4_CMAKE_SUBSTITUTION_TREE_H #define DREAL4_CMAKE_SUBSTITUTION_TREE_H #include +#include +#include #include "dreal/symbolic/symbolic.h" #include "dreal/util/pattern_matching/substitutions_map.h" diff --git a/src/dreal/util/pattern_matching/trie_based/pattern_matching_trie.h b/src/dreal/util/pattern_matching/trie_based/pattern_matching_trie.h index 01a25ae66..c649d96c6 100644 --- a/src/dreal/util/pattern_matching/trie_based/pattern_matching_trie.h +++ b/src/dreal/util/pattern_matching/trie_based/pattern_matching_trie.h @@ -6,6 +6,7 @@ #define pattern_matching_trie_H #include +#include #include #include From b8c41f3647bae5cf76138b345c7c01bfd40d15f5 Mon Sep 17 00:00:00 2001 From: Kunal Sheth Date: Mon, 29 Dec 2025 13:12:43 -0800 Subject: [PATCH 23/43] Check for cache hits during DeBruijnCanonicalizer.cc insertion. --- .../util/pattern_matching/map_based/DeBruijnCanonicalizer.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/dreal/util/pattern_matching/map_based/DeBruijnCanonicalizer.cc b/src/dreal/util/pattern_matching/map_based/DeBruijnCanonicalizer.cc index 9fd939963..9e3685967 100644 --- a/src/dreal/util/pattern_matching/map_based/DeBruijnCanonicalizer.cc +++ b/src/dreal/util/pattern_matching/map_based/DeBruijnCanonicalizer.cc @@ -229,6 +229,8 @@ void DeBruijnCanonicalizer::name ( \ template void DeBruijnCanonicalizer::insert(const T& atom) { + if (canonicalization_cache.count(atom) > 0) return; + auto [structure, indices, concrete_vars] = canonicalize_atom(atom); // const auto [it, _] = structure_to_indices_to_concrete.try_emplace(std::move(structure)); const auto [it, _] = structure_to_concrete.try_emplace(std::move(structure)); @@ -239,7 +241,6 @@ void DeBruijnCanonicalizer::name ( \ // DREAL_ASSERT(it->second.size() == 1); // We shouldn't need this middle layer... indices should be baked into the dummy variable names. odot: remove. concretes.insert(concrete_vars, atom); - canonicalization_cache.try_emplace(atom, canon_structure, std::move(indices), std::move(concrete_vars)); } From 47d046e6aed4811a3f9613c7b161e269e662d8e5 Mon Sep 17 00:00:00 2001 From: Kunal Sheth Date: Mon, 29 Dec 2025 13:13:35 -0800 Subject: [PATCH 24/43] Change "Failed to configure desired stack size limit." message from fatal error to warning. --- src/dreal/dreal_main.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/dreal/dreal_main.cc b/src/dreal/dreal_main.cc index 5bd4854e5..cfef472e5 100644 --- a/src/dreal/dreal_main.cc +++ b/src/dreal/dreal_main.cc @@ -525,11 +525,12 @@ int main(int argc, const char* argv[]) { rl.rlim_cur = 0; getrlimit(RLIMIT_STACK, &rl); if (rl.rlim_cur < desired_stack_size) { + // `DREAL_LOG_*` functions have not been initialized yet. std::cerr << "Failed to configure desired stack size limit. Exiting." << std::endl; std::cerr << "\tCurrent Size = " << rl.rlim_cur << std::endl; std::cerr << "\tMaximum Size = " << rl.rlim_max << std::endl; std::cerr << "\tDesired Size = " << desired_stack_size << std::endl; - exit(-1); + // exit(-1); } std::signal(SIGINT, HandleSigInt); From 98dda94f66657cccf4094bf1b8962b0456937525 Mon Sep 17 00:00:00 2001 From: Kunal Sheth Date: Mon, 29 Dec 2025 13:15:20 -0800 Subject: [PATCH 25/43] Update docker build to ubuntu 24.04 LTS. --- Dockerfile.dreal_ubuntu | 12 ++++++------ README.md | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/Dockerfile.dreal_ubuntu b/Dockerfile.dreal_ubuntu index b681ff490..51a192f5c 100644 --- a/Dockerfile.dreal_ubuntu +++ b/Dockerfile.dreal_ubuntu @@ -1,4 +1,4 @@ -FROM ubuntu:20.04 +FROM ubuntu:24.04 RUN DEBIAN_FRONTEND="noninteractive" apt-get update && apt-get -y install tzdata @@ -17,6 +17,7 @@ RUN apt-get update \ ENV CC="/usr/bin/clang-18" ENV CXX="/usr/bin/clang++-18" +RUN apt-get install -y xz-utils RUN cd / && \ wget https://gmplib.org/download/gmp/gmp-6.3.0.tar.xz && \ tar -xf gmp-6.3.0.tar.xz @@ -71,16 +72,15 @@ RUN rm /usr/local/lib/libgmpxx.so* # for ODEs... all installs from dReal3 RUN apt-get update \ && apt-get install -y \ - build-essential \ autoconf \ automake \ + build-essential \ + git-svn \ libtool \ pkg-config \ + python3 python3-dev \ software-properties-common \ - texinfo \ - python python3 python-dev python3-dev - - + texinfo # BEGIN DREAL BUILD RUN mkdir /dreal/ diff --git a/README.md b/README.md index c71ab7eff..d06fae9dc 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@ In this directory, run: docker build --platform linux/amd64 -t dreal/my_dreal_image:1.0 -f Dockerfile.dreal_ubuntu . ``` -This will probably take 20+ minutes. +This takes 30–40 minutes on my M4 MacBook Pro (cold start). ### Execute ``` From 3efcebe4a2b0a380743f2925643efcc6354201e2 Mon Sep 17 00:00:00 2001 From: Kunal Sheth Date: Wed, 31 Dec 2025 22:52:46 -0800 Subject: [PATCH 26/43] Tweak matching_stats_t misses to be array instead of hardcoded fields. --- src/dreal/solver/sat_solver_interval_logic.cc | 5 ++-- .../map_based/DeBruijnCanonicalizer.cc | 27 +++++-------------- .../util/pattern_matching/matching_stats_t.h | 24 +++++++---------- .../util/pattern_matching/substitutions_map.h | 6 ++++- .../pattern_matching_trie_general.cc | 24 +++++------------ 5 files changed, 30 insertions(+), 56 deletions(-) diff --git a/src/dreal/solver/sat_solver_interval_logic.cc b/src/dreal/solver/sat_solver_interval_logic.cc index 62551cb23..6f5aa8679 100644 --- a/src/dreal/solver/sat_solver_interval_logic.cc +++ b/src/dreal/solver/sat_solver_interval_logic.cc @@ -6,6 +6,7 @@ #include #include "auditor.h" +#include "dreal/util/pattern_matching/substitutions_map.h" #include "filter_assertion.h" #include "sat_solver.h" #include "dreal/version.h" @@ -151,8 +152,6 @@ namespace dreal DREAL_LOG_INFO("Clause did not match with itself... Adding regularly."); return match_statistics; } - if (match_statistics.misses.bc_box) - DREAL_LOG_INFO("Rejected {} matches due to box-missmatch.", match_statistics.misses.bc_box); if (DREAL_EXPERIMENTAL_THEORY_AUDIT_ENABLED) { std::set s(base_conflict.begin(), base_conflict.end()); @@ -371,4 +370,4 @@ namespace dreal std::cerr << "SAT Solver Learned: " << sat_clause << std::endl; } } -} // namespace dreal +} // namespace dreal \ No newline at end of file diff --git a/src/dreal/util/pattern_matching/map_based/DeBruijnCanonicalizer.cc b/src/dreal/util/pattern_matching/map_based/DeBruijnCanonicalizer.cc index 9e3685967..ede833e13 100644 --- a/src/dreal/util/pattern_matching/map_based/DeBruijnCanonicalizer.cc +++ b/src/dreal/util/pattern_matching/map_based/DeBruijnCanonicalizer.cc @@ -11,6 +11,7 @@ #include "dreal/util/assert.h" #include "dreal/util/exception.h" #include "dreal/util/logging.h" +#include namespace dreal { @@ -271,22 +272,6 @@ void DeBruijnCanonicalizer::name ( \ return; } - template - void handle_misses_reason( - matching_stats_t& stats, - const substitutions_map::substitution_status& status - ) { - // TYPE_MISS, BOX_MISS, BIJ_MISS, CONST_MISS - if (status == substitutions_map::STRUCTURE_MISS) ++stats.misses.bc_structure; - else if (status == substitutions_map::INDICES_MISS) ++stats.misses.bc_indices; - else if (status == substitutions_map::TYPE_MISS) ++stats.misses.bc_type; - else if (status == substitutions_map::BOX_MISS) ++stats.misses.bc_box; - else if (status == substitutions_map::BIJ_MISS) ++stats.misses.bc_bij; - else if (status == substitutions_map::CONST_MISS) ++stats.misses.bc_const; - else - DREAL_UNREACHABLE(); - } - template std::pair>>, matching_stats_t> DeBruijnCanonicalizer::find_matches( const T& f, const Box& box, const bool return_subs_maps @@ -298,12 +283,12 @@ void DeBruijnCanonicalizer::name ( \ find_matches( f, s, - [&](const auto& m, const auto& s) { + [&](const auto& m, const auto& s) -> auto { ++stats.matches; if (return_subs_maps) match_vec.emplace_back(m, s); else match_vec.emplace_back(m, std::nullopt); }, - [&](const auto& reason) { handle_misses_reason(stats, reason); } + [&](const auto& reason) { ++stats.misses_bc.at(reason); } ); return {std::move(match_vec), std::move(stats)}; @@ -320,7 +305,7 @@ void DeBruijnCanonicalizer::name ( \ const auto start_time = std::chrono::steady_clock::now(); - const misses_vec misses = [&](const auto& reason) { handle_misses_reason(stats, reason); }; + const misses_vec misses = [&](const auto& reason) { ++stats.misses_bc.at(reason); }; bool did_time_out = false; @@ -329,7 +314,7 @@ void DeBruijnCanonicalizer::name ( \ // std::unordered_set seen_truncateds; // lexo-compare for nary goes one by one... // seen_truncateds.reserve(1024 * literals.size()); std::function< - std::function(typeof(ibegin)) + std::function (typeof(ibegin)) > match_next_literal = [&](const auto& it1) { return [&, /*copy*/ it1](const auto& f, auto& s2) { if (did_time_out || std::chrono::steady_clock::now() - start_time > timeout) { @@ -391,4 +376,4 @@ void DeBruijnCanonicalizer::name ( \ // Force template code generation into this translation unit. template class DeBruijnCanonicalizer; template class DeBruijnCanonicalizer; -} +} \ No newline at end of file diff --git a/src/dreal/util/pattern_matching/matching_stats_t.h b/src/dreal/util/pattern_matching/matching_stats_t.h index f2f9b9624..d0bae5568 100644 --- a/src/dreal/util/pattern_matching/matching_stats_t.h +++ b/src/dreal/util/pattern_matching/matching_stats_t.h @@ -4,21 +4,17 @@ #ifndef DREAL4_CMAKE_MATCHING_STATS_T_H #define DREAL4_CMAKE_MATCHING_STATS_T_H +#include "substitutions_map.h" +#include -typedef struct +namespace dreal { - struct + using matching_stats_t = struct { - unsigned bc_structure; - unsigned bc_indices; - unsigned bc_type; - unsigned bc_box; - unsigned bc_bij; - unsigned bc_const; - } misses; + std::array misses_bc; + unsigned partial_matches; + unsigned matches; + }; +} // namespace dreal - unsigned partial_matches; - unsigned matches; -} matching_stats_t; - -#endif //DREAL4_CMAKE_MATCHING_STATS_T_H \ No newline at end of file +#endif //DREAL4_CMAKE_MATCHING_STATS_T_H diff --git a/src/dreal/util/pattern_matching/substitutions_map.h b/src/dreal/util/pattern_matching/substitutions_map.h index c56ea8a7e..b2be0b249 100644 --- a/src/dreal/util/pattern_matching/substitutions_map.h +++ b/src/dreal/util/pattern_matching/substitutions_map.h @@ -32,7 +32,11 @@ namespace dreal typedef enum { - SUCCESS, STRUCTURE_MISS, INDICES_MISS, TYPE_MISS, BOX_MISS, BIJ_MISS, CONST_MISS + SUCCESS, STRUCTURE_MISS, INDICES_MISS, TYPE_MISS, BOX_MISS, BIJ_MISS, CONST_MISS, +#ifdef CAV26_FILTER_SYMMETRIES + CAV26_NOT_PURE_TIME, CAV26_NOT_PURE_LOGIC, +#endif + LEN_substitution_statuses } substitution_status; substitution_status attempt_substitution(const Variable& a, const Variable& aP); diff --git a/src/dreal/util/pattern_matching/trie_based/pattern_matching_trie_general.cc b/src/dreal/util/pattern_matching/trie_based/pattern_matching_trie_general.cc index 4bbe081da..2ce808fe4 100644 --- a/src/dreal/util/pattern_matching/trie_based/pattern_matching_trie_general.cc +++ b/src/dreal/util/pattern_matching/trie_based/pattern_matching_trie_general.cc @@ -17,17 +17,6 @@ namespace dreal { - void handle_misses_reason( - matching_stats_t& stats, - const substitutions_map::substitution_status& status - ) { - // TYPE_MISS, BOX_MISS, BIJ_MISS, CONST_MISS - if (status == substitutions_map::TYPE_MISS) stats.misses.bc_type++; - if (status == substitutions_map::BOX_MISS) stats.misses.bc_box++; - if (status == substitutions_map::BIJ_MISS) stats.misses.bc_bij++; - if (status == substitutions_map::CONST_MISS) stats.misses.bc_const++; - } - std::pair, std::optional>>, matching_stats_t> PatternMatchingTrie::find_matches( const std::vector& literals, const Box& box, const bool return_subs_maps, @@ -40,8 +29,9 @@ namespace dreal const auto start_time = std::chrono::steady_clock::now(); - const f_misses_vec misses = [&](const auto& reason) { handle_misses_reason(stats, reason); }; - const f_partial_matches_vec partial_matches = PM_CONT_LAMBDA(n, s) { + const f_misses_vec misses = [&](const auto& reason) { ++stats.misses_bc.at(reason); }; + const f_partial_matches_vec partial_matches = PM_CONT_LAMBDA(n, s) + { DREAL_LOG_ERROR("Unterminated partial matching?"); DREAL_UNREACHABLE(); // everything should AT LEAST match itself !?!?! }; @@ -53,7 +43,7 @@ namespace dreal std::unordered_set seen_truncateds; // lexo-compare for nary goes one by one... seen_truncateds.reserve(1024 * literals.size()); std::function< - std::function(typeof(ibegin)) + std::function (typeof(ibegin)) > match_next_literal = [&](const auto& it1) { return [&, /*copy*/ it1](const auto& f, auto& s2) { if (did_time_out || std::chrono::steady_clock::now() - start_time > timeout) { @@ -134,7 +124,7 @@ namespace dreal stats.partial_matches++; DREAL_LOG_ERROR("Unterminated partial matching? Not sure if this should ever be reachable."); }, - [&](const auto& reason) { handle_misses_reason(stats, reason); } + [&](const auto& reason) { ++stats.misses_bc.at(reason); } ); DREAL_ASSERT(substitutions.size() == init_size); return {match_vec, stats}; @@ -159,7 +149,7 @@ namespace dreal stats.partial_matches++; DREAL_LOG_ERROR("Unterminated partial matching? Not sure if this should ever be reachable."); }, - [&](const auto& reason) { handle_misses_reason(stats, reason); } + [&](const auto& reason) { ++stats.misses_bc.at(reason); } ); DREAL_ASSERT(substitutions.size() == init_size); return {match_vec, stats}; @@ -176,4 +166,4 @@ namespace dreal recAddExpr(e, e_root, e); // e_already_inserted.emplace(e); } -} +} \ No newline at end of file From ffab0581323b06a2ac75b062aafc47334789d60c Mon Sep 17 00:00:00 2001 From: Kunal Sheth Date: Wed, 31 Dec 2025 22:54:06 -0800 Subject: [PATCH 27/43] Add CAV26 symmetry filtering and remove `GENERATE_HEURISTICS_CSV` functionality from context_impl.cc. --- src/dreal/solver/context.cc | 13 + src/dreal/solver/context_impl.cc | 271 ++++++------------ .../pattern_matching/CAV26_varname_parser.h | 61 ++++ .../pattern_matching/substitutions_map.cc | 26 +- .../util/pattern_matching/substitutions_map.h | 8 + src/dreal/version.h | 10 +- 6 files changed, 198 insertions(+), 191 deletions(-) create mode 100644 src/dreal/util/pattern_matching/CAV26_varname_parser.h diff --git a/src/dreal/solver/context.cc b/src/dreal/solver/context.cc index 0d5974f5d..0deab786b 100644 --- a/src/dreal/solver/context.cc +++ b/src/dreal/solver/context.cc @@ -137,6 +137,19 @@ string Context::version() { oss << ".GENERATE_CSV"; #endif +#ifdef CAV26_FILTER_SYMMETRIES +#define STRINGIFY(x) #x +#define STR(x) STRINGIFY(x) + oss << ".CAV26_FILTER_"; + static_assert(!(CAV26_MATCH_ACROSS_TIME_ONLY && CAV26_MATCH_ACROSS_LOGIC_ONLY)); + if (CAV26_MATCH_ACROSS_TIME_ONLY) oss << "TIME_ONLY"; + else if (CAV26_MATCH_ACROSS_LOGIC_ONLY) oss << "LOGIC_ONLY"; + else oss << "NONE"; + oss << "_using_" STR(CAV26_VARNAME_PARSER); +#undef STR +#undef STRINGIFY +#endif + return oss.str(); } diff --git a/src/dreal/solver/context_impl.cc b/src/dreal/solver/context_impl.cc index b21970be3..49e78428c 100644 --- a/src/dreal/solver/context_impl.cc +++ b/src/dreal/solver/context_impl.cc @@ -16,9 +16,8 @@ #include "dreal/solver/context_impl.h" #include -#include -#include -#include +#include +#include #include #include #include @@ -26,11 +25,11 @@ #include #include #include -#include #include #include +#include "dreal/util/pattern_matching/substitutions_map.h" #include "dreal/version.h" #include "dreal/solver/auditor.h" #include "dreal/solver/filter_assertion.h" @@ -137,36 +136,41 @@ void Context::Impl::Assert(const Formula& f) { } } +void drpm_benchmark_log( + const bool fully_constrained_model, + const double sat_solve_elapsed_ms, + const double theory_solve_elapsed_ms, + const unsigned lemma_size, + const char mode, + const double pm_elapsed_ms, + const unsigned num_pm, +#ifdef CAV26_FILTER_SYMMETRIES + const unsigned CAV26_pm_num_not_pure_time, + const unsigned CAV26_pm_num_not_pure_logic, +#endif + std::ostream& out +) { + out << ".\t"; + out << " S.FCM " << fully_constrained_model; + out << " S.ms " << sat_solve_elapsed_ms; + out << " T.ms " << theory_solve_elapsed_ms; + out << '\t'; + out << " L " << lemma_size; + out << ' ' << mode; + out << "\t"; + out << " PM.ms " << pm_elapsed_ms; + out << " PM " << num_pm; +#ifdef CAV26_FILTER_SYMMETRIES + out << '\t'; + out << " C26.npT " << CAV26_pm_num_not_pure_time; + out << " C26.npL " << CAV26_pm_num_not_pure_logic; +#endif + out << '\n'; +} + optional Context::Impl::CheckSatCore(const ScopedVector& stack, Box box, SatSolver* const sat_solver) { - //////////////////////////////////////////////////////////////////////////////// -#ifdef DREAL_EXPERIMENTAL_GENERATE_HEURISTICS_CSV - std::ofstream myfile; - { - std::ostringstream s; - s << "./kunal_paper_data_epoch"; - s << std::chrono::system_clock::now().time_since_epoch().count(); - - // Seed random number generator with high-resolution clock - static std::mt19937 rng(std::chrono::high_resolution_clock::now().time_since_epoch().count()); - static std::uniform_int_distribution dist(1000, 9999); // random 4-digit numbers - - s << "_random" << dist(rng) << dist(rng) << dist(rng) << dist(rng);; - s << ".csv"; - const auto file_name = s.str(); - - std::cout << "Logging statistics to " << file_name << std::endl; - std::cerr << "Logging statistics to " << file_name << std::endl; - - myfile.open(file_name, std::ios::app); - if (!myfile) throw DREAL_RUNTIME_ERROR("Failed to open log file"); - } -#endif - - PatternMatchingHeuristic::statistics kunal_paper_data{0}; - //////////////////////////////////////////////////////////////////////////////// - DREAL_LOG_DEBUG("ContextImpl::CheckSatCore()"); DREAL_LOG_TRACE("ContextImpl::CheckSat: Box =\n{}", box); if (box.empty()) return {}; @@ -177,49 +181,8 @@ optional Context::Impl::CheckSatCore(const ScopedVector& stack, DREAL_LOG_DEBUG("ContextImpl::CheckSatCore() - Found Model\n{}", box); return box; } - - //////////////////////////////////////////////////////////////////////////////// -#ifdef DREAL_EXPERIMENTAL_GENERATE_HEURISTICS_CSV - { - std::ostringstream s; - s << "box_continuous_count,"; - s << "box_integer_count,"; - s << "box_boolean_count,"; - s << "assertions_size,"; - s << PredicateHeuristic::predicate_stats_csv_header("assertions_stats_") << ','; - s << PredicateHeuristic::predicate_stats_csv_header("biggest_assertion_stats_") << ','; - s << PredicateHeuristic::predicate_stats_csv_header("middle_assertion_stats_") << ','; - s << PredicateHeuristic::predicate_stats_csv_header("smallest_assertion_stats_") << ','; - s << "theory_checksat_ms,"; - s << "lemma_size,"; - s << PredicateHeuristic::predicate_stats_csv_header("lemma_stats_") << ','; - s << PredicateHeuristic::predicate_stats_csv_header("biggest_literal_stats_") << ','; - s << PredicateHeuristic::predicate_stats_csv_header("middle_literal_stats_") << ','; - s << PredicateHeuristic::predicate_stats_csv_header("smallest_literal_stats_") << ','; - s << "estimated_matching_cost,"; - s << "pattern_match_ms,"; - s << PatternMatchingTrie::matching_stats_csv_header("pattern_matching_stats_"); - myfile << s.str() << std::endl; - } -#endif - //////////////////////////////////////////////////////////////////////////////// - - //////////////////////////////////////////////////////////////////////////////// - for (const auto & variable : box.variables()) { - if (variable.get_type() == Variable::Type::CONTINUOUS) kunal_paper_data.box_continuous_count++; - else if (variable.get_type() == Variable::Type::INTEGER) kunal_paper_data.box_integer_count++; - else if (variable.get_type() == Variable::Type::BOOLEAN) kunal_paper_data.box_boolean_count++; - else if (variable.get_type() == Variable::Type::BINARY) kunal_paper_data.box_boolean_count++; - else DREAL_UNREACHABLE(); - } - //////////////////////////////////////////////////////////////////////////////// - DREAL_LOG_INFO("Initialized. Beginning SAT <=> Theory cycles."); - DREAL_LOG_INFO( - "{} continuous variables. {} integer variables. {} boolean variables. Fully Constrained: {}", - kunal_paper_data.box_continuous_count, kunal_paper_data.box_integer_count, kunal_paper_data.box_boolean_count, - recent_under_constrained_deltasat > 0 - ); + std::cerr << std::setprecision(3); while (true) { // Note that 'DREAL_CHECK_INTERRUPT' is only defined in setup.py, // when we build dReal python package. @@ -234,7 +197,13 @@ optional Context::Impl::CheckSatCore(const ScopedVector& stack, DREAL_EXPERIMENTAL_SAT_MODEL_FULL_CONSTRAINTS || recent_under_constrained_deltasat > 0; + /* ################################ START MEASURING TIME ################################ */ + const auto scs_start = std::chrono::high_resolution_clock::now(); const auto optional_model_and_fully_constrained = sat_solver->CheckSat(request_fully_constrained); + const auto scs_end = std::chrono::high_resolution_clock::now(); + const std::chrono::duration scs_elapsed_ms = scs_end - scs_start; + /* ################################ STOP MEASURING TIME ################################ */ + if (optional_model_and_fully_constrained) { const auto& [optional_model, is_full_constrained] = *optional_model_and_fully_constrained; if (request_fully_constrained) DREAL_ASSERT(is_full_constrained); @@ -260,27 +229,12 @@ optional Context::Impl::CheckSatCore(const ScopedVector& stack, return a.GetFreeVariables().size() < b.GetFreeVariables().size(); // ascending }); - //////////////////////////////////////////////////////////////////////////////// - kunal_paper_data.assertions_size = assertions.size(); - -#ifdef DREAL_EXPERIMENTAL_GENERATE_HEURISTICS_CSV - const auto ranking_start1 = std::chrono::high_resolution_clock::now(); - std::set assertions_set(assertions.begin(), assertions.end()); - kunal_paper_data.assertions_stats = pn_.heuristic.collect_statistics(make_conjunction_SKIP_CHECKS_KUNAL_HACK(std::move(assertions_set))); - // cheap because cached. - kunal_paper_data.smallest_assertion_stats = pn_.heuristic.collect_statistics(assertions[0]); - kunal_paper_data.middle_assertion_stats = pn_.heuristic.collect_statistics(assertions[assertions.size()/2]); - kunal_paper_data.biggest_assertion_stats = pn_.heuristic.collect_statistics(assertions[assertions.size()-1]); - const auto ranking_end1 = std::chrono::high_resolution_clock::now(); - const std::chrono::duration ranking_elapsed1 = ranking_end1 - ranking_start1; -#endif - - const auto tscs_start = std::chrono::high_resolution_clock::now(); + /* ################################ START MEASURING TIME ################################ */ + const auto tcs_start = std::chrono::high_resolution_clock::now(); const auto tscs_result = theory_solver_.CheckSat(box, assertions); - const auto tscs_end = std::chrono::high_resolution_clock::now(); - const std::chrono::duration tscs_elapsed = tscs_end - tscs_start; - kunal_paper_data.theory_checksat_ms = tscs_elapsed.count(); - //////////////////////////////////////////////////////////////////////////////// + const auto tcs_end = std::chrono::high_resolution_clock::now(); + const std::chrono::duration tcs_elapsed_ms = tcs_end - tcs_start; + /* ################################ STOP MEASURING TIME ################################ */ if (tscs_result && !is_full_constrained) { // SAT from TheorySolver. @@ -312,109 +266,48 @@ optional Context::Impl::CheckSatCore(const ScopedVector& stack, return a.GetFreeVariables().size() > b.GetFreeVariables().size(); // descending }); - //////////////////////////////////////////////////////////////////////////////// - kunal_paper_data.lemma_size = explanation.size(); - -#ifdef DREAL_EXPERIMENTAL_GENERATE_HEURISTICS_CSV - const auto ranking_start2 = std::chrono::high_resolution_clock::now(); - // kunal_paper_data.lemma_stats = pn_.heuristic.collect_statistics(!make_conjunction_SKIP_CHECKS_KUNAL_HACK(explanation.first)); - // doing individual literals doesn't cost extra because they cache hit after running the entire conjunction - kunal_paper_data.biggest_literal_stats = pn_.heuristic.collect_statistics(explanation[0]); - kunal_paper_data.middle_literal_stats = pn_.heuristic.collect_statistics(explanation[explanation.size() / 2]); - kunal_paper_data.smallest_literal_stats = pn_.heuristic.collect_statistics(explanation[explanation.size()-1]); - const float predicted_is_worth_it = PatternMatchingHeuristic::calculate(kunal_paper_data); - const auto ranking_end2 = std::chrono::high_resolution_clock::now(); - const std::chrono::duration ranking_elapsed2 = ranking_end2 - ranking_start2; -#endif - - if (true - // && explanation.size() < 384 /* stack overflows around size=960 on x86 */ - // && tscs_elapsed > std::chrono::milliseconds(3) - && explanation.size() < config().drpm_max_size() /* stack overflows around size=960 on x86 */ - ) { - const auto alcp_start = std::chrono::high_resolution_clock::now(); - const auto alcp_result = sat_solver->AddLearnedClausePattern( + if (explanation.size() < config().drpm_max_size() + /*&& explanation.size() < 384 /* stack overflows around size=960 on x86 #1# + && tscs_elapsed > std::chrono::milliseconds(3)*/) { + /* ################################ START MEASURING TIME ################################ */ + const auto pm_start = std::chrono::high_resolution_clock::now(); + const auto pm_result = sat_solver->AddLearnedClausePattern( pn_, explanation, box, -#ifdef DREAL_EXPERIMENTAL_GENERATE_HEURISTICS_CSV - std::chrono::duration_cast(std::chrono::seconds(20)) -#else - std::min( // based on i̶n̶f̶o̶r̶m̶a̶t̶i̶o̶n̶ ̶f̶r̶o̶m̶ ̶W̶O̶R̶T̶H̶_̶I̶T̶_̶r̶e̶g̶r̶e̶s̶s̶i̶o̶n̶_̶4̶.̶i̶p̶y̶n̶b̶ vibes - std::chrono::duration_cast(100 * tscs_elapsed), - std::chrono::duration_cast(std::chrono::duration(config().drpm_max_time())) - ) -#endif + std::min(std::chrono::duration_cast(100 * tcs_elapsed_ms), + std::chrono::duration_cast(std::chrono::duration(config().drpm_max_time()))) ); + const auto pm_end = std::chrono::high_resolution_clock::now(); + const std::chrono::duration pm_elapsed = pm_end - pm_start; + /* ################################ STOP MEASURING TIME ################################ */ - // the pattern matching is kinda best-effort now. - // it breaks down when one clause pattern matches into 1000s of permutations of itself - // just make the best effort, and at the very minimum make sure the original at least gets inserted - sat_solver->AddLearnedClauseDirect(explanation, box); // just to be sure, sound because this is unmatched, straight from theory solver. - - const auto alcp_end = std::chrono::high_resolution_clock::now(); - const std::chrono::duration alcp_elapsed = alcp_end - alcp_start; - - kunal_paper_data.pattern_match_ms = alcp_elapsed.count(); - kunal_paper_data.pattern_matching_stats = alcp_result; - - std::cerr << std::setprecision(3); - // std::cerr << "P(is W.I.)=" << predicted_is_worth_it; - std::cerr << ".\tM " << alcp_result.matches << " s " << explanation.size() << " i " << alcp_elapsed.count(); - std::cerr << " m.\tT " << tscs_elapsed.count() << " m.\t"; - std::cerr << "F c = " << is_full_constrained << '\n'; - // std::cerr << explanation << '\n'; - - // const double bb_lpms = 1 / tscs_elapsed.count(); - // const double pm_lpms = (std::max(alcp_result.matches, 1u) - 0.999) / alcp_elapsed.count(); - // const double actual_worth_it = pm_lpms / bb_lpms; - // const double actual_log2_worth_it = log2(actual_worth_it); - // const bool overestimated = (actual_log2_worth_it < 1) && (predicted_is_worth_it > 0.5); - // const bool valid_over = (actual_log2_worth_it > 1) && (predicted_is_worth_it > 0.5); - // const bool valid_under = (actual_log2_worth_it < 1) && (predicted_is_worth_it < 0.5); - // const bool underestimated = (actual_log2_worth_it > 1) && (predicted_is_worth_it < 0.5); - } else { - if (DREAL_EXPERIMENTAL_PM_DUMP_ALL_ENABLED) pm_dump_all(explanation, {}); - std::cerr << std::setprecision(3); - // std::cerr << "P(is W.I.)=" << predicted_is_worth_it; - std::cerr << ".\tA 1 s " << explanation.size() << " d.\t"; - std::cerr << "T " << tscs_elapsed.count() << " m.\t"; - std::cerr << "F c = " << is_full_constrained << '\n'; + // The pattern matching may time out. At the very minimum, make sure the original at least gets inserted. sat_solver->AddLearnedClauseDirect(explanation, box); + + drpm_benchmark_log( + is_full_constrained, scs_elapsed_ms.count(), tcs_elapsed_ms.count(), explanation.size(), + 'M', + pm_elapsed.count(), pm_result.matches, +#ifdef CAV26_FILTER_SYMMETRIES + pm_result.misses_bc.at(substitutions_map::substitution_status::CAV26_NOT_PURE_TIME), + pm_result.misses_bc.at(substitutions_map::substitution_status::CAV26_NOT_PURE_LOGIC), +#endif + std::cerr + ); } - //////////////////////////////////////////////////////////////////////////////// - - /////////////////////////////////////////////////////////////////////////////////// -#ifdef DREAL_EXPERIMENTAL_GENERATE_HEURISTICS_CSV - { - std::ostringstream s; - s << kunal_paper_data.box_continuous_count << ','; - s << kunal_paper_data.box_integer_count << ','; - s << kunal_paper_data.box_boolean_count << ','; - s << kunal_paper_data.assertions_size << ','; - s << kunal_paper_data.assertions_stats << ','; - s << kunal_paper_data.biggest_assertion_stats << ','; - s << kunal_paper_data.middle_assertion_stats << ','; - s << kunal_paper_data.smallest_assertion_stats << ','; - s << kunal_paper_data.theory_checksat_ms << ','; - s << kunal_paper_data.lemma_size << ','; - s << kunal_paper_data.lemma_stats << ','; - s << kunal_paper_data.biggest_literal_stats << ','; - s << kunal_paper_data.middle_literal_stats << ','; - s << kunal_paper_data.smallest_literal_stats << ','; - s << kunal_paper_data.estimated_matching_cost << ','; - s << kunal_paper_data.pattern_match_ms << ','; - s << kunal_paper_data.pattern_matching_stats; - myfile << s.str() << std::endl; // also flushes - } + else { + if (DREAL_EXPERIMENTAL_PM_DUMP_ALL_ENABLED) pm_dump_all(explanation, {}); + sat_solver->AddLearnedClauseDirect(explanation, box); + drpm_benchmark_log( + is_full_constrained, scs_elapsed_ms.count(), tcs_elapsed_ms.count(), explanation.size(), + 'A', + 0 /*pm_elapsed.count()*/, 0 /*pm_result.matches*/, +#ifdef CAV26_FILTER_SYMMETRIES + 0 /*pm_result.misses_bc.at(substitutions_map::substitution_status::CAV26_NOT_PURE_TIME)*/, + 0 /*pm_result.misses_bc.at(substitutions_map::substitution_status::CAV26_NOT_PURE_LOGIC)*/, #endif - - { - typeof(kunal_paper_data) reset_data{0}; - reset_data.box_boolean_count = kunal_paper_data.box_boolean_count; - reset_data.box_integer_count = kunal_paper_data.box_integer_count; - reset_data.box_continuous_count = kunal_paper_data.box_continuous_count; - kunal_paper_data = reset_data; + std::cerr + ); } - /////////////////////////////////////////////////////////////////////////////////// if (DREAL_LOG_TRACE_ENABLED) { for (const auto& f_i : stack.get_vector()) diff --git a/src/dreal/util/pattern_matching/CAV26_varname_parser.h b/src/dreal/util/pattern_matching/CAV26_varname_parser.h new file mode 100644 index 000000000..e3a476c59 --- /dev/null +++ b/src/dreal/util/pattern_matching/CAV26_varname_parser.h @@ -0,0 +1,61 @@ +// +// Created by Kunal Sheth on 12/31/25. +// + +#ifndef DREAL4_CMAKE_CAV26_VARNAME_PARSER_H +#define DREAL4_CMAKE_CAV26_VARNAME_PARSER_H + +#include // NOLINT(*-include-cleaner) + +#ifdef CAV26_FILTER_SYMMETRIES + +#include +#include +#include +#include +#include + +#include "dreal/util/assert.h" +#include "dreal/util/exception.h" +#include "dreal/util/logging.h" + +namespace dreal +{ + static const std::regex SAR_VARIABLE_RE{R"(^(.+)_t(\d+)(ad|bc)$)"}; + static const std::regex DRH_VARIABLE_RE{R"(^(.+)_(\d+)(_t|_0)?$)"}; + + static auto CAV26_SAR_PARSER(const std::string& name) -> std::pair { + std::string prefix{}; + double t = -1; // "unknown" + + if (std::smatch m; std::regex_search(name, m, SAR_VARIABLE_RE)) { + const auto mag = std::stoi(m[2].str()); + const auto polarity = m[3].str(); + prefix = m[1].str(); + t = mag * (polarity == "bc" ? -1 : +1); + } + else if (name.rfind("ITE", 0) == 0) { // known issue... + const auto last = name.rfind("ITE"); + prefix = name; // "ITE"; + // t is unknown ... // if (last != std::string::npos) t = std::stoi(name.substr(last + 3)); + } + else throw DREAL_RUNTIME_ERROR("Invalid SAR variable name: {}", name); + + return {std::move(prefix), t}; + } + + static auto CAV26_DRH_PARSER(const std::string& name) -> std::pair { + if (std::smatch m; std::regex_search(name, m, DRH_VARIABLE_RE)) { + const auto mag = std::stoi(m[2].str()); + const auto step = m[3].matched ? m[3].str() : std::string{}; + + auto prefix = m[1].str(); + const auto t = mag + (step == "_t" ? 0.5 : 0.0); + return {std::move(prefix), t}; + } + throw DREAL_RUNTIME_ERROR("Invalid DRH variable name: {}", name); + } +} // namespace dreal + +#endif //CAV26_FILTER_SYMMETRIES +#endif //DREAL4_CMAKE_CAV26_VARNAME_PARSER_H diff --git a/src/dreal/util/pattern_matching/substitutions_map.cc b/src/dreal/util/pattern_matching/substitutions_map.cc index dc154cd61..78643ba8f 100644 --- a/src/dreal/util/pattern_matching/substitutions_map.cc +++ b/src/dreal/util/pattern_matching/substitutions_map.cc @@ -9,6 +9,9 @@ #include #include +#include "CAV26_varname_parser.h" // NOLINT(*-include-cleaner) +#include "dreal/version.h" // NOLINT(*-include-cleaner) + namespace dreal { substitutions_map::substitutions_map(const Box& b, const size_t reserved_size) : box(b) { @@ -23,6 +26,9 @@ namespace dreal DREAL_ASSERT(!index_stack.empty()); DREAL_ASSERT(index_stack.back() <= mapping.size()); mapping.resize(index_stack.back()); +#ifdef CAV26_FILTER_SYMMETRIES + CAV26_delta_times.resize(index_stack.back()); +#endif index_stack.pop_back(); } @@ -44,6 +50,24 @@ namespace dreal } } +#ifdef CAV26_FILTER_SYMMETRIES + const auto [pA,tA] = CAV26_VARNAME_PARSER(a.get_name()); + const auto [pAP,tAP] = CAV26_VARNAME_PARSER(aP.get_name()); + + static_assert(!(CAV26_MATCH_ACROSS_TIME_ONLY && CAV26_MATCH_ACROSS_LOGIC_ONLY)); + + const auto delta_time = tAP - tA; + if (CAV26_MATCH_ACROSS_TIME_ONLY) { + if (pA != pAP) return CAV26_NOT_PURE_TIME; + if (!CAV26_delta_times.empty() && delta_time != CAV26_delta_times.back()) return CAV26_NOT_PURE_TIME; + } + if (CAV26_MATCH_ACROSS_LOGIC_ONLY) { + if (tA != tAP) return CAV26_NOT_PURE_LOGIC; + } + + CAV26_delta_times.emplace_back(delta_time); +#endif + mapping.emplace_back(a, aP); return SUCCESS; } @@ -75,4 +99,4 @@ namespace dreal // Force template code generation into this translation unit. template Expression substitutions_map::apply_substitution(const Expression& f, const substitutions_map& subs, bool backward); template Formula substitutions_map::apply_substitution(const Formula& f, const substitutions_map& subs, bool backward); -} +} \ No newline at end of file diff --git a/src/dreal/util/pattern_matching/substitutions_map.h b/src/dreal/util/pattern_matching/substitutions_map.h index b2be0b249..291cc7aa8 100644 --- a/src/dreal/util/pattern_matching/substitutions_map.h +++ b/src/dreal/util/pattern_matching/substitutions_map.h @@ -4,8 +4,12 @@ #ifndef substitutions_mapH #define substitutions_mapH +#include "dreal/symbolic/symbolic_variable.h" #include #include +#include // NOLINT(*-include-cleaner) +#include +#include namespace dreal { @@ -16,6 +20,10 @@ namespace dreal std::vector index_stack; const Box& box; +#ifdef CAV26_FILTER_SYMMETRIES + std::vector CAV26_delta_times; +#endif + public: [[nodiscard]] const std::vector>& get_map() const { return mapping; } diff --git a/src/dreal/version.h b/src/dreal/version.h index 5464df804..6673dd41f 100644 --- a/src/dreal/version.h +++ b/src/dreal/version.h @@ -17,7 +17,15 @@ #define DREAL_EXPERIMENTAL_PM_DUMP_ALL_ENABLED false #define DREAL_EXPERIMENTAL_SAT_AUDIT_ENABLED false -// #define DREAL_EXPERIMENTAL_GENERATE_HEURISTICS_CSV +// #define CAV26_FILTER_SYMMETRIES +#ifdef CAV26_FILTER_SYMMETRIES +#define CAV26_VARNAME_PARSER CAV26_DRH_PARSER +#define CAV26_MATCH_ACROSS_TIME_ONLY false +#define CAV26_MATCH_ACROSS_LOGIC_ONLY false +static_assert(!(CAV26_MATCH_ACROSS_TIME_ONLY && CAV26_MATCH_ACROSS_LOGIC_ONLY)); +#endif + +#define DREAL_EXPERIMENTAL_GENERATE_HEURISTICS_CSV // check that options are required and mutually exclusive #ifdef DREAL_EXPERIMENTAL_PM_USE_TRIE_IMPL From f141d8906e81bd1f2ddd765414f051421e5ae5f9 Mon Sep 17 00:00:00 2001 From: Kunal Sheth Date: Wed, 31 Dec 2025 23:02:17 -0800 Subject: [PATCH 28/43] Remove now-defunct pattern_matching_heuristic.cc/h. --- src/dreal/solver/context_impl.cc | 1 - .../pattern_matching_heuristic.cc | 450 ------------------ .../pattern_matching_heuristic.h | 47 -- 3 files changed, 498 deletions(-) delete mode 100644 src/dreal/util/pattern_matching/pattern_matching_heuristic.cc delete mode 100644 src/dreal/util/pattern_matching/pattern_matching_heuristic.h diff --git a/src/dreal/solver/context_impl.cc b/src/dreal/solver/context_impl.cc index 49e78428c..0405da25f 100644 --- a/src/dreal/solver/context_impl.cc +++ b/src/dreal/solver/context_impl.cc @@ -25,7 +25,6 @@ #include #include #include -#include #include diff --git a/src/dreal/util/pattern_matching/pattern_matching_heuristic.cc b/src/dreal/util/pattern_matching/pattern_matching_heuristic.cc deleted file mode 100644 index 27a3ee8bb..000000000 --- a/src/dreal/util/pattern_matching/pattern_matching_heuristic.cc +++ /dev/null @@ -1,450 +0,0 @@ - -// This file was automatically generated on 2025-04-19 11:57:36.897311 by Kunal in the `WORTH_IT_regression` python notebook. -// -// Notes: -// len(df_overestimated) / len(df) = 0.012 -// len(df_valid_over) / len(df) = 0.234 -// len(df_valid_under) / len(df) = 0.750 -// len(df_underestimated) / len(df) = 0.005 -// -// accuracy_score(y_test, y_pred) = 0.9801667145731532 -// len(X_train) = 13913 -// len(X_test) / len(X_train) = 0.25 -// model = Pipeline(steps=[('standardscaler', StandardScaler()), ('mlpclassifier', MLPClassifier(hidden_layer_sizes=(8, 4), max_iter=1000, random_state=42))]) - - -#include "pattern_matching_heuristic.h" - -namespace dreal -{ - float relu(const float x) { return x < 0 ? 0 : x; } - float sigmoid(const float x) { return 1 / (1 + expf(-x)); } - - float PatternMatchingHeuristic::calculate(const statistics &k) { - -const float LOG2P1_assertions_size = log2(1+k.assertions_size); -const float LOG2P1_box_boolean_count = log2(1+k.box_boolean_count); -const float LOG2P1_box_continuous_count = log2(1+k.box_continuous_count); -const float LOG2P1_box_integer_count = log2(1+k.box_integer_count); -const float LOG2P1_lemma_size = log2(1+k.lemma_size); -const float LOG2P1_theory_checksat_ms = log2(1+k.theory_checksat_ms); -const float assertions_size = k.assertions_size; -const float assertions_stats_abs_cntr = k.assertions_stats.abs_cntr; -const float assertions_stats_addition_cntr = k.assertions_stats.addition_cntr; -const float assertions_stats_conjunction_cntr = k.assertions_stats.conjunction_cntr; -const float assertions_stats_constant_cntr = k.assertions_stats.constant_cntr; -const float assertions_stats_disjunction_cntr = k.assertions_stats.disjunction_cntr; -const float assertions_stats_division_cntr = k.assertions_stats.division_cntr; -const float assertions_stats_equalto_cntr = k.assertions_stats.equalto_cntr; -const float assertions_stats_exp_cntr = k.assertions_stats.exp_cntr; -const float assertions_stats_false_cntr = k.assertions_stats.false_cntr; -const float assertions_stats_forall_cntr = k.assertions_stats.forall_cntr; -const float assertions_stats_forallt_cntr = k.assertions_stats.forallt_cntr; -const float assertions_stats_integral_cntr = k.assertions_stats.integral_cntr; -const float assertions_stats_ifthenelse_cntr = k.assertions_stats.ifthenelse_cntr; -const float assertions_stats_inequality_cntr = k.assertions_stats.inequality_cntr; -const float assertions_stats_log_cntr = k.assertions_stats.log_cntr; -const float assertions_stats_max_cntr = k.assertions_stats.max_cntr; -const float assertions_stats_min_cntr = k.assertions_stats.min_cntr; -const float assertions_stats_multiplication_cntr = k.assertions_stats.multiplication_cntr; -const float assertions_stats_negation_cntr = k.assertions_stats.negation_cntr; -const float assertions_stats_notequalto_cntr = k.assertions_stats.notequalto_cntr; -const float assertions_stats_pow_cntr = k.assertions_stats.pow_cntr; -const float assertions_stats_realconstant_cntr = k.assertions_stats.realconstant_cntr; -const float assertions_stats_sqrt_cntr = k.assertions_stats.sqrt_cntr; -const float assertions_stats_trigonometry_cntr = k.assertions_stats.trigonometry_cntr; -const float assertions_stats_true_cntr = k.assertions_stats.true_cntr; -const float assertions_stats_uninterpretedfunction_cntr = k.assertions_stats.uninterpretedfunction_cntr; -const float assertions_stats_unique_variables = k.assertions_stats.unique_variables; -const float assertions_stats_variable_cntr = k.assertions_stats.variable_cntr; -const float biggest_assertion_stats_abs_cntr = k.biggest_assertion_stats.abs_cntr; -const float biggest_assertion_stats_addition_cntr = k.biggest_assertion_stats.addition_cntr; -const float biggest_assertion_stats_conjunction_cntr = k.biggest_assertion_stats.conjunction_cntr; -const float biggest_assertion_stats_constant_cntr = k.biggest_assertion_stats.constant_cntr; -const float biggest_assertion_stats_disjunction_cntr = k.biggest_assertion_stats.disjunction_cntr; -const float biggest_assertion_stats_division_cntr = k.biggest_assertion_stats.division_cntr; -const float biggest_assertion_stats_equalto_cntr = k.biggest_assertion_stats.equalto_cntr; -const float biggest_assertion_stats_exp_cntr = k.biggest_assertion_stats.exp_cntr; -const float biggest_assertion_stats_false_cntr = k.biggest_assertion_stats.false_cntr; -const float biggest_assertion_stats_forall_cntr = k.biggest_assertion_stats.forall_cntr; -const float biggest_assertion_stats_forallt_cntr = k.biggest_assertion_stats.forallt_cntr; -const float biggest_assertion_stats_integral_cntr = k.biggest_assertion_stats.integral_cntr; -const float biggest_assertion_stats_ifthenelse_cntr = k.biggest_assertion_stats.ifthenelse_cntr; -const float biggest_assertion_stats_inequality_cntr = k.biggest_assertion_stats.inequality_cntr; -const float biggest_assertion_stats_log_cntr = k.biggest_assertion_stats.log_cntr; -const float biggest_assertion_stats_max_cntr = k.biggest_assertion_stats.max_cntr; -const float biggest_assertion_stats_min_cntr = k.biggest_assertion_stats.min_cntr; -const float biggest_assertion_stats_multiplication_cntr = k.biggest_assertion_stats.multiplication_cntr; -const float biggest_assertion_stats_negation_cntr = k.biggest_assertion_stats.negation_cntr; -const float biggest_assertion_stats_notequalto_cntr = k.biggest_assertion_stats.notequalto_cntr; -const float biggest_assertion_stats_pow_cntr = k.biggest_assertion_stats.pow_cntr; -const float biggest_assertion_stats_realconstant_cntr = k.biggest_assertion_stats.realconstant_cntr; -const float biggest_assertion_stats_sqrt_cntr = k.biggest_assertion_stats.sqrt_cntr; -const float biggest_assertion_stats_trigonometry_cntr = k.biggest_assertion_stats.trigonometry_cntr; -const float biggest_assertion_stats_true_cntr = k.biggest_assertion_stats.true_cntr; -const float biggest_assertion_stats_uninterpretedfunction_cntr = k.biggest_assertion_stats.uninterpretedfunction_cntr; -const float biggest_assertion_stats_unique_variables = k.biggest_assertion_stats.unique_variables; -const float biggest_assertion_stats_variable_cntr = k.biggest_assertion_stats.variable_cntr; -const float biggest_literal_stats_abs_cntr = k.biggest_literal_stats.abs_cntr; -const float biggest_literal_stats_addition_cntr = k.biggest_literal_stats.addition_cntr; -const float biggest_literal_stats_conjunction_cntr = k.biggest_literal_stats.conjunction_cntr; -const float biggest_literal_stats_constant_cntr = k.biggest_literal_stats.constant_cntr; -const float biggest_literal_stats_disjunction_cntr = k.biggest_literal_stats.disjunction_cntr; -const float biggest_literal_stats_division_cntr = k.biggest_literal_stats.division_cntr; -const float biggest_literal_stats_equalto_cntr = k.biggest_literal_stats.equalto_cntr; -const float biggest_literal_stats_exp_cntr = k.biggest_literal_stats.exp_cntr; -const float biggest_literal_stats_false_cntr = k.biggest_literal_stats.false_cntr; -const float biggest_literal_stats_forall_cntr = k.biggest_literal_stats.forall_cntr; -const float biggest_literal_stats_forallt_cntr = k.biggest_literal_stats.forallt_cntr; -const float biggest_literal_stats_integral_cntr = k.biggest_literal_stats.integral_cntr; -const float biggest_literal_stats_ifthenelse_cntr = k.biggest_literal_stats.ifthenelse_cntr; -const float biggest_literal_stats_inequality_cntr = k.biggest_literal_stats.inequality_cntr; -const float biggest_literal_stats_log_cntr = k.biggest_literal_stats.log_cntr; -const float biggest_literal_stats_max_cntr = k.biggest_literal_stats.max_cntr; -const float biggest_literal_stats_min_cntr = k.biggest_literal_stats.min_cntr; -const float biggest_literal_stats_multiplication_cntr = k.biggest_literal_stats.multiplication_cntr; -const float biggest_literal_stats_negation_cntr = k.biggest_literal_stats.negation_cntr; -const float biggest_literal_stats_notequalto_cntr = k.biggest_literal_stats.notequalto_cntr; -const float biggest_literal_stats_pow_cntr = k.biggest_literal_stats.pow_cntr; -const float biggest_literal_stats_realconstant_cntr = k.biggest_literal_stats.realconstant_cntr; -const float biggest_literal_stats_sqrt_cntr = k.biggest_literal_stats.sqrt_cntr; -const float biggest_literal_stats_trigonometry_cntr = k.biggest_literal_stats.trigonometry_cntr; -const float biggest_literal_stats_true_cntr = k.biggest_literal_stats.true_cntr; -const float biggest_literal_stats_uninterpretedfunction_cntr = k.biggest_literal_stats.uninterpretedfunction_cntr; -const float biggest_literal_stats_unique_variables = k.biggest_literal_stats.unique_variables; -const float biggest_literal_stats_variable_cntr = k.biggest_literal_stats.variable_cntr; -const float box_boolean_count = k.box_boolean_count; -const float box_continuous_count = k.box_continuous_count; -const float box_integer_count = k.box_integer_count; -const float lemma_size = k.lemma_size; -const float middle_assertion_stats_abs_cntr = k.middle_assertion_stats.abs_cntr; -const float middle_assertion_stats_addition_cntr = k.middle_assertion_stats.addition_cntr; -const float middle_assertion_stats_conjunction_cntr = k.middle_assertion_stats.conjunction_cntr; -const float middle_assertion_stats_constant_cntr = k.middle_assertion_stats.constant_cntr; -const float middle_assertion_stats_disjunction_cntr = k.middle_assertion_stats.disjunction_cntr; -const float middle_assertion_stats_division_cntr = k.middle_assertion_stats.division_cntr; -const float middle_assertion_stats_equalto_cntr = k.middle_assertion_stats.equalto_cntr; -const float middle_assertion_stats_exp_cntr = k.middle_assertion_stats.exp_cntr; -const float middle_assertion_stats_false_cntr = k.middle_assertion_stats.false_cntr; -const float middle_assertion_stats_forall_cntr = k.middle_assertion_stats.forall_cntr; -const float middle_assertion_stats_forallt_cntr = k.middle_assertion_stats.forallt_cntr; -const float middle_assertion_stats_integral_cntr = k.middle_assertion_stats.integral_cntr; -const float middle_assertion_stats_ifthenelse_cntr = k.middle_assertion_stats.ifthenelse_cntr; -const float middle_assertion_stats_inequality_cntr = k.middle_assertion_stats.inequality_cntr; -const float middle_assertion_stats_log_cntr = k.middle_assertion_stats.log_cntr; -const float middle_assertion_stats_max_cntr = k.middle_assertion_stats.max_cntr; -const float middle_assertion_stats_min_cntr = k.middle_assertion_stats.min_cntr; -const float middle_assertion_stats_multiplication_cntr = k.middle_assertion_stats.multiplication_cntr; -const float middle_assertion_stats_negation_cntr = k.middle_assertion_stats.negation_cntr; -const float middle_assertion_stats_notequalto_cntr = k.middle_assertion_stats.notequalto_cntr; -const float middle_assertion_stats_pow_cntr = k.middle_assertion_stats.pow_cntr; -const float middle_assertion_stats_realconstant_cntr = k.middle_assertion_stats.realconstant_cntr; -const float middle_assertion_stats_sqrt_cntr = k.middle_assertion_stats.sqrt_cntr; -const float middle_assertion_stats_trigonometry_cntr = k.middle_assertion_stats.trigonometry_cntr; -const float middle_assertion_stats_true_cntr = k.middle_assertion_stats.true_cntr; -const float middle_assertion_stats_uninterpretedfunction_cntr = k.middle_assertion_stats.uninterpretedfunction_cntr; -const float middle_assertion_stats_unique_variables = k.middle_assertion_stats.unique_variables; -const float middle_assertion_stats_variable_cntr = k.middle_assertion_stats.variable_cntr; -const float middle_literal_stats_abs_cntr = k.middle_literal_stats.abs_cntr; -const float middle_literal_stats_addition_cntr = k.middle_literal_stats.addition_cntr; -const float middle_literal_stats_conjunction_cntr = k.middle_literal_stats.conjunction_cntr; -const float middle_literal_stats_constant_cntr = k.middle_literal_stats.constant_cntr; -const float middle_literal_stats_disjunction_cntr = k.middle_literal_stats.disjunction_cntr; -const float middle_literal_stats_division_cntr = k.middle_literal_stats.division_cntr; -const float middle_literal_stats_equalto_cntr = k.middle_literal_stats.equalto_cntr; -const float middle_literal_stats_exp_cntr = k.middle_literal_stats.exp_cntr; -const float middle_literal_stats_false_cntr = k.middle_literal_stats.false_cntr; -const float middle_literal_stats_forall_cntr = k.middle_literal_stats.forall_cntr; -const float middle_literal_stats_forallt_cntr = k.middle_literal_stats.forallt_cntr; -const float middle_literal_stats_integral_cntr = k.middle_literal_stats.integral_cntr; -const float middle_literal_stats_ifthenelse_cntr = k.middle_literal_stats.ifthenelse_cntr; -const float middle_literal_stats_inequality_cntr = k.middle_literal_stats.inequality_cntr; -const float middle_literal_stats_log_cntr = k.middle_literal_stats.log_cntr; -const float middle_literal_stats_max_cntr = k.middle_literal_stats.max_cntr; -const float middle_literal_stats_min_cntr = k.middle_literal_stats.min_cntr; -const float middle_literal_stats_multiplication_cntr = k.middle_literal_stats.multiplication_cntr; -const float middle_literal_stats_negation_cntr = k.middle_literal_stats.negation_cntr; -const float middle_literal_stats_notequalto_cntr = k.middle_literal_stats.notequalto_cntr; -const float middle_literal_stats_pow_cntr = k.middle_literal_stats.pow_cntr; -const float middle_literal_stats_realconstant_cntr = k.middle_literal_stats.realconstant_cntr; -const float middle_literal_stats_sqrt_cntr = k.middle_literal_stats.sqrt_cntr; -const float middle_literal_stats_trigonometry_cntr = k.middle_literal_stats.trigonometry_cntr; -const float middle_literal_stats_true_cntr = k.middle_literal_stats.true_cntr; -const float middle_literal_stats_uninterpretedfunction_cntr = k.middle_literal_stats.uninterpretedfunction_cntr; -const float middle_literal_stats_unique_variables = k.middle_literal_stats.unique_variables; -const float middle_literal_stats_variable_cntr = k.middle_literal_stats.variable_cntr; -const float smallest_assertion_stats_abs_cntr = k.smallest_assertion_stats.abs_cntr; -const float smallest_assertion_stats_addition_cntr = k.smallest_assertion_stats.addition_cntr; -const float smallest_assertion_stats_conjunction_cntr = k.smallest_assertion_stats.conjunction_cntr; -const float smallest_assertion_stats_constant_cntr = k.smallest_assertion_stats.constant_cntr; -const float smallest_assertion_stats_disjunction_cntr = k.smallest_assertion_stats.disjunction_cntr; -const float smallest_assertion_stats_division_cntr = k.smallest_assertion_stats.division_cntr; -const float smallest_assertion_stats_equalto_cntr = k.smallest_assertion_stats.equalto_cntr; -const float smallest_assertion_stats_exp_cntr = k.smallest_assertion_stats.exp_cntr; -const float smallest_assertion_stats_false_cntr = k.smallest_assertion_stats.false_cntr; -const float smallest_assertion_stats_forall_cntr = k.smallest_assertion_stats.forall_cntr; -const float smallest_assertion_stats_forallt_cntr = k.smallest_assertion_stats.forallt_cntr; -const float smallest_assertion_stats_integral_cntr = k.smallest_assertion_stats.integral_cntr; -const float smallest_assertion_stats_ifthenelse_cntr = k.smallest_assertion_stats.ifthenelse_cntr; -const float smallest_assertion_stats_inequality_cntr = k.smallest_assertion_stats.inequality_cntr; -const float smallest_assertion_stats_log_cntr = k.smallest_assertion_stats.log_cntr; -const float smallest_assertion_stats_max_cntr = k.smallest_assertion_stats.max_cntr; -const float smallest_assertion_stats_min_cntr = k.smallest_assertion_stats.min_cntr; -const float smallest_assertion_stats_multiplication_cntr = k.smallest_assertion_stats.multiplication_cntr; -const float smallest_assertion_stats_negation_cntr = k.smallest_assertion_stats.negation_cntr; -const float smallest_assertion_stats_notequalto_cntr = k.smallest_assertion_stats.notequalto_cntr; -const float smallest_assertion_stats_pow_cntr = k.smallest_assertion_stats.pow_cntr; -const float smallest_assertion_stats_realconstant_cntr = k.smallest_assertion_stats.realconstant_cntr; -const float smallest_assertion_stats_sqrt_cntr = k.smallest_assertion_stats.sqrt_cntr; -const float smallest_assertion_stats_trigonometry_cntr = k.smallest_assertion_stats.trigonometry_cntr; -const float smallest_assertion_stats_true_cntr = k.smallest_assertion_stats.true_cntr; -const float smallest_assertion_stats_uninterpretedfunction_cntr = k.smallest_assertion_stats.uninterpretedfunction_cntr; -const float smallest_assertion_stats_unique_variables = k.smallest_assertion_stats.unique_variables; -const float smallest_assertion_stats_variable_cntr = k.smallest_assertion_stats.variable_cntr; -const float smallest_literal_stats_abs_cntr = k.smallest_literal_stats.abs_cntr; -const float smallest_literal_stats_addition_cntr = k.smallest_literal_stats.addition_cntr; -const float smallest_literal_stats_conjunction_cntr = k.smallest_literal_stats.conjunction_cntr; -const float smallest_literal_stats_constant_cntr = k.smallest_literal_stats.constant_cntr; -const float smallest_literal_stats_disjunction_cntr = k.smallest_literal_stats.disjunction_cntr; -const float smallest_literal_stats_division_cntr = k.smallest_literal_stats.division_cntr; -const float smallest_literal_stats_equalto_cntr = k.smallest_literal_stats.equalto_cntr; -const float smallest_literal_stats_exp_cntr = k.smallest_literal_stats.exp_cntr; -const float smallest_literal_stats_false_cntr = k.smallest_literal_stats.false_cntr; -const float smallest_literal_stats_forall_cntr = k.smallest_literal_stats.forall_cntr; -const float smallest_literal_stats_forallt_cntr = k.smallest_literal_stats.forallt_cntr; -const float smallest_literal_stats_integral_cntr = k.smallest_literal_stats.integral_cntr; -const float smallest_literal_stats_ifthenelse_cntr = k.smallest_literal_stats.ifthenelse_cntr; -const float smallest_literal_stats_inequality_cntr = k.smallest_literal_stats.inequality_cntr; -const float smallest_literal_stats_log_cntr = k.smallest_literal_stats.log_cntr; -const float smallest_literal_stats_max_cntr = k.smallest_literal_stats.max_cntr; -const float smallest_literal_stats_min_cntr = k.smallest_literal_stats.min_cntr; -const float smallest_literal_stats_multiplication_cntr = k.smallest_literal_stats.multiplication_cntr; -const float smallest_literal_stats_negation_cntr = k.smallest_literal_stats.negation_cntr; -const float smallest_literal_stats_notequalto_cntr = k.smallest_literal_stats.notequalto_cntr; -const float smallest_literal_stats_pow_cntr = k.smallest_literal_stats.pow_cntr; -const float smallest_literal_stats_realconstant_cntr = k.smallest_literal_stats.realconstant_cntr; -const float smallest_literal_stats_sqrt_cntr = k.smallest_literal_stats.sqrt_cntr; -const float smallest_literal_stats_trigonometry_cntr = k.smallest_literal_stats.trigonometry_cntr; -const float smallest_literal_stats_true_cntr = k.smallest_literal_stats.true_cntr; -const float smallest_literal_stats_uninterpretedfunction_cntr = k.smallest_literal_stats.uninterpretedfunction_cntr; -const float smallest_literal_stats_unique_variables = k.smallest_literal_stats.unique_variables; -const float smallest_literal_stats_variable_cntr = k.smallest_literal_stats.variable_cntr; -const float theory_checksat_ms = k.theory_checksat_ms; - -float x0[194]; -float x1[8]; -float x2[4]; -float x3_result[1]; - -x0[0] = 0.37771877530321563*LOG2P1_assertions_size - 3.7112883484884471; -x0[1] = 0.18421227306209151*LOG2P1_box_boolean_count - 0.73736612118951128; -x0[2] = 0.36467247081702653*LOG2P1_box_continuous_count - 2.214490285843389; -x0[3] = 1.9871975876578016*LOG2P1_box_integer_count - 1.012779622743669; -x0[4] = 0.70528450158506573*LOG2P1_lemma_size - 1.5663136897555112; -x0[5] = 0.58871281170393086*LOG2P1_theory_checksat_ms - 0.48690060312132571; -x0[6] = 0.00096372470822849647*assertions_size - 1.718519538122546; -x0[7] = 28.615217352461183*assertions_stats_abs_cntr - 0.022623976919217494; -x0[8] = 0.0014136802583617301*assertions_stats_addition_cntr - 0.79391086360450547; -x0[9] = 0.00096372447885263702*assertions_stats_conjunction_cntr - 1.7185189905623448; -x0[10] = 0.0012802935056375627*assertions_stats_constant_cntr - 1.4390970152848623; -x0[11] = 1.0*assertions_stats_disjunction_cntr; -x0[12] = 0.87410597744741314*assertions_stats_division_cntr - 0.11616631584131867; -x0[13] = 0.0010233994255783704*assertions_stats_equalto_cntr - 1.6120255568011366; -x0[14] = 1.0*assertions_stats_exp_cntr; -x0[15] = 1.0*assertions_stats_false_cntr; -x0[16] = 1.0*assertions_stats_forall_cntr; -x0[17] = 1.0*assertions_stats_ifthenelse_cntr; -x0[18] = 0.0025361863745808283*assertions_stats_inequality_cntr - 0.52762392593133101; -x0[19] = 117.95761981271237*assertions_stats_log_cntr - 0.0084782304185087587; -x0[20] = 1.0*assertions_stats_max_cntr; -x0[21] = 1.0*assertions_stats_min_cntr; -x0[22] = 0.0020301349895948911*assertions_stats_multiplication_cntr - 0.80350139739440551; -x0[23] = 0.0017962028699604385*assertions_stats_negation_cntr - 1.2888746453536402; -x0[24] = 1.0*assertions_stats_notequalto_cntr; -x0[25] = 0.041218934775899371*assertions_stats_pow_cntr - 0.62813177116735486; -x0[26] = 0.0014000326583671048*assertions_stats_realconstant_cntr - 1.0087657436576163; -x0[27] = 1.0*assertions_stats_sqrt_cntr; -x0[28] = 0.73604231188820646*assertions_stats_trigonometry_cntr - 0.069990942185588809; -x0[29] = 1.0*assertions_stats_true_cntr; -x0[30] = 1.0*assertions_stats_uninterpretedfunction_cntr; -x0[31] = 0.0016910259525192936*assertions_stats_unique_variables - 0.60267834351180793; -x0[32] = 0.00053076321034285453*assertions_stats_variable_cntr - 1.249344076420934; -x0[33] = 1.0*biggest_assertion_stats_abs_cntr; -x0[34] = 0.13113042655611967*biggest_assertion_stats_addition_cntr - 0.47619958324933132; -x0[35] = 1.0*biggest_assertion_stats_conjunction_cntr; -x0[36] = 0.06672989296864644*biggest_assertion_stats_constant_cntr - 0.33028731038545733; -x0[37] = 1.0*biggest_assertion_stats_disjunction_cntr; -x0[38] = 1.9874186465655559*biggest_assertion_stats_division_cntr - 0.0764226964646426; -x0[39] = 3.2950530271276053*biggest_assertion_stats_equalto_cntr - 2.9568559651899773; -x0[40] = 1.0*biggest_assertion_stats_exp_cntr; -x0[41] = 1.0*biggest_assertion_stats_false_cntr; -x0[42] = 1.0*biggest_assertion_stats_forall_cntr; -x0[43] = 1.0*biggest_assertion_stats_ifthenelse_cntr; -x0[44] = 3.2950530271276053*biggest_assertion_stats_inequality_cntr - 0.33819706193762811; -x0[45] = 117.95761981271237*biggest_assertion_stats_log_cntr - 0.0084782304185087587; -x0[46] = 1.0*biggest_assertion_stats_max_cntr; -x0[47] = 1.0*biggest_assertion_stats_min_cntr; -x0[48] = 0.082958029418317966*biggest_assertion_stats_multiplication_cntr - 0.38698045477454568; -x0[49] = 3.9531164657417492*biggest_assertion_stats_negation_cntr - 0.27162936399404242; -x0[50] = 1.0*biggest_assertion_stats_notequalto_cntr; -x0[51] = 0.18009925170940652*biggest_assertion_stats_pow_cntr - 0.042109025070847364; -x0[52] = 0.25334944573768703*biggest_assertion_stats_realconstant_cntr - 0.029772611498678811; -x0[53] = 1.0*biggest_assertion_stats_sqrt_cntr; -x0[54] = 1.74487648588679*biggest_assertion_stats_trigonometry_cntr - 0.026713051929410352; -x0[55] = 1.0*biggest_assertion_stats_true_cntr; -x0[56] = 1.0*biggest_assertion_stats_uninterpretedfunction_cntr; -x0[57] = 0.46388951933272993*biggest_assertion_stats_unique_variables - 2.4159064753691473; -x0[58] = 0.11083801287143255*biggest_assertion_stats_variable_cntr - 0.7338985308527981; -x0[59] = 117.95761981271234*biggest_literal_stats_abs_cntr - 0.008478230418508757; -x0[60] = 0.13020544393471256*biggest_literal_stats_addition_cntr - 0.097544120041077348; -x0[61] = 1.0*biggest_literal_stats_conjunction_cntr; -x0[62] = 0.064357853741237328*biggest_literal_stats_constant_cntr - 0.095331776594060239; -x0[63] = 1.0*biggest_literal_stats_disjunction_cntr; -x0[64] = 1.5456289779279924*biggest_literal_stats_division_cntr - 0.052657811797446157; -x0[65] = 2.2417710409364737*biggest_literal_stats_equalto_cntr - 1.6272296228288254; -x0[66] = 1.0*biggest_literal_stats_exp_cntr; -x0[67] = 1.0*biggest_literal_stats_false_cntr; -x0[68] = 1.0*biggest_literal_stats_forall_cntr; -x0[69] = 1.0*biggest_literal_stats_ifthenelse_cntr; -x0[70] = 2.2417710409364737*biggest_literal_stats_inequality_cntr - 0.61454141810764829; -x0[71] = 1.0*biggest_literal_stats_log_cntr; -x0[72] = 1.0*biggest_literal_stats_max_cntr; -x0[73] = 1.0*biggest_literal_stats_min_cntr; -x0[74] = 0.08931595980065464*biggest_literal_stats_multiplication_cntr - 0.075558746988694386; -x0[75] = 3.859314929165945*biggest_literal_stats_negation_cntr - 0.27933085126644913; -x0[76] = 1.0*biggest_literal_stats_notequalto_cntr; -x0[77] = 0.15199671843207646*biggest_literal_stats_pow_cntr - 0.034598836144209451; -x0[78] = 0.24823812915831345*biggest_literal_stats_realconstant_cntr - 0.13793782624329198; -x0[79] = 1.0*biggest_literal_stats_sqrt_cntr; -x0[80] = 2.8596541345038138*biggest_literal_stats_trigonometry_cntr - 0.039463350379122568; -x0[81] = 1.0*biggest_literal_stats_true_cntr; -x0[82] = 1.0*biggest_literal_stats_uninterpretedfunction_cntr; -x0[83] = 0.7844167838394539*biggest_literal_stats_unique_variables - 1.1493090015501524; -x0[84] = 0.11096182710698629*biggest_literal_stats_variable_cntr - 0.2239494074005732; -x0[85] = 0.00046904838095628324*box_boolean_count - 0.5936472249093071; -x0[86] = 0.0016902606416621386*box_continuous_count - 0.6017648612276244; -x0[87] = 1.9019154961840616*box_integer_count - 0.9737183985710538; -x0[88] = 0.0064402310088025709*lemma_size - 0.11973423085545294; -x0[89] = 1.0*middle_assertion_stats_abs_cntr; -x0[90] = 2.0684090968641597*middle_assertion_stats_addition_cntr - 0.23132642526562444; -x0[91] = 1.0*middle_assertion_stats_conjunction_cntr; -x0[92] = 0.97347244624775553*middle_assertion_stats_constant_cntr - 0.80750704392620909; -x0[93] = 1.0*middle_assertion_stats_disjunction_cntr; -x0[94] = 1.0*middle_assertion_stats_division_cntr; -x0[95] = 2.7895691267196265*middle_assertion_stats_equalto_cntr - 2.3671137145153391; -x0[96] = 1.0*middle_assertion_stats_exp_cntr; -x0[97] = 1.0*middle_assertion_stats_false_cntr; -x0[98] = 1.0*middle_assertion_stats_forall_cntr; -x0[99] = 1.0*middle_assertion_stats_ifthenelse_cntr; -x0[100] = 2.7895691267196265*middle_assertion_stats_inequality_cntr - 0.42245541220428762; -x0[101] = 1.0*middle_assertion_stats_log_cntr; -x0[102] = 1.0*middle_assertion_stats_max_cntr; -x0[103] = 1.0*middle_assertion_stats_min_cntr; -x0[104] = 1.0514943753608537*middle_assertion_stats_multiplication_cntr - 0.34379701814968183; -x0[105] = 2.0003360069220513*middle_assertion_stats_negation_cntr - 0.98183674198739934; -x0[106] = 1.0*middle_assertion_stats_notequalto_cntr; -x0[107] = 4.5109334446419505*middle_assertion_stats_pow_cntr - 0.21723031753828123; -x0[108] = 2.4930558858837699*middle_assertion_stats_realconstant_cntr - 0.50172906493743663; -x0[109] = 1.0*middle_assertion_stats_sqrt_cntr; -x0[110] = 26.394155405579589*middle_assertion_stats_trigonometry_cntr - 0.03794171696338617; -x0[111] = 1.0*middle_assertion_stats_true_cntr; -x0[112] = 1.0*middle_assertion_stats_uninterpretedfunction_cntr; -x0[113] = 1.5862324617799162*middle_assertion_stats_unique_variables - 2.171563983290596; -x0[114] = 1.3853974121446897*middle_assertion_stats_variable_cntr - 1.9345576743439254; -x0[115] = 117.95761981271234*middle_literal_stats_abs_cntr - 0.008478230418508757; -x0[116] = 0.17166362569978674*middle_literal_stats_addition_cntr - 0.060988521658452227; -x0[117] = 1.0*middle_literal_stats_conjunction_cntr; -x0[118] = 0.090286815587543409*middle_literal_stats_constant_cntr - 0.095497791862739087; -x0[119] = 1.0*middle_literal_stats_disjunction_cntr; -x0[120] = 1.7689855005756907*middle_literal_stats_division_cntr - 0.033439458538877788; -x0[121] = 2.0532837374454407*middle_literal_stats_equalto_cntr - 1.2590069405697588; -x0[122] = 1.0*middle_literal_stats_exp_cntr; -x0[123] = 1.0*middle_literal_stats_false_cntr; -x0[124] = 1.0*middle_literal_stats_forall_cntr; -x0[125] = 1.0*middle_literal_stats_ifthenelse_cntr; -x0[126] = 2.0532837374454407*middle_literal_stats_inequality_cntr - 0.79427679687568187; -x0[127] = 1.0*middle_literal_stats_log_cntr; -x0[128] = 1.0*middle_literal_stats_max_cntr; -x0[129] = 1.0*middle_literal_stats_min_cntr; -x0[130] = 0.19811233121892721*middle_literal_stats_multiplication_cntr - 0.082830405426615364; -x0[131] = 2.5529411624742262*middle_literal_stats_negation_cntr - 0.48313764686226096; -x0[132] = 1.0*middle_literal_stats_notequalto_cntr; -x0[133] = 0.16942371481996552*middle_literal_stats_pow_cntr - 0.032428329804180853; -x0[134] = 0.72913826386016745*middle_literal_stats_realconstant_cntr - 0.40845997473773771; -x0[135] = 1.0*middle_literal_stats_sqrt_cntr; -x0[136] = 3.2027278540994542*middle_literal_stats_trigonometry_cntr - 0.043967585720764445; -x0[137] = 1.0*middle_literal_stats_true_cntr; -x0[138] = 1.0*middle_literal_stats_uninterpretedfunction_cntr; -x0[139] = 1.6169472673232148*middle_literal_stats_unique_variables - 1.8369487894279259; -x0[140] = 0.15532919408550064*middle_literal_stats_variable_cntr - 0.22999617101670369; -x0[141] = 117.95761981271234*smallest_assertion_stats_abs_cntr - 0.008478230418508757; -x0[142] = 1.4456995849575351*smallest_assertion_stats_addition_cntr - 0.17342576060476719; -x0[143] = 1.0*smallest_assertion_stats_conjunction_cntr; -x0[144] = 1.0264539941560433*smallest_assertion_stats_constant_cntr - 0.72301079154238657; -x0[145] = 1.0*smallest_assertion_stats_disjunction_cntr; -x0[146] = 11.916838896706651*smallest_assertion_stats_division_cntr - 0.017130509446857831; -x0[147] = 2.0160297845385511*smallest_assertion_stats_equalto_cntr - 1.1348771129523418; -x0[148] = 1.0*smallest_assertion_stats_exp_cntr; -x0[149] = 1.0*smallest_assertion_stats_false_cntr; -x0[150] = 1.0*smallest_assertion_stats_forall_cntr; -x0[151] = 1.0*smallest_assertion_stats_ifthenelse_cntr; -x0[152] = 2.0160297845385511*smallest_assertion_stats_inequality_cntr - 0.88115267158620925; -x0[153] = 1.0*smallest_assertion_stats_log_cntr; -x0[154] = 1.0*smallest_assertion_stats_max_cntr; -x0[155] = 1.0*smallest_assertion_stats_min_cntr; -x0[156] = 1.7094086275698364*smallest_assertion_stats_multiplication_cntr - 0.17729293822922976; -x0[157] = 2.0747529068139507*smallest_assertion_stats_negation_cntr - 1.3133291777697451; -x0[158] = 1.0*smallest_assertion_stats_notequalto_cntr; -x0[159] = 1.8874366036972476*smallest_assertion_stats_pow_cntr - 0.04666701586083901; -x0[160] = 1.6935753858341813*smallest_assertion_stats_realconstant_cntr - 0.74179892196316399; -x0[161] = 1.0*smallest_assertion_stats_sqrt_cntr; -x0[162] = 17.208229650322913*smallest_assertion_stats_trigonometry_cntr - 0.01855268056888117; -x0[163] = 1.0*smallest_assertion_stats_true_cntr; -x0[164] = 1.0*smallest_assertion_stats_uninterpretedfunction_cntr; -x0[165] = 2.390572553702162*smallest_assertion_stats_unique_variables - 2.4223597974623075; -x0[166] = 2.0922980271737206*smallest_assertion_stats_variable_cntr - 2.1450829482933913; -x0[167] = 41.714812421160595*smallest_literal_stats_abs_cntr - 0.023986092098705149; -x0[168] = 0.1717450336334706*smallest_literal_stats_addition_cntr - 0.059227533341004238; -x0[169] = 1.0*smallest_literal_stats_conjunction_cntr; -x0[170] = 0.090339966682452699*smallest_literal_stats_constant_cntr - 0.097404574153918844; -x0[171] = 1.0*smallest_literal_stats_disjunction_cntr; -x0[172] = 1.7697667925338136*smallest_literal_stats_division_cntr - 0.033199822673134864; -x0[173] = 2.0051965684798647*smallest_literal_stats_equalto_cntr - 1.0747323230902286; -x0[174] = 1.0*smallest_literal_stats_exp_cntr; -x0[175] = 1.0*smallest_literal_stats_false_cntr; -x0[176] = 1.0*smallest_literal_stats_forall_cntr; -x0[177] = 1.0*smallest_literal_stats_ifthenelse_cntr; -x0[178] = 2.0051965684798647*smallest_literal_stats_inequality_cntr - 0.93046424538963612; -x0[179] = 1.0*smallest_literal_stats_log_cntr; -x0[180] = 1.0*smallest_literal_stats_max_cntr; -x0[181] = 1.0*smallest_literal_stats_min_cntr; -x0[182] = 0.1984602857866811*smallest_literal_stats_multiplication_cntr - 0.072348923273919827; -x0[183] = 2.0731409307148403*smallest_literal_stats_negation_cntr - 0.76366328397279937; -x0[184] = 1.0*smallest_literal_stats_notequalto_cntr; -x0[185] = 0.16945087581388943*smallest_literal_stats_pow_cntr - 0.029827154091009504; -x0[186] = 0.72943489750124979*smallest_literal_stats_realconstant_cntr - 0.4083115777862239; -x0[187] = 1.0*smallest_literal_stats_sqrt_cntr; -x0[188] = 3.2392414057685444*smallest_literal_stats_trigonometry_cntr - 0.039113962205787063; -x0[189] = 1.0*smallest_literal_stats_true_cntr; -x0[190] = 1.0*smallest_literal_stats_uninterpretedfunction_cntr; -x0[191] = 1.8363223514790834*smallest_literal_stats_unique_variables - 1.9094426406129448; -x0[192] = 0.15542016244619064*smallest_literal_stats_variable_cntr - 0.21487147449525459; -x0[193] = 0.00032842472077025258*theory_checksat_ms - 0.040918510018383925; -x1[0] = relu(-0.16556423295607245*x0[0] + 0.082974316766689246*x0[1] - 0.070722927977365069*x0[2] + 0.1558869971408442*x0[3] - 1.4119709729810439*x0[4] - 2.1097765534499846*x0[5] - 0.12928738256404615*x0[6] + 0.097009240786868164*x0[7] - 0.22269921513249433*x0[8] - 0.31573854062714962*x0[9] - 0.10016744154350013*x0[10] - 2.8907555397204009e-315*x0[11] - 0.023407995991644236*x0[12] + 0.22046846964756034*x0[13] + 3.2078235266195469e-316*x0[14] - 7.9454434608407292e-316*x0[15] + 2.6790589439569961e-315*x0[16] - 2.2427428132965561e-315*x0[17] - 0.44812290897529489*x0[18] + 0.11780412051880074*x0[19] - 4.060998000610261e-315*x0[20] + 1.1069668115790062e-315*x0[21] + 0.21024239523690832*x0[22] - 0.31739924607606362*x0[23] + 6.2422281835059267e-316*x0[24] + 0.23561625742663317*x0[25] + 0.012574916490713841*x0[26] + 1.4336084320140295e-315*x0[27] - 0.53694554994486821*x0[28] - 1.5955856801142405e-315*x0[29] - 4.4586757224970297e-315*x0[30] + 0.13444999862326215*x0[31] + 0.056964236807352471*x0[32] - 2.7588952735232754e-316*x0[33] - 0.20816041132504173*x0[34] - 3.3410160062460881e-315*x0[35] - 0.093964201887369855*x0[36] + 2.8681410434625439e-316*x0[37] + 0.052600160234754292*x0[38] - 0.1073453660436731*x0[39] + 1.8673265332977827e-315*x0[40] + 2.7493787786793396e-316*x0[41] + 6.0787623650213606e-316*x0[42] + 1.0199772316099177e-315*x0[43] - 0.0014764594504569108*x0[44] + 0.19762800078142215*x0[45] + 6.049828003351443e-316*x0[46] - 2.4391067240266175e-315*x0[47] + 0.24645373946604948*x0[48] + 0.043879414938393591*x0[49] - 1.9036378533542899e-315*x0[50] - 0.24127064975314907*x0[51] - 0.086858580206087541*x0[52] + 2.9365397434462854e-315*x0[53] + 0.052405352987023028*x0[54] - 3.1057557498906313e-315*x0[55] + 2.6258382864594497e-315*x0[56] - 0.17945404514179875*x0[57] + 0.12500035512455551*x0[58] + 0.084418609359942456*x0[59] - 0.029797038425556095*x0[60] + 5.947857695893139e-316*x0[61] - 0.016631529166626847*x0[62] + 3.9148294302679098e-315*x0[63] + 0.10447658962629225*x0[64] + 0.19580220380787028*x0[65] + 2.9702972134761569e-315*x0[66] + 9.4946129729208331e-316*x0[67] + 7.1030706254892873e-317*x0[68] + 1.1127353392555596e-315*x0[69] - 0.093047630265211109*x0[70] - 1.8625190374122373e-316*x0[71] - 8.7482608077073458e-317*x0[72] + 3.635606545756877e-315*x0[73] - 0.052147909363746914*x0[74] - 0.26018220107046747*x0[75] + 4.4526816489124933e-315*x0[76] - 0.21338391457092676*x0[77] + 0.22593490384148873*x0[78] - 1.5967483549172858e-315*x0[79] - 0.16969265324655797*x0[80] - 3.8148056228784653e-315*x0[81] - 1.7742441110808976e-315*x0[82] - 0.38544407657664892*x0[83] - 0.21240420573551816*x0[84] + 0.29902522689253713*x0[85] + 0.068522370854487993*x0[86] + 0.098638805740658295*x0[87] + 0.016425467095267016*x0[88] - 3.7576017785002081e-315*x0[89] - 0.030431523054088468*x0[90] + 4.36941070837405e-315*x0[91] + 0.063172325950318645*x0[92] - 7.8281434327429567e-316*x0[93] - 1.8927611315588192e-315*x0[94] - 0.025294287664367303*x0[95] - 1.6289210995068086e-315*x0[96] - 2.7283072247301626e-316*x0[97] - 3.8862993328720454e-315*x0[98] + 3.1188031836857007e-315*x0[99] - 0.023314246802055742*x0[100] - 1.712810274269206e-315*x0[101] + 6.0884882448860039e-316*x0[102] - 3.9952889594178839e-315*x0[103] - 0.12978525852773426*x0[104] + 0.03777613750954173*x0[105] + 4.1584152856345667e-315*x0[106] - 0.024900803629977802*x0[107] - 0.038676464429491922*x0[108] - 3.0171189945835598e-315*x0[109] - 0.0097436836477277876*x0[110] - 4.567685166015923e-316*x0[111] - 3.9748786728104137e-317*x0[112] - 0.1315147586125838*x0[113] + 0.036584245967938571*x0[114] + 0.35522027089812058*x0[115] + 0.088688347650989749*x0[116] - 1.4865135989527675e-315*x0[117] + 0.038989267952152136*x0[118] + 9.6762432136878818e-316*x0[119] - 0.20602109968973448*x0[120] + 0.060814263937814847*x0[121] + 5.631560426698223e-316*x0[122] - 3.7075671230824948e-315*x0[123] + 3.4629589520221197e-315*x0[124] - 3.7155303743490349e-315*x0[125] - 0.12419192997888814*x0[126] - 4.2253866052641906e-315*x0[127] - 2.6626568884178244e-315*x0[128] - 1.2078850210664607e-316*x0[129] + 0.3148480242647948*x0[130] + 0.14690383097096657*x0[131] + 9.4653685850581502e-316*x0[132] - 0.11143746018007494*x0[133] - 0.25766352104691681*x0[134] + 1.466273769933769e-315*x0[135] + 0.17357021951233403*x0[136] - 2.037720812197613e-315*x0[137] - 1.7442481307951351e-315*x0[138] + 0.010272590793254302*x0[139] + 0.24597142284889759*x0[140] + 0.19254417214120217*x0[141] + 0.077370851329911935*x0[142] + 9.4400782045591347e-316*x0[143] - 0.046131622465092281*x0[144] - 7.1998780457616795e-316*x0[145] + 0.12737566053610352*x0[146] + 0.013932518885668365*x0[147] - 1.7335439811891003e-315*x0[148] - 9.1516703481931821e-316*x0[149] - 4.0084745438488435e-315*x0[150] + 3.7297396529168645e-315*x0[151] - 0.061403949296831718*x0[152] + 4.8140282732949519e-316*x0[153] - 3.6335593995753032e-316*x0[154] + 2.6849086960257258e-315*x0[155] + 0.0056548893410976299*x0[156] - 0.0037009159116067119*x0[157] - 2.1765002997824256e-315*x0[158] + 0.40284176535921951*x0[159] + 0.11919998592763914*x0[160] - 3.7901772014130609e-315*x0[161] + 0.14495943558718627*x0[162] + 4.2646548933890883e-316*x0[163] + 1.7521583490552506e-315*x0[164] + 0.25014622509862233*x0[165] + 0.58430270629998138*x0[166] + 0.13454630996969805*x0[167] + 0.10472780005713632*x0[168] + 1.152859032877041e-315*x0[169] + 0.25625650253016041*x0[170] - 4.5216106246132598e-315*x0[171] - 0.081496953684469173*x0[172] + 0.22182386372701268*x0[173] + 3.8130761263225722e-317*x0[174] + 7.7295827711197322e-316*x0[175] + 1.3455879346683287e-316*x0[176] + 1.6677417098093531e-316*x0[177] - 0.0001436789837231135*x0[178] + 1.4852079267298464e-315*x0[179] + 1.3063738653074056e-315*x0[180] - 3.2779782100184551e-315*x0[181] + 0.29474819142155179*x0[182] - 0.065379164746487903*x0[183] - 3.2623968815081856e-316*x0[184] + 0.015522429424791295*x0[185] - 0.1357282802625184*x0[186] - 1.4675036376646487e-315*x0[187] - 0.047104945698932921*x0[188] - 1.0284381552015137e-315*x0[189] + 3.2832205627228441e-315*x0[190] - 0.075819496789809149*x0[191] - 0.036774903539201917*x0[192] + 0.11746425877049586*x0[193] - 0.12740327785667965); -x1[1] = relu(0.16361118768631158*x0[0] + 0.18640325164741592*x0[1] + 0.089326361227807127*x0[2] + 0.09315222543841091*x0[3] + 0.92606428143778707*x0[4] - 0.59460062459548635*x0[5] - 0.10736709967806669*x0[6] - 0.28151680344792246*x0[7] + 0.051314994622633038*x0[8] + 0.10992110123039787*x0[9] - 0.029724198811366401*x0[10] - 4.0747359899585227e-315*x0[11] - 0.017169961468298165*x0[12] - 0.089564218370592932*x0[13] - 2.8301541145901355e-316*x0[14] + 7.1100988575210728e-316*x0[15] - 1.5649223999452354e-315*x0[16] + 5.3656873490981709e-316*x0[17] - 0.17498866186628784*x0[18] - 0.17741104905752436*x0[19] + 3.9726304814362342e-315*x0[20] + 7.4359041730373806e-316*x0[21] - 0.046091790140453191*x0[22] - 0.03532176407184702*x0[23] + 4.4192149710997946e-315*x0[24] + 0.033759238134656679*x0[25] - 0.11895463464203426*x0[26] + 5.866762205443838e-316*x0[27] - 0.50206519920556714*x0[28] - 8.3207672962165093e-316*x0[29] - 3.3765053937535174e-316*x0[30] + 0.17069318379287285*x0[31] + 0.057540604542752005*x0[32] + 5.8394594461627466e-316*x0[33] - 0.19399815200435874*x0[34] + 7.7169282677328004e-316*x0[35] - 0.1719059201329918*x0[36] - 2.7400784523774288e-315*x0[37] + 0.14606011598730514*x0[38] + 0.20192050860406899*x0[39] + 7.0128448513114047e-316*x0[40] - 1.3981132095913229e-315*x0[41] + 3.8711066067548558e-316*x0[42] + 1.8117338567532395e-315*x0[43] - 0.15865988636337147*x0[44] - 0.12607955633754214*x0[45] - 3.6967750495541261e-316*x0[46] - 3.2362094408379855e-315*x0[47] - 0.10385140116373275*x0[48] + 0.012262380603050025*x0[49] + 7.8936300060563243e-317*x0[50] + 0.12126916008995091*x0[51] - 0.08510299216812689*x0[52] + 1.8404355876138128e-315*x0[53] - 0.31426611137793953*x0[54] + 2.4411568000174711e-315*x0[55] - 4.1860060802465271e-315*x0[56] - 0.29850559250132974*x0[57] - 0.33614211469613636*x0[58] - 0.043375721380811479*x0[59] + 0.2447690842859509*x0[60] - 3.7375087512065583e-315*x0[61] - 0.63510862602688989*x0[62] + 2.5306788270894175e-315*x0[63] + 0.38772750698875297*x0[64] + 0.18579495468370216*x0[65] + 4.058406221163994e-315*x0[66] - 1.1136035064677754e-315*x0[67] + 3.4353539036162768e-315*x0[68] - 1.140701910316434e-315*x0[69] - 0.32574450850590603*x0[70] - 1.6838758780146932e-315*x0[71] - 1.1245996834550976e-316*x0[72] + 2.7343863368936612e-315*x0[73] + 0.046836272835482619*x0[74] - 0.19800836202633987*x0[75] + 1.3919091630479604e-315*x0[76] - 0.3273240714600244*x0[77] + 0.19463003262041778*x0[78] - 1.2261099663905588e-316*x0[79] - 0.23972839599390333*x0[80] - 3.8462146210300209e-315*x0[81] - 4.2104227748200628e-315*x0[82] + 0.94346665821912401*x0[83] + 0.38663913597753879*x0[84] + 0.26909833266696026*x0[85] - 0.058527157104441452*x0[86] + 0.022193226199336381*x0[87] + 0.8706854839799093*x0[88] - 3.5331538078986913e-315*x0[89] + 0.26866762273720068*x0[90] + 1.8070159843758498e-315*x0[91] + 0.16207370779724597*x0[92] + 5.4658551074541877e-316*x0[93] + 1.8300568988113195e-316*x0[94] - 0.14038844887667828*x0[95] + 2.7600035072328054e-315*x0[96] - 6.3787217726264691e-316*x0[97] + 2.7740208363565693e-315*x0[98] + 1.0907798574000645e-315*x0[99] - 0.044223703515797859*x0[100] + 2.3287118611489079e-315*x0[101] + 8.6784898453329367e-316*x0[102] + 3.9471726522085302e-315*x0[103] - 0.057912663211742918*x0[104] - 0.032483348315396898*x0[105] + 7.7098464295784411e-316*x0[106] + 0.0078606104723038424*x0[107] + 0.11394468726553499*x0[108] - 3.6645835107074355e-316*x0[109] - 0.0031695404658739074*x0[110] + 4.3278433302321382e-315*x0[111] + 1.2639788382768935e-315*x0[112] + 0.044057293916553858*x0[113] - 0.11521152329592375*x0[114] - 0.17808559920788253*x0[115] - 1.0695630147830548*x0[116] + 3.3841667906730742e-315*x0[117] - 1.1148388166842469*x0[118] + 3.740564715208406e-315*x0[119] - 0.067580796405067894*x0[120] + 0.23499537440750751*x0[121] + 1.6358586655519258e-315*x0[122] - 4.1577041720098509e-315*x0[123] + 7.2525264220809915e-316*x0[124] - 7.82549138716921e-316*x0[125] - 0.24689280523397716*x0[126] + 1.3992438936438e-315*x0[127] - 3.9863808273662984e-315*x0[128] + 3.5820667416147431e-316*x0[129] - 0.56143721177062678*x0[130] - 0.037260082718270388*x0[131] + 1.3265058002706654e-315*x0[132] + 0.063295970300649484*x0[133] - 0.29477661936020239*x0[134] - 1.7762898195314421e-315*x0[135] + 0.061931509897609156*x0[136] - 3.7521086825398982e-315*x0[137] + 6.4191161845779327e-316*x0[138] - 0.20844032023211309*x0[139] - 0.09031889422662627*x0[140] - 0.25405640308172794*x0[141] - 0.097788321284511884*x0[142] - 3.1227067864721795e-316*x0[143] + 0.053554967211260067*x0[144] + 1.0476335245045474e-315*x0[145] - 0.24928774225906722*x0[146] - 0.084001586648459359*x0[147] - 2.9526248608143064e-315*x0[148] - 2.286877366415572e-315*x0[149] - 3.3335620279659683e-315*x0[150] - 9.1976489371067664e-316*x0[151] + 0.010767059663905489*x0[152] + 2.0388447423727114e-315*x0[153] - 2.1621940707129125e-315*x0[154] + 3.3929864405081461e-315*x0[155] - 0.040148469281403122*x0[156] - 0.062987418837505985*x0[157] + 2.2622304471323872e-316*x0[158] - 0.33605101746293781*x0[159] + 0.057919809031597831*x0[160] - 7.4711605987114828e-316*x0[161] - 0.31158569462227287*x0[162] - 9.1374562277820231e-316*x0[163] + 3.4016525248591776e-315*x0[164] - 0.29483692099962533*x0[165] - 0.17599519019407897*x0[166] - 0.11676235657248291*x0[167] - 0.17535198504878158*x0[168] - 4.3659065329589516e-315*x0[169] + 0.025890054667003323*x0[170] + 2.9339968715583003e-315*x0[171] - 0.17350392130791334*x0[172] + 0.17707821716648792*x0[173] - 6.7317088013406373e-316*x0[174] + 4.9544763638448076e-316*x0[175] + 3.281014011201296e-315*x0[176] + 1.7677181659473002e-316*x0[177] - 0.077037704363882145*x0[178] - 1.1052697603140755e-316*x0[179] - 3.7306547118995271e-316*x0[180] + 2.8758307503436075e-315*x0[181] - 0.095777881030916334*x0[182] + 0.062021258441814393*x0[183] - 2.389646024669678e-316*x0[184] - 0.29123479765125376*x0[185] - 0.14502628343229398*x0[186] + 4.1014182274917198e-315*x0[187] - 0.21344508402332721*x0[188] - 1.286496685413111e-315*x0[189] - 1.0208596279127337e-315*x0[190] + 0.077135398003818897*x0[191] - 0.079724677391178445*x0[192] - 0.01628231845105324*x0[193] + 0.31263168925764606); -x1[2] = relu(0.1702442664303645*x0[0] - 0.26048644724726788*x0[1] - 0.016119224474414478*x0[2] - 0.024551490525421556*x0[3] - 0.29708121036055696*x0[4] - 2.1343571618773134*x0[5] + 0.19306413191708457*x0[6] - 0.081035067948088443*x0[7] - 0.35896811695686148*x0[8] + 0.10262840485110895*x0[9] - 0.22257917339561636*x0[10] + 1.9891883781980495e-316*x0[11] - 0.027332287166827007*x0[12] - 0.023486382115482558*x0[13] + 3.7372309677378405e-315*x0[14] - 2.9837667028491862e-315*x0[15] + 3.4833132461699468e-316*x0[16] - 3.8861657029368147e-315*x0[17] + 0.11890972952789311*x0[18] + 0.21561583753604688*x0[19] + 3.3758066218886347e-315*x0[20] - 1.5390609833134131e-315*x0[21] + 0.089575806757818163*x0[22] + 0.34683038863864585*x0[23] - 8.5060606879015187e-316*x0[24] - 0.078054822431138773*x0[25] + 0.15509036973783183*x0[26] - 1.9337394204092251e-315*x0[27] + 0.27927482755981109*x0[28] + 1.132512100307337e-315*x0[29] + 3.4172269265690925e-315*x0[30] - 0.062271606627618888*x0[31] - 0.055872752897774394*x0[32] - 1.607143328123466e-315*x0[33] - 0.12180310771838465*x0[34] + 3.0812556372734518e-315*x0[35] - 0.15740516969547586*x0[36] - 2.2444830063736817e-315*x0[37] + 0.3516636676348443*x0[38] + 0.078289205826371847*x0[39] + 3.319987939955058e-315*x0[40] + 2.7435815062635112e-315*x0[41] - 4.4140294161820515e-315*x0[42] + 4.1716964569460271e-315*x0[43] - 0.11039377081343789*x0[44] + 0.057047405180536088*x0[45] - 1.168057420986532e-315*x0[46] + 4.0841337064805417e-315*x0[47] - 0.046449574010417542*x0[48] - 0.027692190541673749*x0[49] + 3.720824979436128e-315*x0[50] - 0.05878776257656728*x0[51] + 0.0081906332354465417*x0[52] + 1.2240768072074188e-315*x0[53] + 0.069177837226000793*x0[54] + 3.5406655918593745e-315*x0[55] + 2.2326342746485524e-315*x0[56] - 0.071879830951788959*x0[57] - 0.09484964178180838*x0[58] + 0.078251622504937154*x0[59] - 0.03461975870266016*x0[60] - 2.3934137198782987e-315*x0[61] + 0.18637185584916813*x0[62] + 1.8126489651424667e-315*x0[63] - 0.15510536155890858*x0[64] + 0.2038500587489131*x0[65] + 3.1188809446776997e-315*x0[66] - 1.537835325021836e-315*x0[67] + 2.2420658988958455e-315*x0[68] - 4.3750176469404746e-316*x0[69] - 0.16728269974657661*x0[70] - 1.7893507363779865e-315*x0[71] - 1.0671275466091792e-316*x0[72] + 9.1125238472499842e-316*x0[73] + 0.30095491373817801*x0[74] - 0.081725596397782846*x0[75] + 6.2021889059406937e-316*x0[76] + 0.10321979796662095*x0[77] + 0.17947564240857669*x0[78] + 4.259822382959894e-315*x0[79] + 0.067382040596557724*x0[80] - 3.8987399799441749e-315*x0[81] - 2.4716296425832867e-315*x0[82] - 0.18793020115456327*x0[83] - 0.097030175716786946*x0[84] + 0.032456210946033813*x0[85] - 0.052591550087735153*x0[86] - 0.039707970508244692*x0[87] + 0.081670312413103227*x0[88] - 7.5237006264346618e-316*x0[89] - 0.047188514090880478*x0[90] + 1.6314654140664796e-315*x0[91] - 0.08446715600917902*x0[92] - 1.1761026772689687e-315*x0[93] - 1.6929594873617122e-315*x0[94] + 0.010561952765896679*x0[95] + 4.1754649574816506e-315*x0[96] + 1.4904811881810392e-315*x0[97] - 6.1056817293612793e-316*x0[98] - 1.1119123148214044e-315*x0[99] - 0.070798766680634964*x0[100] + 2.3009333660574359e-315*x0[101] + 3.2485345704214608e-315*x0[102] - 1.0701365052054815e-315*x0[103] + 0.24522320067527253*x0[104] - 0.22404247307810843*x0[105] + 1.1755020811885712e-316*x0[106] + 0.041368677308169406*x0[107] + 0.074052632141589678*x0[108] - 2.3744098158349979e-315*x0[109] - 0.093187761394946778*x0[110] - 6.654822009095435e-316*x0[111] - 2.7582806212752537e-315*x0[112] + 0.22206739176268181*x0[113] + 0.1593163719201672*x0[114] + 0.18855107642269348*x0[115] - 0.058175960776775067*x0[116] + 2.4222086364603341e-315*x0[117] + 0.19497169597187061*x0[118] + 1.4542644421704589e-316*x0[119] - 0.038166235609970636*x0[120] + 0.20434121183384715*x0[121] - 3.4819530488623506e-315*x0[122] + 4.3834441736818071e-315*x0[123] - 1.7546488203408377e-315*x0[124] - 1.5066733992184527e-315*x0[125] - 0.24397434879534341*x0[126] + 4.3252060572212022e-315*x0[127] + 2.4431047971052375e-315*x0[128] + 1.2932140661625026e-315*x0[129] - 0.0042881163245358468*x0[130] - 0.24491871064343373*x0[131] - 3.6994598022736275e-318*x0[132] - 0.10565097495292988*x0[133] - 0.53110591652716233*x0[134] + 7.0114868130706808e-316*x0[135] + 0.44890199677702969*x0[136] + 1.5349175017745655e-315*x0[137] + 1.478522719535312e-315*x0[138] + 0.193697587607224*x0[139] + 0.16146487854973576*x0[140] + 0.1370972373853144*x0[141] + 0.013592369411314675*x0[142] - 2.6438124490023753e-315*x0[143] - 0.22195326088078218*x0[144] + 2.3045279011385022e-316*x0[145] + 0.1068951749839316*x0[146] + 0.11647947748584336*x0[147] + 3.6137994565181103e-315*x0[148] + 4.4243930853889113e-316*x0[149] - 8.816743839756176e-316*x0[150] - 3.4224690124780327e-316*x0[151] + 0.026579254564368351*x0[152] + 1.3980927404516157e-315*x0[153] + 1.7715912700614612e-315*x0[154] - 1.2192668607562701e-316*x0[155] - 0.20012344898197773*x0[156] + 0.095018549002521074*x0[157] - 3.1355574833270749e-317*x0[158] + 0.077308074006573579*x0[159] + 0.10181457654714247*x0[160] + 1.4108592633424291e-315*x0[161] + 0.11748505264423285*x0[162] + 9.7074318980866438e-316*x0[163] - 1.7564248084740045e-315*x0[164] + 0.19045202641689443*x0[165] + 0.084485143892374409*x0[166] - 0.072662900441799488*x0[167] - 0.070545923636236144*x0[168] + 1.6643214810881396e-315*x0[169] + 0.30526580046031149*x0[170] + 1.5966468787742865e-315*x0[171] - 0.07329947254245249*x0[172] + 0.20751568481465996*x0[173] + 2.9132320434433744e-316*x0[174] - 2.9549997997892701e-315*x0[175] + 1.1755533454399837e-315*x0[176] - 1.866051517848186e-315*x0[177] - 0.28380431736558287*x0[178] - 1.4322027263197949e-315*x0[179] - 1.6789350140487094e-316*x0[180] - 3.7036117817415835e-315*x0[181] - 0.11605188817725882*x0[182] + 0.046591980266523843*x0[183] + 3.6374313920417611e-316*x0[184] - 0.0077477214572164296*x0[185] - 0.8350520750252971*x0[186] + 3.8698489181874588e-315*x0[187] + 0.078684707090775977*x0[188] + 9.4846210881124689e-316*x0[189] + 3.3413037846628213e-315*x0[190] + 0.045447156532637589*x0[191] - 0.11645568405663147*x0[192] + 0.08144328173929237*x0[193] - 0.16036145298517582); -x1[3] = relu(0.33915185155107158*x0[0] + 0.20127567676435479*x0[1] + 0.028385822762779383*x0[2] - 0.071140332437234249*x0[3] - 0.43531423889196735*x0[4] + 0.18294571946940258*x0[5] - 0.01812576054660546*x0[6] - 0.11088089835294598*x0[7] + 0.16329261666600275*x0[8] - 0.034012300830118046*x0[9] - 0.40392466072711852*x0[10] + 1.3200686584962514e-315*x0[11] - 0.17434210615497747*x0[12] + 0.012132417124453346*x0[13] - 1.502092200220672e-315*x0[14] + 3.3230231680217497e-315*x0[15] - 1.2357745919964307e-315*x0[16] + 1.5750585865067805e-315*x0[17] - 0.088700150253639184*x0[18] - 0.13639410480438152*x0[19] - 3.828349375258721e-315*x0[20] - 1.7001249757705688e-315*x0[21] - 0.61473686784263271*x0[22] - 0.094130648706502965*x0[23] - 4.8611343694189105e-316*x0[24] + 0.10926679463213283*x0[25] + 0.0061005540147055157*x0[26] + 9.6483953517797337e-316*x0[27] + 0.29830735245991896*x0[28] - 6.9553177249591041e-316*x0[29] - 1.1104798604131039e-315*x0[30] - 0.10526589511822355*x0[31] - 0.25720102900866326*x0[32] + 5.7876110115306161e-316*x0[33] - 0.22075152474643092*x0[34] - 4.7585089803207856e-316*x0[35] - 0.37317656167665558*x0[36] - 3.6561631202614244e-315*x0[37] - 0.21045075660321749*x0[38] - 0.20598850669616267*x0[39] - 1.2425833600683335e-315*x0[40] - 3.769595553076987e-315*x0[41] - 1.878287340125519e-316*x0[42] + 5.7333390366859406e-316*x0[43] + 0.32253591560365918*x0[44] - 0.039988660521900241*x0[45] - 1.5118821356962986e-315*x0[46] - 1.563212547439421e-315*x0[47] - 0.35489245296328553*x0[48] + 0.19942176300190384*x0[49] - 1.2945806962048076e-316*x0[50] - 0.80427107585573587*x0[51] - 0.035992795297983132*x0[52] - 3.3578778442159361e-315*x0[53] - 0.1209989185384366*x0[54] - 4.2968513234856727e-316*x0[55] - 1.3103728326448447e-315*x0[56] - 0.33112094397905445*x0[57] - 0.14267270972985222*x0[58] + 0.13923971693707587*x0[59] - 0.33876155124556961*x0[60] - 3.5647860594936332e-315*x0[61] - 0.23126401734288798*x0[62] + 2.4723158552994521e-316*x0[63] - 0.23089042386845746*x0[64] + 0.19817801047137332*x0[65] - 3.6918762404559164e-316*x0[66] + 7.3908554156692695e-316*x0[67] - 9.412032963425473e-316*x0[68] - 2.2256841642766873e-316*x0[69] - 0.24755611461342633*x0[70] + 3.0130987379574414e-315*x0[71] - 7.6595193218829851e-316*x0[72] + 8.4898898205000055e-316*x0[73] - 0.27278959605780706*x0[74] - 0.65436848593727948*x0[75] - 1.2410787621944273e-315*x0[76] - 0.40296067913993183*x0[77] + 0.042809081843081125*x0[78] - 7.2917665978706408e-316*x0[79] - 0.15665737037534228*x0[80] - 4.1775606011470202e-315*x0[81] + 6.2974702068396469e-316*x0[82] - 0.62669165872472099*x0[83] + 0.035245624602095647*x0[84] - 0.064307383667904769*x0[85] - 0.087451592647154824*x0[86] - 0.082468250398803386*x0[87] - 0.32196801001453718*x0[88] + 5.165605732721535e-316*x0[89] + 0.23617093169630377*x0[90] + 4.5341023481918564e-315*x0[91] - 0.27159970728591126*x0[92] + 8.0167077860362581e-316*x0[93] - 1.1323193850615202e-315*x0[94] + 0.061260492853105551*x0[95] + 6.0076898855161119e-316*x0[96] - 2.8795988408047449e-315*x0[97] + 4.0131171156811505e-315*x0[98] - 2.2734477283775363e-315*x0[99] + 0.059537835319846424*x0[100] - 4.1015685272018412e-315*x0[101] + 2.4012033564768902e-316*x0[102] - 1.3863778511099447e-315*x0[103] - 0.31266861636622989*x0[104] - 0.259525117201236*x0[105] + 2.0628969746006229e-315*x0[106] + 0.004176732499957818*x0[107] + 0.031758891343788932*x0[108] + 3.6375937617756103e-315*x0[109] - 0.19064100693084352*x0[110] + 6.2426741765644276e-316*x0[111] - 3.6750486807605769e-315*x0[112] - 0.062741019996422731*x0[113] - 0.10551195688514121*x0[114] + 0.077856823999104235*x0[115] + 0.61914699497350478*x0[116] - 1.2492685277376162e-315*x0[117] + 0.59552395056104568*x0[118] - 1.0917291501913274e-315*x0[119] - 0.099654791416629973*x0[120] + 0.36537578309459295*x0[121] - 3.0321446029960436e-317*x0[122] - 4.4544126128433546e-316*x0[123] - 2.568271377941346e-315*x0[124] - 2.7638283065487725e-315*x0[125] - 0.046890140564114648*x0[126] - 3.3413517979622841e-315*x0[127] - 2.7205270247854067e-315*x0[128] - 1.8312057101323425e-315*x0[129] - 0.32727396715027957*x0[130] + 0.41130019586238686*x0[131] - 1.9951471359702211e-315*x0[132] - 0.3816644797820723*x0[133] + 0.014517365125678342*x0[134] - 5.1928702019150738e-316*x0[135] - 0.39626392462722282*x0[136] + 1.6775050892565157e-315*x0[137] - 4.1843402934556652e-315*x0[138] - 0.7088175719769868*x0[139] - 0.31995124270197839*x0[140] - 0.018767804954102244*x0[141] + 0.26661647695564994*x0[142] + 1.7567934357930231e-315*x0[143] - 0.19938201681865309*x0[144] + 3.7635244299549817e-315*x0[145] + 0.013612546018600631*x0[146] + 0.13250299007722682*x0[147] - 3.527510184958063e-316*x0[148] - 2.015682925133048e-315*x0[149] + 1.6496690701018984e-315*x0[150] - 1.9502918053024569e-315*x0[151] - 0.19639380715523888*x0[152] + 4.351133599599064e-315*x0[153] - 3.4782780156656074e-315*x0[154] - 2.3952528150164088e-315*x0[155] - 0.35610387542581318*x0[156] - 0.26697275999278991*x0[157] + 2.6830112369128725e-316*x0[158] - 0.30948208269455951*x0[159] - 0.073079969845820131*x0[160] - 4.3113438647102325e-315*x0[161] - 0.01412482789112162*x0[162] - 2.4063615994457311e-316*x0[163] - 2.5558285668616878e-315*x0[164] - 0.14763564603522489*x0[165] - 0.057598151543755055*x0[166] - 0.20831936416719468*x0[167] + 0.046004371144909163*x0[168] - 1.3996575303431547e-315*x0[169] - 0.65881611669478424*x0[170] - 3.3490492666146439e-315*x0[171] - 0.030290108681582099*x0[172] - 0.29449380944713699*x0[173] + 1.1932859247040623e-316*x0[174] + 7.7885262848655305e-316*x0[175] + 3.7088828347193394e-315*x0[176] - 4.0440234069787191e-316*x0[177] + 0.32297650796664101*x0[178] - 1.8145002291174338e-315*x0[179] + 3.61630513020362e-315*x0[180] + 4.3535946146908461e-316*x0[181] - 0.28136731091890738*x0[182] - 0.066863770388969415*x0[183] - 1.5606038709480663e-316*x0[184] + 0.064562245425370562*x0[185] - 0.0049144724996739286*x0[186] + 3.1608164066664196e-315*x0[187] - 0.50320303876117711*x0[188] + 1.9677824455604235e-315*x0[189] - 1.2612184490476703e-315*x0[190] + 0.35894088621069026*x0[191] - 0.023912911886548784*x0[192] - 0.91619798401419517*x0[193] - 0.041954501357514822); -x1[4] = relu(0.12420968635455001*x0[0] + 0.11664330339354495*x0[1] + 0.27146842030875257*x0[2] - 0.19470012758209881*x0[3] - 0.79731290394514076*x0[4] + 0.18453664437093423*x0[5] + 0.4022809529840583*x0[6] - 0.18413761279680566*x0[7] + 0.13752518152169482*x0[8] + 0.34435732919026052*x0[9] + 0.32395017540132359*x0[10] - 2.7375845572169159e-315*x0[11] - 0.050311007279280562*x0[12] - 0.097013541037693773*x0[13] - 7.5312617082654871e-316*x0[14] - 2.7643378018647334e-317*x0[15] + 4.9742083082018507e-316*x0[16] + 1.0460199555117944e-315*x0[17] + 0.34645832509821367*x0[18] + 0.075003046537570131*x0[19] - 1.6371539376930019e-315*x0[20] - 1.6716298730443993e-315*x0[21] + 0.087553792943819583*x0[22] + 0.22172572475230182*x0[23] - 3.7338417070513083e-315*x0[24] - 0.054046300801450772*x0[25] - 0.17788163856804096*x0[26] + 1.41473790593248e-315*x0[27] + 0.44816135197917284*x0[28] - 2.0348531711979906e-315*x0[29] - 2.2726805679459563e-315*x0[30] + 0.42206657635878236*x0[31] + 0.34038666497954334*x0[32] + 1.3894380640763467e-315*x0[33] - 0.046649621245460862*x0[34] - 2.4705384986044463e-315*x0[35] + 0.062847465463980554*x0[36] + 1.8938985250227668e-315*x0[37] + 0.1854103216395514*x0[38] + 0.024958251850476652*x0[39] - 6.5244535988192094e-316*x0[40] - 2.5899708003945711e-315*x0[41] + 2.5638124651315675e-316*x0[42] + 3.1873781909951607e-315*x0[43] - 0.21909771670335002*x0[44] + 0.1640364853601527*x0[45] - 3.0577683789928727e-316*x0[46] + 1.0479907685510858e-315*x0[47] + 0.059132963931732799*x0[48] + 0.025792768682489801*x0[49] + 2.4636647164342072e-316*x0[50] - 0.0023792575144762902*x0[51] - 0.11467141083796029*x0[52] + 3.1433941796784327e-315*x0[53] - 0.22894941786636358*x0[54] + 2.9683840628383917e-315*x0[55] + 3.5551301837903491e-316*x0[56] - 0.039278388123051712*x0[57] - 0.1192077374569076*x0[58] - 0.21566529705278639*x0[59] - 0.18760385161896909*x0[60] + 1.2315919508144937e-315*x0[61] + 0.0098136357857593285*x0[62] + 5.4322513807719891e-316*x0[63] - 0.088849442973327447*x0[64] + 0.31354340398379626*x0[65] - 9.8942623279958654e-316*x0[66] - 5.3032882414122298e-316*x0[67] + 2.4994837840657934e-316*x0[68] - 4.0770884884718522e-315*x0[69] - 0.24847763185345503*x0[70] + 1.5368160922977478e-315*x0[71] + 2.0977766603978018e-315*x0[72] + 2.3060864213369955e-315*x0[73] - 0.03482735142413642*x0[74] - 0.13744222600623765*x0[75] - 1.9125780601476035e-315*x0[76] - 0.23935880133469156*x0[77] - 0.31412521315307512*x0[78] - 8.4932861265626474e-316*x0[79] - 0.1167608891998881*x0[80] + 8.5856956214885838e-316*x0[81] + 2.6054365867129042e-315*x0[82] - 0.5674870493606442*x0[83] - 0.21938035267101266*x0[84] - 0.18500447797463956*x0[85] + 0.30571708722819529*x0[86] - 0.21539032888707799*x0[87] - 0.79215146920148427*x0[88] + 1.2907460056946108e-317*x0[89] - 0.14228200450896508*x0[90] + 1.8774958963674459e-317*x0[91] + 0.50425368874134624*x0[92] + 1.9473596442701441e-316*x0[93] - 4.2153414700605176e-315*x0[94] + 0.013557523679765569*x0[95] + 1.7899638125565979e-315*x0[96] - 2.5694267356321764e-315*x0[97] + 3.6572081777968207e-315*x0[98] + 1.6897100917188612e-316*x0[99] - 0.20033250326032864*x0[100] + 7.5405881360554677e-316*x0[101] - 5.7537916251940078e-316*x0[102] + 8.4708665144987925e-316*x0[103] + 0.72113415986736062*x0[104] - 0.22903541055531634*x0[105] + 3.409015081232191e-315*x0[106] - 0.21512508310448547*x0[107] - 0.084423611625770154*x0[108] + 1.2805131453081439e-315*x0[109] + 0.1191128642574624*x0[110] + 2.9259502318920552e-316*x0[111] + 1.908628030012385e-315*x0[112] + 0.0022050041676339215*x0[113] + 0.028936531126440613*x0[114] - 0.1058694986068052*x0[115] + 0.23102839579494738*x0[116] + 3.7820614814882142e-315*x0[117] + 0.51834427398734395*x0[118] - 1.7567039456825919e-315*x0[119] - 0.079313044165757657*x0[120] - 0.11642983320224007*x0[121] + 1.3798716933054632e-316*x0[122] - 1.802332158062115e-316*x0[123] + 3.2075051803613056e-315*x0[124] - 1.0227909700475788e-315*x0[125] + 0.34949975048674914*x0[126] - 1.6709153948326354e-315*x0[127] - 1.6143598189289429e-315*x0[128] - 3.7092587989131988e-315*x0[129] + 0.20716902395434555*x0[130] + 0.22993728692385099*x0[131] - 1.4580415246263507e-315*x0[132] + 0.065867746136622593*x0[133] - 0.19811516568108758*x0[134] - 3.3352348700142528e-315*x0[135] - 0.14187534749871805*x0[136] + 3.0450083728279279e-315*x0[137] - 1.5014191000067473e-315*x0[138] - 0.30352988952895976*x0[139] + 0.011492722124083145*x0[140] - 0.2134001968633312*x0[141] - 0.27994318133375062*x0[142] + 4.9563393371755812e-316*x0[143] - 0.065369508324624917*x0[144] + 4.1377524919568199e-315*x0[145] - 0.037696139346391662*x0[146] + 0.15740374108357064*x0[147] + 2.5023682578819696e-315*x0[148] + 1.7000447345690278e-315*x0[149] + 1.6814783009518371e-315*x0[150] + 1.7738722130473035e-315*x0[151] + 0.15735777795638545*x0[152] + 2.21646259697938e-315*x0[153] + 4.0543462317786371e-315*x0[154] - 2.6462504851009693e-315*x0[155] - 0.489013049320346*x0[156] + 0.2311293525976145*x0[157] - 1.3716118247877859e-315*x0[158] - 0.16918984913697727*x0[159] - 0.22274668915734003*x0[160] + 2.2738195819452222e-315*x0[161] - 0.23385865846973136*x0[162] - 2.2167083847568731e-315*x0[163] + 3.9556990296168871e-315*x0[164] + 0.16171541920275642*x0[165] - 0.18012193584456632*x0[166] - 0.2321617903455867*x0[167] + 0.10123551535028749*x0[168] + 5.9172336791210089e-316*x0[169] + 0.19536852004218458*x0[170] + 3.2054214288560314e-316*x0[171] - 0.12183308416794221*x0[172] - 0.15577583585886201*x0[173] - 9.9632415995793785e-316*x0[174] - 4.4738236121568592e-316*x0[175] + 4.0951418349158368e-315*x0[176] - 3.3516631653798751e-315*x0[177] + 0.36551491747990977*x0[178] + 2.6738792980643773e-315*x0[179] + 3.2982673912548168e-315*x0[180] + 2.4235259192259325e-315*x0[181] - 0.12025252746487113*x0[182] + 0.33894432613510356*x0[183] - 4.0529190095255261e-316*x0[184] + 0.01639222247935802*x0[185] - 0.24598298765030827*x0[186] - 1.4715754105156589e-315*x0[187] - 0.12223001395542825*x0[188] - 2.8703240329934418e-315*x0[189] + 1.5243907414980136e-315*x0[190] + 0.01433084919481753*x0[191] + 0.0073343633701947542*x0[192] - 0.82874666578745404*x0[193] + 0.12065217193972148); -x1[5] = relu(0.08859568538211185*x0[0] - 0.03918679314478371*x0[1] - 0.084969093479156516*x0[2] - 0.22574996916701623*x0[3] - 0.2118931230697704*x0[4] - 1.265372549869382*x0[5] + 0.21861481482906095*x0[6] - 0.16937693426893538*x0[7] + 0.26622955818475547*x0[8] - 0.063802089132739923*x0[9] + 0.35903571332203305*x0[10] - 1.3167725785905249e-315*x0[11] + 0.093644447408266454*x0[12] - 0.49521366934201527*x0[13] - 3.6359741058941006e-315*x0[14] - 5.9570741446703553e-316*x0[15] + 3.9973540154791195e-316*x0[16] - 1.5363701684084373e-315*x0[17] + 0.42806509209410509*x0[18] + 0.27174422324534864*x0[19] - 1.6375657068242154e-315*x0[20] - 2.0243475717530501e-316*x0[21] + 0.27502970579434977*x0[22] + 0.042627795462223207*x0[23] + 1.880569755426986e-315*x0[24] - 0.23705469148267286*x0[25] - 0.1663554740547491*x0[26] + 8.7381351299220878e-316*x0[27] + 0.012398013243231181*x0[28] - 3.7791660690586391e-315*x0[29] + 4.3753451136505382e-316*x0[30] - 0.11080979352977816*x0[31] + 0.30674564893539358*x0[32] - 2.2604606051758547e-316*x0[33] - 0.0056898700805643968*x0[34] - 3.5884272587481435e-315*x0[35] - 0.1063974386563801*x0[36] + 6.7420389234901444e-316*x0[37] - 0.078221565327795423*x0[38] - 0.67429460999177226*x0[39] + 6.2115060452965325e-316*x0[40] + 1.2820803857652863e-315*x0[41] - 3.7299849318067424e-315*x0[42] - 2.8946843596174434e-315*x0[43] + 0.59141585613362146*x0[44] + 0.15105238915326896*x0[45] + 2.9771798937686776e-315*x0[46] - 1.4709226658063428e-315*x0[47] - 0.03949679936297007*x0[48] + 0.25498383043998385*x0[49] - 5.478768896492057e-316*x0[50] + 0.027761158948993538*x0[51] + 0.098642770546164354*x0[52] + 4.1010602621093385e-315*x0[53] + 0.0062043150737285911*x0[54] - 4.1011467433599865e-315*x0[55] + 3.8183524509807692e-316*x0[56] + 0.086448330471316434*x0[57] + 0.039040285683839229*x0[58] - 0.077176801000532619*x0[59] + 0.12568468308104883*x0[60] - 3.6661512353489108e-315*x0[61] + 0.020329709354629116*x0[62] - 3.3450036693615503e-315*x0[63] + 0.18426821909145974*x0[64] - 0.09518873776160687*x0[65] - 2.0247213521767548e-315*x0[66] - 6.1333864604518272e-316*x0[67] - 2.0125188496865773e-316*x0[68] - 1.1767491028786745e-315*x0[69] + 0.11536570325542334*x0[70] - 2.2158470801164781e-315*x0[71] + 5.7578183096141785e-316*x0[72] - 1.9000927989476545e-315*x0[73] - 0.17640953431752299*x0[74] - 0.077326596600618955*x0[75] - 4.1194117228233672e-315*x0[76] - 0.013475232336032201*x0[77] - 0.013885012103943722*x0[78] + 3.4882776573046113e-315*x0[79] + 0.10669475040322819*x0[80] + 2.2518040809950702e-316*x0[81] + 2.7000579048408297e-315*x0[82] + 0.36259897682225978*x0[83] - 0.070186694051158224*x0[84] + 0.43085517340892221*x0[85] - 0.12879409389786206*x0[86] - 0.22404371025820771*x0[87] + 0.11278392895374265*x0[88] + 4.0786431055517434e-315*x0[89] + 0.17785862145556311*x0[90] + 2.9780799627996453e-315*x0[91] + 0.18973011200169881*x0[92] - 2.803907316873244e-315*x0[93] - 2.9658951132749937e-315*x0[94] + 0.090482254093401535*x0[95] + 9.5535691841537295e-316*x0[96] - 4.3586658526994544e-316*x0[97] - 4.0074237502112989e-315*x0[98] + 2.7355482014290473e-316*x0[99] + 0.014946871141338719*x0[100] + 2.0196673669404993e-315*x0[101] + 1.5090324144576509e-315*x0[102] - 1.9159367332300016e-315*x0[103] + 0.17770790283188101*x0[104] - 0.093899963626526403*x0[105] + 1.7053521903035692e-315*x0[106] - 0.17370526580490911*x0[107] - 0.0039232232320796654*x0[108] + 2.4013114580402002e-315*x0[109] - 0.20296773720537511*x0[110] + 1.1922472406154973e-315*x0[111] - 1.5611164838182524e-315*x0[112] + 0.0051030558813535548*x0[113] + 0.17576669236658979*x0[114] - 0.22917328971330742*x0[115] + 0.0072858029152470024*x0[116] - 1.5949361468316224e-316*x0[117] + 0.048205649832637816*x0[118] + 7.5153273994952027e-317*x0[119] + 0.0074300599327998089*x0[120] + 0.29527218062340294*x0[121] + 6.3445439910703675e-317*x0[122] + 3.8976887910541136e-315*x0[123] - 3.6921473589790718e-315*x0[124] + 2.176876609822237e-315*x0[125] - 0.5519602619273859*x0[126] - 2.6589407539000036e-316*x0[127] - 2.4168456230439178e-317*x0[128] - 3.737835669503755e-315*x0[129] + 0.042670105040652967*x0[130] - 0.11887648760688804*x0[131] + 2.4569876613228293e-315*x0[132] - 0.048578005868632146*x0[133] + 0.2046167680674974*x0[134] + 5.5534042809957254e-316*x0[135] + 0.070555077679985229*x0[136] + 2.1088192400305814e-315*x0[137] - 1.6874883279160777e-316*x0[138] - 0.11182855948965204*x0[139] - 0.010834655593437978*x0[140] - 0.17261915565832711*x0[141] - 0.38007312303778623*x0[142] + 4.1289593635656168e-315*x0[143] + 0.30990689439168634*x0[144] + 3.3372456924895444e-315*x0[145] - 0.047622732547011298*x0[146] + 0.037748122250799099*x0[147] + 2.9433693067412217e-316*x0[148] + 1.8990334431524676e-315*x0[149] + 1.1960902413098572e-316*x0[150] - 1.0970590809720981e-315*x0[151] - 0.21227286560148192*x0[152] - 4.3867255205499746e-316*x0[153] - 4.3662225324053752e-315*x0[154] - 2.8533699628488281e-315*x0[155] - 0.139689887315012*x0[156] + 0.24928967471914382*x0[157] - 3.9715739171119462e-316*x0[158] + 0.10271783710393385*x0[159] - 0.12798220301575117*x0[160] + 2.9294467295270172e-315*x0[161] + 0.18292854259894004*x0[162] + 4.0754867029447526e-315*x0[163] - 3.9418850480316386e-315*x0[164] + 0.0097562324126187674*x0[165] + 0.26124154234855351*x0[166] - 0.10806024363723658*x0[167] - 0.14775713285754935*x0[168] + 2.3274414899163821e-315*x0[169] - 0.10419925170479385*x0[170] - 2.4782108983659361e-316*x0[171] - 0.0016247021412578639*x0[172] - 0.04069783515590867*x0[173] - 1.452828178516029e-315*x0[174] - 3.3245017236954636e-315*x0[175] + 3.3048865962197232e-315*x0[176] + 1.0311470529091273e-315*x0[177] + 0.15142720907647783*x0[178] + 5.0284196117852169e-316*x0[179] + 4.0258646170445991e-316*x0[180] + 8.0998576508475315e-316*x0[181] + 0.067046858125205486*x0[182] + 0.67433439672221807*x0[183] - 2.6666864828846492e-315*x0[184] - 0.019346852951154545*x0[185] + 0.011523947005243644*x0[186] - 5.1779540142211745e-316*x0[187] + 0.15990890652421441*x0[188] + 1.7644745854571007e-315*x0[189] - 2.3634029423264433e-315*x0[190] + 0.095516370817599658*x0[191] - 0.14735791085853969*x0[192] - 0.21372811218762608*x0[193] + 0.067213102988710013); -x1[6] = relu(-0.68765528137869592*x0[0] - 0.07157033255913875*x0[1] - 0.42516412645224011*x0[2] + 0.18987661107165704*x0[3] + 0.732267780481902*x0[4] - 0.56793527729584681*x0[5] - 0.053538435557701373*x0[6] + 0.17458214156323829*x0[7] - 0.10185148378021833*x0[8] - 0.13603229583604379*x0[9] - 0.13115596133819427*x0[10] + 6.8435399179914638e-317*x0[11] - 0.17024549847721052*x0[12] - 0.036623292421400964*x0[13] - 4.335497074074841e-315*x0[14] + 3.5862801976710112e-315*x0[15] - 2.7807040178819557e-315*x0[16] - 3.7623426891586634e-315*x0[17] - 0.36767116011552109*x0[18] - 0.11288541370238732*x0[19] + 8.63858525006276e-316*x0[20] - 2.43516987556283e-315*x0[21] + 0.012039174976280249*x0[22] - 0.093807734071303953*x0[23] - 2.853782576832296e-315*x0[24] - 0.072593333812481925*x0[25] + 0.27269082346867113*x0[26] - 4.8037135165870304e-316*x0[27] - 0.5419953599648224*x0[28] - 2.5763546377532609e-315*x0[29] - 7.534933159486298e-316*x0[30] - 0.42819505919330436*x0[31] - 0.29668152880803872*x0[32] + 2.3834174378856865e-316*x0[33] - 0.038189801360211502*x0[34] + 4.5527801985528407e-315*x0[35] + 0.035661360020231979*x0[36] - 2.2620068231397666e-315*x0[37] - 0.043013280621736753*x0[38] + 0.20982046957965228*x0[39] - 2.4349117756694426e-316*x0[40] + 3.2613552923136231e-316*x0[41] + 3.8734613730294998e-316*x0[42] + 4.544927983599547e-315*x0[43] - 0.1765169928846381*x0[44] + 0.11892874504341883*x0[45] - 4.3648158830457571e-316*x0[46] - 7.0559873551981665e-316*x0[47] + 0.53464337431636266*x0[48] + 0.10476760920052069*x0[49] - 1.2364515162784543e-315*x0[50] + 0.042784823605017668*x0[51] - 0.36288957441009295*x0[52] - 1.0659777817414597e-315*x0[53] - 0.02805557302704129*x0[54] + 2.731512080355041e-315*x0[55] + 3.9625378319394006e-315*x0[56] + 0.15555455275801117*x0[57] - 0.04860436168463831*x0[58] + 0.12143237566597079*x0[59] - 0.09253879448542443*x0[60] + 4.2682317755046287e-315*x0[61] + 0.060028352204519353*x0[62] + 1.4422833650807781e-315*x0[63] + 0.19183966925789675*x0[64] - 0.032415279103084574*x0[65] + 7.4805153364629701e-316*x0[66] - 7.2028051870870305e-317*x0[67] + 1.6648088867290749e-316*x0[68] - 3.6006324835400296e-315*x0[69] - 0.034052299112486174*x0[70] + 2.606135640195205e-315*x0[71] - 9.4814467657445035e-316*x0[72] - 2.1752605803825678e-315*x0[73] + 0.099393442660463099*x0[74] + 0.068389077651714744*x0[75] - 1.1717310115115893e-315*x0[76] + 0.086215039440826244*x0[77] + 0.049070218513637895*x0[78] + 4.059293133226813e-315*x0[79] - 0.084448133234861389*x0[80] - 1.2797877630675763e-315*x0[81] - 9.7345068931050025e-316*x0[82] - 0.23870286156778853*x0[83] + 0.14945616767229489*x0[84] + 0.34799383405645995*x0[85] - 0.44282355423021758*x0[86] + 0.096565307483040055*x0[87] + 0.16505337000358605*x0[88] + 5.4771045869574762e-316*x0[89] - 0.30357752473616778*x0[90] + 3.0592322115103405e-315*x0[91] - 0.48048031526450008*x0[92] + 4.2424762223187407e-315*x0[93] - 3.1766895204658101e-315*x0[94] + 0.094464049401117064*x0[95] - 2.8327034834413634e-315*x0[96] - 1.6172595198483239e-315*x0[97] - 8.4342388590312225e-316*x0[98] - 1.6889531880900889e-315*x0[99] + 0.14560258778794613*x0[100] + 8.1131920873762701e-316*x0[101] - 8.8073658809193342e-317*x0[102] - 1.0224952322332912e-315*x0[103] - 0.14740057766171707*x0[104] - 0.010143237475377809*x0[105] + 1.045831652272195e-315*x0[106] + 0.15222096330328166*x0[107] - 0.039108673351762623*x0[108] - 1.3824083449069672e-315*x0[109] - 0.048337201978920635*x0[110] - 4.1411395688731975e-316*x0[111] - 3.4823180447988723e-315*x0[112] + 0.17789908724839598*x0[113] + 0.30961179776035924*x0[114] - 0.10303486796921003*x0[115] - 0.28699488426270126*x0[116] + 1.418629127433874e-315*x0[117] + 0.08163717552777261*x0[118] + 2.292186897225826e-315*x0[119] + 0.025526493068027178*x0[120] + 0.0092500510632690901*x0[121] + 3.6101571354077782e-315*x0[122] - 9.4583050767392516e-316*x0[123] + 3.9596766681403952e-316*x0[124] - 2.5819002183071285e-315*x0[125] - 0.099938408337685788*x0[126] - 5.8592581881951074e-316*x0[127] - 1.7807903771345085e-315*x0[128] + 1.2787831349239792e-315*x0[129] + 0.089019179457013903*x0[130] + 0.23054239946781216*x0[131] + 6.4816047181457711e-316*x0[132] - 0.045574258231632844*x0[133] - 0.33439803582446309*x0[134] + 1.642997355840152e-315*x0[135] - 0.14286148414891608*x0[136] - 1.9073994764961232e-315*x0[137] + 4.0480363958991871e-315*x0[138] - 0.23560110659208811*x0[139] - 0.12235921568538696*x0[140] + 0.029789115703997317*x0[141] - 0.07936467093171827*x0[142] + 3.2005845755898101e-316*x0[143] - 0.074360793519897952*x0[144] - 4.4814408692516167e-316*x0[145] + 0.31062919304336339*x0[146] + 0.09163507754836181*x0[147] + 2.5237753120486117e-316*x0[148] + 1.775063558479777e-315*x0[149] + 2.9118959170140436e-315*x0[150] - 3.0184465934398433e-315*x0[151] - 0.069258103613290323*x0[152] - 2.5825515796326362e-315*x0[153] + 3.0185208712690391e-315*x0[154] - 3.0365076522485595e-315*x0[155] - 0.19055738370321307*x0[156] - 0.28965413976548543*x0[157] - 2.0077609579918744e-315*x0[158] + 0.043142502932978798*x0[159] - 0.092320828984663886*x0[160] + 4.2752409415431411e-317*x0[161] + 0.044384381543965366*x0[162] - 3.6402149825937129e-315*x0[163] - 3.5679906186791241e-315*x0[164] - 0.049134734908700184*x0[165] + 0.41630085339554201*x0[166] + 0.19983527053911548*x0[167] + 0.089265362367128509*x0[168] + 3.0352125085645512e-315*x0[169] + 0.13962997165119223*x0[170] - 8.7985234892425842e-316*x0[171] + 0.1117874596825385*x0[172] + 0.15445122033291286*x0[173] + 7.8071007322274967e-316*x0[174] - 3.2758540142994124e-315*x0[175] + 8.598809605926148e-316*x0[176] + 1.2591544552275733e-315*x0[177] - 0.26096948968135975*x0[178] + 3.6944933210039069e-315*x0[179] - 2.8459034550639298e-315*x0[180] - 1.4230729959447366e-315*x0[181] + 0.066025667256867898*x0[182] + 0.085294796054346741*x0[183] - 4.2992949968732858e-315*x0[184] - 0.073745014740705273*x0[185] - 0.19727709893953566*x0[186] - 2.0260116540174338e-315*x0[187] + 0.036259335274381084*x0[188] + 3.3234102783365792e-315*x0[189] - 1.3206933007516321e-315*x0[190] + 0.02015153026860696*x0[191] + 0.04522197804188953*x0[192] - 0.019659580057185058*x0[193] + 0.15350273151627605); -x1[7] = relu(0.28489520986920119*x0[0] - 0.053481838325104163*x0[1] - 0.084677404457370695*x0[2] - 0.095887872684440351*x0[3] - 0.80768384388586045*x0[4] - 0.11810074084250968*x0[5] + 0.091116547967756298*x0[6] - 0.55285578004899416*x0[7] - 0.27544016691124124*x0[8] - 0.18642623055488977*x0[9] - 0.15380091311407693*x0[10] - 2.1253785418428549e-315*x0[11] - 0.082049671153709314*x0[12] - 0.13859425954164781*x0[13] - 3.5104019070440694e-315*x0[14] + 1.7614800338150311e-315*x0[15] + 2.0471841356967433e-315*x0[16] + 2.1465029114095724e-315*x0[17] - 0.074449386368483916*x0[18] - 0.41076022675399437*x0[19] - 4.0321798382395888e-315*x0[20] + 3.676654621379758e-316*x0[21] - 0.28739714477629058*x0[22] + 0.090016233406349455*x0[23] + 2.0872916338463541e-315*x0[24] - 0.34750766799203675*x0[25] - 0.08759468584014804*x0[26] - 4.0376424898748019e-315*x0[27] + 0.015224704272591478*x0[28] + 3.4063240341163616e-316*x0[29] + 3.810993150500362e-315*x0[30] - 0.14464689371538605*x0[31] - 0.24845992950226226*x0[32] + 1.1269088178266917e-315*x0[33] + 0.61851662143563424*x0[34] - 3.9786557058597409e-316*x0[35] - 0.07145902639400728*x0[36] + 4.0435211546651263e-315*x0[37] - 0.19603392095643485*x0[38] + 0.46174507162342743*x0[39] + 1.0971910261434765e-315*x0[40] + 9.1813882485708393e-316*x0[41] - 1.5539985591091209e-315*x0[42] + 7.4107891858426388e-316*x0[43] - 0.52169868623590898*x0[44] - 0.35686967710975132*x0[45] - 1.9160939449185083e-315*x0[46] - 2.5229167247692688e-316*x0[47] - 0.15559925857024695*x0[48] - 0.11634830875216962*x0[49] - 1.471757933187202e-315*x0[50] + 0.26761520547190143*x0[51] + 0.14984517163518668*x0[52] - 2.772640278603708e-315*x0[53] - 0.55989381009084438*x0[54] + 4.0965303323036267e-316*x0[55] - 7.1740614359432785e-316*x0[56] + 0.35115957971910711*x0[57] + 0.36336209104500572*x0[58] - 0.47307395150716919*x0[59] - 0.44646782502356208*x0[60] + 2.8384899852261125e-315*x0[61] - 0.16639894462108459*x0[62] + 5.9773136426653712e-316*x0[63] - 0.52866108357028052*x0[64] + 0.17014527999871118*x0[65] - 3.0414090502507534e-315*x0[66] - 9.1106791049415422e-316*x0[67] + 3.812019171686424e-316*x0[68] - 4.1071961621781701e-315*x0[69] - 0.26969930864222474*x0[70] - 2.0467387256357045e-316*x0[71] + 2.4530934210803392e-315*x0[72] - 2.0799737410077248e-315*x0[73] - 0.25667029110283968*x0[74] + 0.2359379938122296*x0[75] + 1.9752735232298895e-315*x0[76] - 1.0773022751397858*x0[77] + 0.16659368459656163*x0[78] + 2.3707467340862276e-315*x0[79] - 0.38183238483426618*x0[80] + 2.4608941692153056e-315*x0[81] + 3.0738318859295446e-315*x0[82] + 0.74094211044246994*x0[83] + 0.24114198376806159*x0[84] - 0.47721124823615718*x0[85] - 0.14209697150704428*x0[86] - 0.11013014459582912*x0[87] - 0.51811253230855814*x0[88] - 4.0942676944499628e-315*x0[89] - 0.065526186731175162*x0[90] - 5.1456210243800795e-316*x0[91] - 0.21371158176041888*x0[92] - 4.2456055896535911e-315*x0[93] - 2.5173373155406304e-315*x0[94] + 0.11215651893744115*x0[95] - 7.9420773421890482e-316*x0[96] - 1.0476042906402829e-315*x0[97] + 3.0377725047678212e-316*x0[98] - 7.6285509907622682e-316*x0[99] + 0.1641604444849358*x0[100] - 2.5097190406706426e-315*x0[101] + 1.2185084848118731e-315*x0[102] - 1.6052712096375879e-315*x0[103] - 0.27144213289451241*x0[104] + 0.050036848483263216*x0[105] - 1.9751341374298848e-317*x0[106] + 0.1215395876336295*x0[107] + 0.038460259488975836*x0[108] - 1.2067871232102417e-315*x0[109] - 0.5999353741750546*x0[110] + 1.0351143160540727e-315*x0[111] - 4.2767466065988423e-316*x0[112] - 0.2323958913639104*x0[113] - 0.31019114940280124*x0[114] - 0.4674348178200754*x0[115] + 0.062853441253287609*x0[116] + 3.0896649606489961e-316*x0[117] - 0.57556454062175677*x0[118] + 7.7690774401235544e-316*x0[119] - 0.54181305509779587*x0[120] + 0.23813409372037353*x0[121] + 8.8847554343657445e-316*x0[122] - 2.1362366126601951e-315*x0[123] + 1.0948500640629774e-316*x0[124] + 1.0758256365327483e-315*x0[125] - 0.17355492916484466*x0[126] + 1.1661231885676587e-315*x0[127] + 3.77331653931945e-316*x0[128] - 3.8695415698304939e-315*x0[129] - 0.14028655094992507*x0[130] + 0.17420400140617601*x0[131] + 4.5585790915039876e-316*x0[132] - 0.70512998363163459*x0[133] + 0.40383836622877384*x0[134] + 9.8732808916204897e-316*x0[135] - 0.52432203025258461*x0[136] - 1.4017868149383497e-316*x0[137] - 1.5292856128930259e-315*x0[138] - 0.23772580373815183*x0[139] - 0.2439803111629166*x0[140] - 0.609045147093489*x0[141] - 0.027347111868986935*x0[142] - 2.5508040279379244e-315*x0[143] - 0.12753183768260412*x0[144] + 9.1416968426268431e-316*x0[145] - 0.46918384398114737*x0[146] - 0.075246857374183615*x0[147] - 7.6013071735127256e-316*x0[148] - 1.1426281240498753e-315*x0[149] + 4.092387344830425e-316*x0[150] - 1.6889788893849855e-315*x0[151] + 0.37680125045881818*x0[152] - 4.3617701165588395e-316*x0[153] - 3.4859513590924807e-315*x0[154] - 3.0802208513628325e-315*x0[155] + 0.022245223951219344*x0[156] - 0.063527821570863202*x0[157] + 1.4613472437528276e-315*x0[158] - 0.29556943581355483*x0[159] - 0.0062454171396883326*x0[160] + 2.7298030084729469e-316*x0[161] - 0.48883326751197681*x0[162] - 1.4523334656441917e-315*x0[163] + 3.4242228911735481e-315*x0[164] - 0.32368841991856251*x0[165] - 0.4032444849270902*x0[166] - 0.43171499450479278*x0[167] - 0.35500711616288605*x0[168] + 1.1701452287707585e-315*x0[169] - 0.90582787613342053*x0[170] - 5.7729588525178544e-316*x0[171] - 0.55437504355512957*x0[172] - 0.17479901329145778*x0[173] - 1.0298883366851869e-316*x0[174] - 9.2241709738542995e-316*x0[175] - 2.7634419126291295e-315*x0[176] - 2.0865189151762583e-316*x0[177] + 0.033292917834291412*x0[178] - 8.0797627164604888e-316*x0[179] - 3.3417840955210823e-315*x0[180] + 2.1873998078854824e-316*x0[181] - 0.47901782325402714*x0[182] - 0.041625147207387962*x0[183] - 2.279977136911311e-316*x0[184] - 0.33085941494965382*x0[185] + 0.29844039102976755*x0[186] - 2.5380562350757448e-315*x0[187] - 0.3594719292115342*x0[188] - 3.047560933343228e-316*x0[189] + 2.7509407622780103e-315*x0[190] - 0.39018668914496751*x0[191] - 0.49969062127546648*x0[192] + 0.6854000591020496*x0[193] + 0.65973192306452422); -x2[0] = relu(1.0286548433015636*x1[0] + 1.1407276551979413*x1[1] + 1.0023508028437138*x1[2] - 0.42003137662840634*x1[3] - 0.075173685326270001*x1[4] - 0.30121707956461558*x1[5] + 1.219163584682279*x1[6] - 0.33927265879156082*x1[7] - 0.41488067699898373); -x2[1] = relu(-0.95316275515418236*x1[0] - 0.10164607709323226*x1[1] - 0.12364178493903279*x1[2] + 1.0149583533406084*x1[3] - 0.12280523025089821*x1[4] - 1.3224989412261423*x1[5] - 0.42235657145318883*x1[6] + 0.23402732006237065*x1[7] - 0.42725583234972531); -x2[2] = relu(1.6280486014958921*x1[0] + 0.85699684997521264*x1[1] + 0.88789814406815781*x1[2] - 1.1675389312349578*x1[3] + 0.0080942762406626696*x1[4] + 0.48761851493601083*x1[5] + 0.91845932988324142*x1[6] - 0.047734609184752898*x1[7] + 0.17251628667016805); -x2[3] = relu(-1.3801804542631915*x1[0] - 0.77209990347519986*x1[1] - 0.9633139808107426*x1[2] + 0.066723855089116019*x1[3] + 0.70857436032679366*x1[4] - 0.9023753772958043*x1[5] - 0.64560789943933328*x1[6] + 1.2960763688306787*x1[7] + 0.78275710544714194); -x3_result[0] = sigmoid(-1.6767804886380782*x2[0] - 2.3739096588154478*x2[1] - 2.1644623224652353*x2[2] + 2.5121316236545326*x2[3] + 0.55794744288557929); - - return x3_result[0]; - } -} - diff --git a/src/dreal/util/pattern_matching/pattern_matching_heuristic.h b/src/dreal/util/pattern_matching/pattern_matching_heuristic.h deleted file mode 100644 index 153e74662..000000000 --- a/src/dreal/util/pattern_matching/pattern_matching_heuristic.h +++ /dev/null @@ -1,47 +0,0 @@ -// -// Created by Kunal Sheth on 4/13/25. -// - -#ifndef PATTERN_MATCHING_HEURISTIC_H -#define PATTERN_MATCHING_HEURISTIC_H -#include - -#include "matching_stats_t.h" - -namespace dreal -{ - class PatternMatchingHeuristic - { - public: - using statistics = struct - { - unsigned box_continuous_count; - unsigned box_integer_count; - unsigned box_boolean_count; - unsigned assertions_size; - PredicateHeuristic::predicate_stats_t assertions_stats; - PredicateHeuristic::predicate_stats_t biggest_assertion_stats; - PredicateHeuristic::predicate_stats_t middle_assertion_stats; - PredicateHeuristic::predicate_stats_t smallest_assertion_stats; - double theory_checksat_ms; - unsigned lemma_size; - PredicateHeuristic::predicate_stats_t lemma_stats; - PredicateHeuristic::predicate_stats_t biggest_literal_stats; - PredicateHeuristic::predicate_stats_t middle_literal_stats; - PredicateHeuristic::predicate_stats_t smallest_literal_stats; - uint64_t estimated_matching_cost; - double pattern_match_ms; - matching_stats_t pattern_matching_stats; - }; - - // todo: I have no idea why, but passing const ref instead of copying BREAKS it?!?!?! - // it goes from functioning perfectly normally.. to just returning 0 and only 0... - // the unit tests work, it only breaks the executable. - // I think it's a compiler bug.... the struct is massive, the function is pure / constexpr. - // lots to optimize away here. - // honestly passing by copy might let some fancier optimizations through so who knows. - static float calculate(const statistics& k); - }; -} - -#endif //PATTERN_MATCHING_HEURISTIC_H \ No newline at end of file From aa8803b7c2780235a1db30e4da71e5daecb909df Mon Sep 17 00:00:00 2001 From: Kunal Sheth Date: Wed, 31 Dec 2025 23:13:14 -0800 Subject: [PATCH 29/43] Fix using matching_stats_t = struct / typedef struct compile error on CentOS. --- src/dreal/solver/sat_solver.h | 2 ++ src/dreal/util/pattern_matching/matching_stats_t.h | 5 +++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/dreal/solver/sat_solver.h b/src/dreal/solver/sat_solver.h index cf66fc550..08cac1585 100644 --- a/src/dreal/solver/sat_solver.h +++ b/src/dreal/solver/sat_solver.h @@ -33,6 +33,8 @@ #include "dreal/util/scoped_unordered_map.h" #include "dreal/util/scoped_unordered_set.h" #include "dreal/util/tseitin_cnfizer.h" +#include "dreal/util/pattern_matching/matching_stats_t.h" + namespace dreal { diff --git a/src/dreal/util/pattern_matching/matching_stats_t.h b/src/dreal/util/pattern_matching/matching_stats_t.h index d0bae5568..1da84cc32 100644 --- a/src/dreal/util/pattern_matching/matching_stats_t.h +++ b/src/dreal/util/pattern_matching/matching_stats_t.h @@ -9,12 +9,13 @@ namespace dreal { - using matching_stats_t = struct + typedef struct { std::array misses_bc; unsigned partial_matches; unsigned matches; - }; + } matching_stats_t; } // namespace dreal #endif //DREAL4_CMAKE_MATCHING_STATS_T_H + From 38c534e555b9d94376e1d5f4b9c866ab05ab0104 Mon Sep 17 00:00:00 2001 From: Kunal Sheth Date: Wed, 31 Dec 2025 23:12:21 -0800 Subject: [PATCH 30/43] Remove now-defunct predicate_heuristic.cc/h. --- src/dreal/util/predicate_heuristic.cc | 317 -- src/dreal/util/predicate_heuristic.h | 233 - src/dreal/util/predicate_normalizer.cc | 12 - src/dreal/util/predicate_normalizer.h | 3 - .../test/pattern_matching_heuristic_test.cc | 3887 ----------------- test/dreal/util/test/pattern_matching_test.cc | 2 +- 6 files changed, 1 insertion(+), 4453 deletions(-) delete mode 100644 src/dreal/util/predicate_heuristic.cc delete mode 100644 src/dreal/util/predicate_heuristic.h delete mode 100644 test/dreal/util/test/pattern_matching_heuristic_test.cc diff --git a/src/dreal/util/predicate_heuristic.cc b/src/dreal/util/predicate_heuristic.cc deleted file mode 100644 index c3a4c823e..000000000 --- a/src/dreal/util/predicate_heuristic.cc +++ /dev/null @@ -1,317 +0,0 @@ -/* - Copyright 2017 Toyota Research Institute - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. -*/ -#include "dreal/util/predicate_heuristic.h" - -#include -#include -#include - -#include "exception.h" -#include "logging.h" - -namespace dreal -{ - PredicateHeuristic::predicate_stats_t PredicateHeuristic::collect_statistics(const Expression& e) { - const auto it = ecache.find(e); - if (it == ecache.cend()) { - predicate_stats_t stats = {0}; - recHeurExpr(e, stats); - stats.unique_variables = e.GetVariables().size(); - ecache.try_emplace(e, stats); - return stats; - } - else return it->second; - } - - PredicateHeuristic::predicate_stats_t PredicateHeuristic::collect_statistics(const Formula& f, const bool inverted) { - auto& fcache = inverted ? fcache_neg : fcache_pos; - const auto it = fcache.find(f); - if (it == fcache.cend()) { - predicate_stats_t stats = {0}; - recHeurForm(f, stats, inverted); - stats.unique_variables = f.GetFreeVariables().size(); - if ( - !(is_negation(f) && is_nary(get_operand(f))) && - !is_nary(f) // these will be cached at a lower level - ) fcache.try_emplace(f, stats); - return stats; - } - else return it->second; - } - -#define ADD_DECL(name) void PredicateHeuristic::name (const Expression &e, predicate_stats_t &stats) const - ADD_DECL(VisitVariable) { - stats.variable_cntr++; - } - - ADD_DECL(VisitConstant) { - stats.constant_cntr++; - } - - ADD_DECL(VisitRealConstant) { - stats.realconstant_cntr++; - } - - ADD_DECL(VisitAddition) { - const auto& map = get_expr_to_coeff_map_in_addition(e); - stats.addition_cntr += map.size(); - for (const auto& [expr, coeff] : map) { - recHeurExpr(expr, stats); - } - } - - ADD_DECL(VisitMultiplication) { - const auto map = get_base_to_exponent_map_in_multiplication(e); - stats.multiplication_cntr += map.size(); - for (const auto& [base, exp] : map) { - recHeurExpr(base, stats); - recHeurExpr(exp, stats); - } - } - - ADD_DECL(VisitDivision) { - stats.division_cntr++; - BinaryOpHelper(e, stats); - } - - ADD_DECL(VisitLog) { - stats.log_cntr++; - UnaryOpHelper(e, stats); - } - - ADD_DECL(VisitAbs) { - stats.abs_cntr++; - UnaryOpHelper(e, stats); - } - - ADD_DECL(VisitExp) { - stats.exp_cntr++; - UnaryOpHelper(e, stats); - } - - ADD_DECL(VisitSqrt) { - stats.sqrt_cntr++; - UnaryOpHelper(e, stats); - } - - ADD_DECL(VisitPow) { - stats.pow_cntr++; - BinaryOpHelper(e, stats); - } - - ADD_DECL(VisitSin) { - stats.trigonometry_cntr++; - UnaryOpHelper(e, stats); - } - - ADD_DECL(VisitCos) { - stats.trigonometry_cntr++; - UnaryOpHelper(e, stats); - } - - ADD_DECL(VisitTan) { - stats.trigonometry_cntr++; - UnaryOpHelper(e, stats); - } - - ADD_DECL(VisitAsin) { - stats.trigonometry_cntr++; - UnaryOpHelper(e, stats); - } - - ADD_DECL(VisitAcos) { - stats.trigonometry_cntr++; - UnaryOpHelper(e, stats); - } - - ADD_DECL(VisitAtan) { - stats.trigonometry_cntr++; - UnaryOpHelper(e, stats); - } - - ADD_DECL(VisitAtan2) { - stats.trigonometry_cntr++; - BinaryOpHelper(e, stats); - } - - ADD_DECL(VisitSinh) { - stats.trigonometry_cntr++; - UnaryOpHelper(e, stats); - } - - ADD_DECL(VisitCosh) { - stats.trigonometry_cntr++; - UnaryOpHelper(e, stats); - } - - ADD_DECL(VisitTanh) { - stats.trigonometry_cntr++; - UnaryOpHelper(e, stats); - } - - ADD_DECL(VisitMin) { - stats.min_cntr++; - BinaryOpHelper(e, stats); - } - - ADD_DECL(VisitMax) { - stats.max_cntr++; - BinaryOpHelper(e, stats); - } - - ADD_DECL(VisitIfThenElse) { - stats.ifthenelse_cntr++; - const auto ite = to_if_then_else(e); - recHeurForm(ite->get_conditional_formula(), stats, false); - recHeurExpr(ite->get_then_expression(), stats); - recHeurExpr(ite->get_else_expression(), stats); - } - - ADD_DECL(VisitUninterpretedFunction) { - stats.uninterpretedfunction_cntr++; - } - -#undef ADD_DECL -#define ADD_DECL(name) void PredicateHeuristic::name (const Formula &f, predicate_stats_t &stats, const bool &inverted) const - ADD_DECL(VisitFalse) { - stats.false_cntr++; - } - - ADD_DECL(VisitTrue) { - stats.true_cntr++; - } - - ADD_DECL(VisitVariable) { - stats.variable_cntr++; - } - - ADD_DECL(VisitEqualTo) { - stats.equalto_cntr++; - BinaryOpHelper(f, stats, inverted); - } - - ADD_DECL(VisitNotEqualTo) { - stats.notequalto_cntr++; - BinaryOpHelper(f, stats, inverted); - } - - ADD_DECL(VisitGreaterThan) { - stats.inequality_cntr++; - BinaryOpHelper(f, stats, inverted); - } - - ADD_DECL(VisitGreaterThanOrEqualTo) { - stats.inequality_cntr++; - BinaryOpHelper(f, stats, inverted); - } - - ADD_DECL(VisitLessThan) { - stats.inequality_cntr++; - BinaryOpHelper(f, stats, inverted); - } - - ADD_DECL(VisitLessThanOrEqualTo) { - stats.inequality_cntr++; - BinaryOpHelper(f, stats, inverted); - } - - ADD_DECL(VisitConjunction) { - const auto& ops = get_operands(f); - stats.conjunction_cntr += ops.size(); - for (const auto& op : ops) recHeurFormCheckCache(op, stats, inverted); - } - - ADD_DECL(VisitDisjunction) { - const auto& ops = get_operands(f); - stats.disjunction_cntr += ops.size(); - for (const auto& op : ops) recHeurFormCheckCache(op, stats, inverted); - } - - ADD_DECL(VisitNegation) { - stats.negation_cntr++; - UnaryOpHelper(f, stats, !inverted); - } - - ADD_DECL(VisitForall) { - stats.forall_cntr++; - recHeurForm(get_quantified_formula(f), stats, inverted); - for (const auto & v : get_quantified_variables(f)) - recHeurExpr({v}, stats); - } - - ADD_DECL(VisitForallT) { - stats.forallt_cntr++; - const auto* const ft = to_forallT(f); - recHeurExpr(ft->get_lb(), stats); - recHeurExpr(ft->get_ub(), stats); - recHeurForm(ft->get_bound_f(), stats, inverted); - // todo: recurse through flow as well? - } - - ADD_DECL(VisitIntegral) { - stats.integral_cntr++; - const auto* const i = to_integral(f); - recHeurExpr(i->get_time_0(), stats); - recHeurExpr(i->get_time_t(), stats); - for (const auto& v : i->get_vec_0()) { recHeurExpr(v, stats); } - for (const auto& v : i->get_vec_t()) { recHeurExpr(v, stats); } - // todo: recurse through flow as well? - } - -#undef ADD_DECL - - void PredicateHeuristic::recHeurExprCheckCache(const Expression& e, predicate_stats_t& outer_stats) const { - const auto it = ecache.find(e); - if (it == ecache.cend()) recHeurExpr(e, outer_stats); - else outer_stats += it->second; - } - - void PredicateHeuristic::recHeurExpr(const Expression& e, predicate_stats_t& stats) const { - return VisitExpression(this, e, stats); - } - - void PredicateHeuristic::recHeurFormCheckCache(const Formula& f, predicate_stats_t& outer_stats, - const bool& inverted) const { - auto& fcache = inverted ? fcache_neg : fcache_pos; - const auto it = fcache.find(f); - if (it == fcache.cend()) recHeurForm(f, outer_stats, inverted); - else outer_stats += it->second; - } - - void PredicateHeuristic::recHeurForm(const Formula& f, predicate_stats_t& stats, const bool& inverted) const { - return VisitFormula(this, f, stats, inverted); - } - - void PredicateHeuristic::UnaryOpHelper(const Expression& e, predicate_stats_t& stats) const { - return recHeurExpr(get_argument(e), stats); - } - - void PredicateHeuristic::UnaryOpHelper(const Formula& f, predicate_stats_t& stats, const bool& inverted) const { - return recHeurForm(get_operand(f), stats, inverted); - } - - void PredicateHeuristic::BinaryOpHelper(const Expression& e, predicate_stats_t& stats) const { - const auto b = to_binary(e); - recHeurExpr(b->get_first_argument(), stats); - recHeurExpr(b->get_second_argument(), stats); - } - - void PredicateHeuristic::BinaryOpHelper(const Formula& f, predicate_stats_t& stats, const bool& inverted) const { - const auto b = to_relational(f); - recHeurExpr(b->get_lhs_expression(), stats); - recHeurExpr(b->get_rhs_expression(), stats); - } -} // namespace dreal diff --git a/src/dreal/util/predicate_heuristic.h b/src/dreal/util/predicate_heuristic.h deleted file mode 100644 index 80dbe529f..000000000 --- a/src/dreal/util/predicate_heuristic.h +++ /dev/null @@ -1,233 +0,0 @@ -// -// Created by Kunal Sheth on 2/19/25. -// - -#ifndef predicate_heuristic_H -#define predicate_heuristic_H - -#include "dreal/symbolic/symbolic.h" -#include "dreal/util/box.h" - -namespace dreal -{ - class PredicateHeuristic - { - // todo: unit test this!!! - - public: - typedef struct - { - double raw_score; - unsigned unique_variables; - unsigned variable_cntr; - unsigned constant_cntr; - unsigned realconstant_cntr; - unsigned addition_cntr; - unsigned multiplication_cntr; - unsigned division_cntr; - unsigned log_cntr; - unsigned abs_cntr; - unsigned exp_cntr; - unsigned sqrt_cntr; - unsigned pow_cntr; - unsigned trigonometry_cntr; - unsigned min_cntr; - unsigned max_cntr; - unsigned ifthenelse_cntr; - unsigned uninterpretedfunction_cntr; - unsigned false_cntr; - unsigned true_cntr; - unsigned equalto_cntr; - unsigned notequalto_cntr; - unsigned inequality_cntr; - unsigned conjunction_cntr; - unsigned disjunction_cntr; - unsigned negation_cntr; - unsigned forall_cntr; - unsigned forallt_cntr; - unsigned integral_cntr; - } predicate_stats_t; - - static std::string predicate_stats_csv_header(const std::string& prefix) { - std::ostringstream s; - s << prefix << "raw_score,"; - s << prefix << "unique_variables,"; - s << prefix << "variable_cntr,"; - s << prefix << "constant_cntr,"; - s << prefix << "realconstant_cntr,"; - s << prefix << "addition_cntr,"; - s << prefix << "multiplication_cntr,"; - s << prefix << "division_cntr,"; - s << prefix << "log_cntr,"; - s << prefix << "abs_cntr,"; - s << prefix << "exp_cntr,"; - s << prefix << "sqrt_cntr,"; - s << prefix << "pow_cntr,"; - s << prefix << "trigonometry_cntr,"; - s << prefix << "min_cntr,"; - s << prefix << "max_cntr,"; - s << prefix << "ifthenelse_cntr,"; - s << prefix << "uninterpretedfunction_cntr,"; - s << prefix << "false_cntr,"; - s << prefix << "true_cntr,"; - s << prefix << "equalto_cntr,"; - s << prefix << "notequalto_cntr,"; - s << prefix << "inequality_cntr,"; - s << prefix << "conjunction_cntr,"; - s << prefix << "disjunction_cntr,"; - s << prefix << "negation_cntr,"; - s << prefix << "forall_cntr"; - s << prefix << "forallt_cntr"; - s << prefix << "integral_cntr"; - return s.str(); - } - - predicate_stats_t collect_statistics(const Expression& e); - predicate_stats_t collect_statistics(const Formula& f, bool inverted = false); - - private: - // must be reference to const bool because of `drake::symbolic::VisitExpression...` template requires it. -#define ADD_DECL(name) void name (const Expression &e, predicate_stats_t &stats) const - ADD_DECL(VisitVariable); - ADD_DECL(VisitConstant); - ADD_DECL(VisitRealConstant); - ADD_DECL(VisitAddition); - ADD_DECL(VisitMultiplication); - ADD_DECL(VisitDivision); - ADD_DECL(VisitLog); - ADD_DECL(VisitAbs); - ADD_DECL(VisitExp); - ADD_DECL(VisitSqrt); - ADD_DECL(VisitPow); - ADD_DECL(VisitSin); - ADD_DECL(VisitCos); - ADD_DECL(VisitTan); - ADD_DECL(VisitAsin); - ADD_DECL(VisitAcos); - ADD_DECL(VisitAtan); - ADD_DECL(VisitAtan2); - ADD_DECL(VisitSinh); - ADD_DECL(VisitCosh); - ADD_DECL(VisitTanh); - ADD_DECL(VisitMin); - ADD_DECL(VisitMax); - ADD_DECL(VisitIfThenElse); - ADD_DECL(VisitUninterpretedFunction); -#undef ADD_DECL - - // must be reference to const bool because of `drake::symbolic::VisitExpression...` template requires it. -#define ADD_DECL(name) void name (const Formula &e, predicate_stats_t &stats, const bool &inverted) const - ADD_DECL(VisitFalse); - ADD_DECL(VisitTrue); - ADD_DECL(VisitVariable); - ADD_DECL(VisitEqualTo); - ADD_DECL(VisitNotEqualTo); - ADD_DECL(VisitGreaterThan); - ADD_DECL(VisitGreaterThanOrEqualTo); - ADD_DECL(VisitLessThan); - ADD_DECL(VisitLessThanOrEqualTo); - ADD_DECL(VisitConjunction); - ADD_DECL(VisitDisjunction); - ADD_DECL(VisitNegation); - ADD_DECL(VisitForall); - ADD_DECL(VisitForallT); - ADD_DECL(VisitIntegral); -#undef VISIT_DECL -#undef ADD_DECL -#undef VISIT_AND_ADD_DECL - - std::unordered_map fcache_pos; - std::unordered_map fcache_neg; - std::unordered_map ecache; - - void recHeurExprCheckCache(const Expression& e, predicate_stats_t& stats) const; - void recHeurExpr(const Expression& e, predicate_stats_t& stats) const; - - void recHeurFormCheckCache(const Formula& f, predicate_stats_t& stats, const bool& inverted) const; - void recHeurForm(const Formula& f, predicate_stats_t& stats, const bool& inverted) const; - - void UnaryOpHelper(const Expression& e, predicate_stats_t& stats) const; - void UnaryOpHelper(const Formula& f, predicate_stats_t& stats, const bool& inverted) const; - void BinaryOpHelper(const Expression& e, predicate_stats_t& stats) const; - void BinaryOpHelper(const Formula& f, predicate_stats_t& stats, const bool& inverted) const; - void NaryOpHelper(const Formula& f, predicate_stats_t& stats, bool inverted) const; - - friend void drake::symbolic::VisitExpression( - const PredicateHeuristic*, const Expression&, predicate_stats_t& - ); - friend void drake::symbolic::VisitFormula( - const PredicateHeuristic*, const Formula&, predicate_stats_t&, const bool& - ); - }; - - inline std::ostream& operator<<(std::ostream& os, const PredicateHeuristic::predicate_stats_t& stats) { - os << stats.raw_score << ','; - os << stats.unique_variables << ','; - os << stats.variable_cntr << ','; - os << stats.constant_cntr << ','; - os << stats.realconstant_cntr << ','; - os << stats.addition_cntr << ','; - os << stats.multiplication_cntr << ','; - os << stats.division_cntr << ','; - os << stats.log_cntr << ','; - os << stats.abs_cntr << ','; - os << stats.exp_cntr << ','; - os << stats.sqrt_cntr << ','; - os << stats.pow_cntr << ','; - os << stats.trigonometry_cntr << ','; - os << stats.min_cntr << ','; - os << stats.max_cntr << ','; - os << stats.ifthenelse_cntr << ','; - os << stats.uninterpretedfunction_cntr << ','; - os << stats.false_cntr << ','; - os << stats.true_cntr << ','; - os << stats.equalto_cntr << ','; - os << stats.notequalto_cntr << ','; - os << stats.inequality_cntr << ','; - os << stats.conjunction_cntr << ','; - os << stats.disjunction_cntr << ','; - os << stats.negation_cntr << ','; - os << stats.forall_cntr << ','; - os << stats.forallt_cntr << ','; - os << stats.integral_cntr; - return os; - } - - inline PredicateHeuristic::predicate_stats_t& operator+=( - PredicateHeuristic::predicate_stats_t& lhs, - const PredicateHeuristic::predicate_stats_t& rhs - ) { - lhs.raw_score += rhs.raw_score; - lhs.unique_variables += rhs.unique_variables; - lhs.variable_cntr += rhs.variable_cntr; - lhs.constant_cntr += rhs.constant_cntr; - lhs.realconstant_cntr += rhs.realconstant_cntr; - lhs.addition_cntr += rhs.addition_cntr; - lhs.multiplication_cntr += rhs.multiplication_cntr; - lhs.division_cntr += rhs.division_cntr; - lhs.log_cntr += rhs.log_cntr; - lhs.abs_cntr += rhs.abs_cntr; - lhs.exp_cntr += rhs.exp_cntr; - lhs.sqrt_cntr += rhs.sqrt_cntr; - lhs.pow_cntr += rhs.pow_cntr; - lhs.trigonometry_cntr += rhs.trigonometry_cntr; - lhs.min_cntr += rhs.min_cntr; - lhs.max_cntr += rhs.max_cntr; - lhs.ifthenelse_cntr += rhs.ifthenelse_cntr; - lhs.uninterpretedfunction_cntr += rhs.uninterpretedfunction_cntr; - lhs.false_cntr += rhs.false_cntr; - lhs.true_cntr += rhs.true_cntr; - lhs.equalto_cntr += rhs.equalto_cntr; - lhs.notequalto_cntr += rhs.notequalto_cntr; - lhs.inequality_cntr += rhs.inequality_cntr; - lhs.conjunction_cntr += rhs.conjunction_cntr; - lhs.disjunction_cntr += rhs.disjunction_cntr; - lhs.negation_cntr += rhs.negation_cntr; - lhs.forall_cntr += rhs.forall_cntr; - lhs.forallt_cntr += rhs.forallt_cntr; - lhs.integral_cntr += rhs.integral_cntr; - return lhs; - } -} // namespace dreal - -#endif //predicate_heuristic_H diff --git a/src/dreal/util/predicate_normalizer.cc b/src/dreal/util/predicate_normalizer.cc index 7705803dd..520694653 100644 --- a/src/dreal/util/predicate_normalizer.cc +++ b/src/dreal/util/predicate_normalizer.cc @@ -62,40 +62,30 @@ namespace dreal Formula PredicateNormalizer::VisitEqualTo(const Formula& f) { trie.insert(f); trie.insert(!f); - heuristic.collect_statistics(f); - heuristic.collect_statistics(!f); return f; } Formula PredicateNormalizer::VisitLessThan(const Formula& f) { trie.insert(f); trie.insert(!f); - heuristic.collect_statistics(f); - heuristic.collect_statistics(!f); return f; } Formula PredicateNormalizer::VisitLessThanOrEqualTo(const Formula& f) { trie.insert(f); trie.insert(!f); - heuristic.collect_statistics(f); - heuristic.collect_statistics(!f); return f; } Formula PredicateNormalizer::VisitForall(const Formula& f) { trie.insert(f); trie.insert(!f); - heuristic.collect_statistics(f); - heuristic.collect_statistics(!f); return f; } Formula PredicateNormalizer::VisitForallT(const Formula& f) { trie.insert(f); trie.insert(!f); - heuristic.collect_statistics(f); - heuristic.collect_statistics(!f); const auto* const fa = to_forallT(f); return forallT(fa->get_flow(), fa->get_lb(), fa->get_ub(), Convert(fa->get_bound_f())); } @@ -103,8 +93,6 @@ namespace dreal Formula PredicateNormalizer::VisitIntegral(const Formula& f) { trie.insert(f); trie.insert(!f); - heuristic.collect_statistics(f); - heuristic.collect_statistics(!f); return f; } diff --git a/src/dreal/util/predicate_normalizer.h b/src/dreal/util/predicate_normalizer.h index 513ac4566..319f39cd7 100644 --- a/src/dreal/util/predicate_normalizer.h +++ b/src/dreal/util/predicate_normalizer.h @@ -20,7 +20,6 @@ #include "pattern_matching/trie_based/pattern_matching_trie.h" #include -#include "predicate_heuristic.h" #include "dreal/symbolic/symbolic.h" #include "pattern_matching/map_based/DeBruijnCanonicalizer.h" @@ -38,8 +37,6 @@ namespace dreal bool return_subs_maps, std::chrono::duration timeout = std::chrono::microseconds{-1} ) const; - PredicateHeuristic heuristic; // todo: make private? - private: Formula VisitFalse(const Formula& f); Formula VisitTrue(const Formula& f); diff --git a/test/dreal/util/test/pattern_matching_heuristic_test.cc b/test/dreal/util/test/pattern_matching_heuristic_test.cc deleted file mode 100644 index 61cc0091e..000000000 --- a/test/dreal/util/test/pattern_matching_heuristic_test.cc +++ /dev/null @@ -1,3887 +0,0 @@ - -// This file was automatically generated on 2025-04-19 11:57:52.077108 by Kunal in the `WORTH_IT_regression` python notebook. - - -#include -#include - -namespace dreal -{ - namespace - { - class PatternMatchingHeuristicTest : public ::testing::Test - { - protected: - void SetUp() override {} - }; - - TEST_F(PatternMatchingHeuristicTest, Generated) { - PatternMatchingHeuristic::statistics k; - float expected_value = -1E9; - float calculated_value = -1E9; - -k.assertions_size = 2144; -k.assertions_stats.abs_cntr = 0; -k.assertions_stats.addition_cntr = 982; -k.assertions_stats.conjunction_cntr = 2144; -k.assertions_stats.constant_cntr = 1625; -k.assertions_stats.disjunction_cntr = 0; -k.assertions_stats.division_cntr = 0; -k.assertions_stats.equalto_cntr = 1261; -k.assertions_stats.exp_cntr = 0; -k.assertions_stats.false_cntr = 0; -k.assertions_stats.forall_cntr = 0; -k.assertions_stats.ifthenelse_cntr = 0; -k.assertions_stats.inequality_cntr = 883; -k.assertions_stats.log_cntr = 0; -k.assertions_stats.max_cntr = 0; -k.assertions_stats.min_cntr = 0; -k.assertions_stats.multiplication_cntr = 504; -k.assertions_stats.negation_cntr = 507; -k.assertions_stats.notequalto_cntr = 0; -k.assertions_stats.pow_cntr = 50; -k.assertions_stats.realconstant_cntr = 0; -k.assertions_stats.sqrt_cntr = 0; -k.assertions_stats.trigonometry_cntr = 0; -k.assertions_stats.true_cntr = 0; -k.assertions_stats.uninterpretedfunction_cntr = 0; -k.assertions_stats.unique_variables = 1121; -k.assertions_stats.variable_cntr = 3812; -k.biggest_assertion_stats.abs_cntr = 0; -k.biggest_assertion_stats.addition_cntr = 2; -k.biggest_assertion_stats.conjunction_cntr = 0; -k.biggest_assertion_stats.constant_cntr = 0; -k.biggest_assertion_stats.disjunction_cntr = 0; -k.biggest_assertion_stats.division_cntr = 0; -k.biggest_assertion_stats.equalto_cntr = 1; -k.biggest_assertion_stats.exp_cntr = 0; -k.biggest_assertion_stats.false_cntr = 0; -k.biggest_assertion_stats.forall_cntr = 0; -k.biggest_assertion_stats.ifthenelse_cntr = 0; -k.biggest_assertion_stats.inequality_cntr = 0; -k.biggest_assertion_stats.log_cntr = 0; -k.biggest_assertion_stats.max_cntr = 0; -k.biggest_assertion_stats.min_cntr = 0; -k.biggest_assertion_stats.multiplication_cntr = 0; -k.biggest_assertion_stats.negation_cntr = 0; -k.biggest_assertion_stats.notequalto_cntr = 0; -k.biggest_assertion_stats.pow_cntr = 0; -k.biggest_assertion_stats.realconstant_cntr = 0; -k.biggest_assertion_stats.sqrt_cntr = 0; -k.biggest_assertion_stats.trigonometry_cntr = 0; -k.biggest_assertion_stats.true_cntr = 0; -k.biggest_assertion_stats.uninterpretedfunction_cntr = 0; -k.biggest_assertion_stats.unique_variables = 3; -k.biggest_assertion_stats.variable_cntr = 3; -k.biggest_literal_stats.abs_cntr = 0; -k.biggest_literal_stats.addition_cntr = 0; -k.biggest_literal_stats.conjunction_cntr = 0; -k.biggest_literal_stats.constant_cntr = 1; -k.biggest_literal_stats.disjunction_cntr = 0; -k.biggest_literal_stats.division_cntr = 0; -k.biggest_literal_stats.equalto_cntr = 0; -k.biggest_literal_stats.exp_cntr = 0; -k.biggest_literal_stats.false_cntr = 0; -k.biggest_literal_stats.forall_cntr = 0; -k.biggest_literal_stats.ifthenelse_cntr = 0; -k.biggest_literal_stats.inequality_cntr = 1; -k.biggest_literal_stats.log_cntr = 0; -k.biggest_literal_stats.max_cntr = 0; -k.biggest_literal_stats.min_cntr = 0; -k.biggest_literal_stats.multiplication_cntr = 0; -k.biggest_literal_stats.negation_cntr = 0; -k.biggest_literal_stats.notequalto_cntr = 0; -k.biggest_literal_stats.pow_cntr = 0; -k.biggest_literal_stats.realconstant_cntr = 0; -k.biggest_literal_stats.sqrt_cntr = 0; -k.biggest_literal_stats.trigonometry_cntr = 0; -k.biggest_literal_stats.true_cntr = 0; -k.biggest_literal_stats.uninterpretedfunction_cntr = 0; -k.biggest_literal_stats.unique_variables = 1; -k.biggest_literal_stats.variable_cntr = 1; -k.box_boolean_count = 5854; -k.box_continuous_count = 1121; -k.box_integer_count = 0; -k.lemma_size = 3; -k.middle_assertion_stats.abs_cntr = 0; -k.middle_assertion_stats.addition_cntr = 0; -k.middle_assertion_stats.conjunction_cntr = 0; -k.middle_assertion_stats.constant_cntr = 1; -k.middle_assertion_stats.disjunction_cntr = 0; -k.middle_assertion_stats.division_cntr = 0; -k.middle_assertion_stats.equalto_cntr = 1; -k.middle_assertion_stats.exp_cntr = 0; -k.middle_assertion_stats.false_cntr = 0; -k.middle_assertion_stats.forall_cntr = 0; -k.middle_assertion_stats.ifthenelse_cntr = 0; -k.middle_assertion_stats.inequality_cntr = 0; -k.middle_assertion_stats.log_cntr = 0; -k.middle_assertion_stats.max_cntr = 0; -k.middle_assertion_stats.min_cntr = 0; -k.middle_assertion_stats.multiplication_cntr = 1; -k.middle_assertion_stats.negation_cntr = 0; -k.middle_assertion_stats.notequalto_cntr = 0; -k.middle_assertion_stats.pow_cntr = 0; -k.middle_assertion_stats.realconstant_cntr = 0; -k.middle_assertion_stats.sqrt_cntr = 0; -k.middle_assertion_stats.trigonometry_cntr = 0; -k.middle_assertion_stats.true_cntr = 0; -k.middle_assertion_stats.uninterpretedfunction_cntr = 0; -k.middle_assertion_stats.unique_variables = 2; -k.middle_assertion_stats.variable_cntr = 2; -k.middle_literal_stats.abs_cntr = 0; -k.middle_literal_stats.addition_cntr = 0; -k.middle_literal_stats.conjunction_cntr = 0; -k.middle_literal_stats.constant_cntr = 1; -k.middle_literal_stats.disjunction_cntr = 0; -k.middle_literal_stats.division_cntr = 0; -k.middle_literal_stats.equalto_cntr = 0; -k.middle_literal_stats.exp_cntr = 0; -k.middle_literal_stats.false_cntr = 0; -k.middle_literal_stats.forall_cntr = 0; -k.middle_literal_stats.ifthenelse_cntr = 0; -k.middle_literal_stats.inequality_cntr = 1; -k.middle_literal_stats.log_cntr = 0; -k.middle_literal_stats.max_cntr = 0; -k.middle_literal_stats.min_cntr = 0; -k.middle_literal_stats.multiplication_cntr = 0; -k.middle_literal_stats.negation_cntr = 0; -k.middle_literal_stats.notequalto_cntr = 0; -k.middle_literal_stats.pow_cntr = 0; -k.middle_literal_stats.realconstant_cntr = 0; -k.middle_literal_stats.sqrt_cntr = 0; -k.middle_literal_stats.trigonometry_cntr = 0; -k.middle_literal_stats.true_cntr = 0; -k.middle_literal_stats.uninterpretedfunction_cntr = 0; -k.middle_literal_stats.unique_variables = 1; -k.middle_literal_stats.variable_cntr = 1; -k.smallest_assertion_stats.abs_cntr = 0; -k.smallest_assertion_stats.addition_cntr = 0; -k.smallest_assertion_stats.conjunction_cntr = 0; -k.smallest_assertion_stats.constant_cntr = 1; -k.smallest_assertion_stats.disjunction_cntr = 0; -k.smallest_assertion_stats.division_cntr = 0; -k.smallest_assertion_stats.equalto_cntr = 0; -k.smallest_assertion_stats.exp_cntr = 0; -k.smallest_assertion_stats.false_cntr = 0; -k.smallest_assertion_stats.forall_cntr = 0; -k.smallest_assertion_stats.ifthenelse_cntr = 0; -k.smallest_assertion_stats.inequality_cntr = 1; -k.smallest_assertion_stats.log_cntr = 0; -k.smallest_assertion_stats.max_cntr = 0; -k.smallest_assertion_stats.min_cntr = 0; -k.smallest_assertion_stats.multiplication_cntr = 0; -k.smallest_assertion_stats.negation_cntr = 1; -k.smallest_assertion_stats.notequalto_cntr = 0; -k.smallest_assertion_stats.pow_cntr = 0; -k.smallest_assertion_stats.realconstant_cntr = 0; -k.smallest_assertion_stats.sqrt_cntr = 0; -k.smallest_assertion_stats.trigonometry_cntr = 0; -k.smallest_assertion_stats.true_cntr = 0; -k.smallest_assertion_stats.uninterpretedfunction_cntr = 0; -k.smallest_assertion_stats.unique_variables = 1; -k.smallest_assertion_stats.variable_cntr = 1; -k.smallest_literal_stats.abs_cntr = 0; -k.smallest_literal_stats.addition_cntr = 0; -k.smallest_literal_stats.conjunction_cntr = 0; -k.smallest_literal_stats.constant_cntr = 1; -k.smallest_literal_stats.disjunction_cntr = 0; -k.smallest_literal_stats.division_cntr = 0; -k.smallest_literal_stats.equalto_cntr = 0; -k.smallest_literal_stats.exp_cntr = 0; -k.smallest_literal_stats.false_cntr = 0; -k.smallest_literal_stats.forall_cntr = 0; -k.smallest_literal_stats.ifthenelse_cntr = 0; -k.smallest_literal_stats.inequality_cntr = 1; -k.smallest_literal_stats.log_cntr = 0; -k.smallest_literal_stats.max_cntr = 0; -k.smallest_literal_stats.min_cntr = 0; -k.smallest_literal_stats.multiplication_cntr = 0; -k.smallest_literal_stats.negation_cntr = 1; -k.smallest_literal_stats.notequalto_cntr = 0; -k.smallest_literal_stats.pow_cntr = 0; -k.smallest_literal_stats.realconstant_cntr = 0; -k.smallest_literal_stats.sqrt_cntr = 0; -k.smallest_literal_stats.trigonometry_cntr = 0; -k.smallest_literal_stats.true_cntr = 0; -k.smallest_literal_stats.uninterpretedfunction_cntr = 0; -k.smallest_literal_stats.unique_variables = 1; -k.smallest_literal_stats.variable_cntr = 1; -k.theory_checksat_ms = 0.0847941; -expected_value = 0.583019044053358; -calculated_value = PatternMatchingHeuristic::calculate(k); -std::cout << "Trial 1593: C++/Python neural inference delta = " << expected_value - calculated_value << std::endl; -EXPECT_NEAR(calculated_value, expected_value, 0.001); - -k.assertions_size = 1289; -k.assertions_stats.abs_cntr = 0; -k.assertions_stats.addition_cntr = 582; -k.assertions_stats.conjunction_cntr = 1289; -k.assertions_stats.constant_cntr = 985; -k.assertions_stats.disjunction_cntr = 0; -k.assertions_stats.division_cntr = 0; -k.assertions_stats.equalto_cntr = 751; -k.assertions_stats.exp_cntr = 0; -k.assertions_stats.false_cntr = 0; -k.assertions_stats.forall_cntr = 0; -k.assertions_stats.ifthenelse_cntr = 0; -k.assertions_stats.inequality_cntr = 538; -k.assertions_stats.log_cntr = 0; -k.assertions_stats.max_cntr = 0; -k.assertions_stats.min_cntr = 0; -k.assertions_stats.multiplication_cntr = 304; -k.assertions_stats.negation_cntr = 296; -k.assertions_stats.notequalto_cntr = 0; -k.assertions_stats.pow_cntr = 30; -k.assertions_stats.realconstant_cntr = 0; -k.assertions_stats.sqrt_cntr = 0; -k.assertions_stats.trigonometry_cntr = 0; -k.assertions_stats.true_cntr = 0; -k.assertions_stats.uninterpretedfunction_cntr = 0; -k.assertions_stats.unique_variables = 671; -k.assertions_stats.variable_cntr = 2282; -k.biggest_assertion_stats.abs_cntr = 0; -k.biggest_assertion_stats.addition_cntr = 0; -k.biggest_assertion_stats.conjunction_cntr = 0; -k.biggest_assertion_stats.constant_cntr = 2; -k.biggest_assertion_stats.disjunction_cntr = 0; -k.biggest_assertion_stats.division_cntr = 0; -k.biggest_assertion_stats.equalto_cntr = 1; -k.biggest_assertion_stats.exp_cntr = 0; -k.biggest_assertion_stats.false_cntr = 0; -k.biggest_assertion_stats.forall_cntr = 0; -k.biggest_assertion_stats.ifthenelse_cntr = 0; -k.biggest_assertion_stats.inequality_cntr = 0; -k.biggest_assertion_stats.log_cntr = 0; -k.biggest_assertion_stats.max_cntr = 0; -k.biggest_assertion_stats.min_cntr = 0; -k.biggest_assertion_stats.multiplication_cntr = 2; -k.biggest_assertion_stats.negation_cntr = 0; -k.biggest_assertion_stats.notequalto_cntr = 0; -k.biggest_assertion_stats.pow_cntr = 0; -k.biggest_assertion_stats.realconstant_cntr = 0; -k.biggest_assertion_stats.sqrt_cntr = 0; -k.biggest_assertion_stats.trigonometry_cntr = 0; -k.biggest_assertion_stats.true_cntr = 0; -k.biggest_assertion_stats.uninterpretedfunction_cntr = 0; -k.biggest_assertion_stats.unique_variables = 3; -k.biggest_assertion_stats.variable_cntr = 3; -k.biggest_literal_stats.abs_cntr = 0; -k.biggest_literal_stats.addition_cntr = 0; -k.biggest_literal_stats.conjunction_cntr = 0; -k.biggest_literal_stats.constant_cntr = 1; -k.biggest_literal_stats.disjunction_cntr = 0; -k.biggest_literal_stats.division_cntr = 0; -k.biggest_literal_stats.equalto_cntr = 0; -k.biggest_literal_stats.exp_cntr = 0; -k.biggest_literal_stats.false_cntr = 0; -k.biggest_literal_stats.forall_cntr = 0; -k.biggest_literal_stats.ifthenelse_cntr = 0; -k.biggest_literal_stats.inequality_cntr = 1; -k.biggest_literal_stats.log_cntr = 0; -k.biggest_literal_stats.max_cntr = 0; -k.biggest_literal_stats.min_cntr = 0; -k.biggest_literal_stats.multiplication_cntr = 0; -k.biggest_literal_stats.negation_cntr = 0; -k.biggest_literal_stats.notequalto_cntr = 0; -k.biggest_literal_stats.pow_cntr = 0; -k.biggest_literal_stats.realconstant_cntr = 0; -k.biggest_literal_stats.sqrt_cntr = 0; -k.biggest_literal_stats.trigonometry_cntr = 0; -k.biggest_literal_stats.true_cntr = 0; -k.biggest_literal_stats.uninterpretedfunction_cntr = 0; -k.biggest_literal_stats.unique_variables = 1; -k.biggest_literal_stats.variable_cntr = 1; -k.box_boolean_count = 3529; -k.box_continuous_count = 671; -k.box_integer_count = 0; -k.lemma_size = 3; -k.middle_assertion_stats.abs_cntr = 0; -k.middle_assertion_stats.addition_cntr = 0; -k.middle_assertion_stats.conjunction_cntr = 0; -k.middle_assertion_stats.constant_cntr = 1; -k.middle_assertion_stats.disjunction_cntr = 0; -k.middle_assertion_stats.division_cntr = 0; -k.middle_assertion_stats.equalto_cntr = 1; -k.middle_assertion_stats.exp_cntr = 0; -k.middle_assertion_stats.false_cntr = 0; -k.middle_assertion_stats.forall_cntr = 0; -k.middle_assertion_stats.ifthenelse_cntr = 0; -k.middle_assertion_stats.inequality_cntr = 0; -k.middle_assertion_stats.log_cntr = 0; -k.middle_assertion_stats.max_cntr = 0; -k.middle_assertion_stats.min_cntr = 0; -k.middle_assertion_stats.multiplication_cntr = 0; -k.middle_assertion_stats.negation_cntr = 1; -k.middle_assertion_stats.notequalto_cntr = 0; -k.middle_assertion_stats.pow_cntr = 0; -k.middle_assertion_stats.realconstant_cntr = 0; -k.middle_assertion_stats.sqrt_cntr = 0; -k.middle_assertion_stats.trigonometry_cntr = 0; -k.middle_assertion_stats.true_cntr = 0; -k.middle_assertion_stats.uninterpretedfunction_cntr = 0; -k.middle_assertion_stats.unique_variables = 1; -k.middle_assertion_stats.variable_cntr = 1; -k.middle_literal_stats.abs_cntr = 0; -k.middle_literal_stats.addition_cntr = 0; -k.middle_literal_stats.conjunction_cntr = 0; -k.middle_literal_stats.constant_cntr = 1; -k.middle_literal_stats.disjunction_cntr = 0; -k.middle_literal_stats.division_cntr = 0; -k.middle_literal_stats.equalto_cntr = 0; -k.middle_literal_stats.exp_cntr = 0; -k.middle_literal_stats.false_cntr = 0; -k.middle_literal_stats.forall_cntr = 0; -k.middle_literal_stats.ifthenelse_cntr = 0; -k.middle_literal_stats.inequality_cntr = 1; -k.middle_literal_stats.log_cntr = 0; -k.middle_literal_stats.max_cntr = 0; -k.middle_literal_stats.min_cntr = 0; -k.middle_literal_stats.multiplication_cntr = 0; -k.middle_literal_stats.negation_cntr = 0; -k.middle_literal_stats.notequalto_cntr = 0; -k.middle_literal_stats.pow_cntr = 0; -k.middle_literal_stats.realconstant_cntr = 0; -k.middle_literal_stats.sqrt_cntr = 0; -k.middle_literal_stats.trigonometry_cntr = 0; -k.middle_literal_stats.true_cntr = 0; -k.middle_literal_stats.uninterpretedfunction_cntr = 0; -k.middle_literal_stats.unique_variables = 1; -k.middle_literal_stats.variable_cntr = 1; -k.smallest_assertion_stats.abs_cntr = 0; -k.smallest_assertion_stats.addition_cntr = 0; -k.smallest_assertion_stats.conjunction_cntr = 0; -k.smallest_assertion_stats.constant_cntr = 1; -k.smallest_assertion_stats.disjunction_cntr = 0; -k.smallest_assertion_stats.division_cntr = 0; -k.smallest_assertion_stats.equalto_cntr = 0; -k.smallest_assertion_stats.exp_cntr = 0; -k.smallest_assertion_stats.false_cntr = 0; -k.smallest_assertion_stats.forall_cntr = 0; -k.smallest_assertion_stats.ifthenelse_cntr = 0; -k.smallest_assertion_stats.inequality_cntr = 1; -k.smallest_assertion_stats.log_cntr = 0; -k.smallest_assertion_stats.max_cntr = 0; -k.smallest_assertion_stats.min_cntr = 0; -k.smallest_assertion_stats.multiplication_cntr = 0; -k.smallest_assertion_stats.negation_cntr = 1; -k.smallest_assertion_stats.notequalto_cntr = 0; -k.smallest_assertion_stats.pow_cntr = 0; -k.smallest_assertion_stats.realconstant_cntr = 0; -k.smallest_assertion_stats.sqrt_cntr = 0; -k.smallest_assertion_stats.trigonometry_cntr = 0; -k.smallest_assertion_stats.true_cntr = 0; -k.smallest_assertion_stats.uninterpretedfunction_cntr = 0; -k.smallest_assertion_stats.unique_variables = 1; -k.smallest_assertion_stats.variable_cntr = 1; -k.smallest_literal_stats.abs_cntr = 0; -k.smallest_literal_stats.addition_cntr = 0; -k.smallest_literal_stats.conjunction_cntr = 0; -k.smallest_literal_stats.constant_cntr = 1; -k.smallest_literal_stats.disjunction_cntr = 0; -k.smallest_literal_stats.division_cntr = 0; -k.smallest_literal_stats.equalto_cntr = 0; -k.smallest_literal_stats.exp_cntr = 0; -k.smallest_literal_stats.false_cntr = 0; -k.smallest_literal_stats.forall_cntr = 0; -k.smallest_literal_stats.ifthenelse_cntr = 0; -k.smallest_literal_stats.inequality_cntr = 1; -k.smallest_literal_stats.log_cntr = 0; -k.smallest_literal_stats.max_cntr = 0; -k.smallest_literal_stats.min_cntr = 0; -k.smallest_literal_stats.multiplication_cntr = 0; -k.smallest_literal_stats.negation_cntr = 1; -k.smallest_literal_stats.notequalto_cntr = 0; -k.smallest_literal_stats.pow_cntr = 0; -k.smallest_literal_stats.realconstant_cntr = 0; -k.smallest_literal_stats.sqrt_cntr = 0; -k.smallest_literal_stats.trigonometry_cntr = 0; -k.smallest_literal_stats.true_cntr = 0; -k.smallest_literal_stats.uninterpretedfunction_cntr = 0; -k.smallest_literal_stats.unique_variables = 1; -k.smallest_literal_stats.variable_cntr = 1; -k.theory_checksat_ms = 0.213477; -expected_value = 0.7505997556622402; -calculated_value = PatternMatchingHeuristic::calculate(k); -std::cout << "Trial 16215: C++/Python neural inference delta = " << expected_value - calculated_value << std::endl; -EXPECT_NEAR(calculated_value, expected_value, 0.001); - -k.assertions_size = 2144; -k.assertions_stats.abs_cntr = 0; -k.assertions_stats.addition_cntr = 982; -k.assertions_stats.conjunction_cntr = 2144; -k.assertions_stats.constant_cntr = 1625; -k.assertions_stats.disjunction_cntr = 0; -k.assertions_stats.division_cntr = 0; -k.assertions_stats.equalto_cntr = 1261; -k.assertions_stats.exp_cntr = 0; -k.assertions_stats.false_cntr = 0; -k.assertions_stats.forall_cntr = 0; -k.assertions_stats.ifthenelse_cntr = 0; -k.assertions_stats.inequality_cntr = 883; -k.assertions_stats.log_cntr = 0; -k.assertions_stats.max_cntr = 0; -k.assertions_stats.min_cntr = 0; -k.assertions_stats.multiplication_cntr = 504; -k.assertions_stats.negation_cntr = 496; -k.assertions_stats.notequalto_cntr = 0; -k.assertions_stats.pow_cntr = 50; -k.assertions_stats.realconstant_cntr = 0; -k.assertions_stats.sqrt_cntr = 0; -k.assertions_stats.trigonometry_cntr = 0; -k.assertions_stats.true_cntr = 0; -k.assertions_stats.uninterpretedfunction_cntr = 0; -k.assertions_stats.unique_variables = 1121; -k.assertions_stats.variable_cntr = 3812; -k.biggest_assertion_stats.abs_cntr = 0; -k.biggest_assertion_stats.addition_cntr = 2; -k.biggest_assertion_stats.conjunction_cntr = 0; -k.biggest_assertion_stats.constant_cntr = 0; -k.biggest_assertion_stats.disjunction_cntr = 0; -k.biggest_assertion_stats.division_cntr = 0; -k.biggest_assertion_stats.equalto_cntr = 1; -k.biggest_assertion_stats.exp_cntr = 0; -k.biggest_assertion_stats.false_cntr = 0; -k.biggest_assertion_stats.forall_cntr = 0; -k.biggest_assertion_stats.ifthenelse_cntr = 0; -k.biggest_assertion_stats.inequality_cntr = 0; -k.biggest_assertion_stats.log_cntr = 0; -k.biggest_assertion_stats.max_cntr = 0; -k.biggest_assertion_stats.min_cntr = 0; -k.biggest_assertion_stats.multiplication_cntr = 0; -k.biggest_assertion_stats.negation_cntr = 0; -k.biggest_assertion_stats.notequalto_cntr = 0; -k.biggest_assertion_stats.pow_cntr = 0; -k.biggest_assertion_stats.realconstant_cntr = 0; -k.biggest_assertion_stats.sqrt_cntr = 0; -k.biggest_assertion_stats.trigonometry_cntr = 0; -k.biggest_assertion_stats.true_cntr = 0; -k.biggest_assertion_stats.uninterpretedfunction_cntr = 0; -k.biggest_assertion_stats.unique_variables = 3; -k.biggest_assertion_stats.variable_cntr = 3; -k.biggest_literal_stats.abs_cntr = 0; -k.biggest_literal_stats.addition_cntr = 0; -k.biggest_literal_stats.conjunction_cntr = 0; -k.biggest_literal_stats.constant_cntr = 0; -k.biggest_literal_stats.disjunction_cntr = 0; -k.biggest_literal_stats.division_cntr = 0; -k.biggest_literal_stats.equalto_cntr = 1; -k.biggest_literal_stats.exp_cntr = 0; -k.biggest_literal_stats.false_cntr = 0; -k.biggest_literal_stats.forall_cntr = 0; -k.biggest_literal_stats.ifthenelse_cntr = 0; -k.biggest_literal_stats.inequality_cntr = 0; -k.biggest_literal_stats.log_cntr = 0; -k.biggest_literal_stats.max_cntr = 0; -k.biggest_literal_stats.min_cntr = 0; -k.biggest_literal_stats.multiplication_cntr = 0; -k.biggest_literal_stats.negation_cntr = 0; -k.biggest_literal_stats.notequalto_cntr = 0; -k.biggest_literal_stats.pow_cntr = 0; -k.biggest_literal_stats.realconstant_cntr = 0; -k.biggest_literal_stats.sqrt_cntr = 0; -k.biggest_literal_stats.trigonometry_cntr = 0; -k.biggest_literal_stats.true_cntr = 0; -k.biggest_literal_stats.uninterpretedfunction_cntr = 0; -k.biggest_literal_stats.unique_variables = 2; -k.biggest_literal_stats.variable_cntr = 2; -k.box_boolean_count = 5854; -k.box_continuous_count = 1121; -k.box_integer_count = 0; -k.lemma_size = 8; -k.middle_assertion_stats.abs_cntr = 0; -k.middle_assertion_stats.addition_cntr = 0; -k.middle_assertion_stats.conjunction_cntr = 0; -k.middle_assertion_stats.constant_cntr = 1; -k.middle_assertion_stats.disjunction_cntr = 0; -k.middle_assertion_stats.division_cntr = 0; -k.middle_assertion_stats.equalto_cntr = 1; -k.middle_assertion_stats.exp_cntr = 0; -k.middle_assertion_stats.false_cntr = 0; -k.middle_assertion_stats.forall_cntr = 0; -k.middle_assertion_stats.ifthenelse_cntr = 0; -k.middle_assertion_stats.inequality_cntr = 0; -k.middle_assertion_stats.log_cntr = 0; -k.middle_assertion_stats.max_cntr = 0; -k.middle_assertion_stats.min_cntr = 0; -k.middle_assertion_stats.multiplication_cntr = 1; -k.middle_assertion_stats.negation_cntr = 0; -k.middle_assertion_stats.notequalto_cntr = 0; -k.middle_assertion_stats.pow_cntr = 0; -k.middle_assertion_stats.realconstant_cntr = 0; -k.middle_assertion_stats.sqrt_cntr = 0; -k.middle_assertion_stats.trigonometry_cntr = 0; -k.middle_assertion_stats.true_cntr = 0; -k.middle_assertion_stats.uninterpretedfunction_cntr = 0; -k.middle_assertion_stats.unique_variables = 2; -k.middle_assertion_stats.variable_cntr = 2; -k.middle_literal_stats.abs_cntr = 0; -k.middle_literal_stats.addition_cntr = 0; -k.middle_literal_stats.conjunction_cntr = 0; -k.middle_literal_stats.constant_cntr = 1; -k.middle_literal_stats.disjunction_cntr = 0; -k.middle_literal_stats.division_cntr = 0; -k.middle_literal_stats.equalto_cntr = 0; -k.middle_literal_stats.exp_cntr = 0; -k.middle_literal_stats.false_cntr = 0; -k.middle_literal_stats.forall_cntr = 0; -k.middle_literal_stats.ifthenelse_cntr = 0; -k.middle_literal_stats.inequality_cntr = 1; -k.middle_literal_stats.log_cntr = 0; -k.middle_literal_stats.max_cntr = 0; -k.middle_literal_stats.min_cntr = 0; -k.middle_literal_stats.multiplication_cntr = 0; -k.middle_literal_stats.negation_cntr = 0; -k.middle_literal_stats.notequalto_cntr = 0; -k.middle_literal_stats.pow_cntr = 0; -k.middle_literal_stats.realconstant_cntr = 0; -k.middle_literal_stats.sqrt_cntr = 0; -k.middle_literal_stats.trigonometry_cntr = 0; -k.middle_literal_stats.true_cntr = 0; -k.middle_literal_stats.uninterpretedfunction_cntr = 0; -k.middle_literal_stats.unique_variables = 1; -k.middle_literal_stats.variable_cntr = 1; -k.smallest_assertion_stats.abs_cntr = 0; -k.smallest_assertion_stats.addition_cntr = 0; -k.smallest_assertion_stats.conjunction_cntr = 0; -k.smallest_assertion_stats.constant_cntr = 1; -k.smallest_assertion_stats.disjunction_cntr = 0; -k.smallest_assertion_stats.division_cntr = 0; -k.smallest_assertion_stats.equalto_cntr = 0; -k.smallest_assertion_stats.exp_cntr = 0; -k.smallest_assertion_stats.false_cntr = 0; -k.smallest_assertion_stats.forall_cntr = 0; -k.smallest_assertion_stats.ifthenelse_cntr = 0; -k.smallest_assertion_stats.inequality_cntr = 1; -k.smallest_assertion_stats.log_cntr = 0; -k.smallest_assertion_stats.max_cntr = 0; -k.smallest_assertion_stats.min_cntr = 0; -k.smallest_assertion_stats.multiplication_cntr = 0; -k.smallest_assertion_stats.negation_cntr = 1; -k.smallest_assertion_stats.notequalto_cntr = 0; -k.smallest_assertion_stats.pow_cntr = 0; -k.smallest_assertion_stats.realconstant_cntr = 0; -k.smallest_assertion_stats.sqrt_cntr = 0; -k.smallest_assertion_stats.trigonometry_cntr = 0; -k.smallest_assertion_stats.true_cntr = 0; -k.smallest_assertion_stats.uninterpretedfunction_cntr = 0; -k.smallest_assertion_stats.unique_variables = 1; -k.smallest_assertion_stats.variable_cntr = 1; -k.smallest_literal_stats.abs_cntr = 0; -k.smallest_literal_stats.addition_cntr = 0; -k.smallest_literal_stats.conjunction_cntr = 0; -k.smallest_literal_stats.constant_cntr = 1; -k.smallest_literal_stats.disjunction_cntr = 0; -k.smallest_literal_stats.division_cntr = 0; -k.smallest_literal_stats.equalto_cntr = 0; -k.smallest_literal_stats.exp_cntr = 0; -k.smallest_literal_stats.false_cntr = 0; -k.smallest_literal_stats.forall_cntr = 0; -k.smallest_literal_stats.ifthenelse_cntr = 0; -k.smallest_literal_stats.inequality_cntr = 1; -k.smallest_literal_stats.log_cntr = 0; -k.smallest_literal_stats.max_cntr = 0; -k.smallest_literal_stats.min_cntr = 0; -k.smallest_literal_stats.multiplication_cntr = 0; -k.smallest_literal_stats.negation_cntr = 1; -k.smallest_literal_stats.notequalto_cntr = 0; -k.smallest_literal_stats.pow_cntr = 0; -k.smallest_literal_stats.realconstant_cntr = 0; -k.smallest_literal_stats.sqrt_cntr = 0; -k.smallest_literal_stats.trigonometry_cntr = 0; -k.smallest_literal_stats.true_cntr = 0; -k.smallest_literal_stats.uninterpretedfunction_cntr = 0; -k.smallest_literal_stats.unique_variables = 1; -k.smallest_literal_stats.variable_cntr = 1; -k.theory_checksat_ms = 6.83229; -expected_value = 0.578838237320077; -calculated_value = PatternMatchingHeuristic::calculate(k); -std::cout << "Trial 1704: C++/Python neural inference delta = " << expected_value - calculated_value << std::endl; -EXPECT_NEAR(calculated_value, expected_value, 0.001); - -k.assertions_size = 776; -k.assertions_stats.abs_cntr = 0; -k.assertions_stats.addition_cntr = 342; -k.assertions_stats.conjunction_cntr = 776; -k.assertions_stats.constant_cntr = 601; -k.assertions_stats.disjunction_cntr = 0; -k.assertions_stats.division_cntr = 0; -k.assertions_stats.equalto_cntr = 445; -k.assertions_stats.exp_cntr = 0; -k.assertions_stats.false_cntr = 0; -k.assertions_stats.forall_cntr = 0; -k.assertions_stats.ifthenelse_cntr = 0; -k.assertions_stats.inequality_cntr = 331; -k.assertions_stats.log_cntr = 0; -k.assertions_stats.max_cntr = 0; -k.assertions_stats.min_cntr = 0; -k.assertions_stats.multiplication_cntr = 184; -k.assertions_stats.negation_cntr = 172; -k.assertions_stats.notequalto_cntr = 0; -k.assertions_stats.pow_cntr = 18; -k.assertions_stats.realconstant_cntr = 0; -k.assertions_stats.sqrt_cntr = 0; -k.assertions_stats.trigonometry_cntr = 0; -k.assertions_stats.true_cntr = 0; -k.assertions_stats.uninterpretedfunction_cntr = 0; -k.assertions_stats.unique_variables = 401; -k.assertions_stats.variable_cntr = 1364; -k.biggest_assertion_stats.abs_cntr = 0; -k.biggest_assertion_stats.addition_cntr = 2; -k.biggest_assertion_stats.conjunction_cntr = 0; -k.biggest_assertion_stats.constant_cntr = 0; -k.biggest_assertion_stats.disjunction_cntr = 0; -k.biggest_assertion_stats.division_cntr = 0; -k.biggest_assertion_stats.equalto_cntr = 1; -k.biggest_assertion_stats.exp_cntr = 0; -k.biggest_assertion_stats.false_cntr = 0; -k.biggest_assertion_stats.forall_cntr = 0; -k.biggest_assertion_stats.ifthenelse_cntr = 0; -k.biggest_assertion_stats.inequality_cntr = 0; -k.biggest_assertion_stats.log_cntr = 0; -k.biggest_assertion_stats.max_cntr = 0; -k.biggest_assertion_stats.min_cntr = 0; -k.biggest_assertion_stats.multiplication_cntr = 0; -k.biggest_assertion_stats.negation_cntr = 0; -k.biggest_assertion_stats.notequalto_cntr = 0; -k.biggest_assertion_stats.pow_cntr = 0; -k.biggest_assertion_stats.realconstant_cntr = 0; -k.biggest_assertion_stats.sqrt_cntr = 0; -k.biggest_assertion_stats.trigonometry_cntr = 0; -k.biggest_assertion_stats.true_cntr = 0; -k.biggest_assertion_stats.uninterpretedfunction_cntr = 0; -k.biggest_assertion_stats.unique_variables = 3; -k.biggest_assertion_stats.variable_cntr = 3; -k.biggest_literal_stats.abs_cntr = 0; -k.biggest_literal_stats.addition_cntr = 0; -k.biggest_literal_stats.conjunction_cntr = 0; -k.biggest_literal_stats.constant_cntr = 1; -k.biggest_literal_stats.disjunction_cntr = 0; -k.biggest_literal_stats.division_cntr = 0; -k.biggest_literal_stats.equalto_cntr = 1; -k.biggest_literal_stats.exp_cntr = 0; -k.biggest_literal_stats.false_cntr = 0; -k.biggest_literal_stats.forall_cntr = 0; -k.biggest_literal_stats.ifthenelse_cntr = 0; -k.biggest_literal_stats.inequality_cntr = 0; -k.biggest_literal_stats.log_cntr = 0; -k.biggest_literal_stats.max_cntr = 0; -k.biggest_literal_stats.min_cntr = 0; -k.biggest_literal_stats.multiplication_cntr = 0; -k.biggest_literal_stats.negation_cntr = 0; -k.biggest_literal_stats.notequalto_cntr = 0; -k.biggest_literal_stats.pow_cntr = 0; -k.biggest_literal_stats.realconstant_cntr = 0; -k.biggest_literal_stats.sqrt_cntr = 0; -k.biggest_literal_stats.trigonometry_cntr = 0; -k.biggest_literal_stats.true_cntr = 0; -k.biggest_literal_stats.uninterpretedfunction_cntr = 0; -k.biggest_literal_stats.unique_variables = 1; -k.biggest_literal_stats.variable_cntr = 1; -k.box_boolean_count = 2134; -k.box_continuous_count = 401; -k.box_integer_count = 0; -k.lemma_size = 3; -k.middle_assertion_stats.abs_cntr = 0; -k.middle_assertion_stats.addition_cntr = 0; -k.middle_assertion_stats.conjunction_cntr = 0; -k.middle_assertion_stats.constant_cntr = 1; -k.middle_assertion_stats.disjunction_cntr = 0; -k.middle_assertion_stats.division_cntr = 0; -k.middle_assertion_stats.equalto_cntr = 0; -k.middle_assertion_stats.exp_cntr = 0; -k.middle_assertion_stats.false_cntr = 0; -k.middle_assertion_stats.forall_cntr = 0; -k.middle_assertion_stats.ifthenelse_cntr = 0; -k.middle_assertion_stats.inequality_cntr = 1; -k.middle_assertion_stats.log_cntr = 0; -k.middle_assertion_stats.max_cntr = 0; -k.middle_assertion_stats.min_cntr = 0; -k.middle_assertion_stats.multiplication_cntr = 0; -k.middle_assertion_stats.negation_cntr = 1; -k.middle_assertion_stats.notequalto_cntr = 0; -k.middle_assertion_stats.pow_cntr = 0; -k.middle_assertion_stats.realconstant_cntr = 0; -k.middle_assertion_stats.sqrt_cntr = 0; -k.middle_assertion_stats.trigonometry_cntr = 0; -k.middle_assertion_stats.true_cntr = 0; -k.middle_assertion_stats.uninterpretedfunction_cntr = 0; -k.middle_assertion_stats.unique_variables = 1; -k.middle_assertion_stats.variable_cntr = 1; -k.middle_literal_stats.abs_cntr = 0; -k.middle_literal_stats.addition_cntr = 0; -k.middle_literal_stats.conjunction_cntr = 0; -k.middle_literal_stats.constant_cntr = 1; -k.middle_literal_stats.disjunction_cntr = 0; -k.middle_literal_stats.division_cntr = 0; -k.middle_literal_stats.equalto_cntr = 0; -k.middle_literal_stats.exp_cntr = 0; -k.middle_literal_stats.false_cntr = 0; -k.middle_literal_stats.forall_cntr = 0; -k.middle_literal_stats.ifthenelse_cntr = 0; -k.middle_literal_stats.inequality_cntr = 1; -k.middle_literal_stats.log_cntr = 0; -k.middle_literal_stats.max_cntr = 0; -k.middle_literal_stats.min_cntr = 0; -k.middle_literal_stats.multiplication_cntr = 0; -k.middle_literal_stats.negation_cntr = 0; -k.middle_literal_stats.notequalto_cntr = 0; -k.middle_literal_stats.pow_cntr = 0; -k.middle_literal_stats.realconstant_cntr = 0; -k.middle_literal_stats.sqrt_cntr = 0; -k.middle_literal_stats.trigonometry_cntr = 0; -k.middle_literal_stats.true_cntr = 0; -k.middle_literal_stats.uninterpretedfunction_cntr = 0; -k.middle_literal_stats.unique_variables = 1; -k.middle_literal_stats.variable_cntr = 1; -k.smallest_assertion_stats.abs_cntr = 0; -k.smallest_assertion_stats.addition_cntr = 0; -k.smallest_assertion_stats.conjunction_cntr = 0; -k.smallest_assertion_stats.constant_cntr = 1; -k.smallest_assertion_stats.disjunction_cntr = 0; -k.smallest_assertion_stats.division_cntr = 0; -k.smallest_assertion_stats.equalto_cntr = 0; -k.smallest_assertion_stats.exp_cntr = 0; -k.smallest_assertion_stats.false_cntr = 0; -k.smallest_assertion_stats.forall_cntr = 0; -k.smallest_assertion_stats.ifthenelse_cntr = 0; -k.smallest_assertion_stats.inequality_cntr = 1; -k.smallest_assertion_stats.log_cntr = 0; -k.smallest_assertion_stats.max_cntr = 0; -k.smallest_assertion_stats.min_cntr = 0; -k.smallest_assertion_stats.multiplication_cntr = 0; -k.smallest_assertion_stats.negation_cntr = 1; -k.smallest_assertion_stats.notequalto_cntr = 0; -k.smallest_assertion_stats.pow_cntr = 0; -k.smallest_assertion_stats.realconstant_cntr = 0; -k.smallest_assertion_stats.sqrt_cntr = 0; -k.smallest_assertion_stats.trigonometry_cntr = 0; -k.smallest_assertion_stats.true_cntr = 0; -k.smallest_assertion_stats.uninterpretedfunction_cntr = 0; -k.smallest_assertion_stats.unique_variables = 1; -k.smallest_assertion_stats.variable_cntr = 1; -k.smallest_literal_stats.abs_cntr = 0; -k.smallest_literal_stats.addition_cntr = 0; -k.smallest_literal_stats.conjunction_cntr = 0; -k.smallest_literal_stats.constant_cntr = 1; -k.smallest_literal_stats.disjunction_cntr = 0; -k.smallest_literal_stats.division_cntr = 0; -k.smallest_literal_stats.equalto_cntr = 0; -k.smallest_literal_stats.exp_cntr = 0; -k.smallest_literal_stats.false_cntr = 0; -k.smallest_literal_stats.forall_cntr = 0; -k.smallest_literal_stats.ifthenelse_cntr = 0; -k.smallest_literal_stats.inequality_cntr = 1; -k.smallest_literal_stats.log_cntr = 0; -k.smallest_literal_stats.max_cntr = 0; -k.smallest_literal_stats.min_cntr = 0; -k.smallest_literal_stats.multiplication_cntr = 0; -k.smallest_literal_stats.negation_cntr = 0; -k.smallest_literal_stats.notequalto_cntr = 0; -k.smallest_literal_stats.pow_cntr = 0; -k.smallest_literal_stats.realconstant_cntr = 0; -k.smallest_literal_stats.sqrt_cntr = 0; -k.smallest_literal_stats.trigonometry_cntr = 0; -k.smallest_literal_stats.true_cntr = 0; -k.smallest_literal_stats.uninterpretedfunction_cntr = 0; -k.smallest_literal_stats.unique_variables = 1; -k.smallest_literal_stats.variable_cntr = 1; -k.theory_checksat_ms = 2.67265; -expected_value = 0.9977925501127247; -calculated_value = PatternMatchingHeuristic::calculate(k); -std::cout << "Trial 3075: C++/Python neural inference delta = " << expected_value - calculated_value << std::endl; -EXPECT_NEAR(calculated_value, expected_value, 0.001); - -k.assertions_size = 1973; -k.assertions_stats.abs_cntr = 0; -k.assertions_stats.addition_cntr = 902; -k.assertions_stats.conjunction_cntr = 1973; -k.assertions_stats.constant_cntr = 1497; -k.assertions_stats.disjunction_cntr = 0; -k.assertions_stats.division_cntr = 0; -k.assertions_stats.equalto_cntr = 1159; -k.assertions_stats.exp_cntr = 0; -k.assertions_stats.false_cntr = 0; -k.assertions_stats.forall_cntr = 0; -k.assertions_stats.ifthenelse_cntr = 0; -k.assertions_stats.inequality_cntr = 814; -k.assertions_stats.log_cntr = 0; -k.assertions_stats.max_cntr = 0; -k.assertions_stats.min_cntr = 0; -k.assertions_stats.multiplication_cntr = 464; -k.assertions_stats.negation_cntr = 458; -k.assertions_stats.notequalto_cntr = 0; -k.assertions_stats.pow_cntr = 46; -k.assertions_stats.realconstant_cntr = 0; -k.assertions_stats.sqrt_cntr = 0; -k.assertions_stats.trigonometry_cntr = 0; -k.assertions_stats.true_cntr = 0; -k.assertions_stats.uninterpretedfunction_cntr = 0; -k.assertions_stats.unique_variables = 1031; -k.assertions_stats.variable_cntr = 3506; -k.biggest_assertion_stats.abs_cntr = 0; -k.biggest_assertion_stats.addition_cntr = 2; -k.biggest_assertion_stats.conjunction_cntr = 0; -k.biggest_assertion_stats.constant_cntr = 0; -k.biggest_assertion_stats.disjunction_cntr = 0; -k.biggest_assertion_stats.division_cntr = 0; -k.biggest_assertion_stats.equalto_cntr = 1; -k.biggest_assertion_stats.exp_cntr = 0; -k.biggest_assertion_stats.false_cntr = 0; -k.biggest_assertion_stats.forall_cntr = 0; -k.biggest_assertion_stats.ifthenelse_cntr = 0; -k.biggest_assertion_stats.inequality_cntr = 0; -k.biggest_assertion_stats.log_cntr = 0; -k.biggest_assertion_stats.max_cntr = 0; -k.biggest_assertion_stats.min_cntr = 0; -k.biggest_assertion_stats.multiplication_cntr = 0; -k.biggest_assertion_stats.negation_cntr = 0; -k.biggest_assertion_stats.notequalto_cntr = 0; -k.biggest_assertion_stats.pow_cntr = 0; -k.biggest_assertion_stats.realconstant_cntr = 0; -k.biggest_assertion_stats.sqrt_cntr = 0; -k.biggest_assertion_stats.trigonometry_cntr = 0; -k.biggest_assertion_stats.true_cntr = 0; -k.biggest_assertion_stats.uninterpretedfunction_cntr = 0; -k.biggest_assertion_stats.unique_variables = 3; -k.biggest_assertion_stats.variable_cntr = 3; -k.biggest_literal_stats.abs_cntr = 0; -k.biggest_literal_stats.addition_cntr = 0; -k.biggest_literal_stats.conjunction_cntr = 0; -k.biggest_literal_stats.constant_cntr = 1; -k.biggest_literal_stats.disjunction_cntr = 0; -k.biggest_literal_stats.division_cntr = 0; -k.biggest_literal_stats.equalto_cntr = 0; -k.biggest_literal_stats.exp_cntr = 0; -k.biggest_literal_stats.false_cntr = 0; -k.biggest_literal_stats.forall_cntr = 0; -k.biggest_literal_stats.ifthenelse_cntr = 0; -k.biggest_literal_stats.inequality_cntr = 1; -k.biggest_literal_stats.log_cntr = 0; -k.biggest_literal_stats.max_cntr = 0; -k.biggest_literal_stats.min_cntr = 0; -k.biggest_literal_stats.multiplication_cntr = 0; -k.biggest_literal_stats.negation_cntr = 0; -k.biggest_literal_stats.notequalto_cntr = 0; -k.biggest_literal_stats.pow_cntr = 0; -k.biggest_literal_stats.realconstant_cntr = 0; -k.biggest_literal_stats.sqrt_cntr = 0; -k.biggest_literal_stats.trigonometry_cntr = 0; -k.biggest_literal_stats.true_cntr = 0; -k.biggest_literal_stats.uninterpretedfunction_cntr = 0; -k.biggest_literal_stats.unique_variables = 1; -k.biggest_literal_stats.variable_cntr = 1; -k.box_boolean_count = 5389; -k.box_continuous_count = 1031; -k.box_integer_count = 0; -k.lemma_size = 3; -k.middle_assertion_stats.abs_cntr = 0; -k.middle_assertion_stats.addition_cntr = 0; -k.middle_assertion_stats.conjunction_cntr = 0; -k.middle_assertion_stats.constant_cntr = 1; -k.middle_assertion_stats.disjunction_cntr = 0; -k.middle_assertion_stats.division_cntr = 0; -k.middle_assertion_stats.equalto_cntr = 1; -k.middle_assertion_stats.exp_cntr = 0; -k.middle_assertion_stats.false_cntr = 0; -k.middle_assertion_stats.forall_cntr = 0; -k.middle_assertion_stats.ifthenelse_cntr = 0; -k.middle_assertion_stats.inequality_cntr = 0; -k.middle_assertion_stats.log_cntr = 0; -k.middle_assertion_stats.max_cntr = 0; -k.middle_assertion_stats.min_cntr = 0; -k.middle_assertion_stats.multiplication_cntr = 0; -k.middle_assertion_stats.negation_cntr = 1; -k.middle_assertion_stats.notequalto_cntr = 0; -k.middle_assertion_stats.pow_cntr = 0; -k.middle_assertion_stats.realconstant_cntr = 0; -k.middle_assertion_stats.sqrt_cntr = 0; -k.middle_assertion_stats.trigonometry_cntr = 0; -k.middle_assertion_stats.true_cntr = 0; -k.middle_assertion_stats.uninterpretedfunction_cntr = 0; -k.middle_assertion_stats.unique_variables = 1; -k.middle_assertion_stats.variable_cntr = 1; -k.middle_literal_stats.abs_cntr = 0; -k.middle_literal_stats.addition_cntr = 0; -k.middle_literal_stats.conjunction_cntr = 0; -k.middle_literal_stats.constant_cntr = 1; -k.middle_literal_stats.disjunction_cntr = 0; -k.middle_literal_stats.division_cntr = 0; -k.middle_literal_stats.equalto_cntr = 0; -k.middle_literal_stats.exp_cntr = 0; -k.middle_literal_stats.false_cntr = 0; -k.middle_literal_stats.forall_cntr = 0; -k.middle_literal_stats.ifthenelse_cntr = 0; -k.middle_literal_stats.inequality_cntr = 1; -k.middle_literal_stats.log_cntr = 0; -k.middle_literal_stats.max_cntr = 0; -k.middle_literal_stats.min_cntr = 0; -k.middle_literal_stats.multiplication_cntr = 0; -k.middle_literal_stats.negation_cntr = 0; -k.middle_literal_stats.notequalto_cntr = 0; -k.middle_literal_stats.pow_cntr = 0; -k.middle_literal_stats.realconstant_cntr = 0; -k.middle_literal_stats.sqrt_cntr = 0; -k.middle_literal_stats.trigonometry_cntr = 0; -k.middle_literal_stats.true_cntr = 0; -k.middle_literal_stats.uninterpretedfunction_cntr = 0; -k.middle_literal_stats.unique_variables = 1; -k.middle_literal_stats.variable_cntr = 1; -k.smallest_assertion_stats.abs_cntr = 0; -k.smallest_assertion_stats.addition_cntr = 0; -k.smallest_assertion_stats.conjunction_cntr = 0; -k.smallest_assertion_stats.constant_cntr = 1; -k.smallest_assertion_stats.disjunction_cntr = 0; -k.smallest_assertion_stats.division_cntr = 0; -k.smallest_assertion_stats.equalto_cntr = 0; -k.smallest_assertion_stats.exp_cntr = 0; -k.smallest_assertion_stats.false_cntr = 0; -k.smallest_assertion_stats.forall_cntr = 0; -k.smallest_assertion_stats.ifthenelse_cntr = 0; -k.smallest_assertion_stats.inequality_cntr = 1; -k.smallest_assertion_stats.log_cntr = 0; -k.smallest_assertion_stats.max_cntr = 0; -k.smallest_assertion_stats.min_cntr = 0; -k.smallest_assertion_stats.multiplication_cntr = 0; -k.smallest_assertion_stats.negation_cntr = 1; -k.smallest_assertion_stats.notequalto_cntr = 0; -k.smallest_assertion_stats.pow_cntr = 0; -k.smallest_assertion_stats.realconstant_cntr = 0; -k.smallest_assertion_stats.sqrt_cntr = 0; -k.smallest_assertion_stats.trigonometry_cntr = 0; -k.smallest_assertion_stats.true_cntr = 0; -k.smallest_assertion_stats.uninterpretedfunction_cntr = 0; -k.smallest_assertion_stats.unique_variables = 1; -k.smallest_assertion_stats.variable_cntr = 1; -k.smallest_literal_stats.abs_cntr = 0; -k.smallest_literal_stats.addition_cntr = 0; -k.smallest_literal_stats.conjunction_cntr = 0; -k.smallest_literal_stats.constant_cntr = 1; -k.smallest_literal_stats.disjunction_cntr = 0; -k.smallest_literal_stats.division_cntr = 0; -k.smallest_literal_stats.equalto_cntr = 0; -k.smallest_literal_stats.exp_cntr = 0; -k.smallest_literal_stats.false_cntr = 0; -k.smallest_literal_stats.forall_cntr = 0; -k.smallest_literal_stats.ifthenelse_cntr = 0; -k.smallest_literal_stats.inequality_cntr = 1; -k.smallest_literal_stats.log_cntr = 0; -k.smallest_literal_stats.max_cntr = 0; -k.smallest_literal_stats.min_cntr = 0; -k.smallest_literal_stats.multiplication_cntr = 0; -k.smallest_literal_stats.negation_cntr = 1; -k.smallest_literal_stats.notequalto_cntr = 0; -k.smallest_literal_stats.pow_cntr = 0; -k.smallest_literal_stats.realconstant_cntr = 0; -k.smallest_literal_stats.sqrt_cntr = 0; -k.smallest_literal_stats.trigonometry_cntr = 0; -k.smallest_literal_stats.true_cntr = 0; -k.smallest_literal_stats.uninterpretedfunction_cntr = 0; -k.smallest_literal_stats.unique_variables = 1; -k.smallest_literal_stats.variable_cntr = 1; -k.theory_checksat_ms = 0.275559; -expected_value = 0.7479350195180026; -calculated_value = PatternMatchingHeuristic::calculate(k); -std::cout << "Trial 1425: C++/Python neural inference delta = " << expected_value - calculated_value << std::endl; -EXPECT_NEAR(calculated_value, expected_value, 0.001); - -k.assertions_size = 1890; -k.assertions_stats.abs_cntr = 0; -k.assertions_stats.addition_cntr = 822; -k.assertions_stats.conjunction_cntr = 1890; -k.assertions_stats.constant_cntr = 1435; -k.assertions_stats.disjunction_cntr = 0; -k.assertions_stats.division_cntr = 0; -k.assertions_stats.equalto_cntr = 1101; -k.assertions_stats.exp_cntr = 0; -k.assertions_stats.false_cntr = 0; -k.assertions_stats.forall_cntr = 0; -k.assertions_stats.ifthenelse_cntr = 0; -k.assertions_stats.inequality_cntr = 789; -k.assertions_stats.log_cntr = 0; -k.assertions_stats.max_cntr = 0; -k.assertions_stats.min_cntr = 0; -k.assertions_stats.multiplication_cntr = 490; -k.assertions_stats.negation_cntr = 624; -k.assertions_stats.notequalto_cntr = 0; -k.assertions_stats.pow_cntr = 42; -k.assertions_stats.realconstant_cntr = 0; -k.assertions_stats.sqrt_cntr = 0; -k.assertions_stats.trigonometry_cntr = 0; -k.assertions_stats.true_cntr = 0; -k.assertions_stats.uninterpretedfunction_cntr = 0; -k.assertions_stats.unique_variables = 985; -k.assertions_stats.variable_cntr = 3398; -k.biggest_assertion_stats.abs_cntr = 0; -k.biggest_assertion_stats.addition_cntr = 2; -k.biggest_assertion_stats.conjunction_cntr = 0; -k.biggest_assertion_stats.constant_cntr = 0; -k.biggest_assertion_stats.disjunction_cntr = 0; -k.biggest_assertion_stats.division_cntr = 0; -k.biggest_assertion_stats.equalto_cntr = 1; -k.biggest_assertion_stats.exp_cntr = 0; -k.biggest_assertion_stats.false_cntr = 0; -k.biggest_assertion_stats.forall_cntr = 0; -k.biggest_assertion_stats.ifthenelse_cntr = 0; -k.biggest_assertion_stats.inequality_cntr = 0; -k.biggest_assertion_stats.log_cntr = 0; -k.biggest_assertion_stats.max_cntr = 0; -k.biggest_assertion_stats.min_cntr = 0; -k.biggest_assertion_stats.multiplication_cntr = 0; -k.biggest_assertion_stats.negation_cntr = 0; -k.biggest_assertion_stats.notequalto_cntr = 0; -k.biggest_assertion_stats.pow_cntr = 0; -k.biggest_assertion_stats.realconstant_cntr = 0; -k.biggest_assertion_stats.sqrt_cntr = 0; -k.biggest_assertion_stats.trigonometry_cntr = 0; -k.biggest_assertion_stats.true_cntr = 0; -k.biggest_assertion_stats.uninterpretedfunction_cntr = 0; -k.biggest_assertion_stats.unique_variables = 3; -k.biggest_assertion_stats.variable_cntr = 3; -k.biggest_literal_stats.abs_cntr = 0; -k.biggest_literal_stats.addition_cntr = 0; -k.biggest_literal_stats.conjunction_cntr = 0; -k.biggest_literal_stats.constant_cntr = 1; -k.biggest_literal_stats.disjunction_cntr = 0; -k.biggest_literal_stats.division_cntr = 0; -k.biggest_literal_stats.equalto_cntr = 1; -k.biggest_literal_stats.exp_cntr = 0; -k.biggest_literal_stats.false_cntr = 0; -k.biggest_literal_stats.forall_cntr = 0; -k.biggest_literal_stats.ifthenelse_cntr = 0; -k.biggest_literal_stats.inequality_cntr = 0; -k.biggest_literal_stats.log_cntr = 0; -k.biggest_literal_stats.max_cntr = 0; -k.biggest_literal_stats.min_cntr = 0; -k.biggest_literal_stats.multiplication_cntr = 0; -k.biggest_literal_stats.negation_cntr = 0; -k.biggest_literal_stats.notequalto_cntr = 0; -k.biggest_literal_stats.pow_cntr = 0; -k.biggest_literal_stats.realconstant_cntr = 0; -k.biggest_literal_stats.sqrt_cntr = 0; -k.biggest_literal_stats.trigonometry_cntr = 0; -k.biggest_literal_stats.true_cntr = 0; -k.biggest_literal_stats.uninterpretedfunction_cntr = 0; -k.biggest_literal_stats.unique_variables = 1; -k.biggest_literal_stats.variable_cntr = 1; -k.box_boolean_count = 5232; -k.box_continuous_count = 985; -k.box_integer_count = 0; -k.lemma_size = 2; -k.middle_assertion_stats.abs_cntr = 0; -k.middle_assertion_stats.addition_cntr = 0; -k.middle_assertion_stats.conjunction_cntr = 0; -k.middle_assertion_stats.constant_cntr = 1; -k.middle_assertion_stats.disjunction_cntr = 0; -k.middle_assertion_stats.division_cntr = 0; -k.middle_assertion_stats.equalto_cntr = 1; -k.middle_assertion_stats.exp_cntr = 0; -k.middle_assertion_stats.false_cntr = 0; -k.middle_assertion_stats.forall_cntr = 0; -k.middle_assertion_stats.ifthenelse_cntr = 0; -k.middle_assertion_stats.inequality_cntr = 0; -k.middle_assertion_stats.log_cntr = 0; -k.middle_assertion_stats.max_cntr = 0; -k.middle_assertion_stats.min_cntr = 0; -k.middle_assertion_stats.multiplication_cntr = 0; -k.middle_assertion_stats.negation_cntr = 0; -k.middle_assertion_stats.notequalto_cntr = 0; -k.middle_assertion_stats.pow_cntr = 1; -k.middle_assertion_stats.realconstant_cntr = 0; -k.middle_assertion_stats.sqrt_cntr = 0; -k.middle_assertion_stats.trigonometry_cntr = 0; -k.middle_assertion_stats.true_cntr = 0; -k.middle_assertion_stats.uninterpretedfunction_cntr = 0; -k.middle_assertion_stats.unique_variables = 2; -k.middle_assertion_stats.variable_cntr = 2; -k.middle_literal_stats.abs_cntr = 0; -k.middle_literal_stats.addition_cntr = 0; -k.middle_literal_stats.conjunction_cntr = 0; -k.middle_literal_stats.constant_cntr = 1; -k.middle_literal_stats.disjunction_cntr = 0; -k.middle_literal_stats.division_cntr = 0; -k.middle_literal_stats.equalto_cntr = 0; -k.middle_literal_stats.exp_cntr = 0; -k.middle_literal_stats.false_cntr = 0; -k.middle_literal_stats.forall_cntr = 0; -k.middle_literal_stats.ifthenelse_cntr = 0; -k.middle_literal_stats.inequality_cntr = 1; -k.middle_literal_stats.log_cntr = 0; -k.middle_literal_stats.max_cntr = 0; -k.middle_literal_stats.min_cntr = 0; -k.middle_literal_stats.multiplication_cntr = 0; -k.middle_literal_stats.negation_cntr = 1; -k.middle_literal_stats.notequalto_cntr = 0; -k.middle_literal_stats.pow_cntr = 0; -k.middle_literal_stats.realconstant_cntr = 0; -k.middle_literal_stats.sqrt_cntr = 0; -k.middle_literal_stats.trigonometry_cntr = 0; -k.middle_literal_stats.true_cntr = 0; -k.middle_literal_stats.uninterpretedfunction_cntr = 0; -k.middle_literal_stats.unique_variables = 1; -k.middle_literal_stats.variable_cntr = 1; -k.smallest_assertion_stats.abs_cntr = 0; -k.smallest_assertion_stats.addition_cntr = 0; -k.smallest_assertion_stats.conjunction_cntr = 0; -k.smallest_assertion_stats.constant_cntr = 1; -k.smallest_assertion_stats.disjunction_cntr = 0; -k.smallest_assertion_stats.division_cntr = 0; -k.smallest_assertion_stats.equalto_cntr = 0; -k.smallest_assertion_stats.exp_cntr = 0; -k.smallest_assertion_stats.false_cntr = 0; -k.smallest_assertion_stats.forall_cntr = 0; -k.smallest_assertion_stats.ifthenelse_cntr = 0; -k.smallest_assertion_stats.inequality_cntr = 1; -k.smallest_assertion_stats.log_cntr = 0; -k.smallest_assertion_stats.max_cntr = 0; -k.smallest_assertion_stats.min_cntr = 0; -k.smallest_assertion_stats.multiplication_cntr = 0; -k.smallest_assertion_stats.negation_cntr = 1; -k.smallest_assertion_stats.notequalto_cntr = 0; -k.smallest_assertion_stats.pow_cntr = 0; -k.smallest_assertion_stats.realconstant_cntr = 0; -k.smallest_assertion_stats.sqrt_cntr = 0; -k.smallest_assertion_stats.trigonometry_cntr = 0; -k.smallest_assertion_stats.true_cntr = 0; -k.smallest_assertion_stats.uninterpretedfunction_cntr = 0; -k.smallest_assertion_stats.unique_variables = 1; -k.smallest_assertion_stats.variable_cntr = 1; -k.smallest_literal_stats.abs_cntr = 0; -k.smallest_literal_stats.addition_cntr = 0; -k.smallest_literal_stats.conjunction_cntr = 0; -k.smallest_literal_stats.constant_cntr = 1; -k.smallest_literal_stats.disjunction_cntr = 0; -k.smallest_literal_stats.division_cntr = 0; -k.smallest_literal_stats.equalto_cntr = 0; -k.smallest_literal_stats.exp_cntr = 0; -k.smallest_literal_stats.false_cntr = 0; -k.smallest_literal_stats.forall_cntr = 0; -k.smallest_literal_stats.ifthenelse_cntr = 0; -k.smallest_literal_stats.inequality_cntr = 1; -k.smallest_literal_stats.log_cntr = 0; -k.smallest_literal_stats.max_cntr = 0; -k.smallest_literal_stats.min_cntr = 0; -k.smallest_literal_stats.multiplication_cntr = 0; -k.smallest_literal_stats.negation_cntr = 1; -k.smallest_literal_stats.notequalto_cntr = 0; -k.smallest_literal_stats.pow_cntr = 0; -k.smallest_literal_stats.realconstant_cntr = 0; -k.smallest_literal_stats.sqrt_cntr = 0; -k.smallest_literal_stats.trigonometry_cntr = 0; -k.smallest_literal_stats.true_cntr = 0; -k.smallest_literal_stats.uninterpretedfunction_cntr = 0; -k.smallest_literal_stats.unique_variables = 1; -k.smallest_literal_stats.variable_cntr = 1; -k.theory_checksat_ms = 0.230767; -expected_value = 0.9433754178507163; -calculated_value = PatternMatchingHeuristic::calculate(k); -std::cout << "Trial 188: C++/Python neural inference delta = " << expected_value - calculated_value << std::endl; -EXPECT_NEAR(calculated_value, expected_value, 0.001); - -k.assertions_size = 816; -k.assertions_stats.abs_cntr = 0; -k.assertions_stats.addition_cntr = 342; -k.assertions_stats.conjunction_cntr = 816; -k.assertions_stats.constant_cntr = 631; -k.assertions_stats.disjunction_cntr = 0; -k.assertions_stats.division_cntr = 0; -k.assertions_stats.equalto_cntr = 465; -k.assertions_stats.exp_cntr = 0; -k.assertions_stats.false_cntr = 0; -k.assertions_stats.forall_cntr = 0; -k.assertions_stats.ifthenelse_cntr = 0; -k.assertions_stats.inequality_cntr = 351; -k.assertions_stats.log_cntr = 0; -k.assertions_stats.max_cntr = 0; -k.assertions_stats.min_cntr = 0; -k.assertions_stats.multiplication_cntr = 214; -k.assertions_stats.negation_cntr = 207; -k.assertions_stats.notequalto_cntr = 0; -k.assertions_stats.pow_cntr = 18; -k.assertions_stats.realconstant_cntr = 0; -k.assertions_stats.sqrt_cntr = 0; -k.assertions_stats.trigonometry_cntr = 0; -k.assertions_stats.true_cntr = 0; -k.assertions_stats.uninterpretedfunction_cntr = 0; -k.assertions_stats.unique_variables = 421; -k.assertions_stats.variable_cntr = 1454; -k.biggest_assertion_stats.abs_cntr = 0; -k.biggest_assertion_stats.addition_cntr = 2; -k.biggest_assertion_stats.conjunction_cntr = 0; -k.biggest_assertion_stats.constant_cntr = 0; -k.biggest_assertion_stats.disjunction_cntr = 0; -k.biggest_assertion_stats.division_cntr = 0; -k.biggest_assertion_stats.equalto_cntr = 1; -k.biggest_assertion_stats.exp_cntr = 0; -k.biggest_assertion_stats.false_cntr = 0; -k.biggest_assertion_stats.forall_cntr = 0; -k.biggest_assertion_stats.ifthenelse_cntr = 0; -k.biggest_assertion_stats.inequality_cntr = 0; -k.biggest_assertion_stats.log_cntr = 0; -k.biggest_assertion_stats.max_cntr = 0; -k.biggest_assertion_stats.min_cntr = 0; -k.biggest_assertion_stats.multiplication_cntr = 0; -k.biggest_assertion_stats.negation_cntr = 0; -k.biggest_assertion_stats.notequalto_cntr = 0; -k.biggest_assertion_stats.pow_cntr = 0; -k.biggest_assertion_stats.realconstant_cntr = 0; -k.biggest_assertion_stats.sqrt_cntr = 0; -k.biggest_assertion_stats.trigonometry_cntr = 0; -k.biggest_assertion_stats.true_cntr = 0; -k.biggest_assertion_stats.uninterpretedfunction_cntr = 0; -k.biggest_assertion_stats.unique_variables = 3; -k.biggest_assertion_stats.variable_cntr = 3; -k.biggest_literal_stats.abs_cntr = 0; -k.biggest_literal_stats.addition_cntr = 0; -k.biggest_literal_stats.conjunction_cntr = 0; -k.biggest_literal_stats.constant_cntr = 1; -k.biggest_literal_stats.disjunction_cntr = 0; -k.biggest_literal_stats.division_cntr = 0; -k.biggest_literal_stats.equalto_cntr = 1; -k.biggest_literal_stats.exp_cntr = 0; -k.biggest_literal_stats.false_cntr = 0; -k.biggest_literal_stats.forall_cntr = 0; -k.biggest_literal_stats.ifthenelse_cntr = 0; -k.biggest_literal_stats.inequality_cntr = 0; -k.biggest_literal_stats.log_cntr = 0; -k.biggest_literal_stats.max_cntr = 0; -k.biggest_literal_stats.min_cntr = 0; -k.biggest_literal_stats.multiplication_cntr = 0; -k.biggest_literal_stats.negation_cntr = 0; -k.biggest_literal_stats.notequalto_cntr = 0; -k.biggest_literal_stats.pow_cntr = 0; -k.biggest_literal_stats.realconstant_cntr = 0; -k.biggest_literal_stats.sqrt_cntr = 0; -k.biggest_literal_stats.trigonometry_cntr = 0; -k.biggest_literal_stats.true_cntr = 0; -k.biggest_literal_stats.uninterpretedfunction_cntr = 0; -k.biggest_literal_stats.unique_variables = 1; -k.biggest_literal_stats.variable_cntr = 1; -k.box_boolean_count = 2274; -k.box_continuous_count = 421; -k.box_integer_count = 0; -k.lemma_size = 2; -k.middle_assertion_stats.abs_cntr = 0; -k.middle_assertion_stats.addition_cntr = 0; -k.middle_assertion_stats.conjunction_cntr = 0; -k.middle_assertion_stats.constant_cntr = 1; -k.middle_assertion_stats.disjunction_cntr = 0; -k.middle_assertion_stats.division_cntr = 0; -k.middle_assertion_stats.equalto_cntr = 1; -k.middle_assertion_stats.exp_cntr = 0; -k.middle_assertion_stats.false_cntr = 0; -k.middle_assertion_stats.forall_cntr = 0; -k.middle_assertion_stats.ifthenelse_cntr = 0; -k.middle_assertion_stats.inequality_cntr = 0; -k.middle_assertion_stats.log_cntr = 0; -k.middle_assertion_stats.max_cntr = 0; -k.middle_assertion_stats.min_cntr = 0; -k.middle_assertion_stats.multiplication_cntr = 1; -k.middle_assertion_stats.negation_cntr = 0; -k.middle_assertion_stats.notequalto_cntr = 0; -k.middle_assertion_stats.pow_cntr = 0; -k.middle_assertion_stats.realconstant_cntr = 0; -k.middle_assertion_stats.sqrt_cntr = 0; -k.middle_assertion_stats.trigonometry_cntr = 0; -k.middle_assertion_stats.true_cntr = 0; -k.middle_assertion_stats.uninterpretedfunction_cntr = 0; -k.middle_assertion_stats.unique_variables = 2; -k.middle_assertion_stats.variable_cntr = 2; -k.middle_literal_stats.abs_cntr = 0; -k.middle_literal_stats.addition_cntr = 0; -k.middle_literal_stats.conjunction_cntr = 0; -k.middle_literal_stats.constant_cntr = 1; -k.middle_literal_stats.disjunction_cntr = 0; -k.middle_literal_stats.division_cntr = 0; -k.middle_literal_stats.equalto_cntr = 0; -k.middle_literal_stats.exp_cntr = 0; -k.middle_literal_stats.false_cntr = 0; -k.middle_literal_stats.forall_cntr = 0; -k.middle_literal_stats.ifthenelse_cntr = 0; -k.middle_literal_stats.inequality_cntr = 1; -k.middle_literal_stats.log_cntr = 0; -k.middle_literal_stats.max_cntr = 0; -k.middle_literal_stats.min_cntr = 0; -k.middle_literal_stats.multiplication_cntr = 0; -k.middle_literal_stats.negation_cntr = 0; -k.middle_literal_stats.notequalto_cntr = 0; -k.middle_literal_stats.pow_cntr = 0; -k.middle_literal_stats.realconstant_cntr = 0; -k.middle_literal_stats.sqrt_cntr = 0; -k.middle_literal_stats.trigonometry_cntr = 0; -k.middle_literal_stats.true_cntr = 0; -k.middle_literal_stats.uninterpretedfunction_cntr = 0; -k.middle_literal_stats.unique_variables = 1; -k.middle_literal_stats.variable_cntr = 1; -k.smallest_assertion_stats.abs_cntr = 0; -k.smallest_assertion_stats.addition_cntr = 0; -k.smallest_assertion_stats.conjunction_cntr = 0; -k.smallest_assertion_stats.constant_cntr = 1; -k.smallest_assertion_stats.disjunction_cntr = 0; -k.smallest_assertion_stats.division_cntr = 0; -k.smallest_assertion_stats.equalto_cntr = 0; -k.smallest_assertion_stats.exp_cntr = 0; -k.smallest_assertion_stats.false_cntr = 0; -k.smallest_assertion_stats.forall_cntr = 0; -k.smallest_assertion_stats.ifthenelse_cntr = 0; -k.smallest_assertion_stats.inequality_cntr = 1; -k.smallest_assertion_stats.log_cntr = 0; -k.smallest_assertion_stats.max_cntr = 0; -k.smallest_assertion_stats.min_cntr = 0; -k.smallest_assertion_stats.multiplication_cntr = 0; -k.smallest_assertion_stats.negation_cntr = 1; -k.smallest_assertion_stats.notequalto_cntr = 0; -k.smallest_assertion_stats.pow_cntr = 0; -k.smallest_assertion_stats.realconstant_cntr = 0; -k.smallest_assertion_stats.sqrt_cntr = 0; -k.smallest_assertion_stats.trigonometry_cntr = 0; -k.smallest_assertion_stats.true_cntr = 0; -k.smallest_assertion_stats.uninterpretedfunction_cntr = 0; -k.smallest_assertion_stats.unique_variables = 1; -k.smallest_assertion_stats.variable_cntr = 1; -k.smallest_literal_stats.abs_cntr = 0; -k.smallest_literal_stats.addition_cntr = 0; -k.smallest_literal_stats.conjunction_cntr = 0; -k.smallest_literal_stats.constant_cntr = 1; -k.smallest_literal_stats.disjunction_cntr = 0; -k.smallest_literal_stats.division_cntr = 0; -k.smallest_literal_stats.equalto_cntr = 0; -k.smallest_literal_stats.exp_cntr = 0; -k.smallest_literal_stats.false_cntr = 0; -k.smallest_literal_stats.forall_cntr = 0; -k.smallest_literal_stats.ifthenelse_cntr = 0; -k.smallest_literal_stats.inequality_cntr = 1; -k.smallest_literal_stats.log_cntr = 0; -k.smallest_literal_stats.max_cntr = 0; -k.smallest_literal_stats.min_cntr = 0; -k.smallest_literal_stats.multiplication_cntr = 0; -k.smallest_literal_stats.negation_cntr = 0; -k.smallest_literal_stats.notequalto_cntr = 0; -k.smallest_literal_stats.pow_cntr = 0; -k.smallest_literal_stats.realconstant_cntr = 0; -k.smallest_literal_stats.sqrt_cntr = 0; -k.smallest_literal_stats.trigonometry_cntr = 0; -k.smallest_literal_stats.true_cntr = 0; -k.smallest_literal_stats.uninterpretedfunction_cntr = 0; -k.smallest_literal_stats.unique_variables = 1; -k.smallest_literal_stats.variable_cntr = 1; -k.theory_checksat_ms = 1.70081; -expected_value = 0.9997769258614276; -calculated_value = PatternMatchingHeuristic::calculate(k); -std::cout << "Trial 16848: C++/Python neural inference delta = " << expected_value - calculated_value << std::endl; -EXPECT_NEAR(calculated_value, expected_value, 0.001); - -k.assertions_size = 2606; -k.assertions_stats.abs_cntr = 0; -k.assertions_stats.addition_cntr = 1142; -k.assertions_stats.conjunction_cntr = 2606; -k.assertions_stats.constant_cntr = 1971; -k.assertions_stats.disjunction_cntr = 0; -k.assertions_stats.division_cntr = 0; -k.assertions_stats.equalto_cntr = 1525; -k.assertions_stats.exp_cntr = 0; -k.assertions_stats.false_cntr = 0; -k.assertions_stats.forall_cntr = 0; -k.assertions_stats.ifthenelse_cntr = 0; -k.assertions_stats.inequality_cntr = 1081; -k.assertions_stats.log_cntr = 0; -k.assertions_stats.max_cntr = 0; -k.assertions_stats.min_cntr = 0; -k.assertions_stats.multiplication_cntr = 674; -k.assertions_stats.negation_cntr = 646; -k.assertions_stats.notequalto_cntr = 0; -k.assertions_stats.pow_cntr = 58; -k.assertions_stats.realconstant_cntr = 0; -k.assertions_stats.sqrt_cntr = 0; -k.assertions_stats.trigonometry_cntr = 0; -k.assertions_stats.true_cntr = 0; -k.assertions_stats.uninterpretedfunction_cntr = 0; -k.assertions_stats.unique_variables = 1361; -k.assertions_stats.variable_cntr = 4694; -k.biggest_assertion_stats.abs_cntr = 0; -k.biggest_assertion_stats.addition_cntr = 0; -k.biggest_assertion_stats.conjunction_cntr = 0; -k.biggest_assertion_stats.constant_cntr = 2; -k.biggest_assertion_stats.disjunction_cntr = 0; -k.biggest_assertion_stats.division_cntr = 0; -k.biggest_assertion_stats.equalto_cntr = 1; -k.biggest_assertion_stats.exp_cntr = 0; -k.biggest_assertion_stats.false_cntr = 0; -k.biggest_assertion_stats.forall_cntr = 0; -k.biggest_assertion_stats.ifthenelse_cntr = 0; -k.biggest_assertion_stats.inequality_cntr = 0; -k.biggest_assertion_stats.log_cntr = 0; -k.biggest_assertion_stats.max_cntr = 0; -k.biggest_assertion_stats.min_cntr = 0; -k.biggest_assertion_stats.multiplication_cntr = 2; -k.biggest_assertion_stats.negation_cntr = 0; -k.biggest_assertion_stats.notequalto_cntr = 0; -k.biggest_assertion_stats.pow_cntr = 0; -k.biggest_assertion_stats.realconstant_cntr = 0; -k.biggest_assertion_stats.sqrt_cntr = 0; -k.biggest_assertion_stats.trigonometry_cntr = 0; -k.biggest_assertion_stats.true_cntr = 0; -k.biggest_assertion_stats.uninterpretedfunction_cntr = 0; -k.biggest_assertion_stats.unique_variables = 3; -k.biggest_assertion_stats.variable_cntr = 3; -k.biggest_literal_stats.abs_cntr = 0; -k.biggest_literal_stats.addition_cntr = 0; -k.biggest_literal_stats.conjunction_cntr = 0; -k.biggest_literal_stats.constant_cntr = 1; -k.biggest_literal_stats.disjunction_cntr = 0; -k.biggest_literal_stats.division_cntr = 0; -k.biggest_literal_stats.equalto_cntr = 1; -k.biggest_literal_stats.exp_cntr = 0; -k.biggest_literal_stats.false_cntr = 0; -k.biggest_literal_stats.forall_cntr = 0; -k.biggest_literal_stats.ifthenelse_cntr = 0; -k.biggest_literal_stats.inequality_cntr = 0; -k.biggest_literal_stats.log_cntr = 0; -k.biggest_literal_stats.max_cntr = 0; -k.biggest_literal_stats.min_cntr = 0; -k.biggest_literal_stats.multiplication_cntr = 0; -k.biggest_literal_stats.negation_cntr = 0; -k.biggest_literal_stats.notequalto_cntr = 0; -k.biggest_literal_stats.pow_cntr = 0; -k.biggest_literal_stats.realconstant_cntr = 0; -k.biggest_literal_stats.sqrt_cntr = 0; -k.biggest_literal_stats.trigonometry_cntr = 0; -k.biggest_literal_stats.true_cntr = 0; -k.biggest_literal_stats.uninterpretedfunction_cntr = 0; -k.biggest_literal_stats.unique_variables = 1; -k.biggest_literal_stats.variable_cntr = 1; -k.box_boolean_count = 7204; -k.box_continuous_count = 1361; -k.box_integer_count = 0; -k.lemma_size = 3; -k.middle_assertion_stats.abs_cntr = 0; -k.middle_assertion_stats.addition_cntr = 0; -k.middle_assertion_stats.conjunction_cntr = 0; -k.middle_assertion_stats.constant_cntr = 1; -k.middle_assertion_stats.disjunction_cntr = 0; -k.middle_assertion_stats.division_cntr = 0; -k.middle_assertion_stats.equalto_cntr = 1; -k.middle_assertion_stats.exp_cntr = 0; -k.middle_assertion_stats.false_cntr = 0; -k.middle_assertion_stats.forall_cntr = 0; -k.middle_assertion_stats.ifthenelse_cntr = 0; -k.middle_assertion_stats.inequality_cntr = 0; -k.middle_assertion_stats.log_cntr = 0; -k.middle_assertion_stats.max_cntr = 0; -k.middle_assertion_stats.min_cntr = 0; -k.middle_assertion_stats.multiplication_cntr = 1; -k.middle_assertion_stats.negation_cntr = 0; -k.middle_assertion_stats.notequalto_cntr = 0; -k.middle_assertion_stats.pow_cntr = 0; -k.middle_assertion_stats.realconstant_cntr = 0; -k.middle_assertion_stats.sqrt_cntr = 0; -k.middle_assertion_stats.trigonometry_cntr = 0; -k.middle_assertion_stats.true_cntr = 0; -k.middle_assertion_stats.uninterpretedfunction_cntr = 0; -k.middle_assertion_stats.unique_variables = 2; -k.middle_assertion_stats.variable_cntr = 2; -k.middle_literal_stats.abs_cntr = 0; -k.middle_literal_stats.addition_cntr = 0; -k.middle_literal_stats.conjunction_cntr = 0; -k.middle_literal_stats.constant_cntr = 1; -k.middle_literal_stats.disjunction_cntr = 0; -k.middle_literal_stats.division_cntr = 0; -k.middle_literal_stats.equalto_cntr = 0; -k.middle_literal_stats.exp_cntr = 0; -k.middle_literal_stats.false_cntr = 0; -k.middle_literal_stats.forall_cntr = 0; -k.middle_literal_stats.ifthenelse_cntr = 0; -k.middle_literal_stats.inequality_cntr = 1; -k.middle_literal_stats.log_cntr = 0; -k.middle_literal_stats.max_cntr = 0; -k.middle_literal_stats.min_cntr = 0; -k.middle_literal_stats.multiplication_cntr = 0; -k.middle_literal_stats.negation_cntr = 0; -k.middle_literal_stats.notequalto_cntr = 0; -k.middle_literal_stats.pow_cntr = 0; -k.middle_literal_stats.realconstant_cntr = 0; -k.middle_literal_stats.sqrt_cntr = 0; -k.middle_literal_stats.trigonometry_cntr = 0; -k.middle_literal_stats.true_cntr = 0; -k.middle_literal_stats.uninterpretedfunction_cntr = 0; -k.middle_literal_stats.unique_variables = 1; -k.middle_literal_stats.variable_cntr = 1; -k.smallest_assertion_stats.abs_cntr = 0; -k.smallest_assertion_stats.addition_cntr = 0; -k.smallest_assertion_stats.conjunction_cntr = 0; -k.smallest_assertion_stats.constant_cntr = 1; -k.smallest_assertion_stats.disjunction_cntr = 0; -k.smallest_assertion_stats.division_cntr = 0; -k.smallest_assertion_stats.equalto_cntr = 0; -k.smallest_assertion_stats.exp_cntr = 0; -k.smallest_assertion_stats.false_cntr = 0; -k.smallest_assertion_stats.forall_cntr = 0; -k.smallest_assertion_stats.ifthenelse_cntr = 0; -k.smallest_assertion_stats.inequality_cntr = 1; -k.smallest_assertion_stats.log_cntr = 0; -k.smallest_assertion_stats.max_cntr = 0; -k.smallest_assertion_stats.min_cntr = 0; -k.smallest_assertion_stats.multiplication_cntr = 0; -k.smallest_assertion_stats.negation_cntr = 1; -k.smallest_assertion_stats.notequalto_cntr = 0; -k.smallest_assertion_stats.pow_cntr = 0; -k.smallest_assertion_stats.realconstant_cntr = 0; -k.smallest_assertion_stats.sqrt_cntr = 0; -k.smallest_assertion_stats.trigonometry_cntr = 0; -k.smallest_assertion_stats.true_cntr = 0; -k.smallest_assertion_stats.uninterpretedfunction_cntr = 0; -k.smallest_assertion_stats.unique_variables = 1; -k.smallest_assertion_stats.variable_cntr = 1; -k.smallest_literal_stats.abs_cntr = 0; -k.smallest_literal_stats.addition_cntr = 0; -k.smallest_literal_stats.conjunction_cntr = 0; -k.smallest_literal_stats.constant_cntr = 1; -k.smallest_literal_stats.disjunction_cntr = 0; -k.smallest_literal_stats.division_cntr = 0; -k.smallest_literal_stats.equalto_cntr = 0; -k.smallest_literal_stats.exp_cntr = 0; -k.smallest_literal_stats.false_cntr = 0; -k.smallest_literal_stats.forall_cntr = 0; -k.smallest_literal_stats.ifthenelse_cntr = 0; -k.smallest_literal_stats.inequality_cntr = 1; -k.smallest_literal_stats.log_cntr = 0; -k.smallest_literal_stats.max_cntr = 0; -k.smallest_literal_stats.min_cntr = 0; -k.smallest_literal_stats.multiplication_cntr = 0; -k.smallest_literal_stats.negation_cntr = 0; -k.smallest_literal_stats.notequalto_cntr = 0; -k.smallest_literal_stats.pow_cntr = 0; -k.smallest_literal_stats.realconstant_cntr = 0; -k.smallest_literal_stats.sqrt_cntr = 0; -k.smallest_literal_stats.trigonometry_cntr = 0; -k.smallest_literal_stats.true_cntr = 0; -k.smallest_literal_stats.uninterpretedfunction_cntr = 0; -k.smallest_literal_stats.unique_variables = 1; -k.smallest_literal_stats.variable_cntr = 1; -k.theory_checksat_ms = 0.87857; -expected_value = 0.9968641251090132; -calculated_value = PatternMatchingHeuristic::calculate(k); -std::cout << "Trial 14024: C++/Python neural inference delta = " << expected_value - calculated_value << std::endl; -EXPECT_NEAR(calculated_value, expected_value, 0.001); - -k.assertions_size = 1460; -k.assertions_stats.abs_cntr = 0; -k.assertions_stats.addition_cntr = 662; -k.assertions_stats.conjunction_cntr = 1460; -k.assertions_stats.constant_cntr = 1113; -k.assertions_stats.disjunction_cntr = 0; -k.assertions_stats.division_cntr = 0; -k.assertions_stats.equalto_cntr = 853; -k.assertions_stats.exp_cntr = 0; -k.assertions_stats.false_cntr = 0; -k.assertions_stats.forall_cntr = 0; -k.assertions_stats.ifthenelse_cntr = 0; -k.assertions_stats.inequality_cntr = 607; -k.assertions_stats.log_cntr = 0; -k.assertions_stats.max_cntr = 0; -k.assertions_stats.min_cntr = 0; -k.assertions_stats.multiplication_cntr = 344; -k.assertions_stats.negation_cntr = 341; -k.assertions_stats.notequalto_cntr = 0; -k.assertions_stats.pow_cntr = 34; -k.assertions_stats.realconstant_cntr = 0; -k.assertions_stats.sqrt_cntr = 0; -k.assertions_stats.trigonometry_cntr = 0; -k.assertions_stats.true_cntr = 0; -k.assertions_stats.uninterpretedfunction_cntr = 0; -k.assertions_stats.unique_variables = 761; -k.assertions_stats.variable_cntr = 2588; -k.biggest_assertion_stats.abs_cntr = 0; -k.biggest_assertion_stats.addition_cntr = 0; -k.biggest_assertion_stats.conjunction_cntr = 0; -k.biggest_assertion_stats.constant_cntr = 2; -k.biggest_assertion_stats.disjunction_cntr = 0; -k.biggest_assertion_stats.division_cntr = 0; -k.biggest_assertion_stats.equalto_cntr = 1; -k.biggest_assertion_stats.exp_cntr = 0; -k.biggest_assertion_stats.false_cntr = 0; -k.biggest_assertion_stats.forall_cntr = 0; -k.biggest_assertion_stats.ifthenelse_cntr = 0; -k.biggest_assertion_stats.inequality_cntr = 0; -k.biggest_assertion_stats.log_cntr = 0; -k.biggest_assertion_stats.max_cntr = 0; -k.biggest_assertion_stats.min_cntr = 0; -k.biggest_assertion_stats.multiplication_cntr = 2; -k.biggest_assertion_stats.negation_cntr = 0; -k.biggest_assertion_stats.notequalto_cntr = 0; -k.biggest_assertion_stats.pow_cntr = 0; -k.biggest_assertion_stats.realconstant_cntr = 0; -k.biggest_assertion_stats.sqrt_cntr = 0; -k.biggest_assertion_stats.trigonometry_cntr = 0; -k.biggest_assertion_stats.true_cntr = 0; -k.biggest_assertion_stats.uninterpretedfunction_cntr = 0; -k.biggest_assertion_stats.unique_variables = 3; -k.biggest_assertion_stats.variable_cntr = 3; -k.biggest_literal_stats.abs_cntr = 0; -k.biggest_literal_stats.addition_cntr = 0; -k.biggest_literal_stats.conjunction_cntr = 0; -k.biggest_literal_stats.constant_cntr = 1; -k.biggest_literal_stats.disjunction_cntr = 0; -k.biggest_literal_stats.division_cntr = 0; -k.biggest_literal_stats.equalto_cntr = 0; -k.biggest_literal_stats.exp_cntr = 0; -k.biggest_literal_stats.false_cntr = 0; -k.biggest_literal_stats.forall_cntr = 0; -k.biggest_literal_stats.ifthenelse_cntr = 0; -k.biggest_literal_stats.inequality_cntr = 1; -k.biggest_literal_stats.log_cntr = 0; -k.biggest_literal_stats.max_cntr = 0; -k.biggest_literal_stats.min_cntr = 0; -k.biggest_literal_stats.multiplication_cntr = 0; -k.biggest_literal_stats.negation_cntr = 0; -k.biggest_literal_stats.notequalto_cntr = 0; -k.biggest_literal_stats.pow_cntr = 0; -k.biggest_literal_stats.realconstant_cntr = 0; -k.biggest_literal_stats.sqrt_cntr = 0; -k.biggest_literal_stats.trigonometry_cntr = 0; -k.biggest_literal_stats.true_cntr = 0; -k.biggest_literal_stats.uninterpretedfunction_cntr = 0; -k.biggest_literal_stats.unique_variables = 1; -k.biggest_literal_stats.variable_cntr = 1; -k.box_boolean_count = 3994; -k.box_continuous_count = 761; -k.box_integer_count = 0; -k.lemma_size = 3; -k.middle_assertion_stats.abs_cntr = 0; -k.middle_assertion_stats.addition_cntr = 0; -k.middle_assertion_stats.conjunction_cntr = 0; -k.middle_assertion_stats.constant_cntr = 1; -k.middle_assertion_stats.disjunction_cntr = 0; -k.middle_assertion_stats.division_cntr = 0; -k.middle_assertion_stats.equalto_cntr = 0; -k.middle_assertion_stats.exp_cntr = 0; -k.middle_assertion_stats.false_cntr = 0; -k.middle_assertion_stats.forall_cntr = 0; -k.middle_assertion_stats.ifthenelse_cntr = 0; -k.middle_assertion_stats.inequality_cntr = 1; -k.middle_assertion_stats.log_cntr = 0; -k.middle_assertion_stats.max_cntr = 0; -k.middle_assertion_stats.min_cntr = 0; -k.middle_assertion_stats.multiplication_cntr = 0; -k.middle_assertion_stats.negation_cntr = 0; -k.middle_assertion_stats.notequalto_cntr = 0; -k.middle_assertion_stats.pow_cntr = 0; -k.middle_assertion_stats.realconstant_cntr = 0; -k.middle_assertion_stats.sqrt_cntr = 0; -k.middle_assertion_stats.trigonometry_cntr = 0; -k.middle_assertion_stats.true_cntr = 0; -k.middle_assertion_stats.uninterpretedfunction_cntr = 0; -k.middle_assertion_stats.unique_variables = 1; -k.middle_assertion_stats.variable_cntr = 1; -k.middle_literal_stats.abs_cntr = 0; -k.middle_literal_stats.addition_cntr = 0; -k.middle_literal_stats.conjunction_cntr = 0; -k.middle_literal_stats.constant_cntr = 1; -k.middle_literal_stats.disjunction_cntr = 0; -k.middle_literal_stats.division_cntr = 0; -k.middle_literal_stats.equalto_cntr = 0; -k.middle_literal_stats.exp_cntr = 0; -k.middle_literal_stats.false_cntr = 0; -k.middle_literal_stats.forall_cntr = 0; -k.middle_literal_stats.ifthenelse_cntr = 0; -k.middle_literal_stats.inequality_cntr = 1; -k.middle_literal_stats.log_cntr = 0; -k.middle_literal_stats.max_cntr = 0; -k.middle_literal_stats.min_cntr = 0; -k.middle_literal_stats.multiplication_cntr = 0; -k.middle_literal_stats.negation_cntr = 0; -k.middle_literal_stats.notequalto_cntr = 0; -k.middle_literal_stats.pow_cntr = 0; -k.middle_literal_stats.realconstant_cntr = 0; -k.middle_literal_stats.sqrt_cntr = 0; -k.middle_literal_stats.trigonometry_cntr = 0; -k.middle_literal_stats.true_cntr = 0; -k.middle_literal_stats.uninterpretedfunction_cntr = 0; -k.middle_literal_stats.unique_variables = 1; -k.middle_literal_stats.variable_cntr = 1; -k.smallest_assertion_stats.abs_cntr = 0; -k.smallest_assertion_stats.addition_cntr = 0; -k.smallest_assertion_stats.conjunction_cntr = 0; -k.smallest_assertion_stats.constant_cntr = 1; -k.smallest_assertion_stats.disjunction_cntr = 0; -k.smallest_assertion_stats.division_cntr = 0; -k.smallest_assertion_stats.equalto_cntr = 0; -k.smallest_assertion_stats.exp_cntr = 0; -k.smallest_assertion_stats.false_cntr = 0; -k.smallest_assertion_stats.forall_cntr = 0; -k.smallest_assertion_stats.ifthenelse_cntr = 0; -k.smallest_assertion_stats.inequality_cntr = 1; -k.smallest_assertion_stats.log_cntr = 0; -k.smallest_assertion_stats.max_cntr = 0; -k.smallest_assertion_stats.min_cntr = 0; -k.smallest_assertion_stats.multiplication_cntr = 0; -k.smallest_assertion_stats.negation_cntr = 1; -k.smallest_assertion_stats.notequalto_cntr = 0; -k.smallest_assertion_stats.pow_cntr = 0; -k.smallest_assertion_stats.realconstant_cntr = 0; -k.smallest_assertion_stats.sqrt_cntr = 0; -k.smallest_assertion_stats.trigonometry_cntr = 0; -k.smallest_assertion_stats.true_cntr = 0; -k.smallest_assertion_stats.uninterpretedfunction_cntr = 0; -k.smallest_assertion_stats.unique_variables = 1; -k.smallest_assertion_stats.variable_cntr = 1; -k.smallest_literal_stats.abs_cntr = 0; -k.smallest_literal_stats.addition_cntr = 0; -k.smallest_literal_stats.conjunction_cntr = 0; -k.smallest_literal_stats.constant_cntr = 1; -k.smallest_literal_stats.disjunction_cntr = 0; -k.smallest_literal_stats.division_cntr = 0; -k.smallest_literal_stats.equalto_cntr = 0; -k.smallest_literal_stats.exp_cntr = 0; -k.smallest_literal_stats.false_cntr = 0; -k.smallest_literal_stats.forall_cntr = 0; -k.smallest_literal_stats.ifthenelse_cntr = 0; -k.smallest_literal_stats.inequality_cntr = 1; -k.smallest_literal_stats.log_cntr = 0; -k.smallest_literal_stats.max_cntr = 0; -k.smallest_literal_stats.min_cntr = 0; -k.smallest_literal_stats.multiplication_cntr = 0; -k.smallest_literal_stats.negation_cntr = 0; -k.smallest_literal_stats.notequalto_cntr = 0; -k.smallest_literal_stats.pow_cntr = 0; -k.smallest_literal_stats.realconstant_cntr = 0; -k.smallest_literal_stats.sqrt_cntr = 0; -k.smallest_literal_stats.trigonometry_cntr = 0; -k.smallest_literal_stats.true_cntr = 0; -k.smallest_literal_stats.uninterpretedfunction_cntr = 0; -k.smallest_literal_stats.unique_variables = 1; -k.smallest_literal_stats.variable_cntr = 1; -k.theory_checksat_ms = 0.120065; -expected_value = 0.9508706440668288; -calculated_value = PatternMatchingHeuristic::calculate(k); -std::cout << "Trial 12967: C++/Python neural inference delta = " << expected_value - calculated_value << std::endl; -EXPECT_NEAR(calculated_value, expected_value, 0.001); - -k.assertions_size = 1626; -k.assertions_stats.abs_cntr = 0; -k.assertions_stats.addition_cntr = 822; -k.assertions_stats.conjunction_cntr = 1626; -k.assertions_stats.constant_cntr = 1193; -k.assertions_stats.disjunction_cntr = 0; -k.assertions_stats.division_cntr = 0; -k.assertions_stats.equalto_cntr = 1101; -k.assertions_stats.exp_cntr = 0; -k.assertions_stats.false_cntr = 0; -k.assertions_stats.forall_cntr = 0; -k.assertions_stats.ifthenelse_cntr = 0; -k.assertions_stats.inequality_cntr = 525; -k.assertions_stats.log_cntr = 0; -k.assertions_stats.max_cntr = 0; -k.assertions_stats.min_cntr = 0; -k.assertions_stats.multiplication_cntr = 490; -k.assertions_stats.negation_cntr = 285; -k.assertions_stats.notequalto_cntr = 0; -k.assertions_stats.pow_cntr = 42; -k.assertions_stats.realconstant_cntr = 0; -k.assertions_stats.sqrt_cntr = 0; -k.assertions_stats.trigonometry_cntr = 0; -k.assertions_stats.true_cntr = 0; -k.assertions_stats.uninterpretedfunction_cntr = 0; -k.assertions_stats.unique_variables = 985; -k.assertions_stats.variable_cntr = 3112; -k.biggest_assertion_stats.abs_cntr = 0; -k.biggest_assertion_stats.addition_cntr = 2; -k.biggest_assertion_stats.conjunction_cntr = 0; -k.biggest_assertion_stats.constant_cntr = 0; -k.biggest_assertion_stats.disjunction_cntr = 0; -k.biggest_assertion_stats.division_cntr = 0; -k.biggest_assertion_stats.equalto_cntr = 1; -k.biggest_assertion_stats.exp_cntr = 0; -k.biggest_assertion_stats.false_cntr = 0; -k.biggest_assertion_stats.forall_cntr = 0; -k.biggest_assertion_stats.ifthenelse_cntr = 0; -k.biggest_assertion_stats.inequality_cntr = 0; -k.biggest_assertion_stats.log_cntr = 0; -k.biggest_assertion_stats.max_cntr = 0; -k.biggest_assertion_stats.min_cntr = 0; -k.biggest_assertion_stats.multiplication_cntr = 0; -k.biggest_assertion_stats.negation_cntr = 0; -k.biggest_assertion_stats.notequalto_cntr = 0; -k.biggest_assertion_stats.pow_cntr = 0; -k.biggest_assertion_stats.realconstant_cntr = 0; -k.biggest_assertion_stats.sqrt_cntr = 0; -k.biggest_assertion_stats.trigonometry_cntr = 0; -k.biggest_assertion_stats.true_cntr = 0; -k.biggest_assertion_stats.uninterpretedfunction_cntr = 0; -k.biggest_assertion_stats.unique_variables = 3; -k.biggest_assertion_stats.variable_cntr = 3; -k.biggest_literal_stats.abs_cntr = 0; -k.biggest_literal_stats.addition_cntr = 0; -k.biggest_literal_stats.conjunction_cntr = 0; -k.biggest_literal_stats.constant_cntr = 1; -k.biggest_literal_stats.disjunction_cntr = 0; -k.biggest_literal_stats.division_cntr = 0; -k.biggest_literal_stats.equalto_cntr = 0; -k.biggest_literal_stats.exp_cntr = 0; -k.biggest_literal_stats.false_cntr = 0; -k.biggest_literal_stats.forall_cntr = 0; -k.biggest_literal_stats.ifthenelse_cntr = 0; -k.biggest_literal_stats.inequality_cntr = 1; -k.biggest_literal_stats.log_cntr = 0; -k.biggest_literal_stats.max_cntr = 0; -k.biggest_literal_stats.min_cntr = 0; -k.biggest_literal_stats.multiplication_cntr = 0; -k.biggest_literal_stats.negation_cntr = 0; -k.biggest_literal_stats.notequalto_cntr = 0; -k.biggest_literal_stats.pow_cntr = 0; -k.biggest_literal_stats.realconstant_cntr = 0; -k.biggest_literal_stats.sqrt_cntr = 0; -k.biggest_literal_stats.trigonometry_cntr = 0; -k.biggest_literal_stats.true_cntr = 0; -k.biggest_literal_stats.uninterpretedfunction_cntr = 0; -k.biggest_literal_stats.unique_variables = 1; -k.biggest_literal_stats.variable_cntr = 1; -k.box_boolean_count = 3164; -k.box_continuous_count = 985; -k.box_integer_count = 0; -k.lemma_size = 4; -k.middle_assertion_stats.abs_cntr = 0; -k.middle_assertion_stats.addition_cntr = 0; -k.middle_assertion_stats.conjunction_cntr = 0; -k.middle_assertion_stats.constant_cntr = 1; -k.middle_assertion_stats.disjunction_cntr = 0; -k.middle_assertion_stats.division_cntr = 0; -k.middle_assertion_stats.equalto_cntr = 1; -k.middle_assertion_stats.exp_cntr = 0; -k.middle_assertion_stats.false_cntr = 0; -k.middle_assertion_stats.forall_cntr = 0; -k.middle_assertion_stats.ifthenelse_cntr = 0; -k.middle_assertion_stats.inequality_cntr = 0; -k.middle_assertion_stats.log_cntr = 0; -k.middle_assertion_stats.max_cntr = 0; -k.middle_assertion_stats.min_cntr = 0; -k.middle_assertion_stats.multiplication_cntr = 1; -k.middle_assertion_stats.negation_cntr = 0; -k.middle_assertion_stats.notequalto_cntr = 0; -k.middle_assertion_stats.pow_cntr = 0; -k.middle_assertion_stats.realconstant_cntr = 0; -k.middle_assertion_stats.sqrt_cntr = 0; -k.middle_assertion_stats.trigonometry_cntr = 0; -k.middle_assertion_stats.true_cntr = 0; -k.middle_assertion_stats.uninterpretedfunction_cntr = 0; -k.middle_assertion_stats.unique_variables = 2; -k.middle_assertion_stats.variable_cntr = 2; -k.middle_literal_stats.abs_cntr = 0; -k.middle_literal_stats.addition_cntr = 0; -k.middle_literal_stats.conjunction_cntr = 0; -k.middle_literal_stats.constant_cntr = 1; -k.middle_literal_stats.disjunction_cntr = 0; -k.middle_literal_stats.division_cntr = 0; -k.middle_literal_stats.equalto_cntr = 0; -k.middle_literal_stats.exp_cntr = 0; -k.middle_literal_stats.false_cntr = 0; -k.middle_literal_stats.forall_cntr = 0; -k.middle_literal_stats.ifthenelse_cntr = 0; -k.middle_literal_stats.inequality_cntr = 1; -k.middle_literal_stats.log_cntr = 0; -k.middle_literal_stats.max_cntr = 0; -k.middle_literal_stats.min_cntr = 0; -k.middle_literal_stats.multiplication_cntr = 0; -k.middle_literal_stats.negation_cntr = 0; -k.middle_literal_stats.notequalto_cntr = 0; -k.middle_literal_stats.pow_cntr = 0; -k.middle_literal_stats.realconstant_cntr = 0; -k.middle_literal_stats.sqrt_cntr = 0; -k.middle_literal_stats.trigonometry_cntr = 0; -k.middle_literal_stats.true_cntr = 0; -k.middle_literal_stats.uninterpretedfunction_cntr = 0; -k.middle_literal_stats.unique_variables = 1; -k.middle_literal_stats.variable_cntr = 1; -k.smallest_assertion_stats.abs_cntr = 0; -k.smallest_assertion_stats.addition_cntr = 0; -k.smallest_assertion_stats.conjunction_cntr = 0; -k.smallest_assertion_stats.constant_cntr = 1; -k.smallest_assertion_stats.disjunction_cntr = 0; -k.smallest_assertion_stats.division_cntr = 0; -k.smallest_assertion_stats.equalto_cntr = 0; -k.smallest_assertion_stats.exp_cntr = 0; -k.smallest_assertion_stats.false_cntr = 0; -k.smallest_assertion_stats.forall_cntr = 0; -k.smallest_assertion_stats.ifthenelse_cntr = 0; -k.smallest_assertion_stats.inequality_cntr = 1; -k.smallest_assertion_stats.log_cntr = 0; -k.smallest_assertion_stats.max_cntr = 0; -k.smallest_assertion_stats.min_cntr = 0; -k.smallest_assertion_stats.multiplication_cntr = 0; -k.smallest_assertion_stats.negation_cntr = 1; -k.smallest_assertion_stats.notequalto_cntr = 0; -k.smallest_assertion_stats.pow_cntr = 0; -k.smallest_assertion_stats.realconstant_cntr = 0; -k.smallest_assertion_stats.sqrt_cntr = 0; -k.smallest_assertion_stats.trigonometry_cntr = 0; -k.smallest_assertion_stats.true_cntr = 0; -k.smallest_assertion_stats.uninterpretedfunction_cntr = 0; -k.smallest_assertion_stats.unique_variables = 1; -k.smallest_assertion_stats.variable_cntr = 1; -k.smallest_literal_stats.abs_cntr = 0; -k.smallest_literal_stats.addition_cntr = 0; -k.smallest_literal_stats.conjunction_cntr = 0; -k.smallest_literal_stats.constant_cntr = 1; -k.smallest_literal_stats.disjunction_cntr = 0; -k.smallest_literal_stats.division_cntr = 0; -k.smallest_literal_stats.equalto_cntr = 0; -k.smallest_literal_stats.exp_cntr = 0; -k.smallest_literal_stats.false_cntr = 0; -k.smallest_literal_stats.forall_cntr = 0; -k.smallest_literal_stats.ifthenelse_cntr = 0; -k.smallest_literal_stats.inequality_cntr = 1; -k.smallest_literal_stats.log_cntr = 0; -k.smallest_literal_stats.max_cntr = 0; -k.smallest_literal_stats.min_cntr = 0; -k.smallest_literal_stats.multiplication_cntr = 0; -k.smallest_literal_stats.negation_cntr = 1; -k.smallest_literal_stats.notequalto_cntr = 0; -k.smallest_literal_stats.pow_cntr = 0; -k.smallest_literal_stats.realconstant_cntr = 0; -k.smallest_literal_stats.sqrt_cntr = 0; -k.smallest_literal_stats.trigonometry_cntr = 0; -k.smallest_literal_stats.true_cntr = 0; -k.smallest_literal_stats.uninterpretedfunction_cntr = 0; -k.smallest_literal_stats.unique_variables = 1; -k.smallest_literal_stats.variable_cntr = 1; -k.theory_checksat_ms = 0.400362; -expected_value = 0.9802891068888676; -calculated_value = PatternMatchingHeuristic::calculate(k); -std::cout << "Trial 2984: C++/Python neural inference delta = " << expected_value - calculated_value << std::endl; -EXPECT_NEAR(calculated_value, expected_value, 0.001); - -k.assertions_size = 2578; -k.assertions_stats.abs_cntr = 0; -k.assertions_stats.addition_cntr = 660; -k.assertions_stats.conjunction_cntr = 2578; -k.assertions_stats.constant_cntr = 1434; -k.assertions_stats.disjunction_cntr = 0; -k.assertions_stats.division_cntr = 0; -k.assertions_stats.equalto_cntr = 2571; -k.assertions_stats.exp_cntr = 0; -k.assertions_stats.false_cntr = 0; -k.assertions_stats.forall_cntr = 0; -k.assertions_stats.ifthenelse_cntr = 0; -k.assertions_stats.inequality_cntr = 7; -k.assertions_stats.log_cntr = 0; -k.assertions_stats.max_cntr = 0; -k.assertions_stats.min_cntr = 0; -k.assertions_stats.multiplication_cntr = 379; -k.assertions_stats.negation_cntr = 947; -k.assertions_stats.notequalto_cntr = 0; -k.assertions_stats.pow_cntr = 1; -k.assertions_stats.realconstant_cntr = 1511; -k.assertions_stats.sqrt_cntr = 0; -k.assertions_stats.trigonometry_cntr = 0; -k.assertions_stats.true_cntr = 0; -k.assertions_stats.uninterpretedfunction_cntr = 0; -k.assertions_stats.unique_variables = 24; -k.assertions_stats.variable_cntr = 2613; -k.biggest_assertion_stats.abs_cntr = 0; -k.biggest_assertion_stats.addition_cntr = 4; -k.biggest_assertion_stats.conjunction_cntr = 0; -k.biggest_assertion_stats.constant_cntr = 6; -k.biggest_assertion_stats.disjunction_cntr = 0; -k.biggest_assertion_stats.division_cntr = 0; -k.biggest_assertion_stats.equalto_cntr = 1; -k.biggest_assertion_stats.exp_cntr = 0; -k.biggest_assertion_stats.false_cntr = 0; -k.biggest_assertion_stats.forall_cntr = 0; -k.biggest_assertion_stats.ifthenelse_cntr = 0; -k.biggest_assertion_stats.inequality_cntr = 0; -k.biggest_assertion_stats.log_cntr = 0; -k.biggest_assertion_stats.max_cntr = 0; -k.biggest_assertion_stats.min_cntr = 0; -k.biggest_assertion_stats.multiplication_cntr = 6; -k.biggest_assertion_stats.negation_cntr = 0; -k.biggest_assertion_stats.notequalto_cntr = 0; -k.biggest_assertion_stats.pow_cntr = 0; -k.biggest_assertion_stats.realconstant_cntr = 0; -k.biggest_assertion_stats.sqrt_cntr = 0; -k.biggest_assertion_stats.trigonometry_cntr = 0; -k.biggest_assertion_stats.true_cntr = 0; -k.biggest_assertion_stats.uninterpretedfunction_cntr = 0; -k.biggest_assertion_stats.unique_variables = 7; -k.biggest_assertion_stats.variable_cntr = 8; -k.biggest_literal_stats.abs_cntr = 0; -k.biggest_literal_stats.addition_cntr = 0; -k.biggest_literal_stats.conjunction_cntr = 0; -k.biggest_literal_stats.constant_cntr = 0; -k.biggest_literal_stats.disjunction_cntr = 0; -k.biggest_literal_stats.division_cntr = 0; -k.biggest_literal_stats.equalto_cntr = 1; -k.biggest_literal_stats.exp_cntr = 0; -k.biggest_literal_stats.false_cntr = 0; -k.biggest_literal_stats.forall_cntr = 0; -k.biggest_literal_stats.ifthenelse_cntr = 0; -k.biggest_literal_stats.inequality_cntr = 0; -k.biggest_literal_stats.log_cntr = 0; -k.biggest_literal_stats.max_cntr = 0; -k.biggest_literal_stats.min_cntr = 0; -k.biggest_literal_stats.multiplication_cntr = 0; -k.biggest_literal_stats.negation_cntr = 0; -k.biggest_literal_stats.notequalto_cntr = 0; -k.biggest_literal_stats.pow_cntr = 0; -k.biggest_literal_stats.realconstant_cntr = 1; -k.biggest_literal_stats.sqrt_cntr = 0; -k.biggest_literal_stats.trigonometry_cntr = 0; -k.biggest_literal_stats.true_cntr = 0; -k.biggest_literal_stats.uninterpretedfunction_cntr = 0; -k.biggest_literal_stats.unique_variables = 1; -k.biggest_literal_stats.variable_cntr = 1; -k.box_boolean_count = 0; -k.box_continuous_count = 23; -k.box_integer_count = 1; -k.lemma_size = 2; -k.middle_assertion_stats.abs_cntr = 0; -k.middle_assertion_stats.addition_cntr = 1; -k.middle_assertion_stats.conjunction_cntr = 0; -k.middle_assertion_stats.constant_cntr = 1; -k.middle_assertion_stats.disjunction_cntr = 0; -k.middle_assertion_stats.division_cntr = 0; -k.middle_assertion_stats.equalto_cntr = 1; -k.middle_assertion_stats.exp_cntr = 0; -k.middle_assertion_stats.false_cntr = 0; -k.middle_assertion_stats.forall_cntr = 0; -k.middle_assertion_stats.ifthenelse_cntr = 0; -k.middle_assertion_stats.inequality_cntr = 0; -k.middle_assertion_stats.log_cntr = 0; -k.middle_assertion_stats.max_cntr = 0; -k.middle_assertion_stats.min_cntr = 0; -k.middle_assertion_stats.multiplication_cntr = 0; -k.middle_assertion_stats.negation_cntr = 0; -k.middle_assertion_stats.notequalto_cntr = 0; -k.middle_assertion_stats.pow_cntr = 0; -k.middle_assertion_stats.realconstant_cntr = 0; -k.middle_assertion_stats.sqrt_cntr = 0; -k.middle_assertion_stats.trigonometry_cntr = 0; -k.middle_assertion_stats.true_cntr = 0; -k.middle_assertion_stats.uninterpretedfunction_cntr = 0; -k.middle_assertion_stats.unique_variables = 1; -k.middle_assertion_stats.variable_cntr = 1; -k.middle_literal_stats.abs_cntr = 0; -k.middle_literal_stats.addition_cntr = 0; -k.middle_literal_stats.conjunction_cntr = 0; -k.middle_literal_stats.constant_cntr = 0; -k.middle_literal_stats.disjunction_cntr = 0; -k.middle_literal_stats.division_cntr = 0; -k.middle_literal_stats.equalto_cntr = 1; -k.middle_literal_stats.exp_cntr = 0; -k.middle_literal_stats.false_cntr = 0; -k.middle_literal_stats.forall_cntr = 0; -k.middle_literal_stats.ifthenelse_cntr = 0; -k.middle_literal_stats.inequality_cntr = 0; -k.middle_literal_stats.log_cntr = 0; -k.middle_literal_stats.max_cntr = 0; -k.middle_literal_stats.min_cntr = 0; -k.middle_literal_stats.multiplication_cntr = 0; -k.middle_literal_stats.negation_cntr = 0; -k.middle_literal_stats.notequalto_cntr = 0; -k.middle_literal_stats.pow_cntr = 0; -k.middle_literal_stats.realconstant_cntr = 1; -k.middle_literal_stats.sqrt_cntr = 0; -k.middle_literal_stats.trigonometry_cntr = 0; -k.middle_literal_stats.true_cntr = 0; -k.middle_literal_stats.uninterpretedfunction_cntr = 0; -k.middle_literal_stats.unique_variables = 1; -k.middle_literal_stats.variable_cntr = 1; -k.smallest_assertion_stats.abs_cntr = 0; -k.smallest_assertion_stats.addition_cntr = 1; -k.smallest_assertion_stats.conjunction_cntr = 0; -k.smallest_assertion_stats.constant_cntr = 1; -k.smallest_assertion_stats.disjunction_cntr = 0; -k.smallest_assertion_stats.division_cntr = 0; -k.smallest_assertion_stats.equalto_cntr = 1; -k.smallest_assertion_stats.exp_cntr = 0; -k.smallest_assertion_stats.false_cntr = 0; -k.smallest_assertion_stats.forall_cntr = 0; -k.smallest_assertion_stats.ifthenelse_cntr = 0; -k.smallest_assertion_stats.inequality_cntr = 0; -k.smallest_assertion_stats.log_cntr = 0; -k.smallest_assertion_stats.max_cntr = 0; -k.smallest_assertion_stats.min_cntr = 0; -k.smallest_assertion_stats.multiplication_cntr = 0; -k.smallest_assertion_stats.negation_cntr = 0; -k.smallest_assertion_stats.notequalto_cntr = 0; -k.smallest_assertion_stats.pow_cntr = 0; -k.smallest_assertion_stats.realconstant_cntr = 0; -k.smallest_assertion_stats.sqrt_cntr = 0; -k.smallest_assertion_stats.trigonometry_cntr = 0; -k.smallest_assertion_stats.true_cntr = 0; -k.smallest_assertion_stats.uninterpretedfunction_cntr = 0; -k.smallest_assertion_stats.unique_variables = 1; -k.smallest_assertion_stats.variable_cntr = 1; -k.smallest_literal_stats.abs_cntr = 0; -k.smallest_literal_stats.addition_cntr = 0; -k.smallest_literal_stats.conjunction_cntr = 0; -k.smallest_literal_stats.constant_cntr = 0; -k.smallest_literal_stats.disjunction_cntr = 0; -k.smallest_literal_stats.division_cntr = 0; -k.smallest_literal_stats.equalto_cntr = 1; -k.smallest_literal_stats.exp_cntr = 0; -k.smallest_literal_stats.false_cntr = 0; -k.smallest_literal_stats.forall_cntr = 0; -k.smallest_literal_stats.ifthenelse_cntr = 0; -k.smallest_literal_stats.inequality_cntr = 0; -k.smallest_literal_stats.log_cntr = 0; -k.smallest_literal_stats.max_cntr = 0; -k.smallest_literal_stats.min_cntr = 0; -k.smallest_literal_stats.multiplication_cntr = 0; -k.smallest_literal_stats.negation_cntr = 0; -k.smallest_literal_stats.notequalto_cntr = 0; -k.smallest_literal_stats.pow_cntr = 0; -k.smallest_literal_stats.realconstant_cntr = 1; -k.smallest_literal_stats.sqrt_cntr = 0; -k.smallest_literal_stats.trigonometry_cntr = 0; -k.smallest_literal_stats.true_cntr = 0; -k.smallest_literal_stats.uninterpretedfunction_cntr = 0; -k.smallest_literal_stats.unique_variables = 1; -k.smallest_literal_stats.variable_cntr = 1; -k.theory_checksat_ms = 0.0341241; -expected_value = 4.984553724196303e-06; -calculated_value = PatternMatchingHeuristic::calculate(k); -std::cout << "Trial 5173: C++/Python neural inference delta = " << expected_value - calculated_value << std::endl; -EXPECT_NEAR(calculated_value, expected_value, 0.001); - -k.assertions_size = 9; -k.assertions_stats.abs_cntr = 0; -k.assertions_stats.addition_cntr = 2; -k.assertions_stats.conjunction_cntr = 9; -k.assertions_stats.constant_cntr = 11; -k.assertions_stats.disjunction_cntr = 0; -k.assertions_stats.division_cntr = 0; -k.assertions_stats.equalto_cntr = 3; -k.assertions_stats.exp_cntr = 0; -k.assertions_stats.false_cntr = 0; -k.assertions_stats.forall_cntr = 0; -k.assertions_stats.ifthenelse_cntr = 0; -k.assertions_stats.inequality_cntr = 6; -k.assertions_stats.log_cntr = 0; -k.assertions_stats.max_cntr = 0; -k.assertions_stats.min_cntr = 0; -k.assertions_stats.multiplication_cntr = 2; -k.assertions_stats.negation_cntr = 5; -k.assertions_stats.notequalto_cntr = 0; -k.assertions_stats.pow_cntr = 3; -k.assertions_stats.realconstant_cntr = 0; -k.assertions_stats.sqrt_cntr = 0; -k.assertions_stats.trigonometry_cntr = 0; -k.assertions_stats.true_cntr = 0; -k.assertions_stats.uninterpretedfunction_cntr = 0; -k.assertions_stats.unique_variables = 4; -k.assertions_stats.variable_cntr = 13; -k.biggest_assertion_stats.abs_cntr = 0; -k.biggest_assertion_stats.addition_cntr = 0; -k.biggest_assertion_stats.conjunction_cntr = 0; -k.biggest_assertion_stats.constant_cntr = 3; -k.biggest_assertion_stats.disjunction_cntr = 0; -k.biggest_assertion_stats.division_cntr = 0; -k.biggest_assertion_stats.equalto_cntr = 0; -k.biggest_assertion_stats.exp_cntr = 0; -k.biggest_assertion_stats.false_cntr = 0; -k.biggest_assertion_stats.forall_cntr = 0; -k.biggest_assertion_stats.ifthenelse_cntr = 0; -k.biggest_assertion_stats.inequality_cntr = 1; -k.biggest_assertion_stats.log_cntr = 0; -k.biggest_assertion_stats.max_cntr = 0; -k.biggest_assertion_stats.min_cntr = 0; -k.biggest_assertion_stats.multiplication_cntr = 2; -k.biggest_assertion_stats.negation_cntr = 0; -k.biggest_assertion_stats.notequalto_cntr = 0; -k.biggest_assertion_stats.pow_cntr = 0; -k.biggest_assertion_stats.realconstant_cntr = 0; -k.biggest_assertion_stats.sqrt_cntr = 0; -k.biggest_assertion_stats.trigonometry_cntr = 0; -k.biggest_assertion_stats.true_cntr = 0; -k.biggest_assertion_stats.uninterpretedfunction_cntr = 0; -k.biggest_assertion_stats.unique_variables = 2; -k.biggest_assertion_stats.variable_cntr = 2; -k.biggest_literal_stats.abs_cntr = 0; -k.biggest_literal_stats.addition_cntr = 1; -k.biggest_literal_stats.conjunction_cntr = 0; -k.biggest_literal_stats.constant_cntr = 1; -k.biggest_literal_stats.disjunction_cntr = 0; -k.biggest_literal_stats.division_cntr = 0; -k.biggest_literal_stats.equalto_cntr = 1; -k.biggest_literal_stats.exp_cntr = 0; -k.biggest_literal_stats.false_cntr = 0; -k.biggest_literal_stats.forall_cntr = 0; -k.biggest_literal_stats.ifthenelse_cntr = 0; -k.biggest_literal_stats.inequality_cntr = 0; -k.biggest_literal_stats.log_cntr = 0; -k.biggest_literal_stats.max_cntr = 0; -k.biggest_literal_stats.min_cntr = 0; -k.biggest_literal_stats.multiplication_cntr = 0; -k.biggest_literal_stats.negation_cntr = 0; -k.biggest_literal_stats.notequalto_cntr = 0; -k.biggest_literal_stats.pow_cntr = 1; -k.biggest_literal_stats.realconstant_cntr = 0; -k.biggest_literal_stats.sqrt_cntr = 0; -k.biggest_literal_stats.trigonometry_cntr = 0; -k.biggest_literal_stats.true_cntr = 0; -k.biggest_literal_stats.uninterpretedfunction_cntr = 0; -k.biggest_literal_stats.unique_variables = 2; -k.biggest_literal_stats.variable_cntr = 2; -k.box_boolean_count = 0; -k.box_continuous_count = 4; -k.box_integer_count = 0; -k.lemma_size = 9; -k.middle_assertion_stats.abs_cntr = 0; -k.middle_assertion_stats.addition_cntr = 0; -k.middle_assertion_stats.conjunction_cntr = 0; -k.middle_assertion_stats.constant_cntr = 1; -k.middle_assertion_stats.disjunction_cntr = 0; -k.middle_assertion_stats.division_cntr = 0; -k.middle_assertion_stats.equalto_cntr = 0; -k.middle_assertion_stats.exp_cntr = 0; -k.middle_assertion_stats.false_cntr = 0; -k.middle_assertion_stats.forall_cntr = 0; -k.middle_assertion_stats.ifthenelse_cntr = 0; -k.middle_assertion_stats.inequality_cntr = 1; -k.middle_assertion_stats.log_cntr = 0; -k.middle_assertion_stats.max_cntr = 0; -k.middle_assertion_stats.min_cntr = 0; -k.middle_assertion_stats.multiplication_cntr = 0; -k.middle_assertion_stats.negation_cntr = 1; -k.middle_assertion_stats.notequalto_cntr = 0; -k.middle_assertion_stats.pow_cntr = 0; -k.middle_assertion_stats.realconstant_cntr = 0; -k.middle_assertion_stats.sqrt_cntr = 0; -k.middle_assertion_stats.trigonometry_cntr = 0; -k.middle_assertion_stats.true_cntr = 0; -k.middle_assertion_stats.uninterpretedfunction_cntr = 0; -k.middle_assertion_stats.unique_variables = 1; -k.middle_assertion_stats.variable_cntr = 1; -k.middle_literal_stats.abs_cntr = 0; -k.middle_literal_stats.addition_cntr = 0; -k.middle_literal_stats.conjunction_cntr = 0; -k.middle_literal_stats.constant_cntr = 1; -k.middle_literal_stats.disjunction_cntr = 0; -k.middle_literal_stats.division_cntr = 0; -k.middle_literal_stats.equalto_cntr = 0; -k.middle_literal_stats.exp_cntr = 0; -k.middle_literal_stats.false_cntr = 0; -k.middle_literal_stats.forall_cntr = 0; -k.middle_literal_stats.ifthenelse_cntr = 0; -k.middle_literal_stats.inequality_cntr = 1; -k.middle_literal_stats.log_cntr = 0; -k.middle_literal_stats.max_cntr = 0; -k.middle_literal_stats.min_cntr = 0; -k.middle_literal_stats.multiplication_cntr = 0; -k.middle_literal_stats.negation_cntr = 1; -k.middle_literal_stats.notequalto_cntr = 0; -k.middle_literal_stats.pow_cntr = 0; -k.middle_literal_stats.realconstant_cntr = 0; -k.middle_literal_stats.sqrt_cntr = 0; -k.middle_literal_stats.trigonometry_cntr = 0; -k.middle_literal_stats.true_cntr = 0; -k.middle_literal_stats.uninterpretedfunction_cntr = 0; -k.middle_literal_stats.unique_variables = 1; -k.middle_literal_stats.variable_cntr = 1; -k.smallest_assertion_stats.abs_cntr = 0; -k.smallest_assertion_stats.addition_cntr = 0; -k.smallest_assertion_stats.conjunction_cntr = 0; -k.smallest_assertion_stats.constant_cntr = 1; -k.smallest_assertion_stats.disjunction_cntr = 0; -k.smallest_assertion_stats.division_cntr = 0; -k.smallest_assertion_stats.equalto_cntr = 0; -k.smallest_assertion_stats.exp_cntr = 0; -k.smallest_assertion_stats.false_cntr = 0; -k.smallest_assertion_stats.forall_cntr = 0; -k.smallest_assertion_stats.ifthenelse_cntr = 0; -k.smallest_assertion_stats.inequality_cntr = 1; -k.smallest_assertion_stats.log_cntr = 0; -k.smallest_assertion_stats.max_cntr = 0; -k.smallest_assertion_stats.min_cntr = 0; -k.smallest_assertion_stats.multiplication_cntr = 0; -k.smallest_assertion_stats.negation_cntr = 1; -k.smallest_assertion_stats.notequalto_cntr = 0; -k.smallest_assertion_stats.pow_cntr = 0; -k.smallest_assertion_stats.realconstant_cntr = 0; -k.smallest_assertion_stats.sqrt_cntr = 0; -k.smallest_assertion_stats.trigonometry_cntr = 0; -k.smallest_assertion_stats.true_cntr = 0; -k.smallest_assertion_stats.uninterpretedfunction_cntr = 0; -k.smallest_assertion_stats.unique_variables = 1; -k.smallest_assertion_stats.variable_cntr = 1; -k.smallest_literal_stats.abs_cntr = 0; -k.smallest_literal_stats.addition_cntr = 0; -k.smallest_literal_stats.conjunction_cntr = 0; -k.smallest_literal_stats.constant_cntr = 1; -k.smallest_literal_stats.disjunction_cntr = 0; -k.smallest_literal_stats.division_cntr = 0; -k.smallest_literal_stats.equalto_cntr = 0; -k.smallest_literal_stats.exp_cntr = 0; -k.smallest_literal_stats.false_cntr = 0; -k.smallest_literal_stats.forall_cntr = 0; -k.smallest_literal_stats.ifthenelse_cntr = 0; -k.smallest_literal_stats.inequality_cntr = 1; -k.smallest_literal_stats.log_cntr = 0; -k.smallest_literal_stats.max_cntr = 0; -k.smallest_literal_stats.min_cntr = 0; -k.smallest_literal_stats.multiplication_cntr = 0; -k.smallest_literal_stats.negation_cntr = 1; -k.smallest_literal_stats.notequalto_cntr = 0; -k.smallest_literal_stats.pow_cntr = 0; -k.smallest_literal_stats.realconstant_cntr = 0; -k.smallest_literal_stats.sqrt_cntr = 0; -k.smallest_literal_stats.trigonometry_cntr = 0; -k.smallest_literal_stats.true_cntr = 0; -k.smallest_literal_stats.uninterpretedfunction_cntr = 0; -k.smallest_literal_stats.unique_variables = 1; -k.smallest_literal_stats.variable_cntr = 1; -k.theory_checksat_ms = 0.478957; -expected_value = 0.014762318503545334; -calculated_value = PatternMatchingHeuristic::calculate(k); -std::cout << "Trial 3009: C++/Python neural inference delta = " << expected_value - calculated_value << std::endl; -EXPECT_NEAR(calculated_value, expected_value, 0.001); - -k.assertions_size = 1193; -k.assertions_stats.abs_cntr = 0; -k.assertions_stats.addition_cntr = 582; -k.assertions_stats.conjunction_cntr = 1193; -k.assertions_stats.constant_cntr = 919; -k.assertions_stats.disjunction_cntr = 0; -k.assertions_stats.division_cntr = 0; -k.assertions_stats.equalto_cntr = 845; -k.assertions_stats.exp_cntr = 0; -k.assertions_stats.false_cntr = 0; -k.assertions_stats.forall_cntr = 0; -k.assertions_stats.ifthenelse_cntr = 0; -k.assertions_stats.inequality_cntr = 348; -k.assertions_stats.log_cntr = 0; -k.assertions_stats.max_cntr = 0; -k.assertions_stats.min_cntr = 0; -k.assertions_stats.multiplication_cntr = 442; -k.assertions_stats.negation_cntr = 285; -k.assertions_stats.notequalto_cntr = 0; -k.assertions_stats.pow_cntr = 32; -k.assertions_stats.realconstant_cntr = 0; -k.assertions_stats.sqrt_cntr = 0; -k.assertions_stats.trigonometry_cntr = 0; -k.assertions_stats.true_cntr = 0; -k.assertions_stats.uninterpretedfunction_cntr = 0; -k.assertions_stats.unique_variables = 765; -k.assertions_stats.variable_cntr = 2342; -k.biggest_assertion_stats.abs_cntr = 0; -k.biggest_assertion_stats.addition_cntr = 0; -k.biggest_assertion_stats.conjunction_cntr = 0; -k.biggest_assertion_stats.constant_cntr = 2; -k.biggest_assertion_stats.disjunction_cntr = 0; -k.biggest_assertion_stats.division_cntr = 0; -k.biggest_assertion_stats.equalto_cntr = 1; -k.biggest_assertion_stats.exp_cntr = 0; -k.biggest_assertion_stats.false_cntr = 0; -k.biggest_assertion_stats.forall_cntr = 0; -k.biggest_assertion_stats.ifthenelse_cntr = 0; -k.biggest_assertion_stats.inequality_cntr = 0; -k.biggest_assertion_stats.log_cntr = 0; -k.biggest_assertion_stats.max_cntr = 0; -k.biggest_assertion_stats.min_cntr = 0; -k.biggest_assertion_stats.multiplication_cntr = 2; -k.biggest_assertion_stats.negation_cntr = 0; -k.biggest_assertion_stats.notequalto_cntr = 0; -k.biggest_assertion_stats.pow_cntr = 0; -k.biggest_assertion_stats.realconstant_cntr = 0; -k.biggest_assertion_stats.sqrt_cntr = 0; -k.biggest_assertion_stats.trigonometry_cntr = 0; -k.biggest_assertion_stats.true_cntr = 0; -k.biggest_assertion_stats.uninterpretedfunction_cntr = 0; -k.biggest_assertion_stats.unique_variables = 3; -k.biggest_assertion_stats.variable_cntr = 3; -k.biggest_literal_stats.abs_cntr = 0; -k.biggest_literal_stats.addition_cntr = 0; -k.biggest_literal_stats.conjunction_cntr = 0; -k.biggest_literal_stats.constant_cntr = 0; -k.biggest_literal_stats.disjunction_cntr = 0; -k.biggest_literal_stats.division_cntr = 0; -k.biggest_literal_stats.equalto_cntr = 1; -k.biggest_literal_stats.exp_cntr = 0; -k.biggest_literal_stats.false_cntr = 0; -k.biggest_literal_stats.forall_cntr = 0; -k.biggest_literal_stats.ifthenelse_cntr = 0; -k.biggest_literal_stats.inequality_cntr = 0; -k.biggest_literal_stats.log_cntr = 0; -k.biggest_literal_stats.max_cntr = 0; -k.biggest_literal_stats.min_cntr = 0; -k.biggest_literal_stats.multiplication_cntr = 0; -k.biggest_literal_stats.negation_cntr = 0; -k.biggest_literal_stats.notequalto_cntr = 0; -k.biggest_literal_stats.pow_cntr = 0; -k.biggest_literal_stats.realconstant_cntr = 0; -k.biggest_literal_stats.sqrt_cntr = 0; -k.biggest_literal_stats.trigonometry_cntr = 0; -k.biggest_literal_stats.true_cntr = 0; -k.biggest_literal_stats.uninterpretedfunction_cntr = 0; -k.biggest_literal_stats.unique_variables = 2; -k.biggest_literal_stats.variable_cntr = 2; -k.box_boolean_count = 2277; -k.box_continuous_count = 765; -k.box_integer_count = 0; -k.lemma_size = 8; -k.middle_assertion_stats.abs_cntr = 0; -k.middle_assertion_stats.addition_cntr = 0; -k.middle_assertion_stats.conjunction_cntr = 0; -k.middle_assertion_stats.constant_cntr = 0; -k.middle_assertion_stats.disjunction_cntr = 0; -k.middle_assertion_stats.division_cntr = 0; -k.middle_assertion_stats.equalto_cntr = 1; -k.middle_assertion_stats.exp_cntr = 0; -k.middle_assertion_stats.false_cntr = 0; -k.middle_assertion_stats.forall_cntr = 0; -k.middle_assertion_stats.ifthenelse_cntr = 0; -k.middle_assertion_stats.inequality_cntr = 0; -k.middle_assertion_stats.log_cntr = 0; -k.middle_assertion_stats.max_cntr = 0; -k.middle_assertion_stats.min_cntr = 0; -k.middle_assertion_stats.multiplication_cntr = 0; -k.middle_assertion_stats.negation_cntr = 1; -k.middle_assertion_stats.notequalto_cntr = 0; -k.middle_assertion_stats.pow_cntr = 0; -k.middle_assertion_stats.realconstant_cntr = 0; -k.middle_assertion_stats.sqrt_cntr = 0; -k.middle_assertion_stats.trigonometry_cntr = 0; -k.middle_assertion_stats.true_cntr = 0; -k.middle_assertion_stats.uninterpretedfunction_cntr = 0; -k.middle_assertion_stats.unique_variables = 2; -k.middle_assertion_stats.variable_cntr = 2; -k.middle_literal_stats.abs_cntr = 0; -k.middle_literal_stats.addition_cntr = 0; -k.middle_literal_stats.conjunction_cntr = 0; -k.middle_literal_stats.constant_cntr = 1; -k.middle_literal_stats.disjunction_cntr = 0; -k.middle_literal_stats.division_cntr = 0; -k.middle_literal_stats.equalto_cntr = 0; -k.middle_literal_stats.exp_cntr = 0; -k.middle_literal_stats.false_cntr = 0; -k.middle_literal_stats.forall_cntr = 0; -k.middle_literal_stats.ifthenelse_cntr = 0; -k.middle_literal_stats.inequality_cntr = 1; -k.middle_literal_stats.log_cntr = 0; -k.middle_literal_stats.max_cntr = 0; -k.middle_literal_stats.min_cntr = 0; -k.middle_literal_stats.multiplication_cntr = 0; -k.middle_literal_stats.negation_cntr = 0; -k.middle_literal_stats.notequalto_cntr = 0; -k.middle_literal_stats.pow_cntr = 0; -k.middle_literal_stats.realconstant_cntr = 0; -k.middle_literal_stats.sqrt_cntr = 0; -k.middle_literal_stats.trigonometry_cntr = 0; -k.middle_literal_stats.true_cntr = 0; -k.middle_literal_stats.uninterpretedfunction_cntr = 0; -k.middle_literal_stats.unique_variables = 1; -k.middle_literal_stats.variable_cntr = 1; -k.smallest_assertion_stats.abs_cntr = 0; -k.smallest_assertion_stats.addition_cntr = 0; -k.smallest_assertion_stats.conjunction_cntr = 0; -k.smallest_assertion_stats.constant_cntr = 1; -k.smallest_assertion_stats.disjunction_cntr = 0; -k.smallest_assertion_stats.division_cntr = 0; -k.smallest_assertion_stats.equalto_cntr = 0; -k.smallest_assertion_stats.exp_cntr = 0; -k.smallest_assertion_stats.false_cntr = 0; -k.smallest_assertion_stats.forall_cntr = 0; -k.smallest_assertion_stats.ifthenelse_cntr = 0; -k.smallest_assertion_stats.inequality_cntr = 1; -k.smallest_assertion_stats.log_cntr = 0; -k.smallest_assertion_stats.max_cntr = 0; -k.smallest_assertion_stats.min_cntr = 0; -k.smallest_assertion_stats.multiplication_cntr = 0; -k.smallest_assertion_stats.negation_cntr = 0; -k.smallest_assertion_stats.notequalto_cntr = 0; -k.smallest_assertion_stats.pow_cntr = 0; -k.smallest_assertion_stats.realconstant_cntr = 0; -k.smallest_assertion_stats.sqrt_cntr = 0; -k.smallest_assertion_stats.trigonometry_cntr = 0; -k.smallest_assertion_stats.true_cntr = 0; -k.smallest_assertion_stats.uninterpretedfunction_cntr = 0; -k.smallest_assertion_stats.unique_variables = 1; -k.smallest_assertion_stats.variable_cntr = 1; -k.smallest_literal_stats.abs_cntr = 0; -k.smallest_literal_stats.addition_cntr = 0; -k.smallest_literal_stats.conjunction_cntr = 0; -k.smallest_literal_stats.constant_cntr = 1; -k.smallest_literal_stats.disjunction_cntr = 0; -k.smallest_literal_stats.division_cntr = 0; -k.smallest_literal_stats.equalto_cntr = 0; -k.smallest_literal_stats.exp_cntr = 0; -k.smallest_literal_stats.false_cntr = 0; -k.smallest_literal_stats.forall_cntr = 0; -k.smallest_literal_stats.ifthenelse_cntr = 0; -k.smallest_literal_stats.inequality_cntr = 1; -k.smallest_literal_stats.log_cntr = 0; -k.smallest_literal_stats.max_cntr = 0; -k.smallest_literal_stats.min_cntr = 0; -k.smallest_literal_stats.multiplication_cntr = 0; -k.smallest_literal_stats.negation_cntr = 1; -k.smallest_literal_stats.notequalto_cntr = 0; -k.smallest_literal_stats.pow_cntr = 0; -k.smallest_literal_stats.realconstant_cntr = 0; -k.smallest_literal_stats.sqrt_cntr = 0; -k.smallest_literal_stats.trigonometry_cntr = 0; -k.smallest_literal_stats.true_cntr = 0; -k.smallest_literal_stats.uninterpretedfunction_cntr = 0; -k.smallest_literal_stats.unique_variables = 1; -k.smallest_literal_stats.variable_cntr = 1; -k.theory_checksat_ms = 1.30679; -expected_value = 0.02644266276326945; -calculated_value = PatternMatchingHeuristic::calculate(k); -std::cout << "Trial 17002: C++/Python neural inference delta = " << expected_value - calculated_value << std::endl; -EXPECT_NEAR(calculated_value, expected_value, 0.001); - -k.assertions_size = 2094; -k.assertions_stats.abs_cntr = 0; -k.assertions_stats.addition_cntr = 366; -k.assertions_stats.conjunction_cntr = 2094; -k.assertions_stats.constant_cntr = 1090; -k.assertions_stats.disjunction_cntr = 0; -k.assertions_stats.division_cntr = 0; -k.assertions_stats.equalto_cntr = 2087; -k.assertions_stats.exp_cntr = 0; -k.assertions_stats.false_cntr = 0; -k.assertions_stats.forall_cntr = 0; -k.assertions_stats.ifthenelse_cntr = 0; -k.assertions_stats.inequality_cntr = 7; -k.assertions_stats.log_cntr = 0; -k.assertions_stats.max_cntr = 0; -k.assertions_stats.min_cntr = 0; -k.assertions_stats.multiplication_cntr = 335; -k.assertions_stats.negation_cntr = 1391; -k.assertions_stats.notequalto_cntr = 0; -k.assertions_stats.pow_cntr = 1; -k.assertions_stats.realconstant_cntr = 1327; -k.assertions_stats.sqrt_cntr = 0; -k.assertions_stats.trigonometry_cntr = 0; -k.assertions_stats.true_cntr = 0; -k.assertions_stats.uninterpretedfunction_cntr = 0; -k.assertions_stats.unique_variables = 24; -k.assertions_stats.variable_cntr = 2129; -k.biggest_assertion_stats.abs_cntr = 0; -k.biggest_assertion_stats.addition_cntr = 4; -k.biggest_assertion_stats.conjunction_cntr = 0; -k.biggest_assertion_stats.constant_cntr = 6; -k.biggest_assertion_stats.disjunction_cntr = 0; -k.biggest_assertion_stats.division_cntr = 0; -k.biggest_assertion_stats.equalto_cntr = 1; -k.biggest_assertion_stats.exp_cntr = 0; -k.biggest_assertion_stats.false_cntr = 0; -k.biggest_assertion_stats.forall_cntr = 0; -k.biggest_assertion_stats.ifthenelse_cntr = 0; -k.biggest_assertion_stats.inequality_cntr = 0; -k.biggest_assertion_stats.log_cntr = 0; -k.biggest_assertion_stats.max_cntr = 0; -k.biggest_assertion_stats.min_cntr = 0; -k.biggest_assertion_stats.multiplication_cntr = 6; -k.biggest_assertion_stats.negation_cntr = 0; -k.biggest_assertion_stats.notequalto_cntr = 0; -k.biggest_assertion_stats.pow_cntr = 0; -k.biggest_assertion_stats.realconstant_cntr = 0; -k.biggest_assertion_stats.sqrt_cntr = 0; -k.biggest_assertion_stats.trigonometry_cntr = 0; -k.biggest_assertion_stats.true_cntr = 0; -k.biggest_assertion_stats.uninterpretedfunction_cntr = 0; -k.biggest_assertion_stats.unique_variables = 7; -k.biggest_assertion_stats.variable_cntr = 8; -k.biggest_literal_stats.abs_cntr = 0; -k.biggest_literal_stats.addition_cntr = 0; -k.biggest_literal_stats.conjunction_cntr = 0; -k.biggest_literal_stats.constant_cntr = 1; -k.biggest_literal_stats.disjunction_cntr = 0; -k.biggest_literal_stats.division_cntr = 0; -k.biggest_literal_stats.equalto_cntr = 1; -k.biggest_literal_stats.exp_cntr = 0; -k.biggest_literal_stats.false_cntr = 0; -k.biggest_literal_stats.forall_cntr = 0; -k.biggest_literal_stats.ifthenelse_cntr = 0; -k.biggest_literal_stats.inequality_cntr = 0; -k.biggest_literal_stats.log_cntr = 0; -k.biggest_literal_stats.max_cntr = 0; -k.biggest_literal_stats.min_cntr = 0; -k.biggest_literal_stats.multiplication_cntr = 0; -k.biggest_literal_stats.negation_cntr = 0; -k.biggest_literal_stats.notequalto_cntr = 0; -k.biggest_literal_stats.pow_cntr = 0; -k.biggest_literal_stats.realconstant_cntr = 0; -k.biggest_literal_stats.sqrt_cntr = 0; -k.biggest_literal_stats.trigonometry_cntr = 0; -k.biggest_literal_stats.true_cntr = 0; -k.biggest_literal_stats.uninterpretedfunction_cntr = 0; -k.biggest_literal_stats.unique_variables = 1; -k.biggest_literal_stats.variable_cntr = 1; -k.box_boolean_count = 0; -k.box_continuous_count = 23; -k.box_integer_count = 1; -k.lemma_size = 2; -k.middle_assertion_stats.abs_cntr = 0; -k.middle_assertion_stats.addition_cntr = 0; -k.middle_assertion_stats.conjunction_cntr = 0; -k.middle_assertion_stats.constant_cntr = 0; -k.middle_assertion_stats.disjunction_cntr = 0; -k.middle_assertion_stats.division_cntr = 0; -k.middle_assertion_stats.equalto_cntr = 1; -k.middle_assertion_stats.exp_cntr = 0; -k.middle_assertion_stats.false_cntr = 0; -k.middle_assertion_stats.forall_cntr = 0; -k.middle_assertion_stats.ifthenelse_cntr = 0; -k.middle_assertion_stats.inequality_cntr = 0; -k.middle_assertion_stats.log_cntr = 0; -k.middle_assertion_stats.max_cntr = 0; -k.middle_assertion_stats.min_cntr = 0; -k.middle_assertion_stats.multiplication_cntr = 0; -k.middle_assertion_stats.negation_cntr = 1; -k.middle_assertion_stats.notequalto_cntr = 0; -k.middle_assertion_stats.pow_cntr = 0; -k.middle_assertion_stats.realconstant_cntr = 1; -k.middle_assertion_stats.sqrt_cntr = 0; -k.middle_assertion_stats.trigonometry_cntr = 0; -k.middle_assertion_stats.true_cntr = 0; -k.middle_assertion_stats.uninterpretedfunction_cntr = 0; -k.middle_assertion_stats.unique_variables = 1; -k.middle_assertion_stats.variable_cntr = 1; -k.middle_literal_stats.abs_cntr = 0; -k.middle_literal_stats.addition_cntr = 0; -k.middle_literal_stats.conjunction_cntr = 0; -k.middle_literal_stats.constant_cntr = 0; -k.middle_literal_stats.disjunction_cntr = 0; -k.middle_literal_stats.division_cntr = 0; -k.middle_literal_stats.equalto_cntr = 1; -k.middle_literal_stats.exp_cntr = 0; -k.middle_literal_stats.false_cntr = 0; -k.middle_literal_stats.forall_cntr = 0; -k.middle_literal_stats.ifthenelse_cntr = 0; -k.middle_literal_stats.inequality_cntr = 0; -k.middle_literal_stats.log_cntr = 0; -k.middle_literal_stats.max_cntr = 0; -k.middle_literal_stats.min_cntr = 0; -k.middle_literal_stats.multiplication_cntr = 0; -k.middle_literal_stats.negation_cntr = 0; -k.middle_literal_stats.notequalto_cntr = 0; -k.middle_literal_stats.pow_cntr = 0; -k.middle_literal_stats.realconstant_cntr = 1; -k.middle_literal_stats.sqrt_cntr = 0; -k.middle_literal_stats.trigonometry_cntr = 0; -k.middle_literal_stats.true_cntr = 0; -k.middle_literal_stats.uninterpretedfunction_cntr = 0; -k.middle_literal_stats.unique_variables = 1; -k.middle_literal_stats.variable_cntr = 1; -k.smallest_assertion_stats.abs_cntr = 0; -k.smallest_assertion_stats.addition_cntr = 1; -k.smallest_assertion_stats.conjunction_cntr = 0; -k.smallest_assertion_stats.constant_cntr = 1; -k.smallest_assertion_stats.disjunction_cntr = 0; -k.smallest_assertion_stats.division_cntr = 0; -k.smallest_assertion_stats.equalto_cntr = 1; -k.smallest_assertion_stats.exp_cntr = 0; -k.smallest_assertion_stats.false_cntr = 0; -k.smallest_assertion_stats.forall_cntr = 0; -k.smallest_assertion_stats.ifthenelse_cntr = 0; -k.smallest_assertion_stats.inequality_cntr = 0; -k.smallest_assertion_stats.log_cntr = 0; -k.smallest_assertion_stats.max_cntr = 0; -k.smallest_assertion_stats.min_cntr = 0; -k.smallest_assertion_stats.multiplication_cntr = 0; -k.smallest_assertion_stats.negation_cntr = 0; -k.smallest_assertion_stats.notequalto_cntr = 0; -k.smallest_assertion_stats.pow_cntr = 0; -k.smallest_assertion_stats.realconstant_cntr = 0; -k.smallest_assertion_stats.sqrt_cntr = 0; -k.smallest_assertion_stats.trigonometry_cntr = 0; -k.smallest_assertion_stats.true_cntr = 0; -k.smallest_assertion_stats.uninterpretedfunction_cntr = 0; -k.smallest_assertion_stats.unique_variables = 1; -k.smallest_assertion_stats.variable_cntr = 1; -k.smallest_literal_stats.abs_cntr = 0; -k.smallest_literal_stats.addition_cntr = 0; -k.smallest_literal_stats.conjunction_cntr = 0; -k.smallest_literal_stats.constant_cntr = 0; -k.smallest_literal_stats.disjunction_cntr = 0; -k.smallest_literal_stats.division_cntr = 0; -k.smallest_literal_stats.equalto_cntr = 1; -k.smallest_literal_stats.exp_cntr = 0; -k.smallest_literal_stats.false_cntr = 0; -k.smallest_literal_stats.forall_cntr = 0; -k.smallest_literal_stats.ifthenelse_cntr = 0; -k.smallest_literal_stats.inequality_cntr = 0; -k.smallest_literal_stats.log_cntr = 0; -k.smallest_literal_stats.max_cntr = 0; -k.smallest_literal_stats.min_cntr = 0; -k.smallest_literal_stats.multiplication_cntr = 0; -k.smallest_literal_stats.negation_cntr = 0; -k.smallest_literal_stats.notequalto_cntr = 0; -k.smallest_literal_stats.pow_cntr = 0; -k.smallest_literal_stats.realconstant_cntr = 1; -k.smallest_literal_stats.sqrt_cntr = 0; -k.smallest_literal_stats.trigonometry_cntr = 0; -k.smallest_literal_stats.true_cntr = 0; -k.smallest_literal_stats.uninterpretedfunction_cntr = 0; -k.smallest_literal_stats.unique_variables = 1; -k.smallest_literal_stats.variable_cntr = 1; -k.theory_checksat_ms = 0.276103; -expected_value = 0.00021564863787240456; -calculated_value = PatternMatchingHeuristic::calculate(k); -std::cout << "Trial 10736: C++/Python neural inference delta = " << expected_value - calculated_value << std::endl; -EXPECT_NEAR(calculated_value, expected_value, 0.001); - -k.assertions_size = 2104; -k.assertions_stats.abs_cntr = 0; -k.assertions_stats.addition_cntr = 379; -k.assertions_stats.conjunction_cntr = 2104; -k.assertions_stats.constant_cntr = 1099; -k.assertions_stats.disjunction_cntr = 0; -k.assertions_stats.division_cntr = 0; -k.assertions_stats.equalto_cntr = 2097; -k.assertions_stats.exp_cntr = 0; -k.assertions_stats.false_cntr = 0; -k.assertions_stats.forall_cntr = 0; -k.assertions_stats.ifthenelse_cntr = 0; -k.assertions_stats.inequality_cntr = 7; -k.assertions_stats.log_cntr = 0; -k.assertions_stats.max_cntr = 0; -k.assertions_stats.min_cntr = 0; -k.assertions_stats.multiplication_cntr = 335; -k.assertions_stats.negation_cntr = 1375; -k.assertions_stats.notequalto_cntr = 0; -k.assertions_stats.pow_cntr = 1; -k.assertions_stats.realconstant_cntr = 1328; -k.assertions_stats.sqrt_cntr = 0; -k.assertions_stats.trigonometry_cntr = 0; -k.assertions_stats.true_cntr = 0; -k.assertions_stats.uninterpretedfunction_cntr = 0; -k.assertions_stats.unique_variables = 24; -k.assertions_stats.variable_cntr = 2139; -k.biggest_assertion_stats.abs_cntr = 0; -k.biggest_assertion_stats.addition_cntr = 4; -k.biggest_assertion_stats.conjunction_cntr = 0; -k.biggest_assertion_stats.constant_cntr = 6; -k.biggest_assertion_stats.disjunction_cntr = 0; -k.biggest_assertion_stats.division_cntr = 0; -k.biggest_assertion_stats.equalto_cntr = 1; -k.biggest_assertion_stats.exp_cntr = 0; -k.biggest_assertion_stats.false_cntr = 0; -k.biggest_assertion_stats.forall_cntr = 0; -k.biggest_assertion_stats.ifthenelse_cntr = 0; -k.biggest_assertion_stats.inequality_cntr = 0; -k.biggest_assertion_stats.log_cntr = 0; -k.biggest_assertion_stats.max_cntr = 0; -k.biggest_assertion_stats.min_cntr = 0; -k.biggest_assertion_stats.multiplication_cntr = 6; -k.biggest_assertion_stats.negation_cntr = 0; -k.biggest_assertion_stats.notequalto_cntr = 0; -k.biggest_assertion_stats.pow_cntr = 0; -k.biggest_assertion_stats.realconstant_cntr = 0; -k.biggest_assertion_stats.sqrt_cntr = 0; -k.biggest_assertion_stats.trigonometry_cntr = 0; -k.biggest_assertion_stats.true_cntr = 0; -k.biggest_assertion_stats.uninterpretedfunction_cntr = 0; -k.biggest_assertion_stats.unique_variables = 7; -k.biggest_assertion_stats.variable_cntr = 8; -k.biggest_literal_stats.abs_cntr = 0; -k.biggest_literal_stats.addition_cntr = 0; -k.biggest_literal_stats.conjunction_cntr = 0; -k.biggest_literal_stats.constant_cntr = 0; -k.biggest_literal_stats.disjunction_cntr = 0; -k.biggest_literal_stats.division_cntr = 0; -k.biggest_literal_stats.equalto_cntr = 1; -k.biggest_literal_stats.exp_cntr = 0; -k.biggest_literal_stats.false_cntr = 0; -k.biggest_literal_stats.forall_cntr = 0; -k.biggest_literal_stats.ifthenelse_cntr = 0; -k.biggest_literal_stats.inequality_cntr = 0; -k.biggest_literal_stats.log_cntr = 0; -k.biggest_literal_stats.max_cntr = 0; -k.biggest_literal_stats.min_cntr = 0; -k.biggest_literal_stats.multiplication_cntr = 0; -k.biggest_literal_stats.negation_cntr = 0; -k.biggest_literal_stats.notequalto_cntr = 0; -k.biggest_literal_stats.pow_cntr = 0; -k.biggest_literal_stats.realconstant_cntr = 1; -k.biggest_literal_stats.sqrt_cntr = 0; -k.biggest_literal_stats.trigonometry_cntr = 0; -k.biggest_literal_stats.true_cntr = 0; -k.biggest_literal_stats.uninterpretedfunction_cntr = 0; -k.biggest_literal_stats.unique_variables = 1; -k.biggest_literal_stats.variable_cntr = 1; -k.box_boolean_count = 0; -k.box_continuous_count = 23; -k.box_integer_count = 1; -k.lemma_size = 2; -k.middle_assertion_stats.abs_cntr = 0; -k.middle_assertion_stats.addition_cntr = 1; -k.middle_assertion_stats.conjunction_cntr = 0; -k.middle_assertion_stats.constant_cntr = 1; -k.middle_assertion_stats.disjunction_cntr = 0; -k.middle_assertion_stats.division_cntr = 0; -k.middle_assertion_stats.equalto_cntr = 1; -k.middle_assertion_stats.exp_cntr = 0; -k.middle_assertion_stats.false_cntr = 0; -k.middle_assertion_stats.forall_cntr = 0; -k.middle_assertion_stats.ifthenelse_cntr = 0; -k.middle_assertion_stats.inequality_cntr = 0; -k.middle_assertion_stats.log_cntr = 0; -k.middle_assertion_stats.max_cntr = 0; -k.middle_assertion_stats.min_cntr = 0; -k.middle_assertion_stats.multiplication_cntr = 0; -k.middle_assertion_stats.negation_cntr = 0; -k.middle_assertion_stats.notequalto_cntr = 0; -k.middle_assertion_stats.pow_cntr = 0; -k.middle_assertion_stats.realconstant_cntr = 0; -k.middle_assertion_stats.sqrt_cntr = 0; -k.middle_assertion_stats.trigonometry_cntr = 0; -k.middle_assertion_stats.true_cntr = 0; -k.middle_assertion_stats.uninterpretedfunction_cntr = 0; -k.middle_assertion_stats.unique_variables = 1; -k.middle_assertion_stats.variable_cntr = 1; -k.middle_literal_stats.abs_cntr = 0; -k.middle_literal_stats.addition_cntr = 0; -k.middle_literal_stats.conjunction_cntr = 0; -k.middle_literal_stats.constant_cntr = 0; -k.middle_literal_stats.disjunction_cntr = 0; -k.middle_literal_stats.division_cntr = 0; -k.middle_literal_stats.equalto_cntr = 1; -k.middle_literal_stats.exp_cntr = 0; -k.middle_literal_stats.false_cntr = 0; -k.middle_literal_stats.forall_cntr = 0; -k.middle_literal_stats.ifthenelse_cntr = 0; -k.middle_literal_stats.inequality_cntr = 0; -k.middle_literal_stats.log_cntr = 0; -k.middle_literal_stats.max_cntr = 0; -k.middle_literal_stats.min_cntr = 0; -k.middle_literal_stats.multiplication_cntr = 0; -k.middle_literal_stats.negation_cntr = 0; -k.middle_literal_stats.notequalto_cntr = 0; -k.middle_literal_stats.pow_cntr = 0; -k.middle_literal_stats.realconstant_cntr = 1; -k.middle_literal_stats.sqrt_cntr = 0; -k.middle_literal_stats.trigonometry_cntr = 0; -k.middle_literal_stats.true_cntr = 0; -k.middle_literal_stats.uninterpretedfunction_cntr = 0; -k.middle_literal_stats.unique_variables = 1; -k.middle_literal_stats.variable_cntr = 1; -k.smallest_assertion_stats.abs_cntr = 0; -k.smallest_assertion_stats.addition_cntr = 0; -k.smallest_assertion_stats.conjunction_cntr = 0; -k.smallest_assertion_stats.constant_cntr = 0; -k.smallest_assertion_stats.disjunction_cntr = 0; -k.smallest_assertion_stats.division_cntr = 0; -k.smallest_assertion_stats.equalto_cntr = 1; -k.smallest_assertion_stats.exp_cntr = 0; -k.smallest_assertion_stats.false_cntr = 0; -k.smallest_assertion_stats.forall_cntr = 0; -k.smallest_assertion_stats.ifthenelse_cntr = 0; -k.smallest_assertion_stats.inequality_cntr = 0; -k.smallest_assertion_stats.log_cntr = 0; -k.smallest_assertion_stats.max_cntr = 0; -k.smallest_assertion_stats.min_cntr = 0; -k.smallest_assertion_stats.multiplication_cntr = 0; -k.smallest_assertion_stats.negation_cntr = 1; -k.smallest_assertion_stats.notequalto_cntr = 0; -k.smallest_assertion_stats.pow_cntr = 0; -k.smallest_assertion_stats.realconstant_cntr = 1; -k.smallest_assertion_stats.sqrt_cntr = 0; -k.smallest_assertion_stats.trigonometry_cntr = 0; -k.smallest_assertion_stats.true_cntr = 0; -k.smallest_assertion_stats.uninterpretedfunction_cntr = 0; -k.smallest_assertion_stats.unique_variables = 1; -k.smallest_assertion_stats.variable_cntr = 1; -k.smallest_literal_stats.abs_cntr = 0; -k.smallest_literal_stats.addition_cntr = 0; -k.smallest_literal_stats.conjunction_cntr = 0; -k.smallest_literal_stats.constant_cntr = 0; -k.smallest_literal_stats.disjunction_cntr = 0; -k.smallest_literal_stats.division_cntr = 0; -k.smallest_literal_stats.equalto_cntr = 1; -k.smallest_literal_stats.exp_cntr = 0; -k.smallest_literal_stats.false_cntr = 0; -k.smallest_literal_stats.forall_cntr = 0; -k.smallest_literal_stats.ifthenelse_cntr = 0; -k.smallest_literal_stats.inequality_cntr = 0; -k.smallest_literal_stats.log_cntr = 0; -k.smallest_literal_stats.max_cntr = 0; -k.smallest_literal_stats.min_cntr = 0; -k.smallest_literal_stats.multiplication_cntr = 0; -k.smallest_literal_stats.negation_cntr = 0; -k.smallest_literal_stats.notequalto_cntr = 0; -k.smallest_literal_stats.pow_cntr = 0; -k.smallest_literal_stats.realconstant_cntr = 1; -k.smallest_literal_stats.sqrt_cntr = 0; -k.smallest_literal_stats.trigonometry_cntr = 0; -k.smallest_literal_stats.true_cntr = 0; -k.smallest_literal_stats.uninterpretedfunction_cntr = 0; -k.smallest_literal_stats.unique_variables = 1; -k.smallest_literal_stats.variable_cntr = 1; -k.theory_checksat_ms = 0.16993; -expected_value = 6.504819201251068e-07; -calculated_value = PatternMatchingHeuristic::calculate(k); -std::cout << "Trial 10372: C++/Python neural inference delta = " << expected_value - calculated_value << std::endl; -EXPECT_NEAR(calculated_value, expected_value, 0.001); - -k.assertions_size = 2634; -k.assertions_stats.abs_cntr = 0; -k.assertions_stats.addition_cntr = 1130; -k.assertions_stats.conjunction_cntr = 2634; -k.assertions_stats.constant_cntr = 2309; -k.assertions_stats.disjunction_cntr = 0; -k.assertions_stats.division_cntr = 0; -k.assertions_stats.equalto_cntr = 1887; -k.assertions_stats.exp_cntr = 0; -k.assertions_stats.false_cntr = 0; -k.assertions_stats.forall_cntr = 0; -k.assertions_stats.ifthenelse_cntr = 0; -k.assertions_stats.inequality_cntr = 747; -k.assertions_stats.log_cntr = 0; -k.assertions_stats.max_cntr = 0; -k.assertions_stats.min_cntr = 0; -k.assertions_stats.multiplication_cntr = 1276; -k.assertions_stats.negation_cntr = 662; -k.assertions_stats.notequalto_cntr = 0; -k.assertions_stats.pow_cntr = 64; -k.assertions_stats.realconstant_cntr = 0; -k.assertions_stats.sqrt_cntr = 0; -k.assertions_stats.trigonometry_cntr = 0; -k.assertions_stats.true_cntr = 0; -k.assertions_stats.uninterpretedfunction_cntr = 0; -k.assertions_stats.unique_variables = 1619; -k.assertions_stats.variable_cntr = 5302; -k.biggest_assertion_stats.abs_cntr = 0; -k.biggest_assertion_stats.addition_cntr = 2; -k.biggest_assertion_stats.conjunction_cntr = 0; -k.biggest_assertion_stats.constant_cntr = 0; -k.biggest_assertion_stats.disjunction_cntr = 0; -k.biggest_assertion_stats.division_cntr = 0; -k.biggest_assertion_stats.equalto_cntr = 1; -k.biggest_assertion_stats.exp_cntr = 0; -k.biggest_assertion_stats.false_cntr = 0; -k.biggest_assertion_stats.forall_cntr = 0; -k.biggest_assertion_stats.ifthenelse_cntr = 0; -k.biggest_assertion_stats.inequality_cntr = 0; -k.biggest_assertion_stats.log_cntr = 0; -k.biggest_assertion_stats.max_cntr = 0; -k.biggest_assertion_stats.min_cntr = 0; -k.biggest_assertion_stats.multiplication_cntr = 0; -k.biggest_assertion_stats.negation_cntr = 0; -k.biggest_assertion_stats.notequalto_cntr = 0; -k.biggest_assertion_stats.pow_cntr = 0; -k.biggest_assertion_stats.realconstant_cntr = 0; -k.biggest_assertion_stats.sqrt_cntr = 0; -k.biggest_assertion_stats.trigonometry_cntr = 0; -k.biggest_assertion_stats.true_cntr = 0; -k.biggest_assertion_stats.uninterpretedfunction_cntr = 0; -k.biggest_assertion_stats.unique_variables = 3; -k.biggest_assertion_stats.variable_cntr = 3; -k.biggest_literal_stats.abs_cntr = 0; -k.biggest_literal_stats.addition_cntr = 0; -k.biggest_literal_stats.conjunction_cntr = 0; -k.biggest_literal_stats.constant_cntr = 0; -k.biggest_literal_stats.disjunction_cntr = 0; -k.biggest_literal_stats.division_cntr = 0; -k.biggest_literal_stats.equalto_cntr = 1; -k.biggest_literal_stats.exp_cntr = 0; -k.biggest_literal_stats.false_cntr = 0; -k.biggest_literal_stats.forall_cntr = 0; -k.biggest_literal_stats.ifthenelse_cntr = 0; -k.biggest_literal_stats.inequality_cntr = 0; -k.biggest_literal_stats.log_cntr = 0; -k.biggest_literal_stats.max_cntr = 0; -k.biggest_literal_stats.min_cntr = 0; -k.biggest_literal_stats.multiplication_cntr = 0; -k.biggest_literal_stats.negation_cntr = 0; -k.biggest_literal_stats.notequalto_cntr = 0; -k.biggest_literal_stats.pow_cntr = 0; -k.biggest_literal_stats.realconstant_cntr = 0; -k.biggest_literal_stats.sqrt_cntr = 0; -k.biggest_literal_stats.trigonometry_cntr = 0; -k.biggest_literal_stats.true_cntr = 0; -k.biggest_literal_stats.uninterpretedfunction_cntr = 0; -k.biggest_literal_stats.unique_variables = 2; -k.biggest_literal_stats.variable_cntr = 2; -k.box_boolean_count = 4406; -k.box_continuous_count = 1619; -k.box_integer_count = 0; -k.lemma_size = 6; -k.middle_assertion_stats.abs_cntr = 0; -k.middle_assertion_stats.addition_cntr = 0; -k.middle_assertion_stats.conjunction_cntr = 0; -k.middle_assertion_stats.constant_cntr = 1; -k.middle_assertion_stats.disjunction_cntr = 0; -k.middle_assertion_stats.division_cntr = 0; -k.middle_assertion_stats.equalto_cntr = 1; -k.middle_assertion_stats.exp_cntr = 0; -k.middle_assertion_stats.false_cntr = 0; -k.middle_assertion_stats.forall_cntr = 0; -k.middle_assertion_stats.ifthenelse_cntr = 0; -k.middle_assertion_stats.inequality_cntr = 0; -k.middle_assertion_stats.log_cntr = 0; -k.middle_assertion_stats.max_cntr = 0; -k.middle_assertion_stats.min_cntr = 0; -k.middle_assertion_stats.multiplication_cntr = 1; -k.middle_assertion_stats.negation_cntr = 0; -k.middle_assertion_stats.notequalto_cntr = 0; -k.middle_assertion_stats.pow_cntr = 0; -k.middle_assertion_stats.realconstant_cntr = 0; -k.middle_assertion_stats.sqrt_cntr = 0; -k.middle_assertion_stats.trigonometry_cntr = 0; -k.middle_assertion_stats.true_cntr = 0; -k.middle_assertion_stats.uninterpretedfunction_cntr = 0; -k.middle_assertion_stats.unique_variables = 2; -k.middle_assertion_stats.variable_cntr = 2; -k.middle_literal_stats.abs_cntr = 0; -k.middle_literal_stats.addition_cntr = 0; -k.middle_literal_stats.conjunction_cntr = 0; -k.middle_literal_stats.constant_cntr = 1; -k.middle_literal_stats.disjunction_cntr = 0; -k.middle_literal_stats.division_cntr = 0; -k.middle_literal_stats.equalto_cntr = 1; -k.middle_literal_stats.exp_cntr = 0; -k.middle_literal_stats.false_cntr = 0; -k.middle_literal_stats.forall_cntr = 0; -k.middle_literal_stats.ifthenelse_cntr = 0; -k.middle_literal_stats.inequality_cntr = 0; -k.middle_literal_stats.log_cntr = 0; -k.middle_literal_stats.max_cntr = 0; -k.middle_literal_stats.min_cntr = 0; -k.middle_literal_stats.multiplication_cntr = 0; -k.middle_literal_stats.negation_cntr = 0; -k.middle_literal_stats.notequalto_cntr = 0; -k.middle_literal_stats.pow_cntr = 0; -k.middle_literal_stats.realconstant_cntr = 0; -k.middle_literal_stats.sqrt_cntr = 0; -k.middle_literal_stats.trigonometry_cntr = 0; -k.middle_literal_stats.true_cntr = 0; -k.middle_literal_stats.uninterpretedfunction_cntr = 0; -k.middle_literal_stats.unique_variables = 1; -k.middle_literal_stats.variable_cntr = 1; -k.smallest_assertion_stats.abs_cntr = 0; -k.smallest_assertion_stats.addition_cntr = 0; -k.smallest_assertion_stats.conjunction_cntr = 0; -k.smallest_assertion_stats.constant_cntr = 1; -k.smallest_assertion_stats.disjunction_cntr = 0; -k.smallest_assertion_stats.division_cntr = 0; -k.smallest_assertion_stats.equalto_cntr = 0; -k.smallest_assertion_stats.exp_cntr = 0; -k.smallest_assertion_stats.false_cntr = 0; -k.smallest_assertion_stats.forall_cntr = 0; -k.smallest_assertion_stats.ifthenelse_cntr = 0; -k.smallest_assertion_stats.inequality_cntr = 1; -k.smallest_assertion_stats.log_cntr = 0; -k.smallest_assertion_stats.max_cntr = 0; -k.smallest_assertion_stats.min_cntr = 0; -k.smallest_assertion_stats.multiplication_cntr = 0; -k.smallest_assertion_stats.negation_cntr = 1; -k.smallest_assertion_stats.notequalto_cntr = 0; -k.smallest_assertion_stats.pow_cntr = 0; -k.smallest_assertion_stats.realconstant_cntr = 0; -k.smallest_assertion_stats.sqrt_cntr = 0; -k.smallest_assertion_stats.trigonometry_cntr = 0; -k.smallest_assertion_stats.true_cntr = 0; -k.smallest_assertion_stats.uninterpretedfunction_cntr = 0; -k.smallest_assertion_stats.unique_variables = 1; -k.smallest_assertion_stats.variable_cntr = 1; -k.smallest_literal_stats.abs_cntr = 0; -k.smallest_literal_stats.addition_cntr = 0; -k.smallest_literal_stats.conjunction_cntr = 0; -k.smallest_literal_stats.constant_cntr = 1; -k.smallest_literal_stats.disjunction_cntr = 0; -k.smallest_literal_stats.division_cntr = 0; -k.smallest_literal_stats.equalto_cntr = 0; -k.smallest_literal_stats.exp_cntr = 0; -k.smallest_literal_stats.false_cntr = 0; -k.smallest_literal_stats.forall_cntr = 0; -k.smallest_literal_stats.ifthenelse_cntr = 0; -k.smallest_literal_stats.inequality_cntr = 1; -k.smallest_literal_stats.log_cntr = 0; -k.smallest_literal_stats.max_cntr = 0; -k.smallest_literal_stats.min_cntr = 0; -k.smallest_literal_stats.multiplication_cntr = 0; -k.smallest_literal_stats.negation_cntr = 0; -k.smallest_literal_stats.notequalto_cntr = 0; -k.smallest_literal_stats.pow_cntr = 0; -k.smallest_literal_stats.realconstant_cntr = 0; -k.smallest_literal_stats.sqrt_cntr = 0; -k.smallest_literal_stats.trigonometry_cntr = 0; -k.smallest_literal_stats.true_cntr = 0; -k.smallest_literal_stats.uninterpretedfunction_cntr = 0; -k.smallest_literal_stats.unique_variables = 1; -k.smallest_literal_stats.variable_cntr = 1; -k.theory_checksat_ms = 11.4709; -expected_value = 0.3956353498959523; -calculated_value = PatternMatchingHeuristic::calculate(k); -std::cout << "Trial 16696: C++/Python neural inference delta = " << expected_value - calculated_value << std::endl; -EXPECT_NEAR(calculated_value, expected_value, 0.001); - -k.assertions_size = 2785; -k.assertions_stats.abs_cntr = 0; -k.assertions_stats.addition_cntr = 1222; -k.assertions_stats.conjunction_cntr = 2785; -k.assertions_stats.constant_cntr = 2105; -k.assertions_stats.disjunction_cntr = 0; -k.assertions_stats.division_cntr = 0; -k.assertions_stats.equalto_cntr = 1631; -k.assertions_stats.exp_cntr = 0; -k.assertions_stats.false_cntr = 0; -k.assertions_stats.forall_cntr = 0; -k.assertions_stats.ifthenelse_cntr = 0; -k.assertions_stats.inequality_cntr = 1154; -k.assertions_stats.log_cntr = 0; -k.assertions_stats.max_cntr = 0; -k.assertions_stats.min_cntr = 0; -k.assertions_stats.multiplication_cntr = 720; -k.assertions_stats.negation_cntr = 929; -k.assertions_stats.notequalto_cntr = 0; -k.assertions_stats.pow_cntr = 62; -k.assertions_stats.realconstant_cntr = 0; -k.assertions_stats.sqrt_cntr = 0; -k.assertions_stats.trigonometry_cntr = 0; -k.assertions_stats.true_cntr = 0; -k.assertions_stats.uninterpretedfunction_cntr = 0; -k.assertions_stats.unique_variables = 1455; -k.assertions_stats.variable_cntr = 5018; -k.biggest_assertion_stats.abs_cntr = 0; -k.biggest_assertion_stats.addition_cntr = 0; -k.biggest_assertion_stats.conjunction_cntr = 0; -k.biggest_assertion_stats.constant_cntr = 2; -k.biggest_assertion_stats.disjunction_cntr = 0; -k.biggest_assertion_stats.division_cntr = 0; -k.biggest_assertion_stats.equalto_cntr = 1; -k.biggest_assertion_stats.exp_cntr = 0; -k.biggest_assertion_stats.false_cntr = 0; -k.biggest_assertion_stats.forall_cntr = 0; -k.biggest_assertion_stats.ifthenelse_cntr = 0; -k.biggest_assertion_stats.inequality_cntr = 0; -k.biggest_assertion_stats.log_cntr = 0; -k.biggest_assertion_stats.max_cntr = 0; -k.biggest_assertion_stats.min_cntr = 0; -k.biggest_assertion_stats.multiplication_cntr = 2; -k.biggest_assertion_stats.negation_cntr = 0; -k.biggest_assertion_stats.notequalto_cntr = 0; -k.biggest_assertion_stats.pow_cntr = 0; -k.biggest_assertion_stats.realconstant_cntr = 0; -k.biggest_assertion_stats.sqrt_cntr = 0; -k.biggest_assertion_stats.trigonometry_cntr = 0; -k.biggest_assertion_stats.true_cntr = 0; -k.biggest_assertion_stats.uninterpretedfunction_cntr = 0; -k.biggest_assertion_stats.unique_variables = 3; -k.biggest_assertion_stats.variable_cntr = 3; -k.biggest_literal_stats.abs_cntr = 0; -k.biggest_literal_stats.addition_cntr = 0; -k.biggest_literal_stats.conjunction_cntr = 0; -k.biggest_literal_stats.constant_cntr = 1; -k.biggest_literal_stats.disjunction_cntr = 0; -k.biggest_literal_stats.division_cntr = 0; -k.biggest_literal_stats.equalto_cntr = 1; -k.biggest_literal_stats.exp_cntr = 0; -k.biggest_literal_stats.false_cntr = 0; -k.biggest_literal_stats.forall_cntr = 0; -k.biggest_literal_stats.ifthenelse_cntr = 0; -k.biggest_literal_stats.inequality_cntr = 0; -k.biggest_literal_stats.log_cntr = 0; -k.biggest_literal_stats.max_cntr = 0; -k.biggest_literal_stats.min_cntr = 0; -k.biggest_literal_stats.multiplication_cntr = 0; -k.biggest_literal_stats.negation_cntr = 0; -k.biggest_literal_stats.notequalto_cntr = 0; -k.biggest_literal_stats.pow_cntr = 0; -k.biggest_literal_stats.realconstant_cntr = 0; -k.biggest_literal_stats.sqrt_cntr = 0; -k.biggest_literal_stats.trigonometry_cntr = 0; -k.biggest_literal_stats.true_cntr = 0; -k.biggest_literal_stats.uninterpretedfunction_cntr = 0; -k.biggest_literal_stats.unique_variables = 1; -k.biggest_literal_stats.variable_cntr = 1; -k.box_boolean_count = 7697; -k.box_continuous_count = 1455; -k.box_integer_count = 0; -k.lemma_size = 2; -k.middle_assertion_stats.abs_cntr = 0; -k.middle_assertion_stats.addition_cntr = 0; -k.middle_assertion_stats.conjunction_cntr = 0; -k.middle_assertion_stats.constant_cntr = 1; -k.middle_assertion_stats.disjunction_cntr = 0; -k.middle_assertion_stats.division_cntr = 0; -k.middle_assertion_stats.equalto_cntr = 1; -k.middle_assertion_stats.exp_cntr = 0; -k.middle_assertion_stats.false_cntr = 0; -k.middle_assertion_stats.forall_cntr = 0; -k.middle_assertion_stats.ifthenelse_cntr = 0; -k.middle_assertion_stats.inequality_cntr = 0; -k.middle_assertion_stats.log_cntr = 0; -k.middle_assertion_stats.max_cntr = 0; -k.middle_assertion_stats.min_cntr = 0; -k.middle_assertion_stats.multiplication_cntr = 1; -k.middle_assertion_stats.negation_cntr = 0; -k.middle_assertion_stats.notequalto_cntr = 0; -k.middle_assertion_stats.pow_cntr = 0; -k.middle_assertion_stats.realconstant_cntr = 0; -k.middle_assertion_stats.sqrt_cntr = 0; -k.middle_assertion_stats.trigonometry_cntr = 0; -k.middle_assertion_stats.true_cntr = 0; -k.middle_assertion_stats.uninterpretedfunction_cntr = 0; -k.middle_assertion_stats.unique_variables = 2; -k.middle_assertion_stats.variable_cntr = 2; -k.middle_literal_stats.abs_cntr = 0; -k.middle_literal_stats.addition_cntr = 0; -k.middle_literal_stats.conjunction_cntr = 0; -k.middle_literal_stats.constant_cntr = 1; -k.middle_literal_stats.disjunction_cntr = 0; -k.middle_literal_stats.division_cntr = 0; -k.middle_literal_stats.equalto_cntr = 0; -k.middle_literal_stats.exp_cntr = 0; -k.middle_literal_stats.false_cntr = 0; -k.middle_literal_stats.forall_cntr = 0; -k.middle_literal_stats.ifthenelse_cntr = 0; -k.middle_literal_stats.inequality_cntr = 1; -k.middle_literal_stats.log_cntr = 0; -k.middle_literal_stats.max_cntr = 0; -k.middle_literal_stats.min_cntr = 0; -k.middle_literal_stats.multiplication_cntr = 0; -k.middle_literal_stats.negation_cntr = 1; -k.middle_literal_stats.notequalto_cntr = 0; -k.middle_literal_stats.pow_cntr = 0; -k.middle_literal_stats.realconstant_cntr = 0; -k.middle_literal_stats.sqrt_cntr = 0; -k.middle_literal_stats.trigonometry_cntr = 0; -k.middle_literal_stats.true_cntr = 0; -k.middle_literal_stats.uninterpretedfunction_cntr = 0; -k.middle_literal_stats.unique_variables = 1; -k.middle_literal_stats.variable_cntr = 1; -k.smallest_assertion_stats.abs_cntr = 0; -k.smallest_assertion_stats.addition_cntr = 0; -k.smallest_assertion_stats.conjunction_cntr = 0; -k.smallest_assertion_stats.constant_cntr = 1; -k.smallest_assertion_stats.disjunction_cntr = 0; -k.smallest_assertion_stats.division_cntr = 0; -k.smallest_assertion_stats.equalto_cntr = 0; -k.smallest_assertion_stats.exp_cntr = 0; -k.smallest_assertion_stats.false_cntr = 0; -k.smallest_assertion_stats.forall_cntr = 0; -k.smallest_assertion_stats.ifthenelse_cntr = 0; -k.smallest_assertion_stats.inequality_cntr = 1; -k.smallest_assertion_stats.log_cntr = 0; -k.smallest_assertion_stats.max_cntr = 0; -k.smallest_assertion_stats.min_cntr = 0; -k.smallest_assertion_stats.multiplication_cntr = 0; -k.smallest_assertion_stats.negation_cntr = 1; -k.smallest_assertion_stats.notequalto_cntr = 0; -k.smallest_assertion_stats.pow_cntr = 0; -k.smallest_assertion_stats.realconstant_cntr = 0; -k.smallest_assertion_stats.sqrt_cntr = 0; -k.smallest_assertion_stats.trigonometry_cntr = 0; -k.smallest_assertion_stats.true_cntr = 0; -k.smallest_assertion_stats.uninterpretedfunction_cntr = 0; -k.smallest_assertion_stats.unique_variables = 1; -k.smallest_assertion_stats.variable_cntr = 1; -k.smallest_literal_stats.abs_cntr = 0; -k.smallest_literal_stats.addition_cntr = 0; -k.smallest_literal_stats.conjunction_cntr = 0; -k.smallest_literal_stats.constant_cntr = 1; -k.smallest_literal_stats.disjunction_cntr = 0; -k.smallest_literal_stats.division_cntr = 0; -k.smallest_literal_stats.equalto_cntr = 0; -k.smallest_literal_stats.exp_cntr = 0; -k.smallest_literal_stats.false_cntr = 0; -k.smallest_literal_stats.forall_cntr = 0; -k.smallest_literal_stats.ifthenelse_cntr = 0; -k.smallest_literal_stats.inequality_cntr = 1; -k.smallest_literal_stats.log_cntr = 0; -k.smallest_literal_stats.max_cntr = 0; -k.smallest_literal_stats.min_cntr = 0; -k.smallest_literal_stats.multiplication_cntr = 0; -k.smallest_literal_stats.negation_cntr = 1; -k.smallest_literal_stats.notequalto_cntr = 0; -k.smallest_literal_stats.pow_cntr = 0; -k.smallest_literal_stats.realconstant_cntr = 0; -k.smallest_literal_stats.sqrt_cntr = 0; -k.smallest_literal_stats.trigonometry_cntr = 0; -k.smallest_literal_stats.true_cntr = 0; -k.smallest_literal_stats.uninterpretedfunction_cntr = 0; -k.smallest_literal_stats.unique_variables = 1; -k.smallest_literal_stats.variable_cntr = 1; -k.theory_checksat_ms = 0.226032; -expected_value = 0.3314437657064444; -calculated_value = PatternMatchingHeuristic::calculate(k); -std::cout << "Trial 15562: C++/Python neural inference delta = " << expected_value - calculated_value << std::endl; -EXPECT_NEAR(calculated_value, expected_value, 0.001); - -k.assertions_size = 91; -k.assertions_stats.abs_cntr = 0; -k.assertions_stats.addition_cntr = 118; -k.assertions_stats.conjunction_cntr = 91; -k.assertions_stats.constant_cntr = 91; -k.assertions_stats.disjunction_cntr = 0; -k.assertions_stats.division_cntr = 0; -k.assertions_stats.equalto_cntr = 0; -k.assertions_stats.exp_cntr = 0; -k.assertions_stats.false_cntr = 0; -k.assertions_stats.forall_cntr = 0; -k.assertions_stats.ifthenelse_cntr = 0; -k.assertions_stats.inequality_cntr = 91; -k.assertions_stats.log_cntr = 0; -k.assertions_stats.max_cntr = 0; -k.assertions_stats.min_cntr = 0; -k.assertions_stats.multiplication_cntr = 0; -k.assertions_stats.negation_cntr = 31; -k.assertions_stats.notequalto_cntr = 0; -k.assertions_stats.pow_cntr = 0; -k.assertions_stats.realconstant_cntr = 0; -k.assertions_stats.sqrt_cntr = 0; -k.assertions_stats.trigonometry_cntr = 0; -k.assertions_stats.true_cntr = 0; -k.assertions_stats.uninterpretedfunction_cntr = 0; -k.assertions_stats.unique_variables = 16; -k.assertions_stats.variable_cntr = 150; -k.biggest_assertion_stats.abs_cntr = 0; -k.biggest_assertion_stats.addition_cntr = 2; -k.biggest_assertion_stats.conjunction_cntr = 0; -k.biggest_assertion_stats.constant_cntr = 1; -k.biggest_assertion_stats.disjunction_cntr = 0; -k.biggest_assertion_stats.division_cntr = 0; -k.biggest_assertion_stats.equalto_cntr = 0; -k.biggest_assertion_stats.exp_cntr = 0; -k.biggest_assertion_stats.false_cntr = 0; -k.biggest_assertion_stats.forall_cntr = 0; -k.biggest_assertion_stats.ifthenelse_cntr = 0; -k.biggest_assertion_stats.inequality_cntr = 1; -k.biggest_assertion_stats.log_cntr = 0; -k.biggest_assertion_stats.max_cntr = 0; -k.biggest_assertion_stats.min_cntr = 0; -k.biggest_assertion_stats.multiplication_cntr = 0; -k.biggest_assertion_stats.negation_cntr = 0; -k.biggest_assertion_stats.notequalto_cntr = 0; -k.biggest_assertion_stats.pow_cntr = 0; -k.biggest_assertion_stats.realconstant_cntr = 0; -k.biggest_assertion_stats.sqrt_cntr = 0; -k.biggest_assertion_stats.trigonometry_cntr = 0; -k.biggest_assertion_stats.true_cntr = 0; -k.biggest_assertion_stats.uninterpretedfunction_cntr = 0; -k.biggest_assertion_stats.unique_variables = 2; -k.biggest_assertion_stats.variable_cntr = 2; -k.biggest_literal_stats.abs_cntr = 0; -k.biggest_literal_stats.addition_cntr = 2; -k.biggest_literal_stats.conjunction_cntr = 0; -k.biggest_literal_stats.constant_cntr = 1; -k.biggest_literal_stats.disjunction_cntr = 0; -k.biggest_literal_stats.division_cntr = 0; -k.biggest_literal_stats.equalto_cntr = 0; -k.biggest_literal_stats.exp_cntr = 0; -k.biggest_literal_stats.false_cntr = 0; -k.biggest_literal_stats.forall_cntr = 0; -k.biggest_literal_stats.ifthenelse_cntr = 0; -k.biggest_literal_stats.inequality_cntr = 1; -k.biggest_literal_stats.log_cntr = 0; -k.biggest_literal_stats.max_cntr = 0; -k.biggest_literal_stats.min_cntr = 0; -k.biggest_literal_stats.multiplication_cntr = 0; -k.biggest_literal_stats.negation_cntr = 0; -k.biggest_literal_stats.notequalto_cntr = 0; -k.biggest_literal_stats.pow_cntr = 0; -k.biggest_literal_stats.realconstant_cntr = 0; -k.biggest_literal_stats.sqrt_cntr = 0; -k.biggest_literal_stats.trigonometry_cntr = 0; -k.biggest_literal_stats.true_cntr = 0; -k.biggest_literal_stats.uninterpretedfunction_cntr = 0; -k.biggest_literal_stats.unique_variables = 2; -k.biggest_literal_stats.variable_cntr = 2; -k.box_boolean_count = 0; -k.box_continuous_count = 16; -k.box_integer_count = 0; -k.lemma_size = 33; -k.middle_assertion_stats.abs_cntr = 0; -k.middle_assertion_stats.addition_cntr = 2; -k.middle_assertion_stats.conjunction_cntr = 0; -k.middle_assertion_stats.constant_cntr = 1; -k.middle_assertion_stats.disjunction_cntr = 0; -k.middle_assertion_stats.division_cntr = 0; -k.middle_assertion_stats.equalto_cntr = 0; -k.middle_assertion_stats.exp_cntr = 0; -k.middle_assertion_stats.false_cntr = 0; -k.middle_assertion_stats.forall_cntr = 0; -k.middle_assertion_stats.ifthenelse_cntr = 0; -k.middle_assertion_stats.inequality_cntr = 1; -k.middle_assertion_stats.log_cntr = 0; -k.middle_assertion_stats.max_cntr = 0; -k.middle_assertion_stats.min_cntr = 0; -k.middle_assertion_stats.multiplication_cntr = 0; -k.middle_assertion_stats.negation_cntr = 1; -k.middle_assertion_stats.notequalto_cntr = 0; -k.middle_assertion_stats.pow_cntr = 0; -k.middle_assertion_stats.realconstant_cntr = 0; -k.middle_assertion_stats.sqrt_cntr = 0; -k.middle_assertion_stats.trigonometry_cntr = 0; -k.middle_assertion_stats.true_cntr = 0; -k.middle_assertion_stats.uninterpretedfunction_cntr = 0; -k.middle_assertion_stats.unique_variables = 2; -k.middle_assertion_stats.variable_cntr = 2; -k.middle_literal_stats.abs_cntr = 0; -k.middle_literal_stats.addition_cntr = 2; -k.middle_literal_stats.conjunction_cntr = 0; -k.middle_literal_stats.constant_cntr = 1; -k.middle_literal_stats.disjunction_cntr = 0; -k.middle_literal_stats.division_cntr = 0; -k.middle_literal_stats.equalto_cntr = 0; -k.middle_literal_stats.exp_cntr = 0; -k.middle_literal_stats.false_cntr = 0; -k.middle_literal_stats.forall_cntr = 0; -k.middle_literal_stats.ifthenelse_cntr = 0; -k.middle_literal_stats.inequality_cntr = 1; -k.middle_literal_stats.log_cntr = 0; -k.middle_literal_stats.max_cntr = 0; -k.middle_literal_stats.min_cntr = 0; -k.middle_literal_stats.multiplication_cntr = 0; -k.middle_literal_stats.negation_cntr = 0; -k.middle_literal_stats.notequalto_cntr = 0; -k.middle_literal_stats.pow_cntr = 0; -k.middle_literal_stats.realconstant_cntr = 0; -k.middle_literal_stats.sqrt_cntr = 0; -k.middle_literal_stats.trigonometry_cntr = 0; -k.middle_literal_stats.true_cntr = 0; -k.middle_literal_stats.uninterpretedfunction_cntr = 0; -k.middle_literal_stats.unique_variables = 2; -k.middle_literal_stats.variable_cntr = 2; -k.smallest_assertion_stats.abs_cntr = 0; -k.smallest_assertion_stats.addition_cntr = 0; -k.smallest_assertion_stats.conjunction_cntr = 0; -k.smallest_assertion_stats.constant_cntr = 1; -k.smallest_assertion_stats.disjunction_cntr = 0; -k.smallest_assertion_stats.division_cntr = 0; -k.smallest_assertion_stats.equalto_cntr = 0; -k.smallest_assertion_stats.exp_cntr = 0; -k.smallest_assertion_stats.false_cntr = 0; -k.smallest_assertion_stats.forall_cntr = 0; -k.smallest_assertion_stats.ifthenelse_cntr = 0; -k.smallest_assertion_stats.inequality_cntr = 1; -k.smallest_assertion_stats.log_cntr = 0; -k.smallest_assertion_stats.max_cntr = 0; -k.smallest_assertion_stats.min_cntr = 0; -k.smallest_assertion_stats.multiplication_cntr = 0; -k.smallest_assertion_stats.negation_cntr = 0; -k.smallest_assertion_stats.notequalto_cntr = 0; -k.smallest_assertion_stats.pow_cntr = 0; -k.smallest_assertion_stats.realconstant_cntr = 0; -k.smallest_assertion_stats.sqrt_cntr = 0; -k.smallest_assertion_stats.trigonometry_cntr = 0; -k.smallest_assertion_stats.true_cntr = 0; -k.smallest_assertion_stats.uninterpretedfunction_cntr = 0; -k.smallest_assertion_stats.unique_variables = 1; -k.smallest_assertion_stats.variable_cntr = 1; -k.smallest_literal_stats.abs_cntr = 0; -k.smallest_literal_stats.addition_cntr = 0; -k.smallest_literal_stats.conjunction_cntr = 0; -k.smallest_literal_stats.constant_cntr = 1; -k.smallest_literal_stats.disjunction_cntr = 0; -k.smallest_literal_stats.division_cntr = 0; -k.smallest_literal_stats.equalto_cntr = 0; -k.smallest_literal_stats.exp_cntr = 0; -k.smallest_literal_stats.false_cntr = 0; -k.smallest_literal_stats.forall_cntr = 0; -k.smallest_literal_stats.ifthenelse_cntr = 0; -k.smallest_literal_stats.inequality_cntr = 1; -k.smallest_literal_stats.log_cntr = 0; -k.smallest_literal_stats.max_cntr = 0; -k.smallest_literal_stats.min_cntr = 0; -k.smallest_literal_stats.multiplication_cntr = 0; -k.smallest_literal_stats.negation_cntr = 0; -k.smallest_literal_stats.notequalto_cntr = 0; -k.smallest_literal_stats.pow_cntr = 0; -k.smallest_literal_stats.realconstant_cntr = 0; -k.smallest_literal_stats.sqrt_cntr = 0; -k.smallest_literal_stats.trigonometry_cntr = 0; -k.smallest_literal_stats.true_cntr = 0; -k.smallest_literal_stats.uninterpretedfunction_cntr = 0; -k.smallest_literal_stats.unique_variables = 1; -k.smallest_literal_stats.variable_cntr = 1; -k.theory_checksat_ms = 1.27253; -expected_value = 0.1014047539809046; -calculated_value = PatternMatchingHeuristic::calculate(k); -std::cout << "Trial 1788: C++/Python neural inference delta = " << expected_value - calculated_value << std::endl; -EXPECT_NEAR(calculated_value, expected_value, 0.001); - -k.assertions_size = 2069; -k.assertions_stats.abs_cntr = 0; -k.assertions_stats.addition_cntr = 902; -k.assertions_stats.conjunction_cntr = 2069; -k.assertions_stats.constant_cntr = 1569; -k.assertions_stats.disjunction_cntr = 0; -k.assertions_stats.division_cntr = 0; -k.assertions_stats.equalto_cntr = 1207; -k.assertions_stats.exp_cntr = 0; -k.assertions_stats.false_cntr = 0; -k.assertions_stats.forall_cntr = 0; -k.assertions_stats.ifthenelse_cntr = 0; -k.assertions_stats.inequality_cntr = 862; -k.assertions_stats.log_cntr = 0; -k.assertions_stats.max_cntr = 0; -k.assertions_stats.min_cntr = 0; -k.assertions_stats.multiplication_cntr = 536; -k.assertions_stats.negation_cntr = 505; -k.assertions_stats.notequalto_cntr = 0; -k.assertions_stats.pow_cntr = 46; -k.assertions_stats.realconstant_cntr = 0; -k.assertions_stats.sqrt_cntr = 0; -k.assertions_stats.trigonometry_cntr = 0; -k.assertions_stats.true_cntr = 0; -k.assertions_stats.uninterpretedfunction_cntr = 0; -k.assertions_stats.unique_variables = 1079; -k.assertions_stats.variable_cntr = 3722; -k.biggest_assertion_stats.abs_cntr = 0; -k.biggest_assertion_stats.addition_cntr = 2; -k.biggest_assertion_stats.conjunction_cntr = 0; -k.biggest_assertion_stats.constant_cntr = 0; -k.biggest_assertion_stats.disjunction_cntr = 0; -k.biggest_assertion_stats.division_cntr = 0; -k.biggest_assertion_stats.equalto_cntr = 1; -k.biggest_assertion_stats.exp_cntr = 0; -k.biggest_assertion_stats.false_cntr = 0; -k.biggest_assertion_stats.forall_cntr = 0; -k.biggest_assertion_stats.ifthenelse_cntr = 0; -k.biggest_assertion_stats.inequality_cntr = 0; -k.biggest_assertion_stats.log_cntr = 0; -k.biggest_assertion_stats.max_cntr = 0; -k.biggest_assertion_stats.min_cntr = 0; -k.biggest_assertion_stats.multiplication_cntr = 0; -k.biggest_assertion_stats.negation_cntr = 0; -k.biggest_assertion_stats.notequalto_cntr = 0; -k.biggest_assertion_stats.pow_cntr = 0; -k.biggest_assertion_stats.realconstant_cntr = 0; -k.biggest_assertion_stats.sqrt_cntr = 0; -k.biggest_assertion_stats.trigonometry_cntr = 0; -k.biggest_assertion_stats.true_cntr = 0; -k.biggest_assertion_stats.uninterpretedfunction_cntr = 0; -k.biggest_assertion_stats.unique_variables = 3; -k.biggest_assertion_stats.variable_cntr = 3; -k.biggest_literal_stats.abs_cntr = 0; -k.biggest_literal_stats.addition_cntr = 0; -k.biggest_literal_stats.conjunction_cntr = 0; -k.biggest_literal_stats.constant_cntr = 0; -k.biggest_literal_stats.disjunction_cntr = 0; -k.biggest_literal_stats.division_cntr = 0; -k.biggest_literal_stats.equalto_cntr = 1; -k.biggest_literal_stats.exp_cntr = 0; -k.biggest_literal_stats.false_cntr = 0; -k.biggest_literal_stats.forall_cntr = 0; -k.biggest_literal_stats.ifthenelse_cntr = 0; -k.biggest_literal_stats.inequality_cntr = 0; -k.biggest_literal_stats.log_cntr = 0; -k.biggest_literal_stats.max_cntr = 0; -k.biggest_literal_stats.min_cntr = 0; -k.biggest_literal_stats.multiplication_cntr = 0; -k.biggest_literal_stats.negation_cntr = 0; -k.biggest_literal_stats.notequalto_cntr = 0; -k.biggest_literal_stats.pow_cntr = 0; -k.biggest_literal_stats.realconstant_cntr = 0; -k.biggest_literal_stats.sqrt_cntr = 0; -k.biggest_literal_stats.trigonometry_cntr = 0; -k.biggest_literal_stats.true_cntr = 0; -k.biggest_literal_stats.uninterpretedfunction_cntr = 0; -k.biggest_literal_stats.unique_variables = 2; -k.biggest_literal_stats.variable_cntr = 2; -k.box_boolean_count = 5725; -k.box_continuous_count = 1079; -k.box_integer_count = 0; -k.lemma_size = 11; -k.middle_assertion_stats.abs_cntr = 0; -k.middle_assertion_stats.addition_cntr = 0; -k.middle_assertion_stats.conjunction_cntr = 0; -k.middle_assertion_stats.constant_cntr = 0; -k.middle_assertion_stats.disjunction_cntr = 0; -k.middle_assertion_stats.division_cntr = 0; -k.middle_assertion_stats.equalto_cntr = 0; -k.middle_assertion_stats.exp_cntr = 0; -k.middle_assertion_stats.false_cntr = 0; -k.middle_assertion_stats.forall_cntr = 0; -k.middle_assertion_stats.ifthenelse_cntr = 0; -k.middle_assertion_stats.inequality_cntr = 1; -k.middle_assertion_stats.log_cntr = 0; -k.middle_assertion_stats.max_cntr = 0; -k.middle_assertion_stats.min_cntr = 0; -k.middle_assertion_stats.multiplication_cntr = 0; -k.middle_assertion_stats.negation_cntr = 1; -k.middle_assertion_stats.notequalto_cntr = 0; -k.middle_assertion_stats.pow_cntr = 0; -k.middle_assertion_stats.realconstant_cntr = 0; -k.middle_assertion_stats.sqrt_cntr = 0; -k.middle_assertion_stats.trigonometry_cntr = 0; -k.middle_assertion_stats.true_cntr = 0; -k.middle_assertion_stats.uninterpretedfunction_cntr = 0; -k.middle_assertion_stats.unique_variables = 2; -k.middle_assertion_stats.variable_cntr = 2; -k.middle_literal_stats.abs_cntr = 0; -k.middle_literal_stats.addition_cntr = 0; -k.middle_literal_stats.conjunction_cntr = 0; -k.middle_literal_stats.constant_cntr = 1; -k.middle_literal_stats.disjunction_cntr = 0; -k.middle_literal_stats.division_cntr = 0; -k.middle_literal_stats.equalto_cntr = 0; -k.middle_literal_stats.exp_cntr = 0; -k.middle_literal_stats.false_cntr = 0; -k.middle_literal_stats.forall_cntr = 0; -k.middle_literal_stats.ifthenelse_cntr = 0; -k.middle_literal_stats.inequality_cntr = 1; -k.middle_literal_stats.log_cntr = 0; -k.middle_literal_stats.max_cntr = 0; -k.middle_literal_stats.min_cntr = 0; -k.middle_literal_stats.multiplication_cntr = 0; -k.middle_literal_stats.negation_cntr = 0; -k.middle_literal_stats.notequalto_cntr = 0; -k.middle_literal_stats.pow_cntr = 0; -k.middle_literal_stats.realconstant_cntr = 0; -k.middle_literal_stats.sqrt_cntr = 0; -k.middle_literal_stats.trigonometry_cntr = 0; -k.middle_literal_stats.true_cntr = 0; -k.middle_literal_stats.uninterpretedfunction_cntr = 0; -k.middle_literal_stats.unique_variables = 1; -k.middle_literal_stats.variable_cntr = 1; -k.smallest_assertion_stats.abs_cntr = 0; -k.smallest_assertion_stats.addition_cntr = 0; -k.smallest_assertion_stats.conjunction_cntr = 0; -k.smallest_assertion_stats.constant_cntr = 1; -k.smallest_assertion_stats.disjunction_cntr = 0; -k.smallest_assertion_stats.division_cntr = 0; -k.smallest_assertion_stats.equalto_cntr = 1; -k.smallest_assertion_stats.exp_cntr = 0; -k.smallest_assertion_stats.false_cntr = 0; -k.smallest_assertion_stats.forall_cntr = 0; -k.smallest_assertion_stats.ifthenelse_cntr = 0; -k.smallest_assertion_stats.inequality_cntr = 0; -k.smallest_assertion_stats.log_cntr = 0; -k.smallest_assertion_stats.max_cntr = 0; -k.smallest_assertion_stats.min_cntr = 0; -k.smallest_assertion_stats.multiplication_cntr = 0; -k.smallest_assertion_stats.negation_cntr = 0; -k.smallest_assertion_stats.notequalto_cntr = 0; -k.smallest_assertion_stats.pow_cntr = 0; -k.smallest_assertion_stats.realconstant_cntr = 0; -k.smallest_assertion_stats.sqrt_cntr = 0; -k.smallest_assertion_stats.trigonometry_cntr = 0; -k.smallest_assertion_stats.true_cntr = 0; -k.smallest_assertion_stats.uninterpretedfunction_cntr = 0; -k.smallest_assertion_stats.unique_variables = 1; -k.smallest_assertion_stats.variable_cntr = 1; -k.smallest_literal_stats.abs_cntr = 0; -k.smallest_literal_stats.addition_cntr = 0; -k.smallest_literal_stats.conjunction_cntr = 0; -k.smallest_literal_stats.constant_cntr = 1; -k.smallest_literal_stats.disjunction_cntr = 0; -k.smallest_literal_stats.division_cntr = 0; -k.smallest_literal_stats.equalto_cntr = 0; -k.smallest_literal_stats.exp_cntr = 0; -k.smallest_literal_stats.false_cntr = 0; -k.smallest_literal_stats.forall_cntr = 0; -k.smallest_literal_stats.ifthenelse_cntr = 0; -k.smallest_literal_stats.inequality_cntr = 1; -k.smallest_literal_stats.log_cntr = 0; -k.smallest_literal_stats.max_cntr = 0; -k.smallest_literal_stats.min_cntr = 0; -k.smallest_literal_stats.multiplication_cntr = 0; -k.smallest_literal_stats.negation_cntr = 1; -k.smallest_literal_stats.notequalto_cntr = 0; -k.smallest_literal_stats.pow_cntr = 0; -k.smallest_literal_stats.realconstant_cntr = 0; -k.smallest_literal_stats.sqrt_cntr = 0; -k.smallest_literal_stats.trigonometry_cntr = 0; -k.smallest_literal_stats.true_cntr = 0; -k.smallest_literal_stats.uninterpretedfunction_cntr = 0; -k.smallest_literal_stats.unique_variables = 1; -k.smallest_literal_stats.variable_cntr = 1; -k.theory_checksat_ms = 6.71753; -expected_value = 0.14082359371285263; -calculated_value = PatternMatchingHeuristic::calculate(k); -std::cout << "Trial 16066: C++/Python neural inference delta = " << expected_value - calculated_value << std::endl; -EXPECT_NEAR(calculated_value, expected_value, 0.001); - -k.assertions_size = 89; -k.assertions_stats.abs_cntr = 0; -k.assertions_stats.addition_cntr = 22; -k.assertions_stats.conjunction_cntr = 89; -k.assertions_stats.constant_cntr = 86; -k.assertions_stats.disjunction_cntr = 0; -k.assertions_stats.division_cntr = 0; -k.assertions_stats.equalto_cntr = 34; -k.assertions_stats.exp_cntr = 0; -k.assertions_stats.false_cntr = 0; -k.assertions_stats.forall_cntr = 0; -k.assertions_stats.ifthenelse_cntr = 0; -k.assertions_stats.inequality_cntr = 55; -k.assertions_stats.log_cntr = 0; -k.assertions_stats.max_cntr = 0; -k.assertions_stats.min_cntr = 0; -k.assertions_stats.multiplication_cntr = 21; -k.assertions_stats.negation_cntr = 16; -k.assertions_stats.notequalto_cntr = 0; -k.assertions_stats.pow_cntr = 2; -k.assertions_stats.realconstant_cntr = 0; -k.assertions_stats.sqrt_cntr = 0; -k.assertions_stats.trigonometry_cntr = 0; -k.assertions_stats.true_cntr = 0; -k.assertions_stats.uninterpretedfunction_cntr = 0; -k.assertions_stats.unique_variables = 38; -k.assertions_stats.variable_cntr = 134; -k.biggest_assertion_stats.abs_cntr = 0; -k.biggest_assertion_stats.addition_cntr = 2; -k.biggest_assertion_stats.conjunction_cntr = 0; -k.biggest_assertion_stats.constant_cntr = 0; -k.biggest_assertion_stats.disjunction_cntr = 0; -k.biggest_assertion_stats.division_cntr = 0; -k.biggest_assertion_stats.equalto_cntr = 1; -k.biggest_assertion_stats.exp_cntr = 0; -k.biggest_assertion_stats.false_cntr = 0; -k.biggest_assertion_stats.forall_cntr = 0; -k.biggest_assertion_stats.ifthenelse_cntr = 0; -k.biggest_assertion_stats.inequality_cntr = 0; -k.biggest_assertion_stats.log_cntr = 0; -k.biggest_assertion_stats.max_cntr = 0; -k.biggest_assertion_stats.min_cntr = 0; -k.biggest_assertion_stats.multiplication_cntr = 0; -k.biggest_assertion_stats.negation_cntr = 0; -k.biggest_assertion_stats.notequalto_cntr = 0; -k.biggest_assertion_stats.pow_cntr = 0; -k.biggest_assertion_stats.realconstant_cntr = 0; -k.biggest_assertion_stats.sqrt_cntr = 0; -k.biggest_assertion_stats.trigonometry_cntr = 0; -k.biggest_assertion_stats.true_cntr = 0; -k.biggest_assertion_stats.uninterpretedfunction_cntr = 0; -k.biggest_assertion_stats.unique_variables = 3; -k.biggest_assertion_stats.variable_cntr = 3; -k.biggest_literal_stats.abs_cntr = 0; -k.biggest_literal_stats.addition_cntr = 0; -k.biggest_literal_stats.conjunction_cntr = 0; -k.biggest_literal_stats.constant_cntr = 1; -k.biggest_literal_stats.disjunction_cntr = 0; -k.biggest_literal_stats.division_cntr = 0; -k.biggest_literal_stats.equalto_cntr = 0; -k.biggest_literal_stats.exp_cntr = 0; -k.biggest_literal_stats.false_cntr = 0; -k.biggest_literal_stats.forall_cntr = 0; -k.biggest_literal_stats.ifthenelse_cntr = 0; -k.biggest_literal_stats.inequality_cntr = 1; -k.biggest_literal_stats.log_cntr = 0; -k.biggest_literal_stats.max_cntr = 0; -k.biggest_literal_stats.min_cntr = 0; -k.biggest_literal_stats.multiplication_cntr = 0; -k.biggest_literal_stats.negation_cntr = 0; -k.biggest_literal_stats.notequalto_cntr = 0; -k.biggest_literal_stats.pow_cntr = 0; -k.biggest_literal_stats.realconstant_cntr = 0; -k.biggest_literal_stats.sqrt_cntr = 0; -k.biggest_literal_stats.trigonometry_cntr = 0; -k.biggest_literal_stats.true_cntr = 0; -k.biggest_literal_stats.uninterpretedfunction_cntr = 0; -k.biggest_literal_stats.unique_variables = 1; -k.biggest_literal_stats.variable_cntr = 1; -k.box_boolean_count = 274; -k.box_continuous_count = 38; -k.box_integer_count = 0; -k.lemma_size = 2; -k.middle_assertion_stats.abs_cntr = 0; -k.middle_assertion_stats.addition_cntr = 0; -k.middle_assertion_stats.conjunction_cntr = 0; -k.middle_assertion_stats.constant_cntr = 1; -k.middle_assertion_stats.disjunction_cntr = 0; -k.middle_assertion_stats.division_cntr = 0; -k.middle_assertion_stats.equalto_cntr = 1; -k.middle_assertion_stats.exp_cntr = 0; -k.middle_assertion_stats.false_cntr = 0; -k.middle_assertion_stats.forall_cntr = 0; -k.middle_assertion_stats.ifthenelse_cntr = 0; -k.middle_assertion_stats.inequality_cntr = 0; -k.middle_assertion_stats.log_cntr = 0; -k.middle_assertion_stats.max_cntr = 0; -k.middle_assertion_stats.min_cntr = 0; -k.middle_assertion_stats.multiplication_cntr = 0; -k.middle_assertion_stats.negation_cntr = 0; -k.middle_assertion_stats.notequalto_cntr = 0; -k.middle_assertion_stats.pow_cntr = 0; -k.middle_assertion_stats.realconstant_cntr = 0; -k.middle_assertion_stats.sqrt_cntr = 0; -k.middle_assertion_stats.trigonometry_cntr = 0; -k.middle_assertion_stats.true_cntr = 0; -k.middle_assertion_stats.uninterpretedfunction_cntr = 0; -k.middle_assertion_stats.unique_variables = 1; -k.middle_assertion_stats.variable_cntr = 1; -k.middle_literal_stats.abs_cntr = 0; -k.middle_literal_stats.addition_cntr = 0; -k.middle_literal_stats.conjunction_cntr = 0; -k.middle_literal_stats.constant_cntr = 1; -k.middle_literal_stats.disjunction_cntr = 0; -k.middle_literal_stats.division_cntr = 0; -k.middle_literal_stats.equalto_cntr = 0; -k.middle_literal_stats.exp_cntr = 0; -k.middle_literal_stats.false_cntr = 0; -k.middle_literal_stats.forall_cntr = 0; -k.middle_literal_stats.ifthenelse_cntr = 0; -k.middle_literal_stats.inequality_cntr = 1; -k.middle_literal_stats.log_cntr = 0; -k.middle_literal_stats.max_cntr = 0; -k.middle_literal_stats.min_cntr = 0; -k.middle_literal_stats.multiplication_cntr = 0; -k.middle_literal_stats.negation_cntr = 1; -k.middle_literal_stats.notequalto_cntr = 0; -k.middle_literal_stats.pow_cntr = 0; -k.middle_literal_stats.realconstant_cntr = 0; -k.middle_literal_stats.sqrt_cntr = 0; -k.middle_literal_stats.trigonometry_cntr = 0; -k.middle_literal_stats.true_cntr = 0; -k.middle_literal_stats.uninterpretedfunction_cntr = 0; -k.middle_literal_stats.unique_variables = 1; -k.middle_literal_stats.variable_cntr = 1; -k.smallest_assertion_stats.abs_cntr = 0; -k.smallest_assertion_stats.addition_cntr = 0; -k.smallest_assertion_stats.conjunction_cntr = 0; -k.smallest_assertion_stats.constant_cntr = 1; -k.smallest_assertion_stats.disjunction_cntr = 0; -k.smallest_assertion_stats.division_cntr = 0; -k.smallest_assertion_stats.equalto_cntr = 0; -k.smallest_assertion_stats.exp_cntr = 0; -k.smallest_assertion_stats.false_cntr = 0; -k.smallest_assertion_stats.forall_cntr = 0; -k.smallest_assertion_stats.ifthenelse_cntr = 0; -k.smallest_assertion_stats.inequality_cntr = 1; -k.smallest_assertion_stats.log_cntr = 0; -k.smallest_assertion_stats.max_cntr = 0; -k.smallest_assertion_stats.min_cntr = 0; -k.smallest_assertion_stats.multiplication_cntr = 0; -k.smallest_assertion_stats.negation_cntr = 1; -k.smallest_assertion_stats.notequalto_cntr = 0; -k.smallest_assertion_stats.pow_cntr = 0; -k.smallest_assertion_stats.realconstant_cntr = 0; -k.smallest_assertion_stats.sqrt_cntr = 0; -k.smallest_assertion_stats.trigonometry_cntr = 0; -k.smallest_assertion_stats.true_cntr = 0; -k.smallest_assertion_stats.uninterpretedfunction_cntr = 0; -k.smallest_assertion_stats.unique_variables = 1; -k.smallest_assertion_stats.variable_cntr = 1; -k.smallest_literal_stats.abs_cntr = 0; -k.smallest_literal_stats.addition_cntr = 0; -k.smallest_literal_stats.conjunction_cntr = 0; -k.smallest_literal_stats.constant_cntr = 1; -k.smallest_literal_stats.disjunction_cntr = 0; -k.smallest_literal_stats.division_cntr = 0; -k.smallest_literal_stats.equalto_cntr = 0; -k.smallest_literal_stats.exp_cntr = 0; -k.smallest_literal_stats.false_cntr = 0; -k.smallest_literal_stats.forall_cntr = 0; -k.smallest_literal_stats.ifthenelse_cntr = 0; -k.smallest_literal_stats.inequality_cntr = 1; -k.smallest_literal_stats.log_cntr = 0; -k.smallest_literal_stats.max_cntr = 0; -k.smallest_literal_stats.min_cntr = 0; -k.smallest_literal_stats.multiplication_cntr = 0; -k.smallest_literal_stats.negation_cntr = 1; -k.smallest_literal_stats.notequalto_cntr = 0; -k.smallest_literal_stats.pow_cntr = 0; -k.smallest_literal_stats.realconstant_cntr = 0; -k.smallest_literal_stats.sqrt_cntr = 0; -k.smallest_literal_stats.trigonometry_cntr = 0; -k.smallest_literal_stats.true_cntr = 0; -k.smallest_literal_stats.uninterpretedfunction_cntr = 0; -k.smallest_literal_stats.unique_variables = 1; -k.smallest_literal_stats.variable_cntr = 1; -k.theory_checksat_ms = 0.0367441; -expected_value = 0.23488732402191095; -calculated_value = PatternMatchingHeuristic::calculate(k); -std::cout << "Trial 15765: C++/Python neural inference delta = " << expected_value - calculated_value << std::endl; -EXPECT_NEAR(calculated_value, expected_value, 0.001); - - - } - } // namespace -} // namespace dreal - diff --git a/test/dreal/util/test/pattern_matching_test.cc b/test/dreal/util/test/pattern_matching_test.cc index 18b491b24..3e8d52865 100644 --- a/test/dreal/util/test/pattern_matching_test.cc +++ b/test/dreal/util/test/pattern_matching_test.cc @@ -138,7 +138,7 @@ namespace dreal const auto [related_clauses, stats] = trie.find_matches( {y1 == sin(x1), y1 == atan(x1)}, Box{}, false ); - EXPECT_EQ(stats.misses.bc_bij, 2); + EXPECT_EQ(stats.misses_bc.at(substitutions_map::substitution_status::BIJ_MISS), 2); EXPECT_EQ(stats.matches, 2); EXPECT_EQ(related_clauses.size(), 2); EXPECT_EQ(related_clauses[0].second, std::nullopt); // trie.find_matches(..., return_subs_maps=false) From 8323d387f5ab1ea25cd5ce02d1b8787b545da356 Mon Sep 17 00:00:00 2001 From: Kunal Sheth Date: Wed, 31 Dec 2025 23:12:21 -0800 Subject: [PATCH 31/43] Remove now-defunct predicate_heuristic.cc/h. --- src/dreal/solver/context.cc | 4 ---- src/dreal/version.h | 2 -- 2 files changed, 6 deletions(-) diff --git a/src/dreal/solver/context.cc b/src/dreal/solver/context.cc index 0deab786b..14211eef7 100644 --- a/src/dreal/solver/context.cc +++ b/src/dreal/solver/context.cc @@ -133,10 +133,6 @@ string Context::version() { oss << "audit_theory" << (DREAL_EXPERIMENTAL_THEORY_AUDIT_ENABLED ? 1 : 0) << '.'; oss << "audit_sat" << (DREAL_EXPERIMENTAL_SAT_AUDIT_ENABLED ? 1 : 0); -#ifdef DREAL_EXPERIMENTAL_GENERATE_HEURISTICS_CSV - oss << ".GENERATE_CSV"; -#endif - #ifdef CAV26_FILTER_SYMMETRIES #define STRINGIFY(x) #x #define STR(x) STRINGIFY(x) diff --git a/src/dreal/version.h b/src/dreal/version.h index 6673dd41f..a69824743 100644 --- a/src/dreal/version.h +++ b/src/dreal/version.h @@ -25,8 +25,6 @@ static_assert(!(CAV26_MATCH_ACROSS_TIME_ONLY && CAV26_MATCH_ACROSS_LOGIC_ONLY)); #endif -#define DREAL_EXPERIMENTAL_GENERATE_HEURISTICS_CSV - // check that options are required and mutually exclusive #ifdef DREAL_EXPERIMENTAL_PM_USE_TRIE_IMPL constexpr int pm_impl_mode = 0; From 7e01f9b12dbc3fb0f0cc4b1d09772bd53ddc20dd Mon Sep 17 00:00:00 2001 From: Kunal Sheth Date: Fri, 2 Jan 2026 19:17:31 -0800 Subject: [PATCH 32/43] Remove CAV26 symmetry filtering from substitutions_map.cc. --- .../pattern_matching/substitutions_map.cc | 24 ------------------- .../util/pattern_matching/substitutions_map.h | 4 ---- 2 files changed, 28 deletions(-) diff --git a/src/dreal/util/pattern_matching/substitutions_map.cc b/src/dreal/util/pattern_matching/substitutions_map.cc index 78643ba8f..431471d4a 100644 --- a/src/dreal/util/pattern_matching/substitutions_map.cc +++ b/src/dreal/util/pattern_matching/substitutions_map.cc @@ -9,9 +9,6 @@ #include #include -#include "CAV26_varname_parser.h" // NOLINT(*-include-cleaner) -#include "dreal/version.h" // NOLINT(*-include-cleaner) - namespace dreal { substitutions_map::substitutions_map(const Box& b, const size_t reserved_size) : box(b) { @@ -26,9 +23,6 @@ namespace dreal DREAL_ASSERT(!index_stack.empty()); DREAL_ASSERT(index_stack.back() <= mapping.size()); mapping.resize(index_stack.back()); -#ifdef CAV26_FILTER_SYMMETRIES - CAV26_delta_times.resize(index_stack.back()); -#endif index_stack.pop_back(); } @@ -50,24 +44,6 @@ namespace dreal } } -#ifdef CAV26_FILTER_SYMMETRIES - const auto [pA,tA] = CAV26_VARNAME_PARSER(a.get_name()); - const auto [pAP,tAP] = CAV26_VARNAME_PARSER(aP.get_name()); - - static_assert(!(CAV26_MATCH_ACROSS_TIME_ONLY && CAV26_MATCH_ACROSS_LOGIC_ONLY)); - - const auto delta_time = tAP - tA; - if (CAV26_MATCH_ACROSS_TIME_ONLY) { - if (pA != pAP) return CAV26_NOT_PURE_TIME; - if (!CAV26_delta_times.empty() && delta_time != CAV26_delta_times.back()) return CAV26_NOT_PURE_TIME; - } - if (CAV26_MATCH_ACROSS_LOGIC_ONLY) { - if (tA != tAP) return CAV26_NOT_PURE_LOGIC; - } - - CAV26_delta_times.emplace_back(delta_time); -#endif - mapping.emplace_back(a, aP); return SUCCESS; } diff --git a/src/dreal/util/pattern_matching/substitutions_map.h b/src/dreal/util/pattern_matching/substitutions_map.h index 291cc7aa8..b620af3fd 100644 --- a/src/dreal/util/pattern_matching/substitutions_map.h +++ b/src/dreal/util/pattern_matching/substitutions_map.h @@ -20,10 +20,6 @@ namespace dreal std::vector index_stack; const Box& box; -#ifdef CAV26_FILTER_SYMMETRIES - std::vector CAV26_delta_times; -#endif - public: [[nodiscard]] const std::vector>& get_map() const { return mapping; } From 7f2be6b2f5029c963fd38a0a9ddfba4bd517ce9d Mon Sep 17 00:00:00 2001 From: Kunal Sheth Date: Fri, 2 Jan 2026 19:19:57 -0800 Subject: [PATCH 33/43] Add `metadata_tags` and `was_not_added` fields to `pm_dump_all(..)` json dumps. --- src/dreal/solver/auditor.cc | 18 ++++++++++++++---- src/dreal/solver/auditor.h | 4 +++- 2 files changed, 17 insertions(+), 5 deletions(-) diff --git a/src/dreal/solver/auditor.cc b/src/dreal/solver/auditor.cc index 16245ba92..594ff90f5 100644 --- a/src/dreal/solver/auditor.cc +++ b/src/dreal/solver/auditor.cc @@ -9,15 +9,18 @@ #include #include #include +#include #include #include #include #include +#include #include "dreal/solver/filter_assertion.h" #include "dreal/util/assert.h" #include "dreal/util/logging.h" +#include "dreal/util/pattern_matching/substitutions_map.h" #include "dreal/version.h" #include "dreal/symbolic/odes/symbolic_odes_cell.h" #include "nlohmann/json.hpp" @@ -137,9 +140,12 @@ namespace dreal void pm_dump_all( const std::vector& base_conflict, - const std::vector, std::optional>>& all_matches + const std::vector, std::optional>>& all_matches, + const std::vector& metadata_tags, const std::vector& was_not_added ) { DREAL_ASSERT(DREAL_EXPERIMENTAL_PM_DUMP_ALL_ENABLED); + DREAL_ASSERT(metadata_tags.size() == all_matches.size() || metadata_tags.empty()); + DREAL_ASSERT(was_not_added.size() == was_not_added.size() || was_not_added.empty()); nlohmann::json dump; @@ -152,9 +158,10 @@ namespace dreal for (const auto& a : base_conflict) base_conflict_str.emplace_back(a.to_string()); dump["base_conflict"] = base_conflict_str; - std::vector, std::map>> all_matches_json; + std::vector, std::map, std::string_view, bool>> all_matches_json; all_matches_json.reserve(all_matches.size()); - for (const auto& [match_conflict, subs] : all_matches) { + for (int i = 0; i < all_matches.size(); i++) { + const auto& [match_conflict, subs] = all_matches[i]; std::vector match_conflict_str; match_conflict_str.reserve(match_conflict.size()); for (const auto& a : match_conflict) match_conflict_str.emplace_back(a.to_string()); @@ -162,7 +169,10 @@ namespace dreal std::map subs_strs; for (const auto& [a,b] : subs->get_map()) subs_strs[a.get_name()] = b.get_name(); - all_matches_json.emplace_back(match_conflict_str, subs_strs); + const auto& tag = metadata_tags.empty() ? "" : metadata_tags.at(i); + const auto& wna = was_not_added.empty() ? false : was_not_added.at(i); + + all_matches_json.emplace_back(match_conflict_str, subs_strs, tag, wna); } dump["all_matches"] = all_matches_json; const auto dump_str = dump.dump(-1, ' ', true); diff --git a/src/dreal/solver/auditor.h b/src/dreal/solver/auditor.h index 71cbfdf1f..5f5cdb497 100644 --- a/src/dreal/solver/auditor.h +++ b/src/dreal/solver/auditor.h @@ -9,6 +9,7 @@ #include #include #include +#include namespace dreal { @@ -26,7 +27,8 @@ namespace dreal void pm_dump_all( const std::vector& base_conflict, - const std::vector, std::optional>>& all_matches + const std::vector, std::optional>>& all_matches, + const std::vector& metadata_tags, const std::vector& was_not_added ); } From 61efc21ee3bd65d99a6f26f5e1ddd248bdf3eb6b Mon Sep 17 00:00:00 2001 From: Kunal Sheth Date: Fri, 2 Jan 2026 19:24:49 -0800 Subject: [PATCH 34/43] Switch CAV26 parser's `t` field from double to optional. --- .../util/pattern_matching/CAV26_varname_parser.h | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/src/dreal/util/pattern_matching/CAV26_varname_parser.h b/src/dreal/util/pattern_matching/CAV26_varname_parser.h index e3a476c59..451be8b69 100644 --- a/src/dreal/util/pattern_matching/CAV26_varname_parser.h +++ b/src/dreal/util/pattern_matching/CAV26_varname_parser.h @@ -24,9 +24,9 @@ namespace dreal static const std::regex SAR_VARIABLE_RE{R"(^(.+)_t(\d+)(ad|bc)$)"}; static const std::regex DRH_VARIABLE_RE{R"(^(.+)_(\d+)(_t|_0)?$)"}; - static auto CAV26_SAR_PARSER(const std::string& name) -> std::pair { + static std::pair> const& CAV26_SAR_PARSER(const std::string& name) { std::string prefix{}; - double t = -1; // "unknown" + std::optional t{}; if (std::smatch m; std::regex_search(name, m, SAR_VARIABLE_RE)) { const auto mag = std::stoi(m[2].str()); @@ -35,23 +35,22 @@ namespace dreal t = mag * (polarity == "bc" ? -1 : +1); } else if (name.rfind("ITE", 0) == 0) { // known issue... - const auto last = name.rfind("ITE"); prefix = name; // "ITE"; - // t is unknown ... // if (last != std::string::npos) t = std::stoi(name.substr(last + 3)); + t = std::nullopt; // const auto last = name.rfind("ITE"); if (last != std::string::npos) t = std::stoi(name.substr(last + 3)); } else throw DREAL_RUNTIME_ERROR("Invalid SAR variable name: {}", name); return {std::move(prefix), t}; } - static auto CAV26_DRH_PARSER(const std::string& name) -> std::pair { + static auto CAV26_DRH_PARSER(const std::string& name) -> std::pair> { if (std::smatch m; std::regex_search(name, m, DRH_VARIABLE_RE)) { - const auto mag = std::stoi(m[2].str()); + const int mag = std::stoi(m[2].str()); const auto step = m[3].matched ? m[3].str() : std::string{}; auto prefix = m[1].str(); - const auto t = mag + (step == "_t" ? 0.5 : 0.0); return {std::move(prefix), t}; + const int t = (2 * mag) + (step == "_t" ? 1 : 0); } throw DREAL_RUNTIME_ERROR("Invalid DRH variable name: {}", name); } From d81814ddbccbc91836ad2abc106068b37a1edb3f Mon Sep 17 00:00:00 2001 From: Kunal Sheth Date: Fri, 2 Jan 2026 19:25:16 -0800 Subject: [PATCH 35/43] Add caching to CAV26 variable name parser. --- .../pattern_matching/CAV26_varname_parser.h | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/src/dreal/util/pattern_matching/CAV26_varname_parser.h b/src/dreal/util/pattern_matching/CAV26_varname_parser.h index 451be8b69..eba9e302a 100644 --- a/src/dreal/util/pattern_matching/CAV26_varname_parser.h +++ b/src/dreal/util/pattern_matching/CAV26_varname_parser.h @@ -7,15 +7,14 @@ #include // NOLINT(*-include-cleaner) -#ifdef CAV26_FILTER_SYMMETRIES +#if CAV26_FILTER_SYMMETRIES -#include -#include +#include +#include #include #include #include -#include "dreal/util/assert.h" #include "dreal/util/exception.h" #include "dreal/util/logging.h" @@ -25,6 +24,10 @@ namespace dreal static const std::regex DRH_VARIABLE_RE{R"(^(.+)_(\d+)(_t|_0)?$)"}; static std::pair> const& CAV26_SAR_PARSER(const std::string& name) { + static std::unordered_map>> cache; + const auto cache_it = cache.find(name); + if (cache_it != cache.end()) return cache_it->second; + std::string prefix{}; std::optional t{}; @@ -40,17 +43,21 @@ namespace dreal } else throw DREAL_RUNTIME_ERROR("Invalid SAR variable name: {}", name); - return {std::move(prefix), t}; + return cache.try_emplace(name, std::move(prefix), t).first->second; } static auto CAV26_DRH_PARSER(const std::string& name) -> std::pair> { + static std::unordered_map>> cache; + const auto cache_it = cache.find(name); + if (cache_it != cache.end()) return cache_it->second; + if (std::smatch m; std::regex_search(name, m, DRH_VARIABLE_RE)) { const int mag = std::stoi(m[2].str()); const auto step = m[3].matched ? m[3].str() : std::string{}; auto prefix = m[1].str(); - return {std::move(prefix), t}; const int t = (2 * mag) + (step == "_t" ? 1 : 0); + return cache.try_emplace(name, std::move(prefix), t).first->second; } throw DREAL_RUNTIME_ERROR("Invalid DRH variable name: {}", name); } From ebe09de81310a5208e2af75e5aee854ba4c49650 Mon Sep 17 00:00:00 2001 From: Kunal Sheth Date: Fri, 2 Jan 2026 19:29:10 -0800 Subject: [PATCH 36/43] Add concept of `CAV26_NOT_PURE_ANY` to identify mixed symmetries. --- src/dreal/solver/context.cc | 11 +++++------ src/dreal/solver/context_impl.cc | 19 ++++++++++++------- .../util/pattern_matching/substitutions_map.h | 4 ++-- src/dreal/version.h | 12 ++++++------ 4 files changed, 25 insertions(+), 21 deletions(-) diff --git a/src/dreal/solver/context.cc b/src/dreal/solver/context.cc index 14211eef7..816617d07 100644 --- a/src/dreal/solver/context.cc +++ b/src/dreal/solver/context.cc @@ -133,15 +133,14 @@ string Context::version() { oss << "audit_theory" << (DREAL_EXPERIMENTAL_THEORY_AUDIT_ENABLED ? 1 : 0) << '.'; oss << "audit_sat" << (DREAL_EXPERIMENTAL_SAT_AUDIT_ENABLED ? 1 : 0); -#ifdef CAV26_FILTER_SYMMETRIES +#if CAV26_FILTER_SYMMETRIES #define STRINGIFY(x) #x #define STR(x) STRINGIFY(x) - oss << ".CAV26_FILTER_"; - static_assert(!(CAV26_MATCH_ACROSS_TIME_ONLY && CAV26_MATCH_ACROSS_LOGIC_ONLY)); - if (CAV26_MATCH_ACROSS_TIME_ONLY) oss << "TIME_ONLY"; - else if (CAV26_MATCH_ACROSS_LOGIC_ONLY) oss << "LOGIC_ONLY"; + oss << ".CAV26_FILT_"; + if (CAV26_MATCH_PURE_TIME_SYM) oss << "TIME_"; + if (CAV26_MATCH_PURE_LOGIC_SYM) oss << "LOGIC_"; else oss << "NONE"; - oss << "_using_" STR(CAV26_VARNAME_PARSER); + oss << "using_" STR(CAV26_VARNAME_PARSER); #undef STR #undef STRINGIFY #endif diff --git a/src/dreal/solver/context_impl.cc b/src/dreal/solver/context_impl.cc index 0405da25f..af275a6a2 100644 --- a/src/dreal/solver/context_impl.cc +++ b/src/dreal/solver/context_impl.cc @@ -143,9 +143,10 @@ void drpm_benchmark_log( const char mode, const double pm_elapsed_ms, const unsigned num_pm, -#ifdef CAV26_FILTER_SYMMETRIES +#if CAV26_FILTER_SYMMETRIES const unsigned CAV26_pm_num_not_pure_time, const unsigned CAV26_pm_num_not_pure_logic, + const unsigned CAV26_pm_num_not_pure_any, #endif std::ostream& out ) { @@ -159,10 +160,11 @@ void drpm_benchmark_log( out << "\t"; out << " PM.ms " << pm_elapsed_ms; out << " PM " << num_pm; -#ifdef CAV26_FILTER_SYMMETRIES +#if CAV26_FILTER_SYMMETRIES out << '\t'; out << " C26.npT " << CAV26_pm_num_not_pure_time; out << " C26.npL " << CAV26_pm_num_not_pure_logic; + out << " C26.np* " << CAV26_pm_num_not_pure_any; #endif out << '\n'; } @@ -241,6 +243,7 @@ optional Context::Impl::CheckSatCore(const ScopedVector& stack, // or, we get a fully constrained deltasat, in which case we are done :) recent_under_constrained_deltasat = recent_under_constrained_deltasat_limit; DREAL_LOG_WARN("ContextImpl::CheckSatCore() - Underconstrained Theory Check = delta-SAT. Exponential Backoff = {}", recent_under_constrained_deltasat_limit); + // todo: log scs_elapsed_ms, tcs_elapsed_ms recent_under_constrained_deltasat_limit *= 2; // exponential backoff return CheckSatCore(stack, std::move(box), sat_solver); } else if (tscs_result && is_full_constrained) { @@ -286,23 +289,25 @@ optional Context::Impl::CheckSatCore(const ScopedVector& stack, is_full_constrained, scs_elapsed_ms.count(), tcs_elapsed_ms.count(), explanation.size(), 'M', pm_elapsed.count(), pm_result.matches, -#ifdef CAV26_FILTER_SYMMETRIES +#if CAV26_FILTER_SYMMETRIES pm_result.misses_bc.at(substitutions_map::substitution_status::CAV26_NOT_PURE_TIME), - pm_result.misses_bc.at(substitutions_map::substitution_status::CAV26_NOT_PURE_LOGIC), + pm_result.misses_bc.at(substitutions_map::substitution_status::CAV26_NOT_PURE_LOGIC), + pm_result.misses_bc.at(substitutions_map::substitution_status::CAV26_NOT_PURE_ANY), #endif std::cerr ); } else { - if (DREAL_EXPERIMENTAL_PM_DUMP_ALL_ENABLED) pm_dump_all(explanation, {}); + if (DREAL_EXPERIMENTAL_PM_DUMP_ALL_ENABLED) pm_dump_all(explanation, {}, {}, {}); sat_solver->AddLearnedClauseDirect(explanation, box); drpm_benchmark_log( is_full_constrained, scs_elapsed_ms.count(), tcs_elapsed_ms.count(), explanation.size(), 'A', 0 /*pm_elapsed.count()*/, 0 /*pm_result.matches*/, -#ifdef CAV26_FILTER_SYMMETRIES +#if CAV26_FILTER_SYMMETRIES 0 /*pm_result.misses_bc.at(substitutions_map::substitution_status::CAV26_NOT_PURE_TIME)*/, - 0 /*pm_result.misses_bc.at(substitutions_map::substitution_status::CAV26_NOT_PURE_LOGIC)*/, + 0 /*pm_result.misses_bc.at(substitutions_map::substitution_status::CAV26_NOT_PURE_LOGIC)*/, + 0 /*pm_result.misses_bc.at(substitutions_map::substitution_status::CAV26_NOT_PURE_ANY)*/, #endif std::cerr ); diff --git a/src/dreal/util/pattern_matching/substitutions_map.h b/src/dreal/util/pattern_matching/substitutions_map.h index b620af3fd..00dd74d05 100644 --- a/src/dreal/util/pattern_matching/substitutions_map.h +++ b/src/dreal/util/pattern_matching/substitutions_map.h @@ -37,8 +37,8 @@ namespace dreal typedef enum { SUCCESS, STRUCTURE_MISS, INDICES_MISS, TYPE_MISS, BOX_MISS, BIJ_MISS, CONST_MISS, -#ifdef CAV26_FILTER_SYMMETRIES - CAV26_NOT_PURE_TIME, CAV26_NOT_PURE_LOGIC, +#if CAV26_FILTER_SYMMETRIES + CAV26_NOT_PURE_TIME, CAV26_NOT_PURE_LOGIC, CAV26_NOT_PURE_ANY, #endif LEN_substitution_statuses } substitution_status; diff --git a/src/dreal/version.h b/src/dreal/version.h index a69824743..c391342b6 100644 --- a/src/dreal/version.h +++ b/src/dreal/version.h @@ -17,12 +17,12 @@ #define DREAL_EXPERIMENTAL_PM_DUMP_ALL_ENABLED false #define DREAL_EXPERIMENTAL_SAT_AUDIT_ENABLED false -// #define CAV26_FILTER_SYMMETRIES -#ifdef CAV26_FILTER_SYMMETRIES -#define CAV26_VARNAME_PARSER CAV26_DRH_PARSER -#define CAV26_MATCH_ACROSS_TIME_ONLY false -#define CAV26_MATCH_ACROSS_LOGIC_ONLY false -static_assert(!(CAV26_MATCH_ACROSS_TIME_ONLY && CAV26_MATCH_ACROSS_LOGIC_ONLY)); +#define CAV26_FILTER_SYMMETRIES false +#if CAV26_FILTER_SYMMETRIES +#define CAV26_VARNAME_PARSER CAV26_SAR_PARSER +#define CAV26_MATCH_PURE_TIME_SYM false +#define CAV26_MATCH_PURE_LOGIC_SYM false + #endif // check that options are required and mutually exclusive From 837688ed7d7579bdfb86fe427e47a4fdb42858d9 Mon Sep 17 00:00:00 2001 From: Kunal Sheth Date: Fri, 2 Jan 2026 20:00:00 -0800 Subject: [PATCH 37/43] Implement symetry filtering at the lemma-level and add deeper telemetry. --- src/dreal/solver/auditor.cc | 2 +- src/dreal/solver/sat_solver_interval_logic.cc | 98 +++++++++++++++++-- 2 files changed, 89 insertions(+), 11 deletions(-) diff --git a/src/dreal/solver/auditor.cc b/src/dreal/solver/auditor.cc index 594ff90f5..1760b1048 100644 --- a/src/dreal/solver/auditor.cc +++ b/src/dreal/solver/auditor.cc @@ -169,7 +169,7 @@ namespace dreal std::map subs_strs; for (const auto& [a,b] : subs->get_map()) subs_strs[a.get_name()] = b.get_name(); - const auto& tag = metadata_tags.empty() ? "" : metadata_tags.at(i); + const auto& tag = metadata_tags.empty() ? "?" : metadata_tags.at(i); const auto& wna = was_not_added.empty() ? false : was_not_added.at(i); all_matches_json.emplace_back(match_conflict_str, subs_strs, tag, wna); diff --git a/src/dreal/solver/sat_solver_interval_logic.cc b/src/dreal/solver/sat_solver_interval_logic.cc index 6f5aa8679..feae54baf 100644 --- a/src/dreal/solver/sat_solver_interval_logic.cc +++ b/src/dreal/solver/sat_solver_interval_logic.cc @@ -2,14 +2,22 @@ // Created by Kunal Sheth on 4/17/25. // +#include #include -#include +#include +#include +#include +#include +#include +#include "dreal/util/logging.h" #include "auditor.h" -#include "dreal/util/pattern_matching/substitutions_map.h" +#include "dreal/util/pattern_matching/matching_stats_t.h" +#include "dreal/util/predicate_normalizer.h" #include "filter_assertion.h" #include "sat_solver.h" -#include "dreal/version.h" +#include "dreal/util/pattern_matching/CAV26_varname_parser.h" +#include "dreal/util/pattern_matching/substitutions_map.h" namespace dreal { @@ -137,6 +145,32 @@ namespace dreal } }*/ +#if CAV26_FILTER_SYMMETRIES + std::pair analyze_symmetries_npT_npL(const substitutions_map& subs) { + bool npT = false; + bool npL = false; + std::optional constant_time_offset{}; + for (const auto& [a,aP] : subs.get_map()) { + if (npT && npL) break; + + const auto [pA,tA] = CAV26_VARNAME_PARSER(a.get_name()); + const auto [pAP,tAP] = CAV26_VARNAME_PARSER(aP.get_name()); + + npT |= pA != pAP; + + if (tA.has_value() != tAP.has_value()) npT = true; + if (tA.has_value() && tAP.has_value()) { + const auto time_offset = *tAP - *tA; + npT |= time_offset != constant_time_offset.value_or(time_offset); + npL |= time_offset != 0; + constant_time_offset = time_offset; + } + } + return {npT, npL}; + } +#endif + + matching_stats_t SatSolver::AddLearnedClausePattern( PredicateNormalizer& pn, const std::vector& base_conflict, const Box& base_box, @@ -144,15 +178,56 @@ namespace dreal ) { sat_log_label_clause("SatSolver::AddLearnedClausePattern"); - const auto [ - all_related_conflicts, - match_statistics - ] = pn.FindSimilar(base_conflict, base_box, DREAL_EXPERIMENTAL_PM_DUMP_ALL_ENABLED, timeout); + auto pnfs_result = pn.FindSimilar(base_conflict, base_box, DREAL_EXPERIMENTAL_PM_DUMP_ALL_ENABLED || CAV26_FILTER_SYMMETRIES, timeout); + const auto& all_related_conflicts = pnfs_result.first; + auto& match_statistics = pnfs_result.second; + + DREAL_ASSERT(match_statistics.matches == all_related_conflicts.size()); if (all_related_conflicts.empty()) { DREAL_LOG_INFO("Clause did not match with itself... Adding regularly."); return match_statistics; } + std::vector do_not_add_clause; // optional filtering, + do_not_add_clause.resize(all_related_conflicts.size(), false); // add all by default. + + std::vector metadata_tags; // calculate metadata if needed, otherwise leave empty. + +#if CAV26_FILTER_SYMMETRIES + metadata_tags.resize(all_related_conflicts.size()); // empty string by default. + DREAL_ASSERT(match_statistics.misses_bc.at(substitutions_map::CAV26_NOT_PURE_TIME) == 0); + DREAL_ASSERT(match_statistics.misses_bc.at(substitutions_map::CAV26_NOT_PURE_LOGIC) == 0); + DREAL_ASSERT(match_statistics.misses_bc.at(substitutions_map::CAV26_NOT_PURE_ANY) == 0); + + for (int i = 0; i < all_related_conflicts.size(); ++i) { + const auto& [conflict_clause, subs] = all_related_conflicts[i]; + const auto [npT, npL] = analyze_symmetries_npT_npL(*subs); + + int stats_miss_reason = -1; + if (npT && npL) { + metadata_tags[i] = "np*"; + stats_miss_reason = substitutions_map::CAV26_NOT_PURE_ANY; + } + else if (npT) { + metadata_tags[i] = "npT"; + stats_miss_reason = substitutions_map::CAV26_NOT_PURE_TIME; + } + else if (npL) { + metadata_tags[i] = "npL"; + stats_miss_reason = substitutions_map::CAV26_NOT_PURE_LOGIC; + } + else { + metadata_tags[i] = "P"; + } + + if ((CAV26_MATCH_PURE_TIME_SYM && npT) || (CAV26_MATCH_PURE_LOGIC_SYM && npL)) { + ++match_statistics.misses_bc.at(stats_miss_reason); + --match_statistics.matches; + do_not_add_clause[i] = true; + } + } +#endif + if (DREAL_EXPERIMENTAL_THEORY_AUDIT_ENABLED) { std::set s(base_conflict.begin(), base_conflict.end()); theory_audit_formula( @@ -163,10 +238,13 @@ namespace dreal } if (DREAL_EXPERIMENTAL_PM_DUMP_ALL_ENABLED) { - pm_dump_all(base_conflict, all_related_conflicts); + pm_dump_all(base_conflict, all_related_conflicts, metadata_tags, do_not_add_clause); } - for (const auto& [conflict_clause, subs] : all_related_conflicts) { + DREAL_ASSERT(std::count(do_not_add_clause.begin(), do_not_add_clause.end(), false) == match_statistics.matches); + for (int i = 0; i < all_related_conflicts.size(); ++i) { + if (do_not_add_clause[i]) continue; + const auto& [conflict_clause, subs] = all_related_conflicts[i]; // const auto conflict_box = substitutions_map::apply_substitution(base_box, subs, true); // AddLearnedClause(pn, conflict_clause, conflict_box); AddLearnedClauseDirect(conflict_clause, base_box); @@ -370,4 +448,4 @@ namespace dreal std::cerr << "SAT Solver Learned: " << sat_clause << std::endl; } } -} // namespace dreal \ No newline at end of file +} // namespace dreal From 3537c06a0099649dedd96b0bc028e957513e659f Mon Sep 17 00:00:00 2001 From: Kunal Sheth Date: Sun, 4 Jan 2026 16:26:59 -0800 Subject: [PATCH 38/43] Fix CAV26 sym. version string printout. --- src/dreal/solver/context.cc | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/dreal/solver/context.cc b/src/dreal/solver/context.cc index 816617d07..f2d80b9b3 100644 --- a/src/dreal/solver/context.cc +++ b/src/dreal/solver/context.cc @@ -136,11 +136,12 @@ string Context::version() { #if CAV26_FILTER_SYMMETRIES #define STRINGIFY(x) #x #define STR(x) STRINGIFY(x) - oss << ".CAV26_FILT_"; - if (CAV26_MATCH_PURE_TIME_SYM) oss << "TIME_"; - if (CAV26_MATCH_PURE_LOGIC_SYM) oss << "LOGIC_"; - else oss << "NONE"; - oss << "using_" STR(CAV26_VARNAME_PARSER); + oss << ".CAV26_"; + if (CAV26_MATCH_PURE_TIME_SYM && CAV26_MATCH_PURE_LOGIC_SYM) oss << "PURE"; + if (CAV26_MATCH_PURE_TIME_SYM && !CAV26_MATCH_PURE_LOGIC_SYM) oss << "TIME"; + if (!CAV26_MATCH_PURE_TIME_SYM && CAV26_MATCH_PURE_LOGIC_SYM) oss << "LOGIC"; + if (!CAV26_MATCH_PURE_TIME_SYM && !CAV26_MATCH_PURE_LOGIC_SYM) oss << "MIXED"; + oss << "_SYM_using_" STR(CAV26_VARNAME_PARSER); #undef STR #undef STRINGIFY #endif From d12b74a5f7835f1c0a5282ccf1853c4794dc8f75 Mon Sep 17 00:00:00 2001 From: Kunal Sheth Date: Mon, 5 Jan 2026 15:22:34 -0800 Subject: [PATCH 39/43] Implement randomization in substitution_tree.cc iteration for pattern matching. --- src/dreal/solver/context.cc | 9 ++- src/dreal/util/math.cc | 9 +++ src/dreal/util/math.h | 12 ++++ .../map_based/DeBruijnCanonicalizer.cc | 28 ++++---- .../map_based/DeBruijnCanonicalizer.h | 9 ++- .../substitution_tree/substitution_tree.cc | 64 +++++++++++++++---- .../substitution_tree/substitution_tree.h | 20 +++--- src/dreal/version.h | 6 +- test/dreal/util/test/pattern_matching_test.cc | 8 ++- 9 files changed, 117 insertions(+), 48 deletions(-) diff --git a/src/dreal/solver/context.cc b/src/dreal/solver/context.cc index f2d80b9b3..0f620a274 100644 --- a/src/dreal/solver/context.cc +++ b/src/dreal/solver/context.cc @@ -121,10 +121,15 @@ string Context::version() { oss << DREAL_VERSION_REVISION << '.'; #ifdef DREAL_EXPERIMENTAL_PM_USE_TRIE_IMPL - oss << "PM_trie."; + oss << "PM_trie_"; #endif #ifdef DREAL_EXPERIMENTAL_PM_USE_MAP_IMPL - oss << "PM_map."; + oss << "PM_map_"; +#endif +#if DREAL_EXPERIMENTAL_PM_SUBSTREE_RANDOMIZE + oss << "rand."; +#else + oss << "sequ."; #endif oss << "full_models" << (DREAL_EXPERIMENTAL_SAT_MODEL_FULL_CONSTRAINTS ? 1 : 0) << '.'; diff --git a/src/dreal/util/math.cc b/src/dreal/util/math.cc index 4e9a53db1..44b191b77 100644 --- a/src/dreal/util/math.cc +++ b/src/dreal/util/math.cc @@ -18,11 +18,13 @@ #include #include #include +#include #include "rounding_mode_guard.h" #include "dreal/util/exception.h" using std::int64_t; +using std::uint64_t; using std::modf; using std::numeric_limits; @@ -58,4 +60,11 @@ double convert_int64_to_double(const int64_t v) { } } +uint64_t fast_random_next(uint64_t& state) { + uint64_t z = (state += UINT64_C(0x9E3779B97F4A7C15)); + z = (z ^ (z >> 30)) * UINT64_C(0xBF58476D1CE4E5B9); + z = (z ^ (z >> 27)) * UINT64_C(0x94D049BB133111EB); + return z ^ (z >> 31); +} + } // namespace dreal diff --git a/src/dreal/util/math.h b/src/dreal/util/math.h index cb47cc5fa..f8f9baaed 100644 --- a/src/dreal/util/math.h +++ b/src/dreal/util/math.h @@ -29,4 +29,16 @@ int convert_int64_to_int(std::int64_t v); /// @throw std::runtime_error if this conversion result in a loss of precision. double convert_int64_to_double(std::int64_t v); + +/** + * This is a fixed-increment version of Java 8's SplittableRandom generator. + * Taken from: https://github.com/svaarala/duktape/blob/50af773b1b32067170786c2b7c661705ec7425d4/misc/splitmix64.c#L11-L28 + * http://dx.doi.org/10.1145/2714064.2660195 + * http://docs.oracle.com/javase/8/docs/api/java/util/SplittableRandom.html + * + * @param state - Can be seeded with any value. Must be preserved between invocations. + * @return Next random value in splitmix64 sequence. + */ +uint64_t fast_random_next(uint64_t& state); + } // namespace dreal diff --git a/src/dreal/util/pattern_matching/map_based/DeBruijnCanonicalizer.cc b/src/dreal/util/pattern_matching/map_based/DeBruijnCanonicalizer.cc index ede833e13..28fde5250 100644 --- a/src/dreal/util/pattern_matching/map_based/DeBruijnCanonicalizer.cc +++ b/src/dreal/util/pattern_matching/map_based/DeBruijnCanonicalizer.cc @@ -247,7 +247,7 @@ void DeBruijnCanonicalizer::name ( \ template void DeBruijnCanonicalizer::find_matches( - const T& atom, substitutions_map& subs, const matches_vec& matches, const misses_vec& misses + const T& atom, substitutions_map& subs, const matches_vec& matches, const misses_vec& misses, uint64_t &random_state ) const { const auto init_size = subs.size(); @@ -256,17 +256,11 @@ void DeBruijnCanonicalizer::name ( \ cache_it == canonicalization_cache.cend() ? canonicalize_atom(atom) : cache_it->second ); - // const auto indices_to_concrete_it = structure_to_indices_to_concrete.find(structure); - // if (indices_to_concrete_it == structure_to_indices_to_concrete.cend()) return misses(substitutions_map::STRUCTURE_MISS); - // const auto& indices_to_concrete = indices_to_concrete_it->second; - // const auto concrete_it = indices_to_concrete.find(indices); - // if (concrete_it == indices_to_concrete.cend()) return misses(substitutions_map::INDICES_MISS); - // const auto& concrete = concrete_it->second; const auto concrete_it = structure_to_concrete.find(structure); if (concrete_it == structure_to_concrete.cend()) return misses(substitutions_map::STRUCTURE_MISS); const auto& concrete = concrete_it->second; - concrete.find_matches(concrete_vars, subs, matches, misses); + concrete.find_matches(concrete_vars, subs, matches, misses, random_state); DREAL_ASSERT(subs.size() == init_size); return; @@ -274,7 +268,7 @@ void DeBruijnCanonicalizer::name ( \ template std::pair>>, matching_stats_t> DeBruijnCanonicalizer::find_matches( - const T& f, const Box& box, const bool return_subs_maps + const T& f, const Box& box, const bool return_subs_maps, uint64_t &random_state ) const { substitutions_map s(box, GetVars(f).size()); @@ -288,7 +282,8 @@ void DeBruijnCanonicalizer::name ( \ if (return_subs_maps) match_vec.emplace_back(m, s); else match_vec.emplace_back(m, std::nullopt); }, - [&](const auto& reason) { ++stats.misses_bc.at(reason); } + [&](const auto& reason) -> auto { ++stats.misses_bc.at(reason); }, + random_state ); return {std::move(match_vec), std::move(stats)}; @@ -296,15 +291,16 @@ void DeBruijnCanonicalizer::name ( \ template std::pair, std::optional>>, matching_stats_t> DeBruijnCanonicalizer::find_matches( - const std::vector& literals, const Box& box, const bool return_subs_maps, std::chrono::duration timeout + const std::vector& literals, const Box& box, const bool return_subs_maps, const std::chrono::duration timeout ) const { + const auto start_time = std::chrono::steady_clock::now(); + uint64_t random_state = timeout.count() == -1 ? 0 : start_time.time_since_epoch().count(); + matching_stats_t stats = {0}; std::vector matches_vec; std::vector, std::optional>> result; matches_vec.reserve(literals.size()); - const auto start_time = std::chrono::steady_clock::now(); - const misses_vec misses = [&](const auto& reason) { ++stats.misses_bc.at(reason); }; bool did_time_out = false; @@ -350,7 +346,7 @@ void DeBruijnCanonicalizer::name ( \ if (return_subs_maps) result.emplace_back(matches_vec, s2); else result.emplace_back(matches_vec, std::nullopt); } - else find_matches(*it2, s2, match_next_literal(it2), misses); + else find_matches(*it2, s2, match_next_literal(it2), misses, random_state); matches_vec.pop_back(); }; }; @@ -358,7 +354,7 @@ void DeBruijnCanonicalizer::name ( \ size_t sub_preallocations = 0; for (const auto& literal : literals) sub_preallocations += GetVars(literal).size(); substitutions_map substitutions(box, sub_preallocations); - find_matches(*ibegin, substitutions, match_next_literal(ibegin), misses); + find_matches(*ibegin, substitutions, match_next_literal(ibegin), misses, random_state); DREAL_ASSERT(result.size() == stats.matches); if (did_time_out) @@ -376,4 +372,4 @@ void DeBruijnCanonicalizer::name ( \ // Force template code generation into this translation unit. template class DeBruijnCanonicalizer; template class DeBruijnCanonicalizer; -} \ No newline at end of file +} diff --git a/src/dreal/util/pattern_matching/map_based/DeBruijnCanonicalizer.h b/src/dreal/util/pattern_matching/map_based/DeBruijnCanonicalizer.h index 7093957c4..1ba538a67 100644 --- a/src/dreal/util/pattern_matching/map_based/DeBruijnCanonicalizer.h +++ b/src/dreal/util/pattern_matching/map_based/DeBruijnCanonicalizer.h @@ -12,6 +12,9 @@ #include "dreal/util/pattern_matching/matching_stats_t.h" #include "dreal/util/pattern_matching/substitutions_map.h" #include "dreal/util/pattern_matching/substitution_tree/substitution_tree.h" +#include +#include +#include namespace dreal { @@ -33,7 +36,7 @@ namespace dreal using matches_vec = std::function; using misses_vec = std::function; void find_matches( - const T& f, substitutions_map& substitutions, const matches_vec& matches, const misses_vec& misses + const T& f, substitutions_map& substitutions, const matches_vec& matches, const misses_vec& misses, uint64_t &random_state ) const; public: @@ -44,12 +47,12 @@ namespace dreal [[nodiscard]] std::pair, std::optional>>, matching_stats_t> find_matches( const std::vector& literals, const Box& b, bool return_subs_maps, - std::chrono::duration timeout = std::chrono::microseconds{-1} + const std::chrono::duration timeout = std::chrono::microseconds{-1} ) const; [[nodiscard]] std::pair>>, matching_stats_t> find_matches( - const T& f, const Box& box, bool return_subs_maps + const T& f, const Box& box, bool return_subs_maps, uint64_t &random_state ) const; diff --git a/src/dreal/util/pattern_matching/substitution_tree/substitution_tree.cc b/src/dreal/util/pattern_matching/substitution_tree/substitution_tree.cc index 3630d4950..de981251b 100644 --- a/src/dreal/util/pattern_matching/substitution_tree/substitution_tree.cc +++ b/src/dreal/util/pattern_matching/substitution_tree/substitution_tree.cc @@ -4,28 +4,59 @@ #include "substitution_tree.h" -#include +#include +#include #include "dreal/util/assert.h" #include "dreal/util/pattern_matching/substitutions_map.h" +#include "dreal/version.h" +#include "dreal/util/math.h" namespace dreal { -#define get_map(variant) std::get>(variant) +#define get_map(variant) std::get>>( (variant) ) + + // "std::map::try_emplace" but for vector-of-pairs. + // todo: should I just implement a vector-backed map structure? + // this type of thing is also used in substitutions_map.cc and probably would be useful elsewhere too. + template ::Node> + void vecmap_try_emplace( + std::vector>& map, + const Variable& new_var, const Leaf& new_leaf + ) { + for (const auto& [v,n] : map) { + if (new_var.equal_to(v)) { + DREAL_ASSERT(std::get(n.next).EqualTo(new_leaf)); + return; + } + } + map.emplace_back(new_var, new_leaf); + } + + // `std::map[key] /*constructs if necessary*/` but for vector-of-pairs. + template ::Node> + Node& vecmap_backets( + std::vector>& map, const Variable& new_var + ) { + for (auto& [v,n] : map) if (new_var.equal_to(v)) return n; + return map.emplace_back(new_var, Node{}).second; + } + template template - void substitution_tree::insert(const It& begin, const It& end, std::map& parents_next, const Leaf& leaf) { + void substitution_tree::insert(const It& begin, const It& end, std::vector>& parents_next, const Leaf& leaf) { const Variable& var = *begin; It next = begin; ++next; if (next == end) { - const auto [it, success] = parents_next.try_emplace(var, leaf); - if (!success) - DREAL_ASSERT(std::get(it->second.next).EqualTo(leaf)); + vecmap_try_emplace(parents_next, var, leaf); + // const auto [it, success] = parents_next.try_emplace(var, leaf); + // if (!success) DREAL_ASSERT(std::get(it->second.next).EqualTo(leaf)); } else { - insert(next, end, get_map(parents_next[var].next/*constructs if necessary*/), leaf); + auto& lu = vecmap_backets(parents_next, var); + insert(next, end, get_map(lu.next/*constructs if necessary*/), leaf); } } @@ -45,7 +76,7 @@ namespace dreal template void substitution_tree::find_matches( const It& begin, const It& end, substitutions_map& subs, const Node& parent, - const matches_vec& matches, const misses_vec& misses + const matches_vec& matches, const misses_vec& misses, const unsigned starting_offset ) const { if (begin == end) { matches(std::get(parent.next), subs); @@ -57,11 +88,19 @@ namespace dreal const Variable& concrete_var = *begin; It next = begin; ++next; - for (const auto& [matched_var, child] : get_map(parent.next)) { + + const auto& map = get_map(parent.next); + const auto N = map.size(); + auto i = N >= 2 ? starting_offset % N : 0; + for (int _i = 0; _i < N; ++_i) { + if (++i >= N) i = 0; + DREAL_ASSERT((0 <= i) && (i < N)); + const auto& [matched_var, child] = map[i]; + subs.push(); auto status = subs.attempt_substitution(matched_var, concrete_var); if (status == substitutions_map::SUCCESS) { - find_matches(next, end, subs, child, matches, misses); + find_matches(next, end, subs, child, matches, misses, starting_offset); } else /*if (status != substitutions_map::SUCCESS)*/ { misses(status); // terminate descent path. @@ -75,13 +114,14 @@ namespace dreal template void substitution_tree::find_matches( const std::vector& concrete_vars, substitutions_map& subs, - const matches_vec& matches, const misses_vec& misses + const matches_vec& matches, const misses_vec& misses, uint64_t &random_state ) const { if (concrete_vars.empty()) { matches(std::get(root->next), subs); } else { - find_matches(concrete_vars.begin(), concrete_vars.end(), subs, *root, matches, misses); + const unsigned random_offset = DREAL_EXPERIMENTAL_PM_SUBSTREE_RANDOMIZE ? fast_random_next(random_state) : 0; + find_matches(concrete_vars.begin(), concrete_vars.end(), subs, *root, matches, misses, random_offset); } } diff --git a/src/dreal/util/pattern_matching/substitution_tree/substitution_tree.h b/src/dreal/util/pattern_matching/substitution_tree/substitution_tree.h index e51a0b695..d97dc08b6 100644 --- a/src/dreal/util/pattern_matching/substitution_tree/substitution_tree.h +++ b/src/dreal/util/pattern_matching/substitution_tree/substitution_tree.h @@ -21,32 +21,34 @@ namespace dreal class Node { public: - Node() : next(std::map{}) {} + Node() : next(std::vector>{}) {} explicit Node(const Leaf& leaf) : next(leaf) {} - Node(const Node& other) = delete; - Node(Node&& other) noexcept = delete; + // needs to be moveable and copyable for use inside std::vector. + // Node(const Node& other) = delete; + // Node(Node&& other) noexcept = delete; std::variant< - std::map, + std::vector>, const Leaf> next; }; std::optional root; template - static void insert(const It& begin, const It& end, std::map& parents_next, const Leaf& leaf); + static void insert(const It& begin, const It& end, std::vector>& parents_next, const Leaf& leaf); using matches_vec = std::function; using misses_vec = std::function; + template + void find_matches(const It& begin, const It& end, substitutions_map& subs, const Node& parent, + const matches_vec& matches, const misses_vec& misses, const unsigned starting_offset) const; + public: void insert(const std::vector& concrete_vars, const Leaf& leaf); - template - void find_matches(const It& begin, const It& end, substitutions_map& subs, const Node& parent, - const matches_vec& matches, const misses_vec& misses) const; - void find_matches(const std::vector& concrete_vars, substitutions_map& subs, const matches_vec& matches, const misses_vec& misses) const; + void find_matches(const std::vector& concrete_vars, substitutions_map& subs, const matches_vec& matches, const misses_vec& misses, uint64_t &random_state) const; }; } diff --git a/src/dreal/version.h b/src/dreal/version.h index c391342b6..a89ff20f6 100644 --- a/src/dreal/version.h +++ b/src/dreal/version.h @@ -8,10 +8,11 @@ #define DREAL_VERSION_MINOR 00 #define DREAL_VERSION_REVISION 1 -#define DREAL_EXPERIMENTAL_SAT_MODEL_FULL_CONSTRAINTS false +#define DREAL_EXPERIMENTAL_SAT_MODEL_FULL_CONSTRAINTS true -// #define DREAL_EXPERIMENTAL_PM_USE_TRIE_IMPL +#define DREAL_EXPERIMENTAL_PM_SUBSTREE_RANDOMIZE true #define DREAL_EXPERIMENTAL_PM_USE_MAP_IMPL +// #define DREAL_EXPERIMENTAL_PM_USE_TRIE_IMPL #define DREAL_EXPERIMENTAL_THEORY_AUDIT_ENABLED false #define DREAL_EXPERIMENTAL_PM_DUMP_ALL_ENABLED false @@ -22,7 +23,6 @@ #define CAV26_VARNAME_PARSER CAV26_SAR_PARSER #define CAV26_MATCH_PURE_TIME_SYM false #define CAV26_MATCH_PURE_LOGIC_SYM false - #endif // check that options are required and mutually exclusive diff --git a/test/dreal/util/test/pattern_matching_test.cc b/test/dreal/util/test/pattern_matching_test.cc index 3e8d52865..4cf849bfd 100644 --- a/test/dreal/util/test/pattern_matching_test.cc +++ b/test/dreal/util/test/pattern_matching_test.cc @@ -87,13 +87,14 @@ namespace dreal ) { // PatternMatchingTrie trie; // PatternMatchingTrie &trie2 = trie; + uint64_t random_state = 0; DeBruijnCanonicalizer trie; DeBruijnCanonicalizer trie2; for (const auto& match : matches) trie.insert(match); for (const auto& miss : misses1) trie.insert(miss); for (const auto& miss : misses2) trie2.insert(miss); std::set found; - for (const auto& [form, op_subs] : trie.find_matches(pattern, Box{}, true).first) { + for (const auto& [form, op_subs] : trie.find_matches(pattern, Box{}, true, random_state).first) { EXPECT_TRUE(op_subs.has_value()); // trie.find_matches(..., return_subs_maps=true) const auto& subs = *op_subs; // check substitutions are correct and injective: @@ -608,6 +609,7 @@ namespace dreal } TEST_F(PatternMatchingTest, BinaryAndUnaryOpsComplete) { + uint64_t random_state = 0; DeBruijnCanonicalizer trie; std::vector es{ // for coverage... make sure we didn't mess up call of the unary/binary op helper functions. x1 / x2, log(x1), abs(x1), exp(x1), sqrt(x1), pow(x1, x2), sin(x1), cos(x1), tan(x1), asin(x1), @@ -626,13 +628,13 @@ namespace dreal pattern.Substitute({{x1, p1}, {x2, p2}}), }; for (const auto& match : matches) { - const auto found = trie.find_matches(match, Box{}, false).first; + const auto found = trie.find_matches(match, Box{}, false, random_state).first; EXPECT_EQ(found.size(), 1); EXPECT_EQ(found[0].second, std::nullopt); // trie.find_matches(..., return_subs_maps=false) std::cout << pattern << " MATCHES " << match << std::endl; } for (const auto& miss : misses) { - const auto found = trie.find_matches(miss, Box{}, false).first; + const auto found = trie.find_matches(miss, Box{}, false, random_state).first; EXPECT_EQ(found.size(), 0); std::cout << pattern << " MISSES " << miss << std::endl; } From 9e37ebb00783fc050002782a84bd935b72e87561 Mon Sep 17 00:00:00 2001 From: Kunal Sheth Date: Mon, 5 Jan 2026 16:29:02 -0800 Subject: [PATCH 40/43] Slightly increase PM timeout for very-long-running lemmas. --- src/dreal/solver/config.cc | 4 +++- src/dreal/solver/config.h | 2 +- src/dreal/solver/context_impl.cc | 12 +++++++----- 3 files changed, 11 insertions(+), 7 deletions(-) diff --git a/src/dreal/solver/config.cc b/src/dreal/solver/config.cc index b639adbb7..4cb8a423c 100644 --- a/src/dreal/solver/config.cc +++ b/src/dreal/solver/config.cc @@ -128,7 +128,9 @@ int Config::drpm_max_size() const { return drpm_max_size_.get(); } OptionValue& Config::mutable_drpm_max_size() { return drpm_max_size_; } -double Config::drpm_max_time() const { return drpm_max_time_.get(); } +std::chrono::duration Config::drpm_max_time() const { + return std::chrono::duration(drpm_max_time_.get()); +} OptionValue& Config::mutable_drpm_max_time() { return drpm_max_time_; } diff --git a/src/dreal/solver/config.h b/src/dreal/solver/config.h index c7f55db0b..5e89b47ca 100644 --- a/src/dreal/solver/config.h +++ b/src/dreal/solver/config.h @@ -156,7 +156,7 @@ class Config { int drpm_max_size() const; OptionValue& mutable_drpm_max_size(); - double drpm_max_time() const; + std::chrono::duration drpm_max_time() const; OptionValue& mutable_drpm_max_time(); /// Returns if it's smtlib2_compliant mode. diff --git a/src/dreal/solver/context_impl.cc b/src/dreal/solver/context_impl.cc index af275a6a2..4ec81f0ab 100644 --- a/src/dreal/solver/context_impl.cc +++ b/src/dreal/solver/context_impl.cc @@ -272,12 +272,14 @@ optional Context::Impl::CheckSatCore(const ScopedVector& stack, /*&& explanation.size() < 384 /* stack overflows around size=960 on x86 #1# && tscs_elapsed > std::chrono::milliseconds(3)*/) { /* ################################ START MEASURING TIME ################################ */ - const auto pm_start = std::chrono::high_resolution_clock::now(); - const auto pm_result = sat_solver->AddLearnedClausePattern( - pn_, explanation, box, - std::min(std::chrono::duration_cast(100 * tcs_elapsed_ms), - std::chrono::duration_cast(std::chrono::duration(config().drpm_max_time()))) +#define TO_MICROS(x) ( std::chrono::duration_cast((x)) ) + auto pm_timeout = TO_MICROS(scs_elapsed_ms + tcs_elapsed_ms); + pm_timeout += std::min( // for edge-case of very, very long-running lemmas. try HARD to match those. + 99 * pm_timeout, // `+=`, so 100 + TO_MICROS(config().drpm_max_time()) ); + const auto pm_start = std::chrono::high_resolution_clock::now(); + const auto pm_result = sat_solver->AddLearnedClausePattern(pn_, explanation, box, pm_timeout); const auto pm_end = std::chrono::high_resolution_clock::now(); const std::chrono::duration pm_elapsed = pm_end - pm_start; /* ################################ STOP MEASURING TIME ################################ */ From 4b4467002e0d97b52a597046e46f65a1e1f174cd Mon Sep 17 00:00:00 2001 From: Kunal Sheth Date: Wed, 7 Jan 2026 09:56:54 -0800 Subject: [PATCH 41/43] Make threshold value for fixed-point a macro. --- src/dreal/solver/theory_solver.cc | 3 ++- src/dreal/version.h | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/dreal/solver/theory_solver.cc b/src/dreal/solver/theory_solver.cc index e5742fdb2..62db7d33c 100644 --- a/src/dreal/solver/theory_solver.cc +++ b/src/dreal/solver/theory_solver.cc @@ -23,6 +23,7 @@ #include +#include "dreal/version.h" #include "dreal/contractor/contractor_forall.h" #include "dreal/contractor/odes/contractor_odes.h" #include "dreal/solver/context.h" @@ -57,7 +58,7 @@ namespace { bool DefaultTerminationCondition(const Box::IntervalVector& old_iv, const Box::IntervalVector& new_iv) { DREAL_ASSERT(!new_iv.is_empty()); - constexpr double kThreshold{0.01}; + constexpr double kThreshold{DREAL_EXPERIMENTAL_THEORY_FIXEDPT_THRESHOLD}; // If there is a dimension which is improved more than // threshold, we continue the current fixed-point computation // (return false). diff --git a/src/dreal/version.h b/src/dreal/version.h index a89ff20f6..e7539a107 100644 --- a/src/dreal/version.h +++ b/src/dreal/version.h @@ -9,6 +9,7 @@ #define DREAL_VERSION_REVISION 1 #define DREAL_EXPERIMENTAL_SAT_MODEL_FULL_CONSTRAINTS true +#define DREAL_EXPERIMENTAL_THEORY_FIXEDPT_THRESHOLD 0.01 #define DREAL_EXPERIMENTAL_PM_SUBSTREE_RANDOMIZE true #define DREAL_EXPERIMENTAL_PM_USE_MAP_IMPL From bacf835738e4e39d34bcef35177ea42a986dd587 Mon Sep 17 00:00:00 2001 From: Kunal Sheth Date: Sat, 4 Jul 2026 11:57:12 -0700 Subject: [PATCH 42/43] chore: add Apache-2.0 LICENSE and NOTICE for FMCAD26 artifact release MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Ships the full Apache License 2.0 text (required by §4(a) for redistribution) and a NOTICE crediting the upstream © Toyota Research Institute and this ncsys-lab research fork. No code change. Co-Authored-By: Claude Opus 4.8 (1M context) --- LICENSE | 201 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ NOTICE | 16 +++++ 2 files changed, 217 insertions(+) create mode 100644 LICENSE create mode 100644 NOTICE diff --git a/LICENSE b/LICENSE new file mode 100644 index 000000000..261eeb9e9 --- /dev/null +++ b/LICENSE @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/NOTICE b/NOTICE new file mode 100644 index 000000000..a0d725a0e --- /dev/null +++ b/NOTICE @@ -0,0 +1,16 @@ +dReal +Copyright 2017 Toyota Research Institute + +This product includes software developed at Toyota Research Institute +(https://github.com/dreal/dreal4), licensed under the Apache License, +Version 2.0. + +This distribution is a research fork maintained by the ncsys-lab group at +Stanford University (https://github.com/ncsys-lab/dReal-CMake), packaged as +the FMCAD26 artifact. Modifications are covered by the same Apache License, +Version 2.0 (see the LICENSE file), and are noted in the source history. + +Third-party components are redistributed under their own licenses, including +IBEX (LGPL-3.0), CAPD, Drake symbolic (BSD-3-Clause), fmt (MIT), spdlog (MIT), +nlopt, libcds, and a vendored ThreadPool. See the respective source trees for +their full license texts. From 9cf8cca93bb82ac4cb5d35593c0ed6d346067fd6 Mon Sep 17 00:00:00 2001 From: Kunal Sheth Date: Sat, 4 Jul 2026 12:54:48 -0700 Subject: [PATCH 43/43] build: DREAL_EXE_LINKER_FLAGS build-arg for a fully-static Linux binary FULL_BUILD.sh forwards extra args to the top-level cmake configure ("$@"), and Dockerfile.dreal_ubuntu exposes a DREAL_EXE_LINKER_FLAGS build-arg wired to -DCMAKE_EXE_LINKER_FLAGS. Building with `--build-arg DREAL_EXE_LINKER_FLAGS=-static` links dreal4 statically for the FMCAD26 release, applied to the top-level executable only (a global LDFLAGS=-static breaks the FILIB/CAPD autotools sub-builds). Empty default preserves the normal build. Co-Authored-By: Claude Opus 4.8 (1M context) --- Dockerfile.dreal_ubuntu | 8 +++++++- FULL_BUILD.sh | 2 +- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/Dockerfile.dreal_ubuntu b/Dockerfile.dreal_ubuntu index 51a192f5c..348322605 100644 --- a/Dockerfile.dreal_ubuntu +++ b/Dockerfile.dreal_ubuntu @@ -88,6 +88,12 @@ COPY src/ /dreal/src COPY test/ /dreal/test COPY CMakeLists.txt /dreal/CMakeLists.txt COPY FULL_BUILD.sh /dreal/FULL_BUILD.sh -RUN /dreal/FULL_BUILD.sh +# Linker flags applied to the top-level dreal4 executable ONLY (not the FILIB/CAPD +# autotools sub-builds, which break under a global LDFLAGS=-static). Build with +# --build-arg DREAL_EXE_LINKER_FLAGS=-static +# to produce a fully static dreal4 (portable binary for the FMCAD26 release). +# Empty default preserves the normal (dynamic) image build. +ARG DREAL_EXE_LINKER_FLAGS="" +RUN /dreal/FULL_BUILD.sh -DCMAKE_EXE_LINKER_FLAGS="${DREAL_EXE_LINKER_FLAGS}" WORKDIR /dreal/gcc_build/ diff --git a/FULL_BUILD.sh b/FULL_BUILD.sh index f4c215a1d..b6492359a 100755 --- a/FULL_BUILD.sh +++ b/FULL_BUILD.sh @@ -4,7 +4,7 @@ cd "$(dirname "$0")" mkdir gcc_build cd gcc_build && -cmake -DCMAKE_BUILD_TYPE=Release .. && +cmake -DCMAKE_BUILD_TYPE=Release "$@" .. && cmake --build . --target dreal4 -j8 && cd ../ && echo -e "\a DONE! \a"