3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2026-03-03 04:06:54 +00:00

Reorganize combination of objectives

This commit is contained in:
Anh-Dung Phan 2013-11-26 09:20:11 +01:00
parent 87a2b99091
commit dbc791d385
5 changed files with 172 additions and 56 deletions

54
src/opt/objective_ast.cpp Normal file
View file

@ -0,0 +1,54 @@
/*++
Copyright (c) 2013 Microsoft Corporation
Module Name:
objective_ast.h
Abstract:
Abstract data-type for compound objectives.
Author:
Anh-Dung Phan (t-anphan) 2013-11-26
Notes:
--*/
#include"objective_ast.h"
namespace opt {
objective* objective::mk_max(expr_ref& e) { return alloc(min_max_objective, MAXIMIZE, e); };
objective* objective::mk_min(expr_ref& e) { return alloc(min_max_objective, MINIMIZE, e); };
objective* objective::mk_maxsat(symbol id) { return alloc(maxsat_objective, id); };
objective* objective::mk_lex(unsigned sz, objective * const* children) {
return alloc(compound_objective, LEX, sz, children);
};
objective* objective::mk_box(unsigned sz, objective * const* children) {
return alloc(compound_objective, BOX, sz, children);
};
objective* objective::mk_pareto(unsigned sz, objective * const* children) {
return alloc(compound_objective, PARETO, sz, children);
};
compound_objective& objective::get_compound() {
SASSERT(m_type == LEX || m_type == BOX || m_type == PARETO);
return dynamic_cast<compound_objective&>(*this);
}
min_max_objective& objective::get_min_max() {
SASSERT(m_type == MAXIMIZE || m_type == MINIMIZE);
return dynamic_cast<min_max_objective&>(*this);
}
maxsat_objective& objective::get_maxsat() {
SASSERT(m_type == MAXSAT);
return dynamic_cast<maxsat_objective&>(*this);
}
};