<commit_before>-module(rastrigin_bin_ops).

-behaviour(emas_genetic_ops).

-export ([evaluation/2, mutation/2, recombination/3, solution/1]).

-include_lib("emas/include/emas.hrl").

-type sim_params() :: emas:sim_params().


%% @doc Generates a random solution, as a vector of numbers in the range [-50, 50].
-spec solution(sim_params()) -> solution().
solution(SP) ->
    S = [-50 + random:uniform() * 100 || _ <- lists:seq(1, SP#sim_params.problem_size)],
    erlang:term_to_binary(S).

%% @doc Evaluates a given solution by computing the Rastrigin function.
-spec evaluation(solution(), sim_params()) -> float().
evaluation(B, _SP) -><commit_msg>Update solution/0 type from emas<commit_after>-module(rastrigin_bin_ops).

-behaviour(emas_genetic_ops).

-export ([evaluation/2, mutation/2, recombination/3, solution/1]).

-include_lib("emas/include/emas.hrl").

-type sim_params() :: emas:sim_params().
-type solution() :: emas:solution(binary()).

%% @doc Generates a random solution, as a vector of numbers in the range [-50, 50].
-spec solution(sim_params()) -> solution().
solution(SP) ->
    S = [-50 + random:uniform() * 100 || _ <- lists:seq(1, SP#sim_params.problem_size)],
    erlang:term_to_binary(S).

%% @doc Evaluates a given solution by computing the Rastrigin function.
-spec evaluation(solution(), sim_params()) -> float().
evaluation(B, _SP) ->
{'fraction_non_alphanumeric': 0.17168011738811445, 'fraction_numerical': 0.02127659574468085, 'mean_word_length': 4.804255319148936, 'pattern_counts': {'":': 0, '<': 5, '<?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': '3594754', 'n_tokens_mistral': 495, 'n_tokens_neox': 450, 'n_words': 113}