SimpleOptTestGrid.h 2.1 KB

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