本文整理汇总了C++中CState::setContinuousState方法的典型用法代码示例。如果您正苦于以下问题:C++ CState::setContinuousState方法的具体用法?C++ CState::setContinuousState怎么用?C++ CState::setContinuousState使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CState
的用法示例。
在下文中一共展示了CState::setContinuousState方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: getInputDerivation
void CCAGradientPolicyNumericInputDerivationCalculator::getInputDerivation(CStateCollection *inputStateCol, Matrix *targetVector)
{
CStateProperties *modelState = policy->getStateProperties();
CState *inputState = stateBuffer->getState(modelState);
inputState->setState(inputStateCol->getState(modelState));
double stepSize = getParameter("NumericInputDerivationStepSize");
DebugPrint('p', "Calculating Numeric Policy Input Derivation\n");;
for (unsigned int col = 0; col < modelState->getNumContinuousStates(); col++)
{
double stepSize_i = (modelState->getMaxValue(col) - modelState->getMinValue(col)) * stepSize;
inputState->setContinuousState(col, inputState->getContinuousState(col) + stepSize_i);
stateBuffer->newModelState();
policy->getNextContinuousAction(stateBuffer, contDataPlus);
if (DebugIsEnabled('p'))
{
DebugPrint('p', "State : ");
inputState->saveASCII(DebugGetFileHandle('p'));
DebugPrint('p', "Action : ");
contDataPlus->saveASCII(DebugGetFileHandle('p'));
}
inputState->setContinuousState(col, inputState->getContinuousState(col) - 2 * stepSize_i);
stateBuffer->newModelState();
policy->getNextContinuousAction(stateBuffer, contDataMinus);
if (DebugIsEnabled('p'))
{
DebugPrint('p', "State : ");
inputState->saveASCII(DebugGetFileHandle('p'));
DebugPrint('p', "Action : ");
contDataMinus->saveASCII(DebugGetFileHandle('p'));
}
inputState->setContinuousState(col, inputState->getContinuousState(col) + stepSize_i);
for (int row = 0; row < policy->getNumOutputs(); row ++)
{
targetVector->element(row, col) = (contDataPlus->getActionValue(row) - contDataMinus->getActionValue(row)) / (2 * stepSize_i);
}
}
}
示例2: getGradientPre
void CContinuousActionGradientPolicy::getGradientPre(ColumnVector *input, ColumnVector *outputErrors, CFeatureList *gradientFeatures)
{
CFeatureList *featureList = new CFeatureList();
CState *state = new CState(modelState);
for (int i = 0; i < getNumInputs(); i ++)
{
state->setContinuousState(i, input->element(i));
}
for (int i = 0; i < getNumOutputs(); i++)
{
getGradient(state, i, featureList);
gradientFeatures->add(featureList, outputErrors->element(i));
}
delete featureList;
delete state;
}
示例3: getFunctionValuePre
void CContinuousActionGradientPolicy::getFunctionValuePre(ColumnVector *input, ColumnVector *output)
{
CState *state = new CState(modelState);
CContinuousActionData *data = dynamic_cast<CContinuousActionData *>(contAction->getNewActionData());
for (int i = 0; i < getNumInputs(); i ++)
{
state->setContinuousState(i, input->element(i));
}
getNextContinuousAction(state, data);
for (int i = 0; i < getNumOutputs(); i ++)
{
output->element(i) = state->getContinuousState(i);
}
delete state;
delete data;
}