mirror of
https://github.com/Z3Prover/z3
synced 2025-04-24 01:25:31 +00:00
A few changes based on previous reviews
Tested the optimization procedure with: - unbounded objectives - bounded with rational solutions - bounded with irrational solutions
This commit is contained in:
parent
3dd72f8f16
commit
3441fc2942
8 changed files with 24 additions and 26 deletions
|
@ -994,7 +994,7 @@ namespace smt {
|
|||
// -----------------------------------
|
||||
virtual bool maximize(theory_var v) { return max_min(v, true); }
|
||||
virtual theory_var add_objective(app* term);
|
||||
virtual inf_eps_rational<rational> get_objective_value(theory_var v);
|
||||
virtual inf_eps_rational<inf_rational> get_objective_value(theory_var v);
|
||||
inf_rational m_objective;
|
||||
|
||||
// -----------------------------------
|
||||
|
|
|
@ -961,9 +961,8 @@ namespace smt {
|
|||
}
|
||||
|
||||
template<typename Ext>
|
||||
inf_eps_rational<rational> theory_arith<Ext>::get_objective_value(theory_var v) {
|
||||
inf_eps_rational<rational> val;
|
||||
val = m_objective.get_rational();
|
||||
inf_eps_rational<inf_rational> theory_arith<Ext>::get_objective_value(theory_var v) {
|
||||
inf_eps_rational<inf_rational> val(m_objective);
|
||||
return val;
|
||||
}
|
||||
|
||||
|
|
|
@ -18,6 +18,7 @@ Notes:
|
|||
|
||||
--*/
|
||||
|
||||
#include "inf_rational.h"
|
||||
#include "inf_eps_rational.h"
|
||||
|
||||
#ifndef _THEORY_OPT_H_
|
||||
|
@ -28,9 +29,9 @@ namespace smt {
|
|||
public:
|
||||
virtual bool maximize(theory_var v) { UNREACHABLE(); return false; };
|
||||
virtual theory_var add_objective(app* term) { UNREACHABLE(); return null_theory_var; }
|
||||
virtual inf_eps_rational<rational> get_objective_value(theory_var v) {
|
||||
virtual inf_eps_rational<inf_rational> get_objective_value(theory_var v) {
|
||||
UNREACHABLE();
|
||||
inf_eps_rational<rational> r(rational(1), rational(0));
|
||||
inf_eps_rational<inf_rational> r(rational(1), inf_rational(0));
|
||||
return r;
|
||||
}
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue