00001
00002
00003
00004
00005
00006
00007
00008 #ifndef MINPRIMEIMPLICANT_H_
00009 #define MINPRIMEIMPLICANT_H_
00010
00011 #include <map>
00012 #include <set>
00013 #include "SatValue.h"
00014 using namespace std;
00015
00016 class CNode;
00017 class VariableTerm;
00018 class BooleanVar;
00019 class Term;
00020
00021 class MinPrimeImplicant {
00022 private:
00023 CNode* orig_constraint;
00024 CNode* constraint;
00025 map<VariableTerm*, int>& costs;
00026 map<CNode*, BooleanVar*> literal_to_bool;
00027 map<Term*, Term*> vars_to_cost_vars;
00028 int min_cost;
00029 int max_cost;
00030 map<Term*, SatValue> min_assignment;
00031 Term* opt_function;
00032 set<CNode*>& background;
00033 Term* bg_violated_cost_var;
00034
00035
00036 public:
00037
00038
00039
00040
00041 MinPrimeImplicant(CNode* c, set<CNode*>& background,
00042 map<VariableTerm*, int>& costs);
00043 int get_cost();
00044 const map<Term*, SatValue>& get_min_assignment();
00045 ~MinPrimeImplicant();
00046
00047 private:
00048 void build_boolean_abstraction();
00049 void add_theory_constraints();
00050 void add_cost_constraints();
00051 void add_background_constraints();
00052 void init_opt_function();
00053 void init_upper_bound();
00054 void init_max_cost();
00055
00056 };
00057
00058 #endif