Skip to content

Commit 979e831

Browse files
authored
Update README.md
1 parent 8735df6 commit 979e831

File tree

1 file changed

+49
-2
lines changed

1 file changed

+49
-2
lines changed

README.md

Lines changed: 49 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,11 +72,58 @@ For training on quadrangular meshes, you can use an agent with all four actions:
7272
##### 2. Using `tune/model_RL/PPO_model_pers`
7373
Run the following command from the `tune/` directory:
7474
```bash
75-
python -m /training/train_quadmesh
75+
python -m training.train_quadmesh
7676
```
7777

7878
##### 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 _ in range(9)]
95+
```
96+
97+
- **Generate a set of random quad meshes**:
98+
```python
99+
dataset = [QM.random_mesh() for _ in range(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+
with open("../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.
80125
81126

127+
#### 🧪 Testing a Saved PPO_perso Policy
82128

129+
🚧 *Section in progress...*

0 commit comments

Comments
 (0)