当前位置: 首页>>代码示例>>C++>>正文


C++ ParameterList::GetDoubleParameter方法代码示例

本文整理汇总了C++中ParameterList::GetDoubleParameter方法的典型用法代码示例。如果您正苦于以下问题:C++ ParameterList::GetDoubleParameter方法的具体用法?C++ ParameterList::GetDoubleParameter怎么用?C++ ParameterList::GetDoubleParameter使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ParameterList的用法示例。


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

示例1: initialParList

std::shared_ptr<FitResult> GenevaIF::exec(ParameterList& par) {
	std::shared_ptr<GenevaResult> result(new GenevaResult());
	ParameterList initialParList(par);

	Go2 go( (configFileDir+"Go2.json"));

	// Initialize a client, if requested
    if(go.clientMode()) {
	  std::cout << "Geneva Client waiting for action!" << std::endl;
	  go.clientRun();
	  return result;
	}

	boost::shared_ptr<GStartIndividual> p( new GStartIndividual(_myData, par) );
	go.push_back(p);

	// Add an evolutionary algorithm to the Go2 class.
	GEvolutionaryAlgorithmFactory ea((configFileDir+"GEvolutionaryAlgorithm.json"), parallelizationMode);
	go & ea();

	// Perform the actual optimization
	boost::shared_ptr<GStartIndividual>
		bestIndividual_ptr = go.optimize<GStartIndividual>();

	// Terminate
	bestIndividual_ptr->getPar(par);
	result->setResult(bestIndividual_ptr);
	result->SetAmplitude(_myData->getAmplitudes().at(0));
	result->setInitialParameters(initialParList);
	result->setFinalParameters(par);
	//int whattodowiththisidontknow =  go.finalize(); //Go2::finalize();

        //write Parameters back
	ParameterList resultPar;
	bestIndividual_ptr->getPar(resultPar);
	for(unsigned int i=0; i<par.GetNDouble(); i++){  //TODO: better way, no cast or check type
	  if(!par.GetDoubleParameter(i)->IsFixed())
	    par.GetDoubleParameter(i)->SetValue(resultPar.GetDoubleParameter(i)->GetValue());
	}

	return result;
}
开发者ID:,项目名称:,代码行数:42,代码来源:

示例2: execute

bool WignerDStrategy::execute(ParameterList& paras,
		std::shared_ptr<AbsParameter>& out)
{
#ifdef DEBUG
	if( checkType != out->type() ) {
		throw( WrongParType( std::string("Output Type ")
		+ParNames[out->type()]+std::string(" conflicts expected type ")
		+ParNames[checkType]+std::string(" of ")+name+" Wigner strat") );
		return false;
	}
#endif

	double _inSpin = paras.GetDoubleParameter(0)->GetValue();
	double _outSpin1 = paras.GetDoubleParameter(1)->GetValue();
	double _outSpin2 = paras.GetDoubleParameter(2)->GetValue();

	ComPWA::Physics::DPKinematics::DalitzKinematics* kin =
			dynamic_cast<ComPWA::Physics::DPKinematics::DalitzKinematics*>(
			Kinematics::instance()
	);

	std::shared_ptr<MultiDouble> _angle = paras.GetMultiDouble(0);

	std::vector<double> results(_angle->GetNValues(), 0.);
	for(unsigned int ele=0; ele<_angle->GetNValues(); ele++){
		try{
			results.at(ele)=AmpWigner2::dynamicalFunction(
					_inSpin,_outSpin1,_outSpin2,_angle->GetValue(ele)
			);
		} catch (std::exception &ex) {
			BOOST_LOG_TRIVIAL(error) << "WignerDStrategy::execute() | "
					<<ex.what();
			throw std::runtime_error("WignerDStrategy::execute() | "
					"Evaluation of dynamical function failed!");
		}
	}//end element loop
	out = std::shared_ptr<AbsParameter>(
			new MultiDouble(out->GetName(),results));

	return true;
}
开发者ID:,项目名称:,代码行数:41,代码来源:

示例3: Append

void ParameterList::Append(const ParameterList& addList)
{
	for(int i=0; i<addList.GetNBool(); i++ )
		AddParameter(addList.GetBoolParameter(i));
	for(int i=0; i<addList.GetNInteger(); i++ )
		AddParameter(addList.GetIntegerParameter(i));
	for(int i=0; i<addList.GetNDouble(); i++ )
		AddParameter(addList.GetDoubleParameter(i));
	for(int i=0; i<addList.GetNComplex(); i++ )
		AddParameter(addList.GetComplexParameter(i));
	for(int i=0; i<addList.GetNMultiDouble(); i++ )
		AddParameter(addList.GetMultiDouble(i));
	for(int i=0; i<addList.GetNMultiComplex(); i++ )
		AddParameter(addList.GetMultiComplex(i));
	for(int i=0; i<addList.GetNMultiUnsignedInteger(); i++ )
		AddParameter(addList.GetMultiUnsignedInteger(i));
}
开发者ID:,项目名称:,代码行数:17,代码来源:

示例4: main


//.........这里部分代码省略.........
	//    BOOST_LOG_TRIVIAL(debug) << "InvMasses first Evt from dataPoint: \t" << myPoint.getVal("m23sq") << " \t " << myPoint.getVal("m13sq");
	//    BOOST_LOG_TRIVIAL(debug) << "InvMasses first Evt from allMasses: \t" << (myEvtMasses.masses_sq[std::make_pair(2,3)])[0] << " \t " << (myEvtMasses.masses_sq[std::make_pair(1,3)])[0];
	//
	//    BOOST_LOG_TRIVIAL(debug) << "First BW first Evt classical: \t" <<  (amps->getFirstBW(myPoint,par));
	//    BOOST_LOG_TRIVIAL(debug) << "First BW first Evt from tree: \t" << (bwChild->GetValue()*adChild->GetValue());
	//
	//    BOOST_LOG_TRIVIAL(debug) << "FirstReso first Evt classical: \t" <<  amps->getFirstReso(myPoint,par);
	//    BOOST_LOG_TRIVIAL(debug) << "FirstReso first Evt from tree: \t" << resoChild->GetValue();
	//
	//    BOOST_LOG_TRIVIAL(debug) << "First Amp first Evt classical: \t" <<  amps->getFirstAmp(myPoint,par);
	//    BOOST_LOG_TRIVIAL(debug) << "First Amp first Evt from tree: \t" << ampChild->GetValue();
	//
	//    BOOST_LOG_TRIVIAL(debug) << "Intensity of first data event classical: \t" << amps->intensity(myPoint,par).GetParameterValue(0);
	//    BOOST_LOG_TRIVIAL(debug) << "Intensity of first data event from tree: \t" << intensChild->GetValue();
	//    BOOST_LOG_TRIVIAL(debug)<<"Finish consistency checks"<<std::endl;
	//  }

	//std::shared_ptr<ControlParameter> esti = MinLogLH::createInstance(amps, myReader, myPHSPReader);
	//std::shared_ptr<Estimator> esti(new MinLogLH(amps, myReader, myPHSPReader));
	std::shared_ptr<Optimizer::Optimizer> opti(new Optimizer::Minuit2::MinuitIF(esti, par));

	ParameterList test;
	/*if(useFctTree)
	 if(!amps->functionTree(test))
	 return 1;*/

	//return 0;
	BOOST_LOG_TRIVIAL(info)<< "LH with optimal parameters: " << esti->controlParameter(par);
	if (useFctTree)
		BOOST_LOG_TRIVIAL(info)<<tree;
		//exit(1);
	double startInt[par.GetNDouble()], optiInt[par.GetNDouble()];
	for (unsigned int i = 0; i < par.GetNDouble(); i++) {
		std::shared_ptr<DoubleParameter> tmp = par.GetDoubleParameter(i);
		optiInt[i] = tmp->GetValue();
		//if (/*i < 2 ||*/ i > 10 /*|| i%4==2 || i%4==3 */) { //omega's and f0 fixed
			//if(i<2 || i>3 || i%2==1){ //omega's and f0 fixed
		//	tmp->FixParameter(true);
		//} else {
		//	tmp->FixParameter(true); if(i==5) tmp->FixParameter(false);
		//	BOOST_LOG_TRIVIAL(debug)<< *tmp;
			//tmp->SetValue(tmp->GetValue()+0.5);			///((i+1)));
		//	tmp->SetError(tmp->GetValue());
		//	if (!tmp->GetValue())
		//		tmp->SetError(1.);
		//}
		startInt[i] = tmp->GetValue();
	}

	BOOST_LOG_TRIVIAL(info)<< "LH with following parameters: " << esti->controlParameter(par);
	for (unsigned int i = 0; i < par.GetNDouble(); i++) {
		BOOST_LOG_TRIVIAL(info)<< par.GetDoubleParameter(i)->GetName() << " = " << par.GetDoubleParameter(i)->GetValue();
	}

	// std::cout << "Fixing 5 of 7 parameters " << std::endl;
	//for(unsigned int i=2; i<par.GetNDouble(); i++){
	//    par.GetDoubleParameter(i).FixParameter(true);
	//  }

	BOOST_LOG_TRIVIAL(info)<< "Start Fit";
	std::shared_ptr<FitResult> genResult = opti->exec(par);
	BOOST_LOG_TRIVIAL(info)<< "Final LH = " << genResult->getResult();

	BOOST_LOG_TRIVIAL(info)<< "Optimierte intensitäten: " << esti->controlParameter(par);
	for (unsigned int i = 0; i < par.GetNDouble(); i++) {
		BOOST_LOG_TRIVIAL(info)<< par.GetDoubleParameter(i)->GetName() << " = " << par.GetDoubleParameter(i)->GetValue()
开发者ID:,项目名称:,代码行数:67,代码来源:


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