Exemplo n.º 1
0
bool StateVectorLimiter<StateType>::operator()(StateVector<StateType> &_stateVec) const
{
	if((_stateVec.size() != mUpper.size()) |(_stateVec.size() != mLower.size()))
	{
		std::cout << "incompatible dimensions. can't evaluate state limits\n";
		return false;
	}
}
Exemplo n.º 2
0
bool StateVectorLimiter<StateType>::testState(const StateVector<StateType> &_stateVec) const
{
	bool result = true;

	if((_stateVec.size() != mUpper.size()) |(_stateVec.size() != mLower.size()))
	{
		std::cout << "incompatible dimensions. can't evaluate state limits\n";
		return false;
	}

	for(unsigned i=0; i < _stateVec.size(); i++)
	{
		bool valid = ((mLower(i) <= _stateVec[i]) & (mUpper(i) >= _stateVec[i]));
		result &= valid;
		std::string msg = valid ? "ok" : "error";
		std::cout << i << ". value=" << _stateVec[i] << "[" << mLower(i) << " ; " << mUpper(i)
				  << msg << "\n";

	}
	return result;
}