-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
49 lines (48 loc) · 1.5 KB
/
main.cpp
File metadata and controls
49 lines (48 loc) · 1.5 KB
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
40
41
42
43
44
45
46
47
48
49
#include <iostream>
#include <list>
#include <vector>
#include "pf.h"
#include <algorithm>
void applyMask(std::list<std::vector<int>>& list,std::vector<bool>& mask){
std::for_each(list.begin(),list.end(),[&](std::vector<int>& to_apply){
int i{0};
std::for_each(to_apply.begin(),to_apply.end(),[&](int& to_apply){
if(!mask[i])
to_apply*=-1;
++i;
});
});
}
int main() {
std::cout<<"Enter number of parameters for each object"<<std::endl;
int vectorSize{0};
std::cin>>vectorSize;
std::cout<<std::endl;
std::cout<<"Enter number of objects"<<std::endl;
int listSize{0};
std::cin>>listSize;
std::list<std::vector<int>> base(listSize);
std::cout<<"Enter MIN and MAX mask"<<std::endl;
int mask_size = vectorSize;
std::vector<bool> mask(mask_size,false);
for(int i{0};i<mask_size;++i){
std::string tmp{};
std::cin>>tmp;
if(tmp=="MAX")
mask[i] = true;
}
int i{0};
std::for_each(base.begin(),base.end(),[&](std::vector<int>& to_write){
to_write.resize(vectorSize);
std::cout<<"Enter parameters of object "<<++i<<std::endl;
std::for_each(to_write.begin(),to_write.end(),[](int& to_write){
std::cin>>to_write;
});
});
applyMask(base,mask);
auto Pareto = pf::find_Pareto(base);
std::cout<<"Pareto multitude: \t"<<std::endl;
applyMask(Pareto,mask);// Deapply. It does same
pf::printmultitude(Pareto);
return 0;
}