00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00037 #ifndef __NUSMV_CORE_SAT_SAT_SOLVER_PRIVATE_H__
00038 #define __NUSMV_CORE_SAT_SAT_SOLVER_PRIVATE_H__
00039
00040 #include "nusmv/core/sat/SatSolver.h"
00041 #include "nusmv/core/utils/EnvObject_private.h"
00042 #include "nusmv/core/utils/Olist.h"
00043 #include "nusmv/core/utils/list.h"
00044
00045
00046
00047
00048
00049
00050
00051
00059 typedef struct SatSolver_TAG
00060 {
00061 INHERITS_FROM(EnvObject);
00062
00063 char* name;
00064 long solvingTime;
00065 Slist_ptr model;
00066 Slist_ptr conflicts;
00067
00068
00069
00070
00071 Olist_ptr existingGroups;
00072 Olist_ptr unsatisfiableGroups;
00073
00074 boolean interpolation;
00075
00076
00077
00078
00079
00080
00081 VIRTUAL void (*add) (const SatSolver_ptr self,
00082 const Be_Cnf_ptr cnfProb,
00083 SatSolverGroup group);
00084
00085
00086 VIRTUAL void (*set_polarity) (const SatSolver_ptr self,
00087 const Be_Cnf_ptr cnfProb,
00088 int polarity,
00089 SatSolverGroup group);
00090
00091
00092 VIRTUAL void (*set_preferred_variables) (const SatSolver_ptr self,
00093 const Slist_ptr cnfVars);
00094
00095
00096 VIRTUAL void (*clear_preferred_variables) (const SatSolver_ptr self);
00097
00098
00099 VIRTUAL SatSolverResult (*solve_all_groups) (const SatSolver_ptr self);
00100
00101
00102
00103 VIRTUAL SatSolverResult (*solve_all_groups_assume) (const SatSolver_ptr self,
00104 Slist_ptr assumption);
00105
00106
00107 VIRTUAL Slist_ptr (*make_model) (const SatSolver_ptr self);
00108
00109
00110
00111 VIRTUAL int (*get_cnf_var) (const SatSolver_ptr self, int lit);
00112
00113
00114 VIRTUAL Slist_ptr (*get_conflicts) (const SatSolver_ptr self);
00115
00116
00117 VIRTUAL void (*set_random_mode) (SatSolver_ptr self, double seed);
00118 VIRTUAL void (*set_polarity_mode) (SatSolver_ptr self, int mode);
00119 VIRTUAL int (*get_polarity_mode) (const SatSolver_ptr self);
00120
00121
00122 VIRTUAL SatSolverItpGroup (*curr_itp_group) (SatSolver_ptr self);
00123 VIRTUAL SatSolverItpGroup (*new_itp_group) (SatSolver_ptr self);
00124
00125
00126 VIRTUAL Term (*extract_interpolant)(SatSolver_ptr self, int nof_ga_groups,
00127 SatSolverItpGroup* ga_groups,
00128 TermFactoryCallbacks_ptr callbacks,
00129 TermFactoryCallbacksUserData_ptr user_data);
00130 } SatSolver;
00131
00134
00135
00136
00141 void sat_solver_init(SatSolver_ptr self,
00142 const NuSMVEnv_ptr env,
00143 const char* name);
00144
00149 void sat_solver_deinit(SatSolver_ptr self);
00150
00151
00156 void sat_solver_add(const SatSolver_ptr self,
00157 const Be_Cnf_ptr cnfClause,
00158 SatSolverGroup group);
00159
00164 void sat_solver_set_polarity(const SatSolver_ptr self,
00165 const Be_Cnf_ptr cnfClause,
00166 int polarity,
00167 SatSolverGroup group);
00168
00173 void sat_solver_set_preferred_variables(const SatSolver_ptr self,
00174 const Slist_ptr cnfVars);
00175
00180 void sat_solver_clear_preferred_variables(const SatSolver_ptr self);
00181
00186 SatSolverResult sat_solver_solve_all_groups(const SatSolver_ptr self);
00191 SatSolverResult sat_solver_solve_all_groups_assume(const SatSolver_ptr self,
00192 Slist_ptr assumptions);
00193
00198 Slist_ptr sat_solver_make_model(const SatSolver_ptr self);
00199
00200 Slist_ptr sat_solver_get_conflicts(const SatSolver_ptr);
00201
00202
00207 void sat_solver_set_random_mode(SatSolver_ptr self, double seed);
00212 void sat_solver_set_polarity_mode(SatSolver_ptr self, int mode);
00217 int sat_solver_get_polarity_mode(const SatSolver_ptr self);
00218
00219 void sat_solver_RemoveFromList(lsList list, const lsGeneric element);
00224 int sat_solver_get_cnf_var(const SatSolver_ptr self, int lit);
00225
00228 #endif