Effacer les filtres
Effacer les filtres

Using time as a negative reward in RL toolbox

1 vue (au cours des 30 derniers jours)
Amin Moradi
Amin Moradi le 24 Fév 2022
I want to use RL toolbox to train a DQN agent. Right now, i'm using the related step_function to implement the reward function. The problem is I don't know how to punish the agent for taking too long to do the objective. How should I add time to my reward function in this toolbox? Your help is appreciated.
function [NextObs,Reward,IsDone,LoggedSignals] = WW6_StepFunction_genloss(Action,LoggedSignals)
a = Action;
obj=4;
d=[1 2];
state = LoggedSignals.State;
[next_state, ~, genloss]=attack_eff_WW6(state, a, d);
LoggedSignals.State = next_state;
NextObs = LoggedSignals.State;
Down=nnz(~next_state);
IsDone = Down==11;
Reward=genloss;
end

Réponses (1)

Kartik Saxena
Kartik Saxena le 30 Nov 2023
Hi,
I understand that you want to add time penalty in the reward function to punish it for taking too long.
The example given below in the MathWorks documentation would be useful for this purpose:
You can refer to it and introduce penalty in your reward function by deducting from the reward as per your requirements, instead of adding '1'.
I hope this resolves your issue.

Catégories

En savoir plus sur Environments dans Help Center et File Exchange

Produits


Version

R2021b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by