src/drone.cpp
/* Fast PGS for Rollout policy
 * Simplified PGS point count by using only the specific action changes
 */
Fast PGS for Rollout policy
Simplified PGS point count by using only the specific action changes
Fast PGS for Rollout policy Simplified PGS point count by using only the specific action changes
double DRONE::PGS_RO(STATE& oldstate, STATE& state, int action, double oldpgs) const
{
    double points = 0.0;
    double oldpoints = 0.0;
    DRONE_STATE& droneState = safe_cast<DRONE_STATE&>(state);
    DRONE_STATE& oldDroneState = safe_cast<DRONE_STATE&>(oldstate);
    int creature;
    int cell;
    if(action >= E_PHOTO){
        creature = action - E_PHOTO;
        if (droneState.Features[creature].Position == droneState.AgentPos){
            if(droneState.Features[creature].Target){
                if(droneState.Features[creature].AssumedTarget &&
                    !oldDroneState.Features[creature].numPhotos)
                points++; 
            }
            else points--;
        }
    }
    else if (action >= E_IDENTIFY){
        creature = action - E_IDENTIFY;
        double p = droneState.Features[creature].ProbTarget;
        if(!BinEntropyCheck(p)) points--;
        p = oldDroneState.Features[creature].ProbTarget;
        if(!BinEntropyCheck(p)) oldpoints--;
    }
    double result = oldpgs - oldpoints + points;
    return result;
}
double DRONE :: PGS_RO ( STATE & oldstate , STATE & state , int action , double oldpgs ) const { double points = 0.0 ; double oldpoints = 0.0 ; DRONE_STATE & droneState = safe_cast < DRONE_STATE & > ( state ) ; DRONE_STATE & oldDroneState = safe_cast < DRONE_STATE & > ( oldstate ) ; int creature ; int cell ; if ( action >= E_PHOTO ) { creature = action - E_PHOTO ; if ( droneState . Features [ creature ] . Position == droneState . AgentPos ) { if ( droneState . Features [ creature ] . Target ) { if ( droneState . Features [ creature ] . AssumedTarget && ! oldDroneState . Features [ creature ] . numPhotos ) points ++ ; } else points -- ; } } else if ( action >= E_IDENTIFY ) { creature = action - E_IDENTIFY ; double p = droneState . Features [ creature ] . ProbTarget ; if ( ! BinEntropyCheck ( p ) ) points -- ; p = oldDroneState . Features [ creature ] . ProbTarget ; if ( ! BinEntropyCheck ( p ) ) oldpoints -- ; } double result = oldpgs - oldpoints + points ; return result ; }
Fast PGS for Rollout policy
 Simplified PGS point count by using only the specific action changes
Fast PGS for Rollout policy Simplified PGS point count by using only the specific action changes
//1. Cast to cellarstate //1. Photos //Add one point for the first (correct) picture //2. Identify //3. Location of creatures /*else if (action >= E_CHECK){
        //Award point if check revealed something
        cell = action- E_CHECK;
        creature = FeatureInCell(droneState, cell);
        for(int i=0; i < NumCreatures; i++) {
            if (droneState.Features[i].ObservedPosition == Grid.Coord(cell))
                points--;
            if (oldDroneState.Features[i].ObservedPosition == COORD::Null)
                oldpoints--;
        }
    }*/ //Update difference for current action