src/drone.cpp
/*
 * Legal actions following PGS policy: avoid actions that do not reduce uncertainty
*/
Legal actions following PGS policy: avoid actions that do not reduce uncertainty
Legal actions following PGS policy : avoid actions that do not reduce uncertainty
void DRONE::PGSLegal(const STATE& state, const HISTORY& history,
                      vector<int>& legal, const STATUS& status) const
{
    const DRONE_STATE& droneState =
            safe_cast<const DRONE_STATE&>(state);
    if (droneState.AgentPos.Y + 1 < Size)
        legal.push_back(COORD::E_NORTH);
    if(droneState.AgentPos.X + 1 < Size)
        legal.push_back(COORD::E_EAST);
    if (droneState.AgentPos.Y - 1 >= 0)
        legal.push_back(COORD::E_SOUTH);
    if (droneState.AgentPos.X - 1 >= 0)
        legal.push_back(COORD::E_WEST);
    legal.push_back(A_WAIT);
    legal.push_back(A_LEAVE);
    for(int i=0; i<NumCells; i++) {
        legal.push_back(E_CHECK + i);
    }
    for(int f=0; f<NumFeatures; f++) {
        if(droneState.Features[f].ObservedPosition == droneState.AgentPos &&
            droneState.Features[f].active) {
                legal.push_back(E_PHOTO + f);
                    legal.push_back(E_IDENTIFY + f);
        }
    }
}
void DRONE :: PGSLegal ( const STATE & state , const HISTORY & history , vector < int > & legal , const STATUS & status ) const { const DRONE_STATE & droneState = safe_cast < const DRONE_STATE & > ( state ) ; if ( droneState . AgentPos . Y + 1 < Size ) legal . push_back ( COORD :: E_NORTH ) ; if ( droneState . AgentPos . X + 1 < Size ) legal . push_back ( COORD :: E_EAST ) ; if ( droneState . AgentPos . Y - 1 >= 0 ) legal . push_back ( COORD :: E_SOUTH ) ; if ( droneState . AgentPos . X - 1 >= 0 ) legal . push_back ( COORD :: E_WEST ) ; legal . push_back ( A_WAIT ) ; legal . push_back ( A_LEAVE ) ; for ( int i = 0 ; i < NumCells ; i ++ ) { legal . push_back ( E_CHECK + i ) ; } for ( int f = 0 ; f < NumFeatures ; f ++ ) { if ( droneState . Features [ f ] . ObservedPosition == droneState . AgentPos && droneState . Features [ f ] . active ) { legal . push_back ( E_PHOTO + f ) ; legal . push_back ( E_IDENTIFY + f ) ; } } }
Legal actions following PGS policy: avoid actions that do not reduce uncertainty
Legal actions following PGS policy : avoid actions that do not reduce uncertainty
//GenerateLegal(state, history, legal, status); //Move is always possible //Use uncertainty reducing tips to: //1. Take pictures if a cell might contain the target //2. Identify a feature if it is not well known and its location is likely //        cout << "RO: Identify f " << people[f] << " in room " << Grid.Index(droneState.AgentPos) << endl; //droneState.Features[f].ProbPosition >= 0.5 && //                if(!droneState.Features[f].AssumedTarget)