src/cellar.cpp
/* PGS Rollout policy
 * Simplified PGS point count
 */
PGS Rollout policy
Simplified PGS point count
PGS Rollout policy Simplified PGS point count
double CELLAR::PGS_RO(STATE& oldstate, STATE& state, int action, double oldpgs) const
{
	double points = 0.0;
	double oldpoints = 0.0;
	CELLAR_STATE& cellarstate = safe_cast<CELLAR_STATE&>(state);
	CELLAR_STATE& oldcellarstate = safe_cast<CELLAR_STATE&>(oldstate);
	int bottle = -1;
	if(action >= E_SAMPLE && action < E_BOTTLECHECK){
		bottle = Grid(cellarstate.AgentPos);
		if (cellarstate.Bottles[bottle].Valuable){
			if(cellarstate.Bottles[bottle].Count)
				points++; 
		}
		else points--;
	}
	else if (action >= E_BOTTLECHECK && action < E_OBJCHECK){ 
		bottle = action - E_BOTTLECHECK;
		double p = cellarstate.Bottles[bottle].ProbValuable;
		double binaryEntropy = -1*p*log2(p) - (1-p)*log2(1-p);
		if(binaryEntropy > CELLAR::BIN_ENTROPY_LIMIT) points--;
		p = oldcellarstate.Bottles[bottle].ProbValuable;
		double oldBinaryEntropy = -1*p*log2(p) - (1-p)*log2(1-p);
		if(oldBinaryEntropy > CELLAR::BIN_ENTROPY_LIMIT) oldpoints--;
	}
	double result = oldpgs - oldpoints + points;
	return result;
}
double CELLAR :: PGS_RO ( STATE & oldstate , STATE & state , int action , double oldpgs ) const { double points = 0.0 ; double oldpoints = 0.0 ; CELLAR_STATE & cellarstate = safe_cast < CELLAR_STATE & > ( state ) ; CELLAR_STATE & oldcellarstate = safe_cast < CELLAR_STATE & > ( oldstate ) ; int bottle = -1 ; if ( action >= E_SAMPLE && action < E_BOTTLECHECK ) { bottle = Grid ( cellarstate . AgentPos ) ; if ( cellarstate . Bottles [ bottle ] . Valuable ) { if ( cellarstate . Bottles [ bottle ] . Count ) points ++ ; } else points -- ; } else if ( action >= E_BOTTLECHECK && action < E_OBJCHECK ) { bottle = action - E_BOTTLECHECK ; double p = cellarstate . Bottles [ bottle ] . ProbValuable ; double binaryEntropy = -1 * p * log2 ( p ) - ( 1 - p ) * log2 ( 1 - p ) ; if ( binaryEntropy > CELLAR :: BIN_ENTROPY_LIMIT ) points -- ; p = oldcellarstate . Bottles [ bottle ] . ProbValuable ; double oldBinaryEntropy = -1 * p * log2 ( p ) - ( 1 - p ) * log2 ( 1 - p ) ; if ( oldBinaryEntropy > CELLAR :: BIN_ENTROPY_LIMIT ) oldpoints -- ; } double result = oldpgs - oldpoints + points ; return result ; }
PGS Rollout policy
 Simplified PGS point count
PGS Rollout policy Simplified PGS point count
//1. Cast to cellarstate //+1 for sampling rocks w/ good observations //Bottle check //else points -= 0.5; //Update difference for current bottle