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


C++ strvec::end方法代码示例

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


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

示例1: elModes

void SplitLP::elModes(solvec& solutions, int num, strvec& fixcols){
    srand (unsigned(time(NULL)));
    double fixrate = 1/this->vmax;
    for (strvec::iterator it = fixcols.begin(); it != fixcols.end(); ++it){
        fix(*it, fixrate, true);
        fix(get_opp_name(*it), 0, true);
    }
    int kind = getKind() == MILP ? INT : CONT;
    void (MtxLP::*optimise)(stomap*, bool, strvec, bool, bool) = \
        (kind == INT) ? &MtxLP::optLenSol : &MtxLP::optSumSol;
    int i;
    for (i = 0; i < num; i++){
        stomap sol;
        (this->*optimise)(&sol, false, getColNames(), false, true);
        if (sol.empty())
            break;
        if (fixrate != 0) mul(&sol, vmax);
        solutions.push_back(sol);
        if (i < num - 1){
            sol.clear();
            MtxLP::getSolution(&sol, getColNames(kind), kind, false);
            if (kind == INT) cutSolution(&sol, true);
            else {
                for (strvec::iterator it = fixcols.begin();  it != fixcols.end(); ++it)
                     sol.erase(*it);
                int nblock = rand() % sol.size();
                stomap::iterator itblock = sol.begin();
                for (int i = 0; i < nblock; i++)itblock++;
                string sblock = itblock->first;
                block(sblock, true);
            }
        }
    }
    cleanTmpRows();//fixcols.size() * 2 + i - 1);
}
开发者ID:kierzek,项目名称:MUFINS,代码行数:35,代码来源:SplitLP.cpp

示例2: involved_with

void Matrix::involved_with(strvec& result, string name) const{
    stomap* sto = (*this)[name]->get_sto();
    for (stomap::iterator jt = sto->begin(); jt != sto->end(); ++jt){
        string name2 = jt->first;
        if (std::find(result.begin(), result.end(), name2) == result.end())
            result.push_back(name2);
    }
}
开发者ID:kierzek,项目名称:MUFINS,代码行数:8,代码来源:Matrix.cpp

示例3: get_int_names

strvec MtxLP::get_int_names(strvec names){
    strvec rv(names.size());
    strvec::iterator it = names.begin(), it2 = rv.begin();
    while (it != names.end())
        *it2++ = get_int_name(*it++);
    return rv;
}
开发者ID:kierzek,项目名称:MUFINS,代码行数:7,代码来源:MtxLP.cpp

示例4: select

void Matrix::select(strvec &rv, strvec &names, bool(Matrix::*fun)(string)const, strvec &ignore)const {
    if (names.empty())
        names = rows;
    elmap::iterator end = map->end();
    string name;
    strvec::iterator igbeg = ignore.begin(), igend = ignore.end();
    for (strvec::iterator it = names.begin(); it != names.end(); ++it){        
        if (std::find(igbeg, igend, *it) == igend){
            name = *it;
            if (map->find(*it) == end)
                throw runtime_error(string("No such row or column: ") + name);
            if ((*this.*fun)(name))
                rv.push_back(name);
        }
    }
}
开发者ID:kierzek,项目名称:MUFINS,代码行数:16,代码来源:Matrix.cpp

示例5: del_cols

void Matrix::del_cols(strvec &names){
    for (strvec::iterator it = names.begin(); it != names.end(); ++it){
        del(*it);
        std::remove(cols.begin(), cols.end(), *it);
    }
    cols.resize(cols.size() - names.size());
}
开发者ID:kierzek,项目名称:MUFINS,代码行数:7,代码来源:Matrix.cpp

示例6: getBottleNecks

strvec MtxLP::getBottleNecks(stomap* obj, strvec q, bool max, bool presolve){
    strvec rv;
    for (strvec::iterator it = q.begin(); it != q.end(); ++it){
        if (isBottleNeck(obj, *it, max, presolve))
            rv.push_back(*it);
    }
    return rv;
}
开发者ID:kierzek,项目名称:MUFINS,代码行数:8,代码来源:MtxLP.cpp

示例7: getUnblockedVars

strvec MtxLP::getUnblockedVars(strvec q, bool presolve){
    strvec rv;
    for (strvec::iterator it = q.begin(); it != q.end(); ++it){
        if (isUnBlocked(*it, presolve))
            rv.push_back(*it);
    }
    return rv;
}
开发者ID:kierzek,项目名称:MUFINS,代码行数:8,代码来源:MtxLP.cpp

示例8: externalise

void MtxLP::externalise(strvec& names, bool on){
    double lb = on ? -UB : 0;
    double ub = on ? UB : 0;
    for (strvec::iterator it = names.begin(); it != names.end(); ++it){
        if (nrow(*it) != 0)
            setRowBnds(*it, lb, ub);
    }
}
开发者ID:kierzek,项目名称:MUFINS,代码行数:8,代码来源:MtxLP.cpp

示例9: getRanges

void MtxLP::getRanges(rangemap* rm, strvec q, bool presolve){
    OBJSTAT_RANGE range;
    stomap targsto;
    for (strvec::iterator it = q.begin(); it != q.end(); ++it){
        string name = *it;
        getColRange(range, name, presolve);
        (*rm)[name] = range;
    }
}
开发者ID:kierzek,项目名称:MUFINS,代码行数:9,代码来源:MtxLP.cpp

示例10: getSolution

void MtxLP::getSolution(stomap* sol, strvec q, int kind, bool withzeroes) const{
    if (!isSolved()) return;
    for (strvec::iterator i = q.begin(); i != q.end(); i++){
        string name = *i;
        double coef = getColValue(name);
        if (withzeroes || !is_zero(coef))
            (*sol)[name] = coef;
    }
}
开发者ID:kierzek,项目名称:MUFINS,代码行数:9,代码来源:MtxLP.cpp

示例11: setLenObjective

void MtxLP::setLenObjective(strvec cols, bool tmp){
    if (kind != MILP)
        throw runtime_error("trying to optimise length using a non-MILP solver!");
    emptyObjective();
    int contcoef = isMaximising() ? 1 : -1;
    int intcoef = -contcoef;
    for (strvec::iterator it = cols.begin(); it != cols.end(); ++it){
        string name = *it;
        string intname = get_int_name(name);
        stomap *sto = new stomap;
        (*sto)[name] = contcoef;
        (*sto)[intname] = intcoef * vmax;
        addConstraint(sto, 0, UB, tmp, name + INT_CONSTR_TAG);
        setObjCoef(intname, 1);
        delete sto;
    }
}
开发者ID:kierzek,项目名称:MUFINS,代码行数:17,代码来源:MtxLP.cpp

示例12: setObjective

void MtxLP::setObjective(strvec names, double coef){
    emptyObjective();
    for (strvec::iterator it = names.begin(); it != names.end(); ++it)
        setObjCoef(*it, coef);
}
开发者ID:kierzek,项目名称:MUFINS,代码行数:5,代码来源:MtxLP.cpp

示例13: eliminateDuplicates

//Eliminates duplicates from the global vars
void eliminateDuplicates(strvec& vecRef)
{
	std::set<std::string> tempSet(vecRef.begin(), vecRef.end()); //sets only allow unique elements! just stuff the whole vector in, then:
	vecRef.clear();
	vecRef.assign(tempSet.begin(), tempSet.end());
}
开发者ID:dhganey,项目名称:430p2,代码行数:7,代码来源:main.cpp

示例14: SentenceToSakuraScriptInternal

int Satori::SentenceToSakuraScriptInternal(const strvec &vec,string &result,string &jump_to,ptrdiff_t &ip)
{
    // 再帰管理
    static	int nest_count=0;
    ++nest_count;
    //DBG(sender << "enter SentenceToSakuraScriptInternal, nest-count: " << nest_count << ", vector_size: " << vec.size() << endl);

    if ( m_nest_limit > 0 && nest_count > m_nest_limit ) {
        sender << "呼び出し回数超過" << endl;
        --nest_count;
        return 0;
    }

    static const int basewait=3;

    strvec::const_iterator it = vec.begin();
    std::advance(it,ip);

    for ( ; it != vec.end() ; ++it) {
        const char*	p = it->c_str();
        //DBG(sender << nest_count << " '" << p << "'" << endl);

        if ( it==vec.begin() && strncmp(p, "→", 2)==0 ) {
            p+=2;
            updateGhostsInfo();	// ゴースト情報を更新

            if ( ghosts_info.size()>=2 ) {	// そもそも自分以外にゴーストはいるのか。
                string	temp = p;
                vector<strmap>::iterator i=ghosts_info.begin();
                ++i; // 自分は飛ばす
                for ( ; i!=ghosts_info.end() ; ++i ) {
                    string	name = (*i)["name"];
                    sender << "ghost: " << name <<endl;
                    if ( compare_head(temp, name) ) {// 相手を特定
                        mCommunicateFor = name;
                        p += mCommunicateFor.size();
                        break;
                    }
                }


                if ( i==ghosts_info.end() ) {	// 特定しなかった場合
                    // ランダム
                    //int n = random(ghosts_info.size()-1))+1;
                    //assert( n>=1 && n < ghosts_info.size());
                    mCommunicateFor = (ghosts_info[1])["name"];

                    // あかん、隣で起動している〜〜にならん
                }
            }
        }

        // 選択肢	\q?[id,string]
        if ( strncmp(p, "_", 2)==0 ) {
            if ( strlen(p)>1023 )
                continue;
            char	buf[1024];
            strncpy(buf, p+2, sizeof(buf) / sizeof(buf[0]));

            char*	choiced = buf;
            char*	id = (char*)strstr_hz(buf, "\t"); // 選択肢ラベルとジャンプ先の区切り

            result += append_at_choice_start;
            if ( id == NULL ) {
                string	str=UnKakko(choiced);
                //result += string("\\q")+itos(question_num++)+"["+str+"]["+str+"]";
                result += "\\q["+str+","+str+"]";
            } else {
                *id++='\0';
                while ( *id=='\t' ) ++id; // 選択肢ラベルとジャンプ先の区切り
                //result += string("\\q")+itos(question_num++)+"["+UnKakko(id)+"]["+UnKakko(choiced)+"]";
                result += "\\q["+UnKakko(choiced)+","+UnKakko(id)+"]";
            }
            result += append_at_choice_end;

            continue;
        }

        // ちょっと微妙な存在意義。
        if ( strncmp(p, "\\s", 2)==0 ) {
            if ( !is_speaked(speaker) ) {
                if ( surface_changed_before_speak.find(speaker) == surface_changed_before_speak.end() ) {
                    surface_changed_before_speak.insert(map<int,bool>::value_type(speaker,is_speaked_anybody()) );
                }
            }
        }

        // ジャンプ
        if ( strncmp(p, ">", 2)==0 || strncmp(p, "≫", 2)==0 ) {
            strvec	words;
            split(p+2, "\t", words, 2); // ジャンプ先とジャンプ条件の区切り

            if ( words.size()>=2 ) {
                string	r;
                if ( !calculate(words[1], r) )
                    break;
                if ( zen2int(r) == 0 ) {
                    sender << "*計算結果が0だったため、続行します。" << endl;
                    continue;
                }
//.........这里部分代码省略.........
开发者ID:yagi,项目名称:satori,代码行数:101,代码来源:satori_sentence.cpp


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