gridworldpy 0.3.0__tar.gz → 0.4.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: gridworldpy
3
- Version: 0.3.0
3
+ Version: 0.4.0
4
4
  Summary: A flexible and interactive grid world environment for reinforcement learning
5
5
  Project-URL: Homepage, https://github.com/hitlic/gridworldpy
6
6
  Project-URL: Repository, https://github.com/hitlic/gridworldpy
@@ -33,7 +33,7 @@ Description-Content-Type: text/markdown
33
33
  # GridWorldPy
34
34
 
35
35
  [![PyPI version](https://badge.fury.io/py/gridworldpy.svg)](https://badge.fury.io/py/gridworldpy)
36
- [![Python 3.8+](https://img.shields.io/badge/python-3.8+-blue.svg)](https://www.python.org/downloads/)
36
+ [![Python 3.8+](https://img.shields.io/badge/python-3.12+-blue.svg)](https://www.python.org/downloads/)
37
37
  [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
38
38
 
39
39
  一个灵活且交互式的网格世界环境,专为强化学习实验和教学目的设计。
@@ -60,7 +60,7 @@ Description-Content-Type: text/markdown
60
60
  pip install gridworldpy
61
61
  ```
62
62
 
63
- 安装后的 Python 包名为 `src`,使用 `from src import GridWorldEnv` 导入。
63
+ 安装后使用 `from gridworldpy import GridWorldEnv` 导入。
64
64
 
65
65
  或者从源码安装:
66
66
 
@@ -75,7 +75,7 @@ pip install -e .
75
75
  ### 基本使用
76
76
 
77
77
  ```python
78
- from src import GridWorldEnv
78
+ from gridworldpy import GridWorldEnv
79
79
 
80
80
  # 创建一个5x5的网格世界
81
81
  env = GridWorldEnv(grid_size=(5, 5), keyboard_control=True)
@@ -93,7 +93,7 @@ obs, reward, done, is_effective, info = env.step(1) # 向上移动
93
93
  ### 自定义配置
94
94
 
95
95
  ```python
96
- from src import GridWorldEnv
96
+ from gridworldpy import GridWorldEnv
97
97
 
98
98
  # 创建带自定义配置的环境
99
99
  env = GridWorldEnv(
@@ -1,7 +1,7 @@
1
1
  # GridWorldPy
2
2
 
3
3
  [![PyPI version](https://badge.fury.io/py/gridworldpy.svg)](https://badge.fury.io/py/gridworldpy)
4
- [![Python 3.8+](https://img.shields.io/badge/python-3.8+-blue.svg)](https://www.python.org/downloads/)
4
+ [![Python 3.8+](https://img.shields.io/badge/python-3.12+-blue.svg)](https://www.python.org/downloads/)
5
5
  [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
6
6
 
7
7
  一个灵活且交互式的网格世界环境,专为强化学习实验和教学目的设计。
@@ -28,7 +28,7 @@
28
28
  pip install gridworldpy
29
29
  ```
30
30
 
31
- 安装后的 Python 包名为 `src`,使用 `from src import GridWorldEnv` 导入。
31
+ 安装后使用 `from gridworldpy import GridWorldEnv` 导入。
32
32
 
33
33
  或者从源码安装:
34
34
 
@@ -43,7 +43,7 @@ pip install -e .
43
43
  ### 基本使用
44
44
 
45
45
  ```python
46
- from src import GridWorldEnv
46
+ from gridworldpy import GridWorldEnv
47
47
 
48
48
  # 创建一个5x5的网格世界
49
49
  env = GridWorldEnv(grid_size=(5, 5), keyboard_control=True)
@@ -61,7 +61,7 @@ obs, reward, done, is_effective, info = env.step(1) # 向上移动
61
61
  ### 自定义配置
62
62
 
63
63
  ```python
64
- from src import GridWorldEnv
64
+ from gridworldpy import GridWorldEnv
65
65
 
66
66
  # 创建带自定义配置的环境
67
67
  env = GridWorldEnv(
@@ -1,5 +1,5 @@
1
1
  import numpy as np
2
- from src import GridWorldEnv
2
+ from gridworldpy import GridWorldEnv
3
3
  import time
4
4
 
5
5
  np.random.seed(5)
@@ -1,7 +1,7 @@
1
1
  """
2
2
  蒙特卡罗法策略评估
3
3
  """
4
- from src import GridWorldEnv
4
+ from gridworldpy import GridWorldEnv
5
5
 
6
6
 
7
7
  # --- 算法核心参数 ---
@@ -6,8 +6,7 @@ Q-learning 是一种异策略(off-policy)算法。
6
6
  Q-learning 更新规则:
7
7
  Q(s, a) <- Q(s, a) + alpha * (reward + gamma * max_{a'} Q(s', a') - Q(s, a))
8
8
  """
9
- from src import GridWorldEnv, QTable
10
-
9
+ from gridworldpy import GridWorldEnv, QTable
11
10
 
12
11
  # 1. 环境设置
13
12
  grid_size = (7, 7)
@@ -1,5 +1,5 @@
1
1
  """SARSA 算法 """
2
- from src import GridWorldEnv, QTable
2
+ from gridworldpy import GridWorldEnv, QTable
3
3
 
4
4
  # 1. 环境设置
5
5
  grid_size = (7, 7)
@@ -2,7 +2,7 @@
2
2
  价值迭代 (Value Iteration) 寻找最优策略
3
3
  """
4
4
  import numpy as np
5
- from src import GridWorldEnv
5
+ from gridworldpy import GridWorldEnv
6
6
  import time
7
7
 
8
8
  # --- 环境和模型参数 ---
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
4
4
 
5
5
  [project]
6
6
  name = "gridworldpy"
7
- version = "0.3.0"
7
+ version = "0.4.0"
8
8
  description = "A flexible and interactive grid world environment for reinforcement learning"
9
9
  readme = "README.md"
10
10
  license = {text = "MIT"}
@@ -47,7 +47,7 @@ Documentation = "https://github.com/hitlic/gridworldpy#readme"
47
47
  "Bug Reports" = "https://github.com/hitlic/gridworldpy/issues"
48
48
 
49
49
  [tool.hatch.build.targets.wheel]
50
- packages = ["src"]
50
+ packages = ["src/gridworldpy"]
51
51
 
52
52
  [tool.hatch.build.targets.sdist]
53
53
  include = ["/src", "/examples", "/tests", "/README.md", "/LICENSE", "/pyproject.toml"]
@@ -9,7 +9,7 @@ from .gridworld import GridWorldEnv
9
9
  from .utils import policy_to_transition_matrix, matrix_to_rewards
10
10
  from .q_table import QTable
11
11
 
12
- __version__ = "0.3.0"
12
+ __version__ = "0.4.0"
13
13
  __author__ = "LIC"
14
14
  __email__ = "liuchen.lic@gmail.com"
15
15
 
@@ -1,6 +1,8 @@
1
+ import time
1
2
  import tkinter as tk
3
+
2
4
  import numpy as np
3
- import time
5
+
4
6
  from .utils import *
5
7
 
6
8
 
@@ -12,7 +14,7 @@ class GridWorldEnv:
12
14
 
13
15
  def __init__(self, grid_size=(5, 5), enable_keep=False, start_state=(0, 0), target_state=None,
14
16
  render_mode="human", keyboard_control=False, max_steps=100000000,
15
- cell_size=135, circle_radius=35, font_size=16, max_arrow_length=30, color_alpha=0.0,
17
+ cell_size=135, circle_radius=35, font_size=14, max_arrow_length=30, color_alpha=0.0,
16
18
  show_cell_pos=False, show_step_num=False):
17
19
  """
18
20
  Args:
@@ -631,13 +633,13 @@ class GridWorldEnv:
631
633
 
632
634
  # 第一行(奖励)
633
635
  self.canvas.create_text(
634
- center_x, center_y - font_size//2,
636
+ center_x, center_y - font_size//2 - 2,
635
637
  text=reward_text, fill=text_color, font=('Arial', font_size)
636
638
  )
637
639
 
638
640
  # 第二行(状态价值)
639
641
  self.canvas.create_text(
640
- center_x, center_y + font_size//2,
642
+ center_x, center_y + font_size//2 + 2,
641
643
  text=value_text, fill=text_color, font=('Arial', font_size)
642
644
  )
643
645
  else:
@@ -2,7 +2,7 @@ import unittest
2
2
 
3
3
  import numpy as np
4
4
 
5
- from src import GridWorldEnv, policy_to_transition_matrix
5
+ from gridworldpy import GridWorldEnv, policy_to_transition_matrix
6
6
 
7
7
 
8
8
  class GridWorldTests(unittest.TestCase):
File without changes
File without changes