Go to the documentation of this file. 1 #ifndef BALL_STRUCTURE_BONDORDERS_FPTBONDORDERSTRATEGY_H
2 #define BALL_STRUCTURE_BONDORDERS_FPTBONDORDERSTRATEGY_H
4 #ifndef BALL_COMMON_GLOBAL_H
8 #ifndef BALL_MATHS_COMMON_H
12 #ifndef BALL_KERNEL_ATOMCONTAINER_H
16 #ifndef BALL_KERNEL_BOND_H
20 #ifndef BALL_DATATYPE_HASHMAP_H
24 #ifndef BALL_DATATYPE_GRAPH_H
28 #ifndef BALL_DATATYPE_GRAPH_GRAPHALGORITHMS_H
32 #ifndef BALL_DATATYPE_GRAPH_TREEWIDTH_H
36 #ifndef BALL_STRUCTURE_BONDORDERS_BONDORDERASSIGNMENTSTRATEGY_H
40 #ifndef BALL_STRUCTURE_BONDORDERS_BONDORDERASSIGNMENT_H
52 #include <boost/shared_ptr.hpp>
53 #include <boost/ref.hpp>
237 DPConfig_(std::vector<Valence>
const& v, std::vector<BondOrder>
const& bo);
247 template<
typename ValenceIterator,
typename BondIterator>
248 DPConfig_(ValenceIterator vit, ValenceIterator vend, BondIterator boit, BondIterator boend)
249 : consumed_valences(vit, vend),
250 bond_assignments(boit, boend)
341 typedef std::map<DPConfig_, Penalty>
DPMap_;
460 std::vector<MolecularGraphTraits::EdgeType>
bonds;
493 Penalty upper_bound = infinite_penalty);
523 boost::shared_ptr<TreeDecomposition>
ntd_;
563 std::vector<DPTable_*>::const_iterator begin, std::vector<DPTable_*>::const_iterator end);
641 std::vector<MolecularGraphTraits::EdgeType>& child_bonds,
Size forgotten_index);
676 boost::shared_ptr<TreeWidth<MolecularGraph> >
tw;
942 typedef std::pair<DPTable_::const_iterator, DPTable_::const_iterator>
DPPairIt_;
958 typedef std::multimap<DPConfig_ const*, Penalty, DPJoinMapComparator_>
DPJoinMap_;
997 std::vector<MolecularGraphTraits::EdgeType>
const&
bonds,
Penalty upperbound = infinite_penalty);
1051 bags_->push_back(node);
1091 std::multiset<BackTrackingState_*, StateComparator_>
queue_;
1102 std::vector<MolecularGraphTraits::EdgeType>
const*
bonds_;
1107 boost::shared_ptr<std::vector<TreeDecompositionBag> >
bags_;
1249 Size solution_number,
Penalty upper_bound = infinite_penalty);
1312 std::priority_queue<Assignment_, std::vector<Assignment_>, std::greater<Assignment_> >
priority_queue_;
1415 #endif // BALL_STRUCTURE_BONDORDERS_FPTBONDORDERSTRATEGY_H
static String UPPER_PENALTY_BOUND
static bool compareTablePointerEntries_(DPPointerRow_ const &left, DPPointerRow_ const &right)
vector< TreeDecompositionBag > BagVector
FPTBondOrderAssignment_(FPTBondOrderStrategy &parent, boost::shared_ptr< TreeDecomposition > &ntd, Penalty upper_bound=infinite_penalty)
std::vector< BondOrder > bond_assignments
std::pair< boost::reference_wrapper< DPConfig_ const >, Penalty > DPConstRow_
std::vector< std::vector< Assignment_ > > component_solutions_
const_iterator end() const
std::vector< DPBackTracking_ * > backtrackers_
std::vector< Position > const * block_to_start_idx_
TreeWidth< MolecularGraph >::TreeDecompositionBag TreeDecompositionBag
BALL_EXPORT AtomList atoms(const AtomContainer &fragment, const String &expression=String())
std::vector< BondOrder > bonds_
vector< AdditionalBagProperties_ > properties_
TreeWidth< MolecularGraph >::TreeDecompositionBag TreeDecompositionBag
DPBackTracking_(DPBackTracking_ const ©)
virtual void setDefaultOptions()
Assignment_(Assignment_ const ©)
BALL_EXPORT BondList bonds(const AtomContainer &fragment, bool selected_only=false)
std::vector< Valence > consumed_valences
DPMap_::iterator iterator
DPBackTrackingCombiner_(std::vector< FPTBondOrderAssignment_ * > &bond_assignments, Size solution_number, Penalty upper_bound=infinite_penalty)
DPBackTracking_(FPTBondOrderAssignment_ &bond_assignment, Size max_number_of_solutions, std::vector< MolecularGraphTraits::EdgeType > const &bonds, Penalty upperbound=infinite_penalty)
Assignment_ const & getSolution() const
Size bondIndexFor(MolecularGraphTraits::EdgeType bond) const
BackTrackingState_ & operator=(BackTrackingState_ const &other)
int compare(BackTrackingState_ const &other) const
bool isValid(MolecularGraph &molecule, FPTBondOrderStrategy &parent)
void setStateAssignment(BackTrackingState_ &state, TreeDecompositionBag &bag, DPConfig_ &antecessor, MolecularGraphTraits::VertexType forgotten_vertex)
std::pair< Size, Penalty > getNextMinimumBackTracker_() const
BALL_EXPORT bool operator<(const String &s1, const String &s2)
TreeWidth< MolecularGraph >::TreeDecomposition TreeDecomposition
DPConfig_(Size atoms, Size bonds)
void computeJoinBag(TreeDecompositionBag &bag, DPTable_ &leftChild, DPTable_ &rightChild, AdditionalBagProperties_ &bag_properties)
void visitForget(BackTrackingState_ &state, TreeDecompositionBag &bag, DPTable_ &table)
std::pair< DPTable_::const_iterator, DPTable_::const_iterator > DPPairIt_
void computeForgetBag(TreeDecompositionBag &bag, DPTable_ &child, AdditionalBagProperties_ &property)
DPMap_::const_iterator const_iterator
DPTable_(DPTable_ const &table)
~DPBackTrackingCombiner_()
GRAPH::GraphTraits< MolecularGraph >::VertexType VertexType
void remember(BackTrackingState_ &state)
Size num_computed_solutions_
Assignment_(Size num_bonds)
Penalty bestPenalty() const
Assignment of bond orders from topology information.
std::vector< Size > const * block_to_length_
BALL_EXPORT bool operator>(const String &s1, const String &s2)
static const Penalty infinite_penalty
BALL_EXPORT bool operator>=(const String &s1, const String &s2)
Assignment_ & operator=(Assignment_ const ©)
FPTBondOrderStrategy * parent_
EdgeComparator_(MolecularGraph *graph)
bool insert(DPConfig_ const &config, Penalty penalty)
void computeRootBag(TreeDecompositionBag &bag, DPTable_ &child, AdditionalBagProperties_ &bag_properties)
bool isSolutionNeeded(Penalty penalty)
TreeWidth< MolecularGraph >::TreeDecompositionContent TreeDecompositionContent
std::vector< MolecularGraphTraits::EdgeType > bonds
void visitLeaf(BackTrackingState_ &state)
BondOrder max_bond_order_
Base class for bond order assignment algorithms.
void combine(Assignment_ const &other)
Penalty penaltyOfNextSolution() const
DPConstRow_ bestEntry() const
std::pair< boost::reference_wrapper< DPConfig_ >, Penalty > DPRow_
int compare(DPConfig_ const *leftp, DPConfig_ const *rightp) const
static const Valence max_valence
boost::shared_ptr< ComputingData_ > computing_data_
AdditionalBagProperties_ & getProperties(Size order)
AdditionalBagProperties_ & operator=(AdditionalBagProperties_ const ©)
BackTrackingState_ * current_state_
Assignment_ & getSolution()
void computeIntroduceBag(TreeDecompositionBag &bag, DPTable_ &child, AdditionalBagProperties_ &bag_properties)
std::vector< DPBackTracking_ * > deepCopyOfBacktrackers_() const
Penalty operator[](DPConfig_ const &config) const
boost::graph_traits< Graph >::edge_descriptor EdgeType
GRAPH::GraphTraits< MolecularGraph >::EdgeType Edge
std::set< OriginalVertexType > TreeDecompositionContent
void computeLeafIntroduceBag(AdditionalBagProperties_ &bag_properties)
boost::graph_traits< Graph >::vertex_descriptor VertexType
void visitIntroduce(BackTrackingState_ &state, TreeDecompositionBag &bag, DPTable_ &table)
boost::shared_ptr< TreeWidth< MolecularGraph > > tw
std::vector< MolecularGraphTraits::EdgeType > const * bonds_
int compare(Assignment_ const &a) const
virtual bool readOptions(const Options &options)
void visitJoin(BackTrackingState_ &state, TreeDecompositionBag &bag, DPTable_ &leftTable, DPTable_ &rightTable)
FPTBondOrderAssignment_ * bond_assignment_
int compare(DPConfig_ const &other) const
void preorder(TreeDecompositionBag node, TreeDecomposition &)
DPBackTrackingCombiner_(DPBackTrackingCombiner_ const ©)
std::map< DPConfig_, Penalty > DPMap_
boost::shared_ptr< TreeDecomposition > ntd_
vector< FPTBondOrderAssignment_ * > bond_assignments
static Penalty UPPER_PENALTY_BOUND
std::vector< MolecularGraphTraits::EdgeType > getBondsInBag(TreeDecompositionBag &bag)
void initPenaltyData_()
Initialize pointers to penalty data.
DPConfig_(ValenceIterator vit, ValenceIterator vend, BondIterator boit, BondIterator boend)
bool hasMoreSolutions() const
Size numberOfBonds() const
boost::graph_traits< TreeDecompositionGraph >::vertex_descriptor TreeDecompositionBag
Size numberOfAtoms() const
boost::shared_ptr< DPBackTrackingCombiner_ > combiner_
bool hasMoreSolutions() const
std::vector< std::vector< int > > const * atom_to_block_
BackTrackingState_(BackTrackingState_ const &other)
~AdditionalBagProperties_()
std::multimap< DPConfig_ const *, Penalty, DPJoinMapComparator_ > DPJoinMap_
BALL_EXPORT bool operator==(const String &s1, const String &s2)
Penalty penaltyOfNextSolution() const
MolecularGraph * molecule_
TreeWidth< MolecularGraph >::TreeDecomposition TreeDecomposition
BackTrackingState_(Size bonds)
std::pair< DPConfig_ *, Penalty > DPPointerRow_
virtual boost::shared_ptr< BondOrderAssignment > computeNextSolution()
vector< Bond const * > bonds
std::vector< BondOrder > const & getBondOrders() const
void extendState(BackTrackingState_ &state, DPConfig_ const &antecessor, Penalty additional_penalty)
virtual ~FPTBondOrderStrategy()
DPConfig_(std::vector< Valence > const &v, std::vector< BondOrder > const &bo)
const_iterator begin() const
std::vector< int > const * penalties_
void applyAssignment_(Size backtracker_index, Size solution_index)
std::multiset< BackTrackingState_ *, StateComparator_ > queue_
Assignment_ & getSolution()
void combineEachSolution_(Size mindex)
Assignment_ const & getSolution() const
boost::shared_ptr< std::vector< TreeDecompositionBag > > bags_
FPTBondOrderStrategy(AssignBondOrderProcessor *parent)
void inorder(TreeDecompositionBag, TreeDecomposition &)
Penalty getPenaltyFor_(MolecularGraphTraits::VertexType vertex, Valence valence) const
Return penalty value for given vertex and valence.
GRAPH::GraphTraits< MolecularGraph >::EdgeType Edge
DPTable_ & getTable(Size order)
static bool compareJoinTablePairs_(DPPairIt_ const &left, DPPairIt_ const &right)
Assignment_(std::vector< BondOrder > const &bonds, Penalty penalty)
BALL_EXPORT bool operator<=(const String &s1, const String &s2)
std::vector< MolecularGraphTraits::EdgeType > sorted_edges
std::priority_queue< Assignment_, std::vector< Assignment_ >, std::greater< Assignment_ > > priority_queue_
~FPTBondOrderAssignment_()
DPConfig_ & operator=(DPConfig_ const ©)
MolecularGraph * molecule_graph
AdditionalBagProperties_(AdditionalBagProperties_ const ©)
boost::graph_as_tree< TreeDecompositionGraph, TreeDecompositionParentMap > TreeDecomposition
std::vector< int > const * block_to_start_valence_
AdditionalBagProperties_()
void postorder(TreeDecompositionBag, TreeDecomposition &)
std::stack< std::pair< DPConfig_, Size > > join_branches
void branchState(BackTrackingState_ &state, TreeDecompositionBag const &child, DPConfig_ const &antecessor)
Penalty forgetInnerVertexIn(TreeDecompositionBag &bag, DPConstRow_ child_row, DPConfig_ &entry, std::vector< MolecularGraphTraits::EdgeType > &child_bonds, Size forgotten_index)