BALL
1.4.79
|
#include <BALL/STRUCTURE/BONDORDERS/FPTBondOrderStrategy.h>
Public Member Functions | |
DPBackTrackingCombiner_ (std::vector< FPTBondOrderAssignment_ * > &bond_assignments, Size solution_number, Penalty upper_bound=infinite_penalty) | |
DPBackTrackingCombiner_ (DPBackTrackingCombiner_ const ©) | |
~DPBackTrackingCombiner_ () | |
void | clear () |
DPBackTrackingCombiner_ & | operator= (DPBackTrackingCombiner_ const ©) |
bool | hasMoreSolutions () const |
void | nextSolution () |
Assignment_ & | getSolution () |
Assignment_ const & | getSolution () const |
Penalty | penaltyOfNextSolution () const |
Public Attributes | |
std::vector < MolecularGraphTraits::EdgeType > | sorted_edges |
Protected Member Functions | |
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 |
Protected Attributes | |
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_ |
Combines backtracked solutions from other DPBackTrackers. Is used to combine the solutions of computed connection components of a graph to a solution for the whole graph. Because the bond orders of the connection components are disjoint, the solutions of the backtrackers can be combined independently. This class provides the same public functions as DPBackTracking. Remarks that this class will start the backtracking of the best solution after constructing, while DPBackTracking will start only after calling DPBackTracking::nextSolution. Nevertheless you have to call nextSolution before you can access the optimal solution.
Definition at line 1240 of file FPTBondOrderStrategy.h.
BALL::FPTBondOrderStrategy::DPBackTrackingCombiner_::DPBackTrackingCombiner_ | ( | std::vector< FPTBondOrderAssignment_ * > & | bond_assignments, |
Size | solution_number, | ||
Penalty | upper_bound = infinite_penalty |
||
) |
Construct a DPBackTrackingCombiner with the given FPTBondOrder and the number of solutions
bondAssignments | vector with pointers to the bond assignments. Call #compute before constructing |
solutionNumber | the maximum number of solutions you want to backtrack |
BALL::FPTBondOrderStrategy::DPBackTrackingCombiner_::DPBackTrackingCombiner_ | ( | DPBackTrackingCombiner_ const & | copy | ) |
Copy constructor
BALL::FPTBondOrderStrategy::DPBackTrackingCombiner_::~DPBackTrackingCombiner_ | ( | ) |
Destructor. Deletes all backtrackers but not the bond assignment algorithms
|
protected |
Combines the component assignment with the whole graph assignment
backtracker_index | index of the backtracker |
solutionIndex | the number of the assignment of this backtracker, which will be combined |
void BALL::FPTBondOrderStrategy::DPBackTrackingCombiner_::clear | ( | ) |
|
protected |
Combines the given new assignment with each previous found assignments
mindex | index of the backtracker which found the next best assignment |
|
protected |
copy each DPBackTracking
|
protected |
Searches for the backtracker which would compute the best next solution (after combining). Returns it index and the penalty of it's solution.
Assignment_& BALL::FPTBondOrderStrategy::DPBackTrackingCombiner_::getSolution | ( | ) |
returns the last computed solution
Assignment_ const& BALL::FPTBondOrderStrategy::DPBackTrackingCombiner_::getSolution | ( | ) | const |
returns the last computed solution, const version
bool BALL::FPTBondOrderStrategy::DPBackTrackingCombiner_::hasMoreSolutions | ( | ) | const |
return true if there are more solutions to backtrack
|
protected |
Lets each backtracker backtrack a solution and initialize the combiner.
void BALL::FPTBondOrderStrategy::DPBackTrackingCombiner_::nextSolution | ( | ) |
computes the next solution. Call hasMoreSolutions before to avoid an OutOfRange exception.
BALL::Exception::OutOfRange | if there is no more solution to backtrack |
DPBackTrackingCombiner_& BALL::FPTBondOrderStrategy::DPBackTrackingCombiner_::operator= | ( | DPBackTrackingCombiner_ const & | copy | ) |
Assignment operator
Penalty BALL::FPTBondOrderStrategy::DPBackTrackingCombiner_::penaltyOfNextSolution | ( | ) | const |
returns the penalty of the solution which can be backtracked next or INFINITE_PENALTY, if there is no more solution.
|
protected |
the last backtracked and combined solution
Definition at line 1323 of file FPTBondOrderStrategy.h.
|
protected |
The backtrackers. They are managed by this class, so you don't have to care about deleting them.
Definition at line 1305 of file FPTBondOrderStrategy.h.
|
protected |
The backtracked solutions of the connection components. They can be combined to build the solution of the whole graph.
Definition at line 1318 of file FPTBondOrderStrategy.h.
|
protected |
The penalty of the best solution
Definition at line 1333 of file FPTBondOrderStrategy.h.
|
protected |
The priority queue for the assignments. Because each new backtracked assignment of a connection component can be combined with each other found assignment of the other connection components, you get many new solutions in each backtracking step. They are combined inserted into this queue.
Definition at line 1312 of file FPTBondOrderStrategy.h.
|
protected |
maximum number of solutions you want to backtrack
Definition at line 1328 of file FPTBondOrderStrategy.h.
std::vector<MolecularGraphTraits::EdgeType> BALL::FPTBondOrderStrategy::DPBackTrackingCombiner_::sorted_edges |
A sorted vector of the edges of the graph. The bond values in the assignments are in the same order as the edges in this vector.
Definition at line 1299 of file FPTBondOrderStrategy.h.
|
protected |
This backtracker returns only solutions which have a better penalty than the given upperbound
Definition at line 1338 of file FPTBondOrderStrategy.h.