mirror of
https://github.com/Z3Prover/z3
synced 2025-06-28 00:48:45 +00:00
rebase with z3prover
Signed-off-by: Lev <levnach@hotmail.com>
This commit is contained in:
parent
4ca0ca3ce8
commit
d301a9c403
8 changed files with 77 additions and 92 deletions
|
@ -82,7 +82,7 @@ struct gomory_test {
|
|||
expl.push_justification(column_upper_bound_constraint(x_j), new_a);
|
||||
}
|
||||
TRACE("gomory_cut_detail_real", tout << a << "*v" << x_j << " k: " << k << "\n";);
|
||||
pol.add_monomial(new_a, x_j);
|
||||
pol.add_coeff_var(new_a, x_j);
|
||||
}
|
||||
|
||||
void int_case_in_gomory_cut(const mpq & a, unsigned x_j, mpq & k, lar_term & t, explanation& expl, mpq & lcm_den, const mpq& f_0, const mpq& one_minus_f_0) {
|
||||
|
@ -122,7 +122,7 @@ struct gomory_test {
|
|||
expl.push_justification(column_upper_bound_constraint(x_j), new_a);
|
||||
}
|
||||
TRACE("gomory_cut_detail", tout << "new_a: " << new_a << " k: " << k << "\n";);
|
||||
t.add_monomial(new_a, x_j);
|
||||
t.add_coeff_var(new_a, x_j);
|
||||
lcm_den = lcm(lcm_den, denominator(new_a));
|
||||
}
|
||||
|
||||
|
@ -145,12 +145,12 @@ struct gomory_test {
|
|||
if (!k.is_int())
|
||||
k = ceil(k);
|
||||
// switch size
|
||||
t.add_monomial(- mpq(1), v);
|
||||
t.add_coeff_var(- mpq(1), v);
|
||||
k.neg();
|
||||
} else {
|
||||
if (!k.is_int())
|
||||
k = floor(k);
|
||||
t.add_monomial(mpq(1), v);
|
||||
t.add_coeff_var(mpq(1), v);
|
||||
}
|
||||
} else {
|
||||
TRACE("gomory_cut_detail", tout << "pol.size() > 1" << std::endl;);
|
||||
|
@ -177,7 +177,7 @@ struct gomory_test {
|
|||
|
||||
// negate everything to return -pol <= -k
|
||||
for (const auto & pi: pol)
|
||||
t.add_monomial(-pi.first, pi.second);
|
||||
t.add_coeff_var(-pi.first, pi.second);
|
||||
k.neg();
|
||||
}
|
||||
TRACE("gomory_cut_detail", tout << "k = " << k << std::endl;);
|
||||
|
|
|
@ -54,6 +54,7 @@
|
|||
#include "util/lp/lu_def.h"
|
||||
#include "util/lp/general_matrix.h"
|
||||
#include "util/lp/bound_propagator.h"
|
||||
#include "util/lp/nla_solver.h"
|
||||
namespace lp {
|
||||
unsigned seed = 1;
|
||||
|
||||
|
@ -1895,6 +1896,7 @@ void test_replace_column() {
|
|||
|
||||
|
||||
void setup_args_parser(argument_parser & parser) {
|
||||
parser.add_option_with_help_string("-nla", "test nla_solver");
|
||||
parser.add_option_with_help_string("-hnf", "test hermite normal form");
|
||||
parser.add_option_with_help_string("-gomory", "gomory");
|
||||
parser.add_option_with_help_string("-intd", "test integer_domain");
|
||||
|
@ -2405,7 +2407,7 @@ void run_lar_solver(argument_parser & args_parser, lar_solver * solver, mps_read
|
|||
lp_status status = solver->solve();
|
||||
std::cout << "status is " << lp_status_to_string(status) << ", processed for " << sw.get_current_seconds() <<" seconds, and " << solver->get_total_iterations() << " iterations" << std::endl;
|
||||
if (solver->get_status() == lp_status::INFEASIBLE) {
|
||||
vector<std::pair<lp::mpq, constraint_index>> evidence;
|
||||
explanation evidence;
|
||||
solver->get_infeasibility_explanation(evidence);
|
||||
}
|
||||
if (args_parser.option_is_used("--randomize_lar")) {
|
||||
|
@ -3546,6 +3548,10 @@ void test_gomory_cut() {
|
|||
test_gomory_cut_1();
|
||||
}
|
||||
|
||||
void test_nla() {
|
||||
nla::solver::test();
|
||||
}
|
||||
|
||||
void test_lp_local(int argn, char**argv) {
|
||||
|
||||
// initialize_util_module();
|
||||
|
@ -3561,7 +3567,15 @@ void test_lp_local(int argn, char**argv) {
|
|||
}
|
||||
|
||||
args_parser.print();
|
||||
|
||||
if (args_parser.option_is_used("-nla")) {
|
||||
#ifdef Z3DEBUG
|
||||
test_nla();
|
||||
#endif
|
||||
return finalize(0);
|
||||
}
|
||||
|
||||
|
||||
if (args_parser.option_is_used("-hnf")) {
|
||||
#ifdef Z3DEBUG
|
||||
test_hnf();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue