src/drone.cpp
// Drone domain transformations -- change a random target
Drone domain transformations -- change a random target
Drone domain transformations -- change a random target
bool DRONE::LocalMove(STATE& state, const HISTORY& history,
                       int stepObs, const STATUS& status) const
{
    DRONE_STATE& droneState = safe_cast<DRONE_STATE&>(state);
    int feature;
    feature = Random(NumFeatures);
    droneState.Features[feature].Target = !(droneState.Features[feature].Target);
    if( (droneState.Features[feature].ProbTarget == 0 && droneState.Features[feature].Target) ||
        (droneState.Features[feature].ProbTarget == 1 && !droneState.Features[feature].Target))
        return false;
    MoveFeature(droneState, feature);
    int action = history.Back().Action;
    if(action >= E_CHECK && action < E_IDENTIFY){
        int cell = action - E_CHECK;
        int realObs = history.Back().Observation;
        int newObs = Observe(droneState, cell);
        if(newObs != realObs)
            return false;
    }
    if (action >= E_IDENTIFY && action < E_PHOTO) {
        feature = action - E_IDENTIFY;
        int realObs = history.Back().Observation;
        int newObs = Identify(droneState, feature);
        if (newObs != realObs)
            return false;
    }
    if (action >= E_PHOTO) {
        feature = action - E_PHOTO;
        int realObs = history.Back().Observation; 
        int newObs = droneState.Features[feature].Target ? O_TARGET : O_NOTARGET;
        if (newObs != realObs)
            return false;
    }
    return true;
}
bool DRONE :: LocalMove ( STATE & state , const HISTORY & history , int stepObs , const STATUS & status ) const { DRONE_STATE & droneState = safe_cast < DRONE_STATE & > ( state ) ; int feature ; feature = Random ( NumFeatures ) ; droneState . Features [ feature ] . Target = ! ( droneState . Features [ feature ] . Target ) ; if ( ( droneState . Features [ feature ] . ProbTarget == 0 && droneState . Features [ feature ] . Target ) || ( droneState . Features [ feature ] . ProbTarget == 1 && ! droneState . Features [ feature ] . Target ) ) return false ; MoveFeature ( droneState , feature ) ; int action = history . Back ( ) . Action ; if ( action >= E_CHECK && action < E_IDENTIFY ) { int cell = action - E_CHECK ; int realObs = history . Back ( ) . Observation ; int newObs = Observe ( droneState , cell ) ; if ( newObs != realObs ) return false ; } if ( action >= E_IDENTIFY && action < E_PHOTO ) { feature = action - E_IDENTIFY ; int realObs = history . Back ( ) . Observation ; int newObs = Identify ( droneState , feature ) ; if ( newObs != realObs ) return false ; } if ( action >= E_PHOTO ) { feature = action - E_PHOTO ; int realObs = history . Back ( ) . Observation ; int newObs = droneState . Features [ feature ] . Target ? O_TARGET : O_NOTARGET ; if ( newObs != realObs ) return false ; } return true ; }
Drone domain transformations -- change a random target
Drone domain transformations -- change a random target
//Modify feature //Change its type //Validate all previous photos and ID's: //Changing target status of known creatures is not a valid belief //And move if possible //cout << "Local move: " << endl; //DisplayState(droneState, cout); //Validate //CHECK: validate location observations //Check the same cell and see if observations match //IDENTIFY: validate id observations //cout << "Local move with action: "; //DisplayAction(action, cout); //ID the same feature and see if observations match //PHOTO: validate photo observations.  If a photo revealed a target (or not target) its type cannot be changed //Use only if photos reveal target status 100% //Target, No Target, NONE // Condition new state on real observation