Atelier des rouesLab FR
Objects/Documentation

horizon33.py

Unavoidable regret at long horizons · horizon33.py

Download ↓
"""A horizon-uniform lower bound from two streams with an indistinguishable first choice."""
from fractions import Fraction as F
from hasard27 import schedules
import json
def forced(s):
    d=[0]*(len(s)+2)
    for i in reversed(range(len(s))):
        d[i]=s[i]+d[i+1]
        if i+1<len(s):d[i]=min(d[i],max(s[i:i+2])+d[i+2])
    return [s[0]+d[1]-d[0],max(s[:2])+d[2]-d[0]]
def study():
    rows=[]
    for n in range(4,129):
        streams=[(2,6,z)+(1,)*(n-3) for z in (1,6)]
        pay=[forced(s) for s in streams]
        assert pay==([[1,0],[0,4]] if n%2 else [[2,0],[0,3]])

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.