Commit d5c224bc authored by SINDT--BARET Yanis's avatar SINDT--BARET Yanis
Browse files

[Update] Modify some comments

parent 7292a376
......@@ -24,11 +24,11 @@ MutationFactorySswm::MutationFactorySswm(int seed,
bool MutationFactorySswm::is_inversion() {
auto* probs = new double[2]; //
probs[0] = mp_sswm.inversion_rate_; // par défaut [0] = prob de inversion
auto* probs = new double[2];
probs[0] = mp_sswm.inversion_rate_; // prob[0] = probability of inversion
probs[1] = 1-probs[0];
int nb = prng_nb.roulette_random(probs, 2);
return nb == 0; // par defition on 0 = inversion
return nb == 0; // If nb == 0, it 's an inversion
}
aevol::MutationEvent MutationFactorySswm::do_mutation(int dna_lenght) {
......
......@@ -24,20 +24,6 @@ constexpr double ERROR_MARGIN = 1E4;
constexpr double ERROR_MARGIN = 1E6;
#endif
void print_step(int gen_i, aevol::Individual_7* parent_individual, aevol::Individual_7* new_individual) {
printf("------------------- Génération %d -------------------\n", gen_i);
printf("Parents :");
printf("DNA : %s\n", parent_individual->dna_->data());
printf("Fitness : %e\n", parent_individual->fitness);
printf("Meta_error : %e\n", parent_individual->metaerror);
printf("----------------------------------------------------\n");
printf("Mutant :");
printf("DNA : %s\n", new_individual->dna_->data());
printf("Fitness : %e\n", new_individual->fitness);
printf("Meta_error : %e\n", new_individual->metaerror);
printf("----------------------------------------------------\n");
}
AbstractFuzzy_7* define_target(std::vector<Gaussian>& gaussians,
int sampling,
FuzzyFactory_7& factory) {
......@@ -85,7 +71,7 @@ void from_json(const json& j, Parameters& p) {
j.at("selection_pressure").get_to(p.selection_pressure);
}
int main(int argc, char* argv[]) { // USAGE: program GENE_JSON_FILE MUTATION_RATE NB_GENERATION NEUTRAL_MUTATION_BOOL
int main(int argc, char* argv[]) { // USAGE: program GENE_JSON_FILE MUTATION_RATE NB_GENERATION NEUTRAL_MUTATION_BOOL HIKE_NUMBER
if (argc != 6 and argc != 5 ) {
printf("!!!\nPlease don't forget to write the json file then the"
" inversion rate, the number of generation"
......@@ -115,14 +101,10 @@ int main(int argc, char* argv[]) { // USAGE: program GENE_JSON_FILE MUTATION_RAT
auto p = inputs.get<Parameters>();
MutationParametersSswm mp{};
mp.inversion_rate_ = inversion_rate;
// auto mp =
// inputs.at("mutation_parameters").get<MutationParametersSswm>();
#ifdef BASE_4
Dna_7::polya_length = inputs.at("polya_length").get<int8_t>();
#endif
// Env : Liste de gaussienne : [hauteur, position (moyenne), ecartype]
const auto& env = inputs.at("env");
assert(env.is_array());
......@@ -177,8 +159,6 @@ int main(int argc, char* argv[]) { // USAGE: program GENE_JSON_FILE MUTATION_RAT
output_evol_file << " nb_gen,fitness_kept,new_fitness,mutation,nb_prot_kept,new_nb_prot" << std::endl;
// Création de la fabrique de mutation, la seed permet d'initialiser le
// générateur de nombre aléatoire interne
MutationFactorySswm mutationFactorySswm(p.seed, mp);
......@@ -192,7 +172,6 @@ int main(int argc, char* argv[]) { // USAGE: program GENE_JSON_FILE MUTATION_RAT
new_indiv->dna_->apply_mutation(mutationEvent);
new_indiv->evaluate_after_mutation(target, p.w_max,
p.selection_pressure, fuzzyFac);
// print_step(i, individual, new_indiv); Si on veut print les infos
if (individual->fitness < new_indiv->fitness) {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment