フィルターのクリア

Using time as a negative reward in RL toolbox

2 ビュー (過去 30 日間)
Amin Moradi
Amin Moradi 2022 年 2 月 24 日
回答済み: Kartik Saxena 2023 年 11 月 30 日
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

回答 (1 件)

Kartik Saxena
Kartik Saxena 2023 年 11 月 30 日
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.

カテゴリ

Help Center および File ExchangeIntroduction to Installation and Licensing についてさらに検索

製品


リリース

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by