ABC: A System for Sequential Synthesis and Verification
 
Loading...
Searching...
No Matches
eSLIM::CadicalSolver Class Reference

#include <satInterfaces.hpp>

Classes

class  TimeoutTerminator
 

Public Member Functions

void addClause (int *pLits, int nLits)
 
void assume (const std::vector< int > &assumptions)
 
int solve (double timeout)
 
int solve ()
 
Vec_Int_tgetModelVec ()
 
double getRunTime () const
 

Detailed Description

Definition at line 37 of file satInterfaces.hpp.

Member Function Documentation

◆ addClause()

void eSLIM::CadicalSolver::addClause ( int * pLits,
int nLits )
inline

Definition at line 92 of file satInterfaces.hpp.

92 {
93 for ( int i = 0; i < nLits; i++ ) {
94 if (pLits[i] == 0) {
95 continue;;
96 }
97 solver.add(Abc_LitIsCompl(pLits[i]) ? -Abc_Lit2Var(pLits[i]) : Abc_Lit2Var(pLits[i]));
98 }
99 solver.add(0);
100 }

◆ assume()

void eSLIM::CadicalSolver::assume ( const std::vector< int > & assumptions)
inline

Definition at line 102 of file satInterfaces.hpp.

102 {
103 for (auto& l: assumptions) {
104 solver.assume(l);
105 }
106 }

◆ getModelVec()

Vec_Int_t * eSLIM::CadicalSolver::getModelVec ( )
inline

Definition at line 129 of file satInterfaces.hpp.

129 {
130 Vec_Int_t* assignment = Vec_IntAlloc( solver.vars() );
131 for (int v = 1; v <= solver.vars(); v++) {
132 Vec_IntSetEntryFull( assignment, Abc_AbsInt(val(v)), val(v) > 0 );
133 }
134 return assignment;
135 }
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition bblif.c:37

◆ getRunTime()

double eSLIM::CadicalSolver::getRunTime ( ) const
inline

Definition at line 88 of file satInterfaces.hpp.

88 {
89 return last_runtime;
90 }

◆ solve() [1/2]

int eSLIM::CadicalSolver::solve ( )
inline

Definition at line 108 of file satInterfaces.hpp.

108 {
109 std::chrono::time_point<std::chrono::steady_clock> start = std::chrono::steady_clock::now();
110 int status = solver.solve();
111 last_runtime = std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::steady_clock::now() - start).count();
112 return status;
113 }

◆ solve() [2/2]

int eSLIM::CadicalSolver::solve ( double timeout)
inline

Definition at line 115 of file satInterfaces.hpp.

115 {
116 std::chrono::time_point<std::chrono::steady_clock> start = std::chrono::steady_clock::now();
117 TimeoutTerminator terminator(timeout);
118 solver.connect_terminator(&terminator);
119 int status = solver.solve();
120 last_runtime = std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::steady_clock::now() - start).count();
121 if (solver.state() == CaDiCaL::INVALID) {
122 std::cerr<<"Solver is in invalid state"<<std::endl;
123 return -1;
124 }
125 solver.disconnect_terminator();
126 return status;
127 }

The documentation for this class was generated from the following file: