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


C++ Formula::getFormula方法代码示例

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


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

示例1: recordQuantifier

/**
 * 把量词保存到对应的vector
 * @param originalFml 一阶语句
 * @return 
 */
Formula HengZhang::recordQuantifier(const Formula& _originalFml) {

    m_vTermsX.clear();
    m_vTermsY.clear();
    m_vTermsZ.clear();
    m_vTermsMIN.clear();
    m_vTermsMAX.clear();
    
    _formula* fml = _originalFml.getFormula();
    while(fml->formula_type == UNIV) {
        m_vTermsX.push_back(fml->variable_id);
        fml = fml->subformula_l;
    }
    while (fml->formula_type == EXIS) {
        m_vTermsY.push_back(fml->variable_id);
        
        const char* sDomainName = Vocabulary::instance().getVariableDomain(fml->variable_id);
        // MIN
        int id = Vocabulary::instance().generateDomainMIN(sDomainName);
        m_vTermsMIN.push_back(id);
        // MAX
        id = Vocabulary::instance().generateDomainMAX(sDomainName);
        m_vTermsMAX.push_back(id);
        // Z
        id = Vocabulary::instance().generateNewVariable(fml->variable_id);
        m_vTermsZ.push_back(id);

        fml = fml->subformula_l;
    }
    Formula ret = Formula(fml, true);
    return ret;
}
开发者ID:yzf,项目名称:Parser,代码行数:37,代码来源:HengZhang.cpp

示例2: createSuccAndSOrTheta__ImplS

/**
 * ((succ(_Y,_Z) & s(_X,_Z)) | theta__(_X,_Y)) -> s(_X,_Y)
 * @return 
 */
Formula HengZhang::createSuccAndSOrTheta__ImplS(const Formula& _originalFml) {
    //1 (succ(_Y,_Z)
    _term* term_y_z = Utils::combineTerms(m_vTermsY, m_vTermsZ);
    _formula* succ_y_z = Utils::compositeToAtom(m_nSymbolSucc, term_y_z);
    //2 s(_X,_Z)
    _term* term_x_z = Utils::combineTerms(m_vTermsX, m_vTermsZ);
    _formula* s_x_z = Utils::compositeToAtom(m_nSymbolS, term_x_z);
    //3 theta__(_X,_Y)
    Formula copyOriginalFml = _originalFml;
    map<int, string> mapPredicates = Vocabulary::instance().getAllIntensionPredicates();
    copyOriginalFml.doubleNegationPredicates(mapPredicates);
    _formula* theta__ = Utils::copyFormula(copyOriginalFml.getFormula());
    //4 s(_X,_Y)
    _term* term_x_y = Utils::combineTerms(m_vTermsX, m_vTermsY);
    _formula* s_x_y   = Utils::compositeToAtom(m_nSymbolS, term_x_y);

    //create structure
    _formula* ll = Utils::compositeByConnective(CONJ, succ_y_z, s_x_z);
    _formula* l = Utils::compositeByConnective(DISJ, ll, theta__);
    _formula* r = s_x_y;
    _formula* f = Utils::compositeByConnective(IMPL, l, r);
    
    Formula fml = Formula(f, false);
    return fml;
}
开发者ID:yzf,项目名称:Parser,代码行数:29,代码来源:HengZhang.cpp

示例3: Formula

/**
 * 章衡量词消去公式五 2   succ(_Y,_Z) -> ((theta(_X,_Z) | t(_X,_Z)) -> t(_X,_Y)) 
 * @param originalFml 一阶语句
 * @return 
 */
Formula HengZhang::createFormula_5_2(const Formula& _originalFml) {
    //1 _succ(_Y,_Z)
    _term* term_y_z = Utils::combineTerms(m_vTermsY, m_vTermsZ);
    _formula* succ_y_z  = Utils::compositeToAtom(m_nSymbolSucc, term_y_z);

    //2 T(_X,_Y)
    _term* term_x_y = Utils::combineTerms(m_vTermsX, m_vTermsY);
    _formula* t_x_y  = Utils::compositeToAtom(m_nSymbolT, term_x_y);

    //3 theta(_X,_Z)
    Formula copyOriginalFml = _originalFml;
    copyOriginalFml.replaceTerms(m_vTermsY, m_vTermsZ);
    _formula* theta_x_z = Utils::copyFormula(copyOriginalFml.getFormula());

    //4 T(_X,_Z)
    _term* term_x_z = Utils::combineTerms(m_vTermsX, m_vTermsZ);
    _formula* t_x_z = Utils::compositeToAtom(m_nSymbolT, term_x_z);

    //create structure
    _formula* left = succ_y_z;
    _formula* rl = Utils::compositeByConnective(DISJ, theta_x_z, t_x_z);
    _formula* right = Utils::compositeByConnective(IMPL, rl, t_x_y);
    _formula* F = Utils::compositeByConnective(IMPL, left, right);
    
    Formula fml = Formula(F, false);
    return fml;
}
开发者ID:yzf,项目名称:Parser,代码行数:32,代码来源:HengZhang.cpp

示例4: addAtom

void Vocabulary::addAtom(const Formula& _newAtom) {
    for (FORMULAS_CONST_ITERATOR iter = m_fmlAtomList->begin();
            iter != m_fmlAtomList->end(); ++ iter) {
        if (iter->getFormula()->predicate_id == _newAtom.getFormula()->predicate_id) {
            return;
        }
    }
    m_fmlAtomList->pushBack(_newAtom);
}
开发者ID:yzf,项目名称:Parser,代码行数:9,代码来源:Vocabulary.cpp

示例5: compareFormula

bool Formula::operator == (const Formula& _rhs) const {
    return Utils::compareFormula(m_pFormula, _rhs.getFormula());
}
开发者ID:yzf,项目名称:Parser,代码行数:3,代码来源:Formula.cpp

示例6:

Formula::Formula(const Formula& _rhs) {
    m_pFormula = Utils::copyFormula(_rhs.getFormula());
}
开发者ID:yzf,项目名称:Parser,代码行数:3,代码来源:Formula.cpp


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