没有合适的资源?快使用搜索试试~ 我知道了~
C语言实现Q-leaning
资源推荐
资源详情
资源评论
#include <cmath>
#include <cstring>
#include <ctime>
#include <iostream>
#include <tuple>
#include <thread>
#include <chrono>
//map size width and height
const int width = 10;
const int height = 10;
double epsilon = 0.2;
double alpha = 0.1;
double gamma_ = 0.9;
double q_table[width][height][4];
//action 0=上 1=右 2=下 3=左
//最大遍历次数
int max_episodes = 100;
//从QTABLE中返回指定状态的值最大的索引
int GetMaxIndex(int x, int y) {
int max_index = 0;
for (int i = 1; i < 4; i++) {
if (q_table[x][y][i] > q_table[x][y][max_index]) max_index = i;
}
return max_index;
}
//选择下一步动作
#include <cstring>
#include <ctime>
#include <iostream>
#include <tuple>
#include <thread>
#include <chrono>
//map size width and height
const int width = 10;
const int height = 10;
double epsilon = 0.2;
double alpha = 0.1;
double gamma_ = 0.9;
double q_table[width][height][4];
//action 0=上 1=右 2=下 3=左
//最大遍历次数
int max_episodes = 100;
//从QTABLE中返回指定状态的值最大的索引
int GetMaxIndex(int x, int y) {
int max_index = 0;
for (int i = 1; i < 4; i++) {
if (q_table[x][y][i] > q_table[x][y][max_index]) max_index = i;
}
return max_index;
}
//选择下一步动作
资源评论
CheckOneA
- 粉丝: 879
- 资源: 8
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功