src/core/reinforcement/policy/updateablepolicy/AbstractUpdateablePolicy.java
protected void updateAlpha() throws MatrixException, DynamicParamException {
        // https://raw.githubusercontent.com/BY571/Deep-Reinforcement-Learning-Algorithm-Collection/master/ContinousControl/SAC.ipynb
        // self.target_entropy = -action_size  # -dim(A)
        // alpha_loss = - (self.log_alpha * (log_pis + self.target_entropy).detach()).mean()
        softQAlphaMatrix.setValue(0,0, softQAlpha);
        softQAlphaMatrixGradient.setValue(0, 0, softQAlpha * cumulativeAlphaLoss / (double) alphaLossCount);
        optimizer.optimize(softQAlphaMatrix, softQAlphaMatrixGradient);
        softQAlpha = softQAlphaMatrix.getValue(0, 0);
        cumulativeAlphaLoss = 0;
        alphaLossCount = 0;
    }
/**
     * Updates alpha.
     *
     * @throws MatrixException throws exception if matrix operation fails.
     * @throws DynamicParamException throws exception if parameter (params) setting fails.
     */
Updates alpha.
@throws MatrixException throws exception if matrix operation fails.
@throws DynamicParamException throws exception if parameter (params) setting fails.
Updates alpha . @throws MatrixException throws exception if matrix operation fails . @throws DynamicParamException throws exception if parameter ( params ) setting fails .
protected void updateAlpha() throws MatrixException, DynamicParamException {
        softQAlphaMatrix.setValue(0,0, softQAlpha);
        softQAlphaMatrixGradient.setValue(0, 0, softQAlpha * cumulativeAlphaLoss / (double) alphaLossCount);
        optimizer.optimize(softQAlphaMatrix, softQAlphaMatrixGradient);
        softQAlpha = softQAlphaMatrix.getValue(0, 0);
        cumulativeAlphaLoss = 0;
        alphaLossCount = 0;
    }
protected void updateAlpha ( ) throws MatrixException , DynamicParamException { softQAlphaMatrix . setValue ( 0 , 0 , softQAlpha ) ; softQAlphaMatrixGradient . setValue ( 0 , 0 , softQAlpha * cumulativeAlphaLoss / ( double ) alphaLossCount ) ; optimizer . optimize ( softQAlphaMatrix , softQAlphaMatrixGradient ) ; softQAlpha = softQAlphaMatrix . getValue ( 0 , 0 ) ; cumulativeAlphaLoss = 0 ; alphaLossCount = 0 ; }
Updates alpha.
Updates alpha .
// https://raw.githubusercontent.com/BY571/Deep-Reinforcement-Learning-Algorithm-Collection/master/ContinousControl/SAC.ipynb // self.target_entropy = -action_size  # -dim(A) // alpha_loss = - (self.log_alpha * (log_pis + self.target_entropy).detach()).mean()