mirror of
https://github.com/Z3Prover/z3
synced 2025-05-08 00:05:46 +00:00
merge
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
This commit is contained in:
commit
fe1a07a8ee
402 changed files with 7898 additions and 3782 deletions
|
@ -8,32 +8,25 @@
|
|||
#include <string>
|
||||
#include <algorithm>
|
||||
#include <limits>
|
||||
#include <sys/timeb.h>
|
||||
#include <iomanip>
|
||||
#include "util/lp/lp_utils.h"
|
||||
#include "util/stopwatch.h"
|
||||
|
||||
namespace lean {
|
||||
namespace lp {
|
||||
typedef unsigned var_index;
|
||||
typedef unsigned constraint_index;
|
||||
typedef unsigned row_index;
|
||||
|
||||
enum class final_check_status {
|
||||
DONE,
|
||||
CONTINUE,
|
||||
UNSAT,
|
||||
GIVEUP
|
||||
};
|
||||
|
||||
typedef vector<std::pair<mpq, constraint_index>> explanation_t;
|
||||
|
||||
|
||||
enum class column_type {
|
||||
free_column = 0,
|
||||
low_bound = 1,
|
||||
upper_bound = 2,
|
||||
boxed = 3,
|
||||
fixed = 4
|
||||
};
|
||||
low_bound = 1,
|
||||
upper_bound = 2,
|
||||
boxed = 3,
|
||||
fixed = 4
|
||||
};
|
||||
|
||||
enum class simplex_strategy_enum {
|
||||
undecided = 3,
|
||||
|
@ -44,7 +37,7 @@ enum class simplex_strategy_enum {
|
|||
|
||||
std::string column_type_to_string(column_type t);
|
||||
|
||||
enum lp_status {
|
||||
enum class lp_status {
|
||||
UNKNOWN,
|
||||
INFEASIBLE,
|
||||
TENTATIVE_UNBOUNDED,
|
||||
|
@ -80,21 +73,20 @@ enum non_basic_column_value_position { at_low_bound, at_upper_bound, at_fixed, f
|
|||
|
||||
template <typename X> bool is_epsilon_small(const X & v, const double& eps); // forward definition
|
||||
|
||||
int get_millisecond_count();
|
||||
int get_millisecond_span(int start_time);
|
||||
|
||||
|
||||
class lp_resource_limit {
|
||||
public:
|
||||
virtual bool get_cancel_flag() = 0;
|
||||
};
|
||||
|
||||
struct stats {
|
||||
unsigned m_make_feasible;
|
||||
unsigned m_total_iterations;
|
||||
unsigned m_iters_with_no_cost_growing;
|
||||
unsigned m_num_factorizations;
|
||||
unsigned m_num_of_implied_bounds;
|
||||
unsigned m_need_to_solve_inf;
|
||||
unsigned m_max_cols;
|
||||
unsigned m_max_rows;
|
||||
stats() { reset(); }
|
||||
void reset() { memset(this, 0, sizeof(*this)); }
|
||||
};
|
||||
|
@ -103,12 +95,13 @@ struct lp_settings {
|
|||
private:
|
||||
class default_lp_resource_limit : public lp_resource_limit {
|
||||
lp_settings& m_settings;
|
||||
int m_start_time;
|
||||
stopwatch m_sw;
|
||||
public:
|
||||
default_lp_resource_limit(lp_settings& s): m_settings(s), m_start_time(get_millisecond_count()) {}
|
||||
default_lp_resource_limit(lp_settings& s): m_settings(s) {
|
||||
m_sw.start();
|
||||
}
|
||||
virtual bool get_cancel_flag() {
|
||||
int span_in_mills = get_millisecond_span(m_start_time);
|
||||
return (span_in_mills / 1000.0 > m_settings.time_limit);
|
||||
return (m_sw.get_current_seconds() > m_settings.time_limit);
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -212,7 +205,8 @@ public:
|
|||
use_breakpoints_in_feasibility_search(false),
|
||||
max_row_length_for_bound_propagation(300),
|
||||
backup_costs(true),
|
||||
column_number_threshold_for_using_lu_in_lar_solver(4000)
|
||||
column_number_threshold_for_using_lu_in_lar_solver(4000),
|
||||
m_int_branch_cut_threshold(100)
|
||||
{}
|
||||
|
||||
void set_resource_limit(lp_resource_limit& lim) { m_resource_limit = &lim; }
|
||||
|
@ -292,13 +286,13 @@ public:
|
|||
return m_simplex_strategy;
|
||||
}
|
||||
|
||||
bool use_lu() const {
|
||||
return m_simplex_strategy == simplex_strategy_enum::lu;
|
||||
}
|
||||
bool use_lu() const {
|
||||
return m_simplex_strategy == simplex_strategy_enum::lu;
|
||||
}
|
||||
|
||||
bool use_tableau() const {
|
||||
return m_simplex_strategy == simplex_strategy_enum::tableau_rows ||
|
||||
m_simplex_strategy == simplex_strategy_enum::tableau_costs;
|
||||
return m_simplex_strategy == simplex_strategy_enum::tableau_rows ||
|
||||
m_simplex_strategy == simplex_strategy_enum::tableau_costs;
|
||||
}
|
||||
|
||||
bool use_tableau_rows() const {
|
||||
|
@ -319,6 +313,7 @@ public:
|
|||
unsigned max_row_length_for_bound_propagation;
|
||||
bool backup_costs;
|
||||
unsigned column_number_threshold_for_using_lu_in_lar_solver;
|
||||
unsigned m_int_branch_cut_threshold;
|
||||
}; // end of lp_settings class
|
||||
|
||||
|
||||
|
@ -380,7 +375,7 @@ inline void print_blanks(int n, std::ostream & out) {
|
|||
// after a push of the last element we ensure that the vector increases
|
||||
// we also suppose that before the last push the vector was increasing
|
||||
inline void ensure_increasing(vector<unsigned> & v) {
|
||||
lean_assert(v.size() > 0);
|
||||
lp_assert(v.size() > 0);
|
||||
unsigned j = v.size() - 1;
|
||||
for (; j > 0; j-- )
|
||||
if (v[j] <= v[j - 1]) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue