This commit is contained in:
Andrew Clark 2020-08-09 14:48:00 -04:00
parent 3a4e78be3c
commit 2a3f14f3d0
18 changed files with 1262 additions and 743 deletions

View File

@ -1,32 +0,0 @@
{
"cells": [
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.7.5"
}
},
"nbformat": 4,
"nbformat_minor": 2
}

File diff suppressed because one or more lines are too long

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: 96 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 106 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 69 KiB

After

Width:  |  Height:  |  Size: 93 KiB

View File

@ -14,7 +14,7 @@ from .model.sys_params import *
sim_config = config_sim({ sim_config = config_sim({
'N': 1, 'N': 1,
'T': range(60), #day 'T': range(100), #day
'M': params, 'M': params,
}) })

View File

@ -13,7 +13,7 @@ genesis_states = {
initial_values['supply'],initial_params), initial_values['supply'],initial_params),
'funds':initial_values['initial_funds'], 'funds':initial_values['initial_funds'],
'sentiment': initial_values['initial_sentiment'], 'sentiment': initial_values['initial_sentiment'],
'effective_supply': initial_values['supply']-initial_values['initial_funds'], 'effective_supply': (initial_values['supply']-initial_values['initial_funds'])*.8, #force some slack into the inequality
'total_supply': initial_values['supply'] 'total_supply': initial_values['supply']
} }

View File

@ -83,7 +83,7 @@ def gen_new_participant(network, new_participant_holdings):
a_rv = a_rv = np.random.uniform(-1,1,1)[0] a_rv = a_rv = np.random.uniform(-1,1,1)[0]
network.edges[(i, j)]['affinity'] = a_rv network.edges[(i, j)]['affinity'] = a_rv
network.edges[(i,j)]['tokens'] = 0 network.edges[(i,j)]['tokens'] = 0 #a_rv*network.nodes[i]['holdings']
network.edges[(i, j)]['conviction'] = 0 network.edges[(i, j)]['conviction'] = 0
network.edges[(i,j)]['type'] = 'support' network.edges[(i,j)]['type'] = 'support'

View File

@ -4,8 +4,6 @@ from .conviction_helper_functions import *
import networkx as nx import networkx as nx
from .sys_params import * from .sys_params import *
# hyperparameters
mu = 0.01
# Phase 2 # Phase 2
# Behaviors # Behaviors

View File

@ -27,10 +27,10 @@ def driving_process(params, step, sL, s):
candidate_subgraph = s['network'].subgraph(subgraph_nodes) candidate_subgraph = s['network'].subgraph(subgraph_nodes)
supporters = get_edges_by_type(candidate_subgraph, 'support') supporters = get_edges_by_type(candidate_subgraph, 'support')
len_parts = len(participants) #len_parts = len(participants)
supply = s['effective_supply'] available_supply = s['total_supply']-s['effective_supply']
expected_holdings = .01*supply/len_parts expected_holdings = .01*available_supply
if new_participant: if new_participant:
h_rv = expon.rvs(loc=0.0, scale=expected_holdings) h_rv = expon.rvs(loc=0.0, scale=expected_holdings)
new_participant_holdings = h_rv new_participant_holdings = h_rv
@ -62,8 +62,8 @@ def driving_process(params, step, sL, s):
funds = s['funds'] funds = s['funds']
scale_factor = funds*sentiment**2/10000 scale_factor = funds*sentiment**2/10000
if scale_factor <1: # if scale_factor <1:
scale_factor = 1 # scale_factor = 1
#this shouldn't happen but expon is throwing domain errors #this shouldn't happen but expon is throwing domain errors
# if sentiment>.4: # if sentiment>.4:
@ -76,8 +76,8 @@ def driving_process(params, step, sL, s):
'new_proposal':new_proposal, #True/False 'new_proposal':new_proposal, #True/False
'new_proposal_ct': new_proposal_ct, #int 'new_proposal_ct': new_proposal_ct, #int
'new_proposal_requested':new_proposal_requested, #list funds requested by new proposal if True, len =ct 'new_proposal_requested':new_proposal_requested, #list funds requested by new proposal if True, len =ct
# 'funds_arrival':funds_arrival #quantity of new funds arriving to the communal pool (donations or revenue) # 'funds_arrival':funds_arrival
}) }) #quantity of new funds arriving to the communal pool (donations or revenue)
# Mechanisms # Mechanisms
def update_network(params, step, sL, s, _input): def update_network(params, step, sL, s, _input):
@ -136,13 +136,11 @@ def increment_supply(params, step, sL, s, _input):
# Substep 2 # Substep 2
def minting_rule(params, step, sL, s): def minting_rule(params, step, sL, s):
supply = s['total_supply'] supply = s['total_supply']
tokens_to_mint = params['gamma'] * supply tokens_to_mint = params['gamma'] * supply #order 0.001 or smaller: expansion of supply per day
return ({'mint':tokens_to_mint}) return ({'mint':tokens_to_mint})
# Mechanisms # Mechanisms
def mint_to_supply(params, step, sL, s, _input): def mint_to_supply(params, step, sL, s, _input):
'''
'''
mint = _input['mint'] mint = _input['mint']
supply = s['total_supply'] supply = s['total_supply']
@ -152,8 +150,6 @@ def mint_to_supply(params, step, sL, s, _input):
return (key, value) return (key, value)
def mint_to_funds(params, step, sL, s, _input): def mint_to_funds(params, step, sL, s, _input):
'''
'''
mint = _input['mint'] mint = _input['mint']
funds = s['funds'] funds = s['funds']