<commit_before>//
// ga_search_example.c
//

#include <stdio.h>
#include <stdlib.h>
#include <math.h>

#include "liquid.h"

#define OUTPUT_FILENAME "ga_search_example.m"

// utility callback function
float utility_callback(void * _userdata, chromosome _c);

// peak callback function; value nearest {0.5, 0.5, 0.5, ...}
float peak_callback(void * _userdata, chromosome _c);

// rosenbrock callback function
float rosenbrock_callback(void * _userdata, chromosome _c);

int main() {
    unsigned int num_parameters = 8;        // dimensionality of search (minimum 1)
    unsigned int bits_per_parameter = 32;   // parameter resolution
    unsigned int num_iterations = 1000;     // number of iterations to run
    unsigned int population_size = 20;      // GA population size
    float mutation_rate = 0.10f;            // GA mutation rate

    unsigned int i;
    float optimum_utility;

    // open output file
    FILE*fid = fopen(OUTPUT_FILENAME,"w");
    fprintf(fid,"%% %s : auto-generated file\n", OUTPUT_FILENAME);
    fprintf(fid,"clear all;\n");
    fprintf(fid,"close all;\n");

    // create prototype chromosome
    chromosome prototype = chromosome_create_basic(num_parameters, bits_per_parameter);

    // create ga_search object
    ga_search ga = ga_search_create_advanced(
                                    //&utility_callback,<commit_msg>ga_search_example: setting chromosome size to 16 bits<commit_after>//
// ga_search_example.c
//

#include <stdio.h>
#include <stdlib.h>
#include <math.h>

#include "liquid.h"

#define OUTPUT_FILENAME "ga_search_example.m"

// utility callback function
float utility_callback(void * _userdata, chromosome _c);

// peak callback function; value nearest {0.5, 0.5, 0.5, ...}
float peak_callback(void * _userdata, chromosome _c);

// rosenbrock callback function
float rosenbrock_callback(void * _userdata, chromosome _c);

int main() {
    unsigned int num_parameters = 8;        // dimensionality of search (minimum 1)
    unsigned int bits_per_parameter = 16;   // parameter resolution
    unsigned int num_iterations = 1000;     // number of iterations to run
    unsigned int population_size = 20;      // GA population size
    float mutation_rate = 0.10f;            // GA mutation rate

    unsigned int i;
    float optimum_utility;

    // open output file
    FILE*fid = fopen(OUTPUT_FILENAME,"w");
    fprintf(fid,"%% %s : auto-generated file\n", OUTPUT_FILENAME);
    fprintf(fid,"clear all;\n");
    fprintf(fid,"close all;\n");

    // create prototype chromosome
    chromosome prototype = chromosome_create_basic(num_parameters, bits_per_parameter);

    // create ga_search object
    ga_search ga = ga_search_create_advanced(
                                    //&utility_callback,
{'fraction_non_alphanumeric': 0.1056644880174292, 'fraction_numerical': 0.014524328249818447, 'mean_word_length': 3.167927382753404, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7529869', 'n_tokens_mistral': 902, 'n_tokens_neox': 817, 'n_words': 233}