How to get the policy function?

4 views (last 30 days)
ryunosuke tazawa
ryunosuke tazawa on 5 Jun 2022
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

Answers (0)

Community Treasure Hunt

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

Start Hunting!

Translated by