"""Reproduce only the manuscript’s explicit illustrations; no empirical effect estimation."""
import json
from pathlib import Path
rows=[]
for system,generation,minutes,accepted in [('A',.10,2,900),('B',.05,4,800)]:
 attempted=1000; reviewer_minute=.50
 model_bill=attempted*generation; review=attempted*minutes*reviewer_minute;total=model_bill+review
 rows.append(dict(system=system,attempts=attempted,generation_per_draft_gbp=generation,review_minutes_per_attempt=minutes,reviewer_minute_gbp=reviewer_minute,accepted_drafts=accepted,model_bill_gbp=model_bill,review_cost_gbp=review,total_cost_gbp=total,cost_per_accepted_draft_gbp=total/accepted))
p=.6;limit=3;unit_cost=.10
expected_attempts=sum((1-p)**j for j in range(limit))
result=dict(status='Illustrative assumptions, not observed effects or quoted prices',draft_scenarios=rows,model_bill_change_B_minus_A_gbp=rows[1]['model_bill_gbp']-rows[0]['model_bill_gbp'],workflow_cost_change_B_minus_A_gbp=rows[1]['total_cost_gbp']-rows[0]['total_cost_gbp'],review_cost_interpretation='If salaried effort is not avoidable cash spending, report capacity consumed rather than an automatic cash saving.',retry_scenario=dict(success_probability_per_attempt=p,maximum_attempts=limit,independent_attempts_assumed=True,perfect_success_detector_assumed=True,cost_per_attempt_gbp=unit_cost,probability_of_at_least_one_success=1-(1-p)**limit,expected_attempts=expected_attempts,expected_generation_cost_per_initial_task_gbp=expected_attempts*unit_cost))
assert [r['total_cost_gbp'] for r in rows]==[1100,2050]
assert round(result['retry_scenario']['probability_of_at_least_one_success'],3)==.936
assert round(expected_attempts,2)==1.56

Path(__file__).with_name('results.json').write_text(json.dumps(result, indent=2, ensure_ascii=False)+'\n')
