mirror of
https://github.com/Z3Prover/z3
synced 2025-04-10 19:27:06 +00:00
66 lines
1.2 KiB
C++
66 lines
1.2 KiB
C++
/*++
|
|
Copyright (c) 2013 Microsoft Corporation
|
|
|
|
Module Name:
|
|
|
|
opt_context.h
|
|
|
|
Abstract:
|
|
Facility for running optimization problem.
|
|
|
|
Author:
|
|
|
|
Anh-Dung Phan (t-anphan) 2013-10-16
|
|
|
|
Notes:
|
|
|
|
--*/
|
|
#ifndef _OPT_CONTEXT_H_
|
|
#define _OPT_CONTEXT_H_
|
|
|
|
#include "ast.h"
|
|
|
|
namespace opt {
|
|
|
|
class context {
|
|
ast_manager& m;
|
|
expr_ref_vector m_hard_constraints;
|
|
expr_ref_vector m_soft_constraints;
|
|
vector<rational> m_weights;
|
|
|
|
expr_ref_vector m_objectives;
|
|
svector<bool> m_is_max;
|
|
|
|
public:
|
|
context(ast_manager& m):
|
|
m(m),
|
|
m_hard_constraints(m),
|
|
m_soft_constraints(m),
|
|
m_objectives(m)
|
|
{}
|
|
|
|
void add_soft_constraint(expr* f, rational const& w) {
|
|
m_soft_constraints.push_back(f);
|
|
m_weights.push_back(w);
|
|
}
|
|
|
|
void add_objective(expr* t, bool is_max) {
|
|
m_objectives.push_back(t);
|
|
m_is_max.push_back(is_max);
|
|
}
|
|
|
|
void add_hard_constraint(expr* f) {
|
|
m_hard_constraints.push_back(f);
|
|
}
|
|
|
|
void optimize();
|
|
|
|
private:
|
|
bool is_maxsat_problem() const;
|
|
|
|
};
|
|
|
|
|
|
}
|
|
|
|
#endif |