#ifndef ANALYSIS_H_INCLUDED
#define ANALYSIS_H_INCLUDED

#include <iostream>
#include <chrono>
#include <vector>
#include <algorithm>
#include <fstream>

#include "SearchHeuristic.h"

struct Statistic {
    Statistic() : Statistic(0,0,0,0,0,0,0) {};
    Statistic(double n, double s, double avg, double mini, double maxi, double med, double dev) :
        nb{n}, sum{s}, average{avg}, minimal{mini}, maximal{maxi}, median{med}, deviation{dev} {
            no_bias_deviation = 0;
            alea = 0;
            label = 0;
    };

    double nb;
    double sum;
    double average;
    double minimal;
    double maximal;
    double median;
    double deviation;
    double no_bias_deviation;
    double alea;
    double label;
};

std::chrono::time_point<std::chrono::system_clock> start_chrono();
std::chrono::time_point<std::chrono::system_clock> stop_chrono();
int interval_chrono(std::chrono::time_point<std::chrono::system_clock> start, std::chrono::time_point<std::chrono::system_clock> stop);

Statistic avg_calls(SearchHeuristic* algo, int nb=100, double abortion_limit=-1, double student_law_quartile=-1);
Statistic* avg_evolution(SearchHeuristic* algo, int max_evolution, int nb_tests = 100);

Statistic* derivate(Statistic* curve, unsigned int length);
Statistic* compress(Statistic* curve, unsigned int length);
Statistic* smooth(Statistic* curve, unsigned int length);

#endif // ANALYSIS_H_INCLUDED
