<jupyter_start><jupyter_text>Useful functions<jupyter_code># Needed for reproducibility.
set_seeds()<jupyter_output><empty_output><jupyter_text>Constants<jupyter_code>ENVIRONMENT_SIZE_X = 100
ENVIRONMENT_SIZE_Y = 100
ENVIRONMENT_RADIUS = 40
TAIL_RADIUS = ENVIRONMENT_RADIUS/10
RESOURCE_MAX = 255

TOTAL_TIMESTEP = 1000 #3*10**2
NUMBER_OF_AGENTS = 50

AGENT_RADIUS = 1
AGENT_INFLUENCE_RADIUS = 3
AGENT_INFLUENCE_STRENGTH = 10
AGENT_GRADIENT_SENSITIVITY = 0.5

RELAXATION_TIME = 12;
DELTA_TIME = 0.1
DIFFUSIVITY = 0
MOVIE_DELTA_TIMESTEP = 1

TIME = np.arange(0,TOTAL_TIMESTEP*DELTA_TIME,DELTA_TIME)<jupyter_output><empty_output><jupyter_text>Initial states:- Create the simple environment- Create the agent positions array<jupyter_code>CENTER_X = (ENVIRONMENT_SIZE_X-1)/2
CENTER_Y = (ENVIRONMENT_SIZE_Y-1)/2
ENVIRONMENT = np.zeros((ENVIRONMENT_SIZE_X,ENVIRONMENT_SIZE_Y))
for dummy_X in range(0,ENVIRONMENT.shape[0]):
    for dummy_Y in range(0,ENVIRONMENT.shape[1]):
        dummy_R = np.sqrt((dummy_X-CENTER_X)**2+(dummy_Y-CENTER_Y)**2)
        if dummy_R<ENVIRONMENT_RADIUS:
            ENVIRONMENT[dummy_X,dummy_Y] = RESOURCE_MAX
        else:
            ENVIRONMENT[dummy_X,dummy_Y] = RESOURCE_MAX*\
                np.exp(-(dummy_R-ENVIRONMENT_RADIUS)**2/(2*TAIL_RADIUS**2))
            
POSITION_X,POSITION_Y, _pos_array_x, _pos_array_y = generate_positions(NUMBER_OF_AGENTS, ENVIRONMENT_SIZE_X,ENVIRONMENT_SIZE_Y,ENVIRONMENT,TOTAL_TIMESTEP, RESOURCE_MAX)

TIMEDRAW_LIST = np.arange(0,TOTAL_TIMESTEP,MOVIE_DELTA_TIMESTEP)
SHADOW = np.zeros((ENVIRONMENT_SIZE_X,ENVIRONMENT_SIZE_Y))
ENVIRONMENT_INFLUENCED_HISTORY =  np.zeros((ENVIRONMENT_SIZE_X,ENVIRONMENT_SIZE_Y,TOTAL_TIMESTEP)) 
ENVIRONMENT_INFLUENCED = ENVIRONMENT
ENVIRONMENT_INFLUENCED_HISTORY[:,:,0] = ENVIRONMENT<jupyter_output><empty_output><jupyter_text>Setup variables<jupyter_code>all_agents = [Agent(pos_x = x, pos_y = y) for x,y in zip(_pos_array_x, _pos_array_y)]

agent_positions = [(a.position_x, a.position_y) for a in all_agents]

board = Board(agent_positions,
              POSITION_X,
              POSITION_Y,
              x_dim = ENVIRONMENT_SIZE_X,
              y_dim = ENVIRONMENT_SIZE_Y,
              I = ENVIRONMENT)<jupyter_output><empty_output><jupyter_text>Run the simulation!<jupyter_code>coevolve(board=board,
         all_agents=all_agents,
         timedraw=TIMEDRAW_LIST,
         resource_max=RESOURCE_MAX,
         total_timesteps=TOTAL_TIMESTEP,
         do_random_choice=False,
         img_path="./output/Field_Drive_NN.gif")<jupyter_output>Running...: 100%|████████████████████████████████████████████████████████████████████| 999/999 [06:40<00:00,  2.53it/s]
Rendering...: 100%|████████████████████████████████████████████████████████████████| 1000/1000 [02:38<00:00,  6.48it/s]
{'fraction_non_alphanumeric': 0.14681540122346168, 'fraction_numerical': 0.03346527527887729, 'mean_word_length': 5.525821596244131, 'pattern_counts': {'":': 0, '<': 23, '<?xml version=': 0, '>': 20, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '5', 'dir': 'jupyter-structured-clean-dedup', 'id': '217874', 'license': 'Apache-2.0', 'n_tokens_mistral': 1342, 'n_tokens_neox': 1171, 'n_words': 131, 'path': 'SwarmGrid.ipynb', 'repo_name': 'adewynter/Lightboard', 'size': '2779'}