<commit_before>-module (rastrigin_nif_ops).
-behaviour (genetic_ops).
-export ([solution/1, evaluation/1,
    mutation/1, mutation/3, recombination/2]).
-on_load(init/0).
-define (LIBNAME, "rastrigin_nif").
-include ("emas.hrl").

init() ->
    SOName = filename:join([priv, ?LIBNAME]) , 
    ok = erlang:load_nif(SOName, 0).

%% @doc Generates a random solution.
-spec solution(integer()) -> solution().
solution(_ProblemSize) ->
    exit(nif_not_loaded).

%% @doc Evaluates a given solution. Higher is better.
-spec evaluation(solution()) -> float().
evaluation(_Solution) ->
    exit(nif_not_loaded).

%% @doc Reproduction function for a single agent (mutation only).
-spec mutation(solution()) -> solution().
mutation(_Solution, _Range, _Rate) ->
    exit(nif_not_loaded).

%% @doc FReproduction function for a pair of agents (crossover and mutation).
-spec recombination(solution(),solution()) -> {solution(),solution()}.
recombination(_Solution1, _Solution2) ->
    exit(nif_not_loaded).

mutation(_Solution) ->
    mutation(_Solution, emas_config:mutationRange(), emas_config:mutationRate()).<commit_msg>rastrigin_nif_ops works with separate conf files<commit_after>-module (rastrigin_nif_ops).
-behaviour (genetic_ops).
-export ([solution/1, evaluation/1,
    mutation/2, mutation/3, recombination/2]).
-on_load(init/0).
-define (LIBNAME, "rastrigin_nif").
-include ("emas.hrl").

init() ->
    SOName = filename:join([priv, ?LIBNAME]) , 
    ok = erlang:load_nif(SOName, 0).

%% @doc Generates a random solution.
-spec solution(integer()) -> solution().
solution(_ProblemSize) ->
    exit(nif_not_loaded).

%% @doc Evaluates a given solution. Higher is better.
-spec evaluation(solution()) -> float().
evaluation(_Solution) ->
    exit(nif_not_loaded).

%% @doc Reproduction function for a single agent (mutation only).
-spec mutation(solution(), float(), float()) -> solution().
mutation(_Solution, _Range, _Rate) ->
    exit(nif_not_loaded).

%% @doc FReproduction function for a pair of agents (crossover and mutation).
-spec recombination(solution(),solution()) -> {solution(),solution()}.
recombination(_Solution1, _Solution2) ->
    exit(nif_not_loaded).

mutation(_Solution, SimParams) ->
    mutation(_Solution, SimParams#sim_params.mutation_range, SimParams#sim_params.mutation_rate).
{'fraction_non_alphanumeric': 0.1576889661164205, 'fraction_numerical': 0.007819287576020852, 'mean_word_length': 5.013054830287206, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 23, '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': '5977531', 'n_tokens_mistral': 800, 'n_tokens_neox': 735, 'n_words': 173}