本文整理汇总了C++中Param::outputSettings方法的典型用法代码示例。如果您正苦于以下问题:C++ Param::outputSettings方法的具体用法?C++ Param::outputSettings怎么用?C++ Param::outputSettings使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Param
的用法示例。
在下文中一共展示了Param::outputSettings方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: writeOutput
// write out the output file
void BidSet::writeOutput(Param &p, Distribution *d, int index)
{
char filename[strlen(p.filename) + 10];
const char* file_ext = strstr(p.filename, ".txt") ? "" : ".txt";
if(p.verbatim)
sprintf(filename, "%s%s", p.filename, file_ext);
else
sprintf(filename,"%s%04d%s",p.filename,index, file_ext);
ofstream outfile(filename);
// comments
long time_buf = time(NULL);
char* time_str = ctime(&time_buf);
outfile << "%% File generated by CATS v." << Param::CATS_VERSION_STRING << time_str << endl;
outfile << "%% The CATS webpage is http://robotics.stanford.edu/CATS\n\n";
outfile << "%% PARAMETER SETTINGS:\n";
outfile << p.outputSettings(true) << endl;
outfile << d->outputSettings(true) << endl << endl;
// header
outfile << "goods " << p.num_goods << "\nbids " << num_bids << "\ndummy " << num_dummy_items << "\n\n";
// bids
for (int t=0; t<numBids(); t++)
{
// bid number
outfile << t << "\t";
// prices
if (p.integer_prices)
outfile << (int)getBid(t)->amount << "\t";
else
outfile << getBid(t)->amount << "\t";
// all the goods
for (int tt=0;tt<getBid(t)->num_goods;tt++)
outfile << getBid(t)->getGood(tt) << "\t";
outfile << "#\n";
}
outfile.close();
if (p.output_parameter_settings) printf ("\nWrote CATS output file \"%s\".\n", filename);
}