adding model 3

This commit is contained in:
Andrew Clark 2020-08-06 14:29:53 -04:00
parent 5d62eecb7c
commit 3485a64fc6
17 changed files with 1908 additions and 266 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

Binary file not shown.

Before

Width:  |  Height:  |  Size: 73 KiB

After

Width:  |  Height:  |  Size: 66 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.6 KiB

After

Width:  |  Height:  |  Size: 11 KiB

View File

@ -4,7 +4,7 @@ from datetime import timedelta
import numpy as np
from typing import Dict, List
from cadCAD.configuration import append_configs
from cadCAD.configuration import Experiment
from cadCAD.configuration.utils import bound_norm_random, ep_time_step, config_sim, access_block
from .genesis_states import genesis_states
@ -21,8 +21,9 @@ seeds = {
'p': np.random.RandomState(1),
}
exp = Experiment()
append_configs(
exp.append_configs(
sim_configs=sim_config,
initial_state=genesis_states,
seeds=seeds,

View File

@ -7,6 +7,7 @@ genesis_states = {
initial_values['supply']),
'funds':initial_values['initial_funds'],
'sentiment': initial_values['initial_sentiment'],
'supply': initial_values['supply']
'effective_supply': initial_values['supply'],
'funds_arrival': 0
}

View File

@ -11,7 +11,7 @@ def trigger_function(params, step, sL, s):
'''
network = s['network']
funds = s['funds']
supply = s['supply']
supply = s['effective_supply']
proposals = get_nodes_by_type(network, 'proposal')
accepted = []

View File

@ -6,14 +6,14 @@ initial_values = {
'n': 30, #initial participants
'm': 7, #initial proposals
'initial_funds': 4867.21, # in honey, as of 8-5-2020
'supply': 22392.22, # Honey supply balance as of 8-5-2020
'supply': 22392.22, # Honey total supply balance as of 8-5-2020
}
# Parameters
sys_params = {
'beta': 0.2, # maximum share of funds a proposal can take
'rho': 0.0025, # tuning param for the trigger function
'alpha': 1/2**3, # timescale set in days with 3 day halflife (from comments in contract comments)
'alpha': 0.875, # timescale set in days with 3 day halflife (from comments in contract comments)
'sensitivity': .75,
'tmin': 0, #unit days; minimum periods passed before a proposal can pass
'min_supp': 1, #number of tokens that must be stake for a proposal to be a candidate

View File

@ -29,7 +29,10 @@ def driving_process(params, step, sL, s):
supporters = get_edges_by_type(candidate_subgraph, 'support')
len_parts = len(participants)
supply = s['supply']
supply = s['effective_supply']
funds_arrival = supply * 0.0001
expected_holdings = .01*supply/len_parts
if new_participant:
h_rv = expon.rvs(loc=0.0, scale=expected_holdings)
@ -87,7 +90,7 @@ def update_network(params, step, sL, s, _input):
network = s['network']
funds = s['funds']
supply = s['supply']
supply = s['effective_supply']
new_participant = _input['new_participant']
new_proposal = _input['new_proposal']
@ -130,4 +133,31 @@ def increment_funds(params, step, sL, s, _input):
key = 'funds'
value = funds
return (key, value)
def increment_supply(params, step, sL, s, _input):
'''
Increase funds by the amount of the new particpant's funds.
'''
supply = s['effective_supply']
funds_arrival = _input['funds_arrival']
#increment funds
supply = supply + funds_arrival #/2 * 0.0001
key = 'supply'
value = supply
return (key, value)
def fund_arrival_check(params, step, sL, s, _input):
'''
Increase funds by the amount of the new particpant's funds.
'''
funds_arrival = _input['funds_arrival']
key = 'funds_arrival'
value = funds_arrival
return (key, value)

View File

@ -12,6 +12,8 @@ partial_state_update_blocks = [
'variables': {
'network': update_network,
'funds':increment_funds,
'effective_supply': increment_supply,
'funds_arrival' : fund_arrival_check,
}
},
{