Added rho as a training parameter for soft actor critic

This commit is contained in:
nishantkr18
2020-08-08 11:50:51 +05:30
parent 3fdf66d24f
commit 902a7f2a88
2 changed files with 18 additions and 4 deletions
@@ -265,7 +265,7 @@ void SAC<
// Update target network
if (totalSteps % config.TargetNetworkSyncInterval() == 0)
SoftUpdate(0.005);
SoftUpdate(config.Rho());
}
template <
@@ -33,7 +33,8 @@ class TrainingConfig
isCategorical(false),
atomSize(51),
vMin(0),
vMax(200)
vMax(200),
rho(0.005)
{ /* Nothing to do here. */ }
TrainingConfig(
@@ -50,7 +51,8 @@ class TrainingConfig
bool isCategorical,
size_t atomSize,
double vMin,
double vMax) :
double vMax,
double rho) :
numWorkers(numWorkers),
updateInterval(updateInterval),
targetNetworkSyncInterval(targetNetworkSyncInterval),
@@ -64,7 +66,8 @@ class TrainingConfig
isCategorical(isCategorical),
atomSize(atomSize),
vMin(vMin),
vMax(vMax)
vMax(vMax),
rho(rho)
{ /* Nothing to do here. */ }
//! Get the amount of workers.
@@ -141,6 +144,11 @@ class TrainingConfig
//! Modify the maximum value for support.
double& VMax() { return vMax; }
//! Get the rho value for sac.
double Rho() const { return rho; }
//! Modify the rho value for sac.
double& Rho() { return rho; }
private:
/**
* Locally-stored number of workers.
@@ -228,6 +236,12 @@ class TrainingConfig
* This is valid only for categorical q-network.
*/
double vMax;
/**
* Locally-stored parameter for softly updating q networks.
* This is valid only for Soft Actor-Critic.
*/
double rho;
};
} // namespace rl