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


C++ CState::copy方法代码示例

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


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

示例1: run

void RLSimionApp::run()
{
	CLogger::logMessage(MessageType::Info, "Simulation starting");
	CSimionApp* pApp = CSimionApp::get();

	//create state and action vectors
	CState *s = pApp->pWorld->getDynamicModel()->getStateDescriptor().getInstance();
	CState *s_p = pApp->pWorld->getDynamicModel()->getStateDescriptor().getInstance();
	CAction *a = pApp->pWorld->getDynamicModel()->getActionDescriptor().getInstance();

	//load stuff we don't want to be loaded in the constructors for faster construction
	pApp->pSimGod->deferredLoad();
	CLogger::logMessage(MessageType::Info, "Deferred load step finished. Simulation starts");

	double r = 0.0;

	//episodes
	for (pApp->pExperiment->nextEpisode(); pApp->pExperiment->isValidEpisode(); pApp->pExperiment->nextEpisode())
	{
		pApp->pWorld->reset(s);

		//steps per episode
		for (pApp->pExperiment->nextStep(); pApp->pExperiment->isValidStep(); pApp->pExperiment->nextStep())
		{
			//a= pi(s)
			pApp->pSimGod->selectAction(s, a);

			//s_p= f(s,a); r= R(s');
			r = pApp->pWorld->executeAction(s, a, s_p);

			//update god's policy and value estimation
			pApp->pSimGod->update(s, a, s_p, r);

			//log tuple <s,a,s',r>
			pApp->pExperiment->timestep(s, a, s_p, pApp->pWorld->getRewardVector());
			//we need the complete reward vector for logging

			//s= s'
			s->copy(s_p);
		}
	}
	CLogger::logMessage(MessageType::Info, "Simulation finished");

	delete s;
	delete s_p;
	delete a;
}
开发者ID:borjafdezgauna,项目名称:RLSimion,代码行数:47,代码来源:app-rlsimion.cpp


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