Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- for (uint16_t i = 0; i < quantityOfRegions; ++i) // Percorre todas as matrizes de restrições para verificar em qual região os estados estão localizados.
- {
- // std::cout << "A matriz de restricoes: \n"<< this->Restrictions[i] << std::endl;
- // std::cout << "A matriz de pontos: \n"<< point << std::endl;
- // LinAlg::Matrix<Type> H = (this->Restrictions[i]); // se todos os elementos desse vetor forem menores que uma tolerância (podem ser negativos), os estados pertencerão ao conjunto de restrições. Isso se aplica a linha 23 também (função any)
- // std::cout << "Resultado de H: \n"<< point << std::endl;
- LinAlg::Matrix<Type> H(this->Restrictions[i].getNumberOfRows(),1);
- for(unsigned k = 0; k < this->Restrictions[i].getNumberOfRows(); k++)
- for(unsigned col = 0; col < point.getNumberOfColumns(); col++)
- {
- Type temp = 0.0;
- for(unsigned j = 0; j < this->Restrictions[i].getNumberOfColumns(); j++)
- temp += this->Restrictions[i](k,j) * point(j,col);
- H(k,col) = temp;
- }
- // if(i == 0 ){
- // std::cout << "H = "<< H << std::endl << "Point = " << point << std::endl;
- // std::cout << "A matriz de restricoes: \n"<< this->Restrictions[i] << std::endl;
- // }
- if(!any(H))//Verifica se algum estado esta fora das restrições.
- {
- this->inWitchRegion = i;//sinaliza qual a região a qual os estados pertencem
- // std::cout << "Controle na regiao: "<< i+1 << std::endl;
- return true; // Sinaliza que encontrou uma região.
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement