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

  Synopsis    [Computes interpolant for the given CNF.]

  Description [Takes the interpolation manager, the CNF deriving by the SAT
  solver, which includes ClausesA, ClausesB, and learned clauses. Additional
  arguments are the vector of variables common to AB and the verbosiness flag.
  Returns the AIG manager with a single output, containing the interpolant.]
               
  SideEffects []

  SeeAlso     []

***********************************************************************/
Function
Synopsis    [Computes interpolant for the given CNF.]

Description [Takes the interpolation manager, the CNF deriving by the SAT
solver, which includes ClausesA, ClausesB, and learned clauses. Additional
arguments are the vector of variables common to AB and the verbosiness flag.
Returns the AIG manager with a single output, containing the interpolant.]




Function Synopsis [ Computes interpolant for the given CNF . ] Description [ Takes the interpolation manager the CNF deriving by the SAT solver which includes ClausesA ClausesB and learned clauses . Additional arguments are the vector of variables common to AB and the verbosiness flag . Returns the AIG manager with a single output containing the interpolant . ]
void * Intb_ManInterpolate( Intb_Man_t * p, Sto_Man_t * pCnf, void * vVarsAB, int fVerbose )
{
    Aig_Man_t * pRes;
    Aig_Obj_t * pObj;
    Sto_Cls_t * pClause;
    int RetValue = 1;
    abctime clkTotal = Abc_Clock();
    assert( pCnf->nVars > 0 && pCnf->nClauses > 0 );
    p->pCnf = pCnf;
    p->fVerbose = fVerbose;
    p->vVarsAB = (Vec_Int_t *)vVarsAB;
    p->pAig = pRes = Aig_ManStart( 10000 );
    Aig_IthVar( p->pAig, Vec_IntSize(p->vVarsAB) - 1 );
    Intb_ManResize( p );
    Intb_ManPrepareInter( p );
    if ( p->fProofWrite )
    {
        p->pFile = fopen( "proof.cnf_", "w" );
        p->Counter = 0;
    }
    Sto_ManForEachClauseRoot( p->pCnf, pClause )
        Intb_ManProofWriteOne( p, pClause );
    if ( Intb_ManProcessRoots( p ) )
    {
        Sto_ManForEachClause( p->pCnf, pClause )
        {
            if ( pClause->fRoot )
                continue;
            if ( !Intb_ManProofRecordOne( p, pClause ) )
            {
                RetValue = 0;
                break;
            }
        }
    }
    if ( p->fProofWrite )
    { 
        fclose( p->pFile );
        p->pFile = NULL;    
    }
    if ( fVerbose )
    {
    printf( "Vars = %d. Roots = %d. Learned = %d. Resol steps = %d.  Ave = %.2f.  Mem = %.2f MB\n", 
        p->pCnf->nVars, p->pCnf->nRoots, p->pCnf->nClauses-p->pCnf->nRoots, p->Counter,  
        1.0*(p->Counter-p->pCnf->nRoots)/(p->pCnf->nClauses-p->pCnf->nRoots), 
        1.0*Sto_ManMemoryReport(p->pCnf)/(1<<20) );
p->timeTotal += Abc_Clock() - clkTotal;
    }
    pObj = *Intb_ManAigRead( p, p->pCnf->pTail );
    Aig_ObjCreateCo( pRes, pObj );
    Aig_ManCleanup( pRes );
    p->pAig = NULL;
    return pRes;
}
void * Intb_ManInterpolate ( Intb_Man_t * p , Sto_Man_t * pCnf , void * vVarsAB , int fVerbose ) { Aig_Man_t * pRes ; Aig_Obj_t * pObj ; Sto_Cls_t * pClause ; int RetValue = 1 ; abctime clkTotal = Abc_Clock ( ) ; assert ( pCnf -> nVars > 0 && pCnf -> nClauses > 0 ) ; p -> pCnf = pCnf ; p -> fVerbose = fVerbose ; p -> vVarsAB = ( Vec_Int_t * ) vVarsAB ; p -> pAig = pRes = Aig_ManStart ( 10000 ) ; Aig_IthVar ( p -> pAig , Vec_IntSize ( p -> vVarsAB ) - 1 ) ; Intb_ManResize ( p ) ; Intb_ManPrepareInter ( p ) ; if ( p -> fProofWrite ) { p -> pFile = fopen ( " " , " " ) ; p -> Counter = 0 ; } Sto_ManForEachClauseRoot ( p -> pCnf , pClause ) Intb_ManProofWriteOne ( p , pClause ) ; if ( Intb_ManProcessRoots ( p ) ) { Sto_ManForEachClause ( p -> pCnf , pClause ) { if ( pClause -> fRoot ) continue ; if ( ! Intb_ManProofRecordOne ( p , pClause ) ) { RetValue = 0 ; break ; } } } if ( p -> fProofWrite ) { fclose ( p -> pFile ) ; p -> pFile = NULL ; } if ( fVerbose ) { printf ( " \n " , p -> pCnf -> nVars , p -> pCnf -> nRoots , p -> pCnf -> nClauses - p -> pCnf -> nRoots , p -> Counter , 1.0 * ( p -> Counter - p -> pCnf -> nRoots ) / ( p -> pCnf -> nClauses - p -> pCnf -> nRoots ) , 1.0 * Sto_ManMemoryReport ( p -> pCnf ) / ( 1 << 20 ) ) ; p -> timeTotal += Abc_Clock ( ) - clkTotal ; } pObj = * Intb_ManAigRead ( p , p -> pCnf -> pTail ) ; Aig_ObjCreateCo ( pRes , pObj ) ; Aig_ManCleanup ( pRes ) ; p -> pAig = NULL ; return pRes ; }
Function
Synopsis    [Computes interpolant for the given CNF.]
Function Synopsis [ Computes interpolant for the given CNF . ]
// check that the CNF makes sense // adjust the manager // prepare the interpolant computation // construct proof for each clause // start the proof // write the root clauses // propagate root level assignments // if there is no conflict, consider learned clauses // stop the proof //        Sat_ProofChecker( "proof.cnf_" ); //        ABC_PRT( "Interpo", Abc_Clock() - clkTotal );