本文整理汇总了C++中Permutation::isSorted方法的典型用法代码示例。如果您正苦于以下问题:C++ Permutation::isSorted方法的具体用法?C++ Permutation::isSorted怎么用?C++ Permutation::isSorted使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Permutation
的用法示例。
在下文中一共展示了Permutation::isSorted方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
//.........这里部分代码省略.........
/* Construct the permutation */
if (is_signed) {
perm_param = getSignedParameters();
} else {
perm_param = getUnsignedGraspParameters();
}
Permutation perm = Permutation(perm_param, perm_seq);
// makes a copy from the original input permutation and set the normal mode
Permutation perm_orig = perm;
// Look for a input solution
Result input_seed_result;
bool has_input_seed_result = false;
if (p_read < argc) {
string solution = string(argv[p_read++]);
if (solution.substr(0, 2) == "-r") {
// in this caseheuristicName is supposed to be like -r=[[...]]
string str_result = solution.substr(3);
// Alterado por Ulisses
input_seed_result = Util::getResultFromStr(str_result.c_str(), cost_function);
has_input_seed_result = true;
Permutation perm_copy = perm;
bool valid = Solver::validateResult(perm_copy, input_seed_result, cout);
if (!valid) {
cout<<"Invalid input solution."<<endl;
exit(1);
}
}
}
/* -------------Check if the permutation is already sorted--------------- */
if (perm.isSorted(1, perm.size())) {
Result::printResult(seed_result, cout);
cout<<endl;
return 0;
}
/* ----------------------- Set Default Parameters ----------------------- */
parameter default_parameters = getDefaultParameters();
/* Set the output for results logging */
if (p_read < argc) {
logOut = new ofstream(argv[p_read++], std::ofstream::out|ofstream::app);
}
if (p_read < argc) {
logTime = new ofstream(argv[p_read++], std::ofstream::out|ofstream::app);
}
/* Look for Parameters */
string type;
parameter::iterator it;
for (it = default_parameters.begin(); it != default_parameters.end(); it++) {
pair<string, string> p = getParameterPair(it->F);
string type = p.F;
string name = p.S;
double value = it->S;
// get Num selected rev
if (type == "HCR") {
hcrP[name] = value;
} else if (type == "IMP") {
improveP[name] = value;
} else if (type == "BUILD_SOLUTION") {
exactP[name] = value;