add cadcad spec and multi imgs
This commit is contained in:
parent
699fb8121f
commit
618106b2d0
Binary file not shown.
After Width: | Height: | Size: 655 KiB |
Binary file not shown.
After Width: | Height: | Size: 91 KiB |
File diff suppressed because one or more lines are too long
|
@ -101,13 +101,12 @@ partial_state_update_block = [
|
|||
},
|
||||
{
|
||||
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
||||
# PROVE with P, Update gradient, Update zees, update escrow with tax and subsidy
|
||||
# GRADIENT, Update gradient, Update zees, update escrow with tax and subsidy
|
||||
'policies': {
|
||||
'tax_subsidy': p_gradient,
|
||||
},
|
||||
'variables': {
|
||||
'angles': s_angles,
|
||||
'network': s_network_proof_payment,
|
||||
'event' : s_reconcile,
|
||||
'treasury': s_treasury,
|
||||
'zees' : s_zees,
|
||||
|
|
|
@ -18,7 +18,10 @@ def p_gradient(params, substep, state_history, prev_state):
|
|||
list_length = prev_state['history'].solved
|
||||
if len(list_length) > 0:
|
||||
time = prev_state['history'].solved[-1].total_time
|
||||
############################################
|
||||
## FOR TESTING #############################
|
||||
time = time * np.random.normal(1,0.2)
|
||||
#############################################
|
||||
# sending node, receiving node
|
||||
# MAKE K to J for distance
|
||||
# Keep i to p for TIME
|
||||
|
|
|
@ -102,7 +102,7 @@ genesis_states = {
|
|||
'network': ij,
|
||||
'gross_storage_demand': 0,
|
||||
'least_storage_demand': 0,
|
||||
'PO': 0,
|
||||
# 'PO': 0, # FOr testing
|
||||
# 'test': 0, # For testing
|
||||
'event': Event(),
|
||||
'history': History(),
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
# from ..model.parts.timestamp import DAYS_PER_TIMESTEP
|
||||
|
||||
#simulation configuration parameters
|
||||
SIMULATION_TIME_STEPS = int(100) # timestep
|
||||
SIMULATION_TIME_STEPS = int(200) # timestep
|
||||
|
||||
# N monte carlo runs
|
||||
MONTE_CARLO_RUNS = 20
|
||||
MONTE_CARLO_RUNS = 5
|
||||
|
||||
# time configuration parameters
|
||||
DAYS_PER_TIMESTEP = 1
|
||||
|
|
100
test_main.ipynb
100
test_main.ipynb
|
@ -9,9 +9,8 @@
|
|||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"[{'N': 20, 'T': range(0, 100), 'M': {'block_time': 30, 'i_storage': 500, 'i_in_bandwidth': 1234, 'i_out_bandwidth': 140, 'j_storage': 500, 'i_wallet': 10000, 'j_in_bandwidth': 400, 'j_out_bandwidth': 100, 'j_wallet': 0, 'p_storage': 4000, 'p_in_bandwidth': 400, 'p_out_bandwidth': 600, 'p_wallet': 0, 'k_storage': 8000, 'k_in_bandwidth': 400, 'k_out_bandwidth': 80, 'k_wallet': 0, 'r_storage': 8000, 'r_in_bandwidth': 400, 'r_out_bandwidth': 80, 'r_wallet': 0, 'j_avail_to_i': 0.9, 'k_avail_to_i': 0.8, 'j_avail_to_k': 0.7, 'p_avail_to_i': 0.6, 'depth': 15, 'tax_%': 0.1, 'subsidy_escrow': 0.1, 'subsidy_treasury': 0.1, 'route_allocation': 0.1, 'store_allocation': 0.45, 'prove_allocation': 0.45, 'starting_treasury': 0, 'j_prove_likelihood': 0.95}}, {'N': 20, 'T': range(0, 100), 'M': {'block_time': 30, 'i_storage': 500, 'i_in_bandwidth': 1234, 'i_out_bandwidth': 140, 'j_storage': 500, 'i_wallet': 10000, 'j_in_bandwidth': 400, 'j_out_bandwidth': 100, 'j_wallet': 0, 'p_storage': 4000, 'p_in_bandwidth': 400, 'p_out_bandwidth': 600, 'p_wallet': 0, 'k_storage': 8000, 'k_in_bandwidth': 400, 'k_out_bandwidth': 80, 'k_wallet': 0, 'r_storage': 8000, 'r_in_bandwidth': 400, 'r_out_bandwidth': 80, 'r_wallet': 0, 'j_avail_to_i': 0.9, 'k_avail_to_i': 0.8, 'j_avail_to_k': 0.7, 'p_avail_to_i': 0.6, 'depth': 15, 'tax_%': 0.1, 'subsidy_escrow': 0.1, 'subsidy_treasury': 0.1, 'route_allocation': 0.1, 'store_allocation': 0.45, 'prove_allocation': 0.45, 'starting_treasury': 1000, 'j_prove_likelihood': 0.95}}, {'N': 20, 'T': range(0, 100), 'M': {'block_time': 30, 'i_storage': 500, 'i_in_bandwidth': 1234, 'i_out_bandwidth': 140, 'j_storage': 500, 'i_wallet': 10000, 'j_in_bandwidth': 400, 'j_out_bandwidth': 100, 'j_wallet': 0, 'p_storage': 4000, 'p_in_bandwidth': 400, 'p_out_bandwidth': 600, 'p_wallet': 0, 'k_storage': 8000, 'k_in_bandwidth': 400, 'k_out_bandwidth': 80, 'k_wallet': 0, 'r_storage': 8000, 'r_in_bandwidth': 400, 'r_out_bandwidth': 80, 'r_wallet': 0, 'j_avail_to_i': 0.9, 'k_avail_to_i': 0.8, 'j_avail_to_k': 0.7, 'p_avail_to_i': 0.6, 'depth': 15, 'tax_%': 0.1, 'subsidy_escrow': 0.1, 'subsidy_treasury': 0.1, 'route_allocation': 0.1, 'store_allocation': 0.45, 'prove_allocation': 0.45, 'starting_treasury': 2000, 'j_prove_likelihood': 0.95}}]\n",
|
||||
"[{'N': 20, 'T': range(0, 100), 'M': {'block_time': 30, 'i_storage': 500, 'i_in_bandwidth': 1234, 'i_out_bandwidth': 140, 'j_storage': 500, 'i_wallet': 10000, 'j_in_bandwidth': 400, 'j_out_bandwidth': 100, 'j_wallet': 0, 'p_storage': 4000, 'p_in_bandwidth': 400, 'p_out_bandwidth': 600, 'p_wallet': 0, 'k_storage': 8000, 'k_in_bandwidth': 400, 'k_out_bandwidth': 80, 'k_wallet': 0, 'r_storage': 8000, 'r_in_bandwidth': 400, 'r_out_bandwidth': 80, 'r_wallet': 0, 'j_avail_to_i': 0.9, 'k_avail_to_i': 0.8, 'j_avail_to_k': 0.7, 'p_avail_to_i': 0.6, 'depth': 15, 'tax_%': 0.1, 'subsidy_escrow': 0.1, 'subsidy_treasury': 0.1, 'route_allocation': 0.1, 'store_allocation': 0.45, 'prove_allocation': 0.45, 'starting_treasury': 0, 'j_prove_likelihood': 0.95}}, {'N': 20, 'T': range(0, 100), 'M': {'block_time': 30, 'i_storage': 500, 'i_in_bandwidth': 1234, 'i_out_bandwidth': 140, 'j_storage': 500, 'i_wallet': 10000, 'j_in_bandwidth': 400, 'j_out_bandwidth': 100, 'j_wallet': 0, 'p_storage': 4000, 'p_in_bandwidth': 400, 'p_out_bandwidth': 600, 'p_wallet': 0, 'k_storage': 8000, 'k_in_bandwidth': 400, 'k_out_bandwidth': 80, 'k_wallet': 0, 'r_storage': 8000, 'r_in_bandwidth': 400, 'r_out_bandwidth': 80, 'r_wallet': 0, 'j_avail_to_i': 0.9, 'k_avail_to_i': 0.8, 'j_avail_to_k': 0.7, 'p_avail_to_i': 0.6, 'depth': 15, 'tax_%': 0.1, 'subsidy_escrow': 0.1, 'subsidy_treasury': 0.1, 'route_allocation': 0.1, 'store_allocation': 0.45, 'prove_allocation': 0.45, 'starting_treasury': 1000, 'j_prove_likelihood': 0.95}}, {'N': 20, 'T': range(0, 100), 'M': {'block_time': 30, 'i_storage': 500, 'i_in_bandwidth': 1234, 'i_out_bandwidth': 140, 'j_storage': 500, 'i_wallet': 10000, 'j_in_bandwidth': 400, 'j_out_bandwidth': 100, 'j_wallet': 0, 'p_storage': 4000, 'p_in_bandwidth': 400, 'p_out_bandwidth': 600, 'p_wallet': 0, 'k_storage': 8000, 'k_in_bandwidth': 400, 'k_out_bandwidth': 80, 'k_wallet': 0, 'r_storage': 8000, 'r_in_bandwidth': 400, 'r_out_bandwidth': 80, 'r_wallet': 0, 'j_avail_to_i': 0.9, 'k_avail_to_i': 0.8, 'j_avail_to_k': 0.7, 'p_avail_to_i': 0.6, 'depth': 15, 'tax_%': 0.1, 'subsidy_escrow': 0.1, 'subsidy_treasury': 0.1, 'route_allocation': 0.1, 'store_allocation': 0.45, 'prove_allocation': 0.45, 'starting_treasury': 2000, 'j_prove_likelihood': 0.95}}]\n",
|
||||
"[{'N': 20, 'T': range(0, 100), 'M': {'block_time': 30, 'i_storage': 500, 'i_in_bandwidth': 1234, 'i_out_bandwidth': 140, 'j_storage': 500, 'i_wallet': 10000, 'j_in_bandwidth': 400, 'j_out_bandwidth': 100, 'j_wallet': 0, 'p_storage': 4000, 'p_in_bandwidth': 400, 'p_out_bandwidth': 600, 'p_wallet': 0, 'k_storage': 8000, 'k_in_bandwidth': 400, 'k_out_bandwidth': 80, 'k_wallet': 0, 'r_storage': 8000, 'r_in_bandwidth': 400, 'r_out_bandwidth': 80, 'r_wallet': 0, 'j_avail_to_i': 0.9, 'k_avail_to_i': 0.8, 'j_avail_to_k': 0.7, 'p_avail_to_i': 0.6, 'depth': 15, 'tax_%': 0.1, 'subsidy_escrow': 0.1, 'subsidy_treasury': 0.1, 'route_allocation': 0.1, 'store_allocation': 0.45, 'prove_allocation': 0.45, 'starting_treasury': 0, 'j_prove_likelihood': 0.95}}, {'N': 20, 'T': range(0, 100), 'M': {'block_time': 30, 'i_storage': 500, 'i_in_bandwidth': 1234, 'i_out_bandwidth': 140, 'j_storage': 500, 'i_wallet': 10000, 'j_in_bandwidth': 400, 'j_out_bandwidth': 100, 'j_wallet': 0, 'p_storage': 4000, 'p_in_bandwidth': 400, 'p_out_bandwidth': 600, 'p_wallet': 0, 'k_storage': 8000, 'k_in_bandwidth': 400, 'k_out_bandwidth': 80, 'k_wallet': 0, 'r_storage': 8000, 'r_in_bandwidth': 400, 'r_out_bandwidth': 80, 'r_wallet': 0, 'j_avail_to_i': 0.9, 'k_avail_to_i': 0.8, 'j_avail_to_k': 0.7, 'p_avail_to_i': 0.6, 'depth': 15, 'tax_%': 0.1, 'subsidy_escrow': 0.1, 'subsidy_treasury': 0.1, 'route_allocation': 0.1, 'store_allocation': 0.45, 'prove_allocation': 0.45, 'starting_treasury': 1000, 'j_prove_likelihood': 0.95}}, {'N': 20, 'T': range(0, 100), 'M': {'block_time': 30, 'i_storage': 500, 'i_in_bandwidth': 1234, 'i_out_bandwidth': 140, 'j_storage': 500, 'i_wallet': 10000, 'j_in_bandwidth': 400, 'j_out_bandwidth': 100, 'j_wallet': 0, 'p_storage': 4000, 'p_in_bandwidth': 400, 'p_out_bandwidth': 600, 'p_wallet': 0, 'k_storage': 8000, 'k_in_bandwidth': 400, 'k_out_bandwidth': 80, 'k_wallet': 0, 'r_storage': 8000, 'r_in_bandwidth': 400, 'r_out_bandwidth': 80, 'r_wallet': 0, 'j_avail_to_i': 0.9, 'k_avail_to_i': 0.8, 'j_avail_to_k': 0.7, 'p_avail_to_i': 0.6, 'depth': 15, 'tax_%': 0.1, 'subsidy_escrow': 0.1, 'subsidy_treasury': 0.1, 'route_allocation': 0.1, 'store_allocation': 0.45, 'prove_allocation': 0.45, 'starting_treasury': 2000, 'j_prove_likelihood': 0.95}}]\n"
|
||||
"[{'N': 3, 'T': range(0, 182), 'M': {'block_time': 30, 'i_storage': 500, 'i_in_bandwidth': 500, 'i_out_bandwidth': 140, 'j_storage': 500, 'j_in_bandwidth': 400, 'j_out_bandwidth': 100, 'p_storage': 4000, 'p_in_bandwidth': 400, 'p_out_bandwidth': 600, 'k_storage': 8000, 'k_in_bandwidth': 400, 'k_out_bandwidth': 80, 'j_avail_to_i': 0.9, 'k_avail_to_i': 0.8, 'j_avail_to_k': 0.7, 'p_avail_to_i': 0.6, 'depth': 15}}, {'N': 3, 'T': range(0, 182), 'M': {'block_time': 30, 'i_storage': 500, 'i_in_bandwidth': 1234, 'i_out_bandwidth': 140, 'j_storage': 500, 'j_in_bandwidth': 400, 'j_out_bandwidth': 100, 'p_storage': 4000, 'p_in_bandwidth': 400, 'p_out_bandwidth': 600, 'k_storage': 8000, 'k_in_bandwidth': 400, 'k_out_bandwidth': 80, 'j_avail_to_i': 0.9, 'k_avail_to_i': 0.8, 'j_avail_to_k': 0.7, 'p_avail_to_i': 0.6, 'depth': 15}}]\n",
|
||||
"[{'N': 3, 'T': range(0, 182), 'M': {'block_time': 30, 'i_storage': 500, 'i_in_bandwidth': 500, 'i_out_bandwidth': 140, 'j_storage': 500, 'j_in_bandwidth': 400, 'j_out_bandwidth': 100, 'p_storage': 4000, 'p_in_bandwidth': 400, 'p_out_bandwidth': 600, 'k_storage': 8000, 'k_in_bandwidth': 400, 'k_out_bandwidth': 80, 'j_avail_to_i': 0.9, 'k_avail_to_i': 0.8, 'j_avail_to_k': 0.7, 'p_avail_to_i': 0.6, 'depth': 15}}, {'N': 3, 'T': range(0, 182), 'M': {'block_time': 30, 'i_storage': 500, 'i_in_bandwidth': 1234, 'i_out_bandwidth': 140, 'j_storage': 500, 'j_in_bandwidth': 400, 'j_out_bandwidth': 100, 'p_storage': 4000, 'p_in_bandwidth': 400, 'p_out_bandwidth': 600, 'k_storage': 8000, 'k_in_bandwidth': 400, 'k_out_bandwidth': 80, 'j_avail_to_i': 0.9, 'k_avail_to_i': 0.8, 'j_avail_to_k': 0.7, 'p_avail_to_i': 0.6, 'depth': 15}}]\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
|
@ -37,8 +36,8 @@
|
|||
" \\___/\\__,_/\\__,_/\\____/_/ |_/_____/ \n",
|
||||
" by BlockScience\n",
|
||||
" \n",
|
||||
"Execution Mode: multi_proc: [<cadCAD.configuration.Configuration object at 0x00000273CDC7DB70>, <cadCAD.configuration.Configuration object at 0x00000273CDC7DBE0>, <cadCAD.configuration.Configuration object at 0x00000273CEF72DA0>]\n",
|
||||
"Configurations: [<cadCAD.configuration.Configuration object at 0x00000273CDC7DB70>, <cadCAD.configuration.Configuration object at 0x00000273CDC7DBE0>, <cadCAD.configuration.Configuration object at 0x00000273CEF72DA0>]\n"
|
||||
"Execution Mode: multi_proc: [<cadCAD.configuration.Configuration object at 0x00000255875CDA58>, <cadCAD.configuration.Configuration object at 0x00000255875CDA90>]\n",
|
||||
"Configurations: [<cadCAD.configuration.Configuration object at 0x00000255875CDA58>, <cadCAD.configuration.Configuration object at 0x00000255875CDA90>]\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
|
@ -48,81 +47,44 @@
|
|||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 5,
|
||||
"execution_count": 3,
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
" timestamp message_array \\\n",
|
||||
"0 2020-01-01 [[0, 0, 0]] \n",
|
||||
"11 2020-01-01 [[0, 0, 0]] \n",
|
||||
"22 2020-01-01 [[0, 0, 0]] \n",
|
||||
"33 2020-01-01 [[0, 0, 0]] \n",
|
||||
"44 2020-01-01 [[0, 0, 0]] \n",
|
||||
"\n",
|
||||
" message_list \\\n",
|
||||
"0 [[None, None, None], [None, None, None]] \n",
|
||||
"11 [[None, None, None], [None, None, None], [1617... \n",
|
||||
"22 [[None, None, None], [None, None, None], [1617... \n",
|
||||
"33 [[None, None, None], [None, None, None], [1617... \n",
|
||||
"44 [[None, None, None], [None, None, None], [1617... \n",
|
||||
"\n",
|
||||
" file_list demand \\\n",
|
||||
"0 [[None, None, None], [None, None, None]] 0 \n",
|
||||
"11 [[None, None, None], [None, None, None]] [1617457632, 46, 1] \n",
|
||||
"22 [[None, None, None], [None, None, None]] [1617461664, 172, 1] \n",
|
||||
"33 [[None, None, None], [None, None, None]] [1617459808, 114, 1] \n",
|
||||
"44 [[None, None, None], [None, None, None]] [1617457600, 45, 1] \n",
|
||||
"\n",
|
||||
" arrival message_arrival \\\n",
|
||||
"0 0 [[None, None, None], [None, None, None]] \n",
|
||||
"11 [1617459104, 92, 1] [1617458336, 68, 1] \n",
|
||||
"22 [1617458720, 80, 1] [1617457856, 53, 1] \n",
|
||||
"33 [1617457472, 41, 1] [1617457792, 51, 1] \n",
|
||||
"44 [1617457984, 57, 1] [1617456576, 13, 1] \n",
|
||||
"\n",
|
||||
" network gross_storage_demand least_storage_demand PO \\\n",
|
||||
"0 (i, j, k, p, r) 0 0 0 \n",
|
||||
"11 (i, j, k, p, r) 0 0 0 \n",
|
||||
"22 (i, j, k, p, r) 218 218 0 \n",
|
||||
"33 (i, j, k, p, r) 332 332 0 \n",
|
||||
"44 (i, j, k, p, r) 377 377 0 \n",
|
||||
"\n",
|
||||
" event \\\n",
|
||||
"0 <class 'src.sim.model.utils.Event'>: {'sending... \n",
|
||||
"11 <class 'src.sim.model.utils.Event'>: {'sending... \n",
|
||||
"22 <class 'src.sim.model.utils.Event'>: {'sending... \n",
|
||||
"33 <class 'src.sim.model.utils.Event'>: {'sending... \n",
|
||||
"44 <class 'src.sim.model.utils.Event'>: {'sending... \n",
|
||||
"\n",
|
||||
" history angles \\\n",
|
||||
"0 <class 'src.sim.model.utils.History'>: {'activ... [0.0, 1.0, -1.0] \n",
|
||||
"11 <class 'src.sim.model.utils.History'>: {'activ... [0.0, 1.0, -1.0] \n",
|
||||
"22 <class 'src.sim.model.utils.History'>: {'activ... [0.0, 1.0, -1.0] \n",
|
||||
"33 <class 'src.sim.model.utils.History'>: {'activ... [0.0, 1.0, -1.0] \n",
|
||||
"44 <class 'src.sim.model.utils.History'>: {'activ... [0.0, 1.0, -1.0] \n",
|
||||
"\n",
|
||||
" zees treasury transit run \\\n",
|
||||
"0 [0.0, 1.0, -1.0] 0.0 0.0 1 \n",
|
||||
"11 [0.0, 1.224744871391589, -1.224744871391589] 0.0 32.0 1 \n",
|
||||
"22 [0.0, 1.224744871391589, -1.224744871391589] 0.0 90.0 1 \n",
|
||||
"33 [0.0, 1.224744871391589, -1.224744871391589] 0.0 141.0 1 \n",
|
||||
"44 [0.0, 1.224744871391589, -1.224744871391589] 0.0 239.0 1 \n",
|
||||
"\n",
|
||||
" substep timestep \n",
|
||||
"0 0 0 \n",
|
||||
"11 11 1 \n",
|
||||
"22 11 2 \n",
|
||||
"33 11 3 \n",
|
||||
"44 11 4 \n"
|
||||
"<class 'src.model.utils.Event'>: {'sending_node': 'i', 'receiving_node': 'j', 'hash_file': 2, 'size': 3, 'block_init': 4, 'reward': 5, 'block_end': None, 'storing_node': None, 'proving_node': None, 'time': None}\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"print(experiments.dataset[0].head())"
|
||||
"print(experiments.dataset[0]['event'][4])"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 4,
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"<class 'src.model.utils.History'>: {'active': [<src.model.utils.Event object at 0x000002558AF62E10>], 'routed': [], 'solved': []}\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"print(experiments.dataset[0]['history'][4])"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": []
|
||||
}
|
||||
],
|
||||
"metadata": {
|
||||
|
|
Loading…
Reference in New Issue