mirror of
https://github.com/Z3Prover/z3
synced 2025-04-23 17:15:31 +00:00
start wcnf
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
This commit is contained in:
parent
be68456c06
commit
08f55f9d1f
5 changed files with 30 additions and 2 deletions
|
@ -1550,6 +1550,27 @@ namespace opt {
|
|||
return to_string(true, m_hard_constraints, m_objectives);
|
||||
}
|
||||
|
||||
std::string context::to_wcnf() {
|
||||
import_scoped_state();
|
||||
expr_ref_vector asms(m);
|
||||
normalize(asms);
|
||||
auto const& objectives = m_objectives;
|
||||
if (objectives.size() > 1)
|
||||
throw default_exception("only single objective weighted MaxSAT wcnf output is supported");
|
||||
if (objectives.size() == 1) {
|
||||
auto const& obj = objectives[0];
|
||||
if (obj.m_type != O_MAXSMT)
|
||||
throw default_exception("only single objective weighted MaxSAT wcnf output is supported");
|
||||
for (unsigned j = 0; j < obj.m_terms.size(); ++j) {
|
||||
rational w = obj.m_weights[j];
|
||||
if (!w.is_unsigned())
|
||||
throw default_exception("only single objective weighted MaxSAT wcnf output is supported");
|
||||
}
|
||||
}
|
||||
NOT_IMPLEMENTED_YET();
|
||||
return std::string("");
|
||||
}
|
||||
|
||||
std::string context::to_string(bool is_internal, expr_ref_vector const& hard, vector<objective> const& objectives) const {
|
||||
smt2_pp_environment_dbg env(m);
|
||||
ast_pp_util visitor(m);
|
||||
|
|
|
@ -322,7 +322,7 @@ namespace opt {
|
|||
|
||||
std::string to_string(bool is_internal, expr_ref_vector const& hard, vector<objective> const& objectives) const;
|
||||
std::string to_string_internal() const;
|
||||
|
||||
std::string to_wcnf();
|
||||
|
||||
void validate_lex();
|
||||
void validate_maxsat(symbol const& id);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue