import pickle import icon as icon F=10 rkinds = ['cancel','share','property'] for rkind in rkinds: for k in range(100,500,100): for tt in range(3,10,2): t = float(tt)/10.0 for vv in range(1,11,3): v = float(vv)/10.0 for i in range(0,10): name = "r"+rkind+"f"+str(F)+"k"+str(k)+"t"+str(t)+"v"+str(v)+"i"+str(i) sim = icon.sim(F, k, t, v) pickle.dump( sim, open( "runs/"+name+".pickle", "wb" ) ) print "Done with: "+name
import icon as icon import numpy import matplotlib.pyplot as plt sim = icon.sim(25,500,0.9,1,'property') simHO = sim['ho'] simHE = sim['he'] ab_sz_HO = icon.size_by_ability(simHO['firms']) ab_sz_HE = icon.size_by_ability(simHE['firms']) nn_sz_HO = icon.size_by_nn(simHO['firms']) nn_sz_HE = icon.size_by_nn(simHE['firms']) ##### plot the sucka fig1, ((ax,cx),(bx,dx)) = plt.subplots(nrows=2, ncols=2) fig1.set_facecolor("#ffffff") ax.set_title("Homogeneous") ax.hist(icon.sizes(simHO['firms'])) ax.set_xlabel("size (knowledge uncovered)") ax.set_ylabel("frequency") bx.plot(range(0,len(simHO['progress'])),simHO['progress']) bx.set_xlabel("time") bx.set_ylabel("% discovered") cx.set_title("Heterogeneous") cx.hist(icon.sizes(simHE['firms'])) cx.set_xlabel("size (knowledge uncovered)") cx.set_ylabel("frequency") dx.plot(range(0,len(simHE['progress'])),simHE['progress']) dx.set_xlabel("time") dx.set_ylabel("% discovered")
import icon as icon import matplotlib.pyplot as plt sim1 = icon.sim(25,250,0.9,0,'cancel') sim2 = icon.sim(25,250,0.9,0,'share') sim3 = icon.sim(25,250,0.9,0,'property') #sim2 = icon.sim(25,250,0.9,0.25,rkind) #sim3 = icon.sim(25,250,0.9,0.75,rkind) #sim4 = icon.sim(25,250,0.9,1,rkind) ##### plot the sucka fig1, (ax) = plt.subplots(nrows=1, ncols=1) fig1.set_facecolor("#ffffff") ax.plot( range(0,len(sim1['ho']['progress'])),sim1['ho']['progress'], range(0,len(sim2['ho']['progress'])),sim2['ho']['progress'], range(0,len(sim3['ho']['progress'])),sim3['ho']['progress'], # range(0,len(sim2['he']['progress'])),sim2['he']['progress'], # range(0,len(sim3['he']['progress'])),sim3['he']['progress'], # range(0,len(sim4['he']['progress'])),sim4['he']['progress'], ) ax.set_xlabel("time") ax.set_ylabel("% discovered") ax.legend(('Revenue Canceling', 'Revenue Sharing','Property Rights'), 'upper left', shadow=False) plt.show()
import icon as icon import numpy import matplotlib.pyplot as plt sim = icon.sim(25, 250, 0.75, 1) simHO = sim["ho"] simHE = sim["he"] ab_pr_HO = icon.profit_by_ability(simHO["firms"]) ab_pr_HE = icon.profit_by_ability(simHE["firms"]) nn_pr_HO = icon.profit_by_nn(simHO["firms"]) nn_pr_HE = icon.profit_by_nn(simHE["firms"]) ##### plot the sucka fig1, ((ax, cx), (bx, dx)) = plt.subplots(nrows=2, ncols=2) fig1.set_facecolor("#ffffff") ax.set_title("Homogeneous") ax.hist(icon.profits(simHO["firms"])) ax.set_xlabel("profits") ax.set_ylabel("frequency") bx.plot(range(0, len(simHO["progress"])), simHO["progress"]) bx.set_xlabel("time") bx.set_ylabel("% discovered") cx.set_title("Heterogeneous") cx.hist(icon.profits(simHE["firms"])) cx.set_xlabel("profits") cx.set_ylabel("frequency") dx.plot(range(0, len(simHE["progress"])), simHE["progress"]) dx.set_xlabel("time") dx.set_ylabel("% discovered")
import icon as icon import numpy import matplotlib.pyplot as plt rkind = 'property' sim = icon.sim(50,500,0.9,1,rkind) simHO = sim['ho'] simHE = sim['he'] ab_rv_HO = icon.revenue_by_ability(simHO['firms'],rkind) ab_rv_HE = icon.revenue_by_ability(simHE['firms'],rkind) nn_rv_HO = icon.revenue_by_nn(simHO['firms'],rkind) nn_rv_HE = icon.revenue_by_nn(simHE['firms'],rkind) ##### plot the sucka fig1, ((ax,cx),(bx,dx)) = plt.subplots(nrows=2, ncols=2) fig1.set_facecolor("#ffffff") ax.set_title("Homogeneous") ax.hist(icon.revenues(simHO['firms'],rkind)) ax.set_xlabel("revenue (knowledge uncovered)") ax.set_ylabel("frequency") bx.plot(range(0,len(simHO['progress'])),simHO['progress']) bx.set_xlabel("time") bx.set_ylabel("% discovered") cx.set_title("Heterogeneous") cx.hist(icon.revenues(simHE['firms'],rkind)) cx.set_xlabel("revenue (knowledge uncovered)") cx.set_ylabel("frequency") dx.plot(range(0,len(simHE['progress'])),simHE['progress']) dx.set_xlabel("time") dx.set_ylabel("% discovered")
import icon as icon import matplotlib.pyplot as plt rkind = 'property' sim = icon.sim(25,250,0.9,-1,rkind) fig, (ax,bx) = plt.subplots(nrows=1, ncols=2) fig.set_facecolor("#ffffff") ax.set_title("Homogeneous") ax.set_xlabel("Revenues") ax.hist(icon.revenues(sim['ho']['firms'],rkind)) bx.set_title("Heterogeneous") bx.set_xlabel("Revenues") bx.hist(icon.revenues(sim['he']['firms'],rkind)) plt.show()