SimpleOptTestGrid.h 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. /// @file optimization/SimpleOptTestGrid.h
  2. /// @author Matthias Wacker
  3. /// @date
  4. ///
  5. ///
  6. ///
  7. ///
  8. #ifndef _SIMPLEOPTTESTGRID_H_
  9. #define _SIMPLEOPTTESTGRID_H_
  10. #include "Opt_Namespace.h"
  11. #include "core/optimization/blackbox/SimpleOptimizer.h"
  12. #include "core/optimization/blackbox/SimpleOptProblem.h"
  13. #include <vector>
  14. namespace OPTIMIZATION
  15. {
  16. ///
  17. /// @class SimpleOptTestGrid defines a class to test simpleOptimizer(s) with SimpleOptProblem(s)
  18. ///
  19. /// gets a number of ploblems and a number of optimizers and tries to solve every problem with each optimizer
  20. ///
  21. class SimpleOptTestGrid
  22. {
  23. public:
  24. ///
  25. /// Default Constructor
  26. ///
  27. SimpleOptTestGrid();
  28. ///
  29. /// Default Destructor
  30. ///
  31. ~SimpleOptTestGrid();
  32. ///
  33. /// adds a SimpleOptProb to the optimizer
  34. ///
  35. /// @param optProb the optProb to test (is copied in this routine -> only works with deep copy implemented copy constructors!)
  36. /// @param solution the solution to the problem
  37. /// @param successDist the maximum distance to the solution that is considered as success
  38. ///
  39. void addSimpleOptProblem( const SimpleOptProblem & optProb, const OPTIMIZATION::matrix_type &solution, double successDist);
  40. ///
  41. /// adds a SimpleOptimizer
  42. ///
  43. /// @param opt the optimizer (already configured!!)
  44. ///
  45. void addSimpleOptimizer(SimpleOptimizer *opt);
  46. ///
  47. /// runs the tests on the test grid
  48. ///
  49. /// @return true in case of a full success, false in case of at least 1 failed test case
  50. ///
  51. bool test();
  52. ///
  53. /// runs a specific test
  54. ///
  55. /// @param optIdx index of the optimizer (starting with 0)
  56. /// @param probIdx index of the problem (starting with 0)
  57. ///
  58. bool test(int optIdx, int probIdx);
  59. ///
  60. /// get optimizers
  61. ///
  62. std::vector<SimpleOptimizer*> getOptimizers() const {return m_vSimpleOptimzers;};
  63. private:
  64. /// the optimizers
  65. std::vector<SimpleOptimizer*> m_vSimpleOptimzers;
  66. /// number of optimizers
  67. int m_iNumberOfOptimizers;
  68. /// the problems
  69. std::vector<SimpleOptProblem> m_vSimpleOptProblem;
  70. /// the solutions
  71. std::vector<OPTIMIZATION::matrix_type> m_vSolutions;
  72. /// the success distances
  73. std::vector<double> m_vSuccessDistances;
  74. /// number of Problems
  75. int m_iNumberOfProblems;
  76. }; //class
  77. }//namespace
  78. #endif // _SIMPLEOPTTESTGRID_H_