#include "experiences/mutation-rate.h"

void script_optimal_proba_2(int n_initial, int n_final, std::default_random_engine& randomizer, double p_init=0.05, double p_final=0.5, double p_step=0.01, std::vector<int> nb_tests_by_depth={}, std::vector<double> stq_by_depth={}) {
    ProbaOptimizer po(n_initial, randomizer);
    po.set_nb_contexts(n_final-n_initial);
    po.set_study_interval(p_init, p_final, p_step);
    for(unsigned int depth=0; depth<nb_tests_by_depth.size(); depth++)
        po.add_test_wave(nb_tests_by_depth[depth], stq_by_depth[depth], depth);
    po.run();
}

void script_optimal_proba(std::default_random_engine& randomizer) {
    std::string namefile = "optimal-proba.csv";
    {
        int n_init=3, n_final=16;
        double p_init=0.05, p_final=0.5, p_step=0.01;
        ProbaOptimizer po(n_init, randomizer);
        po.set_nb_contexts(n_final-n_init);
        po.set_study_interval(p_init, p_final, p_step);
        po.add_test_wave(20, 2.3362421597, 0);
        po.add_test_wave(200, 2.3451370823, 1);
        po.add_test_wave(2000, 2.2953981367, 2);
        po.save_run(namefile);
        po.run();
    }
    {
        int n_init=16, n_final=28;
        double p_init=0.03, p_final=0.2, p_step=0.01;
        ProbaOptimizer po(n_init, randomizer);
        po.set_nb_contexts(n_final-n_init);
        po.set_study_interval(p_init, p_final, p_step);
        po.add_test_wave(20, 2.6742086844, 0);
        po.add_test_wave(100, 2.4755765532, 1);
        po.add_test_wave(1000, 2.4365960683, 2);
        po.save_run(namefile);
        po.run();
    }
    {
        int n_init=28, n_final=46;
        double p_init=0.01, p_final=0.1, p_step=0.005;
        ProbaOptimizer po(n_init, randomizer);
        po.set_nb_contexts(n_final-n_init);
        po.set_study_interval(p_init, p_final, p_step);
        po.add_test_wave(20, 2.6742086844, 0);
        po.add_test_wave(100, 2.4755765532, 1);
        po.add_test_wave(1000, 2.4365960683, 2);
        po.save_run(namefile);
        po.run();
    }
}
