src/ell/LT_Funnels.cc
Go to the documentation of this file.00001 #include "LT_Funnels.hh" 00002 00003 namespace ell 00004 { 00005 00006 LT_Funnels::LT_Funnels() 00007 { 00008 } 00009 00010 LT_Funnels::~LT_Funnels() 00011 { 00012 } 00013 00014 00015 00016 // Sets the saddle if (a) no saddle exists or (b) the old saddle is higher 00017 // than the new one. 00018 // NOTE: only a DIRECTED edge is checked from the higher to the lower 00019 // minimum according to the State::less operator. 00020 // @param i index of the first minimum to connect 00021 // @param j index of the second minimum to connect 00022 // @param s the State representating the saddle point 00023 // @return whether or not the data structure has been changed 00024 virtual 00025 bool 00026 LT_Funnels:: 00027 addSaddle(const size_t i, const size_t j, const State* const s); 00028 00029 // Sets the saddle if (a) no saddle exists or (b) the old saddle is higher 00030 // than the new one. 00031 // NOTE: only a DIRECTED edge is checked from the higher to the lower 00032 // minimum according to the State::less operator. 00033 // @param m_i the first minimum to connect 00034 // @param m_j the second minimum to connect 00035 // @param s the State representating the saddle point 00036 // @return whether or not the data structure has been changed 00037 virtual 00038 bool 00039 LT_Funnels:: 00040 addSaddle(const State* const m_i, const State* const m_j, const State* const s); 00041 00042 // Adds an UNKNOWN minimum to the topology. 00043 // NOTE : this operation should NOT change the indices of already existing 00044 // minima in the topology ! 00045 // FURTHER : the minimum is not checked if it is already known 00046 // @param m the minimum to add 00047 // @return the index of the minimum in the landscape 00048 virtual 00049 const size_t 00050 LT_Funnels:: 00051 addMin(const State* const m); 00052 00053 // Access to the minimum index. 00054 // @param m the minimum of that the index should be accessed 00055 // @return the index of the minimum, or INVALID_INDEX if 'm' is no known 00056 // minimum 00057 virtual 00058 const size_t 00059 LT_Funnels:: 00060 getMinIndex(const State* const m) const; 00061 00062 // Access to the number of stored minima. 00063 // @return the number of minima 00064 virtual 00065 const size_t 00066 LT_Funnels:: 00067 getMinCount() const; 00068 00069 // Access to a minimum. 00070 // @param i index of the minimum to access 00071 // @return the State with the specified minimum index 00072 virtual 00073 const State* const 00074 LT_Funnels:: 00075 getMin(size_t i) const; 00076 00077 // Access to the global minimum of the landscape with minimal energy. 00078 // @return the minimum with smallest energy (and smallest string 00079 // representation for tiebreaking) 00080 virtual 00081 const State* const 00082 LT_Funnels:: 00083 getMFEState() const; 00084 00085 // Calculates the relative 'distance' between landscape topologies. 00086 // On the LandscapeTopology level it is done on the minima only. For each 00087 // minimum m present in only one of the two LTs a value of 00088 // MISSING_MINIMUM_PENALTY*(e^(-energy(m)/BOLTZMANN_KT)) is summed. The 00089 // resulting sum is normalized by the number of (unique) minima in both 00090 // topologies. 00091 // @param lt the landscape topology to calculate the distance to 00092 // @return the distance 00093 virtual 00094 double 00095 LT_Funnels:: 00096 getDistance(const LandscapeTopology* const lt) const; 00097 00098 // Sorts the minima ascending by their energy (mfe minimum gets index 0). 00099 // If energy is equal they are sorted by their string representation. 00100 virtual 00101 void 00102 LT_Funnels:: 00103 sort(); 00104 00105 // Check if the minima of the landscape are sorted ascendingly by their 00106 // energy (mfe minimum gets index 0). 00107 // If energy is equal they are sorted by their string representation. 00108 virtual 00109 bool 00110 LT_Funnels:: 00111 isSorted() const; 00112 00113 // Clears the data structure and removes all stored information to be 00114 // filled again afterwards. 00115 virtual 00116 void 00117 LT_Funnels:: 00118 clear(); 00119 00120 // Writes the current landscape topology to stream. 00121 // @param out the output stream to write to. 00122 // @param writeGraph whether or not the output should contain a graph 00123 // representation of the topology in graphviz DOT format 00124 virtual 00125 void 00126 LT_Funnels:: 00127 write( std::ostream & out, 00128 const bool writeGraph = false ) const; 00129 00130 // Fills the landscape topology from stream. 00131 // @param in the input stream to read from. 00132 // @param templateState the State template to create new State objects via 00133 // its 'fromString' function 00134 // @return an error encoding and an error string : 00135 // 0 = no error occured, read was successfull 00136 // -1 = landscape topology type not supported 00137 // -2 = state description differs from the given one 00138 // -3 = other read errors 00139 virtual 00140 std::pair<int,std::string> 00141 LT_Funnels:: 00142 read( std::istream & in, 00143 const State * const templateState ); 00144 00145 00146 } // namespace ell