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.

MasterMind.h 1.2KB

  1. #ifndef MASTERMIND_H
  2. #define MASTERMIND_H
  3. #include <iostream>
  4. #include <ctime>
  5. #include <random>
  6. #include <vector>
  7. #include <algorithm>
  8. #include "crossover.h"
  9. class MasterMind
  10. {
  11. public:
  12. MasterMind(int nb_colors, int nb_cases, std::default_random_engine& randomizer);
  13. MasterMind(int nb_colors, int nb_cases, int* solution, std::default_random_engine& randomizer);
  14. void set_new_random_solution();
  15. int* get_random_candidate();
  16. void display_candidate(int *x);
  17. int try_candidate(int* candidate);
  18. int get_max_radius();
  19. int* modify_with_radius(int* x, int r);
  20. int* crossover(int* y, void* x, int nb, int* (*selector)(int, void*), int method);
  21. void copy_candidate(int *x, int *y);
  22. double get_progress(int* x, int v_x);
  23. bool is_optimal(int* x, double objective=1.00);
  24. bool is_optimal(int* x, int v_x, double objective=1.00);
  25. virtual ~MasterMind();
  26. protected:
  27. private:
  28. int m_nb_colors;
  29. int m_nb_cases;
  30. int* m_solution;
  31. bool m_random_solution;
  32. std::vector<int> m_permutation;
  33. std::default_random_engine m_randomizer;
  34. int* m_vote;
  35. };
  36. #endif // MASTERMIND_H