#include "PGA.h"

double PGA::get_crossover_proba(double progress) {
    int s = m_crossover_probas.size();
    unsigned int ind = floor(progress * s);
    double p1 = m_crossover_probas[ind];
    double p2 = (ind < s-1) ? m_crossover_probas[ind+1] : m_crossover_probas[ind];
    double crossover_proba = s*(p2-p1)*(progress-(double)ind/s) + p1;
    return crossover_proba;
}
