Projet du cours MPRI 2.24.2 "Résolution de problèmes d'optimisation avec heuristiques de recherche" : https://wikimpri.dptinfo.ens-cachan.fr/doku.php?id=cours:c-2-24-2
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

analysis.h 1.7KB

  1. #ifndef ANALYSIS_H_INCLUDED
  2. #define ANALYSIS_H_INCLUDED
  3. #include <iostream>
  4. #include <chrono>
  5. #include <vector>
  6. #include <algorithm>
  7. #include <fstream>
  8. #include "heuristics/SearchHeuristic.h"
  9. // Statistic
  10. struct Statistic {
  11. Statistic() : Statistic(0,0,0,0,0,0,0) {};
  12. Statistic(double n, double s, double avg, double mini, double maxi, double med, double dev) :
  13. nb{n}, sum{s}, average{avg}, minimal{mini}, maximal{maxi}, median{med}, deviation{dev} {
  14. no_bias_deviation = 0;
  15. alea = 0;
  16. label = 0;
  17. };
  18. double nb;
  19. double sum;
  20. double average;
  21. double minimal;
  22. double maximal;
  23. double median;
  24. double deviation;
  25. double no_bias_deviation;
  26. double alea;
  27. double label;
  28. };
  29. // Chrono Functions
  30. std::chrono::time_point<std::chrono::system_clock> start_chrono();
  31. std::chrono::time_point<std::chrono::system_clock> stop_chrono();
  32. int interval_chrono(std::chrono::time_point<std::chrono::system_clock> start, std::chrono::time_point<std::chrono::system_clock> stop);
  33. // Averaged Executions
  34. Statistic avg_calls(SearchHeuristic* algo, int nb=100, double abortion_limit=-1, double student_law_quartile=-1);
  35. Statistic* avg_evolution(SearchHeuristic* algo, int max_evolution, int nb_tests = 100);
  36. void cmp_evolution(std::vector<SearchHeuristic*> algos, MasterMind& problem, std::string outfilename, int max_evolution, int nb_tests = 100);
  37. // Complexity Tools
  38. std::vector<Statistic> compute_complexity(std::default_random_engine& randomizer, SearchHeuristic* algo, int n_initial, int n_final, int n_step=1, int nb_tests=100, double slq=-1, bool displaying=true);
  39. void save_in_file(std::string namefile, std::vector<Statistic> stats);
  40. #endif // ANALYSIS_H_INCLUDED