#ifndef CROSSOVER-RATE_H_INCLUDED
#define CROSSOVER-RATE_H_INCLUDED

#include <vector>
#include <fstream>

#include "ParameterOptimizer.h"
#include "GA.h"

class CrossoverProbaFromLambdaOptimizer : public ParameterOptimizer {
    public:
        CrossoverProbaFromLambdaOptimizer(int nb_cases, int lda_initial, std::default_random_engine& randomizer) : ParameterOptimizer(randomizer), n{nb_cases}, lambda_initial{lda_initial} {};
        SearchHeuristic* get_context(unsigned int i, double parameter, std::default_random_engine& randomizer);
        std::string display_context(unsigned int num_context);
        std::string get_context_for_csvfile(unsigned int num_context);

    private:
        int n;
        int lambda_initial;
};

void script_crossover_proba_global_optim(std::default_random_engine& randomizer, std::string namefile="global-crossover-proba.csv", bool restart=false, unsigned int restart_n=5, unsigned int restart_lambda=2);
double crossover_model_linearization(double x);
void crossover_model_filtering(std::string input, std::string output, std::string modeling, int filtered_n, int filtered_lda);
void crossover_model_optimization(std::string namefile="global-crossover-proba.csv");
void crossover_model_validation(std::string namefile, double slope1, double intercept1, double slope2, double intercept2);
double cr(int n, int lambda);

#endif // CROSSOVER-RATE_H_INCLUDED
