parameterresult.h 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. // Copyright 2008 Rarefied Technologies, Inc.
  2. // Distributed under the GPL v2 please see
  3. // LICENSE file for more information.
  4. #pragma once
  5. #include <boost/archive/text_oarchive.hpp>
  6. #include <boost/archive/text_iarchive.hpp>
  7. class ParameterResult
  8. {
  9. public:
  10. ParameterResult() { bRefined = false; fError=0; nLevel=0; };
  11. float fError;
  12. float fStdDev;
  13. float fWrong; // percent of predictions that would yield the wrong class
  14. float fParam1;
  15. float fParam2;
  16. bool bRefined; // indicates if a refinement search has been spawned from this result
  17. int nLevel; // which level of refinement this result is from
  18. private:
  19. friend class boost::serialization::access;
  20. template<class Archive>
  21. void serialize(Archive & ar, const unsigned int version)
  22. {
  23. ar & fWrong;
  24. ar & fError;
  25. ar & fStdDev;
  26. ar & fParam1;
  27. ar & fParam2;
  28. ar & bRefined;
  29. ar & nLevel;
  30. }
  31. friend std::ostream& operator<<(std::ostream &os, const ParameterResult &pr)
  32. {
  33. os << pr.fWrong << '\t';
  34. os << pr.fError << '\t';
  35. os << pr.fStdDev << '\t';
  36. os << pr.fParam1 << '\t';
  37. os << pr.fParam2 << '\t';
  38. os << pr.bRefined << '\t';
  39. os << pr.nLevel;
  40. return os;
  41. }
  42. };
  43. class lessthan
  44. {
  45. public:
  46. bool operator()(const ParameterResult* left, const ParameterResult* right) const
  47. {
  48. bool bRet = (left->fWrong < right->fWrong);
  49. if(!bRet && (left->fWrong == right->fWrong ))
  50. {
  51. bRet = left->fError < right->fError;
  52. }
  53. return bRet;
  54. }
  55. };