本文整理汇总了C++中AnyOption::setVerbose方法的典型用法代码示例。如果您正苦于以下问题:C++ AnyOption::setVerbose方法的具体用法?C++ AnyOption::setVerbose怎么用?C++ AnyOption::setVerbose使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AnyOption
的用法示例。
在下文中一共展示了AnyOption::setVerbose方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main(int argc, char** argv)
{
int ret = EXIT_SUCCESS;
// Setup default error handling strategy.
// ...
// Setup the default log stream.
Log logger;
LogSetDefault(&logger);
// Setup the command line handling.
AnyOption options;
// Use this to active debug mode.
options.setFlag("debug", 'd');
options.setVerbose();
options.autoUsagePrint(true);
// Process the command line arguments.
options.processCommandArgs(argc, argv);
String file;
ret = ValidateOptions(options, file);
if( ret != EXIT_SUCCESS )
{
options.printUsage();
return ret;
}
Runtime runtime;
runtime.init();
runtime.shutdown();
return ret;
}
示例2: process_option
int process_option(int argc, char* argv[]){
AnyOption *opt = new AnyOption();
opt->setVerbose();
opt->addUsage( "" );
opt->addUsage( "Usage: " );
opt->addUsage( "" );
opt->addUsage( "--S0" );
opt->addUsage( "--G0" );
opt->addUsage( "--RhoGEF0" );
opt->addUsage( "--RhoA0" );
opt->addUsage( "--Inhibitor0" );
opt->addUsage( "--kg1" );
opt->addUsage( "--kg2" );
opt->addUsage( "--kf1" );
opt->addUsage( "--kfd" );
opt->addUsage( "--kg3" );
opt->addUsage( "--kgd" );
opt->addUsage( "--kf2" );
opt->addUsage( "--ka1" );
opt->addUsage( "--ka2" );
opt->addUsage( "--ki1" );
opt->addUsage( "--kid" );
opt->addUsage( "" );
opt->setOption( "S0" );
opt->setOption( "G0" );
opt->setOption( "RhoGEF0" );
opt->setOption( "RhoA0" );
opt->setOption( "Inhibitor0" );
opt->setOption( "kg1" );
opt->setOption( "kg2" );
opt->setOption( "kf1" );
opt->setOption( "kfd" );
opt->setOption( "kg3" );
opt->setOption( "kgd" );
opt->setOption( "kf2" );
opt->setOption( "ka1" );
opt->setOption( "ka2" );
opt->setOption( "ki1" );
opt->setOption( "kid" );
opt->processCommandArgs( argc, argv );
if( opt->getValue( "S0" ) != NULL ){
S0 = atof(opt->getValue( "S0" ));
}
if( opt->getValue( "G0" ) != NULL ){
G0 = atof(opt->getValue( "G0" ));
}
if( opt->getValue( "RhoGEF0" ) != NULL ){
RhoGEF0 = atof(opt->getValue( "RhoGEF0" ));
}
if( opt->getValue( "RhoA0" ) != NULL ){
RhoA0 = atof(opt->getValue( "RhoA0" ));
}
if( opt->getValue( "Inhibitor0" ) != NULL ){
Inhibitor0 = atof(opt->getValue( "Inhibitor0" ));
}
if( opt->getValue( "kg1" ) != NULL ){
kg1 = atof(opt->getValue( "kg1" ));
}
if( opt->getValue( "kg2" ) != NULL ){
kg2 = atof(opt->getValue( "kg2" ));
}
if( opt->getValue( "kf1" ) != NULL ){
kf1 = atof(opt->getValue( "kf1" ));
}
if( opt->getValue( "kfd" ) != NULL ){
kfd = atof(opt->getValue( "kfd" ));
}
if( opt->getValue( "kg3" ) != NULL ){
kg3 = atof(opt->getValue( "kg3" ));
}
if( opt->getValue( "kgd" ) != NULL ){
kgd = atof(opt->getValue( "kgd" ));
}
if( opt->getValue( "kf2" ) != NULL ){
kf2 = atof(opt->getValue( "kf2" ));
}
if( opt->getValue( "ka1" ) != NULL ){
ka1 = atof(opt->getValue( "ka1" ));
}
if( opt->getValue( "ka2" ) != NULL ){
ka2 = atof(opt->getValue( "ka2" ));
}
if( opt->getValue( "ki1" ) != NULL ){
ki1 = atof(opt->getValue( "ki1" ));
}
if( opt->getValue( "kid" ) != NULL ){
kid = atof(opt->getValue( "kid" ));
}
return 0;
}
示例3: main
int main(int argc, char **argv){
// nekonstantni nastaveni generatoru nahodnych cisel
srand((unsigned int)time(0));
// server cast
clock_t t1, t2;
t1 = clock();
int NP = 50;
double F = 0.7;
double CR = 0.6;
int Generations = 10;
int pocet_neuronu = 5;
char *nejlepsi_jedinec = "nejlepsi_jedinec.txt";
char *data = "data.txt";
int tichy = 0;
// parsovani parametru
AnyOption *opt = new AnyOption();
opt->setVerbose(); /* print warnings about unknown options */
opt->autoUsagePrint(true); /* print usage for bad options */
opt->addUsage( "" );
opt->addUsage( "NNSA (Neural Network Space Arcade) - Testovani rekuretni neuronove site na jednoduche arkade" );
opt->addUsage( "" );
opt->addUsage( "Pouziti: " );
opt->addUsage( "" );
opt->addUsage( " -h --help Zobrazi tuto napovedu " );
opt->addUsage( " -n jedinec.txt Nejlepsi jedinec " );
opt->addUsage( " -d data.txt Udaje o jednotlivych generacich " );
opt->addUsage( " " );
opt->addUsage( " --NP 60 Velikost populace " );
opt->addUsage( " --F 0.7 Mutacni konstanta " );
opt->addUsage( " --CR 0.8 Prah krizeni " );
opt->addUsage( " --generations 100 Pocet kol slechteni populace " );
opt->addUsage( " --neurons 4 Pocet neuronu v neuronove siti " );
opt->addUsage( " --quiet 1 Neukecany rezim " );
opt->addUsage( "" );
opt->setFlag( "help", 'h'); /* a flag (takes no argument), supporting long and short form */
opt->setOption('n');
opt->setOption('d');
opt->setOption("NP");
opt->setOption("F");
opt->setOption("CR");
opt->setOption("generations");
opt->setOption("neurons");
opt->setOption("quiet");
opt->processCommandArgs(argc, argv);
NP = atoi(opt->getValue("NP"));
F = atof(opt->getValue("F"));
CR = atof(opt->getValue("CR"));
Generations = atoi(opt->getValue("generations"));
pocet_neuronu = atoi(opt->getValue("neurons"));
nejlepsi_jedinec = opt->getValue('n');
data = opt->getValue('d');
tichy = atoi(opt->getValue("quiet"));
cout << "Parametry diferencialni evoluce:" << endl;
cout << " -> Velikost populace NP = " << NP << endl;
cout << " -> Mutacni konstanta F = " << F << endl;
cout << " -> Prah krizeni CR = " << CR << endl;
cout << " -> Pocet generaci = " << Generations << endl;
cout << " -> Pocet neuronu = " << pocet_neuronu << endl;
DiferencialniEvoluce *d1 = new DiferencialniEvoluce(NP, F, CR, Generations, pocet_neuronu, &ohodnoceni, tichy, data);
d1->UlozNejlepsiJedinec(nejlepsi_jedinec);
// 32bit - pretece cca po 36 minutach
t2 = clock();
cout << "Doba behu programu: " << ((double) (t2 - t1))/CLOCKS_PER_SEC << endl;
return 0;
}