BALL
1.4.1
|
#include <BALL/STRUCTURE/BONDORDERS/FPTBondOrderStrategy.h>
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 1239 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_ | ( | 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 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
Destructor. Deletes all backtrackers but not the bond assignment algorithms
void BALL::FPTBondOrderStrategy::DPBackTrackingCombiner_::applyAssignment_ | ( | Size | backtracker_index, |
Size | solution_index | ||
) | [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_::combineEachSolution_ | ( | Size | mindex | ) | [protected] |
Combines the given new assignment with each previous found assignments
mindex | index of the backtracker which found the next best assignment |
std::vector<DPBackTracking_*> BALL::FPTBondOrderStrategy::DPBackTrackingCombiner_::deepCopyOfBacktrackers_ | ( | ) | const [protected] |
copy each DPBackTracking
std::pair<Size, Penalty> BALL::FPTBondOrderStrategy::DPBackTrackingCombiner_::getNextMinimumBackTracker_ | ( | ) | const [protected] |
Searches for the backtracker which would compute the best next solution (after combining). Returns it index and the penalty of it's solution.
returns the last computed solution
returns the last computed solution, const version
return true if there are more solutions to backtrack
void BALL::FPTBondOrderStrategy::DPBackTrackingCombiner_::initialize_ | ( | ) | [protected] |
Lets each backtracker backtrack a solution and initialize the combiner.
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
returns the penalty of the solution which can be backtracked next or INFINITE_PENALTY, if there is no more solution.
the last backtracked and combined solution
Definition at line 1330 of file FPTBondOrderStrategy.h.
std::vector<DPBackTracking_*> BALL::FPTBondOrderStrategy::DPBackTrackingCombiner_::backtrackers_ [protected] |
The backtrackers. They are managed by this class, so you don't have to care about deleting them.
Definition at line 1312 of file FPTBondOrderStrategy.h.
std::vector<std::vector<Assignment_> > BALL::FPTBondOrderStrategy::DPBackTrackingCombiner_::component_solutions_ [protected] |
The backtracked solutions of the connection components. They can be combined to build the solution of the whole graph.
Definition at line 1325 of file FPTBondOrderStrategy.h.
The penalty of the best solution
Definition at line 1340 of file FPTBondOrderStrategy.h.
std::priority_queue<Assignment_, std::vector<Assignment_>, std::greater<Assignment_> > BALL::FPTBondOrderStrategy::DPBackTrackingCombiner_::priority_queue_ [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 1319 of file FPTBondOrderStrategy.h.
maximum number of solutions you want to backtrack
Definition at line 1335 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 1306 of file FPTBondOrderStrategy.h.
This backtracker returns only solutions which have a better penalty than the given upperbound
Definition at line 1345 of file FPTBondOrderStrategy.h.