• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ strvec类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: achievable_from

void Matrix::achievable_from(strvec &nodes, strvec from) const{
    int was = nodes.size();
    involved_with(nodes, from);
    if (nodes.size() == was)
        return;
    achievable_from(nodes, nodes);
}
开发者ID:kierzek,项目名称:MUFINS,代码行数:7,代码来源:Matrix.cpp


示例2: srand

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


示例3: printVector

//Just outputs vecRef
void printVector(strvec& vecRef)
{
	for (int i = 0; i < vecRef.size(); i++)
	{
		std::cout << vecRef.at(i) << std::endl;
	}
}
开发者ID:dhganey,项目名称:430p2,代码行数:8,代码来源:main.cpp


示例4: 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


示例5: rv

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


示例6: add

//Simple vector move function, pushes from from to to
void add(strvec& from, strvec& to)
{
	for (int i = 0; i < from.size(); i++)
	{
		to.push_back(from.at(i));
	}
}
开发者ID:dhganey,项目名称:430p2,代码行数:8,代码来源:main.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: 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


示例9: getSolution

void MtxLP::getSupport(strvec& support, strvec queries, int kind) const{
    stomap sol;
    getSolution(&sol, queries, kind, false);
    support.resize(sol.size());
    strvec::iterator jt = support.begin();
    for (stomap::iterator it = sol.begin(); it != sol.end(); ++it)
        *jt++ = it->first;
}
开发者ID:kierzek,项目名称:MUFINS,代码行数:8,代码来源:MtxLP.cpp


示例10: 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


示例11: optimiseLen

void MtxLP::optimiseLen(bool max, strvec q, bool presolve){
    if (q.empty())
        q = getColNames();
    setObjDir(max);
    setLenObjective(q, true);
    Solve(presolve);
    cleanTmpRows(q.size());
}
开发者ID:kierzek,项目名称:MUFINS,代码行数:8,代码来源:MtxLP.cpp


示例12: 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


示例13: 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


示例14: optimiseSum

void MtxLP::optimiseSum(bool max, strvec q, bool presolve){
    setObjDir(max);
    if (q.empty())
        q = getColNames();
    setObjective(q);
    Solve(presolve);
}
开发者ID:kierzek,项目名称:MUFINS,代码行数:7,代码来源:MtxLP.cpp


示例15: runtime_error

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


示例16: redeclareVars

//Redeclares the vars in varlist by pushing them to outlist
//Note: Array types make this function confusing. If a variable is declared as int b[5], its entry in the varList will just be "b"
//All variables should be in the hashmap, so if we don't find "b", assume we're looking for "b["
void redeclareVars(strvec& varList, strvec& outList)
{
	for (int i = 0; i < varList.size(); i++)
	{
		std::string typeStr;
		std::string newLine;

		if (varsAndTypes.find(varList.at(i)) == varsAndTypes.end()) //if the var not there, should be array type
		{
			std::string varNameStr = varList.at(i);
			varNameStr = varNameStr.append("["); //add this to look for array types
			for (std::map<std::string, std::string>::iterator it = varsAndTypes.begin(); it != varsAndTypes.end(); it++)
			{
				if (it->first.substr(0, varNameStr.length()).compare(varNameStr) == 0) //if varnamestr is b[ and the entry in the map starts with b[, we've found it
				{
					//we want to declare it as int b[5], so we still need the type
					typeStr = it->second;
					std::string varNameStr = it->first;
					newLine = typeStr.append(" ").append(varNameStr).append(";");
				}
			}
		}
		else //if it's in there, append like always
		{
			typeStr = varsAndTypes[varList.at(i)];
			newLine = typeStr.append(" ").append(varList.at(i)).append(";");
		}

		outList.push_back(newLine);
	}
}
开发者ID:dhganey,项目名称:430p2,代码行数:34,代码来源:main.cpp


示例17: insertAfterIncludes

//Pushes the vecRef into input after the include statements (at the top)
void insertAfterIncludes(strvec& vecRef)
{
	//move past any includes
	int i;
	for (i = 0; i < input.size(); i++)
	{
		if (input.at(i).length() > 0 && input.at(i).at(0) != '#')
		{
			break;
		}
	}

	//once we're here, we're past the includes and we can copy the new function
	//we need to insert this in reverse order
	for (int j = vecRef.size()-1; j >= 0; j--)
	{
		input.insert(input.begin() + i, vecRef.at(j));
	}
}
开发者ID:dhganey,项目名称:430p2,代码行数:20,代码来源:main.cpp


示例18: bool

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


示例19: declarePrivatesInMain

//Declares the varlist in the main function
void declarePrivatesInMain(strvec& varList)
{
	int mainLine = 0;
	for (mainLine; mainLine < input.size(); mainLine++)
	{
		std::string curStr = input.at(mainLine);
		if (curStr.compare("int main()") == 0)
		{
			break;
		}
	}

	mainLine += 2; //move past brackets
	for (int i = 0; i < varList.size(); i++)
	{
		input.insert(input.begin() + mainLine++, varList.at(i));
	}
}
开发者ID:dhganey,项目名称:430p2,代码行数:19,代码来源:main.cpp


示例20: ko

void MtxLP::ko(OBJSTAT& rv, stomap* obj, strvec blockvec, bool max, bool presolve){
    block(&blockvec, true);
    getOptObjStat(rv, obj, max, presolve);
    cleanTmpRows(blockvec.size());
}
开发者ID:kierzek,项目名称:MUFINS,代码行数:5,代码来源:MtxLP.cpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ sub_match类代码示例发布时间:2022-05-31
下一篇:
C++ strong_type类代码示例发布时间:2022-05-31
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap