mirror of
https://github.com/Z3Prover/z3
synced 2025-08-21 18:50:26 +00:00
update lower bounds from feasible solutiosn
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
This commit is contained in:
parent
e307c5fdda
commit
370a4b66de
14 changed files with 123 additions and 44 deletions
|
@ -21,6 +21,7 @@ Notes:
|
|||
|
||||
#include "solver.h"
|
||||
#include "opt_solver.h"
|
||||
#include "statistics.h"
|
||||
|
||||
namespace opt {
|
||||
|
||||
|
@ -33,6 +34,7 @@ namespace opt {
|
|||
virtual rational get_value() const = 0;
|
||||
virtual expr_ref_vector get_assignment() const = 0;
|
||||
virtual void set_cancel(bool f) = 0;
|
||||
virtual void collect_statistics(statistics& st) const = 0;
|
||||
};
|
||||
/**
|
||||
Takes solver with hard constraints added.
|
||||
|
@ -46,6 +48,8 @@ namespace opt {
|
|||
expr_ref_vector m_soft_constraints;
|
||||
expr_ref_vector m_answer;
|
||||
vector<rational> m_weights;
|
||||
rational m_lower;
|
||||
rational m_upper;
|
||||
scoped_ptr<maxsmt_solver> m_msolver;
|
||||
symbol m_maxsat_engine;
|
||||
public:
|
||||
|
@ -58,8 +62,11 @@ namespace opt {
|
|||
void updt_params(params_ref& p);
|
||||
|
||||
void add(expr* f, rational const& w) {
|
||||
SASSERT(m.is_bool(f));
|
||||
SASSERT(w.is_pos());
|
||||
m_soft_constraints.push_back(f);
|
||||
m_weights.push_back(w);
|
||||
m_upper += w;
|
||||
}
|
||||
|
||||
unsigned size() const { return m_soft_constraints.size(); }
|
||||
|
@ -70,10 +77,15 @@ namespace opt {
|
|||
inf_eps get_value() const;
|
||||
inf_eps get_lower() const;
|
||||
inf_eps get_upper() const;
|
||||
void update_lower(rational const& r);
|
||||
|
||||
|
||||
expr_ref_vector get_assignment() const;
|
||||
|
||||
void display_answer(std::ostream& out) const;
|
||||
|
||||
void collect_statistics(statistics& st) const;
|
||||
|
||||
|
||||
private:
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue