3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-06-23 22:33:40 +00:00

Create placeholders to optimization methods

This commit is contained in:
Anh-Dung Phan 2013-10-16 17:56:35 -07:00
parent 3da47a280e
commit f4e2b23238
9 changed files with 363 additions and 68 deletions

66
src/opt/opt_context.h Normal file
View file

@ -0,0 +1,66 @@
/*++
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