Lawfare Group → Knowledge Institute → Lawfare Academy
Reproduce the original MBA program integration case
Copy the complete Python 3 code into a UTF-8 file and run it with Python 3. Standard library only, synthetic amounts, no network or learner records. The code independently constructs dated baseline/project cash and enumerates feasible choices; a passing calculation is not independent subject review, actual company evidence or observed learner competence.
"""MBA program synthesis: original synthetic case; no network or learner records."""
from fractions import Fraction as F
from itertools import product
from math import isclose
import json
checks=[]
def eq(name,x,y):
assert isclose(float(x),float(y),rel_tol=1e-9,abs_tol=1e-5),(name,x,y)
checks.append(dict(case=name,value=float(x),expected=float(y)))
d=F(10,11);a=d+d*d+d**3
eq('baseline profit',100*(300-180)-8000,4000)
eq('month one cash',F(3,5)*30000-18000-8000,-8000)
eq('month two receivable',F(2,5)*30000,12000)
eq('cycle total cash',-8000+12000,4000)
eq('separate retained pilot',35*120-2000,2200)
eq('pilot unrecovered support',2200-5*30,2050)
I=7*a-12
def S(p):return (4+12*p)*a+5*d**3-30
eq('improvement value',I,5.40796393689)
eq('scale expected value p.6',S(F(3,5)),1.609316303531)
eq('scale low state',S(0),-16.296018031555)
eq('scale high state',S(1),13.546205860255)
eq('scale p.8',S(F(4,5)),7.577761081893)
eq('expected-value crossover',(I+30-5*d**3-4*a)/(12*a),.727291037261)
eq('delayed improvement fixed horizon',7*(d*d+d**3)-12,-.955672426747)
def flows(action,state,delay=False,collection=F(3,5)):
initial={'I':-12,'S':-30,'wait':0}[action]
# Common baseline cycle is actual enterprise cash, not an incremental project benefit.
events=[(0,initial),(F(1,12),30*collection-26),(F(2,12),30*(1-collection))]
if action=='I':events += [(t,7) for t in ([2,3] if delay else [1,2,3])]
elif action=='S':events += [(1,16 if state=='H' else 4),(2,16 if state=='H' else 4),(3,(16 if state=='H' else 4)+5)]
return events
def cash(opening,events):
out=[]
for t in sorted(set(t for t,_ in events)):
opening+=sum(c for date,c in events if date==t);out.append((str(t),float(opening)))
return out
def feasible(action,opening,delay=False,collection=F(3,5)):
return all(v>=10 for st in ['H','L'] for _,v in cash(opening,flows(action,st,delay,collection)))
def pv(events):return sum(float(c)/(1.1**float(t)) for t,c in events)
baseline=pv(flows('wait','H'))
def independent_value(action,p,delay=False):
return float(p)*pv(flows(action,'H',delay))+(1-float(p))*pv(flows(action,'L',delay))-baseline
for action,value in [('I',I),('S',S(F(3,5))),('wait',0)]:eq('independent dated incremental '+action,independent_value(action,F(3,5)),value)
def best(opening,p,delay=False):
return max((independent_value(action,p,delay),action) for action in ['I','S','wait'] if feasible(action,opening,delay))[1]
assert best(30,F(3,5))=='I' and best(48,F(3,5))=='I'
assert best(30,F(4,5))=='I' and best(48,F(4,5))=='S'
assert best(30,F(3,5),True)=='wait'
assert feasible('I',30) and not feasible('S',30) and feasible('S',48)
assert min(v for _,v in cash(30,flows('I','L')))==10
assert min(v for _,v in cash(48,flows('S','L')))==10
assert not feasible('I',30,collection=F(1,2))
assert min(v for _,v in cash(30,flows('I','L',collection=F(1,2))))==7
assert len(list(product(range(2),range(3),range(2),range(2),range(6))))==144
print(json.dumps(dict(passed=True,checks=checks,independentChecks=['dated baseline and project streams constructed separately','baseline cash retained for enterprise reserve but cancelled from incremental valuation','all feasible I/S/wait alternatives evaluated under original, changed probability and delay','reserve checked at every date in both states','144 valid choice combinations enumerated'],learnerRecordsAccessed=False,boundary='Conditional synthetic model checks; no actual company evidence, authority, finance, independent subject review or observed competence established.'),indent=2))
Program guide, full explanations, optional practice and rubric