# Models

This directory contains selected trained DQN policy checkpoints used by the path-planning, evaluation, and mission-generation scripts.

The repository does not include every intermediate checkpoint produced during development. Instead, it keeps the final selected model and a small number of meaningful historical checkpoints that represent important stages in the project.

## Directory Structure

| Path | Description |
|---|---|
| `final_DQN_policy_net.pth` | Final selected DQN policy checkpoint used for the main path-planning workflow |
| `selected_checkpoints/` | Additional meaningful checkpoints retained for comparison and project history |

## Included Models

### Final Model

| Model ID | Architecture | Description |
|---|---|---|
| `final_DQN` | 2 hidden layers, 512 neurons each | Final selected DQN policy used for the main path-planning workflow |

### Selected Checkpoints

The following checkpoints are stored in `selected_checkpoints/`:

| Model ID | Architecture | Description |
|---|---|---|
| `_24_21_57` | 2 hidden layers, 512 neurons each | Strong earlier model that achieved high accuracy over a narrower trained-distance setting |
| `_26_23_6` | 2 hidden layers, 512 neurons each | Intermediate model useful for understanding threshold sensitivity during evaluation |
| `_27_16_10` | 3 hidden layers, 512 neurons each | Larger experimental model trained during later architecture exploration |

## Checkpoint Naming

Policy checkpoints follow the naming pattern:

```text
<model_id>_policy_net.pth
```

For example:

```text
final_DQN_policy_net.pth
selected_checkpoints/_27_16_10_policy_net.pth
```

## Model Registry

The known model architectures are registered in the `NETWORKS` dictionaries used by `eval.py` and `path_planner.py`.

Each entry maps a model ID to:

```text
(hidden_nodes, hidden_layers)
```

For example:

```python
"final_DQN": (512, 2)
```

This allows the scripts to reconstruct the correct network architecture before loading the checkpoint weights.

## Usage

The default model is:

```text
final_DQN
```

The final model is stored directly in `models/`, so it can be used with the default settings.

To evaluate the default model:

```bash
python -m dqn_path_planning.eval
```

To generate a mission path using the default model:

```bash
python -m dqn_path_planning.path_planner --to_txt true
```

Selected historical checkpoints are stored in:

```text
models/selected_checkpoints/
```

To evaluate one of these checkpoints, pass the checkpoint directory explicitly:

```bash
python -m dqn_path_planning.eval \
    --id _27_16_10 \
    --model_dir models/selected_checkpoints
```

To generate a mission path using one of these checkpoints:

```bash
python -m dqn_path_planning.path_planner \
    --id _27_16_10 \
    --model_dir models/selected_checkpoints \
    --to_txt true
```

## Notes

Only selected model checkpoints are included to keep the repository focused and readable.

The target-network checkpoints from training are not required for evaluation or mission generation. The planner and evaluator use trained policy-network checkpoints.