mirror of
https://github.com/Z3Prover/z3
synced 2025-04-29 20:05:51 +00:00
arrays (#4684)
* arrays Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com> * arrays Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com> * na Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com> * arrays Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com> * na Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com> * fill Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com> * update drat and fix euf bugs Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com> * na Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com> * na Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com> * na Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com> * const qualifiers Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com> * na Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com> * reorg ba Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com> * reorg Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com> * build warnings Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
This commit is contained in:
parent
d56dd1db7b
commit
796e2fd9eb
79 changed files with 2571 additions and 1850 deletions
67
src/sat/smt/ba_pb.h
Normal file
67
src/sat/smt/ba_pb.h
Normal file
|
@ -0,0 +1,67 @@
|
|||
/*++
|
||||
Copyright (c) 2017 Microsoft Corporation
|
||||
|
||||
Module Name:
|
||||
|
||||
ba_pb.h
|
||||
|
||||
Abstract:
|
||||
|
||||
Interface for PB constraints.
|
||||
|
||||
Author:
|
||||
|
||||
Nikolaj Bjorner (nbjorner) 2017-01-30
|
||||
|
||||
--*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "sat/sat_types.h"
|
||||
#include "sat/smt/ba_card.h"
|
||||
|
||||
|
||||
namespace ba {
|
||||
|
||||
class pb : public pb_base {
|
||||
unsigned m_slack;
|
||||
unsigned m_num_watch;
|
||||
unsigned m_max_sum;
|
||||
wliteral m_wlits[0];
|
||||
public:
|
||||
static size_t get_obj_size(unsigned num_lits) { return sat::constraint_base::obj_size(sizeof(pb) + num_lits * sizeof(wliteral)); }
|
||||
pb(unsigned id, literal lit, svector<wliteral> const& wlits, unsigned k);
|
||||
literal lit() const { return m_lit; }
|
||||
wliteral operator[](unsigned i) const { return m_wlits[i]; }
|
||||
wliteral& operator[](unsigned i) { return m_wlits[i]; }
|
||||
wliteral const* begin() const { return m_wlits; }
|
||||
wliteral const* end() const { return begin() + m_size; }
|
||||
|
||||
unsigned slack() const { return m_slack; }
|
||||
void set_slack(unsigned s) { m_slack = s; }
|
||||
unsigned num_watch() const { return m_num_watch; }
|
||||
unsigned max_sum() const { return m_max_sum; }
|
||||
void update_max_sum();
|
||||
void set_num_watch(unsigned s) { m_num_watch = s; }
|
||||
bool is_cardinality() const;
|
||||
void negate() override;
|
||||
void set_k(unsigned k) override { m_k = k; VERIFY(k < 4000000000); update_max_sum(); }
|
||||
void swap(unsigned i, unsigned j) override { std::swap(m_wlits[i], m_wlits[j]); }
|
||||
literal_vector literals() const override { literal_vector lits; for (auto wl : *this) lits.push_back(wl.second); return lits; }
|
||||
bool is_watching(literal l) const override;
|
||||
literal get_lit(unsigned i) const override { return m_wlits[i].second; }
|
||||
void set_lit(unsigned i, literal l) override { m_wlits[i].second = l; }
|
||||
unsigned get_coeff(unsigned i) const override { return m_wlits[i].first; }
|
||||
double get_reward(ba::solver_interface const& s, sat::literal_occs_fun& occs) const override;
|
||||
void clear_watch(solver_interface& s) override;
|
||||
std::ostream& display(std::ostream& out) const override;
|
||||
std::ostream& display(std::ostream& out, solver_interface const& s, bool values) const override;
|
||||
bool init_watch(solver_interface& s) override;
|
||||
bool validate_unit_propagation(solver_interface const& s, literal alit) const override;
|
||||
lbool eval(sat::model const& m) const override;
|
||||
lbool eval(solver_interface const& s) const override;
|
||||
void init_use_list(sat::ext_use_list& ul) const override;
|
||||
bool is_blocked(sat::simplifier& s, literal lit) const override;
|
||||
};
|
||||
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue