Commit 890aa684 by Alan Mishchenko

Adding Glucose API to return a CEX.

parent 83519c32
...@@ -116,6 +116,11 @@ int glucose_solver_addvar(Gluco::SimpSolver* S) ...@@ -116,6 +116,11 @@ int glucose_solver_addvar(Gluco::SimpSolver* S)
return S->nVars() - 1; return S->nVars() - 1;
} }
int * glucose_solver_read_cex(Gluco::SimpSolver* S )
{
return S->getCex();
}
int glucose_solver_read_cex_varvalue(Gluco::SimpSolver* S, int ivar) int glucose_solver_read_cex_varvalue(Gluco::SimpSolver* S, int ivar)
{ {
return S->model[ivar] == l_True; return S->model[ivar] == l_True;
...@@ -208,6 +213,10 @@ int bmcg_sat_solver_elim_varnum(bmcg_sat_solver* s) ...@@ -208,6 +213,10 @@ int bmcg_sat_solver_elim_varnum(bmcg_sat_solver* s)
return ((Gluco::SimpSolver*)s)->eliminated_vars; return ((Gluco::SimpSolver*)s)->eliminated_vars;
} }
int * bmcg_sat_solver_read_cex(bmcg_sat_solver* s)
{
return glucose_solver_read_cex((Gluco::SimpSolver*)s);
}
int bmcg_sat_solver_read_cex_varvalue(bmcg_sat_solver* s, int ivar) int bmcg_sat_solver_read_cex_varvalue(bmcg_sat_solver* s, int ivar)
{ {
return glucose_solver_read_cex_varvalue((Gluco::SimpSolver*)s, ivar); return glucose_solver_read_cex_varvalue((Gluco::SimpSolver*)s, ivar);
...@@ -383,6 +392,11 @@ int glucose_solver_addvar(Gluco::Solver* S) ...@@ -383,6 +392,11 @@ int glucose_solver_addvar(Gluco::Solver* S)
return S->nVars() - 1; return S->nVars() - 1;
} }
int * glucose_solver_read_cex(Gluco::Solver* S )
{
return S->getCex();
}
int glucose_solver_read_cex_varvalue(Gluco::Solver* S, int ivar) int glucose_solver_read_cex_varvalue(Gluco::Solver* S, int ivar)
{ {
return S->model[ivar] == l_True; return S->model[ivar] == l_True;
...@@ -470,6 +484,11 @@ int bmcg_sat_solver_elim_varnum(bmcg_sat_solver* s) ...@@ -470,6 +484,11 @@ int bmcg_sat_solver_elim_varnum(bmcg_sat_solver* s)
// return ((Gluco::SimpSolver*)s)->eliminated_vars; // return ((Gluco::SimpSolver*)s)->eliminated_vars;
} }
int * bmcg_sat_solver_read_cex(bmcg_sat_solver* s)
{
return glucose_solver_read_cex((Gluco::Solver*)s);
}
int bmcg_sat_solver_read_cex_varvalue(bmcg_sat_solver* s, int ivar) int bmcg_sat_solver_read_cex_varvalue(bmcg_sat_solver* s, int ivar)
{ {
return glucose_solver_read_cex_varvalue((Gluco::Solver*)s, ivar); return glucose_solver_read_cex_varvalue((Gluco::Solver*)s, ivar);
......
...@@ -83,6 +83,7 @@ extern int bmcg_sat_solver_eliminate( bmcg_sat_solver* s, int turn ...@@ -83,6 +83,7 @@ extern int bmcg_sat_solver_eliminate( bmcg_sat_solver* s, int turn
extern int bmcg_sat_solver_var_is_elim( bmcg_sat_solver* s, int v ); extern int bmcg_sat_solver_var_is_elim( bmcg_sat_solver* s, int v );
extern void bmcg_sat_solver_var_set_frozen( bmcg_sat_solver* s, int v, int freeze ); extern void bmcg_sat_solver_var_set_frozen( bmcg_sat_solver* s, int v, int freeze );
extern int bmcg_sat_solver_elim_varnum(bmcg_sat_solver* s); extern int bmcg_sat_solver_elim_varnum(bmcg_sat_solver* s);
extern int * bmcg_sat_solver_read_cex( bmcg_sat_solver* s );
extern int bmcg_sat_solver_read_cex_varvalue( bmcg_sat_solver* s, int ); extern int bmcg_sat_solver_read_cex_varvalue( bmcg_sat_solver* s, int );
extern void bmcg_sat_solver_set_stop( bmcg_sat_solver* s, int * pstop ); extern void bmcg_sat_solver_set_stop( bmcg_sat_solver* s, int * pstop );
extern abctime bmcg_sat_solver_set_runtime_limit( bmcg_sat_solver* s, abctime Limit ); extern abctime bmcg_sat_solver_set_runtime_limit( bmcg_sat_solver* s, abctime Limit );
......
...@@ -116,6 +116,7 @@ public: ...@@ -116,6 +116,7 @@ public:
int nLearnts () const; // The current number of learnt clauses. int nLearnts () const; // The current number of learnt clauses.
int nVars () const; // The current number of variables. int nVars () const; // The current number of variables.
int nFreeVars () const; int nFreeVars () const;
int * getCex () const;
// Incremental mode // Incremental mode
void setIncrementalMode(); void setIncrementalMode();
...@@ -418,6 +419,7 @@ inline int Solver::nClauses () const { return clauses.size(); } ...@@ -418,6 +419,7 @@ inline int Solver::nClauses () const { return clauses.size(); }
inline int Solver::nLearnts () const { return learnts.size(); } inline int Solver::nLearnts () const { return learnts.size(); }
inline int Solver::nVars () const { return vardata.size(); } inline int Solver::nVars () const { return vardata.size(); }
inline int Solver::nFreeVars () const { return (int)dec_vars - (trail_lim.size() == 0 ? trail.size() : trail_lim[0]); } inline int Solver::nFreeVars () const { return (int)dec_vars - (trail_lim.size() == 0 ? trail.size() : trail_lim[0]); }
inline int * Solver::getCex () const { return NULL; }
inline void Solver::setPolarity (Var v, bool b) { polarity[v] = b; } inline void Solver::setPolarity (Var v, bool b) { polarity[v] = b; }
inline void Solver::setDecisionVar(Var v, bool b) inline void Solver::setDecisionVar(Var v, bool b)
{ {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment