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


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

本文整理汇总了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];
				}
//.........这里部分代码省略.........
开发者ID:busarobi,项目名称:MDDAG,代码行数:101,代码来源:clinearfafeaturecalculator.cpp


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