mirror of
https://github.com/Z3Prover/z3
synced 2025-05-07 15:55:46 +00:00
fix bug in handling of repeated soft constraints. #815
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
This commit is contained in:
parent
0765eea486
commit
2307a7ffa7
5 changed files with 40 additions and 4 deletions
|
@ -333,8 +333,15 @@ namespace opt {
|
|||
TRACE("opt", tout << mk_pp(f, m) << " weight: " << w << "\n";);
|
||||
SASSERT(m.is_bool(f));
|
||||
SASSERT(w.is_pos());
|
||||
m_soft_constraints.push_back(f);
|
||||
m_weights.push_back(w);
|
||||
unsigned index = 0;
|
||||
if (m_soft_constraint_index.find(f, index)) {
|
||||
m_weights[index] += w;
|
||||
}
|
||||
else {
|
||||
m_soft_constraint_index.insert(f, m_weights.size());
|
||||
m_soft_constraints.push_back(f);
|
||||
m_weights.push_back(w);
|
||||
}
|
||||
m_upper += w;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue