本文整理汇总了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;
}