generateRewardFunction
Generate a reward function from control specifications to train a reinforcement learning agent
Since R2021b
Syntax
Description
generateRewardFunction(
generates a
MATLAB® reward function based on the cost and constraints defined in the linear or
nonlinear MPC object mpcobj
)mpcobj
. The generated reward function is displayed
in a new editor window and you can use it as a starting point for reward design. You can
tune the weights, use a different penalty function, and then use the resulting reward
function within an environment to train an agent.
This syntax requires Model Predictive Control Toolbox™ software.
generateRewardFunction(
generates a
MATLAB reward function based on performance constraints defined in the model
verification blocks specified in the array of block paths blks
)blks
.
This syntax requires Simulink® Design Optimization™ software.
generateRewardFunction(___,'FunctionName',
specifies the name of the generated reward function, and saves it into a file with the same
name. It also overwrites any preexisting file with the same name in the current directory.
Provide this name after either of the previous input arguments.myFcnName
)
Examples
Input Arguments
Tips
By default, the exterior bound penalty function exteriorPenalty
is
used to calculate the penalty. Alternatively, to calculate hyperbolic and barrier penalties,
you can use the hyperbolicPenalty
or
barrierPenalty
functions.
Version History
Introduced in R2021b