finished weighted rank
This commit is contained in:
parent
e04c6e3a21
commit
769a230a0e
BIN
weightedrank
BIN
weightedrank
Binary file not shown.
@ -127,9 +127,12 @@ main(int argc, char *argv[])
|
|||||||
// copy memory before ranking
|
// copy memory before ranking
|
||||||
int space = sizeof(struct Rank) * items->rank_count;
|
int space = sizeof(struct Rank) * items->rank_count;
|
||||||
|
|
||||||
|
printf("\n\n" BOLDWHITE "**Choose items to rank!**" "\n");
|
||||||
|
mem->rl.rank_count = rsstdin(mem->rl.rank);
|
||||||
|
|
||||||
// manual copy with for loop
|
// manual copy with for loop
|
||||||
for (int i = 0; i < items->rank_count; i++) {
|
for (int i = 0; i < items->rank_count; i++) {
|
||||||
strncpy(mem->rl.srank[0][i].name, items->rank[i], M_STR_LEN);
|
strncpy(mem->rl.srank[0][i].name, mem->rl.rank[i], M_STR_LEN);
|
||||||
}
|
}
|
||||||
|
|
||||||
memcpy(mem->rl.srank[1], mem->rl.srank[0], space);
|
memcpy(mem->rl.srank[1], mem->rl.srank[0], space);
|
||||||
@ -148,23 +151,23 @@ main(int argc, char *argv[])
|
|||||||
"%s " BOLDGREEN "(%g)" BOLDWHITE " | "
|
"%s " BOLDGREEN "(%g)" BOLDWHITE " | "
|
||||||
"%s " BOLDGREEN "(%g)" BOLDWHITE " | "
|
"%s " BOLDGREEN "(%g)" BOLDWHITE " | "
|
||||||
"%s " BOLDGREEN "(%g)" BOLDWHITE " | "
|
"%s " BOLDGREEN "(%g)" BOLDWHITE " | "
|
||||||
"total " RESET "\n\n",
|
"total " RESET "\n",
|
||||||
weighted.opt1, weighted.opt1_w,
|
weighted.opt1, weighted.opt1_w,
|
||||||
weighted.opt2, weighted.opt2_w,
|
weighted.opt2, weighted.opt2_w,
|
||||||
weighted.opt3, weighted.opt3_w);
|
weighted.opt3, weighted.opt3_w);
|
||||||
|
|
||||||
for (int i = 0; i < mem->rl.rank_count; i++) {
|
for (int i = 0; i < mem->rl.rank_count; i++) {
|
||||||
// garbage dot product T_T
|
// garbage dot product T_T
|
||||||
|
float total =
|
||||||
int total = mem->rl.srank[0][i].score * weighted.opt1_w +
|
((double) mem->rl.srank[0][i].score) * weighted.opt1_w +
|
||||||
mem->rl.srank[1][i].score * weighted.opt2_w +
|
((double) mem->rl.srank[1][i].score) * weighted.opt2_w +
|
||||||
mem->rl.srank[2][i].score * weighted.opt3_w;
|
((double) mem->rl.srank[2][i].score) * weighted.opt3_w;
|
||||||
|
|
||||||
printf(BOLDWHITE "%s | "
|
printf(BOLDWHITE "%s | "
|
||||||
BOLDGREEN "%d*%g " BOLDWHITE "|"
|
BOLDGREEN "%d*%g " BOLDWHITE "| "
|
||||||
BOLDGREEN "%d*%g " BOLDWHITE "|"
|
BOLDGREEN "%d*%g " BOLDWHITE "| "
|
||||||
BOLDGREEN "%d*%g " BOLDWHITE "|"
|
BOLDGREEN "%d*%g " BOLDWHITE " |"
|
||||||
BOLDGREEN "%d " RESET "\n",
|
BOLDGREEN "%g " RESET "\n",
|
||||||
mem->rl.srank[0][i].name,
|
mem->rl.srank[0][i].name,
|
||||||
mem->rl.srank[0][i].score, weighted.opt1_w,
|
mem->rl.srank[0][i].score, weighted.opt1_w,
|
||||||
mem->rl.srank[1][i].score, weighted.opt2_w,
|
mem->rl.srank[1][i].score, weighted.opt2_w,
|
||||||
|
Loading…
Reference in New Issue
Block a user