Lawfare Group → Knowledge Institute → Lawfare Academy

Reproduce the worked examples

Copy the complete code below into a UTF-8 file named verify.py and run python verify.py with Python 3. It uses only the standard library and performs exact or rational synthetic calculations. It does not access a network or learner records. Assertions fail if the expected synthetic results change.

These checks verify the stated arithmetic and query behavior, not independent academic acceptance or production migration safety.

"""Mosaic synthetic strategic alternatives; no market or investment forecast."""
from fractions import Fraction as F
import json
checks={}
def check(n,a,b):
 assert a==b,(n,a,b)
 checks[n]=str(a)
hours=600
def alternative(price,variable,fixed,demand,time):
 capacity=int(F(hours)/time)
 quantity=min(capacity,demand)
 return capacity,quantity,quantity*(price-variable)-fixed
check('routine alternative',alternative(100,60,20000,1000,F(1,2)),(1200,1000,20000))
check('specialist alternative',alternative(180,100,30000,600,F(6,5)),(500,500,10000))
check('routine demand hours',1000*F(1,2),500)
check('specialist demand hours',600*F(6,5),720)
check('specialist unmet hour demand',720-hours,120)
check('routine break even',F(20000,40),500)
check('specialist break even',F(30000,80),375)
check('routine contribution per hour',40/F(1,2),80)
check('specialist contribution per hour',80/F(6,5),F(200,3))
check('infeasible specialist paper result',600*80-30000,18000)
check('conditional higher specialist price',alternative(220,100,30000,600,F(6,5)),(500,500,30000))
check('matching routine result price',100+F(20000+30000,500),200)
check('routine lower demand',alternative(100,60,20000,800,F(1,2)),(1200,800,12000))
check('specialist lower demand',alternative(180,100,30000,480,F(6,5)),(500,480,8400))
check('lower specialist demand hours',480*F(6,5),576)
check('incremental operating working capital',20000+10000-8000,22000)
check('specified incremental funding uses',22000+15000,37000)
check('execution extra initiative shortage',500*F(6,5)+60-hours,60)
pilot_time=F(30,20)
check('synthetic pilot hours per order',pilot_time,F(3,2))
check('pilot revised specialist result',alternative(180,100,30000,600,pilot_time),(400,400,2000))
check('pilot revised higher price result',alternative(220,100,30000,600,pilot_time),(400,400,18000))
assert 18000<20000
print(json.dumps(dict(passed=True,checks=checks,limits='Synthetic mutually exclusive alternatives only. Qualified hours, demand and prices are assumptions, not estimates of actual willingness to pay, market demand or competitive advantage. The pilot is not a population estimate. Partial operating working capital and specified funding uses are not complete cash forecasts. Independent subject review and observed learner testing remain pending.'),indent=2))

Related chapters