mirror of
https://github.com/Z3Prover/z3
synced 2025-06-03 21:01:22 +00:00
fix lower bound update
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
This commit is contained in:
parent
02f74f1028
commit
72130ac7b9
2 changed files with 5 additions and 1 deletions
|
@ -424,6 +424,10 @@ namespace opt {
|
||||||
objective const& obj = m_objectives[i];
|
objective const& obj = m_objectives[i];
|
||||||
switch(obj.m_type) {
|
switch(obj.m_type) {
|
||||||
case O_MINIMIZE:
|
case O_MINIMIZE:
|
||||||
|
if (m_model->eval(obj.m_term, val) && a.is_numeral(val, r)) {
|
||||||
|
m_optsmt.update_lower(obj.m_index, -r);
|
||||||
|
}
|
||||||
|
break;
|
||||||
case O_MAXIMIZE:
|
case O_MAXIMIZE:
|
||||||
if (m_model->eval(obj.m_term, val) && a.is_numeral(val, r)) {
|
if (m_model->eval(obj.m_term, val) && a.is_numeral(val, r)) {
|
||||||
m_optsmt.update_lower(obj.m_index, r);
|
m_optsmt.update_lower(obj.m_index, r);
|
||||||
|
|
|
@ -117,6 +117,7 @@ namespace opt {
|
||||||
|
|
||||||
void optsmt::update_lower(unsigned idx, rational const& r) {
|
void optsmt::update_lower(unsigned idx, rational const& r) {
|
||||||
inf_eps v(r);
|
inf_eps v(r);
|
||||||
|
std::cout << "update lower: " << r << "\n";
|
||||||
if (m_lower[idx] < v) {
|
if (m_lower[idx] < v) {
|
||||||
m_lower[idx] = v;
|
m_lower[idx] = v;
|
||||||
if (m_s) m_s->get_model(m_model);
|
if (m_s) m_s->get_model(m_model);
|
||||||
|
@ -322,7 +323,6 @@ namespace opt {
|
||||||
|
|
||||||
std::ostream& optsmt::display_objective(std::ostream& out, unsigned i) const {
|
std::ostream& optsmt::display_objective(std::ostream& out, unsigned i) const {
|
||||||
bool is_max = m_is_max[i];
|
bool is_max = m_is_max[i];
|
||||||
inf_eps val = get_lower(i);
|
|
||||||
expr_ref obj(m_objs[i], m);
|
expr_ref obj(m_objs[i], m);
|
||||||
if (!is_max) {
|
if (!is_max) {
|
||||||
arith_util a(m);
|
arith_util a(m);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue