You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+49-2Lines changed: 49 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -72,11 +72,58 @@ For training on quadrangular meshes, you can use an agent with all four actions:
72
72
##### 2. Using `tune/model_RL/PPO_model_pers`
73
73
Run the following command from the `tune/` directory:
74
74
```bash
75
-
python -m /training/train_quadmesh
75
+
python -m training.train_quadmesh
76
76
```
77
77
78
78
##### 3. Using PPO from Stable Baselines 3 (SB3)
79
-
Run the training script in pycharm `tune/training/train_quadmesh_SB3.py`
79
+
Run the following command from the `tune/` directory:
80
+
```bash
81
+
python -m training.train_quadmesh_SB3
82
+
```
83
+
#### 🧪 Testing a Saved SB3 Policy
84
+
85
+
After training, the model is saved as a `.zip` file in the `tune/training/policy_saved/` directory. To evaluate the policy, follow these steps in `tune/training/exploit_SB3_policy.py` :
86
+
87
+
##### 1. Create a Test Dataset
88
+
89
+
You can either:
90
+
91
+
-**Load a specific mesh file and duplicate it**:
92
+
```python
93
+
mesh = read_gmsh("../mesh_files/t1_quad.msh")
94
+
dataset = [mesh for _ inrange(9)]
95
+
```
96
+
97
+
-**Generate a set of random quad meshes**:
98
+
```python
99
+
dataset = [QM.random_mesh() for _ inrange(9)]
100
+
```
101
+
102
+
##### 2. Load the Environment Configuration
103
+
104
+
Make sure to change and load the environment settings before testing:
105
+
106
+
```python
107
+
withopen("../environment/environment_config.json", "r") as f:
108
+
env_config = json.load(f)
109
+
110
+
plot_dataset(dataset)
111
+
```
112
+
113
+
##### 3. Load the Model
114
+
115
+
Use the `PPO.load()` function and evaluate the policy with your dataset:
116
+
117
+
```python
118
+
model =PPO.load("policy_saved/name.zip")
119
+
```
120
+
121
+
##### 4. Run the script
122
+
123
+
Run the script directly in **PyCharm** (or another IDE that supports graphical output) instead of the terminal.
124
+
> ❗ If executed in a terminal without GUI support, the plots will not be displayed.
0 commit comments