mirror of
https://github.com/Z3Prover/z3
synced 2025-04-27 19:05:51 +00:00
remove warnings in scaler and use m_cut_solver_cycle_on_var
Signed-off-by: Lev Nachmanson <levnach@hotmail.com> detect slow propagations Signed-off-by: Lev Nachmanson <levnach@hotmail.com> fiddle with the stop conditions Signed-off-by: Lev Nachmanson <levnach@hotmail.com> get rid of constraint->m_predecessors, fix a bug in push/pop with lemmas Signed-off-by: Lev Nachmanson <levnach@hotmail.com> clean detection of stale lemmas in pop Signed-off-by: Lev Nachmanson <levnach@hotmail.com> add constraints lazily to cut_solver Signed-off-by: Lev Nachmanson <levnach@hotmail.com> refactor some of cut_solver classes into include files Signed-off-by: Lev Nachmanson <levnach@hotmail.com> prepare to index constraint from 0 to to n - 1, where n is the number of constraints Signed-off-by: Lev Nachmanson <levnach@hotmail.com> prepare for constraint priority Signed-off-by: Lev Nachmanson <levnach@hotmail.com> use priorities in active_set Signed-off-by: Lev Nachmanson <levnach@hotmail.com> remove unnecesessary parameters Signed-off-by: Lev Nachmanson <levnach@hotmail.com> speedup bound propagations Signed-off-by: Lev Nachmanson <levnach@hotmail.com> restore tactics Signed-off-by: Lev Nachmanson <levnach@hotmail.com> speedup bound propagation by avoiding some calls to propagate_constraint_only_one_unlim Signed-off-by: Lev Nachmanson <levnach@hotmail.com> fixes by Nikolaj Signed-off-by: Lev Nachmanson <levnach@hotmail.com> fix print lp_core_solver Signed-off-by: Lev Nachmanson <levnach@hotmail.com> work on gomory test, subs terms indices correctly Signed-off-by: Lev Nachmanson <levnach@hotmail.com> correct const_iterator for lar_term Signed-off-by: Lev Nachmanson <levnach@hotmail.com> improve static_matrix with iterators Signed-off-by: Lev Nachmanson <levnach@hotmail.com> make row_strip a struct Signed-off-by: Lev Nachmanson <levnach@hotmail.com> move row_strip outside of static_matrix Signed-off-by: Lev Nachmanson <levnach@hotmail.com> add const_iterator to row_strip Signed-off-by: Lev Nachmanson <levnach@hotmail.com> remove the hierarchy of iterators - use std::iterators Signed-off-by: Lev Nachmanson <levnach@hotmail.com> adding gcd_test stats and taking care of for iterators Signed-off-by: Lev Nachmanson <levnach@hotmail.com> restore qflia_tactic.cpp Signed-off-by: Lev Nachmanson <levnach@hotmail.com> run gcd_test according to settings() Signed-off-by: Lev Nachmanson <levnach@hotmail.com> experiment with picking a narrow or random branch Signed-off-by: Lev Nachmanson <levnach@hotmail.com>
This commit is contained in:
parent
6202b2f2e4
commit
2bb94ed4fe
55 changed files with 1715 additions and 1347 deletions
|
@ -50,6 +50,8 @@ Revision History:
|
|||
#include "util/lp/integer_domain.h"
|
||||
#include "util/lp/stacked_map.h"
|
||||
#include <cstdlib>
|
||||
#include "test/lp/gomory_test.h"
|
||||
|
||||
namespace lp {
|
||||
unsigned seed = 1;
|
||||
|
||||
|
@ -1883,6 +1885,7 @@ void test_replace_column() {
|
|||
|
||||
|
||||
void setup_args_parser(argument_parser & parser) {
|
||||
parser.add_option_with_help_string("-gomory", "gomory");
|
||||
parser.add_option_with_help_string("-intd", "test integer_domain");
|
||||
parser.add_option_with_help_string("-xyz_sample", "run a small interactive scenario");
|
||||
parser.add_option_with_after_string_with_help("--density", "the percentage of non-zeroes in the matrix below which it is not dense");
|
||||
|
@ -3255,6 +3258,153 @@ void test_resolve(cut_solver& cs, unsigned constraint_index, unsigned i0) {
|
|||
}
|
||||
|
||||
|
||||
void test_gomory_cut_0() {
|
||||
gomory_test g(
|
||||
[](unsigned j) { return "v" + T_to_string(j);} // name_function_p
|
||||
,
|
||||
[](unsigned j) { //get_value_p
|
||||
if (j == 1)
|
||||
return mpq(2730, 1727);
|
||||
if (j == 2)
|
||||
return zero_of_type<mpq>();
|
||||
if (j == 3) return mpq(3);
|
||||
lp_assert(false);
|
||||
return zero_of_type<mpq>();
|
||||
},
|
||||
[](unsigned j) { // at_low_p
|
||||
if (j == 1)
|
||||
return false;
|
||||
if (j == 2)
|
||||
return true;
|
||||
if (j == 3)
|
||||
return true;
|
||||
lp_assert(false);
|
||||
return false;
|
||||
},
|
||||
[](unsigned j) { // at_upper
|
||||
if (j == 1)
|
||||
return false;
|
||||
if (j == 2)
|
||||
return true;
|
||||
if (j == 3)
|
||||
return false;
|
||||
lp_assert(false);
|
||||
return false;
|
||||
},
|
||||
[](unsigned j) { // lower_bound
|
||||
if (j == 1) {
|
||||
lp_assert(false); //unlimited from below
|
||||
return 0;
|
||||
}
|
||||
if (j == 2)
|
||||
return 0;
|
||||
if (j == 3)
|
||||
return 3;
|
||||
lp_assert(false);
|
||||
return 0;
|
||||
},
|
||||
[](unsigned j) { // upper
|
||||
if (j == 1) {
|
||||
lp_assert(false); //unlimited from above
|
||||
return 0;
|
||||
}
|
||||
if (j == 2)
|
||||
return 0;
|
||||
if (j == 3)
|
||||
return 10;
|
||||
lp_assert(false);
|
||||
return 0;
|
||||
},
|
||||
[] (unsigned) { return 0; },
|
||||
[] (unsigned) { return 0; }
|
||||
);
|
||||
lar_term t;
|
||||
mpq k;
|
||||
explanation expl;
|
||||
unsigned inf_col = 1;
|
||||
vector<std::pair<mpq, unsigned>> row;
|
||||
row.push_back(std::make_pair(mpq(1), 1));
|
||||
row.push_back(std::make_pair(mpq(2731, 1727), 2));
|
||||
row.push_back(std::make_pair(mpq(-910, 1727), 3));
|
||||
g.mk_gomory_cut(t, k, expl, inf_col, row);
|
||||
}
|
||||
|
||||
void test_gomory_cut_1() {
|
||||
gomory_test g(
|
||||
[](unsigned j) { return "v" + T_to_string(j);} // name_function_p
|
||||
,
|
||||
[](unsigned j) { //get_value_p
|
||||
if (j == 1)
|
||||
return mpq(-2);
|
||||
if (j == 2)
|
||||
return mpq(4363334, 2730001);
|
||||
if (j == 3)
|
||||
return mpq(1);
|
||||
lp_assert(false);
|
||||
return zero_of_type<mpq>();
|
||||
},
|
||||
[](unsigned j) { // at_low_p
|
||||
if (j == 1)
|
||||
return false;
|
||||
if (j == 2)
|
||||
return false;
|
||||
if (j == 3)
|
||||
return true;
|
||||
lp_assert(false);
|
||||
return false;
|
||||
},
|
||||
[](unsigned j) { // at_upper
|
||||
if (j == 1)
|
||||
return true;
|
||||
if (j == 2)
|
||||
return false;
|
||||
if (j == 3)
|
||||
return true;
|
||||
lp_assert(false);
|
||||
return false;
|
||||
},
|
||||
[](unsigned j) { // lower_bound
|
||||
if (j == 1) {
|
||||
lp_assert(false); //unlimited from below
|
||||
return 0;
|
||||
}
|
||||
if (j == 2)
|
||||
return 1;
|
||||
if (j == 3)
|
||||
return 1;
|
||||
lp_assert(false);
|
||||
return 0;
|
||||
},
|
||||
[](unsigned j) { // upper
|
||||
if (j == 1) {
|
||||
return -2;
|
||||
}
|
||||
if (j == 2)
|
||||
return 3333;
|
||||
if (j == 3)
|
||||
return 10000;
|
||||
lp_assert(false);
|
||||
return 0;
|
||||
},
|
||||
[] (unsigned) { return 0; },
|
||||
[] (unsigned) { return 0; }
|
||||
);
|
||||
lar_term t;
|
||||
mpq k;
|
||||
explanation expl;
|
||||
unsigned inf_col = 2;
|
||||
vector<std::pair<mpq, unsigned>> row;
|
||||
row.push_back(std::make_pair(mpq(1726667, 2730001), 1));
|
||||
row.push_back(std::make_pair(mpq(-910000, 2730001), 3));
|
||||
row.push_back(std::make_pair(mpq(1), 2));
|
||||
g.mk_gomory_cut(t, k, expl, inf_col, row);
|
||||
}
|
||||
|
||||
void test_gomory_cut() {
|
||||
test_gomory_cut_0();
|
||||
test_gomory_cut_1();
|
||||
}
|
||||
|
||||
void test_lp_local(int argn, char**argv) {
|
||||
|
||||
// initialize_util_module();
|
||||
|
@ -3270,7 +3420,10 @@ void test_lp_local(int argn, char**argv) {
|
|||
}
|
||||
|
||||
args_parser.print();
|
||||
|
||||
if (args_parser.option_is_used("-gomory")) {
|
||||
test_gomory_cut();
|
||||
return finalize(0);
|
||||
}
|
||||
if (args_parser.option_is_used("-intd")) {
|
||||
test_integer_domain();
|
||||
return finalize(0);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue