BALL
1.4.79
|
#include <BALL/STRUCTURE/BONDORDERS/FPTBondOrderStrategy.h>
Public Member Functions | |
Assignment_ () | |
Assignment_ (Size num_bonds) | |
Assignment_ (Assignment_ const ©) | |
Assignment_ (std::vector< BondOrder > const &bonds, Penalty penalty) | |
Assignment_ & | operator= (Assignment_ const ©) |
BondOrder | operator[] (Size index) const |
BondOrder & | operator[] (Size index) |
void | combine (Assignment_ const &other) |
std::vector< BondOrder > const & | getBondOrders () const |
int | compare (Assignment_ const &a) const |
bool | operator< (Assignment_ const &a) const |
bool | operator> (Assignment_ const &a) const |
bool | operator<= (Assignment_ const &a) const |
bool | operator>= (Assignment_ const &a) const |
bool | operator== (Assignment_ const &a) const |
bool | isValid (MolecularGraph &molecule, FPTBondOrderStrategy &parent) |
Public Attributes | |
Penalty | penalty |
Protected Attributes | |
std::vector< BondOrder > | bonds_ |
An assignment is the solution of the bond assignment problem. It consists of the penalty of this solution, and a vector of bond values for each bond. The bond order is just a vector of bond values. If you want a HashMap which maps the concrete bonds to their bond value, you should use the FPTBondOrderStrategy class instead, which can construct such a HashMap from an assignment. Nevertheless the index of the bonds has a strict order: Each bond which points to atoms with indizes u and v can be represented as edge (u < v). An edge is less than another edge, is either it's u is less, or if it's u is equal to the other's u and it's v is less than the other's v. The indizes of the atoms is given by the graph structure. The first atom has index 0. We call an assignment valid to a given UndirectedGraph and PenaltyMap, if it's penalty is equal to the sum of penalties of it's atoms in the given penalty map. Assignments which was computed by the FPTBondOrder algorithm should be valid to the same graph and penalty map which was used by the algorithm.
Definition at line 698 of file FPTBondOrderStrategy.h.
BALL::FPTBondOrderStrategy::Assignment_::Assignment_ | ( | ) |
build a new, empty assignment
BALL::FPTBondOrderStrategy::Assignment_::Assignment_ | ( | Size | num_bonds | ) |
build an assignment with the given number of bonds. The bond values are filled with 0, the penalty is initialized with infinite_penalty. Such a bond assignment don't have to be valid!
BALL::FPTBondOrderStrategy::Assignment_::Assignment_ | ( | Assignment_ const & | copy | ) |
Copy constructor
BALL::FPTBondOrderStrategy::Assignment_::Assignment_ | ( | std::vector< BondOrder > const & | bonds, |
Penalty | penalty | ||
) |
Build an assignment from a given bond value vector and penalty. Such a bond assignment don't have to be valid!
void BALL::FPTBondOrderStrategy::Assignment_::combine | ( | Assignment_ const & | other | ) |
Combines two disjoint assignments. Two assignments are disjoint, if for each bond index i there is a 0 value in at least one of the both assignments. Combining such disjoint assignments means: Insert for each index i the not-zero bond value of the both assignments. Such disjoint assignments exist in separated computing of connection components of the same graph. Each computing just assign the bond values of the bonds, which were connected to the connection component. The other bond values are 0. The combining of assignments of all connection components of a graph creates an assignment of the whole graph. This approach is important, because the FPTBondOrder algorithm is just defined for connected graphs.
BALL::Exception::InvalidArgument | if the two assignments have a different number of bonds |
int BALL::FPTBondOrderStrategy::Assignment_::compare | ( | Assignment_ const & | a | ) | const |
Comparison is needed to insert such an assignment into a priority queue or a search tree. An assignment x is less than an assignment y, if the penalty of x is less than the penalty of y. If two assignments have the same penalty, the comparison is done by comparing each bond value separately.
std::vector<BondOrder> const& BALL::FPTBondOrderStrategy::Assignment_::getBondOrders | ( | ) | const |
returns a const reference to the bond values
bool BALL::FPTBondOrderStrategy::Assignment_::isValid | ( | MolecularGraph & | molecule, |
FPTBondOrderStrategy & | parent | ||
) |
Returns true if the assignment is valid to the given UndirectedGraph and PenaltyMap. This happens if the sum of penalties of each atom with the valence as sum of the bond values of each incident bond is equal to the penalty of this assignment.
molecule | should be the same graph which was used to compute this assignment |
PenaltyMap | should be the same penalty map which was used to compute this assignment |
bool BALL::FPTBondOrderStrategy::Assignment_::operator< | ( | Assignment_ const & | a | ) | const |
bool BALL::FPTBondOrderStrategy::Assignment_::operator<= | ( | Assignment_ const & | a | ) | const |
Assignment_& BALL::FPTBondOrderStrategy::Assignment_::operator= | ( | Assignment_ const & | copy | ) |
Assignment operator
bool BALL::FPTBondOrderStrategy::Assignment_::operator== | ( | Assignment_ const & | a | ) | const |
bool BALL::FPTBondOrderStrategy::Assignment_::operator> | ( | Assignment_ const & | a | ) | const |
bool BALL::FPTBondOrderStrategy::Assignment_::operator>= | ( | Assignment_ const & | a | ) | const |
Returns the value for the bond with the given index.
BALL::Exception::IndexOverflow | unless index is less than the number of bonds in this assignment |
Gives access to the bond value of the bond with the given index.
BALL::Exception::IndexOverflow | unless index is less than the number of bonds in this assignment |
|
protected |
A vector with bond values. 0 is single bond, 1 is double bond, 2 is tripple bond
Definition at line 808 of file FPTBondOrderStrategy.h.
Penalty BALL::FPTBondOrderStrategy::Assignment_::penalty |
The penalty of this assignment
Definition at line 802 of file FPTBondOrderStrategy.h.