本文整理汇总了C++中CState::getNormalizedContinuousState方法的典型用法代码示例。如果您正苦于以下问题:C++ CState::getNormalizedContinuousState方法的具体用法?C++ CState::getNormalizedContinuousState怎么用?C++ CState::getNormalizedContinuousState使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CState
的用法示例。
在下文中一共展示了CState::getNormalizedContinuousState方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: getModifiedState
void CLinearMultiFeatureCalculator::getModifiedState(CStateCollection *stateCol, CState *featState)
{
assert(equals(featState->getStateProperties()));
memset(actualPartition, 0, sizeof(unsigned int) * numDim);
unsigned int j = 0;
CState *state = stateCol->getState(originalState);
/* printf("State : ");
for (int i = 0; i < 4; i ++)
{
printf("%f ", state->getNormalizedContinuousState(i));
}
printf("\n");*/
getSingleActiveFeature(state, singleStateFeatures);
unsigned int i;
int feature = 0;
//offset to add to the actual feature
int featureAdd = 0;
getFeaturePosition(getActiveFeature(state), activePosition);
// printf("[");
// for (i = 0; i < numDim; i ++)
// {
// printf("%f ", state->getNormalizedContinuousState(dimensions[i]));
// }
// printf("]");
// activePosition->saveASCII(stdout);
// printf("\n");
for (i = 0; i < numDim; i ++)
{
int singleFeatureOffset = 0;
if (areaSize[i] % 2 == 0)
{
//double x1 = state->getNormalizedContinuousState(dimensions[i]);
//double x2 = activePosition->element(i);
if (state->getNormalizedContinuousState(dimensions[i]) < activePosition->element(i))
{
singleFeatureOffset ++;
}
singleFeatureOffset += (areaSize[i] - 1) / 2;
}
else
{
singleFeatureOffset += areaSize[i] / 2;
}
singleStateFeatures[i] -= singleFeatureOffset;
activePosition->element(i) = activePosition->element(i) - singleFeatureOffset * 1.0 / partitions[i] * gridScale[i];
}
unsigned int featureIndex = 0;
for (i = 0; i < areaNumPart; i++)
{
feature = 0;
/*for (j = 0; j < numDim; j++)
{
int dist = (actualPartition[j] - areaSize[j]);
featurePosition->setElement(j, (activePosition->element(j) + 1.0 / partitions[j] * dist));
featureAdd = (singleStateFeatures[j] + (actualPartition[j] - areaSize[j]));
if (state->getStateProperties()->getPeriodicity(j))
{
featurePosition->setElement(j, featurePosition->element(j) - floor(featurePosition->element(j)));
featureAdd = featureAdd - (int) floor((double) featureAdd / (double) partitions[j]) * partitions[j];
}
feature = feature + featureAdd * dimensionSize[j];
} */
/*for (j = 0; j < numDim; j++)
{
int dist = (actualPartition[j] - 1);
featurePosition->setElement(j, (activePosition->element(j) + 1.0 / partitions[j] * dist));
featureAdd = (singleStateFeatures[j] + (actualPartition[j] - 1));
if (state->getStateProperties()->getPeriodicity(j))
{
featurePosition->setElement(j, featurePosition->element(j) - floor(featurePosition->element(j)));
featureAdd = featureAdd - (int) floor((double) featureAdd / (double) partitions[j]) * partitions[j];
}
feature = feature + featureAdd * dimensionSize[j];
}
for (i = 0; i < numDim; i ++)
{
int singleFeatureOffset = 0;
if (areaSize[i] % 2 == 0)
{
if (state->getContinuousState(dimensions[i]) < activePosition->element(i))
{
singleFeatureOffset ++;
}
singleFeatureOffset += (singleFeatureOffset - 1) / 2;
}
else
{
//.........这里部分代码省略.........