int setBestAlphasForBeliefV( double *b, AlphaList **projection, double epsilon ) { /* Loops through each action and constructs the alpha vector for the point 'b' for each action. It sets the global variable gCurAlphaVector which can then be used for other purposes (e.g., adding a vector to the list, finding the best action for the belief point, etc.) Returns TRUE if all vectors were created successfully and FALSE if any one of them had a problem. */ int a; int result = TRUE; Assert( b != NULL && projection != NULL, "Bad (NULL) parameter(s)." ); for( a = 0; a < gNumActions; a++ ) result = result && bestAlphaForBeliefQ( gCurAlphaVector[a], b, projection[a], epsilon ); // PBVI: printf( "Belief: " ); showAlpha( b ); printf( "Alphas:\n" ); for( a = 0; a < gNumActions; a++ ) { printf( "a=%d : ", a ); showAlpha( gCurAlphaVector[a]->alpha ); } return ( result ); } /* setBestAlphasForBeliefV */
int setBestAlphaForBeliefQ( double *b, AlphaList *projection, double epsilon ) { /* Just uses the bestAlphaForBeliefQ() routine, but uses the global temporary variable gCurAlphaVector[0] to hold it. */ /* Note that we are using gCurAlphaVector[0] just for the storage and that this does not necessarily mean we are computing for action '0'. */ return ( bestAlphaForBeliefQ( gCurAlphaVector[0], b, projection, epsilon )); } /* setBestAlphaForBeliefQ */