Using time as a negative reward in RL toolbox

1 visualización (últimos 30 días)
Amin Moradi
Amin Moradi el 24 de Feb. de 2022
Respondida: Kartik Saxena el 30 de Nov. de 2023
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

Respuestas (1)

Kartik Saxena
Kartik Saxena el 30 de Nov. de 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.

Categorías

Más información sobre Introduction to Installation and Licensing en Help Center y File Exchange.

Productos


Versión

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by