Ejemplo n.º 1
0
Clause* Master::select0()
{
    CALL("select0()");
    Clause* selected;
try_next_passive:
    selected = _passive.Next();
    if (!selected)
    {   // _passive is empty, try _reservedPassive
        _parameters.lrs = 0;
        _parameters.maxWeight = VampireKernelConst::MaxClauseSize;
        _freshClause.SetMaxWeight(_parameters.maxWeight);
        if ((_parameters.showWeightChange)
                && (_freshClause.PreviousMaxWeight() != _freshClause.MaxWeight()))
            _parameters.showWeightChange(_freshClause.PreviousMaxWeight(),_freshClause.MaxWeight());
        loadReservedClauses();
        selected = _passive.Next();
        if (selected)
        {
            ASSERT(selected->mainSet() == Clause::MainSetPassive);
            selected->setMainSet(Clause::MainSetFree);
        };
        return selected;
    };
    if (selected->MinResWeight() > _parameters.maxWeight)
    {
        makeReserved(selected);
        goto try_next_passive;
    };
    if (selected)
    {
        ASSERT(selected->mainSet() == Clause::MainSetPassive);
        selected->setMainSet(Clause::MainSetFree);
    };
    return selected;
}; // Clause* Master::select0()
Ejemplo n.º 2
0
void Master::disposeObsolete()
{
    CALL("disposeObsolete()");
    Clause* disposedClause;
    while (_queueForDisposal.dequeue(disposedClause))
    {
        ASSERT(disposedClause->mainSet() == Clause::MainSetTrash);
        disposedClause->setMainSet(Clause::MainSetFree);
        disposeClause(disposedClause);
    };
}; // void Master::disposeObsolete()
Ejemplo n.º 3
0
void Master::loadReservedClauses()
{
    CALL("loadReservedClauses()");
    Clause* cl;
    _reservedPassive.ResetIterator();
    while (!_reservedPassive.Empty())
    {
        cl = _reservedPassive.Pop();
        ASSERT(cl->mainSet() == Clause::MainSetReservedPassive);
        cl->setMainSet(Clause::MainSetPassive);
        _passive.Insert(cl);
    };
}; // void Master::loadReservedClauses()
Ejemplo n.º 4
0
void Master::recycleUnreachablePassive0()
{
    CALL("recycleUnreachablePassive0()");
    Clause* cl;
recycle_next:
    if (_passive.UnreachableKept() <= (_passive.CurrentlyKept()/5))
        return; // nothing to recycle
    cl = _passive.TheMostUnreachableClause();
    if (!cl) return;
    ASSERT(cl->mainSet() == Clause::MainSetPassive);
    _passive.Cancel(cl);
    cl->setMainSet(Clause::MainSetFree);
    enqueueForDisposal(cl);
    _statRecycled++;
    goto recycle_next;
}; // void Master::recycleUnreachablePassive0()
Ejemplo n.º 5
0
void Master::reset()
{
    CALL("reset()");
    _unifier.reset();
    Unifier::setCurrent(&_unifier);

    // sets of persistent clauses
    switch (_parameters.main_alg)
    {
    case 0:
        destroyPassive0();
        break;
    case 3:
        destroyPassive3();
        break;
    default:
        ICP("ICP0");
        break;
    };

    Clause* cl;
    while (_reservedPassive.Nonempty())
    {
        cl = _reservedPassive.Top();
        enqueueForDisposal(cl);
    };
    _reservedPassive.Purge(); // to make it clean()

    while (_active.Nonempty())
    {
        cl = _active.Top();
        enqueueForDisposal(cl);
    };
    _active.Purge(); // to make it clean()


    while (_answers.Nonempty())
    {
        cl = _answers.Top();
        enqueueForDisposal(cl);
    };
    _answers.Purge(); // to make it clean()

    ASSERT(_answers.clean());

    if (_reanimatedClause)
    {
        ASSERT(_reanimatedClause->mainSet() == Clause::MainSetFree);
        enqueueForDisposal(_reanimatedClause);
    };

    // queues
    Clause* retainedNewClause;

    while (_retainedNewClauses.dequeue(retainedNewClause))
    {

        ASSERT(retainedNewClause->mainSet() == Clause::MainSetNew);
        retainedNewClause->setMainSet(Clause::MainSetFree);
        disposeClause(retainedNewClause);
    };

    // queue for disposal
    // not after _history.DestroyAllClauses()!
    disposeObsolete();
    _history.DestroyAllClauses();  // not before disposeObsolete()!

    _queueForBackSimplification.reset();
    _queueForIntegrationIntoBackwardDemodIndex.reset();

    // indices and inference engines


    _infDispatcher.reset();
    _forwardSubsumption.reset();
    _backSubsumption.reset();
    _forwardDemodulation.reset();
    _backDemodulation.reset();
    _sharingIndex.reset();
    _clauseAssembler.reset();
    _clauseNumIndex.reset();

    options.reset();
    resetStatistics();
    _reanimatedClause = 0;
    setStrategy();
}; //  void Master::reset()
Ejemplo n.º 6
0
void Master::destroy()
{
    CALL("destroy()");
    if (DestructionMode::isThorough())
    {
        // sets of persistent clauses
        switch (_parameters.main_alg)
        {
        case 0:
            destroyPassive0();
            break;
        case 3:
            destroyPassive3();
            break;
        default:
            ICP("ICP0");
            break;
        };

        Clause* cl;
        while (_reservedPassive.Nonempty())
        {
            cl = _reservedPassive.Top();
            enqueueForDisposal(cl);
        };
        _reservedPassive.Purge();

        while (_active.Nonempty())
        {
            cl = _active.Top();
            enqueueForDisposal(cl);
        };
        _active.Purge();

        while (_answers.Nonempty())
        {
            cl = _answers.Top();
            enqueueForDisposal(cl);
        };
        _answers.Purge();

        ASSERT(_answers.clean());

        if (_reanimatedClause)
        {
            ASSERT(_reanimatedClause->mainSet() == Clause::MainSetFree);
            enqueueForDisposal(_reanimatedClause);
        };

        // queues
        Clause* retainedNewClause;

        while (_retainedNewClauses.dequeue(retainedNewClause))
        {

            ASSERT(retainedNewClause->mainSet() == Clause::MainSetNew);
            retainedNewClause->setMainSet(Clause::MainSetFree);
            disposeClause(retainedNewClause);
        };

        // queue for disposal
        // not after _history.DestroyAllClauses()!
        disposeObsolete();
        _history.DestroyAllClauses();  // not before disposeObsolete()!
    };

    _clauseNumIndex.destroy();
    _freshClause.destroy();
    _clauseAssembler.destroy();
    _litOrdering.destroy();
    _litSelection.destroy();
    _sharingIndex.destroy();
    _componentName.destroy();
    _backDemodulation.destroy();
    _forwardDemodulation.destroy();
    _backSubsumption.destroy();
    _forwardSubsumption.destroy();
    _infDispatcher.destroy();
    _queueForIntegrationIntoBackwardDemodIndex.destroy();
    _queueForBackSimplification.destroy();
    _queueForDisposal.destroy();
    _retainedNewClauses.destroy();
    _answers.destroy();
    _history.destroy();
    _active.destroy();
    _reservedPassive.destroy();
    _pagedPassive.destroy();
    _passive.destroy();
    _unifier.destroy();
    _parameters.destroy();
    _timer.destroy();
    options.destroy();
    BK_CORRUPT(*this);
}; // void Master::destroy()