Ejemplo n.º 1
0
void Master::killActiveOrphans0()
{
    CALL("killActiveOrphans0()");
    _active.ResetIterator();
    for (Clause* cl = _active.Next(); cl; cl = _active.Next())
        if ((cl->Active())
                && (!cl->IsVIP())
                && (cl->IsOrphan()))
        {
            enqueueForDisposal(cl);
            _statActiveOrphansMurdered++;
        };
}; // void Master::killActiveOrphans0()
Ejemplo n.º 2
0
void Master::mainLoop0()
{
    CALL("mainLoop0()");

    Clause* current;

    switch (_continuation)
    {
    case Continuation_Init:
        break;
    case Continuation_MainLoop0_ProcessNewInference:
        cancelTermination();
        _inferenceDispatcherSemaphore = true;
        goto process_new_inference;
    case Continuation_MainLoop0_BackSimplify:
        cancelTermination();
        _inferenceDispatcherSemaphore = true;
        goto back_simplify;
    default:
        ICP("ICP0");
        RuntimeError::report("Bad _continuation in VK::Master::mainLoop0()");
    };

    ASSERT(!_terminated);
    ASSERT(!_proof);

    _timer.reset();
    _timer.start();
    _timerIsOn = true;
    _externalTickFlag = false;
    _startMemory = (float)GlobAlloc::occupiedByObjects(); // mainly for LRS on memory


select_current:
    current = select0();
    if (!current)
    {
        terminate(EmptyPassive);
        _timer.stop();
        _timerIsOn = false;
        return;
    };
    if (_active.Total() >= _parameters.maxActive)
    {
        terminate(MaxActive);
        _timer.stop();
        _timerIsOn = false;
        return;
    };

    if ((_parameters.orphan_murder)
            && (!current->IsVIP())
            && (current->IsOrphan()))
    {
        _statPassiveOrphansMurdered++;
        disposeClause(current);
        estimateResources();
        goto select_current;
    };

    makeActive0(current);

    eliminateAllocationBufferDeficit0();

    _inferenceDispatcherSemaphore = true;
    _infDispatcher.newQuery(current);
next_inference:
    if (_infDispatcher.nextInference())
    {
process_new_inference:
        processCollected0();
        if (_proof)
        {
            terminate(Proof);
            _inferenceDispatcherSemaphore = false;
            _timer.stop();
            _timerIsOn = false;
            _continuation = Continuation_MainLoop0_ProcessNewInference;
            return;
        };
        _continuation = Continuation_Init;

        if (_passive.Total() >= _parameters.maxPassive)
        {
            terminate(MaxPassive);
            _inferenceDispatcherSemaphore = false;
            _timer.stop();
            _timerIsOn = false;
            return;
        };

        internalTick0();

back_simplify:
        backSimplify();
        if (_terminated)
        {
            _inferenceDispatcherSemaphore = false;
            _timer.stop();
            _timerIsOn = false;
            _continuation = Continuation_MainLoop0_BackSimplify;
            return;
        };
        _continuation = Continuation_Init;
        integrateIntoBackDemIndexFromQueue();
        goto next_inference;
    };
    // no more inferences with current
    _inferenceDispatcherSemaphore = false;

    internalTick0();


    // destroy obsolete clauses
    ASSERT(_retainedNewClauses.empty());
    ASSERT(_queueForBackSimplification.empty());
    ASSERT(_queueForIntegrationIntoBackwardDemodIndex.empty());

    disposeObsolete();
    ASSERT(_queueForDisposal.empty());
    estimateResources();
    if ((_parameters.lrs == 2) || (_parameters.lrs == 3))
    {
        recycleUnreachablePassive0();
    };
    goto select_current;
}; // void Master::mainLoop0()