<commit_before>%% @author jstypka <<EMAIL>>
%% @version 1.1

-module(mas_skel).
-export([start/3,
         seed_random_once_per_process/0]).


-include ("mas.hrl").

-compile([{inline, [seed_random_once_per_process/0]}]).

-type sim_params() :: mas:sim_params().

%% ====================================================================
%% API functions
%% ====================================================================

-spec start(Time::pos_integer(), sim_params(), config()) -> ok.
start(Time, SP, Cf = #config{islands = Islands, agent_env = Env}) ->
    mas_topology:start_link(self(), Islands, Cf#config.topology),
    mas_misc_util:initialize_subscriptions(lists:seq(1, Islands), Cf),
    mas_misc_util:seed_random(),
    mas_misc_util:clear_inbox(),
    Population = [{I, Env:initial_agent(SP)} ||
                     _ <- lists:seq(1, Cf#config.population_size),
                     I <- lists:seq(1, Islands)],
    {_Time, Result} = timer:tc(fun main/4, [Population, Time, SP, Cf]),
    mas_misc_util:close_subscriptions(lists:seq(1, Islands), Cf),
    mas_topology:close(),
    Result.

%% ====================================================================<commit_msg>moved logger initialization after generating the initial population<commit_after>%% @author jstypka <<EMAIL>>
%% @version 1.1

-module(mas_skel).
-export([start/3,
         seed_random_once_per_process/0]).


-include ("mas.hrl").

-compile([{inline, [seed_random_once_per_process/0]}]).

-type sim_params() :: mas:sim_params().

%% ====================================================================
%% API functions
%% ====================================================================

-spec start(Time::pos_integer(), sim_params(), config()) -> ok.
start(Time, SP, Cf = #config{islands = Islands, agent_env = Env}) ->
    mas_topology:start_link(self(), Islands, Cf#config.topology),
    mas_misc_util:seed_random(),
    mas_misc_util:clear_inbox(),
    Population = [{I, Env:initial_agent(SP)} ||
                     _ <- lists:seq(1, Cf#config.population_size),
                     I <- lists:seq(1, Islands)],
    mas_misc_util:initialize_subscriptions(lists:seq(1, Islands), Cf),
    {_Time, Result} = timer:tc(fun main/4, [Population, Time, SP, Cf]),
    mas_misc_util:close_subscriptions(lists:seq(1, Islands), Cf),
    mas_topology:close(),
    Result.

%% ====================================================================
{'fraction_non_alphanumeric': 0.31219110378912684, 'fraction_numerical': 0.008237232289950576, 'mean_word_length': 5.012376237623762, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 11, '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}}
{'dir': 'git-commits-cleaned', 'id': '1165485', 'n_tokens_mistral': 767, 'n_tokens_neox': 702, 'n_words': 125}