3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-04-08 10:25:18 +00:00

check parameters

Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
This commit is contained in:
Nikolaj Bjorner 2014-01-06 16:06:47 -08:00
parent 3fa0e6f3fb
commit f1710e5618

View file

@ -53,6 +53,15 @@ namespace opt {
unsigned context::add_soft_constraint(expr* f, rational const& w, symbol const& id) {
maxsmt* ms;
if (w.is_neg()) {
throw default_exception("Negative weight supplied. Weight should be positive");
}
if (w.is_zero()) {
throw default_exception("Zero weight supplied. Weight should be positive");
}
if (!m.is_bool(f)) {
throw default_exception("Soft constraint should be Boolean");
}
if (!m_maxsmts.find(id, ms)) {
ms = alloc(maxsmt, m);
ms->updt_params(m_params);