-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGroupClassification.h
39 lines (38 loc) · 1.4 KB
/
GroupClassification.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
//
// GroupClassification.h
// JPMorganProject
//
// Created by Georgios Tsoumplekas on 23/1/24.
//
#ifndef GroupClassification_h
#define GroupClassification_h
#include <vector>
#include <memory>
#include <map>
#pragma once
class Group;
using MapElements = std::vector<Group>;
using AverageWeight = unsigned long;
using GroupIterator = std::multimap<AverageWeight,MapElements>::iterator;
class GroupClassification{
public:
// classify groups based on their counts
void classify(std::vector<Group> & groups);
// print groups information
void print();
//return two iterators which have the minimum difference
std::pair<GroupIterator,GroupIterator> findMinDiff();
// return the size of the multimap
inline auto size() const {
return classifiedGroup.size();
}
private:
// return the average strength of elements in a group
AverageWeight calculateAverage(std::vector<Group> const & groups);
//create all the combinations of groups which has sum 5
void findAllCompinationTagetSum5(std::vector<Group> const & groups,std::vector<std::vector<Group>> & classifiedGroups, std::vector<Group> & temporalVec, std::size_t index = {}, int sum = 5 );
//store vectors of groups which counts it is 5
//sort base on average weight
std::multimap<AverageWeight,MapElements> classifiedGroup;
};
#endif /* GroupClassification_h */