@@ -343,6 +343,9 @@ namespace lp {
343343            return  out;
344344        }
345345
346+         //  the maximal size of the term to try to tighten the bounds:
347+         //  if the size of the term is large than the chances are that the GCD of the coefficients is one
348+         unsigned  m_tighten_size_max = 10 ;
346349        bool  m_some_terms_are_ignored = false ;
347350        std_vector<mpq> m_sum_of_fixed;
348351        //  we have to use m_var_register because of the fresh variables: otherwise they clash with the existing lar_solver column indices
@@ -360,8 +363,9 @@ namespace lp {
360363        //  set S - iterate over bijection m_k2s
361364        mpq m_c;  //  the constant of the equation
362365        struct  term_with_index  {
363-             //  The invariant is that m_index[m_data[k].var()] = k, for each 0 <= k < m_data.size(),
364-             //  and m_index[j] = -1, or m_tmp[m_index[j]].var() = j, for every 0 <= j < m_index.size().
366+             //  The invariant is
367+             //  1)  m_index[m_data[k].var()] = k, for each 0 <= k < m_data.size(), and
368+             //  2)  m_index[j] = -1, or m_data[m_index[j]].var() = j, for every 0 <= j < m_index.size().
365369            //  For example m_data = [(coeff, 5), (coeff, 3)]
366370            //  then m_index = [-1,-1, -1, 1, -1, 0, -1, ....].
367371            std_vector<iv> m_data;
@@ -375,6 +379,8 @@ namespace lp {
375379                return  r;
376380            }
377381
382+             auto  size () const  { return  m_data.size (); }
383+             
378384            bool  has (unsigned  k) const  {
379385                return  k < m_index.size () && m_index[k] >= 0 ;
380386            }
@@ -626,9 +632,7 @@ namespace lp {
626632                    m_q.erase (it->second );
627633                    m_positions.erase (it);
628634                }
629-                 if  (!invariant ()) {
630-                     throw  std::runtime_error (" Invariant violation in protected_queue"  );
631-                 }
635+                 SASSERT (invariant ());
632636            }
633637
634638            bool  contains (unsigned  j) const  {
@@ -780,9 +784,12 @@ namespace lp {
780784        std_vector<branch> m_branch_stack;
781785        std_vector<constraint_index> m_explanation_of_branches;
782786        bool  term_has_big_number (const  lar_term& t) const  {
783-             for  (const  auto & p : t)
787+             for  (const  auto & p : t) { 
784788                if  (p.coeff ().is_big ())
785789                    return  true ;
790+                 if  (is_fixed (p.var ()) && lra.get_lower_bound (p.var ()).x .is_big ())
791+                     return  true ;
792+             }
786793            return  false ;
787794        }
788795
@@ -896,7 +903,7 @@ namespace lp {
896903            }
897904            subs_entry (entry_index);
898905            SASSERT (entry_invariant (entry_index));
899-             TRACE (" dio "  , print_entry (entry_index, tout) << std::endl;);
906+             TRACE (" dio_entry "  , print_entry (entry_index, tout) << std::endl;);
900907        }
901908        void  subs_entry (unsigned  ei) {
902909            if  (ei >= m_e_matrix.row_count ()) return ;
@@ -1483,7 +1490,7 @@ namespace lp {
14831490
14841491        lia_move subs_with_S_and_fresh (protected_queue& q, unsigned  j) {
14851492            lia_move r = lia_move::undef;
1486-             while  (!q.empty () && r != lia_move::conflict) {
1493+             while  (!q.empty () && r != lia_move::conflict && m_espace. size () <= m_tighten_size_max ) {
14871494                lia_move ret = subs_front_with_S_and_fresh (q, j);
14881495                r = join (ret, r);
14891496            }
@@ -1535,6 +1542,8 @@ namespace lp {
15351542            );
15361543            for  (unsigned  j : sorted_changed_terms) {
15371544                m_terms_to_tighten.remove (j);
1545+                 if  (ignore_big_nums () && term_has_big_number (lra.get_term (j)))
1546+                     continue ;
15381547                auto  ret = tighten_bounds_for_term_column (j);
15391548                r = join (ret, r);
15401549                if  (r == lia_move::conflict)
0 commit comments