Beispiel #1
0
 void logJRPM(const JoinRelevancePropertyMap& jr) {
     DBGLOG_SCOPE(DBG,"jrpm",false);
     DBGLOG(DBG,"logging JoinRelevancePropertyMap:");
     std::vector<bool>::const_iterator it;
     unsigned u = 0;
     for(it = jr.storage_begin();
     it != jr.storage_end(); ++it, ++u) {
         DBGLOG(DBG,"unit " << u << ": " << ((*it == true) ?
             std::string("relevant") : std::string("irrelevant")) );
     }
 }
Beispiel #2
0
 void logAPM(
 const AncestryPropertyMap& apm) {
     DBGLOG_SCOPE(DBG,"apm",false);
     DBGLOG(DBG,"logging AncestryPropertyMap:");
     std::vector<Ancestry>::const_iterator it;
     unsigned u = 0;
     for(it = apm.storage_begin();
     it != apm.storage_end(); ++it, ++u) {
         const Ancestry& anc = *it;
         DBGLOG(DBG,"unit " << u << ": " << printset(anc));
     }
 }
InterpretationPtr GuessAndCheckModelGenerator::generateNextModel()
{
    RegistryPtr reg = factory.reg;

    // now we have postprocessed input in postprocessedInput
    DLVHEX_BENCHMARK_REGISTER_AND_SCOPE(sidgcsolve, "guess and check loop");

    InterpretationPtr modelCandidate;
    do {
        AnswerSetPtr guessas = guessres->getNextAnswerSet();
        if( !guessas )
            return InterpretationPtr();
        modelCandidate = guessas->interpretation;

        DBGLOG_SCOPE(DBG,"gM", false);
        DBGLOG(DBG,"= got guess model " << *modelCandidate);

        DBGLOG(DBG, "doing compatibility check for model candidate " << *modelCandidate);
        assert(!factory.ctx.config.getOption("ExternalLearning") &&
            "cannot use external learning in (non-genuine) GuessAndCheckModelGenerator");
        bool compatible = isCompatibleSet(
            modelCandidate, postprocessedInput, factory.ctx,
            SimpleNogoodContainerPtr());
        DBGLOG(DBG, "Compatible: " << compatible);
        if (!compatible) continue;

        // FLP check
        if (factory.ctx.config.getOption("FLPCheck")) {
            DBGLOG(DBG, "FLP Check");
            if( !isSubsetMinimalFLPModel<ASMOrdinaryASPSolver>(
                modelCandidate, postprocessedInput, factory.ctx) )
                continue;
        }
        else {
            DBGLOG(DBG, "Skipping FLP Check");
        }

        // remove edb and the guess (from here we don't need the guess anymore)
        modelCandidate->getStorage() -= factory.gpMask.mask()->getStorage();
        modelCandidate->getStorage() -= factory.gnMask.mask()->getStorage();

        modelCandidate->getStorage() -= mask->getStorage();

        DBGLOG(DBG,"= final model candidate " << *modelCandidate);
        return modelCandidate;
    }
    while(true);
}