This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
elif self.mode == 'n_fittest': | |
if r[i][x] < self.disturbance_threshold: | |
p[x] = np.random.normal(dev, mean) | |
else: | |
leader_rate = np.random.uniform(0.0, 1.0) | |
update = np.average(self.population[n_fittest]) - best_neighbour[x] | |
p[x] = best_neighbour[x] + leader_rate * update |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
elif self.mode == 'random_gauss': | |
p[x] = np.random.normal(dev, mean) | |
elif self.mode == 'random_uniform': | |
p[x] = np.random.sample() |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
for (auto& agent : unhappy_agents) | |
{ | |
if (happy_agents.size() > 0) | |
{ | |
size_t random_index = uniform_random.get_next(agent_size - 1); | |
if (agents[random_index]->happy) | |
{ | |
set_agent_randomly_in_same_quadrant(agents[random_index], | |
agent, | |
agents, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
for (auto& agent : agents) | |
{ | |
if (agent->set_happy(partial_grid)) | |
{ | |
happy_agents.push_back(agent); | |
const size_t hill_index = get_hill_index((*agent), partial_size, grid_size); | |
if (++most_frequent_hill_indices[hill_index] > max_indices) | |
{ | |
max_indices = most_frequent_hill_indices[hill_index]; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import ccxt | |
# Load the poloniex exhange. There is | |
# limited functionality available with the | |
# public API where you don't need to key e.g | |
# we can query the exchanges's state. We | |
# can't place trades without setting up a key | |
# and passing this to ccxt. | |
poloniex = ccxt.poloniex() | |
poloniex.load_markets() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pip install dash # The core dash backend | |
pip install dash-renderer # The dash front-end | |
pip install dash-html-components # HTML components | |
pip install dash-core-components # Supercharged components | |
pip install plotly --upgrade # Latest Plotly graphing library |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import ccxt | |
import time | |
exchange = ccxt.poloniex() | |
exchange.load_markets() | |
delay_seconds = exchange.rateLimit / 1000 | |
symbols = dict() | |
iteration = 0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from collections import deque | |
import ccxt | |
import time | |
import datetime | |
import dash | |
from dash.dependencies import Input, Output, Event | |
import dash_core_components as dcc | |
import dash_html_components as html | |
import plotly.graph_objs as go | |
import threading |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.