Loading...
Searching...
No Matches
FPTBondOrderStrategy.h
Go to the documentation of this file.
#ifndef BALL_STRUCTURE_BONDORDERS_FPTBONDORDERSTRATEGY_H
#define BALL_STRUCTURE_BONDORDERS_FPTBONDORDERSTRATEGY_H
#ifndef BALL_COMMON_GLOBAL_H
# include <BALL/COMMON/global.h>
#endif
#ifndef BALL_MATHS_COMMON_H
# include <BALL/MATHS/common.h>
#endif
#ifndef BALL_KERNEL_ATOMCONTAINER_H
# include <BALL/KERNEL/atomContainer.h>
#endif
#ifndef BALL_KERNEL_BOND_H
# include <BALL/KERNEL/bond.h>
#endif
#ifndef BALL_DATATYPE_HASHMAP_H
# include <BALL/DATATYPE/hashMap.h>
#endif
#ifndef BALL_DATATYPE_GRAPH_H
# include <BALL/DATATYPE/GRAPH/molecularGraph.h>
#endif
#ifndef BALL_DATATYPE_GRAPH_GRAPHALGORITHMS_H
# include <BALL/DATATYPE/GRAPH/graphAlgorithms.h>
#endif
#ifndef BALL_DATATYPE_GRAPH_TREEWIDTH_H
# include <BALL/DATATYPE/GRAPH/treeWidth.h>
#endif
#ifndef BALL_STRUCTURE_BONDORDERS_BONDORDERASSIGNMENTSTRATEGY_H
# include <BALL/STRUCTURE/BONDORDERS/bondOrderAssignmentStrategy.h>
#endif
#ifndef BALL_STRUCTURE_BONDORDERS_BONDORDERASSIGNMENT_H
# include <BALL/STRUCTURE/BONDORDERS/bondOrderAssignment.h>
#endif
#include <algorithm>
#include <map>
#include <set>
#include <vector>
#include <stack>
#include <iterator>
#include <queue>
#include <boost/shared_ptr.hpp>
#include <boost/ref.hpp>
namespace BALL
{
//TODO: documentation is obsolete!
class BALL_EXPORT FPTBondOrderStrategy
: public BondOrderAssignmentStrategy
{
public:
typedef GRAPH::GraphTraits<MolecularGraph>::EdgeType Edge;
typedef GRAPH::GraphTraits<MolecularGraph>::VertexType VertexType;
typedef TreeWidth<MolecularGraph>::TreeDecomposition TreeDecomposition;
typedef TreeWidth<MolecularGraph>::TreeDecompositionBag TreeDecompositionBag;
friend class FPTBondOrderAssignment_;
typedef float Penalty;
typedef int Valence;
typedef int BondOrder;
static const Penalty infinite_penalty;
static const Valence max_valence;
struct BALL_EXPORT Option
{
static String UPPER_PENALTY_BOUND;
};
struct BALL_EXPORT Default
{
static Penalty UPPER_PENALTY_BOUND;
};
FPTBondOrderStrategy(AssignBondOrderProcessor* parent);
virtual ~FPTBondOrderStrategy();
virtual void clear();
virtual void init();
virtual bool readOptions(const Options& options);
virtual void setDefaultOptions();
virtual boost::shared_ptr<BondOrderAssignment> computeNextSolution();
protected:
class DPConfig_
{
public:
DPConfig_();
DPConfig_(Size atoms, Size bonds);
DPConfig_(std::vector<Valence> const& v, std::vector<BondOrder> const& bo);
DPConfig_& operator=(DPConfig_ const& copy);
template<typename ValenceIterator, typename BondIterator>
DPConfig_(ValenceIterator vit, ValenceIterator vend, BondIterator boit, BondIterator boend)
: consumed_valences(vit, vend),
bond_assignments(boit, boend)
{
}
bool operator < (DPConfig_ const& conf) const;
bool operator > (DPConfig_ const& conf) const;
bool operator <= (DPConfig_ const& conf) const;
bool operator >= (DPConfig_ const& conf) const;
bool operator == (DPConfig_ const& conf) const;
int compare(DPConfig_ const& other) const;
Size numberOfAtoms() const;
Size numberOfBonds() const;
std::vector<Valence> consumed_valences;
std::vector<BondOrder> bond_assignments;
};
typedef std::pair<boost::reference_wrapper<DPConfig_>, Penalty> DPRow_;
typedef std::pair<boost::reference_wrapper<DPConfig_ const>, Penalty> DPConstRow_;
typedef std::pair<DPConfig_*, Penalty> DPPointerRow_;
typedef std::map<DPConfig_, Penalty> DPMap_;
class DPTable_
{
protected:
DPMap_ table;
public:
DPTable_();
DPTable_(DPTable_ const& table);
typedef DPMap_::iterator iterator;
typedef DPMap_::const_iterator const_iterator;
Penalty operator[](DPConfig_ const& config) const;
bool insert(DPConfig_ const& config, Penalty penalty);
Size size() const;
Penalty bestPenalty() const;
DPConstRow_ bestEntry() const;
iterator begin();
iterator end();
const_iterator begin() const;
const_iterator end() const;
};
class AdditionalBagProperties_
{
public:
AdditionalBagProperties_();
AdditionalBagProperties_(AdditionalBagProperties_ const& copy);
AdditionalBagProperties_& operator=(AdditionalBagProperties_ const& copy);
~AdditionalBagProperties_();
std::vector<MolecularGraphTraits::EdgeType> bonds;
DPTable_ * table;
};
class DPBackTracking_;
class DPBackTrackingCombiner_;
class FPTBondOrderAssignment_
{
public:
friend class DPBackTracking_;
friend class DPBackTrackingCombiner_;
friend class GRAPH::PostOrderFolding<TreeDecomposition, TreeDecompositionBag, DPTable_*, FPTBondOrderAssignment_>;
FPTBondOrderAssignment_(FPTBondOrderStrategy& parent, boost::shared_ptr<TreeDecomposition>& ntd,
Penalty upper_bound = infinite_penalty);
~FPTBondOrderAssignment_();
Penalty compute();
protected:
FPTBondOrderStrategy* parent_;
MolecularGraph * molecule_;
boost::shared_ptr<TreeDecomposition> ntd_;
vector<AdditionalBagProperties_> properties_;
Penalty upper_bound_;
BondOrder max_bond_order_;
Valence max_valence_;
DPTable_* operator() (TreeDecompositionBag& bag,
std::vector<DPTable_*>::const_iterator begin, std::vector<DPTable_*>::const_iterator end);
std::vector<MolecularGraphTraits::EdgeType> getBondsInBag(TreeDecompositionBag& bag);
void computeLeafIntroduceBag(AdditionalBagProperties_& bag_properties);
void computeIntroduceBag(TreeDecompositionBag& bag,
DPTable_& child, AdditionalBagProperties_& bag_properties);
void computeForgetBag(TreeDecompositionBag& bag,
DPTable_& child, AdditionalBagProperties_& property);
void computeJoinBag(TreeDecompositionBag& bag,
DPTable_& leftChild, DPTable_& rightChild, AdditionalBagProperties_& bag_properties);
void computeRootBag(TreeDecompositionBag& bag, DPTable_& child, AdditionalBagProperties_& bag_properties);
Penalty forgetInnerVertexIn(TreeDecompositionBag& bag, DPConstRow_ child_row, DPConfig_& entry,
std::vector<MolecularGraphTraits::EdgeType>& child_bonds, Size forgotten_index);
};
class ComputingData_
{
public:
ComputingData_();
~ComputingData_();
vector<FPTBondOrderAssignment_*> bond_assignments;
MolecularGraph *molecule_graph;
boost::shared_ptr<TreeWidth<MolecularGraph> > tw;
vector<Bond const *> bonds;
};
class Assignment_
{
public:
Assignment_();
Assignment_(Size num_bonds);
Assignment_(Assignment_ const& copy);
Assignment_(std::vector<BondOrder> const& bonds, Penalty penalty);
Assignment_& operator=(Assignment_ const& copy);
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);
Penalty penalty;
protected:
std::vector<BondOrder> bonds_;
};
struct DPJoinMapComparator_
{
bool operator() (DPConfig_ const* leftp, DPConfig_ const* rightp) const;
int compare(DPConfig_ const* leftp, DPConfig_ const* rightp) const;
};
class EdgeComparator_
{
public:
typedef GRAPH::GraphTraits<MolecularGraph>::EdgeType Edge;
EdgeComparator_(MolecularGraph* graph)
: graph_(graph)
{ }
bool operator() (Edge const& e1, Edge const& e2);
protected:
MolecularGraph* graph_;
};
class BackTrackingState_
{
public:
BackTrackingState_();
BackTrackingState_(Size bonds);
BackTrackingState_(BackTrackingState_ const& other);
BackTrackingState_& operator=(BackTrackingState_ const& other);
int compare(BackTrackingState_ const& other) const;
bool operator < (BackTrackingState_ const&) const;
bool operator > (BackTrackingState_ const&) const;
bool operator <= (BackTrackingState_ const&) const;
bool operator >= (BackTrackingState_ const&) const;
bool operator == (BackTrackingState_ const&) const;
Assignment_ assignment;
DPConfig_ config;
std::stack<std::pair<DPConfig_, Size> > join_branches;
Size index;
};
typedef std::pair<DPTable_::const_iterator, DPTable_::const_iterator> DPPairIt_;
static bool compareJoinTablePairs_(DPPairIt_ const& left, DPPairIt_ const& right);
static bool compareTablePointerEntries_(DPPointerRow_ const& left, DPPointerRow_ const& right);
typedef std::multimap<DPConfig_ const*, Penalty, DPJoinMapComparator_> DPJoinMap_;
class DPBackTracking_
{
public:
typedef TreeWidth<MolecularGraph>::TreeDecomposition TreeDecomposition;
typedef TreeWidth<MolecularGraph>::TreeDecompositionBag TreeDecompositionBag;
typedef TreeWidth<MolecularGraph>::TreeDecompositionContent TreeDecompositionContent;
DPBackTracking_(FPTBondOrderAssignment_& bond_assignment, Size max_number_of_solutions,
std::vector<MolecularGraphTraits::EdgeType> const& bonds, Penalty upperbound = infinite_penalty);
DPBackTracking_(DPBackTracking_ const& copy);
~DPBackTracking_();
DPBackTracking_& operator= (DPBackTracking_ const& copy);
Assignment_& getSolution();
Assignment_ const& getSolution() const;
bool hasMoreSolutions() const;
void nextSolution();
Penalty penaltyOfNextSolution() const;
void clear();
void preorder(TreeDecompositionBag node, TreeDecomposition&)
{
bags_->push_back(node);
}
void inorder(TreeDecompositionBag, TreeDecomposition&)
{
}
void postorder(TreeDecompositionBag, TreeDecomposition&)
{
}
protected:
struct StateComparator_
{
bool operator () (BackTrackingState_ const * left, BackTrackingState_ const * right) const;
};
FPTBondOrderAssignment_* bond_assignment_;
BackTrackingState_* current_state_;
std::multiset<BackTrackingState_*, StateComparator_> queue_;
Size max_num_solutions_;
std::vector<MolecularGraphTraits::EdgeType> const* bonds_;
boost::shared_ptr<std::vector<TreeDecompositionBag> > bags_;
Size max_heap_size_;
Size num_computed_solutions_;
Penalty upper_bound_;
typedef vector<TreeDecompositionBag> BagVector;
DPTable_& getTable(Size order);
AdditionalBagProperties_& getProperties(Size order);
void visitLeaf(BackTrackingState_& state);
void visitJoin(BackTrackingState_& state, TreeDecompositionBag& bag,
DPTable_& leftTable, DPTable_& rightTable);
void visitForget(BackTrackingState_& state, TreeDecompositionBag& bag, DPTable_& table);
void visitIntroduce(BackTrackingState_& state, TreeDecompositionBag& bag, DPTable_& table);
Size bondIndexFor(MolecularGraphTraits::EdgeType bond) const;
void remember(BackTrackingState_& state);
bool isSolutionNeeded(Penalty penalty);
void setStateAssignment(BackTrackingState_& state, TreeDecompositionBag& bag,
DPConfig_& antecessor, MolecularGraphTraits::VertexType forgotten_vertex);
void extendState(BackTrackingState_& state, DPConfig_ const& antecessor, Penalty additional_penalty);
void branchState(BackTrackingState_& state, TreeDecompositionBag const& child, DPConfig_ const& antecessor);
};
class DPBackTrackingCombiner_
{
public:
DPBackTrackingCombiner_(std::vector<FPTBondOrderAssignment_*>& bond_assignments,
Size solution_number, Penalty upper_bound = infinite_penalty);
DPBackTrackingCombiner_(DPBackTrackingCombiner_ const& copy);
~DPBackTrackingCombiner_();
void clear();
DPBackTrackingCombiner_& operator = (DPBackTrackingCombiner_ const& copy);
bool hasMoreSolutions() const;
void nextSolution();
Assignment_& getSolution();
Assignment_ const& getSolution() const;
Penalty penaltyOfNextSolution() const;
std::vector<MolecularGraphTraits::EdgeType> sorted_edges;
protected:
std::vector<DPBackTracking_*> backtrackers_;
std::priority_queue<Assignment_, std::vector<Assignment_>, std::greater<Assignment_> > priority_queue_;
std::vector<std::vector<Assignment_> > component_solutions_;
Assignment_ assignment_;
Size solution_number_;
Penalty optimum_;
Penalty upper_bound_;
std::pair<Size, Penalty> getNextMinimumBackTracker_() const;
void applyAssignment_(Size backtracker_index, Size solution_index);
void initialize_();
void combineEachSolution_(Size mindex);
std::vector<DPBackTracking_*> deepCopyOfBacktrackers_() const;
};
void initPenaltyData_();
Penalty getPenaltyFor_(MolecularGraphTraits::VertexType vertex, Valence valence) const;
std::vector<int> const* penalties_;
std::vector<Position> const * block_to_start_idx_;
std::vector<Size> const * block_to_length_;
std::vector<int> const * block_to_start_valence_;
std::vector<std::vector<int> > const* atom_to_block_;
boost::shared_ptr<ComputingData_> computing_data_;
boost::shared_ptr<DPBackTrackingCombiner_> combiner_;
};
}
#endif // BALL_STRUCTURE_BONDORDERS_FPTBONDORDERSTRATEGY_H
global.h
BALL_EXPORT
#define BALL_EXPORT
Definition COMMON/global.h:50
common.h
atomContainer.h
bondOrderAssignmentStrategy.h
bondOrderAssignment.h
bond.h
BALL::AssignBondOrderProcessor
Assignment of bond orders from topology information.
Definition assignBondOrderProcessor.h:90
BALL::BondOrderAssignmentStrategy::BondOrderAssignmentStrategy
BondOrderAssignmentStrategy(AssignBondOrderProcessor *parent)
BALL::FPTBondOrderStrategy::AdditionalBagProperties_
Definition FPTBondOrderStrategy.h:435
BALL::FPTBondOrderStrategy::AdditionalBagProperties_::bonds
std::vector< MolecularGraphTraits::EdgeType > bonds
Definition FPTBondOrderStrategy.h:460
BALL::FPTBondOrderStrategy::AdditionalBagProperties_::AdditionalBagProperties_
AdditionalBagProperties_(AdditionalBagProperties_ const &copy)
BALL::FPTBondOrderStrategy::AdditionalBagProperties_::AdditionalBagProperties_
AdditionalBagProperties_()
BALL::FPTBondOrderStrategy::AdditionalBagProperties_::table
DPTable_ * table
Definition FPTBondOrderStrategy.h:465
BALL::FPTBondOrderStrategy::AdditionalBagProperties_::operator=
AdditionalBagProperties_ & operator=(AdditionalBagProperties_ const &copy)
BALL::FPTBondOrderStrategy::AdditionalBagProperties_::~AdditionalBagProperties_
~AdditionalBagProperties_()
BALL::FPTBondOrderStrategy::Assignment_
Definition FPTBondOrderStrategy.h:699
BALL::FPTBondOrderStrategy::Assignment_::isValid
bool isValid(MolecularGraph &molecule, FPTBondOrderStrategy &parent)
BALL::FPTBondOrderStrategy::Assignment_::operator=
Assignment_ & operator=(Assignment_ const &copy)
BALL::FPTBondOrderStrategy::Assignment_::Assignment_
Assignment_()
BALL::FPTBondOrderStrategy::Assignment_::Assignment_
Assignment_(Assignment_ const &copy)
BALL::FPTBondOrderStrategy::Assignment_::combine
void combine(Assignment_ const &other)
BALL::FPTBondOrderStrategy::Assignment_::bonds_
std::vector< BondOrder > bonds_
Definition FPTBondOrderStrategy.h:808
BALL::FPTBondOrderStrategy::Assignment_::getBondOrders
std::vector< BondOrder > const & getBondOrders() const
BALL::FPTBondOrderStrategy::Assignment_::compare
int compare(Assignment_ const &a) const
BALL::FPTBondOrderStrategy::Assignment_::Assignment_
Assignment_(Size num_bonds)
BALL::FPTBondOrderStrategy::Assignment_::penalty
Penalty penalty
Definition FPTBondOrderStrategy.h:802
BALL::FPTBondOrderStrategy::Assignment_::Assignment_
Assignment_(std::vector< BondOrder > const &bonds, Penalty penalty)
BALL::FPTBondOrderStrategy::BackTrackingState_
Definition FPTBondOrderStrategy.h:857
BALL::FPTBondOrderStrategy::BackTrackingState_::compare
int compare(BackTrackingState_ const &other) const
BALL::FPTBondOrderStrategy::BackTrackingState_::operator=
BackTrackingState_ & operator=(BackTrackingState_ const &other)
BALL::FPTBondOrderStrategy::BackTrackingState_::join_branches
std::stack< std::pair< DPConfig_, Size > > join_branches
Definition FPTBondOrderStrategy.h:927
BALL::FPTBondOrderStrategy::BackTrackingState_::BackTrackingState_
BackTrackingState_(BackTrackingState_ const &other)
BALL::FPTBondOrderStrategy::BackTrackingState_::BackTrackingState_
BackTrackingState_(Size bonds)
BALL::FPTBondOrderStrategy::BackTrackingState_::BackTrackingState_
BackTrackingState_()
BALL::FPTBondOrderStrategy::BackTrackingState_::config
DPConfig_ config
Definition FPTBondOrderStrategy.h:920
BALL::FPTBondOrderStrategy::BackTrackingState_::index
Size index
Definition FPTBondOrderStrategy.h:933
BALL::FPTBondOrderStrategy::BackTrackingState_::assignment
Assignment_ assignment
Definition FPTBondOrderStrategy.h:914
BALL::FPTBondOrderStrategy::ComputingData_::ComputingData_
ComputingData_()
BALL::FPTBondOrderStrategy::ComputingData_::molecule_graph
MolecularGraph * molecule_graph
Definition FPTBondOrderStrategy.h:671
BALL::FPTBondOrderStrategy::ComputingData_::bonds
vector< Bond const * > bonds
Definition FPTBondOrderStrategy.h:682
BALL::FPTBondOrderStrategy::ComputingData_::tw
boost::shared_ptr< TreeWidth< MolecularGraph > > tw
Definition FPTBondOrderStrategy.h:676
BALL::FPTBondOrderStrategy::ComputingData_::~ComputingData_
~ComputingData_()
BALL::FPTBondOrderStrategy::ComputingData_::bond_assignments
vector< FPTBondOrderAssignment_ * > bond_assignments
Definition FPTBondOrderStrategy.h:666
BALL::FPTBondOrderStrategy::DPBackTrackingCombiner_
Definition FPTBondOrderStrategy.h:1241
BALL::FPTBondOrderStrategy::DPBackTrackingCombiner_::getSolution
Assignment_ const & getSolution() const
BALL::FPTBondOrderStrategy::DPBackTrackingCombiner_::DPBackTrackingCombiner_
DPBackTrackingCombiner_(DPBackTrackingCombiner_ const &copy)
BALL::FPTBondOrderStrategy::DPBackTrackingCombiner_::assignment_
Assignment_ assignment_
Definition FPTBondOrderStrategy.h:1323
BALL::FPTBondOrderStrategy::DPBackTrackingCombiner_::initialize_
void initialize_()
BALL::FPTBondOrderStrategy::DPBackTrackingCombiner_::nextSolution
void nextSolution()
BALL::FPTBondOrderStrategy::DPBackTrackingCombiner_::~DPBackTrackingCombiner_
~DPBackTrackingCombiner_()
BALL::FPTBondOrderStrategy::DPBackTrackingCombiner_::getSolution
Assignment_ & getSolution()
BALL::FPTBondOrderStrategy::DPBackTrackingCombiner_::combineEachSolution_
void combineEachSolution_(Size mindex)
BALL::FPTBondOrderStrategy::DPBackTrackingCombiner_::component_solutions_
std::vector< std::vector< Assignment_ > > component_solutions_
Definition FPTBondOrderStrategy.h:1318
BALL::FPTBondOrderStrategy::DPBackTrackingCombiner_::optimum_
Penalty optimum_
Definition FPTBondOrderStrategy.h:1333
BALL::FPTBondOrderStrategy::DPBackTrackingCombiner_::clear
void clear()
BALL::FPTBondOrderStrategy::DPBackTrackingCombiner_::sorted_edges
std::vector< MolecularGraphTraits::EdgeType > sorted_edges
Definition FPTBondOrderStrategy.h:1299
BALL::FPTBondOrderStrategy::DPBackTrackingCombiner_::priority_queue_
std::priority_queue< Assignment_, std::vector< Assignment_ >, std::greater< Assignment_ > > priority_queue_
Definition FPTBondOrderStrategy.h:1312
BALL::FPTBondOrderStrategy::DPBackTrackingCombiner_::DPBackTrackingCombiner_
DPBackTrackingCombiner_(std::vector< FPTBondOrderAssignment_ * > &bond_assignments, Size solution_number, Penalty upper_bound=infinite_penalty)
BALL::FPTBondOrderStrategy::DPBackTrackingCombiner_::penaltyOfNextSolution
Penalty penaltyOfNextSolution() const
BALL::FPTBondOrderStrategy::DPBackTrackingCombiner_::getNextMinimumBackTracker_
std::pair< Size, Penalty > getNextMinimumBackTracker_() const
BALL::FPTBondOrderStrategy::DPBackTrackingCombiner_::deepCopyOfBacktrackers_
std::vector< DPBackTracking_ * > deepCopyOfBacktrackers_() const
BALL::FPTBondOrderStrategy::DPBackTrackingCombiner_::backtrackers_
std::vector< DPBackTracking_ * > backtrackers_
Definition FPTBondOrderStrategy.h:1305
BALL::FPTBondOrderStrategy::DPBackTrackingCombiner_::hasMoreSolutions
bool hasMoreSolutions() const
BALL::FPTBondOrderStrategy::DPBackTrackingCombiner_::applyAssignment_
void applyAssignment_(Size backtracker_index, Size solution_index)
BALL::FPTBondOrderStrategy::DPBackTrackingCombiner_::solution_number_
Size solution_number_
Definition FPTBondOrderStrategy.h:1328
BALL::FPTBondOrderStrategy::DPBackTrackingCombiner_::upper_bound_
Penalty upper_bound_
Definition FPTBondOrderStrategy.h:1338
BALL::FPTBondOrderStrategy::DPBackTracking_
Definition FPTBondOrderStrategy.h:980
BALL::FPTBondOrderStrategy::DPBackTracking_::bonds_
std::vector< MolecularGraphTraits::EdgeType > const * bonds_
Definition FPTBondOrderStrategy.h:1102
BALL::FPTBondOrderStrategy::DPBackTracking_::~DPBackTracking_
~DPBackTracking_()
BALL::FPTBondOrderStrategy::DPBackTracking_::DPBackTracking_
DPBackTracking_(DPBackTracking_ const &copy)
BALL::FPTBondOrderStrategy::DPBackTracking_::num_computed_solutions_
Size num_computed_solutions_
Definition FPTBondOrderStrategy.h:1118
BALL::FPTBondOrderStrategy::DPBackTracking_::bondIndexFor
Size bondIndexFor(MolecularGraphTraits::EdgeType bond) const
BALL::FPTBondOrderStrategy::DPBackTracking_::extendState
void extendState(BackTrackingState_ &state, DPConfig_ const &antecessor, Penalty additional_penalty)
BALL::FPTBondOrderStrategy::DPBackTracking_::preorder
void preorder(TreeDecompositionBag node, TreeDecomposition &)
Definition FPTBondOrderStrategy.h:1049
BALL::FPTBondOrderStrategy::DPBackTracking_::bags_
boost::shared_ptr< std::vector< TreeDecompositionBag > > bags_
Definition FPTBondOrderStrategy.h:1107
BALL::FPTBondOrderStrategy::DPBackTracking_::TreeDecompositionContent
TreeWidth< MolecularGraph >::TreeDecompositionContent TreeDecompositionContent
Definition FPTBondOrderStrategy.h:984
BALL::FPTBondOrderStrategy::DPBackTracking_::hasMoreSolutions
bool hasMoreSolutions() const
BALL::FPTBondOrderStrategy::DPBackTracking_::TreeDecompositionBag
TreeWidth< MolecularGraph >::TreeDecompositionBag TreeDecompositionBag
Definition FPTBondOrderStrategy.h:983
BALL::FPTBondOrderStrategy::DPBackTracking_::current_state_
BackTrackingState_ * current_state_
Definition FPTBondOrderStrategy.h:1085
BALL::FPTBondOrderStrategy::DPBackTracking_::max_heap_size_
Size max_heap_size_
Definition FPTBondOrderStrategy.h:1113
BALL::FPTBondOrderStrategy::DPBackTracking_::queue_
std::multiset< BackTrackingState_ *, StateComparator_ > queue_
Definition FPTBondOrderStrategy.h:1091
BALL::FPTBondOrderStrategy::DPBackTracking_::remember
void remember(BackTrackingState_ &state)
BALL::FPTBondOrderStrategy::DPBackTracking_::getSolution
Assignment_ const & getSolution() const
BALL::FPTBondOrderStrategy::DPBackTracking_::visitForget
void visitForget(BackTrackingState_ &state, TreeDecompositionBag &bag, DPTable_ &table)
BALL::FPTBondOrderStrategy::DPBackTracking_::nextSolution
void nextSolution()
BALL::FPTBondOrderStrategy::DPBackTracking_::upper_bound_
Penalty upper_bound_
Definition FPTBondOrderStrategy.h:1123
BALL::FPTBondOrderStrategy::DPBackTracking_::visitIntroduce
void visitIntroduce(BackTrackingState_ &state, TreeDecompositionBag &bag, DPTable_ &table)
BALL::FPTBondOrderStrategy::DPBackTracking_::BagVector
vector< TreeDecompositionBag > BagVector
Definition FPTBondOrderStrategy.h:1125
BALL::FPTBondOrderStrategy::DPBackTracking_::clear
void clear()
BALL::FPTBondOrderStrategy::DPBackTracking_::inorder
void inorder(TreeDecompositionBag, TreeDecomposition &)
Definition FPTBondOrderStrategy.h:1054
BALL::FPTBondOrderStrategy::DPBackTracking_::max_num_solutions_
Size max_num_solutions_
Definition FPTBondOrderStrategy.h:1096
BALL::FPTBondOrderStrategy::DPBackTracking_::visitJoin
void visitJoin(BackTrackingState_ &state, TreeDecompositionBag &bag, DPTable_ &leftTable, DPTable_ &rightTable)
BALL::FPTBondOrderStrategy::DPBackTracking_::setStateAssignment
void setStateAssignment(BackTrackingState_ &state, TreeDecompositionBag &bag, DPConfig_ &antecessor, MolecularGraphTraits::VertexType forgotten_vertex)
BALL::FPTBondOrderStrategy::DPBackTracking_::getProperties
AdditionalBagProperties_ & getProperties(Size order)
BALL::FPTBondOrderStrategy::DPBackTracking_::DPBackTracking_
DPBackTracking_(FPTBondOrderAssignment_ &bond_assignment, Size max_number_of_solutions, std::vector< MolecularGraphTraits::EdgeType > const &bonds, Penalty upperbound=infinite_penalty)
BALL::FPTBondOrderStrategy::DPBackTracking_::isSolutionNeeded
bool isSolutionNeeded(Penalty penalty)
BALL::FPTBondOrderStrategy::DPBackTracking_::TreeDecomposition
TreeWidth< MolecularGraph >::TreeDecomposition TreeDecomposition
Definition FPTBondOrderStrategy.h:982
BALL::FPTBondOrderStrategy::DPBackTracking_::getSolution
Assignment_ & getSolution()
BALL::FPTBondOrderStrategy::DPBackTracking_::bond_assignment_
FPTBondOrderAssignment_ * bond_assignment_
Definition FPTBondOrderStrategy.h:1080
BALL::FPTBondOrderStrategy::DPBackTracking_::getTable
DPTable_ & getTable(Size order)
BALL::FPTBondOrderStrategy::DPBackTracking_::branchState
void branchState(BackTrackingState_ &state, TreeDecompositionBag const &child, DPConfig_ const &antecessor)
BALL::FPTBondOrderStrategy::DPBackTracking_::penaltyOfNextSolution
Penalty penaltyOfNextSolution() const
BALL::FPTBondOrderStrategy::DPBackTracking_::postorder
void postorder(TreeDecompositionBag, TreeDecomposition &)
Definition FPTBondOrderStrategy.h:1058
BALL::FPTBondOrderStrategy::DPBackTracking_::visitLeaf
void visitLeaf(BackTrackingState_ &state)
BALL::FPTBondOrderStrategy::DPConfig_
Definition FPTBondOrderStrategy.h:221
BALL::FPTBondOrderStrategy::DPConfig_::numberOfAtoms
Size numberOfAtoms() const
BALL::FPTBondOrderStrategy::DPConfig_::operator=
DPConfig_ & operator=(DPConfig_ const &copy)
BALL::FPTBondOrderStrategy::DPConfig_::DPConfig_
DPConfig_(Size atoms, Size bonds)
BALL::FPTBondOrderStrategy::DPConfig_::bond_assignments
std::vector< BondOrder > bond_assignments
Definition FPTBondOrderStrategy.h:314
BALL::FPTBondOrderStrategy::DPConfig_::numberOfBonds
Size numberOfBonds() const
BALL::FPTBondOrderStrategy::DPConfig_::DPConfig_
DPConfig_(ValenceIterator vit, ValenceIterator vend, BondIterator boit, BondIterator boend)
Definition FPTBondOrderStrategy.h:248
BALL::FPTBondOrderStrategy::DPConfig_::compare
int compare(DPConfig_ const &other) const
BALL::FPTBondOrderStrategy::DPConfig_::DPConfig_
DPConfig_(std::vector< Valence > const &v, std::vector< BondOrder > const &bo)
BALL::FPTBondOrderStrategy::DPConfig_::DPConfig_
DPConfig_()
BALL::FPTBondOrderStrategy::DPConfig_::consumed_valences
std::vector< Valence > consumed_valences
Definition FPTBondOrderStrategy.h:305
BALL::FPTBondOrderStrategy::DPTable_
Definition FPTBondOrderStrategy.h:351
BALL::FPTBondOrderStrategy::DPTable_::insert
bool insert(DPConfig_ const &config, Penalty penalty)
BALL::FPTBondOrderStrategy::DPTable_::size
Size size() const
BALL::FPTBondOrderStrategy::DPTable_::bestEntry
DPConstRow_ bestEntry() const
BALL::FPTBondOrderStrategy::DPTable_::DPTable_
DPTable_(DPTable_ const &table)
BALL::FPTBondOrderStrategy::DPTable_::iterator
DPMap_::iterator iterator
Definition FPTBondOrderStrategy.h:373
BALL::FPTBondOrderStrategy::DPTable_::end
iterator end()
BALL::FPTBondOrderStrategy::DPTable_::bestPenalty
Penalty bestPenalty() const
BALL::FPTBondOrderStrategy::DPTable_::DPTable_
DPTable_()
BALL::FPTBondOrderStrategy::DPTable_::end
const_iterator end() const
BALL::FPTBondOrderStrategy::DPTable_::begin
const_iterator begin() const
BALL::FPTBondOrderStrategy::DPTable_::table
DPMap_ table
Definition FPTBondOrderStrategy.h:357
BALL::FPTBondOrderStrategy::DPTable_::const_iterator
DPMap_::const_iterator const_iterator
Definition FPTBondOrderStrategy.h:378
BALL::FPTBondOrderStrategy::DPTable_::begin
iterator begin()
BALL::FPTBondOrderStrategy::DPTable_::operator[]
Penalty operator[](DPConfig_ const &config) const
BALL::FPTBondOrderStrategy::EdgeComparator_::EdgeComparator_
EdgeComparator_(MolecularGraph *graph)
Definition FPTBondOrderStrategy.h:840
BALL::FPTBondOrderStrategy::EdgeComparator_::graph_
MolecularGraph * graph_
Definition FPTBondOrderStrategy.h:847
BALL::FPTBondOrderStrategy::EdgeComparator_::Edge
GRAPH::GraphTraits< MolecularGraph >::EdgeType Edge
Definition FPTBondOrderStrategy.h:838
BALL::FPTBondOrderStrategy::FPTBondOrderAssignment_
Definition FPTBondOrderStrategy.h:479
BALL::FPTBondOrderStrategy::FPTBondOrderAssignment_::getBondsInBag
std::vector< MolecularGraphTraits::EdgeType > getBondsInBag(TreeDecompositionBag &bag)
BALL::FPTBondOrderStrategy::FPTBondOrderAssignment_::compute
Penalty compute()
BALL::FPTBondOrderStrategy::FPTBondOrderAssignment_::molecule_
MolecularGraph * molecule_
Definition FPTBondOrderStrategy.h:518
BALL::FPTBondOrderStrategy::FPTBondOrderAssignment_::upper_bound_
Penalty upper_bound_
Definition FPTBondOrderStrategy.h:538
BALL::FPTBondOrderStrategy::FPTBondOrderAssignment_::~FPTBondOrderAssignment_
~FPTBondOrderAssignment_()
BALL::FPTBondOrderStrategy::FPTBondOrderAssignment_::max_valence_
Valence max_valence_
Definition FPTBondOrderStrategy.h:548
BALL::FPTBondOrderStrategy::FPTBondOrderAssignment_::computeJoinBag
void computeJoinBag(TreeDecompositionBag &bag, DPTable_ &leftChild, DPTable_ &rightChild, AdditionalBagProperties_ &bag_properties)
BALL::FPTBondOrderStrategy::FPTBondOrderAssignment_::ntd_
boost::shared_ptr< TreeDecomposition > ntd_
Definition FPTBondOrderStrategy.h:523
BALL::FPTBondOrderStrategy::FPTBondOrderAssignment_::computeIntroduceBag
void computeIntroduceBag(TreeDecompositionBag &bag, DPTable_ &child, AdditionalBagProperties_ &bag_properties)
BALL::FPTBondOrderStrategy::FPTBondOrderAssignment_::max_bond_order_
BondOrder max_bond_order_
Definition FPTBondOrderStrategy.h:543
BALL::FPTBondOrderStrategy::FPTBondOrderAssignment_::parent_
FPTBondOrderStrategy * parent_
Definition FPTBondOrderStrategy.h:513
BALL::FPTBondOrderStrategy::FPTBondOrderAssignment_::FPTBondOrderAssignment_
FPTBondOrderAssignment_(FPTBondOrderStrategy &parent, boost::shared_ptr< TreeDecomposition > &ntd, Penalty upper_bound=infinite_penalty)
BALL::FPTBondOrderStrategy::FPTBondOrderAssignment_::computeRootBag
void computeRootBag(TreeDecompositionBag &bag, DPTable_ &child, AdditionalBagProperties_ &bag_properties)
BALL::FPTBondOrderStrategy::FPTBondOrderAssignment_::forgetInnerVertexIn
Penalty forgetInnerVertexIn(TreeDecompositionBag &bag, DPConstRow_ child_row, DPConfig_ &entry, std::vector< MolecularGraphTraits::EdgeType > &child_bonds, Size forgotten_index)
BALL::FPTBondOrderStrategy::FPTBondOrderAssignment_::computeForgetBag
void computeForgetBag(TreeDecompositionBag &bag, DPTable_ &child, AdditionalBagProperties_ &property)
BALL::FPTBondOrderStrategy::FPTBondOrderAssignment_::DPBackTracking_
friend class DPBackTracking_
Definition FPTBondOrderStrategy.h:481
BALL::FPTBondOrderStrategy::FPTBondOrderAssignment_::DPBackTrackingCombiner_
friend class DPBackTrackingCombiner_
Definition FPTBondOrderStrategy.h:482
BALL::FPTBondOrderStrategy::FPTBondOrderAssignment_::properties_
vector< AdditionalBagProperties_ > properties_
Definition FPTBondOrderStrategy.h:529
BALL::FPTBondOrderStrategy::FPTBondOrderAssignment_::computeLeafIntroduceBag
void computeLeafIntroduceBag(AdditionalBagProperties_ &bag_properties)
BALL::FPTBondOrderStrategy::VertexType
GRAPH::GraphTraits< MolecularGraph >::VertexType VertexType
Definition FPTBondOrderStrategy.h:126
BALL::FPTBondOrderStrategy::infinite_penalty
static const Penalty infinite_penalty
Definition FPTBondOrderStrategy.h:152
BALL::FPTBondOrderStrategy::init
virtual void init()
BALL::FPTBondOrderStrategy::setDefaultOptions
virtual void setDefaultOptions()
BALL::FPTBondOrderStrategy::compareTablePointerEntries_
static bool compareTablePointerEntries_(DPPointerRow_ const &left, DPPointerRow_ const &right)
BALL::FPTBondOrderStrategy::DPJoinMap_
std::multimap< DPConfig_ const *, Penalty, DPJoinMapComparator_ > DPJoinMap_
Definition FPTBondOrderStrategy.h:958
BALL::FPTBondOrderStrategy::atom_to_block_
std::vector< std::vector< int > > const * atom_to_block_
Definition FPTBondOrderStrategy.h:1401
BALL::FPTBondOrderStrategy::Valence
int Valence
Definition FPTBondOrderStrategy.h:142
BALL::FPTBondOrderStrategy::initPenaltyData_
void initPenaltyData_()
Initialize pointers to penalty data.
BALL::FPTBondOrderStrategy::TreeDecomposition
TreeWidth< MolecularGraph >::TreeDecomposition TreeDecomposition
Definition FPTBondOrderStrategy.h:128
BALL::FPTBondOrderStrategy::DPPairIt_
std::pair< DPTable_::const_iterator, DPTable_::const_iterator > DPPairIt_
Definition FPTBondOrderStrategy.h:942
BALL::FPTBondOrderStrategy::Edge
GRAPH::GraphTraits< MolecularGraph >::EdgeType Edge
Definition FPTBondOrderStrategy.h:125
BALL::FPTBondOrderStrategy::penalties_
std::vector< int > const * penalties_
Definition FPTBondOrderStrategy.h:1381
BALL::FPTBondOrderStrategy::DPMap_
std::map< DPConfig_, Penalty > DPMap_
Definition FPTBondOrderStrategy.h:341
BALL::FPTBondOrderStrategy::block_to_start_valence_
std::vector< int > const * block_to_start_valence_
Definition FPTBondOrderStrategy.h:1396
BALL::FPTBondOrderStrategy::combiner_
boost::shared_ptr< DPBackTrackingCombiner_ > combiner_
Definition FPTBondOrderStrategy.h:1412
BALL::FPTBondOrderStrategy::Penalty
float Penalty
Definition FPTBondOrderStrategy.h:136
BALL::FPTBondOrderStrategy::TreeDecompositionBag
TreeWidth< MolecularGraph >::TreeDecompositionBag TreeDecompositionBag
Definition FPTBondOrderStrategy.h:129
BALL::FPTBondOrderStrategy::DPPointerRow_
std::pair< DPConfig_ *, Penalty > DPPointerRow_
Definition FPTBondOrderStrategy.h:335
BALL::FPTBondOrderStrategy::computing_data_
boost::shared_ptr< ComputingData_ > computing_data_
Definition FPTBondOrderStrategy.h:1407
BALL::FPTBondOrderStrategy::DPRow_
std::pair< boost::reference_wrapper< DPConfig_ >, Penalty > DPRow_
Definition FPTBondOrderStrategy.h:322
BALL::FPTBondOrderStrategy::FPTBondOrderStrategy
FPTBondOrderStrategy(AssignBondOrderProcessor *parent)
BALL::FPTBondOrderStrategy::BondOrder
int BondOrder
Definition FPTBondOrderStrategy.h:148
BALL::FPTBondOrderStrategy::clear
virtual void clear()
BALL::FPTBondOrderStrategy::readOptions
virtual bool readOptions(const Options &options)
BALL::FPTBondOrderStrategy::max_valence
static const Valence max_valence
Definition FPTBondOrderStrategy.h:153
BALL::FPTBondOrderStrategy::~FPTBondOrderStrategy
virtual ~FPTBondOrderStrategy()
BALL::FPTBondOrderStrategy::getPenaltyFor_
Penalty getPenaltyFor_(MolecularGraphTraits::VertexType vertex, Valence valence) const
Return penalty value for given vertex and valence.
BALL::FPTBondOrderStrategy::computeNextSolution
virtual boost::shared_ptr< BondOrderAssignment > computeNextSolution()
BALL::FPTBondOrderStrategy::DPConstRow_
std::pair< boost::reference_wrapper< DPConfig_ const >, Penalty > DPConstRow_
Definition FPTBondOrderStrategy.h:328
BALL::FPTBondOrderStrategy::compareJoinTablePairs_
static bool compareJoinTablePairs_(DPPairIt_ const &left, DPPairIt_ const &right)
BALL::FPTBondOrderStrategy::block_to_start_idx_
std::vector< Position > const * block_to_start_idx_
Definition FPTBondOrderStrategy.h:1386
BALL::FPTBondOrderStrategy::block_to_length_
std::vector< Size > const * block_to_length_
Definition FPTBondOrderStrategy.h:1391
BALL::GRAPH::GraphTraits::VertexType
boost::graph_traits< Graph >::vertex_descriptor VertexType
Definition graphAlgorithms.h:77
BALL::GRAPH::GraphTraits::EdgeType
boost::graph_traits< Graph >::edge_descriptor EdgeType
Definition graphAlgorithms.h:80
BALL::GRAPH::PostOrderFolding
Definition graphAlgorithms.h:326
BALL::MolecularGraph
Definition molecularGraph.h:48
BALL::Options
Definition options.h:48
BALL::String
Definition string.h:57
BALL::TreeWidth::TreeDecompositionContent
std::set< OriginalVertexType > TreeDecompositionContent
Definition treeWidth.h:99
BALL::TreeWidth::TreeDecompositionBag
boost::graph_traits< TreeDecompositionGraph >::vertex_descriptor TreeDecompositionBag
Definition treeWidth.h:107
BALL::TreeWidth::TreeDecomposition
boost::graph_as_tree< TreeDecompositionGraph, TreeDecompositionParentMap > TreeDecomposition
Definition treeWidth.h:112
graphAlgorithms.h
BALL::atoms
BALL_EXPORT AtomList atoms(const AtomContainer &fragment, const String &expression=String())
hashMap.h
molecularGraph.h
BALL
Definition constants.h:13
BALL::Size
BALL_SIZE_TYPE Size
Definition COMMON/global.h:114
BALL::bonds
BALL_EXPORT BondList bonds(const AtomContainer &fragment, bool selected_only=false)
BALL::FPTBondOrderStrategy::DPBackTracking_::StateComparator_
Definition FPTBondOrderStrategy.h:1068
BALL::FPTBondOrderStrategy::DPJoinMapComparator_
Definition FPTBondOrderStrategy.h:818
BALL::FPTBondOrderStrategy::DPJoinMapComparator_::compare
int compare(DPConfig_ const *leftp, DPConfig_ const *rightp) const
BALL::FPTBondOrderStrategy::Default
Default option values.
Definition FPTBondOrderStrategy.h:168
BALL::FPTBondOrderStrategy::Default::UPPER_PENALTY_BOUND
static Penalty UPPER_PENALTY_BOUND
Definition FPTBondOrderStrategy.h:173
BALL::FPTBondOrderStrategy::Option
Option names.
Definition FPTBondOrderStrategy.h:158
BALL::FPTBondOrderStrategy::Option::UPPER_PENALTY_BOUND
static String UPPER_PENALTY_BOUND
Definition FPTBondOrderStrategy.h:163
treeWidth.h