@@ -508,7 +508,7 @@ namespace lp {
508
508
term_o term_to_tighten = lra.get_term (j); // copy the term aside
509
509
std::queue<unsigned > q;
510
510
for (const auto & p: term_to_tighten) {
511
- if (can_substitute (p.j ()))
511
+ if (can_substitute (p.j ()) && !lra. column_is_fixed (p. j ()) )
512
512
q.push (p.j ());
513
513
}
514
514
if (q.empty ()) {
@@ -549,23 +549,11 @@ namespace lp {
549
549
}
550
550
551
551
void get_expl_from_meta_term (const lar_term& t, explanation& ex) {
552
- for (const auto & p: t) {
553
- const auto & l = lra.get_term (p.j ());
554
- get_expl_from_lar_term (l, ex);
555
- }
552
+ u_dependency *dep = explain_fixed_in_meta_term (t);
553
+ for (constraint_index ci : lra.flatten (dep))
554
+ ex.push_back (ci);
556
555
}
557
556
558
- void get_expl_from_lar_term (const lar_term & l, explanation& ex) {
559
- for (const auto & p: l) {
560
- if (lra.column_is_fixed (p.j ())) {
561
- u_dependency* u = lra.get_bound_constraint_witnesses_for_column (p.j ());
562
- for (const auto & ci: lra.flatten (u)) {
563
- ex.push_back (ci);
564
- }
565
- }
566
- }
567
- }
568
-
569
557
void handle_constant_term (unsigned j) {
570
558
if (m_c.is_zero ()) {
571
559
return ;
@@ -575,13 +563,21 @@ namespace lp {
575
563
u_dependency *b_dep = nullptr ;
576
564
if (lra.has_upper_bound (j, b_dep, rs, is_strict)) {
577
565
if (m_c > rs || (is_strict && m_c == rs)) {
578
- get_expl_from_meta_term (m_tmp_l, m_infeas_explanation);
566
+ u_dependency* dep = lra.mk_join (explain_fixed (lra.get_term (j)), explain_fixed_in_meta_term (m_tmp_l));
567
+ dep = lra.mk_join (dep, lra.get_bound_constraint_witnesses_for_column (j));
568
+ for (constraint_index ci : lra.flatten (dep)) {
569
+ m_infeas_explanation.push_back (ci);
570
+ }
579
571
return ;
580
572
}
581
573
}
582
574
if (lra.has_lower_bound (j, b_dep, rs, is_strict)) {
583
575
if (m_c < rs || (is_strict && m_c == rs)) {
584
- get_expl_from_meta_term (m_tmp_l, m_infeas_explanation);
576
+ u_dependency* dep = lra.mk_join (explain_fixed (lra.get_term (j)), explain_fixed_in_meta_term (m_tmp_l));
577
+ dep = lra.mk_join (dep, lra.get_bound_constraint_witnesses_for_column (j));
578
+ for (constraint_index ci : lra.flatten (dep)) {
579
+ m_infeas_explanation.push_back (ci);
580
+ }
585
581
}
586
582
}
587
583
}
@@ -626,7 +622,10 @@ namespace lp {
626
622
dep = lra.mk_join (dep, explain_fixed_in_meta_term (m_tmp_l));
627
623
u_dependency* j_bound_dep = upper? lra.get_column_upper_bound_witness (j): lra.get_column_lower_bound_witness (j);
628
624
dep = lra.mk_join (dep, j_bound_dep);
629
- TRACE (" dioph_eq" , tout << " jterm:" ; print_lar_term_L (lra.get_term (j), tout) << " \n dep:" ; print_dep (tout, dep) << std::endl;);
625
+ dep = lra.mk_join (dep, explain_fixed (lra.get_term (j)));
626
+ dep = lra.mk_join (dep, lra.get_bound_constraint_witnesses_for_column (j));
627
+ TRACE (" dioph_eq" , tout << " jterm:" ; print_lar_term_L (lra.get_term (j), tout) << " \n dep:" ; print_dep (tout, dep) << std::endl;
628
+ );
630
629
lra.update_column_type_and_bound (j, kind, bound, dep);
631
630
}
632
631
@@ -636,11 +635,11 @@ namespace lp {
636
635
for (const auto & p: t) {
637
636
lar_term const & term = lra.get_term (p.j ());
638
637
for (const auto & q: term) {
639
- if (is_fixed (q.j ())) {
640
- u_dependency* bound_dep = lra.get_bound_constraint_witnesses_for_column (q.j ());
641
- dep = lra.mk_join (dep, bound_dep);
642
- }
638
+ if (is_fixed (q.j ()))
639
+ dep = lra.mk_join (dep, lra.get_bound_constraint_witnesses_for_column (q.j ()));
643
640
}
641
+ if (is_fixed (p.j ()))
642
+ dep = lra.mk_join (dep, lra.get_bound_constraint_witnesses_for_column (p.j ()));
644
643
}
645
644
return dep;
646
645
}
@@ -890,25 +889,27 @@ namespace lp {
890
889
return print_eprime_entry (m_eprime[i], out, print_dep);
891
890
}
892
891
893
- std::ostream& print_eprime_entry (const eprime_entry& e, std::ostream& out, bool print_dep = true ) {
892
+ std::ostream& print_eprime_entry (const eprime_entry& e, std::ostream& out, bool need_print_dep = true ) {
894
893
out << " {\n " ;
895
894
print_term_o (get_term_from_e_matrix (e.m_row_index ), out << " \t m_e:" ) << " ,\n " ;
896
895
// out << "\tstatus:" << (int)e.m_entry_status;
897
- if (print_dep ) {
896
+ if (need_print_dep ) {
898
897
out << " \t m_l:{" ; print_lar_term_L (e.m_l , out) << " }, " ;
899
- print_ml (e.m_l , out<< " \t opened m_l:" ) << " \n " ;
898
+ print_ml (e.m_l , out<< " \t fixed expl of m_l:" ) << " \n " ;
899
+ print_dep (out, explain_fixed_in_meta_term (e.m_l )) << std::endl;
900
900
}
901
901
switch (e.m_entry_status )
902
902
{
903
903
case entry_status::F:
904
- out << " \t F \n " ;
904
+ out << " \t in F \n " ;
905
905
break ;
906
906
case entry_status::S:
907
- out << " \t S \n " ;
907
+ out << " \t in S \n " ;
908
908
break ;
909
909
default :
910
910
out << " \t NOSF\n " ;
911
911
}
912
+ out << " }\n " ;
912
913
return out;
913
914
}
914
915
@@ -969,14 +970,6 @@ namespace lp {
969
970
SASSERT (ex.empty ());
970
971
TRACE (" dioph_eq" , tout << " conflict:" ; print_eprime_entry (m_conflict_index, tout, true ) << std::endl;);
971
972
auto & ep = m_eprime[m_conflict_index];
972
- /*
973
- for (const auto & pl : ep.m_l) {
974
- unsigned row_index = pl.j();
975
- for (const auto & p : lra.get_row(row_index))
976
- if (lra.column_is_fixed(p.var()))
977
- lra.explain_fixed_column(p.var(), ex);
978
- }
979
- */
980
973
for (auto ci: lra.flatten (eq_deps (ep.m_l ))) {
981
974
ex.push_back (ci);
982
975
}
0 commit comments