14.22 GeneratePreferenceArrayForTeam
This function generates a vector of type vector<vector<pair<double,int > > >
which stores the preferences of each player to each point so that it can be used the stable marriage function to optimally assign players to ImportantPositions
. For each of our teammates we get there position and with that determine their particular preference for each point by using GeneratePreferenceArrayForAnAgent
.
vector<vector<pair<double,int >>> NaoBehavior::GeneratePreferenceArrayForTeam(int _playerNumber, vector<VecPosition> ImportantPositions){
vector<vector<pair<double,int > > > PreferenceToPointArray;
for(int i = WO_TEAMMATE1; i<WO_TEAMMATE1+NUM_AGENTS;i++){ //OUR PLAYERS
WorldObject* teammate = worldModel->getWorldObject(i);
VecPosition temp;
if(i == _playerNumber){
temp = worldModel->getMyPosition();
}
else{
temp = teammate->pos;
}
temp.setZ(0);
PreferenceToPointArray.push_back(GeneratePreferenceArrayForAnAgent(ImportantPositions, temp));
}
return PreferenceToPointArray;
}