Loading...
Searching...
No Matches
BALL::FPTBondOrderStrategy::DPBackTrackingCombiner_ Class Reference

`#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 &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, 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_

## 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 1240 of file FPTBondOrderStrategy.h.

## Constructor & Destructor Documentation

## DPBackTrackingCombiner_() [1/2]

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

  bondAssignments | vector with pointers to the bond assignments. Call #compute before constructing
  solutionNumber | the maximum number of solutions you want to backtrack

## DPBackTrackingCombiner_() [2/2]

BALL::FPTBondOrderStrategy::DPBackTrackingCombiner_::DPBackTrackingCombiner_ | ( | DPBackTrackingCombiner_ const & | copy | ) |

Copy constructor

## ~DPBackTrackingCombiner_()

BALL::FPTBondOrderStrategy::DPBackTrackingCombiner_::~DPBackTrackingCombiner_ | ( |  | ) |

Destructor. Deletes all backtrackers but not the bond assignment algorithms

## Member Function Documentation

## applyAssignment_()

void BALL::FPTBondOrderStrategy::DPBackTrackingCombiner_::applyAssignment_ | ( | Size | backtracker_index,
|  | Size | solution_index )

protected

Combines the component assignment with the whole graph assignment

Parameters

  backtracker_index | index of the backtracker
  solutionIndex | the number of the assignment of this backtracker, which will be combined

## clear()

void BALL::FPTBondOrderStrategy::DPBackTrackingCombiner_::clear | ( |  | ) |

## combineEachSolution_()

void BALL::FPTBondOrderStrategy::DPBackTrackingCombiner_::combineEachSolution_ | ( | Size | mindex | ) |

protected

Combines the given new assignment with each previous found assignments

Parameters

  mindex | index of the backtracker which found the next best assignment

## deepCopyOfBacktrackers_()

std::vector< DPBackTracking_ * > BALL::FPTBondOrderStrategy::DPBackTrackingCombiner_::deepCopyOfBacktrackers_ | ( |  | ) | const

protected

copy each DPBackTracking

## getNextMinimumBackTracker_()

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.

## getSolution() [1/2]

Assignment_ & BALL::FPTBondOrderStrategy::DPBackTrackingCombiner_::getSolution | ( |  | ) |

returns the last computed solution

## getSolution() [2/2]

Assignment_ const & BALL::FPTBondOrderStrategy::DPBackTrackingCombiner_::getSolution | ( |  | ) | const

returns the last computed solution, const version

## hasMoreSolutions()

bool BALL::FPTBondOrderStrategy::DPBackTrackingCombiner_::hasMoreSolutions | ( |  | ) | const

return true if there are more solutions to backtrack

## initialize_()

void BALL::FPTBondOrderStrategy::DPBackTrackingCombiner_::initialize_ | ( |  | ) |

protected

Lets each backtracker backtrack a solution and initialize the combiner.

## nextSolution()

void BALL::FPTBondOrderStrategy::DPBackTrackingCombiner_::nextSolution | ( |  | ) |

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

Exceptions

  BALL::Exception::OutOfRange | if there is no more solution to backtrack

## operator=()

DPBackTrackingCombiner_ & BALL::FPTBondOrderStrategy::DPBackTrackingCombiner_::operator= | ( | DPBackTrackingCombiner_ const & | copy | ) |

Assignment operator

## penaltyOfNextSolution()

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.

## Member Data Documentation

## assignment_

Assignment_ BALL::FPTBondOrderStrategy::DPBackTrackingCombiner_::assignment_

protected

the last backtracked and combined solution

Definition at line 1323 of file FPTBondOrderStrategy.h.

## backtrackers_

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 1305 of file FPTBondOrderStrategy.h.

## component_solutions_

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 1318 of file FPTBondOrderStrategy.h.

## optimum_

Penalty BALL::FPTBondOrderStrategy::DPBackTrackingCombiner_::optimum_

protected

The penalty of the best solution

Definition at line 1333 of file FPTBondOrderStrategy.h.

## priority_queue_

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 1312 of file FPTBondOrderStrategy.h.

## solution_number_

Size BALL::FPTBondOrderStrategy::DPBackTrackingCombiner_::solution_number_

protected

maximum number of solutions you want to backtrack

Definition at line 1328 of file FPTBondOrderStrategy.h.

## sorted_edges

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.

## upper_bound_

Penalty BALL::FPTBondOrderStrategy::DPBackTrackingCombiner_::upper_bound_

protected

This backtracker returns only solutions which have a better penalty than the given upperbound

Definition at line 1338 of file FPTBondOrderStrategy.h.