src/rocksample.cpp
/*** Added by JCS

		Step function with new reward distribution using PGS action biases
***/
Added by JCS
Step function with new reward distribution using PGS action biases
Added by JCS Step function with new reward distribution using PGS action biases
bool ROCKSAMPLE::StepPGS(STATE& state, int action,
    int& observation, double& reward) const
{
	double scale = 10.0;
	double r = 0.0;
	double r2 = 0.0;
	STATE* oldstate = Copy(state);	
	bool result = StepNormal(state, action, observation, reward);
	if(reward != -100){
		r2 = PGS(*oldstate);
		r = PGS_RO(*oldstate, state, action, r2);
		reward += scale*r - scale*r2;
	}
	FreeState(oldstate);
	return result;
}
bool ROCKSAMPLE :: StepPGS ( STATE & state , int action , int & observation , double & reward ) const { double scale = 10.0 ; double r = 0.0 ; double r2 = 0.0 ; STATE * oldstate = Copy ( state ) ; bool result = StepNormal ( state , action , observation , reward ) ; if ( reward != -100 ) { r2 = PGS ( * oldstate ) ; r = PGS_RO ( * oldstate , state , action , r2 ) ; reward += scale * r - scale * r2 ; } FreeState ( oldstate ) ; return result ; }
Added by JCS
Step function with new reward distribution using PGS action biases
Added by JCS Step function with new reward distribution using PGS action biases
// Potential-based reward bonus //Not terminal or out of bounds //cout << "reward = " << reward << ", r1 = " << r << ", r2 = " << r2 << endl;