5 #include "../boys/allboys.h" 6 #include "../girls/allgirls.h" 7 #include "../gifts/gift.h" 8 #include "../couples/couple.h" 9 #include "../utils/read_data.h" 10 #include "../utils/logger/logger.h" 11 #include "../templates/kbest.h" 12 #include "../templates/randomK.h" 13 #include "../configs.h" 15 std::vector<Couple>
makeCouples(
int k, std::vector<Boy*>, std::vector<Girl*>,
Logger *logger);
16 void performGifting (
int k, std::vector<Couple> *couples, std::vector<Gift> *giftlist,
Logger *logger);
18 int main(
int argc,
char **argv)
29 logger.
info(
"Processing for question 3",
true);
30 logger.
log(
"boys", std::to_string(boys.size()) +
" record read",
true);
31 logger.
log(
"girls", std::to_string(girls.size()) +
" record read",
true);
32 logger.
log(
"gifts", std::to_string(gifts.size()) +
" record read",
true);
34 std::vector<Couple> couples =
makeCouples(k, boys, girls, &logger);
36 logger.
log(
"couples", std::to_string(couples.size()) +
" formed",
true);
38 logger.
info(
"Couples list",
true);
39 for (
int i = 0; i < (int)couples.size(); i++)
40 logger.
log(
"couple"+std::to_string(i+1),
41 couples[i].boy->name+
" and "+couples[i].girl->name,
true);
51 std::vector<Couple>
makeCouples(
int k, std::vector<Boy*> boys, std::vector<Girl*> girls,
Logger *logger)
53 std::vector<Couple> couples;
56 for (
int j = 0; j < girls.size(); j++) {
58 logger->
info(girl->name+
" was chosen at random",
true);
59 if (girl->committed)
continue;
61 std::vector<Boy*> topBoys;
62 switch (girl->boy_type) {
74 for (
int i = 0; i < topBoys.size(); i++) {
76 logger->
info(boy->name+
" was chosen at random",
true);
77 if (boy->committed)
continue;
78 if (boy->isCompatible(girl) &&
79 girl->isCompatible(boy)) {
81 couples.push_back(
Couple(boy, girl));
82 logger->
log(
"Couple", boy->name+
" coupled with "+girl->name,
true);
83 boy->committed =
true;
84 girl->committed=
true;
96 for (
auto it = couples->begin(); it != couples->end(); it++)
97 it->makeGiftBasket(*giftlist, logger);
std::vector< Gift > readAllGifts(std::string filename)
void info(const std::string msg, bool print=false)
void log(const std::string type, const std::string msg, bool print=false)
bool compareOnIntelligence(Boy *b1, Boy *b2)
std::vector< Girl * > readAllGirls(std::string filename)
int main(int argc, char **argv)
std::vector< Boy * > readAllBoys(std::string filename)
std::vector< Couple > makeCouples(int k, std::vector< Boy * >, std::vector< Girl * >, Logger *logger)
bool compareOnAttractiveness(Boy *b1, Boy *b2)
void performGifting(int k, std::vector< Couple > *couples, std::vector< Gift > *giftlist, Logger *logger)
bool compareOnRichness(Boy *b1, Boy *b2)