Plotter.h 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137
  1. /*
  2. This library is free software; you can redistribute it and/or
  3. modify it under the terms of the GNU Library General Public
  4. License version 2 as published by the Free Software Foundation.
  5. This library is distributed in the hope that it will be useful,
  6. but WITHOUT ANY WARRANTY; without even the implied warranty of
  7. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  8. Library General Public License for more details.
  9. You should have received a copy of the GNU Library General Public License
  10. along with this library; see the file COPYING.LIB. If not, write to
  11. the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
  12. Boston, MA 02110-1301, USA.
  13. ---
  14. Copyright (C) 2009, Esther-Sabrina Platzer <esther.platzer@uni-jena.de>
  15. Matthias Wacker <matthias.wacker@mti.uni-jena.de>
  16. */
  17. /// @class Plotter
  18. /// Class interface for cost function plotting.
  19. ///
  20. /// @author Esther-Sabrina Platzer, Matthias Wacker
  21. /// @date 2009-07-07
  22. #ifndef _PLOTTER_H_
  23. #define _PLOTTER_H_
  24. #include "core/optimization/blackbox/SimpleOptProblem.h"
  25. #include "AdaptiveDirectionRandomSearchOptimizer.h"
  26. namespace OPTIMIZATION
  27. {
  28. class Plotter
  29. {
  30. public:
  31. ///
  32. /// defaultConstructor
  33. ///
  34. Plotter();
  35. ///
  36. /// Copy constructor
  37. /// @param plotter plotter to copy
  38. ///
  39. Plotter(const Plotter &plotter);
  40. ///
  41. /// Assignment operator
  42. /// @param pkitter plotter to assign
  43. Plotter& operator=(const Plotter &plotter);
  44. ///
  45. /// Destructor.
  46. ///
  47. ~Plotter();
  48. ///
  49. /// Set optimization problem
  50. ///
  51. void setOptProblem(const SimpleOptProblem& optprob);
  52. ///
  53. /// Performs a 1d evaluation of the costfunction defined in the optimization problem.
  54. /// @param paramnum parameter to evaluate (will be checked to lie in the range of the dimension of the opt. problem)
  55. /// @param from lower border of parameter value
  56. /// @param to upper border of parameter value
  57. /// @param stepwidth sampling rate for costfunction evaluation
  58. /// @param path path to the result file
  59. ///
  60. void plot1D(int paramnum, const float from, const float to, const float stepwidth, const char* path);
  61. ///
  62. /// Performs a 2d evaluation of the costfunction defined in the optimization problem.
  63. /// @param paramnum1 first parameter to evaluate (will be checked to lie in the range of the dimension of the opt. problem)
  64. /// @param from1 lower border of parameter value for parameter 1
  65. /// @param to1 upper border of parameter value for parameter 1
  66. /// @param stepwidth1 sampling rate for costfunction evaluation of parameter 1
  67. /// @param paramnum2 second parameter to evaluate (will be checked to lie in the range of the dimension of the opt. problem)
  68. /// @param from2 lower border of parameter value for parameter 2
  69. /// @param to2 upper border of parameter value for parameter2
  70. /// @param stepwidth2 sampling rate for costfunction evaluation of parameter 2
  71. /// @param path path to the result file
  72. ///
  73. void plot2D(int paramnum1, const float from1, const float to1, const float stepwidth1, int paramnum2, const float from2, const float to2, const float stepwidth2, const char* path);
  74. ///
  75. /// Performs a 3d evaluation of the costfunction defined in the optimization problem. Note, that the first to parameters will vary while the third one stays fixed for the generation of one evaluation cycle. Afterwards a new plot file will be generated with a new initialization of parameter 3 and again parameter 1 and 2 will be varied within their ranges. This function will result in a fixed number of plot files giving the behavior of the first two parameters over time for a varied third one. The files will be named given the path and a evaluation number corresponding to the parameter value of parameter 1 will be added to the path name.
  76. /// @param paramnum1 first parameter to evaluate (will be checked to lie in the range of the dimension of the opt. problem)
  77. /// @param from1 lower border of parameter value for parameter 1
  78. /// @param to1 upper border of parameter value for parameter 1
  79. /// @param stepwidth1 sampling rate for costfunction evaluation of parameter 1
  80. /// @param paramnum2 second parameter to evaluate (will be checked to lie in the range of the dimension of the opt. problem)
  81. /// @param from2 lower border of parameter value for parameter 2
  82. /// @param to2 upper border of parameter value for parameter 2
  83. /// @param stepwidth2 sampling rate for costfunction evaluation of parameter 2
  84. /// @param paramnum3 third parameter to evaluate (will be checked to lie in the range of the dimension of the opt. problem)
  85. /// @param from3 lower border of parameter value for parameter 3
  86. /// @param to3 upper border of parameter value for parameter 3
  87. /// @param stepwidth3 sampling rate for costfunction evaluation of parameter 3
  88. /// @param path path to the result file
  89. ///
  90. void plot3D(int paramnum1, const float from1, const float to1, const float stepwidth1, int paramnum2, const float from2, const float to2, const float stepwidth2, int paramnum3, const float from3, const float to3, const float stepwidth3, const char* path);
  91. ///
  92. /// Setting the bound interpretation status: if absolute= true, the bounds (from,to) will be interpreted as absolute values and the evaluation goes from from till to; if absolute= false, the bounds will be interpreted relative to the current parameter values, meaning the the evaluation goes from start= actualval + from till end= actualval + to. Default is true.
  93. /// @param absolute bound interpretation status
  94. ///
  95. void setBoundInterpretationStatus(bool absolute);
  96. /// Get the bound interpretation status
  97. /// @retval true, if bounds are interpreted as absolute bounds (start= from, end=to)
  98. /// @retval false, if bounds are interpreted relative to the actual parameter value (start= actualval + from, end= actualval + to)
  99. ///
  100. bool getBoundInterpretationStatus();
  101. protected:
  102. //! Flag giving the status of the bound interpretation: if true, the bounds (from,to) will be interpreted as absolute values and the evaluation goes from from till to; if false, the bounds will be interpreted relative to the current parameter values, meaning the the evaluation goes from start= actualval + from till end= actualval + to. Default is true.
  103. bool m_absoluteBounds;
  104. //! Costfunction
  105. CostFunction* m_pCostfunc;
  106. //! Optproblem pointer
  107. const SimpleOptProblem* m_pOptprob;
  108. }; //class
  109. } //namespace
  110. #endif