File size: 3,821 Bytes
d287289
 
4ad94ab
 
 
 
 
 
 
f23551f
 
4ad94ab
d287289
4ad94ab
41a321a
4ad94ab
f23551f
4ad94ab
f23551f
 
 
 
4ad94ab
f23551f
4ad94ab
f23551f
 
 
 
 
 
4ad94ab
f23551f
 
4ad94ab
f23551f
4ad94ab
f23551f
 
 
 
 
 
4ad94ab
f23551f
 
 
 
 
 
 
 
 
 
 
 
 
4ad94ab
 
f23551f
33a1350
 
 
 
 
 
4ad94ab
 
f23551f
 
4ad94ab
 
 
f23551f
 
 
4ad94ab
 
f23551f
 
4ad94ab
f23551f
4ad94ab
f23551f
 
4ad94ab
f23551f
4ad94ab
 
 
 
33a1350
 
 
 
 
 
 
4ad94ab
 
 
 
 
f23551f
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
---
license: cc-by-4.0
tags:
  - reinforcement-learning
  - multi-objective
  - production-scheduling
  - attention
  - ppo
  - morl
language:
  - en
pipeline_tag: reinforcement-learning
---

# SmartFlexPack MORL: Sequential Attention Policy for Packaging Scheduling

Trained model weights for the paper:

> **Multi-Objective Reinforcement Learning for Adaptive Packaging Scheduling via Sequential Attention Policy**  
> L. Venturoso, G. Egger, F. Visentin, M. Todescato  
> Fraunhofer Italia Research EFRE1054 Smartflexpack  
> *Manuscript in preparation*

## Model description

`SeqAttentionActorCritic` (12,355 parameters) decides, for each order, between
inline printing and labelling. At each planning event a one-layer multi-head
self-attention encoder (4 heads, d=32) encodes the pending orders; for each
decision a 54→64→64 MLP combines that embedding with ten live decision features
and twelve global features, including the preference vector
`(tardiness, cost, CO2)`, and outputs two action logits and a value.

A single trained policy covers the whole trade-off: the operator sets the
preference at inference time, with no retraining.

## Results

In the reference plant configuration (3 label lines, inline 0.45 s/pack) the
policy exceeds the hypervolume of the full family of 32 realisable reference
controllers by **+0.058** (95% CI [+0.025, +0.095], about 7%), replicated on an
independent seed set (+0.050). The advantage grows with a slower inline line
(12–15% at 0.60 s/pack); with a single label line, and with the fastest inline
line, the policy ties the reference family or falls slightly below it.

## Repository structure

```
ppo/seed_{1..5}/policy_200.pt   # final PPO checkpoints (5 independent seeds)
ppo/seed_{1..5}/metrics.csv     # training metrics
bc/bc_seq_morl.pt               # behavioural-cloning warm start
configs/paper.json              # training configuration
normalisation/                  # observation and reward normalisers
inference/seq_morl/             # minimal code to load the policy
manifest.json                   # source revision and SHA-256 of every file
```

## Inference

```python
import sys, torch
from pathlib import Path
from huggingface_hub import snapshot_download

release = Path(snapshot_download("fhi/smartflexpack-morl"))
sys.path.insert(0, str(release / "inference"))
from seq_morl.policies.attention import SeqAttentionActorCritic

model = SeqAttentionActorCritic()
model.load_state_dict(torch.load(release / "ppo/seed_1/policy_200.pt",
                                 map_location="cpu", weights_only=True))
model.eval()

with torch.no_grad():
    ctx = model.encode_sequence(order_feats)              # [N, 32], pending orders
    logits, value = model.forward_single(ctx[i], extra)   # extra: 10 decision + 12 global
    action = logits.argmax(dim=-1).item()                 # 0 = inline, 1 = label
```

Simulation and evaluation: `experiments/evaluate_policy.py` in the project
repository; it also needs the separate DataGenerator.

## Training

Behavioural-cloning warm start, then 5 independent seeds of 200 PPO updates,
10 parallel episodes of 600 orders, lr=3e-4 (Adam). About 3.8 h CPU per seed.

Training code: `experiments/train_bc_warm_start.py`, `experiments/train_policy.py`

## Citation

```bibtex
@unpublished{venturoso2026morl,
  title  = {Multi-Objective Reinforcement Learning for Adaptive Packaging
            Scheduling via Sequential Attention Policy},
  author = {Venturoso, Leonardo and Egger, Georg and
            Visentin, Francesco and Todescato, Marco},
  year   = {2026},
  note   = {Manuscript in preparation}
}
```

## License

[CC BY 4.0](https://creativecommons.org/licenses/by/4.0/)
Fraunhofer Italia Research, EFRE1054 Smartflexpack project
(funded under FESR 2021–27, Priority 1 "Smart" R&I programme).