How to get the policy function?
1 view (last 30 days)
Show older comments
I did simulation with pendulum in Reinforcement learning.
After that, I would like to find a policy function of the post -learning controller.
In this case, the policy function will be a torque (control function) that outputs the controller to the state (angle and angle speed).
In addition, I want to tailor the state (angle and angular speed) like Qtable.
In this case, which one use GeneratePolicyFunction or Getaction?
Is this method correct? Or is there another way? Also, how can I save the network by using Sac (Soft-Acto-Critic)?
clear all;
close all;
%% load 'agent.mat'
load('k5_simplePendulum.mat','agent');
generatePolicyFunction(agent);
%% tiring states(angler velocity , angle)
N = 5; %5 divisions
NN = N*N;
Angle = linspace(-3.14,-4.71,N);
Velocity = linspace(0,-20,N);
State = comvec(Angle,Velocity); % Combination of state, number of tiles 5×5
F = zeros(NN,1); % Policy function (Torque predicted by trainned agent?)
for i=1:NN
F(:,i) = evaluatePolicy(State(:,1));
end
0 Comments
Answers (0)
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!