Debian Codegraph @

include/BALL/STRUCTURE/BONDORDERS/partialBondOrderAssignment.h

raw symbols SCIP
1 #ifndef BALL_STRUCTURE_BONDORDERS_PARTIALBONDORDERASSIGNMENT_H
2 #define BALL_STRUCTURE_BONDORDERS_PARTIALBONDORDERASSIGNMENT_H
3
4 #ifndef BALL_COMMON_GLOBAL_H
5 # include <BALL/COMMON/global.h>
6 #endif
7
8 #ifndef BALL_KERNEL_ATOM_H
9 # include <BALL/KERNEL/atom.h>
10 #endif
11
12 #ifndef BALL_KERNEL_BOND_H
13 # include <BALL/KERNEL/bond.h>
14 #endif
15
16 #include <boost/shared_ptr.hpp>
17 #include <vector>
18
19 namespace BALL
20 {
21 class AssignBondOrderProcessor;
22 class BondOrderAssignment;
23
24 /** \brief A full or partial solution to the AStar-based bond order assignment problem.
25 *
26 * This class represents a full or partial bond order assignment. It is a very basic representation
27 * without any convenience functionality. This class exists because sometimes we need a
28 * representation that is as small as possible - we need many of these during the AStar
29 * runs, e.g., and memory quickly becomes an issue. Please note that we explicitly avoid
30 * virtual functions here to save the vtable - inheriting from this class makes no sense, anyhow.
31 *
32 */
33 class BALL_EXPORT PartialBondOrderAssignment
34 {
35 public:
36 // this enum allows faster access to the type of the chosen heuristic than a string compare
37 enum HEURISTIC_INDEX
38 {
39 SIMPLE,
40 MEDIUM,
41 TIGHT
42 };
43
44 // Constructor
45 PartialBondOrderAssignment(AssignBondOrderProcessor* parent);
46
47 // Destructor
48 ~PartialBondOrderAssignment();
49
50 boost::shared_ptr<BondOrderAssignment> convertToFullAssignment();
51
52 //
53 void clear();
54
55 // the less operator.
56 // NOTE: we want a reverse sort, hence we actually return a "greater"
57 bool operator < (const PartialBondOrderAssignment& b) const;
58
59 // the penalty
60 float coarsePenalty(float atom_type_penalty, float bond_length_penalty) const;
61
62 // the combined penalty of structure and type penalty
63 float coarsePenalty() const;
64
65 // the bond length penalty
66 float finePenalty() const {return estimated_bond_length_penalty;}
67
68 /// Convenience function to obtain total atom type penalty value
69 float getAtomTypePenalty(bool include_heuristic_term = true, HEURISTIC_INDEX heuristic_index = SIMPLE);
70
71 /** Estimates the objective function f = g* + h* of the ASTAR - algorithm, if
72 * include_heuristic_term == true, otherwise compute only f = g*. The
73 * result is stored in the PartialBondOrderAssignment entry's member estimated_atom_type_penalty.
74 *
75 * @retval bool - true, if the entry is still valid.
76 * @retval bool - false otherwise.
77 */
78 bool estimatePenalty_(bool include_heuristic_term = true, HEURISTIC_INDEX heuristic_index = SIMPLE);
79
80 /// Estimates the atom type penalty for a given unclosed atom.
81 float estimateAtomTypePenalty_(Atom* atom,
82 Index atom_index, // the atom index
83 int fixed_valence, // its so far fixed valence (incl. virtual H's)
84 int fixed_virtual_order, // its so far fixed virtual H's
85 int num_free_bonds, // its number of unfixed original bonds
86 HEURISTIC_INDEX heuristic_index);
87
88 /// Estimates the bond length penalty for a given unclosed atom.
89 // NOTE: virtual bonds are excluded!
90 float estimateBondLengthPenalty_(Index atom_index, // the atom index
91 const vector<Bond*>& free_bonds,
92 int fixed_virtual_order,
93 int fixed_valence,
94 int num_free_bonds);
95
96
97 // the estimated atom type penalty
98 float estimated_atom_type_penalty;
99 // the estimated bond length penalty
100 float estimated_bond_length_penalty;
101
102 // the bond orders
103 // the i-th entry denotes the bondorder of the i-th bond
104 // unset bonds get the order 0
105 vector<short> bond_orders;
106
107 // the index of the bond last considered
108 Position last_bond;
109
110 AssignBondOrderProcessor* abop;
111 };
112 }
113
114 #endif // BALL_STRUCTURE_BONDORDERS_PARTIALBONDORDERASSIGNMENT_H