当前位置: 首页>>代码示例>>C++>>正文


C++ Gaussian::assert_clauses_toclear_is_empty方法代码示例

本文整理汇总了C++中Gaussian::assert_clauses_toclear_is_empty方法的典型用法代码示例。如果您正苦于以下问题:C++ Gaussian::assert_clauses_toclear_is_empty方法的具体用法?C++ Gaussian::assert_clauses_toclear_is_empty怎么用?C++ Gaussian::assert_clauses_toclear_is_empty使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Gaussian的用法示例。


在下文中一共展示了Gaussian::assert_clauses_toclear_is_empty方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: updateAllOffsetsAndPointers

void ClauseAllocator::updateAllOffsetsAndPointers(
    Solver* solver
    , const vector<ClOffset>& offsets
) {
    //Must be at toplevel, otherwise propBy reset will not work
    //and also, detachReattacher will fail
    assert(solver->decisionLevel() == 0);

    //We are at decision level 0, so we can reset all PropBy-s
    for (VarData& vdata: solver->varData) {
        vdata.reason = PropBy();
        //vdata.level = 0;
    }

    //Detach long clauses
    CompleteDetachReatacher detachReattach(solver);
    detachReattach.detach_nonbins_nontris();

    #ifdef USE_GAUSS
    for(size_t i = 0; i < solver->gauss_matrixes.size(); i++) {
        Gaussian* g = solver->gauss_matrixes[i];
        g->assert_clauses_toclear_is_empty();
    }
    #endif

    //Make sure all non-freed clauses were accessible from solver
    const size_t origNumClauses =
        solver->longIrredCls.size() + solver->longRedCls.size();
    if (origNumClauses != offsets.size()) {
        std::cerr
        << "ERROR: Not all non-freed clauses are accessible from Solver"
        << endl
        << " This usually means that a clause was not freed, i.e. a mem leak"
        << endl
        << " no. clauses accessible from solver: " << origNumClauses
        << endl
        << " no. clauses non-freed: " << offsets.size()
        << endl;

        assert(origNumClauses == offsets.size());
        std::exit(-1);
    }

    //Clear clauses
    solver->longIrredCls.clear();
    solver->longRedCls.clear();

    //Add back to the solver the correct red & irred clauses
    for(auto offset: offsets) {
        Clause* cl = ptr(offset);
        assert(!cl->freed());

        //Put it in the right bucket
        if (cl->red()) {
            solver->longRedCls.push_back(offset);
        } else {
            solver->longIrredCls.push_back(offset);
        }
    }

    //Finally, reattach long clauses
    detachReattach.reattachLongsNoClean();
}
开发者ID:Darriall,项目名称:cryptominisat,代码行数:63,代码来源:clauseallocator.cpp


注:本文中的Gaussian::assert_clauses_toclear_is_empty方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。