本文整理汇总了C++中ConfigurationParameters::getValue方法的典型用法代码示例。如果您正苦于以下问题:C++ ConfigurationParameters::getValue方法的具体用法?C++ ConfigurationParameters::getValue怎么用?C++ ConfigurationParameters::getValue使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ConfigurationParameters
的用法示例。
在下文中一共展示了ConfigurationParameters::getValue方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: configure
void LinearComboFunction::configure(ConfigurationParameters& params, QString prefix)
{
// We don't need configured component functions here (and they will be
// configured after exiting from this function)
first.reset(params.getObjectFromParameter<OutputFunction>(prefix + "first", false, false));
w1 = 0.0;
QString str = params.getValue(prefix + "w1");
if (!str.isNull()) {
bool ok;
w1 = str.toDouble(&ok);
if (!ok) {
w1 = 0.0;
}
}
second.reset(params.getObjectFromParameter<OutputFunction>(prefix + "second", false, false));
w2 = 0.0;
str = params.getValue(prefix + "w2");
if (!str.isNull()) {
bool ok;
w2 = str.toDouble(&ok);
if (!ok) {
w2 = 0.0;
}
}
// We don't need to reload a reference to the cluster as he calls our setCluster
// function after our creation
}
示例2: configure
void Pattern::configure(ConfigurationParameters& params, QString prefix) {
//--- get all parameters with the prefix 'cluster:'
QStringList clusterList = params.getParametersWithPrefixList( prefix, "cluster:" );
foreach( QString cluster, clusterList ) {
QString id = cluster.split(':')[1];
if ( id.isNull() || id.isEmpty() ) continue;
//--- now, it check if there is a inputs and outputs parameter and load it
QString str = params.getValue( prefix + "inputs:" + id );
DoubleVector inputs;
if (!str.isNull()) {
QStringList list = str.split(QRegExp("\\s+"), QString::SkipEmptyParts);
for( int i=0; i<list.size(); i++) {
inputs.append( list[i].toDouble() );
}
}
str = params.getValue( prefix + "outputs:" + id );
DoubleVector outputs;
if (!str.isNull()) {
QStringList list = str.split(QRegExp("\\s+"), QString::SkipEmptyParts);
for( int i=0; i<list.size(); i++) {
outputs.append( list[i].toDouble() );
}
}
if ( inputs.size() == 0 && outputs.size() == 0 ) continue;
Cluster* cl = params.getObjectFromParameter<Cluster>( prefix+cluster, false, true );
if ( inputs.size() > 0 ) {
setInputsOf( cl, inputs );
}
if ( outputs.size() > 0 ) {
setOutputsOf( cl, outputs );
}
}
示例3: Linker
MatrixLinker::MatrixLinker( ConfigurationParameters& params, QString prefix )
: Linker( params, prefix ), nrows(from()->numNeurons()), ncols(to()->numNeurons()), w(nrows, ncols, true) {
// the weights are read from a single vector of data supposing they are row-major arranged
QString str = params.getValue(prefix + "weights");
if (!str.isNull()) {
QStringList list = str.split(QRegExp("\\s+"), QString::SkipEmptyParts);
int cycleLength = nrows*ncols;
if (list.size() != cycleLength) {
#ifdef NNFW_DEBUG
qWarning() << "The number of elements of the weights in configuration file (" << list.size()
<< ") is different from the total number of weights (" << cycleLength << ").";
#endif
cycleLength = std::min(list.size(), cycleLength);
}
for( int i=0; i<cycleLength; i++) {
bool ok;
unsigned int r = i/ncols; //--- division may be expensive
unsigned int c = i%ncols; //--- module may be expensive
w[r][c] = list[i].toDouble(&ok);
if (!ok) {
w[r][c] = 0.0;
}
}
}
}
示例4: configure
void Genotype::configure( ConfigurationParameters& params, QString prefix ) {
int newsize = params.getValue( prefix + QString( "bitsize" ) ).toInt();
Q_ASSERT_X( newsize > 0,
"Genotype::configure",
"The bitsize must be present in the config file and its value must be greater than zero" );
resize( newsize );
QString zipdata = params.getValue( prefix + QString( "data" ) );
if ( !zipdata.isNull() ) {
fromCompressedString( zipdata );
}
QStringList valuesList = params.getValue( prefix + QString( "fitness" ) )
.split( QRegExp("\\s+"), QString::SkipEmptyParts );
if ( valuesList.size() > 0 ) {
// read the values of fitness
fitnessv.resize(0);
foreach( QString avalue, valuesList ) {
fitnessv << avalue.toDouble();
}
// safe check
if ( fitnessv.size() == 0 ) {
fitnessv.append( 0 );
}
}
示例5: Linker
CopyLinker::CopyLinker( ConfigurationParameters& params, QString prefix )
: Linker( params, prefix ), dataFrom(), dataTo() {
dimData = qMin( to()->numNeurons(), from()->numNeurons() );
this->mode = (CopyMode)-1;
//--- default initialisation, in the case the user forget to set the parameter
setMode( Out2In );
QString str = params.getValue(prefix + "mode");
if ( !str.isNull() ) {
str = str.toLower();
if ( str == "in2in" ) {
setMode( In2In );
} else if ( str == "in2ou" ) {
setMode( In2Out );
} else if ( str == "out2in" ) {
setMode( Out2In );
} else if ( str == "out2out" ) {
setMode( Out2Out );
}
}
}
示例6: configure
void DeterministicRank::configure( ConfigurationParameters& params, QString prefix ) {
nTruncation = params.getValue( prefix + QString( "nTruncation" ) ).toInt();
}