BALL  1.4.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines
Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes
BALL::FPTBondOrderStrategy::DPBackTrackingCombiner_ Class Reference

#include <BALL/STRUCTURE/BONDORDERS/FPTBondOrderStrategy.h>

List of all members.

Public Member Functions

 DPBackTrackingCombiner_ (std::vector< FPTBondOrderAssignment_ * > &bond_assignments, Size solution_number, Penalty upper_bound=infinite_penalty)
 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

Public Attributes

std::vector
< MolecularGraphTraits::EdgeType
sorted_edges

Protected Member Functions

std::pair< Size, PenaltygetNextMinimumBackTracker_ () 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_

Detailed Description

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.


Constructor & Destructor Documentation

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

Parameters:
bondAssignmentsvector with pointers to the bond assignments. Call #compute before constructing
solutionNumberthe 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

Parameters:
bondAssignmentsvector with the bond assignments. Call #compute before constructing
solutionNumberthe maximum number of solutions you want to backtrack

Copy constructor

Destructor. Deletes all backtrackers but not the bond assignment algorithms


Member Function Documentation

void BALL::FPTBondOrderStrategy::DPBackTrackingCombiner_::applyAssignment_ ( Size  backtracker_index,
Size  solution_index 
) [protected]

Combines the component assignment with the whole graph assignment

Parameters:
backtracker_indexindex of the backtracker
solutionIndexthe number of the assignment of this backtracker, which will be combined

Combines the given new assignment with each previous found assignments

Parameters:
mindexindex of the backtracker which found the next best assignment

copy each DPBackTracking

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

Lets each backtracker backtrack a solution and initialize the combiner.

computes the next solution. Call hasMoreSolutions before to avoid an OutOfRange exception.

Exceptions:
BALL::Exception::OutOfRangeif 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.


Member Data Documentation

the last backtracked and combined solution

Definition at line 1330 of file FPTBondOrderStrategy.h.

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.

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.

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.

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines