本文整理汇总了C++中CState::getSingleStateDifference方法的典型用法代码示例。如果您正苦于以下问题:C++ CState::getSingleStateDifference方法的具体用法?C++ CState::getSingleStateDifference怎么用?C++ CState::getSingleStateDifference使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CState
的用法示例。
在下文中一共展示了CState::getSingleStateDifference方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: getModifiedState
void CSingleStateFeatureCalculator::getModifiedState(CStateCollection *stateCol, CState *featState)
{
CState *state = stateCol->getState(originalState);
CStateProperties *properties = state->getStateProperties();
double contState = state->getContinuousState(dimension);
double width = properties->getMaxValue(dimension) - properties->getMinValue(dimension);
if (contState < partitions[0] && properties->getPeriodicity(dimension))
{
contState += width;
}
unsigned int activeFeature = 0;
unsigned int featureNum = 0, realfeatureNum = 0;
int featureIndex = 0;
double part = partitions[activeFeature];
while (activeFeature < numFeatures && part < contState)
{
activeFeature++;
if (activeFeature < numFeatures)
{
part = partitions[activeFeature];
}
if (part < partitions[0])
{
assert(properties->getPeriodicity(dimension));
part += width;
}
}
if (activeFeature == numFeatures && !properties->getPeriodicity(dimension))
{
featureNum ++;
}
DebugPrint('l', "Single State Features: [");
for (; realfeatureNum < this->numActiveFeatures; realfeatureNum++, featureNum ++)
{
if (featureNum % 2 == 0)
{
featureIndex = activeFeature + featureNum / 2;
}
else
{
featureIndex = activeFeature - (featureNum / 2 + 1);
}
if (state->getStateProperties()->getPeriodicity(dimension))
{
featureIndex = featureIndex % numFeatures;
}
if (featureIndex >= 0 && featureIndex < (signed int) numFeatures)
{
featState->setDiscreteState(realfeatureNum, featureIndex);
double stateDiff = state->getSingleStateDifference(dimension, partitions[featureIndex]);
double diffNextPart = 1.0;
if (!state->getStateProperties()->getPeriodicity(dimension))
{
if (featureIndex == 0 && stateDiff <= 0)
{
stateDiff = 0;
}
else
{
if (featureIndex == (signed int) (numFeatures - 1) && stateDiff > 0)
{
stateDiff = 0;
}
else
{
if (stateDiff <= 0)
{
diffNextPart = partitions[featureIndex] - partitions[featureIndex - 1];
}
else
{
diffNextPart = partitions[featureIndex + 1] - partitions[featureIndex];
}
}
}
}
else
{
if (stateDiff <= 0)
{
diffNextPart = partitions[featureIndex] - partitions[(numPartitions + featureIndex - 1) % numPartitions];
}
//.........这里部分代码省略.........