libatomprobe
Library for Atom Probe Tomography (APT) computation
|
Class that brute-force solves the knapsack problem. More...
#include <massTool.h>
Static Public Member Functions | |
static void | bruteKnapsack (std::vector< Weight > &weights, float targetWeight, float tolerance, unsigned int maxObjects, std::vector< std::vector< Weight > > &solutions) |
Depth-First-Search based brute force solve the knapsack problem,. More... | |
static void | bruteKnapsack (std::vector< Weight > &weights, const std::vector< float > &targetWeight, float tolerance, unsigned int maxObjects, std::vector< std::vector< Weight > > &solutions) |
Multiple-target version of brute knapsack. More... | |
Class that brute-force solves the knapsack problem.
Definition at line 43 of file massTool.h.
|
static |
Depth-First-Search based brute force solve the knapsack problem,.
Record all solutions within "tolerance" of the value "targetWeight". Solutions are reported as std::vectors of weights. All solutions are ensured unique.
"weights" vector should contain the masses of the input object. Note that the elemIdx and isotopeIdx values in the Weight structure are used for tracking purposes only. Elements may be removed from this input vector by MassTool.
targetWeight is the total mass you want to find out what combination of weights matches. tolerance is the mass error from targetweight (+-tolerance) you are willing to accept maxObjects is the maximum number of weights you can combine to get the solution
Definition at line 117 of file massTool.cpp.
References WEIGHT_SEARCH_ENTRY::allowableWeights, WEIGHT_SEARCH_ENTRY::cumulativeWeight, WEIGHT_SEARCH_ENTRY::curWeights, FixedStack< T >::empty(), WEIGHT_SEARCH_ENTRY::offset, FixedStack< T >::pop(), FixedStack< T >::push(), and FixedStack< T >::top().
Referenced by main().
|
static |
Multiple-target version of brute knapsack.
Definition at line 220 of file massTool.cpp.
References WEIGHT_SEARCH_ENTRY::allowableWeights, WEIGHT_SEARCH_ENTRY::cumulativeWeight, WEIGHT_SEARCH_ENTRY::curWeights, FixedStack< T >::empty(), WEIGHT_SEARCH_ENTRY::offset, FixedStack< T >::pop(), FixedStack< T >::push(), TEST, and FixedStack< T >::top().