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> 191 virtual void clear();
200 virtual bool readOptions(
const Options& options);
201 virtual void setDefaultOptions();
208 virtual boost::shared_ptr<BondOrderAssignment> computeNextSolution();
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)
294 Size numberOfAtoms()
const;
299 Size numberOfBonds()
const;
322 typedef std::pair<boost::reference_wrapper<DPConfig_>, Penalty>
DPRow_;
328 typedef std::pair<boost::reference_wrapper<DPConfig_ const>, Penalty>
DPConstRow_;
341 typedef std::map<DPConfig_, Penalty>
DPMap_;
383 Penalty operator[](
DPConfig_ const& config)
const;
389 bool insert(
DPConfig_ const& config, Penalty penalty);
399 Penalty bestPenalty()
const;
406 DPConstRow_ bestEntry()
const;
421 const_iterator begin()
const;
426 const_iterator end()
const;
460 std::vector<MolecularGraphTraits::EdgeType>
bonds;
492 FPTBondOrderAssignment_(
FPTBondOrderStrategy& parent, boost::shared_ptr<TreeDecomposition>& ntd,
493 Penalty upper_bound = infinite_penalty);
500 ~FPTBondOrderAssignment_();
523 boost::shared_ptr<TreeDecomposition>
ntd_;
562 DPTable_* operator() (TreeDecompositionBag& bag,
563 std::vector<DPTable_*>::const_iterator begin, std::vector<DPTable_*>::const_iterator end);
572 std::vector<MolecularGraphTraits::EdgeType> getBondsInBag(TreeDecompositionBag& bag);
592 void computeIntroduceBag(TreeDecompositionBag& bag,
609 void computeForgetBag(TreeDecompositionBag& bag,
625 void computeJoinBag(TreeDecompositionBag& bag,
640 Penalty forgetInnerVertexIn(TreeDecompositionBag& bag, DPConstRow_ child_row,
DPConfig_& entry,
641 std::vector<MolecularGraphTraits::EdgeType>& child_bonds,
Size forgotten_index);
676 boost::shared_ptr<TreeWidth<MolecularGraph> >
tw;
732 BondOrder operator [](
Size index)
const;
738 BondOrder& operator [](
Size index);
755 std::vector<BondOrder>
const& getBondOrders()
const;
844 bool operator() (Edge
const& e1, Edge
const& e2);
942 typedef std::pair<DPTable_::const_iterator, DPTable_::const_iterator>
DPPairIt_;
947 static bool compareJoinTablePairs_(DPPairIt_
const& left, DPPairIt_
const& right);
952 static bool compareTablePointerEntries_(DPPointerRow_
const& left, DPPointerRow_
const& right);
958 typedef std::multimap<DPConfig_ const*, Penalty, DPJoinMapComparator_>
DPJoinMap_;
997 std::vector<MolecularGraphTraits::EdgeType>
const&
bonds, Penalty upperbound = infinite_penalty);
1033 bool hasMoreSolutions()
const;
1039 void nextSolution();
1045 Penalty penaltyOfNextSolution()
const;
1049 void preorder(TreeDecompositionBag node, TreeDecomposition&)
1051 bags_->push_back(node);
1054 void inorder(TreeDecompositionBag, TreeDecomposition&)
1091 std::multiset<BackTrackingState_*, StateComparator_>
queue_;
1102 std::vector<MolecularGraphTraits::EdgeType>
const*
bonds_;
1107 boost::shared_ptr<std::vector<TreeDecompositionBag> >
bags_;
1197 bool isSolutionNeeded(Penalty penalty);
1249 Size solution_number, Penalty upper_bound = infinite_penalty);
1271 bool hasMoreSolutions()
const;
1277 void nextSolution();
1293 Penalty penaltyOfNextSolution()
const;
1312 std::priority_queue<Assignment_, std::vector<Assignment_>, std::greater<Assignment_> >
priority_queue_;
1344 std::pair<Size, Penalty> getNextMinimumBackTracker_()
const;
1351 void applyAssignment_(
Size backtracker_index,
Size solution_index);
1362 void combineEachSolution_(
Size mindex);
1367 std::vector<DPBackTracking_*> deepCopyOfBacktrackers_()
const;
1373 void initPenaltyData_();
1415 #endif // BALL_STRUCTURE_BONDORDERS_FPTBONDORDERSTRATEGY_H
static String UPPER_PENALTY_BOUND
TreeWidth< MolecularGraph >::TreeDecomposition TreeDecomposition
GRAPH::GraphTraits< MolecularGraph >::EdgeType Edge
boost::graph_as_tree< TreeDecompositionGraph, TreeDecompositionParentMap > TreeDecomposition
std::stack< std::pair< DPConfig_, Size > > join_branches
vector< Bond const * > bonds
FPTBondOrderStrategy * parent_
static const Penalty infinite_penalty
TreeWidth< MolecularGraph >::TreeDecompositionBag TreeDecompositionBag
GRAPH::GraphTraits< MolecularGraph >::VertexType VertexType
std::vector< int > const * penalties_
std::multiset< BackTrackingState_ *, StateComparator_ > queue_
std::pair< boost::reference_wrapper< DPConfig_ const >, Penalty > DPConstRow_
Index compare(const T1 &a, const T2 &b)
Size num_computed_solutions_
GRAPH::GraphTraits< MolecularGraph >::EdgeType Edge
BackTrackingState_ * current_state_
Base class for bond order assignment algorithms.
BALL_EXPORT AtomList atoms(const AtomContainer &fragment, const String &expression=String())
boost::graph_traits< Graph >::vertex_descriptor VertexType
std::vector< std::vector< int > > const * atom_to_block_
std::vector< std::vector< Assignment_ > > component_solutions_
TreeWidth< MolecularGraph >::TreeDecomposition TreeDecomposition
std::vector< Position > const * block_to_start_idx_
BondOrder max_bond_order_
std::vector< Valence > consumed_valences
boost::graph_traits< TreeDecompositionGraph >::vertex_descriptor TreeDecompositionBag
std::vector< Size > const * block_to_length_
std::vector< BondOrder > bonds_
boost::shared_ptr< TreeWidth< MolecularGraph > > tw
void preorder(TreeDecompositionBag node, TreeDecomposition &)
Assignment of bond orders from topology information.
FPTBondOrderAssignment_ * bond_assignment_
boost::shared_ptr< ComputingData_ > computing_data_
std::vector< DPBackTracking_ * > backtrackers_
static const Valence max_valence
std::multimap< DPConfig_ const *, Penalty, DPJoinMapComparator_ > DPJoinMap_
boost::shared_ptr< std::vector< TreeDecompositionBag > > bags_
BALL_EXPORT BondList bonds(const AtomContainer &fragment, bool selected_only=false)
DPMap_::iterator iterator
void inorder(TreeDecompositionBag, TreeDecomposition &)
boost::shared_ptr< DPBackTrackingCombiner_ > combiner_
boost::graph_traits< Graph >::edge_descriptor EdgeType
std::vector< MolecularGraphTraits::EdgeType > const * bonds_
DPConfig_(ValenceIterator vit, ValenceIterator vend, BondIterator boit, BondIterator boend)
BALL_EXPORT bool operator<=(const String &s1, const String &s2)
BALL_EXPORT bool operator<(const String &s1, const String &s2)
DPMap_::const_iterator const_iterator
TreeWidth< MolecularGraph >::TreeDecompositionContent TreeDecompositionContent
vector< AdditionalBagProperties_ > properties_
vector< FPTBondOrderAssignment_ * > bond_assignments
std::vector< MolecularGraphTraits::EdgeType > bonds
std::set< OriginalVertexType > TreeDecompositionContent
std::priority_queue< Assignment_, std::vector< Assignment_ >, std::greater< Assignment_ > > priority_queue_
void postorder(TreeDecompositionBag, TreeDecomposition &)
std::vector< int > const * block_to_start_valence_
MolecularGraph * molecule_graph
std::vector< MolecularGraphTraits::EdgeType > sorted_edges
vector< TreeDecompositionBag > BagVector
std::pair< boost::reference_wrapper< DPConfig_ >, Penalty > DPRow_
BALL_EXPORT bool operator>(const String &s1, const String &s2)
BALL_EXPORT bool operator==(const String &s1, const String &s2)
std::vector< BondOrder > bond_assignments
EdgeComparator_(MolecularGraph *graph)
static Penalty UPPER_PENALTY_BOUND
MolecularGraph * molecule_
TreeWidth< MolecularGraph >::TreeDecompositionBag TreeDecompositionBag
std::pair< DPConfig_ *, Penalty > DPPointerRow_
boost::shared_ptr< TreeDecomposition > ntd_
BALL_EXPORT bool operator>=(const String &s1, const String &s2)
std::map< DPConfig_, Penalty > DPMap_
std::pair< DPTable_::const_iterator, DPTable_::const_iterator > DPPairIt_