Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Example Analysis of non-landing of small Ball in matlab

2025-01-30 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/01 Report--

Editor to share with you the matlab small ball does not land on the example analysis, I believe that most people do not know much about it, so share this article for your reference, I hope you will learn a lot after reading this article, let's go to know it!

Agent effect after 1000 training times

When using the object-oriented management program in the previous FrozenLake environment training, it was found that the running speed became slower in the later stage of the training, and it was observed by the naked eye, so matlab another program file management method, packages, was adopted.

Name the folder with + and name to form a package, within which you can create a new function or the class you used earlier

Here, use the function file directly. When calling the function, you need to write the name of the package, such as env.step ().

It can be observed that there is no visible change in running speed after 1000 training.

This method is easier to use than the object-oriented model to build a simple game environment.

When passing parameters and calls, structural body variables are used to store the original object parameters, that is, the global variables under the mode of more than a dozen function files in a folder and a main file, such as

Function self = step (self,action)

% one step action

Self.done = 0

Self.reward=0

Temp_w=self.agent (5) + 5* (2-action)

If temp_w25

Temp_w=25

End

Self.reward=0

BallPos = self.observation (1:2)

BallVel = self.observation (3:4)

If ballPos (1) > self.weight

BallPos (1) = self.weight

BallVel (1) =-ballVel (1);% boundary

Elseif ballPos (1)

< 0.1 ballPos(1) = 0.1; ballVel(1) = -ballVel(1); elseif ballPos(2) >

= self.height

BallPos (2) = self.height

BallVel (2) =-ballVel (2);% Top Wall

Self.score=self.score+1

Elseif ballPos (2) < 1

If abs (self.agent (5)-ballPos (1))

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report