00001 // QMcBeaver 00002 // 00003 // Constructed by 00004 // 00005 // Michael Todd Feldmann 00006 // and 00007 // David Randall "Chip" Kent IV 00008 // 00009 // Copyright 2000. All rights reserved. 00010 // 00011 // drkent@users.sourceforge.net mtfeldmann@users.sourceforge.net 00012 00013 #include "ParameterScorePair.h" 00014 00015 ParameterScorePair::ParameterScorePair() 00016 { 00017 } 00018 00019 ParameterScorePair::ParameterScorePair(QMCObjectiveFunctionResult score, 00020 Array1D<double> & parameters) 00021 { 00022 this->Score = score; 00023 this->Parameters = parameters; 00024 } 00025 00026 ParameterScorePair::ParameterScorePair(const ParameterScorePair & PSP) 00027 { 00028 *this = PSP; 00029 } 00030 00031 void ParameterScorePair::operator=(const ParameterScorePair &PSP) 00032 { 00033 Score = PSP.Score; 00034 Parameters = PSP.Parameters; 00035 } 00036 00037 bool ParameterScorePair::operator<(const ParameterScorePair &PSP) const 00038 { 00039 bool returnvalue = true; 00040 if( getScore() < PSP.getScore() ) 00041 { 00042 returnvalue = true; 00043 } 00044 else 00045 { 00046 returnvalue = false; 00047 } 00048 00049 return returnvalue; 00050 } 00051 00052 ostream& operator<<(ostream & strm, const ParameterScorePair & rhs) 00053 { 00054 strm << "Score " << setw(20) << rhs.getScore() << endl; 00055 strm << " "; 00056 strm << "Parameters " << rhs.Parameters; 00057 strm << " "; 00058 strm << "Energy " << setw(20) << rhs.Score.getEnergyAve() << " +/- " << rhs.Score.getEnergyVar(); 00059 strm << " (# samples = " << rhs.Score.getNumberSamples() << ")" << endl; 00060 return strm; 00061 } 00062 00063 double ParameterScorePair::getScore() const 00064 { 00065 double score = Score.getScore(); 00066 return score; 00067 } 00068 00069 Array1D<double> * ParameterScorePair::getParameters() 00070 { 00071 return &Parameters; 00072 }