mirror of
https://github.com/Z3Prover/z3
synced 2025-09-30 21:19:29 +00:00
add option to control epsilon #7791
#7791 reports on using model values during lex optimization that break soft constraints. This is an artifact of using optimization where optimal values can be arbitrarily close to a rational. In a way it is by design, but we give the user now an option to control the starting point for epsilon when converting infinitesimals into rationals.
This commit is contained in:
parent
d8bf0e047f
commit
c75b8ec752
7 changed files with 14 additions and 4 deletions
|
@ -1523,7 +1523,7 @@ namespace lp {
|
|||
if (!m_imp->m_columns_with_changed_bounds.empty())
|
||||
return false;
|
||||
|
||||
m_imp->m_delta = get_core_solver().find_delta_for_strict_bounds(mpq(1));
|
||||
m_imp->m_delta = get_core_solver().find_delta_for_strict_bounds(m_imp->m_settings.m_epsilon);
|
||||
unsigned j;
|
||||
unsigned n = get_core_solver().r_x().size();
|
||||
do {
|
||||
|
@ -1545,7 +1545,7 @@ namespace lp {
|
|||
}
|
||||
|
||||
void lar_solver::get_model_do_not_care_about_diff_vars(std::unordered_map<lpvar, mpq>& variable_values) const {
|
||||
mpq delta = get_core_solver().find_delta_for_strict_bounds(mpq(1));
|
||||
mpq delta = get_core_solver().find_delta_for_strict_bounds(m_imp->m_settings.m_epsilon);
|
||||
for (unsigned i = 0; i < get_core_solver().r_x().size(); i++) {
|
||||
const impq& rp = get_core_solver().r_x(i);
|
||||
variable_values[i] = rp.x + delta * rp.y;
|
||||
|
@ -1569,7 +1569,7 @@ namespace lp {
|
|||
}
|
||||
if (y_is_zero)
|
||||
return;
|
||||
mpq delta = get_core_solver().find_delta_for_strict_bounds(mpq(1));
|
||||
mpq delta = get_core_solver().find_delta_for_strict_bounds(m_imp->m_settings.m_epsilon);
|
||||
for (unsigned j = 0; j < number_of_vars(); j++) {
|
||||
auto& v = get_core_solver().r_x(j);
|
||||
if (!v.y.is_zero()) {
|
||||
|
|
|
@ -34,6 +34,8 @@ void lp::lp_settings::updt_params(params_ref const& _p) {
|
|||
report_frequency = p.arith_rep_freq();
|
||||
m_simplex_strategy = static_cast<lp::simplex_strategy_enum>(p.arith_simplex_strategy());
|
||||
m_nlsat_delay = p.arith_nl_delay();
|
||||
auto eps = p.arith_epsilon();
|
||||
m_epsilon = rational(std::max(1, (int)(100000*eps)), 100000);
|
||||
m_dio = lp_p.dio();
|
||||
m_dio_enable_gomory_cuts = lp_p.dio_cuts_enable_gomory();
|
||||
m_dio_enable_hnf_cuts = lp_p.dio_cuts_enable_hnf();
|
||||
|
|
|
@ -242,6 +242,7 @@ private:
|
|||
public:
|
||||
unsigned limit_on_rows_for_hnf_cutter = 75;
|
||||
unsigned limit_on_columns_for_hnf_cutter = 150;
|
||||
mpq m_epsilon = mpq(1);
|
||||
private:
|
||||
unsigned m_nlsat_delay = 0;
|
||||
bool m_enable_hnf = true;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue