abc/src/sat/bsat/satInterP.c
/**Function*************************************************************

  Synopsis    [Verifies the UNSAT core.]

  Description [Takes the interpolation manager, the CNF derived by the SAT
  solver, which includes the root clauses and the learned clauses. Returns
  the array of integers representing the number of root clauses that are in
  the UNSAT core.]
               
  SideEffects []

  SeeAlso     []

***********************************************************************/
Function
Synopsis    [Verifies the UNSAT core.]

Description [Takes the interpolation manager, the CNF derived by the SAT
solver, which includes the root clauses and the learned clauses. Returns
the array of integers representing the number of root clauses that are in
the UNSAT core.]




Function Synopsis [ Verifies the UNSAT core . ] Description [ Takes the interpolation manager the CNF derived by the SAT solver which includes the root clauses and the learned clauses . Returns the array of integers representing the number of root clauses that are in the UNSAT core . ]
void Intp_ManUnsatCoreVerify( Sto_Man_t * pCnf, Vec_Int_t * vCore )
{
    int fVerbose = 0;
    int nConfMax = 1000000;
    sat_solver * pSat;
    Sto_Cls_t * pClause;
    Vec_Ptr_t * vClauses;
    int i, iClause, RetValue;
    abctime clk = Abc_Clock();
    vClauses = Vec_PtrAlloc( 1000 );
    Sto_ManForEachClauseRoot( pCnf, pClause )
    {
        assert( Vec_PtrSize(vClauses) == pClause->Id );
        Vec_PtrPush( vClauses, pClause );
    }
    pSat = sat_solver_new();
    Vec_IntForEachEntry( vCore, iClause, i )
    {
        pClause = (Sto_Cls_t *)Vec_PtrEntry( vClauses, iClause );
        if ( !sat_solver_addclause( pSat, pClause->pLits, pClause->pLits+pClause->nLits ) )
        {
            printf( "The core verification problem is trivially UNSAT.\n" );
            break;
        }
    }
    Vec_PtrFree( vClauses );
    RetValue = sat_solver_solve( pSat, NULL, NULL, (ABC_INT64_T)nConfMax, (ABC_INT64_T)0, (ABC_INT64_T)0, (ABC_INT64_T)0 );
    sat_solver_delete( pSat );
    if ( fVerbose )
    {
        if ( RetValue == l_Undef )
            printf( "Conflict limit is reached.  " );
        else if ( RetValue == l_True )
            printf( "UNSAT core verification FAILED.  " );
        else
            printf( "UNSAT core verification succeeded.  " );
        ABC_PRT( "Time", Abc_Clock() - clk );
    }
    else
    {
        if ( RetValue == l_True )
            printf( "UNSAT core verification FAILED.  \n" );
    }
}
void Intp_ManUnsatCoreVerify ( Sto_Man_t * pCnf , Vec_Int_t * vCore ) { int fVerbose = 0 ; int nConfMax = 1000000 ; sat_solver * pSat ; Sto_Cls_t * pClause ; Vec_Ptr_t * vClauses ; int i , iClause , RetValue ; abctime clk = Abc_Clock ( ) ; vClauses = Vec_PtrAlloc ( 1000 ) ; Sto_ManForEachClauseRoot ( pCnf , pClause ) { assert ( Vec_PtrSize ( vClauses ) == pClause -> Id ) ; Vec_PtrPush ( vClauses , pClause ) ; } pSat = sat_solver_new ( ) ; Vec_IntForEachEntry ( vCore , iClause , i ) { pClause = ( Sto_Cls_t * ) Vec_PtrEntry ( vClauses , iClause ) ; if ( ! sat_solver_addclause ( pSat , pClause -> pLits , pClause -> pLits + pClause -> nLits ) ) { printf ( " \n " ) ; break ; } } Vec_PtrFree ( vClauses ) ; RetValue = sat_solver_solve ( pSat , NULL , NULL , ( ABC_INT64_T ) nConfMax , ( ABC_INT64_T ) 0 , ( ABC_INT64_T ) 0 , ( ABC_INT64_T ) 0 ) ; sat_solver_delete ( pSat ) ; if ( fVerbose ) { if ( RetValue == l_Undef ) printf ( " " ) ; else if ( RetValue == l_True ) printf ( " " ) ; else printf ( " " ) ; ABC_PRT ( " " , Abc_Clock ( ) - clk ) ; } else { if ( RetValue == l_True ) printf ( " \n " ) ; } }
Function
Synopsis    [Verifies the UNSAT core.]
Function Synopsis [ Verifies the UNSAT core . ]
// collect the clauses // create new SAT solver //    sat_solver_setnvars( pSat, nSatVars ); // solve the problem