La Golosa is a chain of ice cream shops in and around Parma: three stores, around twenty staff, and a production lab sized to supply up to seven shops. Every week the owners rebuilt the rota by hand, juggling availability, seasonal opening hours, contract hours and cost on paper.
I built them a system that handles scheduling and accounting in one place. Scheduling is the hard part: open seven days a week with hours that change by season and by shop, three kinds of contract, fixed rest days, overtime only for the people allowed it, and the lab running a fixed morning shift six days a week. The app generates a draft week, the manager edits and publishes it, and each person sees only their own shifts.
Underneath it is a multi-pass heuristic. It builds the shifts each shop needs from its opening hours, reserves the people who can work anywhere for the stores that would otherwise be left short, fills the evening peak first, and relaxes constraints in stages before it admits a shift is uncovered. It runs around forty seeded variants of the week and keeps the best scoring one, where leaving a shop uncovered costs far more than an hour of overtime, and it reads the last four published weeks so the same people do not always get the closing shifts.
I am not an engineer: I knew the problem well enough to specify it, and Claude Code wrote it. They run the shops on it now.
La Golosa è una catena di gelaterie a Parma e provincia: tre negozi, una ventina di persone e un laboratorio di produzione dimensionato per servirne fino a sette. Ogni settimana i titolari rifacevano i turni a mano, incrociando disponibilità, orari stagionali, ore di contratto e costi sulla carta.
Ho costruito un sistema che gestisce turni e contabilità in un unico posto. La parte difficile sono i turni: apertura sette giorni su sette con orari che cambiano per stagione e per negozio, tre tipi di contratto, riposi fissi, straordinari solo per chi è abilitato, e il laboratorio con un turno fisso al mattino sei giorni su sette. L'app genera una bozza di settimana, il gestore la corregge e la pubblica, e ognuno vede solo i propri turni.
Sotto c'è un'euristica a più passate. Costruisce i turni che servono a ogni negozio a partire dagli orari di apertura, riserva le persone che possono lavorare ovunque ai punti vendita che altrimenti resterebbero scoperti, riempie prima il picco della sera e allenta i vincoli per gradi prima di dichiarare un turno scoperto. Genera una quarantina di varianti della settimana e tiene quella con il punteggio migliore, dove lasciare un negozio scoperto costa molto più di un'ora di straordinario, e legge le ultime quattro settimane pubblicate perché le chiusure non tocchino sempre alle stesse persone.
Non sono un programmatore: conoscevo il problema abbastanza bene da saperlo specificare, e Claude Code ha scritto il codice. Oggi ci gestiscono i negozi.