"""Illustrative policy counts, not model predictions or empirical results."""
POLICIES={'A':{'tp':6,'fn':2,'fp':1,'tn':11},'B':{'tp':8,'fn':0,'fp':4,'tn':8}}
def evaluate(c,miss_cost=20,extra_route_cost=1):
    total=sum(c.values())
    return {'count':total,'accuracy':(c['tp']+c['tn'])/total,
            'critical_recall':c['tp']/(c['tp']+c['fn']),
            'priority_slots':c['tp']+c['fp'],
            'illustrative_cost':c['fn']*miss_cost+c['fp']*extra_route_cost}
if __name__=='__main__':
    a=evaluate(POLICIES['A']);b=evaluate(POLICIES['B'])
    assert a==dict(count=20,accuracy=.85,critical_recall=.75,priority_slots=7,illustrative_cost=41)
    assert b==dict(count=20,accuracy=.8,critical_recall=1.0,priority_slots=12,illustrative_cost=4)
    assert evaluate(POLICIES['A'],miss_cost=1)['illustrative_cost']==3
    assert evaluate(POLICIES['B'],miss_cost=1)['illustrative_cost']==4
    assert b['priority_slots']>10 and a['priority_slots']<=10
    for name,c in POLICIES.items():print(name,c,evaluate(c))
    print('5/5 assertions passed. Counts and cost units are invented teaching inputs, not client or model results.')
