In [1]:
import numpy as np
%matplotlib inline
import matplotlib as mpl
import matplotlib.pyplot as plt
import matplotlib.patches as mpatches
mpl.rc('font', family='serif', size=11)
mpl.rc('savefig', bbox='tight')

import dtw
import worg

make_fname_safe = lambda s: s.lower().replace(' ', '-')


/home/scopatz/miniconda/lib/python3.5/importlib/_bootstrap.py:222: QAWarning: pyne.data is not yet QA compliant.
  return f(*args, **kwds)
/home/scopatz/miniconda/lib/python3.5/importlib/_bootstrap.py:222: QAWarning: pyne.material is not yet QA compliant.
  return f(*args, **kwds)
/home/scopatz/miniconda/lib/python3.5/importlib/_bootstrap.py:222: QAWarning: pyne.enrichment is not yet QA compliant.
  return f(*args, **kwds)

In [2]:
T = 50
seed = 424242
verbose = True
f = 90 * (1.01**np.arange(T))  # 1% growth
g0 = np.zeros(T, dtype='f8')    # zero production
N = np.asarray(np.ceil(4*(1.01)**np.arange(T)), dtype=int)

DTW


In [3]:
def display_dwt(dist, cost, path, xname, yname, offset=2016, vmax=None):
    fig = plt.figure(figsize=(8, 6))
    extent = (offset, offset+cost.shape[1], offset, offset+cost.shape[0])
    plt.imshow(cost[::-1], cmap='viridis', extent=extent, vmin=0.0, vmax=vmax)
    u = offset + np.concatenate([path, np.array([[cost.shape[1]], [cost.shape[0]]])], axis=1)
    plt.plot(u[1], u[0], 'w-')
    plt.axis(extent)
    cb = plt.colorbar()
    cb.set_label('Cost [GWe]', rotation=-90, va='bottom')
    plt.xlabel('time [year]')
    plt.ylabel('time [year]')
    fname = 'cost-{0}-to-{1}'.format(make_fname_safe(xname), make_fname_safe(yname))
    plt.savefig(fname + '.png')
    plt.savefig(fname + '.eps')
    print('Warping between {0} and {1}:'.format(xname, yname))
    print('  Distance is ', dist)

In [4]:
p = np.empty(T, dtype='f8')
p[:T//2] = f[:T//2] * 0.95
p[T//2:] = f[T//2:] * 1.05
dist, cost, path = dtw.dtw(f[:,np.newaxis], p[:,np.newaxis])
display_dwt(dist, cost, path, 'Demand', 'Production')


Warping between Demand and Production:
  Distance is  0.755990232857

GP


In [5]:
def model_plot(t, y, yerr, tpred, mu, std, title=None, ymax=None):
    fig = plt.figure(figsize=(8, 8))
    #plt.errorbar(t, y, yerr, fmt='r.', label='training data')
    plt.plot(t, y, 'r.', label='training data')
    plt.plot(tpred, mu, 'k-', label='model')
    plt.fill_between(tpred, mu - 2*std, mu + 2*std, color='gray')
    ax = plt.axis()
    plt.axis([tpred[0], tpred[-1], 0.0, ymax or ax[3]])
    plt.legend(loc=0)
    plt.xlabel('time [year]')
    plt.ylabel('Power Production [GWe]')
    if title:
        plt.title(title)
    fbase = 'gwe-model-' + (title or '').lower().replace(' ', '-')
    plt.savefig(fbase + '.eps')
    plt.savefig(fbase + '.png')

In [6]:
tol = 1e-1
q = np.empty(T, dtype='f8')
q[:T//2] = f[:T//2] * 0.9
q[T//2:] = f[T//2:] * 1.1
gp, x, y = worg.gp_gwe([N, N], [f, q], T, tol, N)
mu, cov = gp.predict(y, x[:T])
std = np.sqrt(np.diag(cov))
model_plot(x[:,0]+2016, y, 0.0, x[:T,0] + 2016, mu, std)


Optimizations


In [7]:
T = 20

def run_percent_growth(rate, f0=90.0, N0=10, T=T, seed=seed, verbose=verbose, **kwargs):
    r = 1.0 + (rate/100.0)
    tgrid = np.arange(T)
    f = f0 * (r**tgrid)
    N = np.asarray(np.ceil(N0*(r**tgrid)), dtype=int)
    state = worg.optimize(f, N, seed=seed, verbose=verbose, **kwargs)
    return state

In [8]:
%time state0sto = run_percent_growth(0, MAX_S=20, method_0='stochastic')


Simulation 3
------------
SimId 2310b8e0-58d8-4f13-9c55-e27833aac440
hyperparameters: [ 8.2593187   4.52500623]
Estimate method is 'stochastic'
Estimate winner is 'stochastic'
Estimate time:   0.0 min 0.9735634326934814 sec
Simulation time: 0.0 min 4.129423141479492 sec
D_s: 3.1791666666666365
D: [3.1791666666666365, 9.8083333333332412]

Simulation 4
------------
SimId fc392745-4522-45d9-ae4f-5548bc6a2729
hyperparameters: [ 5.08301056  3.40378271]
Estimate method is 'stochastic'
Estimate winner is 'stochastic'
Estimate time:   0.0 min 0.9823391437530518 sec
Simulation time: 0.0 min 4.878907680511475 sec
D_s: 5.937499999999323
D: [3.1791666666666365, 5.9374999999993232]

Simulation 5
------------
SimId 25bc55eb-5c57-41f3-85fe-1fee24621696
hyperparameters: [ 4.66739622  2.47710559]
Estimate method is 'stochastic'
Estimate winner is 'stochastic'
Estimate time:   0.0 min 1.020625114440918 sec
Simulation time: 0.0 min 4.770863056182861 sec
D_s: 2.0187499999999607
D: [2.0187499999999607, 3.1791666666666365]

Simulation 6
------------
SimId df94f645-8eda-4d8b-8223-a922dd226423
hyperparameters: [ 3.67792046  2.17788204]
Estimate method is 'stochastic'
Estimate winner is 'stochastic'
Estimate time:   0.0 min 0.9859230518341064 sec
Simulation time: 0.0 min 5.370298385620117 sec
D_s: 5.218749999999364
D: [2.0187499999999607, 3.1791666666666365, 5.2187499999993641]

Simulation 7
------------
SimId 552d56de-8925-47ed-813d-c147a4c2054b
hyperparameters: [ 4.24622772  2.52204355]
Estimate method is 'stochastic'
Estimate winner is 'stochastic'
Estimate time:   0.0 min 1.0042762756347656 sec
Simulation time: 0.0 min 5.699247598648071 sec
D_s: 2.8687499999996486
D: [2.0187499999999607, 2.8687499999996486]

Simulation 8
------------
SimId b8957f9e-dedb-48f3-a1dd-9c4e6f8d33af
hyperparameters: [ 3.87035802  2.50578992]
Estimate method is 'stochastic'
Estimate winner is 'stochastic'
Estimate time:   0.0 min 0.9333245754241943 sec
Simulation time: 0.0 min 6.484321594238281 sec
D_s: 6.537499999999251
D: [2.0187499999999607, 2.8687499999996486, 6.5374999999992509]

Simulation 9
------------
SimId a094b9b0-0bd0-4c34-b72e-997511f4ce34
hyperparameters: [ 4.34444776  2.68983055]
Estimate method is 'stochastic'
Estimate winner is 'stochastic'
Estimate time:   0.0 min 0.9998979568481445 sec
Simulation time: 0.0 min 7.099883079528809 sec
D_s: 2.7687499999996543
D: [2.0187499999999607, 2.7687499999996543]

Simulation 10
-------------
SimId 35c42849-d260-48be-84bd-15056ab65bb5
hyperparameters: [ 3.6530328   2.24439393]
Estimate method is 'stochastic'
Estimate winner is 'stochastic'
Estimate time:   0.0 min 1.4858763217926025 sec
Simulation time: 0.0 min 7.596681594848633 sec
D_s: 1.6791666666663077
D: [1.6791666666663077, 2.0187499999999607]

Simulation 11
-------------
SimId 713fc8cd-53f6-40d8-8d66-7ba57afc0e11
hyperparameters: [ 3.12982239  1.403103  ]
Estimate method is 'stochastic'
Estimate winner is 'stochastic'
Estimate time:   0.0 min 1.0220792293548584 sec
Simulation time: 0.0 min 7.810549974441528 sec
D_s: 6.42708333333263
D: [1.6791666666663077, 2.0187499999999607, 6.4270833333326296]

Simulation 12
-------------
SimId 9d49cd89-ba6b-4acb-af34-092c84655d87
hyperparameters: [ 4.13745613  2.1826372 ]
Estimate method is 'stochastic'
Estimate winner is 'stochastic'
Estimate time:   0.0 min 0.9677920341491699 sec
Simulation time: 0.0 min 8.249690294265747 sec
D_s: 2.6187499999995123
D: [1.6791666666663077, 2.0187499999999607]

Simulation 13
-------------
SimId 18bb11c4-41a1-4b47-89be-125514bb6b94
hyperparameters: [ 3.12982239  1.403103  ]
Estimate method is 'stochastic'
Estimate winner is 'stochastic'
Estimate time:   0.0 min 1.0493319034576416 sec
Simulation time: 0.0 min 8.93699598312378 sec
D_s: 7.668749999999224
D: [1.6791666666663077, 2.0187499999999607, 7.6687499999992239]

Simulation 14
-------------
SimId 1c29a73d-24b4-4546-975f-6dd398e0d21a
hyperparameters: [ 4.5754542   2.44869253]
Estimate method is 'stochastic'
Estimate winner is 'stochastic'
Estimate time:   0.0 min 1.0204710960388184 sec
Simulation time: 0.0 min 9.119876861572266 sec
D_s: 2.270833333332903
D: [1.6791666666663077, 2.0187499999999607]

Simulation 15
-------------
SimId 81062bbe-f5b8-41e5-966e-acc57afca921
hyperparameters: [ 3.12982239  1.403103  ]
Estimate method is 'stochastic'
Estimate winner is 'stochastic'
Estimate time:   0.0 min 0.9701499938964844 sec
Simulation time: 0.0 min 9.43292760848999 sec
D_s: 6.670833333332614
D: [1.6791666666663077, 2.0187499999999607, 6.670833333332614]

Simulation 16
-------------
SimId feb18af6-81c5-41bf-9fd4-ffd259ff29ad
hyperparameters: [ 4.28850264  2.08388412]
Estimate method is 'stochastic'
Estimate winner is 'stochastic'
Estimate time:   0.0 min 0.9557955265045166 sec
Simulation time: 0.0 min 10.07266616821289 sec
D_s: 2.0250000000000354
D: [1.6791666666663077, 2.0187499999999607]

Simulation 17
-------------
SimId 171cab21-361b-4816-892b-2ebd46d1d46c
hyperparameters: [ 3.12982239  1.403103  ]
Estimate method is 'stochastic'
Estimate winner is 'stochastic'
Estimate time:   0.0 min 0.9504055976867676 sec
Simulation time: 0.0 min 10.453755855560303 sec
D_s: 7.270833333332544
D: [1.6791666666663077, 2.0187499999999607, 7.2708333333325443]

Simulation 18
-------------
SimId 4cb25b88-0ec9-417a-8215-0b3489ff05bb
hyperparameters: [ 4.52311364  2.55600463]
Estimate method is 'stochastic'
Estimate winner is 'stochastic'
Estimate time:   0.0 min 0.9654035568237305 sec
Simulation time: 0.0 min 11.176365852355957 sec
D_s: 2.3437499999995657
D: [1.6791666666663077, 2.0187499999999607]

Simulation 19
-------------
SimId 9fbe873a-ab91-4675-9965-60254879d637
hyperparameters: [ 3.12982239  1.403103  ]
Estimate method is 'stochastic'
Estimate winner is 'stochastic'
Estimate time:   0.0 min 0.9390275478363037 sec
Simulation time: 0.0 min 11.604553699493408 sec
D_s: 5.764583333332666
D: [1.6791666666663077, 2.0187499999999607, 5.7645833333326664]

Simulation 20
-------------
SimId 3b817ab5-da0f-4a34-bb40-405b530a3230
hyperparameters: [ 4.17882085  2.21637221]
Estimate method is 'stochastic'
Estimate winner is 'stochastic'
Estimate time:   0.0 min 0.9887435436248779 sec
Simulation time: 0.0 min 11.914319515228271 sec
D_s: 1.658333333333013
D: [1.658333333333013, 1.6791666666663077]

CPU times: user 26.2 s, sys: 5.88 s, total: 32.1 s
Wall time: 2min 50s

In [9]:
%time state0inn = run_percent_growth(0, MAX_S=20, method_0='inner-prod')


Simulation 3
------------
SimId d0aa25f0-dc17-4426-bbcd-d5df7952bf3d
hyperparameters: [ 8.2593187   4.52500623]
Estimate method is 'inner-prod'
Estimate winner is 'inner-prod'
Estimate time:   0.0 min 0.3671538829803467 sec
Simulation time: 0.0 min 3.881606340408325 sec
D_s: 3.4541666666666964
D: [3.4541666666666964, 9.8083333333332412]

Simulation 4
------------
SimId 1c58f1c6-3002-4bef-8182-e43cd1e464b5
hyperparameters: [ 4.96939389  3.35689812]
Estimate method is 'inner-prod'
Estimate winner is 'inner-prod'
Estimate time:   0.0 min 0.453777551651001 sec
Simulation time: 0.0 min 4.295544385910034 sec
D_s: 2.1250000000000298
D: [2.1250000000000298, 3.4541666666666964]

Simulation 5
------------
SimId 694d04fc-72df-4c7f-81c5-766e709a5f48
hyperparameters: [ 3.13957111  1.93044129]
Estimate method is 'inner-prod'
Estimate winner is 'inner-prod'
Estimate time:   0.0 min 0.3632781505584717 sec
Simulation time: 0.0 min 4.716221809387207 sec
D_s: 2.002083333333408
D: [2.0020833333334078, 2.1250000000000298]

Simulation 6
------------
SimId 0e709e2d-2b94-4de2-862b-37adbb3ad6d3
hyperparameters: [ 2.8217364   1.82838763]
Estimate method is 'inner-prod'
Estimate winner is 'inner-prod'
Estimate time:   0.0 min 0.363358736038208 sec
Simulation time: 0.0 min 5.227883815765381 sec
D_s: 1.729166666666267
D: [1.7291666666662671, 2.0020833333334078]

Simulation 7
------------
SimId 0d2406a9-f7be-4493-b222-31f612162ac7
hyperparameters: [ 2.93583636  1.81901889]
Estimate method is 'inner-prod'
Estimate winner is 'inner-prod'
Estimate time:   0.0 min 0.3809380531311035 sec
Simulation time: 0.0 min 6.409487724304199 sec
D_s: 27.277083333333376
D: [1.7291666666662671, 2.0020833333334078, 27.277083333333376]

Simulation 8
------------
SimId 5c4a5800-f1a5-4ea7-95be-ccc119bc4455
hyperparameters: [ 6.6405802  3.6737091]
Estimate method is 'inner-prod'
Estimate winner is 'inner-prod'
Estimate time:   0.0 min 0.3763725757598877 sec
Simulation time: 0.0 min 6.173323392868042 sec
D_s: 1.631249999999945
D: [1.631249999999945, 1.7291666666662671]

Simulation 9
------------
SimId 3df4020b-a351-4887-a293-e9b89da48fd2
hyperparameters: [ 2.68084675  1.61259842]
Estimate method is 'inner-prod'
Estimate winner is 'inner-prod'
Estimate time:   0.0 min 0.3600924015045166 sec
Simulation time: 0.0 min 7.501947402954102 sec
D_s: 27.26458333333337
D: [1.631249999999945, 1.7291666666662671, 27.26458333333337]

Simulation 10
-------------
SimId 187b8bc0-1ad4-4aa6-b90e-cd40c9554407
hyperparameters: [ 6.59620021  3.64608151]
Estimate method is 'inner-prod'
Estimate winner is 'inner-prod'
Estimate time:   0.0 min 0.41999101638793945 sec
Simulation time: 0.0 min 7.51093316078186 sec
D_s: 1.5083333333332476
D: [1.5083333333332476, 1.631249999999945]

Simulation 11
-------------
SimId 62cf24a9-4987-4df6-8e1d-ed52a1d2c43e
hyperparameters: [ 2.65131211  1.59593753]
Estimate method is 'inner-prod'
Estimate winner is 'inner-prod'
Estimate time:   0.0 min 0.3719964027404785 sec
Simulation time: 0.0 min 8.631904363632202 sec
D_s: 31.8333333333339
D: [1.5083333333332476, 1.631249999999945, 31.833333333333901]

Simulation 12
-------------
SimId dd01b58f-f782-49e9-b3c6-e0dd3df20b95
hyperparameters: [ 7.13130754  4.04250859]
Estimate method is 'inner-prod'
Estimate winner is 'inner-prod'
Estimate time:   0.0 min 0.4264707565307617 sec
Simulation time: 0.0 min 8.258379697799683 sec
D_s: 1.6145833333332038
D: [1.5083333333332476, 1.6145833333332038]

Simulation 13
-------------
SimId 105ef8e1-c4cf-47eb-90e0-0ec25f33f3b1
hyperparameters: [ 2.57600012  1.58895657]
Estimate method is 'inner-prod'
Estimate winner is 'inner-prod'
Estimate time:   0.0 min 0.364732027053833 sec
Simulation time: 0.0 min 9.637608289718628 sec
D_s: 31.8333333333339
D: [1.5083333333332476, 1.6145833333332038, 31.833333333333901]

Simulation 14
-------------
SimId 26e68c8b-06c2-4ad9-9c3f-f039568d817a
hyperparameters: [ 7.16549618  4.07830779]
Estimate method is 'inner-prod'
Estimate winner is 'inner-prod'
Estimate time:   0.0 min 0.4117748737335205 sec
Simulation time: 0.0 min 9.683343887329102 sec
D_s: 2.681249999999471
D: [1.5083333333332476, 1.6145833333332038]

Simulation 15
-------------
SimId d5755945-becd-467c-8c34-7a021642a50f
hyperparameters: [ 2.57600012  1.58895657]
Estimate method is 'inner-prod'
Estimate winner is 'inner-prod'
Estimate time:   0.0 min 0.3723301887512207 sec
Simulation time: 0.0 min 11.07240343093872 sec
D_s: 31.8333333333339
D: [1.5083333333332476, 1.6145833333332038, 31.833333333333901]

Simulation 16
-------------
SimId 8c70a404-5b97-44ae-a131-988d831425bc
hyperparameters: [ 7.16549618  4.07830779]
Estimate method is 'inner-prod'
Estimate winner is 'inner-prod'
Estimate time:   0.0 min 0.4462413787841797 sec
Simulation time: 0.0 min 10.660371780395508 sec
D_s: 2.681249999999471
D: [1.5083333333332476, 1.6145833333332038]

Simulation 17
-------------
SimId 33897946-e273-432f-b8cd-a108e446e61b
hyperparameters: [ 2.57600012  1.58895657]
Estimate method is 'inner-prod'
Estimate winner is 'inner-prod'
Estimate time:   0.0 min 0.370739221572876 sec
Simulation time: 0.0 min 13.79794955253601 sec
D_s: 31.8333333333339
D: [1.5083333333332476, 1.6145833333332038, 31.833333333333901]

Simulation 18
-------------
SimId cc2041a5-a007-4949-b95b-164a806fe9e7
hyperparameters: [ 7.16549618  4.07830779]
Estimate method is 'inner-prod'
Estimate winner is 'inner-prod'
Estimate time:   0.0 min 0.44690942764282227 sec
Simulation time: 0.0 min 12.028872013092041 sec
D_s: 2.681249999999471
D: [1.5083333333332476, 1.6145833333332038]

Simulation 19
-------------
SimId 8d80af68-5f34-42ad-9cc7-5e070adbda59
hyperparameters: [ 2.57600012  1.58895657]
Estimate method is 'inner-prod'
Estimate winner is 'inner-prod'
Estimate time:   0.0 min 0.3821418285369873 sec
Simulation time: 0.0 min 13.150604724884033 sec
D_s: 31.8333333333339
D: [1.5083333333332476, 1.6145833333332038, 31.833333333333901]

Simulation 20
-------------
SimId 6ff1c950-e091-4db1-afc5-dbc48729559f
hyperparameters: [ 7.16549618  4.07830779]
Estimate method is 'inner-prod'
Estimate winner is 'inner-prod'
Estimate time:   0.0 min 0.40644383430480957 sec
Simulation time: 0.0 min 12.962196350097656 sec
D_s: 2.681249999999471
D: [1.5083333333332476, 1.6145833333332038]

CPU times: user 16.2 s, sys: 6.55 s, total: 22.7 s
Wall time: 2min 49s

In [10]:
%time state0all = run_percent_growth(0, MAX_S=20, method_0='all')


Simulation 3
------------
SimId 4641035b-6bf5-414a-b529-7eb39f1a0d54
hyperparameters: [ 8.2593187   4.52500623]
Estimate method is 'all'
Estimate winner is 'inner-prod'
Estimate time:   0.0 min 1.2169685363769531 sec
Simulation time: 0.0 min 3.781930923461914 sec
D_s: 3.4541666666666964
D: [3.4541666666666964, 9.8083333333332412]

Simulation 4
------------
SimId 1f546da2-95e9-4ac3-9140-914368cd5584
hyperparameters: [ 4.96939389  3.35689812]
Estimate method is 'all'
Estimate winner is 'inner-prod'
Estimate time:   0.0 min 1.261075496673584 sec
Simulation time: 0.0 min 4.446516752243042 sec
D_s: 2.1250000000000298
D: [2.1250000000000298, 3.4541666666666964]

Simulation 5
------------
SimId e3303f8c-33fc-493e-912f-0c3e2cf8ef0c
hyperparameters: [ 3.13957111  1.93044129]
Estimate method is 'stochastic'
Estimate winner is 'stochastic'
Estimate time:   0.0 min 0.9203791618347168 sec
Simulation time: 0.0 min 4.719269037246704 sec
D_s: 3.9145833333327347
D: [2.1250000000000298, 3.4541666666666964, 3.9145833333327347]

Simulation 6
------------
SimId b19522a0-eded-4c5b-9e71-53338ceba6ba
hyperparameters: [ 3.63163595  2.16549431]
Estimate method is 'stochastic'
Estimate winner is 'stochastic'
Estimate time:   0.0 min 1.049300193786621 sec
Simulation time: 0.0 min 5.293240785598755 sec
D_s: 1.07916666666653
D: [1.0791666666665301, 2.1250000000000298]

Simulation 7
------------
SimId 57500e1a-e60e-42de-8e35-285c6db1c4eb
hyperparameters: [ 2.56912506  1.08388427]
Estimate method is 'all'
Estimate winner is 'stochastic'
Estimate time:   0.0 min 1.255953311920166 sec
Simulation time: 0.0 min 5.949360609054565 sec
D_s: 6.514583333332624
D: [1.0791666666665301, 2.1250000000000298, 6.5145833333326237]

Simulation 8
------------
SimId 7de67a7b-9380-48e7-8c5d-cda34aaf3428
hyperparameters: [ 4.01165459  2.02726624]
Estimate method is 'all'
Estimate winner is 'inner-prod'
Estimate time:   0.0 min 1.3090946674346924 sec
Simulation time: 0.0 min 6.169275760650635 sec
D_s: 0.9437500000000594
D: [0.94375000000005937, 1.0791666666665301]

Simulation 9
------------
SimId c9ea9435-a48f-4e1b-ba5f-82cb08abb0e2
hyperparameters: [ 1.75751531  0.1305406 ]
Estimate method is 'stochastic'
Estimate winner is 'stochastic'
Estimate time:   0.0 min 0.9559547901153564 sec
Simulation time: 0.0 min 7.103079080581665 sec
D_s: 12.968749999998938
D: [0.94375000000005937, 1.0791666666665301, 12.968749999998938]

Simulation 10
-------------
SimId 2c3ed4e2-1d02-4125-acf4-88f14bfb1419
hyperparameters: [ 5.16377366  2.71094837]
Estimate method is 'stochastic'
Estimate winner is 'stochastic'
Estimate time:   0.0 min 0.9894607067108154 sec
Simulation time: 0.0 min 7.0420591831207275 sec
D_s: 2.843750000000102
D: [0.94375000000005937, 1.0791666666665301]

Simulation 11
-------------
SimId 83039970-0be7-4600-aad2-da9caeb4140b
hyperparameters: [ 1.75751531  0.1305406 ]
Estimate method is 'all'
Estimate winner is 'stochastic'
Estimate time:   0.0 min 1.2800097465515137 sec
Simulation time: 0.0 min 7.904274940490723 sec
D_s: 5.308333333332693
D: [0.94375000000005937, 1.0791666666665301, 5.3083333333326932]

Simulation 12
-------------
SimId 2a3062b7-86fb-4bb5-a313-de5a7d5a7630
hyperparameters: [ 3.77142883  1.84334598]
Estimate method is 'all'
Estimate winner is 'inner-prod'
Estimate time:   0.0 min 1.3825056552886963 sec
Simulation time: 0.0 min 8.375672340393066 sec
D_s: 1.6749999999996035
D: [0.94375000000005937, 1.0791666666665301]

Simulation 13
-------------
SimId 862fed28-2e53-491f-a69f-5183455cc549
hyperparameters: [ 1.75751531  0.1305406 ]
Estimate method is 'stochastic'
Estimate winner is 'stochastic'
Estimate time:   0.0 min 0.9570748805999756 sec
Simulation time: 0.0 min 9.398599863052368 sec
D_s: 4.952083333332713
D: [0.94375000000005937, 1.0791666666665301, 4.9520833333327134]

Simulation 14
-------------
SimId 3cd95600-b726-4434-8365-ae4323158fd6
hyperparameters: [ 3.66380693  1.25576436]
Estimate method is 'stochastic'
Estimate winner is 'stochastic'
Estimate time:   0.0 min 0.9734196662902832 sec
Simulation time: 0.0 min 9.134591817855835 sec
D_s: 5.062499999999373
D: [0.94375000000005937, 1.0791666666665301, 5.0624999999993729]

Simulation 15
-------------
SimId 537672f9-1355-4112-96c2-2f3e8b017249
hyperparameters: [ 3.52779763  1.81727347]
Estimate method is 'all'
Estimate winner is 'inner-prod'
Estimate time:   0.0 min 1.3209974765777588 sec
Simulation time: 0.0 min 9.419975280761719 sec
D_s: 1.6749999999996035
D: [0.94375000000005937, 1.0791666666665301]

Simulation 16
-------------
SimId 87638f6a-8313-420a-b740-cf906274ec9c
hyperparameters: [ 1.75751531  0.1305406 ]
Estimate method is 'all'
Estimate winner is 'stochastic'
Estimate time:   0.0 min 1.3397636413574219 sec
Simulation time: 0.0 min 10.378345727920532 sec
D_s: 11.306249999999071
D: [0.94375000000005937, 1.0791666666665301, 11.306249999999071]

Simulation 17
-------------
SimId ef68643a-c58b-4e19-8d9c-8e277b5bd803
hyperparameters: [ 5.36714033  3.22188   ]
Estimate method is 'stochastic'
Estimate winner is 'stochastic'
Estimate time:   0.0 min 0.924389123916626 sec
Simulation time: 0.0 min 10.467379570007324 sec
D_s: 2.2833333333333163
D: [0.94375000000005937, 1.0791666666665301]

Simulation 18
-------------
SimId 34f908fa-bc8e-471d-b028-129b9fee453a
hyperparameters: [ 1.75751531  0.1305406 ]
Estimate method is 'stochastic'
Estimate winner is 'stochastic'
Estimate time:   0.0 min 0.928847074508667 sec
Simulation time: 0.0 min 11.201294660568237 sec
D_s: 8.474999999999177
D: [0.94375000000005937, 1.0791666666665301, 8.4749999999991772]

Simulation 19
-------------
SimId a2b9a3be-3e5b-4a72-8d0a-1e18241b11e4
hyperparameters: [ 4.36586701  1.96546645]
Estimate method is 'all'
Estimate winner is 'inner-prod'
Estimate time:   0.0 min 1.237168550491333 sec
Simulation time: 0.0 min 11.374820470809937 sec
D_s: 0.8999999999998358
D: [0.89999999999983582, 0.94375000000005937]

Simulation 20
-------------
SimId b0869b4a-6c0c-47fd-bfb6-a3d18214a025
hyperparameters: [ 1.66723967  0.329505  ]
Estimate method is 'all'
Estimate winner is 'stochastic'
Estimate time:   0.0 min 1.1850650310516357 sec
Simulation time: 0.0 min 11.796063423156738 sec
D_s: 10.46249999999907
D: [0.89999999999983582, 0.94375000000005937, 10.46249999999907]

CPU times: user 28.5 s, sys: 7.25 s, total: 35.8 s
Wall time: 2min 51s

In [11]:
%time state1sto = run_percent_growth(1, MAX_S=20, method_0='stochastic')


Simulation 3
------------
SimId f7eab166-21b3-43d5-a84b-a3e155021cbf
hyperparameters: [ 8.58728406  4.5605898 ]
Estimate method is 'stochastic'
Estimate winner is 'stochastic'
Estimate time:   0.0 min 1.0099830627441406 sec
Simulation time: 0.0 min 3.9000790119171143 sec
D_s: 5.952819776625992
D: [5.9528197766259918, 14.30609232162578]

Simulation 4
------------
SimId 830c9c37-ad01-4548-bf5f-99961fba94fe
hyperparameters: [ 5.31310779  3.62122666]
Estimate method is 'stochastic'
Estimate winner is 'stochastic'
Estimate time:   0.0 min 1.1100702285766602 sec
Simulation time: 0.0 min 4.487576007843018 sec
D_s: 1.0913573738881053
D: [1.0913573738881053, 5.9528197766259918]

Simulation 5
------------
SimId efdf8a30-2c26-4fad-a1ed-4ef1be6e3692
hyperparameters: [ 4.45135636  2.60789788]
Estimate method is 'stochastic'
Estimate winner is 'stochastic'
Estimate time:   0.0 min 1.0585527420043945 sec
Simulation time: 0.0 min 4.942779302597046 sec
D_s: 2.701777228550989
D: [1.0913573738881053, 2.7017772285509891]

Simulation 6
------------
SimId 51943899-5038-4fff-9fb1-e80acc7f97a1
hyperparameters: [ 4.73626116  2.80206715]
Estimate method is 'stochastic'
Estimate winner is 'stochastic'
Estimate time:   0.0 min 1.0448598861694336 sec
Simulation time: 0.0 min 5.749910831451416 sec
D_s: 7.863065578995091
D: [1.0913573738881053, 2.7017772285509891, 7.8630655789950907]

Simulation 7
------------
SimId 7d3f80e5-0ea9-40e3-a4ea-e6adb36c5318
hyperparameters: [ 5.68597712  3.51515993]
Estimate method is 'stochastic'
Estimate winner is 'stochastic'
Estimate time:   0.0 min 1.1006357669830322 sec
Simulation time: 0.0 min 5.890583515167236 sec
D_s: 1.4079847147063886
D: [1.0913573738881053, 1.4079847147063886]

Simulation 8
------------
SimId fadd1877-727a-4c4a-8c6a-e7ba61ace994
hyperparameters: [ 3.40833059  1.28407189]
Estimate method is 'stochastic'
Estimate winner is 'stochastic'
Estimate time:   0.0 min 1.0480270385742188 sec
Simulation time: 0.0 min 6.69564962387085 sec
D_s: 5.5203721181184235
D: [1.0913573738881053, 1.4079847147063886, 5.5203721181184235]

Simulation 9
------------
SimId c2e9dc9b-da9b-41c3-9fdf-3d9a1d276214
hyperparameters: [ 4.9396344   2.65505705]
Estimate method is 'stochastic'
Estimate winner is 'stochastic'
Estimate time:   0.0 min 1.0485408306121826 sec
Simulation time: 0.0 min 7.101883888244629 sec
D_s: 1.0661642921604564
D: [1.0661642921604564, 1.0913573738881053]

Simulation 10
-------------
SimId 7c37f857-cdbe-4cbb-8bfb-d07428e32a73
hyperparameters: [ 3.86883331  1.83539702]
Estimate method is 'stochastic'
Estimate winner is 'stochastic'
Estimate time:   0.0 min 1.0567612648010254 sec
Simulation time: 0.0 min 7.608993291854858 sec
D_s: 1.3276751379411333
D: [1.0661642921604564, 1.0913573738881053, 1.3276751379411333]

Simulation 11
-------------
SimId 6c710aab-1d81-4459-a651-0834da15e8c7
hyperparameters: [ 3.99127904  1.54097976]
Estimate method is 'stochastic'
Estimate winner is 'stochastic'
Estimate time:   0.0 min 1.0614826679229736 sec
Simulation time: 0.0 min 8.016199111938477 sec
D_s: 2.1218249445256405
D: [1.0661642921604564, 1.0913573738881053, 2.1218249445256405]

Simulation 12
-------------
SimId b5446d44-092c-4984-a251-c2e302236a96
hyperparameters: [ 4.27612318  2.16489518]
Estimate method is 'stochastic'
Estimate winner is 'stochastic'
Estimate time:   0.0 min 1.071641206741333 sec
Simulation time: 0.0 min 8.470669269561768 sec
D_s: 2.8972563075066304
D: [1.0661642921604564, 1.0913573738881053, 2.8972563075066304]

Simulation 13
-------------
SimId 397afd20-6614-48fb-9cd1-9e578512e20b
hyperparameters: [ 4.44852178  2.1123698 ]
Estimate method is 'stochastic'
Estimate winner is 'stochastic'
Estimate time:   0.0 min 1.09037184715271 sec
Simulation time: 0.0 min 9.079729080200195 sec
D_s: 2.305083110342241
D: [1.0661642921604564, 1.0913573738881053]

Simulation 14
-------------
SimId c794baa5-c6c5-4487-9b80-ae698c7c5665
hyperparameters: [ 3.86883331  1.83539702]
Estimate method is 'stochastic'
Estimate winner is 'stochastic'
Estimate time:   0.0 min 1.074408769607544 sec
Simulation time: 0.0 min 9.617148399353027 sec
D_s: 2.5862845193870685
D: [1.0661642921604564, 1.0913573738881053, 2.5862845193870685]

Simulation 15
-------------
SimId c9b64408-35d2-44ec-bb31-306b04043993
hyperparameters: [ 4.18366427  1.62856617]
Estimate method is 'stochastic'
Estimate winner is 'stochastic'
Estimate time:   0.0 min 1.0943107604980469 sec
Simulation time: 0.0 min 10.315710544586182 sec
D_s: 5.711006742852713
D: [1.0661642921604564, 1.0913573738881053, 5.7110067428527129]

Simulation 16
-------------
SimId d3b79412-ec36-4a67-afc7-c13ab938d8d0
hyperparameters: [ 4.89626166  2.54699203]
Estimate method is 'stochastic'
Estimate winner is 'stochastic'
Estimate time:   0.0 min 1.0880529880523682 sec
Simulation time: 0.0 min 10.86942982673645 sec
D_s: 2.8034454398848685
D: [1.0661642921604564, 1.0913573738881053]

Simulation 17
-------------
SimId da52241c-e2e4-4620-ab2f-5cf00a5e1967
hyperparameters: [ 3.86883331  1.83539702]
Estimate method is 'stochastic'
Estimate winner is 'stochastic'
Estimate time:   0.0 min 1.0902256965637207 sec
Simulation time: 0.0 min 11.067596197128296 sec
D_s: 2.5205441417440224
D: [1.0661642921604564, 1.0913573738881053, 2.5205441417440224]

Simulation 18
-------------
SimId 837790e1-4e47-428b-8b6a-0d6adac03dbd
hyperparameters: [ 4.40551797  2.28239333]
Estimate method is 'stochastic'
Estimate winner is 'stochastic'
Estimate time:   0.0 min 1.0858757495880127 sec
Simulation time: 0.0 min 11.72672152519226 sec
D_s: 1.8727454289061416
D: [1.0661642921604564, 1.0913573738881053]

Simulation 19
-------------
SimId 2f47e461-2827-451b-b069-62a7c4394326
hyperparameters: [ 3.86883331  1.83539702]
Estimate method is 'stochastic'
Estimate winner is 'stochastic'
Estimate time:   0.0 min 1.0726864337921143 sec
Simulation time: 0.0 min 11.977354288101196 sec
D_s: 1.0321141013165231
D: [1.0321141013165231, 1.0661642921604564]

Simulation 20
-------------
SimId 55a38e1f-d280-44be-a95a-83d1d61db205
hyperparameters: [ 4.20641128  2.10161733]
Estimate method is 'stochastic'
Estimate winner is 'stochastic'
Estimate time:   0.0 min 1.0627031326293945 sec
Simulation time: 0.0 min 12.89091968536377 sec
D_s: 4.476502029002225
D: [1.0321141013165231, 1.0661642921604564, 4.4765020290022246]

CPU times: user 27.9 s, sys: 7.04 s, total: 35 s
Wall time: 2min 56s

In [12]:
%time state1inn = run_percent_growth(1, MAX_S=20, method_0='inner-prod')


Simulation 3
------------
SimId 0fcc1c2f-15db-42bd-8269-c1ef664aa012
hyperparameters: [ 8.58728406  4.5605898 ]
Estimate method is 'inner-prod'
Estimate winner is 'inner-prod'
Estimate time:   0.0 min 0.42235398292541504 sec
Simulation time: 0.0 min 3.9640932083129883 sec
D_s: 1.4707812247893888
D: [1.4707812247893888, 14.30609232162578]

Simulation 4
------------
SimId 6ff46085-a318-4a59-a7e4-10e05e97c6a9
hyperparameters: [ 5.65715799  3.99432655]
Estimate method is 'inner-prod'
Estimate winner is 'inner-prod'
Estimate time:   0.0 min 0.4118821620941162 sec
Simulation time: 0.0 min 4.4574079513549805 sec
D_s: 0.8522307813314448
D: [0.85223078133144481, 1.4707812247893888]

Simulation 5
------------
SimId 32944155-cde1-441d-930b-99b93f8ec33a
hyperparameters: [ 2.6667925   1.35406172]
Estimate method is 'inner-prod'
Estimate winner is 'inner-prod'
Estimate time:   0.0 min 0.4165456295013428 sec
Simulation time: 0.0 min 4.957407474517822 sec
D_s: 1.3538143911818423
D: [0.85223078133144481, 1.3538143911818423]

Simulation 6
------------
SimId d64af504-9cc3-4a74-9c47-3cbf589ae7bc
hyperparameters: [ 2.74503544  1.46444109]
Estimate method is 'inner-prod'
Estimate winner is 'inner-prod'
Estimate time:   0.0 min 0.41378092765808105 sec
Simulation time: 0.0 min 5.446901082992554 sec
D_s: 0.8961052564995378
D: [0.85223078133144481, 0.89610525649953776]

Simulation 7
------------
SimId 99e6b09d-b5a0-473f-bac2-2e1d7df69467
hyperparameters: [ 2.71578969  1.33633937]
Estimate method is 'inner-prod'
Estimate winner is 'inner-prod'
Estimate time:   0.0 min 0.4203202724456787 sec
Simulation time: 0.0 min 5.762616157531738 sec
D_s: 1.3475568215315925
D: [0.85223078133144481, 0.89610525649953776, 1.3475568215315925]

Simulation 8
------------
SimId e4fd066d-3e0f-4f5f-bd71-e6b6797b5e69
hyperparameters: [ 2.64620728  1.40248143]
Estimate method is 'inner-prod'
Estimate winner is 'inner-prod'
Estimate time:   0.0 min 0.4212827682495117 sec
Simulation time: 0.0 min 6.41672682762146 sec
D_s: 1.1072860878681297
D: [0.85223078133144481, 0.89610525649953776]

Simulation 9
------------
SimId 8dcf5c5c-2084-4703-9f20-cfe3cbe998f4
hyperparameters: [ 2.71578969  1.33633937]
Estimate method is 'inner-prod'
Estimate winner is 'inner-prod'
Estimate time:   0.0 min 0.41100120544433594 sec
Simulation time: 0.0 min 6.6425275802612305 sec
D_s: 1.3475568215315925
D: [0.85223078133144481, 0.89610525649953776, 1.3475568215315925]

Simulation 10
-------------
SimId 339fb483-c211-4c46-b34d-580dcc00dc31
hyperparameters: [ 2.64620728  1.40248143]
Estimate method is 'inner-prod'
Estimate winner is 'inner-prod'
Estimate time:   0.0 min 0.4218108654022217 sec
Simulation time: 0.0 min 7.142793416976929 sec
D_s: 1.1072860878681297
D: [0.85223078133144481, 0.89610525649953776]

Simulation 11
-------------
SimId 0af3fe98-ae34-4c5f-a092-16705733ab64
hyperparameters: [ 2.71578969  1.33633937]
Estimate method is 'inner-prod'
Estimate winner is 'inner-prod'
Estimate time:   0.0 min 0.42136693000793457 sec
Simulation time: 0.0 min 7.641375780105591 sec
D_s: 1.3475568215315925
D: [0.85223078133144481, 0.89610525649953776, 1.3475568215315925]

Simulation 12
-------------
SimId ac8c1b38-d367-418a-b1e8-9b77d3c337ee
hyperparameters: [ 2.64620728  1.40248143]
Estimate method is 'inner-prod'
Estimate winner is 'inner-prod'
Estimate time:   0.0 min 0.42339658737182617 sec
Simulation time: 0.0 min 8.1130211353302 sec
D_s: 1.1072860878681297
D: [0.85223078133144481, 0.89610525649953776]

Simulation 13
-------------
SimId 73da9bbf-8602-4298-b441-c8c231b253ba
hyperparameters: [ 2.71578969  1.33633937]
Estimate method is 'inner-prod'
Estimate winner is 'inner-prod'
Estimate time:   0.0 min 0.41995692253112793 sec
Simulation time: 0.0 min 8.724573850631714 sec
D_s: 1.3475568215315925
D: [0.85223078133144481, 0.89610525649953776, 1.3475568215315925]

Simulation 14
-------------
SimId f4d1d9ef-d12c-47a3-920d-8b93e6a16647
hyperparameters: [ 2.64620728  1.40248143]
Estimate method is 'inner-prod'
Estimate winner is 'inner-prod'
Estimate time:   0.0 min 0.43657994270324707 sec
Simulation time: 0.0 min 9.13647174835205 sec
D_s: 1.1072860878681297
D: [0.85223078133144481, 0.89610525649953776]

Simulation 15
-------------
SimId f94d5ef4-af42-4d22-8b5b-678f681e71ff
hyperparameters: [ 2.71578969  1.33633937]
Estimate method is 'inner-prod'
Estimate winner is 'inner-prod'
Estimate time:   0.0 min 0.41875505447387695 sec
Simulation time: 0.0 min 9.312734365463257 sec
D_s: 1.3475568215315925
D: [0.85223078133144481, 0.89610525649953776, 1.3475568215315925]

Simulation 16
-------------
SimId 08b80462-8934-4ef3-be35-d2decf38c6ad
hyperparameters: [ 2.64620728  1.40248143]
Estimate method is 'inner-prod'
Estimate winner is 'inner-prod'
Estimate time:   0.0 min 0.4251124858856201 sec
Simulation time: 0.0 min 10.054937362670898 sec
D_s: 1.1072860878681297
D: [0.85223078133144481, 0.89610525649953776]

Simulation 17
-------------
SimId db9268dc-e8a3-423d-9340-5f86c0bbd200
hyperparameters: [ 2.71578969  1.33633937]
Estimate method is 'inner-prod'
Estimate winner is 'inner-prod'
Estimate time:   0.0 min 0.41250133514404297 sec
Simulation time: 0.0 min 10.339520692825317 sec
D_s: 1.3475568215315925
D: [0.85223078133144481, 0.89610525649953776, 1.3475568215315925]

Simulation 18
-------------
SimId 90197880-0e25-4d6d-9be1-b60441c58786
hyperparameters: [ 2.64620728  1.40248143]
Estimate method is 'inner-prod'
Estimate winner is 'inner-prod'
Estimate time:   0.0 min 0.4349074363708496 sec
Simulation time: 0.0 min 11.097005605697632 sec
D_s: 1.1072860878681297
D: [0.85223078133144481, 0.89610525649953776]

Simulation 19
-------------
SimId e088ca4b-d2d0-440d-a23f-442015b7d97e
hyperparameters: [ 2.71578969  1.33633937]
Estimate method is 'inner-prod'
Estimate winner is 'inner-prod'
Estimate time:   0.0 min 0.4287679195404053 sec
Simulation time: 0.0 min 11.418505668640137 sec
D_s: 1.3475568215315925
D: [0.85223078133144481, 0.89610525649953776, 1.3475568215315925]

Simulation 20
-------------
SimId b54134fe-4d11-4ef3-90ce-cbc83f4198de
hyperparameters: [ 2.64620728  1.40248143]
Estimate method is 'inner-prod'
Estimate winner is 'inner-prod'
Estimate time:   0.0 min 0.4248337745666504 sec
Simulation time: 0.0 min 11.63792085647583 sec
D_s: 1.1072860878681297
D: [0.85223078133144481, 0.89610525649953776]

CPU times: user 15.7 s, sys: 7.09 s, total: 22.8 s
Wall time: 2min 36s

In [13]:
%time state1all = run_percent_growth(1, MAX_S=20, method_0='all')


Simulation 3
------------
SimId efc0126f-4cf0-43e1-bb6f-081c79d887aa
hyperparameters: [ 8.58728406  4.5605898 ]
Estimate method is 'all'
Estimate winner is 'inner-prod'
Estimate time:   0.0 min 1.3409497737884521 sec
Simulation time: 0.0 min 4.0297300815582275 sec
D_s: 1.4707812247893888
D: [1.4707812247893888, 14.30609232162578]

Simulation 4
------------
SimId dbb1fb82-2cd1-4be2-b4ee-3fba5caa3d93
hyperparameters: [ 5.65715799  3.99432655]
Estimate method is 'all'
Estimate winner is 'inner-prod'
Estimate time:   0.0 min 1.4545302391052246 sec
Simulation time: 0.0 min 4.499313831329346 sec
D_s: 0.8522307813314448
D: [0.85223078133144481, 1.4707812247893888]

Simulation 5
------------
SimId 283c0d56-f1b7-42bb-ac2b-8a7cdaf697d8
hyperparameters: [ 2.6667925   1.35406172]
Estimate method is 'stochastic'
Estimate winner is 'stochastic'
Estimate time:   0.0 min 0.9849638938903809 sec
Simulation time: 0.0 min 5.233546257019043 sec
D_s: 3.8248014087558717
D: [0.85223078133144481, 1.4707812247893888, 3.8248014087558717]

Simulation 6
------------
SimId 8af0332a-4431-438c-9a6f-fb60c5783efb
hyperparameters: [ 4.36908317  2.16797455]
Estimate method is 'stochastic'
Estimate winner is 'stochastic'
Estimate time:   0.0 min 1.0588572025299072 sec
Simulation time: 0.0 min 5.561527729034424 sec
D_s: 1.2203129534854988
D: [0.85223078133144481, 1.2203129534854988]

Simulation 7
------------
SimId bdf14bc5-afee-443f-bf72-09673d63e309
hyperparameters: [ 2.6814592   1.13402126]
Estimate method is 'all'
Estimate winner is 'inner-prod'
Estimate time:   0.0 min 1.363907814025879 sec
Simulation time: 0.0 min 5.814744234085083 sec
D_s: 0.9511019898092329
D: [0.85223078133144481, 0.95110198980923288]

Simulation 8
------------
SimId 35f45dc3-4388-4644-8073-18cced5efbc2
hyperparameters: [ 2.54336704  1.13434583]
Estimate method is 'all'
Estimate winner is 'inner-prod'
Estimate time:   0.0 min 1.37282133102417 sec
Simulation time: 0.0 min 6.499724864959717 sec
D_s: 1.0669500305185813
D: [0.85223078133144481, 0.95110198980923288, 1.0669500305185813]

Simulation 9
------------
SimId c2a3f0ca-a99c-4962-80ac-b8a935f7fd75
hyperparameters: [ 2.49023143  1.35891343]
Estimate method is 'stochastic'
Estimate winner is 'stochastic'
Estimate time:   0.0 min 1.027599573135376 sec
Simulation time: 0.0 min 6.916848182678223 sec
D_s: 0.918312514458907
D: [0.85223078133144481, 0.91831251445890705]

Simulation 10
-------------
SimId 342e5d76-0034-4eb1-8750-0868828885b4
hyperparameters: [ 2.88052436  1.18456906]
Estimate method is 'stochastic'
Estimate winner is 'stochastic'
Estimate time:   0.0 min 1.115945816040039 sec
Simulation time: 0.0 min 7.612865686416626 sec
D_s: 1.7639162543930251
D: [0.85223078133144481, 0.91831251445890705, 1.7639162543930251]

Simulation 11
-------------
SimId 76f57f7e-5779-4442-86ea-67bd4f9b78d6
hyperparameters: [ 3.93266875  2.21382487]
Estimate method is 'all'
Estimate winner is 'stochastic'
Estimate time:   0.0 min 1.440412998199463 sec
Simulation time: 0.0 min 8.01731014251709 sec
D_s: 0.9444909858959981
D: [0.85223078133144481, 0.91831251445890705]

Simulation 12
-------------
SimId 4a29308a-8732-43ef-93d9-0001fa808c1a
hyperparameters: [ 2.88052436  1.18456906]
Estimate method is 'all'
Estimate winner is 'inner-prod'
Estimate time:   0.0 min 1.419440746307373 sec
Simulation time: 0.0 min 8.344993591308594 sec
D_s: 0.9688462439187522
D: [0.85223078133144481, 0.91831251445890705, 0.96884624391875218]

Simulation 13
-------------
SimId ae0bc7be-7083-4b01-a494-16093abb248a
hyperparameters: [ 2.97292821  1.65430135]
Estimate method is 'stochastic'
Estimate winner is 'stochastic'
Estimate time:   0.0 min 1.1152513027191162 sec
Simulation time: 0.0 min 8.994657516479492 sec
D_s: 0.8443216261139117
D: [0.84432162611391171, 0.85223078133144481]

Simulation 14
-------------
SimId 930845e0-0483-40f6-bc60-051f54a3c0d7
hyperparameters: [ 3.18756742  1.55827403]
Estimate method is 'stochastic'
Estimate winner is 'stochastic'
Estimate time:   0.0 min 1.112253189086914 sec
Simulation time: 0.0 min 9.352413892745972 sec
D_s: 2.1631876067459865
D: [0.84432162611391171, 0.85223078133144481, 2.1631876067459865]

Simulation 15
-------------
SimId bbd32e89-5e63-4132-9fa5-ca5f98d4ccca
hyperparameters: [ 4.05819667  2.28801328]
Estimate method is 'all'
Estimate winner is 'inner-prod'
Estimate time:   0.0 min 1.494279146194458 sec
Simulation time: 0.0 min 9.966062545776367 sec
D_s: 0.7175964455875764
D: [0.7175964455875764, 0.84432162611391171]

Simulation 16
-------------
SimId ec324e88-522f-4641-92cf-14d76faaf49b
hyperparameters: [ 3.27296113  1.70074598]
Estimate method is 'all'
Estimate winner is 'inner-prod'
Estimate time:   0.0 min 1.61517333984375 sec
Simulation time: 0.0 min 10.908344507217407 sec
D_s: 0.724751295041694
D: [0.7175964455875764, 0.724751295041694]

Simulation 17
-------------
SimId 2b1638f9-e18f-4d0f-8ef7-330f8849e0a2
hyperparameters: [ 3.68747283  2.42800076]
Estimate method is 'stochastic'
Estimate winner is 'stochastic'
Estimate time:   0.0 min 1.070617437362671 sec
Simulation time: 0.0 min 12.532337188720703 sec
D_s: 1.9554931154422701
D: [0.7175964455875764, 0.724751295041694, 1.9554931154422701]

Simulation 18
-------------
SimId 9d529c19-01ff-46b1-891a-72d95dbd7d45
hyperparameters: [ 3.98008674  2.21326601]
Estimate method is 'stochastic'
Estimate winner is 'stochastic'
Estimate time:   0.0 min 1.1937336921691895 sec
Simulation time: 0.0 min 11.775976419448853 sec
D_s: 3.021157286493111
D: [0.7175964455875764, 0.724751295041694, 3.0211572864931111]

Simulation 19
-------------
SimId dad22e9f-1445-42cc-bbda-c489a73f2832
hyperparameters: [ 4.79328192  3.08879976]
Estimate method is 'all'
Estimate winner is 'inner-prod'
Estimate time:   0.0 min 1.4993188381195068 sec
Simulation time: 0.0 min 11.945875406265259 sec
D_s: 0.9714994287491046
D: [0.7175964455875764, 0.724751295041694]

Simulation 20
-------------
SimId f9696a11-e96a-4b0e-9d54-f749fca6ff84
hyperparameters: [ 3.68747283  2.42800076]
Estimate method is 'all'
Estimate winner is 'inner-prod'
Estimate time:   0.0 min 1.4011847972869873 sec
Simulation time: 0.0 min 13.543731451034546 sec
D_s: 0.9915314326217338
D: [0.7175964455875764, 0.724751295041694, 0.99153143262173382]

CPU times: user 31.6 s, sys: 7.03 s, total: 38.7 s
Wall time: 3min 1s

In [14]:
%time state2sto = run_percent_growth(2, MAX_S=20, method_0='stochastic')


Simulation 3
------------
SimId 9b08e379-4e15-4354-911d-299d510b3223
hyperparameters: [ 8.80224829  4.55118758]
Estimate method is 'stochastic'
Estimate winner is 'stochastic'
Estimate time:   0.0 min 1.1968672275543213 sec
Simulation time: 0.0 min 3.9381489753723145 sec
D_s: 14.58949871423159
D: [14.58949871423159, 19.423248714231484]

Simulation 4
------------
SimId 83903783-0caa-4d0b-96e0-e805d98d25ce
hyperparameters: [ 4.8998217   3.37256138]
Estimate method is 'stochastic'
Estimate winner is 'stochastic'
Estimate time:   0.0 min 1.17982816696167 sec
Simulation time: 0.0 min 4.515989780426025 sec
D_s: 5.198902042055451
D: [5.198902042055451, 14.58949871423159]

Simulation 5
------------
SimId 58e51274-3385-401a-874b-b01f4936d9bb
hyperparameters: [ 4.15982337  2.23060572]
Estimate method is 'stochastic'
Estimate winner is 'stochastic'
Estimate time:   0.0 min 1.215254306793213 sec
Simulation time: 0.0 min 5.10276198387146 sec
D_s: 2.7651476075241215
D: [2.7651476075241215, 5.198902042055451]

Simulation 6
------------
SimId d0ff42c0-994c-43cf-bac0-e5955d216f6a
hyperparameters: [ 3.70137687  1.47006913]
Estimate method is 'stochastic'
Estimate winner is 'stochastic'
Estimate time:   0.0 min 1.2292392253875732 sec
Simulation time: 0.0 min 5.838144540786743 sec
D_s: 0.8336844882557337
D: [0.83368448825573371, 2.7651476075241215]

Simulation 7
------------
SimId 55b4c69d-c790-437f-adc1-462e5e4ac58c
hyperparameters: [ 4.80680638  2.35954509]
Estimate method is 'stochastic'
Estimate winner is 'stochastic'
Estimate time:   0.0 min 1.2014875411987305 sec
Simulation time: 0.0 min 6.242429971694946 sec
D_s: 1.449144326890562
D: [0.83368448825573371, 1.4491443268905619]

Simulation 8
------------
SimId b6b9c755-8650-47af-b550-8e537f0d236b
hyperparameters: [ 5.50882046  2.80863731]
Estimate method is 'stochastic'
Estimate winner is 'stochastic'
Estimate time:   0.0 min 1.2202725410461426 sec
Simulation time: 0.0 min 6.8269312381744385 sec
D_s: 1.3946519965863717
D: [0.83368448825573371, 1.3946519965863717]

Simulation 9
------------
SimId e75a0b8c-8b47-40b5-9e87-a9005b6806f2
hyperparameters: [ 4.61046082  2.3172316 ]
Estimate method is 'stochastic'
Estimate winner is 'stochastic'
Estimate time:   0.0 min 1.1713411808013916 sec
Simulation time: 0.0 min 7.339361190795898 sec
D_s: 0.9241071776736686
D: [0.83368448825573371, 0.92410717767366857]

Simulation 10
-------------
SimId 89ed3a7b-6e02-4900-82a9-7fb5a485f4ac
hyperparameters: [ 4.9527146   2.34411421]
Estimate method is 'stochastic'
Estimate winner is 'stochastic'
Estimate time:   0.0 min 1.2356979846954346 sec
Simulation time: 0.0 min 7.895087480545044 sec
D_s: 1.2285700195705265
D: [0.83368448825573371, 0.92410717767366857, 1.2285700195705265]

Simulation 11
-------------
SimId 7177b827-6cbf-4e02-9fff-012564088952
hyperparameters: [ 4.80060406  2.24913103]
Estimate method is 'stochastic'
Estimate winner is 'stochastic'
Estimate time:   0.0 min 1.1780157089233398 sec
Simulation time: 0.0 min 8.247249364852905 sec
D_s: 1.054122608419879
D: [0.83368448825573371, 0.92410717767366857]

Simulation 12
-------------
SimId 254f723c-63dd-4a42-b194-6b813d504ebf
hyperparameters: [ 4.9527146   2.34411421]
Estimate method is 'stochastic'
Estimate winner is 'stochastic'
Estimate time:   0.0 min 1.186237096786499 sec
Simulation time: 0.0 min 8.859606742858887 sec
D_s: 1.4235164656379986
D: [0.83368448825573371, 0.92410717767366857, 1.4235164656379986]

Simulation 13
-------------
SimId d9c01401-b91d-4725-a58f-edb7123247a4
hyperparameters: [ 5.19340792  2.44711582]
Estimate method is 'stochastic'
Estimate winner is 'stochastic'
Estimate time:   0.0 min 1.1774656772613525 sec
Simulation time: 0.0 min 9.359809875488281 sec
D_s: 1.0690138705168846
D: [0.83368448825573371, 0.92410717767366857]

Simulation 14
-------------
SimId 25916bd4-e316-4706-9e57-a8ee7fdc8369
hyperparameters: [ 4.9527146   2.34411421]
Estimate method is 'stochastic'
Estimate winner is 'stochastic'
Estimate time:   0.0 min 1.1713533401489258 sec
Simulation time: 0.0 min 9.704303503036499 sec
D_s: 1.0147009287997097
D: [0.83368448825573371, 0.92410717767366857, 1.0147009287997097]

Simulation 15
-------------
SimId 0964afa0-2323-4c5a-b280-d78c8467a7a7
hyperparameters: [ 4.90401731  2.38907022]
Estimate method is 'stochastic'
Estimate winner is 'stochastic'
Estimate time:   0.0 min 1.178004264831543 sec
Simulation time: 0.0 min 10.600332498550415 sec
D_s: 1.1195143275713293
D: [0.83368448825573371, 0.92410717767366857, 1.1195143275713293]

Simulation 16
-------------
SimId 1582fa19-580f-4d49-ad38-efee42b52d3f
hyperparameters: [ 5.12814149  2.63400146]
Estimate method is 'stochastic'
Estimate winner is 'stochastic'
Estimate time:   0.0 min 1.2054932117462158 sec
Simulation time: 0.0 min 11.552398920059204 sec
D_s: 1.2964872154549458
D: [0.83368448825573371, 0.92410717767366857, 1.2964872154549458]

Simulation 17
-------------
SimId 16e653bd-529d-4e9a-b7fc-26be1307e871
hyperparameters: [ 5.14304132  2.52060058]
Estimate method is 'stochastic'
Estimate winner is 'stochastic'
Estimate time:   0.0 min 1.2224855422973633 sec
Simulation time: 0.0 min 13.1326265335083 sec
D_s: 1.0928124033130295
D: [0.83368448825573371, 0.92410717767366857]

Simulation 18
-------------
SimId e6764f92-3b96-4568-b2d7-4b7e24cf086a
hyperparameters: [ 4.9527146   2.34411421]
Estimate method is 'stochastic'
Estimate winner is 'stochastic'
Estimate time:   0.0 min 1.672041416168213 sec
Simulation time: 0.0 min 12.37782883644104 sec
D_s: 1.7248568852677688
D: [0.83368448825573371, 0.92410717767366857, 1.7248568852677688]

Simulation 19
-------------
SimId 6818affb-d0a4-43d3-b50e-d4e5656e4745
hyperparameters: [ 5.17186007  2.46947005]
Estimate method is 'stochastic'
Estimate winner is 'stochastic'
Estimate time:   0.0 min 1.271103858947754 sec
Simulation time: 0.0 min 13.64011812210083 sec
D_s: 1.8441794025089167
D: [0.83368448825573371, 0.92410717767366857, 1.8441794025089167]

Simulation 20
-------------
SimId a085361c-267b-4ff4-b528-0bac39d01526
hyperparameters: [ 5.32856222  2.6253611 ]
Estimate method is 'stochastic'
Estimate winner is 'stochastic'
Estimate time:   0.0 min 1.139291524887085 sec
Simulation time: 0.0 min 13.177784204483032 sec
D_s: 1.8039362407814596
D: [0.83368448825573371, 0.92410717767366857]

CPU times: user 31.1 s, sys: 6.87 s, total: 38 s
Wall time: 3min 7s

In [15]:
%time state2inn = run_percent_growth(2, MAX_S=20, method_0='inner-prod')


Simulation 3
------------
SimId 31fd58db-9393-42ab-8323-9268f08d5b45
hyperparameters: [ 8.80224829  4.55118758]
Estimate method is 'inner-prod'
Estimate winner is 'inner-prod'
Estimate time:   0.0 min 0.47478508949279785 sec
Simulation time: 0.0 min 4.096849679946899 sec
D_s: 2.690879049301638
D: [2.6908790493016381, 19.423248714231484]

Simulation 4
------------
SimId d5d0e6ac-d3b6-4b5e-a90f-56ca7e4f6f06
hyperparameters: [ 5.75445891  3.77715026]
Estimate method is 'inner-prod'
Estimate winner is 'inner-prod'
Estimate time:   0.0 min 0.46710920333862305 sec
Simulation time: 0.0 min 4.468643426895142 sec
D_s: 2.826056990988357
D: [2.6908790493016381, 2.8260569909883571]

Simulation 5
------------
SimId ee0e259d-9f3c-42ec-aa17-50ab387793f7
hyperparameters: [ 3.44085725  1.65251327]
Estimate method is 'inner-prod'
Estimate winner is 'inner-prod'
Estimate time:   0.0 min 0.4711337089538574 sec
Simulation time: 0.0 min 5.0543529987335205 sec
D_s: 3.4486516004432017
D: [2.6908790493016381, 2.8260569909883571, 3.4486516004432017]

Simulation 6
------------
SimId bfff6f95-fe84-4f7b-b3bd-25122cd668ad
hyperparameters: [ 3.25204171  1.56896399]
Estimate method is 'inner-prod'
Estimate winner is 'inner-prod'
Estimate time:   0.0 min 0.4857809543609619 sec
Simulation time: 0.0 min 5.476208686828613 sec
D_s: 2.8780204037116
D: [2.6908790493016381, 2.8260569909883571]

Simulation 7
------------
SimId 254fb90a-98f0-4491-ad2e-b10e601d3b62
hyperparameters: [ 3.44085725  1.65251327]
Estimate method is 'inner-prod'
Estimate winner is 'inner-prod'
Estimate time:   0.0 min 0.47022104263305664 sec
Simulation time: 0.0 min 5.863919258117676 sec
D_s: 3.4486516004432017
D: [2.6908790493016381, 2.8260569909883571, 3.4486516004432017]

Simulation 8
------------
SimId 27934d03-276d-46ba-8a8a-abce4c36378e
hyperparameters: [ 3.25204171  1.56896399]
Estimate method is 'inner-prod'
Estimate winner is 'inner-prod'
Estimate time:   0.0 min 0.49576282501220703 sec
Simulation time: 0.0 min 6.3759989738464355 sec
D_s: 2.8780204037116
D: [2.6908790493016381, 2.8260569909883571]

Simulation 9
------------
SimId 250086ae-07ea-4e3e-bc59-b38dd17587df
hyperparameters: [ 3.44085725  1.65251327]
Estimate method is 'inner-prod'
Estimate winner is 'inner-prod'
Estimate time:   0.0 min 0.47149085998535156 sec
Simulation time: 0.0 min 6.896116256713867 sec
D_s: 3.4486516004432017
D: [2.6908790493016381, 2.8260569909883571, 3.4486516004432017]

Simulation 10
-------------
SimId 35c6938a-5aa8-4f1f-96b6-92972ce1aada
hyperparameters: [ 3.25204171  1.56896399]
Estimate method is 'inner-prod'
Estimate winner is 'inner-prod'
Estimate time:   0.0 min 0.48146653175354004 sec
Simulation time: 0.0 min 7.734738349914551 sec
D_s: 2.8780204037116
D: [2.6908790493016381, 2.8260569909883571]

Simulation 11
-------------
SimId adab9011-2f74-4f71-9698-248eb56eb2bb
hyperparameters: [ 3.44085725  1.65251327]
Estimate method is 'inner-prod'
Estimate winner is 'inner-prod'
Estimate time:   0.0 min 0.4744682312011719 sec
Simulation time: 0.0 min 7.946263551712036 sec
D_s: 3.4486516004432017
D: [2.6908790493016381, 2.8260569909883571, 3.4486516004432017]

Simulation 12
-------------
SimId 5f642d95-7398-4fe9-8ddc-1ba648a7b69f
hyperparameters: [ 3.25204171  1.56896399]
Estimate method is 'inner-prod'
Estimate winner is 'inner-prod'
Estimate time:   0.0 min 0.5003848075866699 sec
Simulation time: 0.0 min 8.780887603759766 sec
D_s: 2.8780204037116
D: [2.6908790493016381, 2.8260569909883571]

Simulation 13
-------------
SimId cd1538b7-7bfc-47a1-bdeb-b5fa971b9e23
hyperparameters: [ 3.44085725  1.65251327]
Estimate method is 'inner-prod'
Estimate winner is 'inner-prod'
Estimate time:   0.0 min 0.48790597915649414 sec
Simulation time: 0.0 min 8.968432903289795 sec
D_s: 3.4486516004432017
D: [2.6908790493016381, 2.8260569909883571, 3.4486516004432017]

Simulation 14
-------------
SimId 0d5297d1-1a26-4513-8cf6-ddb35efde4cb
hyperparameters: [ 3.25204171  1.56896399]
Estimate method is 'inner-prod'
Estimate winner is 'inner-prod'
Estimate time:   0.0 min 0.4792454242706299 sec
Simulation time: 0.0 min 9.217896461486816 sec
D_s: 2.8780204037116
D: [2.6908790493016381, 2.8260569909883571]

Simulation 15
-------------
SimId 7ac09ce4-0d6b-4d3d-b862-66059ede2dc7
hyperparameters: [ 3.44085725  1.65251327]
Estimate method is 'inner-prod'
Estimate winner is 'inner-prod'
Estimate time:   0.0 min 0.4765474796295166 sec
Simulation time: 0.0 min 9.84166932106018 sec
D_s: 3.4486516004432017
D: [2.6908790493016381, 2.8260569909883571, 3.4486516004432017]

Simulation 16
-------------
SimId 71dc0b88-08b0-4e80-9d37-c26b70a23362
hyperparameters: [ 3.25204171  1.56896399]
Estimate method is 'inner-prod'
Estimate winner is 'inner-prod'
Estimate time:   0.0 min 0.4750833511352539 sec
Simulation time: 0.0 min 10.506618738174438 sec
D_s: 2.8780204037116
D: [2.6908790493016381, 2.8260569909883571]

Simulation 17
-------------
SimId c78e5445-2d44-4318-82cf-eec409c3233f
hyperparameters: [ 3.44085725  1.65251327]
Estimate method is 'inner-prod'
Estimate winner is 'inner-prod'
Estimate time:   0.0 min 0.4928607940673828 sec
Simulation time: 0.0 min 10.830146789550781 sec
D_s: 3.4486516004432017
D: [2.6908790493016381, 2.8260569909883571, 3.4486516004432017]

Simulation 18
-------------
SimId 72d3aa7a-47d8-4592-a374-81fc2f1a9f37
hyperparameters: [ 3.25204171  1.56896399]
Estimate method is 'inner-prod'
Estimate winner is 'inner-prod'
Estimate time:   0.0 min 0.5013816356658936 sec
Simulation time: 0.0 min 11.579151153564453 sec
D_s: 2.8780204037116
D: [2.6908790493016381, 2.8260569909883571]

Simulation 19
-------------
SimId 51c09187-4d52-41cd-8807-4b85812ffa49
hyperparameters: [ 3.44085725  1.65251327]
Estimate method is 'inner-prod'
Estimate winner is 'inner-prod'
Estimate time:   0.0 min 0.48076486587524414 sec
Simulation time: 0.0 min 12.204652786254883 sec
D_s: 3.4486516004432017
D: [2.6908790493016381, 2.8260569909883571, 3.4486516004432017]

Simulation 20
-------------
SimId b5362988-4563-417a-9100-9aa448ea486f
hyperparameters: [ 3.25204171  1.56896399]
Estimate method is 'inner-prod'
Estimate winner is 'inner-prod'
Estimate time:   0.0 min 0.5262260437011719 sec
Simulation time: 0.0 min 12.215825319290161 sec
D_s: 2.8780204037116
D: [2.6908790493016381, 2.8260569909883571]

CPU times: user 16.9 s, sys: 6.14 s, total: 23 s
Wall time: 2min 43s

In [16]:
%time state2all = run_percent_growth(2, MAX_S=20, method_0='all')


Simulation 3
------------
SimId 80a16d0c-596e-4c44-aff5-b6c645316568
hyperparameters: [ 8.80224829  4.55118758]
Estimate method is 'all'
Estimate winner is 'inner-prod'
Estimate time:   0.0 min 1.5629198551177979 sec
Simulation time: 0.0 min 4.18960428237915 sec
D_s: 2.690879049301638
D: [2.6908790493016381, 19.423248714231484]

Simulation 4
------------
SimId 1ce6bd4f-fb79-476f-8088-92091e7ce606
hyperparameters: [ 5.75445891  3.77715026]
Estimate method is 'all'
Estimate winner is 'inner-prod'
Estimate time:   0.0 min 1.8613085746765137 sec
Simulation time: 0.0 min 4.6588454246521 sec
D_s: 2.826056990988357
D: [2.6908790493016381, 2.8260569909883571]

Simulation 5
------------
SimId da1504b7-dd7c-48b4-be94-b15a54873251
hyperparameters: [ 3.44085725  1.65251327]
Estimate method is 'stochastic'
Estimate winner is 'stochastic'
Estimate time:   0.0 min 1.0807809829711914 sec
Simulation time: 0.0 min 6.149138450622559 sec
D_s: 0.8483124109832669
D: [0.84831241098326693, 2.6908790493016381]

Simulation 6
------------
SimId d880097b-e80f-4782-9ba9-0734440bc97b
hyperparameters: [ 4.97615725  2.42147615]
Estimate method is 'stochastic'
Estimate winner is 'stochastic'
Estimate time:   0.0 min 1.2372713088989258 sec
Simulation time: 0.0 min 7.909373760223389 sec
D_s: 1.1463009797195216
D: [0.84831241098326693, 1.1463009797195216]

Simulation 7
------------
SimId bfd4a6e0-2fee-414d-bb60-249abee7074e
hyperparameters: [ 5.28600196  2.49110149]
Estimate method is 'all'
Estimate winner is 'inner-prod'
Estimate time:   0.0 min 2.039794921875 sec
Simulation time: 0.0 min 7.105220556259155 sec
D_s: 0.8095948734944276
D: [0.8095948734944276, 0.84831241098326693]

Simulation 8
------------
SimId db733f0e-bbab-471e-9222-e4d88bfeae3c
hyperparameters: [ 5.05911761  2.43602918]
Estimate method is 'all'
Estimate winner is 'inner-prod'
Estimate time:   0.0 min 1.493351697921753 sec
Simulation time: 0.0 min 7.131914854049683 sec
D_s: 0.7895473544308811
D: [0.78954735443088109, 0.8095948734944276]

Simulation 9
------------
SimId db850627-c0e1-4c8e-a9df-d4bba5c71547
hyperparameters: [ 4.98365006  2.37101627]
Estimate method is 'stochastic'
Estimate winner is 'stochastic'
Estimate time:   0.0 min 1.1661081314086914 sec
Simulation time: 0.0 min 9.43192744255066 sec
D_s: 0.7411067299891801
D: [0.74110672998918015, 0.78954735443088109]

Simulation 10
-------------
SimId 2d790fa6-f847-4491-ba95-5256ae10ed7c
hyperparameters: [ 5.17620212  2.5409981 ]
Estimate method is 'stochastic'
Estimate winner is 'stochastic'
Estimate time:   0.0 min 1.3670783042907715 sec
Simulation time: 0.0 min 8.412721872329712 sec
D_s: 1.5196324284827667
D: [0.74110672998918015, 0.78954735443088109, 1.5196324284827667]

Simulation 11
-------------
SimId 8a8e23a0-dc72-4998-aca5-f3537cde5e13
hyperparameters: [ 5.30168767  2.70732272]
Estimate method is 'all'
Estimate winner is 'inner-prod'
Estimate time:   0.0 min 1.577230453491211 sec
Simulation time: 0.0 min 8.547565460205078 sec
D_s: 1.1182152153520817
D: [0.74110672998918015, 0.78954735443088109]

Simulation 12
-------------
SimId 6c802ae5-a66a-4c4b-9a7a-6f09e0b694ed
hyperparameters: [ 5.17620212  2.5409981 ]
Estimate method is 'all'
Estimate winner is 'inner-prod'
Estimate time:   0.0 min 1.608264446258545 sec
Simulation time: 0.0 min 8.907235383987427 sec
D_s: 1.2814770725699436
D: [0.74110672998918015, 0.78954735443088109, 1.2814770725699436]

Simulation 13
-------------
SimId 5e38a302-6290-4822-bce6-37c6947ade3c
hyperparameters: [ 5.12588516  2.29992998]
Estimate method is 'stochastic'
Estimate winner is 'stochastic'
Estimate time:   0.0 min 1.1635277271270752 sec
Simulation time: 0.0 min 9.384390115737915 sec
D_s: 0.7172259850012466
D: [0.71722598500124657, 0.74110672998918015]

Simulation 14
-------------
SimId c3241d28-5a58-41c6-ba49-8dc85c02f846
hyperparameters: [ 5.18851919  2.75020939]
Estimate method is 'stochastic'
Estimate winner is 'stochastic'
Estimate time:   0.0 min 1.224921703338623 sec
Simulation time: 0.0 min 10.20108151435852 sec
D_s: 0.7668899439811956
D: [0.71722598500124657, 0.74110672998918015, 0.76688994398119559]

Simulation 15
-------------
SimId 96f27971-ed70-427a-a5eb-01421c84c430
hyperparameters: [ 5.03155094  2.70565234]
Estimate method is 'all'
Estimate winner is 'inner-prod'
Estimate time:   0.0 min 1.628648281097412 sec
Simulation time: 0.0 min 10.816157341003418 sec
D_s: 0.7948825256922735
D: [0.71722598500124657, 0.74110672998918015, 0.79488252569227347]

Simulation 16
-------------
SimId d9e1dd86-7b96-444b-b0d7-2c0f390f6bc3
hyperparameters: [ 5.05962378  2.7286258 ]
Estimate method is 'all'
Estimate winner is 'inner-prod'
Estimate time:   0.0 min 1.6422712802886963 sec
Simulation time: 0.0 min 11.234803676605225 sec
D_s: 0.7370688493393971
D: [0.71722598500124657, 0.73706884933939709]

Simulation 17
-------------
SimId 8b3cd202-d3f6-4b68-82da-7ec249ed5622
hyperparameters: [ 4.90298629  2.68209466]
Estimate method is 'stochastic'
Estimate winner is 'stochastic'
Estimate time:   0.0 min 1.0927073955535889 sec
Simulation time: 0.0 min 11.691786527633667 sec
D_s: 2.6746552655917677
D: [0.71722598500124657, 0.73706884933939709, 2.6746552655917677]

Simulation 18
-------------
SimId 0949a654-6178-471b-a24f-15a68d1125c2
hyperparameters: [ 5.56220177  3.12306706]
Estimate method is 'stochastic'
Estimate winner is 'stochastic'
Estimate time:   0.0 min 1.1259191036224365 sec
Simulation time: 0.0 min 12.630681276321411 sec
D_s: 0.9379244344476237
D: [0.71722598500124657, 0.73706884933939709]

Simulation 19
-------------
SimId b386e4da-05ce-4a70-9f20-73bd2d4908d9
hyperparameters: [ 4.90298629  2.68209466]
Estimate method is 'all'
Estimate winner is 'inner-prod'
Estimate time:   0.0 min 1.5214729309082031 sec
Simulation time: 0.0 min 13.169702529907227 sec
D_s: 0.7550019382503088
D: [0.71722598500124657, 0.73706884933939709, 0.75500193825030881]

Simulation 20
-------------
SimId 948bbd81-4957-41a1-9b43-be5387c77d06
hyperparameters: [ 4.69693838  2.65400985]
Estimate method is 'all'
Estimate winner is 'inner-prod'
Estimate time:   0.0 min 1.4851388931274414 sec
Simulation time: 0.0 min 13.319425821304321 sec
D_s: 0.7971051437121173
D: [0.71722598500124657, 0.73706884933939709, 0.79710514371211727]

CPU times: user 35 s, sys: 6.32 s, total: 41.3 s
Wall time: 3min 17s

In [17]:
def convergence_plot(states, linestyles, labels, r):
    for state, ls, label in zip(states, linestyles, labels):
        x = np.arange(1, state['s'] + 1)
        D_s = state['D_s']
        y_s = sorted(D_s[:2], reverse=True) + [min(D_s[:i]) for i in x[2:]]
        y = np.fromiter(y_s, dtype='f8', count=len(x))
        plt.semilogy(x, y, linestyle=ls, color='gray', label=label)
        smask = np.fromiter((w == 'stochastic' for w in state['winner_s']), 
                            dtype='bool', count=len(x))
        if np.any(smask):
            plt.semilogy(x[smask], y[smask], linestyle='None', marker='$S$')
        imask = np.fromiter((w == 'inner-prod' for w in state['winner_s']), 
                            dtype='bool', count=len(x))
        if np.any(imask):
            plt.semilogy(x[imask], y[imask], linestyle='None', marker='$I$')
        amask = np.fromiter((w == 'all' for w in state['winner_s']), 
                            dtype='bool', count=len(x))
        if np.any(amask):
            plt.semilogy(x[amask], y[amask], linestyle='None', marker='$A$')
    plt.axis([1, 20, 0.1, 100])
    plt.grid()
    plt.legend(loc=0)
    plt.xlabel('Simulation $s$')
    plt.ylabel('Minimum Distance, $d(f, g_s)$ [GWe]')
    plt.title('{}% Growth'.format(r))
    fname = 'converge-{}per'.format(r)
    plt.savefig(fname + '.eps')
    plt.savefig(fname + '.png')

In [18]:
linestyles = ['--', 'dotted', '-']
labels = ['stochastic', 'inner-prod', 'all']

In [19]:
convergence_plot([state0sto, state0inn, state0all], linestyles, labels, 0)



In [20]:
convergence_plot([state1sto, state1inn, state1all], linestyles, labels, 1)



In [21]:
convergence_plot([state2sto, state2inn, state2all], linestyles, labels, 2)



In [22]:
def demand_product(states, title):
    rates = [0, 1, 2]
    colors = ['k', 'green', 'purple']
    for state, color, rate in zip(states, colors, rates):
        f = state['f']
        g = state['G'][0]
        h = state['G'][1]
        t = 2016 + np.arange(len(g))
        plt.plot(t, f, linestyle='--', color=color)
        plt.plot(t, g, linestyle='-', color=color, label='{}% growth'.format(rate))
        plt.plot(t, h, linestyle=':', color=color)
    plt.legend(loc=0)
    plt.axis([2016, 2015+T, 80, 150])
    plt.xlabel('time [year]')
    plt.ylabel('Power [GWe]')
    plt.title(title + ' Method')
    fname = 'demand-product-{}'.format(make_fname_safe(title))
    plt.savefig(fname + '.eps')
    plt.savefig(fname + '.png')

In [23]:
demand_product([state0sto, state1sto, state2sto], 'Stochastic')



In [24]:
demand_product([state0inn, state1inn, state2inn], 'Inner Product')



In [25]:
demand_product([state0all, state1all, state2all], 'All')



In [26]:
def deploy_plot(states, labels, colors, r):
    width = 0.8 / len(states)
    for i, state, label, color in zip(range(len(states)), states, labels, colors):
        tgrid = np.arange(2015, 2015+state['T'])
        plt.bar(tgrid + i*width, state['Θs'][0], width, label=label, color=color)
    ax = plt.axis()
    plt.axis(ax[:2] + (0, 12))
    plt.legend(loc=0)
    plt.grid(axis='y')
    plt.xlabel('time [year]')
    plt.ylabel('Number of Deployed LWRs, $\Theta$')
    plt.title('{}% Growth'.format(r))
    fname = 'deploy-{}'.format(r)
    plt.savefig(fname + '.eps')
    plt.savefig(fname + '.png')
        
dlabels = ['stochastic', 'inner-prod', 'all']
dcolors = ['k', 'green', 'purple']

In [27]:
deploy_plot([state0sto, state0inn, state0all], dlabels, dcolors, 0)



In [28]:
deploy_plot([state1sto, state1inn, state1all], dlabels, dcolors, 1)



In [29]:
deploy_plot([state2sto, state2inn, state2all], dlabels, dcolors, 2)



In [30]:
#%time state0all5 = run_percent_growth(0, T=5, MAX_S=20, method_0='all')

In [31]:
#%time state0all10 = run_percent_growth(0, T=10, MAX_S=20, method_0='all')

In [32]:
#%time state0all15 = run_percent_growth(0, T=15, MAX_S=20, method_0='all')

In [33]:
#%time state0all50 = run_percent_growth(0, T=50, MAX_S=20, method_0='all')

In [34]:
def time_horizon_plot(states):
    x, y = [], []
    for state in states:
        x.append(state['T'])
        y.append(state['D'][0])
    plt.plot(x, y, 'k-')

In [35]:
#time_horizon_plot([state0all5, state0all10, state0all15, state0all, state0all50])

In [ ]: