Atelier des rouesLab FR
Objects/Documentation

horizon25.py

Batching without knowing the last arrival · horizon25.py

Download ↓
"""Online FIFO batching with an unknown horizon of two to five consecutive arrivals."""
from functools import lru_cache
from itertools import product
import json
from glouton23 import compare
from dispersion21 import scan,primes_to

def game(delay,known=None):
    alphabet=(1,2,6);cap=known or 5;minimum=known or 2
    oracle={s:compare(s,delay)['opt'] for n in range(minimum,cap+1) for s in product(alphabet,repeat=n)}
    policy={}
    def finish(prefix,i):
        return max(prefix[i:],default=0)-oracle[prefix]
    @lru_cache(None)
    def value(prefix,i):
        if len(prefix)==cap:return finish(prefix,i)

Read in context

Comments

Comments from both language editions appear here.

The discussion is open for reading. I’ll enable submissions once spam protection is configured.