Shorter model card in the original format
Browse files- README.md +51 -111
- manifest.json +1 -1
README.md
CHANGED
|
@@ -1,7 +1,5 @@
|
|
| 1 |
---
|
| 2 |
license: cc-by-4.0
|
| 3 |
-
language:
|
| 4 |
-
- en
|
| 5 |
tags:
|
| 6 |
- reinforcement-learning
|
| 7 |
- multi-objective
|
|
@@ -9,106 +7,58 @@ tags:
|
|
| 9 |
- attention
|
| 10 |
- ppo
|
| 11 |
- morl
|
|
|
|
|
|
|
| 12 |
pipeline_tag: reinforcement-learning
|
| 13 |
---
|
| 14 |
|
| 15 |
# SmartFlexPack MORL: Sequential Attention Policy for Packaging Scheduling
|
| 16 |
|
| 17 |
-
|
| 18 |
-
Reinforcement Learning for Adaptive Packaging Scheduling via Sequential Attention
|
| 19 |
-
Policy*, by L. Venturoso, G. Egger, F. Visentin and M. Todescato (2026,
|
| 20 |
-
manuscript in preparation). Developed within the SMARTFLEXPACK project at
|
| 21 |
-
Fraunhofer Italia.
|
| 22 |
|
| 23 |
-
|
|
|
|
|
|
|
|
|
|
| 24 |
|
| 25 |
-
|
| 26 |
-
modes are feasible. A preference vector `(tardiness, cost, CO2)`, with nonnegative
|
| 27 |
-
entries summing to one, controls the trade-off at inference time.
|
| 28 |
-
The planner handles order sequencing, forced modes including NO_PRINT, line
|
| 29 |
-
assignment, timing and label reservations; the discrete-event simulation executes
|
| 30 |
-
the resulting production plan.
|
| 31 |
|
| 32 |
-
`SeqAttentionActorCritic`
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 33 |
|
| 34 |
-
|
| 35 |
-
|
| 36 |
-
layer (four heads, residual connection and LayerNorm).
|
| 37 |
-
- Once per decision: the 32-dimensional embedding is concatenated with ten live
|
| 38 |
-
decision features and twelve global features, including the three preferences.
|
| 39 |
-
A `54 → 64 → 64` tanh MLP feeds two action logits and a scalar critic.
|
| 40 |
|
| 41 |
-
|
| 42 |
-
training episode arrive across multiple planning events.
|
| 43 |
|
| 44 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 45 |
|
| 46 |
-
|
| 47 |
-
|
| 48 |
-
|
| 49 |
-
|
| 50 |
-
|
| 51 |
-
|
| 52 |
-
|
| 53 |
-
|
| 54 |
-
|
| 55 |
-
|
| 56 |
-
|
| 57 |
-
|
| 58 |
-
|
| 59 |
-
plus a 0.5 penalty for late DDP/DAP orders. Each order's cost includes an equal
|
| 60 |
-
share of the episode's line operating cost. Reward normalisers are provided
|
| 61 |
-
in `normalisation/reward_normalisers_consol.json`; observation transforms are
|
| 62 |
-
implemented in the full project's `experiments/seq_morl/envs/observations.py`.
|
| 63 |
-
|
| 64 |
-
These are the final historical paper checkpoints, with identical tensors to
|
| 65 |
-
update 200. The supplied configuration and inference source reflect the current
|
| 66 |
-
code. Current code also seeds BC initialization and orders parallel collection;
|
| 67 |
-
retraining can differ from the historical runs. These weight files contain no
|
| 68 |
-
optimizer or RNG state and support inference or fine-tuning rather than exact
|
| 69 |
-
training continuation.
|
| 70 |
-
|
| 71 |
-
## Evaluation
|
| 72 |
-
|
| 73 |
-
Greedy evaluation uses 15 preference vectors and independent order scenarios.
|
| 74 |
-
The primary configuration has three label lines and an inline processing time
|
| 75 |
-
of 0.45 s/pack. Relative to the capacity-consolidating reference set C
|
| 76 |
-
(32 controllers), the policy improves three-objective hypervolume by **+0.058**
|
| 77 |
-
(95% crossed-bootstrap CI **[+0.025, +0.095]**, approximately **7%**).
|
| 78 |
-
An additional independent test set confirms an advantage of +0.050
|
| 79 |
-
(95% CI [+0.015, +0.084]). These intervals account for training-model and
|
| 80 |
-
order-scenario variability.
|
| 81 |
-
|
| 82 |
-
The advantage increases with a slower inline line (0.60 s/pack). Results with
|
| 83 |
-
one label line are inconclusive; at the fastest inline setting (0.35 s/pack),
|
| 84 |
-
one test shows no significant difference and another shows a small disadvantage.
|
| 85 |
-
The paper also compares against an extended, 43-controller family.
|
| 86 |
-
|
| 87 |
-
## Files
|
| 88 |
-
|
| 89 |
-
| Path | Contents |
|
| 90 |
-
|---|---|
|
| 91 |
-
| `ppo/seed_{1..5}/policy_200.pt` | Five final PPO state dictionaries |
|
| 92 |
-
| `ppo/seed_{1..5}/metrics.csv` | Historical training metrics |
|
| 93 |
-
| `bc/bc_seq_morl.pt` | Shared BC warm-start weights |
|
| 94 |
-
| `inference/seq_morl/` | Minimal PyTorch architecture and configuration source |
|
| 95 |
-
| `configs/paper.json` | Current paper reproduction settings |
|
| 96 |
-
| `normalisation/` | Reward normalisers and observation-scale measurements |
|
| 97 |
-
| `manifest.json` | Source revision, checkpoint origins and SHA-256 file hashes |
|
| 98 |
-
|
| 99 |
-
The earlier PPO weights and REINFORCE ablation remain available in repository
|
| 100 |
-
history; this revision contains the current paper models.
|
| 101 |
-
|
| 102 |
-
## Loading a policy
|
| 103 |
-
|
| 104 |
-
Install `torch` and `huggingface_hub`. The following checks loading and tensor
|
| 105 |
-
dimensions using **synthetic inputs**; real decisions require the full project's
|
| 106 |
-
normalised observations in the same feature order.
|
| 107 |
|
| 108 |
```python
|
| 109 |
-
import sys
|
| 110 |
from pathlib import Path
|
| 111 |
-
import torch
|
| 112 |
from huggingface_hub import snapshot_download
|
| 113 |
|
| 114 |
release = Path(snapshot_download("fhi/smartflexpack-morl"))
|
|
@@ -116,36 +66,25 @@ sys.path.insert(0, str(release / "inference"))
|
|
| 116 |
from seq_morl.policies.attention import SeqAttentionActorCritic
|
| 117 |
|
| 118 |
model = SeqAttentionActorCritic()
|
| 119 |
-
|
| 120 |
-
|
| 121 |
-
model.load_state_dict(weights, strict=True)
|
| 122 |
model.eval()
|
| 123 |
|
| 124 |
with torch.no_grad():
|
| 125 |
-
|
| 126 |
-
logits, value = model.forward_single(
|
| 127 |
-
action = logits.argmax(dim=-1).item()
|
| 128 |
```
|
| 129 |
|
| 130 |
-
|
| 131 |
-
|
| 132 |
-
features followed by the twelve global features. Use each seed independently;
|
| 133 |
-
the paper reports results across five models rather than a voting ensemble.
|
| 134 |
|
| 135 |
-
|
| 136 |
-
[project repository](https://fhi-git.fraunhofer.it/smartflexpack/smartflexpack_digtwin_prototype)
|
| 137 |
-
(access may be required). They additionally require the separate DataGenerator
|
| 138 |
-
and variants workbook, configured through `DATAGENERATOR_SRC` and
|
| 139 |
-
`DATAGENERATOR_DATA`. Industrial input data are outside this model release.
|
| 140 |
|
| 141 |
-
|
|
|
|
| 142 |
|
| 143 |
-
|
| 144 |
-
Performance depends on the plant, planner, observation transforms and operating
|
| 145 |
-
assumptions used in training and evaluation. Evidence comes from simulation;
|
| 146 |
-
physical deployment and service-level guarantees require further validation.
|
| 147 |
-
Changing the preference vector supports different priorities within the learned
|
| 148 |
-
range; coverage of every Pareto-optimal solution is unproven.
|
| 149 |
|
| 150 |
## Citation
|
| 151 |
|
|
@@ -162,5 +101,6 @@ range; coverage of every Pareto-optimal solution is unproven.
|
|
| 162 |
|
| 163 |
## License
|
| 164 |
|
| 165 |
-
|
| 166 |
-
|
|
|
|
|
|
| 1 |
---
|
| 2 |
license: cc-by-4.0
|
|
|
|
|
|
|
| 3 |
tags:
|
| 4 |
- reinforcement-learning
|
| 5 |
- multi-objective
|
|
|
|
| 7 |
- attention
|
| 8 |
- ppo
|
| 9 |
- morl
|
| 10 |
+
language:
|
| 11 |
+
- en
|
| 12 |
pipeline_tag: reinforcement-learning
|
| 13 |
---
|
| 14 |
|
| 15 |
# SmartFlexPack MORL: Sequential Attention Policy for Packaging Scheduling
|
| 16 |
|
| 17 |
+
Trained model weights for the paper:
|
|
|
|
|
|
|
|
|
|
|
|
|
| 18 |
|
| 19 |
+
> **Multi-Objective Reinforcement Learning for Adaptive Packaging Scheduling via Sequential Attention Policy**
|
| 20 |
+
> L. Venturoso, G. Egger, F. Visentin, M. Todescato
|
| 21 |
+
> Fraunhofer Italia Research EFRE1054 Smartflexpack
|
| 22 |
+
> *Manuscript in preparation*
|
| 23 |
|
| 24 |
+
## Model description
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 25 |
|
| 26 |
+
`SeqAttentionActorCritic` (12,355 parameters) decides, for each order, between
|
| 27 |
+
inline printing and labelling. At each planning event a one-layer multi-head
|
| 28 |
+
self-attention encoder (4 heads, d=32) encodes the pending orders; for each
|
| 29 |
+
decision a 54→64→64 MLP combines that embedding with ten live decision features
|
| 30 |
+
and twelve global features, including the preference vector
|
| 31 |
+
`(tardiness, cost, CO2)`, and outputs two action logits and a value.
|
| 32 |
|
| 33 |
+
A single trained policy covers the whole trade-off: the operator sets the
|
| 34 |
+
preference at inference time, with no retraining.
|
|
|
|
|
|
|
|
|
|
|
|
|
| 35 |
|
| 36 |
+
## Results
|
|
|
|
| 37 |
|
| 38 |
+
In the reference plant configuration (3 label lines, inline 0.45 s/pack) the
|
| 39 |
+
policy exceeds the hypervolume of the full family of 32 realisable reference
|
| 40 |
+
controllers by **+0.058** (95% CI [+0.025, +0.095], about 7%), replicated on an
|
| 41 |
+
independent seed set (+0.050). The advantage grows with a slower inline line
|
| 42 |
+
(12–15% at 0.60 s/pack); with a single label line, and with the fastest inline
|
| 43 |
+
line, the policy ties the reference family or falls slightly below it.
|
| 44 |
|
| 45 |
+
## Repository structure
|
| 46 |
+
|
| 47 |
+
```
|
| 48 |
+
ppo/seed_{1..5}/policy_200.pt # final PPO checkpoints (5 independent seeds)
|
| 49 |
+
ppo/seed_{1..5}/metrics.csv # training metrics
|
| 50 |
+
bc/bc_seq_morl.pt # behavioural-cloning warm start
|
| 51 |
+
configs/paper.json # training configuration
|
| 52 |
+
normalisation/ # observation and reward normalisers
|
| 53 |
+
inference/seq_morl/ # minimal code to load the policy
|
| 54 |
+
manifest.json # source revision and SHA-256 of every file
|
| 55 |
+
```
|
| 56 |
+
|
| 57 |
+
## Inference
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 58 |
|
| 59 |
```python
|
| 60 |
+
import sys, torch
|
| 61 |
from pathlib import Path
|
|
|
|
| 62 |
from huggingface_hub import snapshot_download
|
| 63 |
|
| 64 |
release = Path(snapshot_download("fhi/smartflexpack-morl"))
|
|
|
|
| 66 |
from seq_morl.policies.attention import SeqAttentionActorCritic
|
| 67 |
|
| 68 |
model = SeqAttentionActorCritic()
|
| 69 |
+
model.load_state_dict(torch.load(release / "ppo/seed_1/policy_200.pt",
|
| 70 |
+
map_location="cpu", weights_only=True))
|
|
|
|
| 71 |
model.eval()
|
| 72 |
|
| 73 |
with torch.no_grad():
|
| 74 |
+
ctx = model.encode_sequence(order_feats) # [N, 32], pending orders
|
| 75 |
+
logits, value = model.forward_single(ctx[i], extra) # extra: 10 decision + 12 global
|
| 76 |
+
action = logits.argmax(dim=-1).item() # 0 = inline, 1 = label
|
| 77 |
```
|
| 78 |
|
| 79 |
+
Simulation and evaluation: `experiments/evaluate_policy.py` in the project
|
| 80 |
+
repository; it also needs the separate DataGenerator.
|
|
|
|
|
|
|
| 81 |
|
| 82 |
+
## Training
|
|
|
|
|
|
|
|
|
|
|
|
|
| 83 |
|
| 84 |
+
Behavioural-cloning warm start, then 5 independent seeds of 200 PPO updates,
|
| 85 |
+
10 parallel episodes of 600 orders, lr=3e-4 (Adam). About 3.8 h CPU per seed.
|
| 86 |
|
| 87 |
+
Training code: `experiments/train_bc_warm_start.py`, `experiments/train_policy.py`
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 88 |
|
| 89 |
## Citation
|
| 90 |
|
|
|
|
| 101 |
|
| 102 |
## License
|
| 103 |
|
| 104 |
+
[CC BY 4.0](https://creativecommons.org/licenses/by/4.0/)
|
| 105 |
+
Fraunhofer Italia Research, EFRE1054 Smartflexpack project
|
| 106 |
+
(funded under FESR 2021–27, Priority 1 "Smart" R&I programme).
|
manifest.json
CHANGED
|
@@ -34,7 +34,7 @@
|
|
| 34 |
"inference/seq_morl/common/layout.py": "experiments/seq_morl/common/layout.py"
|
| 35 |
},
|
| 36 |
"sha256": {
|
| 37 |
-
"README.md": "
|
| 38 |
"bc/bc_seq_morl.pt": "cf488cf1bcedbf54f9a995e396b915650bec658a9a05b0fe791a9522416993bb",
|
| 39 |
"configs/paper.json": "d548976847f396a057c47b49cdb5440c9800bace63d29c0d501c74e497c739ba",
|
| 40 |
"inference/seq_morl/__init__.py": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
|
|
|
|
| 34 |
"inference/seq_morl/common/layout.py": "experiments/seq_morl/common/layout.py"
|
| 35 |
},
|
| 36 |
"sha256": {
|
| 37 |
+
"README.md": "88b8100be0a8ca3b67c419be4cbd0b713dca8b20c3617259de86fa2d0330f54b",
|
| 38 |
"bc/bc_seq_morl.pt": "cf488cf1bcedbf54f9a995e396b915650bec658a9a05b0fe791a9522416993bb",
|
| 39 |
"configs/paper.json": "d548976847f396a057c47b49cdb5440c9800bace63d29c0d501c74e497c739ba",
|
| 40 |
"inference/seq_morl/__init__.py": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
|