src/mcts.cpp
/*** Activate/deactivate objects in all beliefs ***/
//TODO: Determine activation policy
Activate/deactivate objects in all beliefs
TODO: Determine activation policy
Activate / deactivate objects in all beliefs TODO : Determine activation policy
void MCTS::beliefRevision(BELIEF_STATE& beliefs){	
	std::vector<double> fvalues;
	ftable.getAllFValues(fvalues);
	float FTABLE_INACTIVE = ftable.getACTIVATION_THRESHOLD();
	if(Params.Verbose >= 1) {
        for (int i = 0; i < fvalues.size() - 1; i++) {
            cout << fvalues[i] << ", ";
        }
        if (fvalues.size()) {
            cout << fvalues[fvalues.size() - 1] << "\t";
        }
        cout << endl;
    }
    bool allOff = true;
	for(int i=0; i < fvalues.size(); i++) {
	    allOff = allOff && (fvalues[i] < FTABLE_INACTIVE);
        if (fvalues[i] < FTABLE_INACTIVE){
            beliefs.activateFeature(i, false);
            ftable.toggleActionsForFeature(i, false);
            if(Params.Verbose >= 1) cout << "Feature " << i << " is now OFF" << endl;
        }
        else{
            beliefs.activateFeature(i, true);
            ftable.toggleActionsForFeature(i, true);
            if(Params.Verbose >= 1) cout << "Feature " << i << " is now ON" << endl;
        }
    }
    if(allOff){
        int f = Random(fvalues.size());
        beliefs.activateFeature(f, true);
        ftable.toggleActionsForFeature(f, true);
        if(Params.Verbose >= 1) cout << "Feature " << f << " is back ON" << endl;
    }
	ftable.transition(); 
	fvalues.clear();
}
void MCTS :: beliefRevision ( BELIEF_STATE & beliefs ) { std :: vector < double > fvalues ; ftable . getAllFValues ( fvalues ) ; float FTABLE_INACTIVE = ftable . getACTIVATION_THRESHOLD ( ) ; if ( Params . Verbose >= 1 ) { for ( int i = 0 ; i < fvalues . size ( ) - 1 ; i ++ ) { cout << fvalues [ i ] << " " ; } if ( fvalues . size ( ) ) { cout << fvalues [ fvalues . size ( ) - 1 ] << " \t " ; } cout << endl ; } bool allOff = true ; for ( int i = 0 ; i < fvalues . size ( ) ; i ++ ) { allOff = allOff && ( fvalues [ i ] < FTABLE_INACTIVE ) ; if ( fvalues [ i ] < FTABLE_INACTIVE ) { beliefs . activateFeature ( i , false ) ; ftable . toggleActionsForFeature ( i , false ) ; if ( Params . Verbose >= 1 ) cout << " " << i << " " << endl ; } else { beliefs . activateFeature ( i , true ) ; ftable . toggleActionsForFeature ( i , true ) ; if ( Params . Verbose >= 1 ) cout << " " << i << " " << endl ; } } if ( allOff ) { int f = Random ( fvalues . size ( ) ) ; beliefs . activateFeature ( f , true ) ; ftable . toggleActionsForFeature ( f , true ) ; if ( Params . Verbose >= 1 ) cout << " " << f << " " << endl ; } ftable . transition ( ) ; fvalues . clear ( ) ; }
Activate/deactivate objects in all beliefs
TODO: Determine activation policy
Activate / deactivate objects in all beliefs TODO : Determine activation policy
//    cout << "Useful?" << hvalues[i] << endl; //    cout << "Useful?" << hvalues[hvalues.size()] << endl; ///If all features are off, activate one random feature (to get address estimation errors) //Reset count and set prior to fvalue