libatomprobe
Library for Atom Probe Tomography (APT) computation
knapsack.cpp
Go to the documentation of this file.
1 #include <atomprobe/atomprobe.h>
2 
3 using namespace std;
4 using namespace AtomProbe;
5 
6 int main()
7 {
8 
9  vector<Weight> wVec;
10  Weight wt;
11 
12  wt.mass=0.5;
13  wt.uniqueId =1;
14 
15  wVec.push_back(wt);
16 
17  vector<vector<Weight> > solns;
18  MassTool::bruteKnapsack(wVec,1.0,0.05,3,solns);
19 
20  cout << "There are :" << solns.size() << "solns." << endl;
21 
22  for(auto i=0u;i<solns.size();i++)
23  {
24  cout << "=====Soln" << i << "====" << endl;
25  cout << " Size:" << solns[i].size() << endl;
26  for(auto j=0u;j<solns[i].size();j++)
27  cout << solns[i][j].mass << endl;
28  cout << "======================" << endl;
29  }
30 
31 }
STL namespace.
int main()
Definition: knapsack.cpp:6
size_t uniqueId
Definition: massTool.h:36
Placeholder class for containing input weights for MassTool.
Definition: massTool.h:29