Exemple #1
0
void AStar::FoundNode(Node *current_point, Node *new_point)
{
	unsigned int g_value = CalculG(current_point, new_point->pos);

	if (g_value < new_point->g)
	{
		new_point->g = g_value;
		new_point->parent = current_point;
		PercolateUp(GetIndex(new_point));
	}
}
Exemple #2
0
void AStar::NotFoundNode(Node *current_point, Node *new_point, const Point &end)
{
	new_point->parent = current_point;
	new_point->g = CalculG(current_point, new_point->pos);
	new_point->h = CalculH(new_point->pos, end);

	Node *&node_ptr = maps_index_[new_point->pos.row * num_row_ + new_point->pos.col];
	assert(node_ptr == nullptr);
	node_ptr = new_point;
	node_ptr->state = IN_OPENLIST;

	open_list_.push_back(new_point);
	std::push_heap(open_list_.begin(), open_list_.end(), CompHeap);
}
Exemple #3
0
void CalculTau(double **Pi,double **F, int nbClass,int nbInd,double **G,double **Tau)  
{
     //Déclaration et initialisation des variables locales;   
     int x,y;
     double NormF = 0;
     
     //Calcul de la matrice G nécessaire au calcul des Tau;
     CalculG(Pi,F,nbClass,nbInd,G);
     
     //Double boucle permettant de calculer Tau à tout les instants t(sauf le dernier) et pour toutes les classes;     
     for(x=(nbInd-2); x>=0; x--){
                     for(y=0; y<nbClass; y++){                                   
                             Tau[x][y] =  F[x][y]*CalculSommeTau(Pi,Tau,G,0,nbClass,y,x+1);
                              
                    }         
     }
}