📄 doubleint_demo.m
字号:
% DOUBLEINT_DEMO Demonstration of the use of the approximate RL package, on the double% integrator problem% TODO This is a quick-and-dirty built file, should be fine-tuned and made more detailedecho on% First, you need to define the problem. To do that, start from the template sample_problem.% You need to define the dynamics and return function in a separate function; start from% the template sample_mdp. You can also define a custom plot function, starting from% sample_plot.% See doubleint_problem and doubleint_mdp for an example.pause;% Here is how to run fuzzy Q-iteration for the double integrator% You need to specify the problem function and it's recommended that you specify a data file for saving% the results% stats = fuzzyqi('run problem=doubleint_problem datafile=demodata');pause;stats = fuzzyqi('run problem=doubleint_problem datafile=demodata');% Statistics of fuzzy Q-iteration are returned by the functionpause;% Here's how to make a controlled trajectory with the learnt policy% hist = fuzzyqi('replay problem=doubleint_problem datafile=demodata x0=[-1,0]');pause;hist = fuzzyqi('replay problem=doubleint_problem datafile=demodata x0=[-1,0]');% A history of the controlled trajectory is returned by the functionpause; commandwindow; pause;% equivalently, all the parameters can be specified in a structureclear cfg;cfg.replay = 1;cfg.problem = 'doubleint_problem';cfg.datafile = 'demodata';cfg.x0 = [-1 0]';pause;hist = fuzzyqi(cfg);pause; commandwindow; pause;% Other useful parameters:cfg.loadapprox = 'demodata'; % to load precomputed dynamics, rewards % and possibly membership degrees from this filecfg.interph = 0; % to disable policy interpolation in replaycfg.verb = 0; % set verbosity 0 to display only the most important messagescfg.silent = 1; % or disable text and graphical output entirelypause;% run again with the new configstats = fuzzyqi(cfg);pause;% and replayhist = fuzzyqi(cfg);% notice nothing was plotted since silent=1; we plot the history nowpause;figh = plothistory(hist); pause; close(figh);% for the entire list of configuration parameters, % edit fuzzyqi and check the default configuration comments% for how to specify various types of parameters % on a single configuration string, help str2cfgpause;close all; echo off; return;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -