#include #include #include /***********************************************************************/ /** **/ /** General constants and types **/ /** **/ /***********************************************************************/ const int MAX_COL = 35; const int INCR = 1; const int DECR = 0; typedef int scores[MAX_COL]; /***********************************************************************/ /** **/ /** ATM data for the two replications **/ /** **/ /***********************************************************************/ /* ATM constants for the two replications */ const int ATM_NOV_ERR = 29; const int ATM_NOV = 12; const int ATM_JUN_ERR = 29; const int ATM_JUN = 14; /* ATM scores for NOV replication */ scores atm_nov[ATM_NOV] = // All data arrays are padded with 0 {/* ID P 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 ----------------------------------------------------------------*/ 1, 1, 0,1,1,1,1,0,0,1,0,0,0,0,1,0,0,0,0,1,0,0,1,0,0,0,1,0,0,0,0, 0,0,0,0, 2, 1, 0,0,0,1,0,0,0,1,0,0,1,0,0,0,0,1,1,0,0,0,1,0,0,0,0,0,1,0,0, 0,0,0,0, 3, 0, 0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0, 4, 0, 0,0,1,0,0,0,0,0,0,0,1,0,0,0,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0, 0,0,0,0, 6, 2, 0,1,1,0,1,0,0,1,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0, 0,0,0,0, 7, 2, 0,0,1,1,1,0,0,1,0,1,0,0,0,0,0,1,1,0,1,1,1,0,1,1,0,0,0,1,0, 0,0,0,0, 8, 0, 0,0,0,1,0,0,1,0,0,0,0,0,0,0,0,1,1,0,1,0,0,0,1,1,0,0,1,0,0, 0,0,0,0, 9, 0, 0,1,0,1,1,0,0,1,0,0,1,0,0,0,1,0,0,0,0,0,1,1,1,0,1,0,1,0,0, 0,0,0,0, 11, 3, 1,1,0,1,0,0,1,0,0,0,1,0,0,0,0,1,0,0,1,0,0,0,0,0,0,0,1,0,1, 0,0,0,0, 12, 3, 0,0,0,1,0,0,1,0,0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,0,0,0,0,0,0,0,0,0, 0,0,0,0, 11, 2, 0,1,1,1,0,1,0,1,0,0,1,0,0,0,0,1,1,0,0,0,0,0,0,0,0,0,1,0,0, 0,0,0,0, 12, 3, 0,1,1,1,0,0,1,0,0,1,0,0,0,0,0,1,0,0,1,0,0,0,0,0,0,1,0,0,1, 0,0,0,0, 13, 0, 1,1,0,1,0,0,1,1,0,1,0,0,0,0,1,1,0,1,0,0,0,0,0,1,0,0,0,0,0, 0,0,0,0, 14, 0, 1,0,0,1,1,0,1,0,0,1,1,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,1, 0,0,0,0 }; /***********************************************************************/ /** **/ /** PG data for the two replications **/ /** **/ /***********************************************************************/ /* PG constants for the two replications */ const int PG_NOV_ERR = 27; const int PG_NOV = 12; const int PG_JUN_ERR = 27; const int PG_JUN = 14; /* PG scores for NOV replication */ scores pg_nov[PG_NOV] = {/* ID P 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 ------------------------------------------------------------*/ 1, 0, 0,1,0,0,0,0,0,0,0,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0, 2, 0, 0,1,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0, 3, 1, 0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,1,0,0,1,0,0,0,0,0,0,0,0, 0,0,0,0,0,0, 4, 1, 0,1,0,0,1,1,0,0,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0, 0,0,0,0,0,0, 6, 0, 0,1,0,0,0,0,0,0,0,0,0,0,0,1,1,0,0,0,1,0,0,0,0,0,0,1,0, 0,0,0,0,0,0, 7, 0, 0,1,0,1,0,0,1,1,0,0,0,1,0,1,1,0,0,0,0,0,0,0,0,0,0,1,0, 0,0,0,0,0,0, 8, 2, 0,1,0,1,0,0,0,0,0,0,0,0,1,0,0,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 0,0,0,0,0,0, 8, 2, 0,1,0,0,1,0,0,1,1,1,0,0,0,1,1,1,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0, 9, 3, 0,1,1,0,1,1,0,0,1,0,1,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0, 10, 0, 0,0,0,0,1,0,0,0,0,0,1,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0, 11, 0, 0,0,0,1,0,0,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,1,0,0,0,0,0, 0,0,0,0,0,0, 12, 0, 0,1,0,0,1,0,1,0,1,0,1,0,1,0,1,0,0,0,0,0,0,0,0,0,0,1,0, 0,0,0,0,0,0, 13, 1, 1,0,0,1,0,0,1,0,1,0,1,1,0,1,1,0,0,1,1,0,0,0,0,0,0,0,0, 0,0,0,0,0,0, 14, 2, 0,0,1,0,1,1,0,1,0,0,1,0,0,1,0,1,1,0,0,0,0,1,1,0,0,1,0, 0,0,0,0,0,0 }; /***********************************************************************/ /** **/ /** NASA A data for the two replications **/ /** **/ /***********************************************************************/ /* NASA A constants for the two replications */ const int A_NOV_ERR = 18; const int A_NOV = 12; const int A_JUN_ERR = 15; const int A_JUN = 13; /* NASA A scores for NOV replication */ scores a_nov[A_NOV] = {/* ID P 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 ------------------------------------------*/ 1, 1, 0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 2, 1, 1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 3, 0, 0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 4, 0, 1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0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0,0,0,0,0,0,0,0,0, 6, 3, 1,0,0,0,1,1,1,1,1,0,0,0,0,1,1, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 7, 0, 1,0,1,1,1,1,1,1,0,1,1,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 8, 0, 1,0,1,0,1,1,1,1,0,0,1,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 9, 0, 1,0,0,0,1,1,0,1,1,1,1,1,1,1,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 10, 1, 0,0,0,0,0,0,0,0,0,1,1,0,1,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 11, 2, 1,1,1,0,0,1,1,0,1,1,1,0,1,0,1, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 12, 3, 1,1,1,1,1,1,1,1,1,1,1,0,0,1,1, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 13, 0, 1,0,1,0,1,1,1,1,1,0,1,0,0,1,1, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 }; /***********************************************************************/ /** **/ /** NASA B data for the two replications **/ /** **/ /***********************************************************************/ /* NASA B constants for the two replications */ const int B_NOV_ERR = 15; const int B_NOV = 12; const int B_JUN_ERR = 15; const int B_JUN = 13; /* NASA B scores for NOV replication */ scores b_nov[B_NOV] = {/* ID P 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 ------------------------------------*/ 1, 0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 2, 0, 0,0,1,0,0,0,0,0,0,0,1,0,0,0,1, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 3, 1, 0,0,0,1,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 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0,0,0,0,0,0,0,0, 5, 0, 1,0,1,1,1,1,1,1,1,0,1,1,0,1,1, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 6, 0, 1,0,0,0,1,1,1,0,1,0,1,1,0,1,1, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 7, 1, 1,1,1,1,1,0,0,0,0,0,1,1,0,1,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 8, 2, 1,1,0,1,1,0,1,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 9, 3, 1,1,1,1,1,1,1,1,1,0,1,1,1,1,1, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 10, 0, 0,1,0,0,0,0,1,0,0,0,0,0,0,1,1, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 11, 0, 1,1,0,0,0,0,1,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 12, 0, 1,1,1,1,1,1,1,1,1,0,1,1,0,1,1, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 13, 1, 1,0,1,1,1,0,1,1,1,0,1,1,1,1,1, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 }; /***********************************************************************/ /** **/ /** Merge and/or sort two tables **/ /** **/ /***********************************************************************/ scores *merge_sort(int key, int order, // key is index for sort key scores *a, int a_rows, // order is INCR or DECR scores *b, int b_rows) { int i, j, k, tmp; scores *tab = new scores[a_rows + b_rows]; // Allocates dynamic memory // for new table if (a != 0) for (i=0;i tab[j][key]) for (k=0;k(a-b);i--) nom *= i; for (i=b;i>1;i--) denom *= i; return nom/denom; } /***********************************************************************/ /** **/ /** Legal team **/ /** **/ /***********************************************************************/ int legal_team(int a, int b, int c) // Perspectives of members - { // always sorted with a<=b<=c if (b!=4 && (a==b || b==c)) return 0; return 1; } /***********************************************************************/ /** **/ /** Cross **/ /** **/ /***********************************************************************/ int cross(int a) // Computes the cross sum of the binary representation { // of a number int sum=0; do sum += a % 2; // % means MOD while (a=a/2); // / of integers means DIV return sum; } /***********************************************************************/ /** **/ /** Power **/ /** **/ /***********************************************************************/ int power(int a, int b) // Computes a**b { if (b==0) return 1; return a * power(a, b-1); // Recursive invocation of the power function } /***********************************************************************/ /** **/ /** Combine teams **/ /** **/ /***********************************************************************/ scores *combine_teams(scores *matr, int rows, int err, int &n_teams) { int i, j, k, l, nasa, design, test, use, poseur, sum; scores *matrix = merge_sort(1, INCR, matr, rows, 0, 0); // Make a copy nasa=design=test=use=poseur=n_teams=0; for (i=0;iNASA, 0=>PBR) b_copy[j][1] = 0; mask[i] = mask[i]/2; } tmp = combine_teams(a_copy, a_rows, // Teams are combined for table a a_err, a_teams); j = 0; a_nasa = a_pbr = 0; while (tmp[j][1]==0) a_nasa += (float)tmp[j++][a_err+5]*100/a_err; // Sum up detection rates a_nasa = a_nasa/j; // to find mean for NASA teams j = a_teams-1; while (tmp[j][1]==1) a_pbr += (float)tmp[j--][a_err+5]*100/a_err; // Same for PBR teams a_pbr = a_pbr/(a_teams-j-1); delete tmp; tmp = combine_teams(b_copy, b_rows, b_err, b_teams); // Same for table b j = 0; b_nasa = b_pbr = 0; while (tmp[j][1]==0) b_nasa += (float)tmp[j++][b_err+5]*100/b_err; b_nasa = b_nasa/j; j = b_teams-1; while (tmp[j][1]==1) b_pbr += (float)tmp[j--][b_err+5]*100/b_err; b_pbr = b_pbr/(b_teams-j-1); tot[i].stat = (a_pbr - b_nasa) - (a_nasa - b_pbr); // Compute test stat delete tmp; delete a_copy; delete b_copy; } for (i=0;i