Mercurial > hg > tweakathon2ios
diff TrainingScoreManager.h @ 29:e7af34b1af83
animated sliders
throughput calculation
author | Robert Tubb <rt300@eecs.qmul.ac.uk> |
---|---|
date | Mon, 03 Nov 2014 18:27:58 +0000 |
parents | 8124f46eda65 |
children | 78b51f924ec1 |
line wrap: on
line diff
--- a/TrainingScoreManager.h Thu Oct 30 18:35:00 2014 +0000 +++ b/TrainingScoreManager.h Mon Nov 03 18:27:58 2014 +0000 @@ -23,6 +23,7 @@ int score; ofColor colorBand; string displayText; + float bits; }; class TrainingScoreManager{ @@ -30,15 +31,21 @@ // equiv of score bit of testController public: - TrainingTestResult getScoreForAnswer(vector<int> targetParams, vector<int> answer, int timeAllowed) const { + TrainingTestResult getScoreForAnswer(vector<int> targetParams, vector<int> startPosition, vector<int> answer, int timeAllowed) const { TrainingTestResult result; stringstream msg; int score = 0; // work out euc distance from actual point //for_each(answer.begin(),answer.end(),printThing<int>()); //for_each(targetParams.begin(),targetParams.end(),printThing<int>()); + float initDist = euclideanDistance(startPosition, answer); float dist = euclideanDistance(targetParams, answer); - auto dimComp = sqrt(6.0); + + float TP = calculateThroughput(TOTAL_NUM_PARAMS, dist, initDist, timeAllowed/1000.); + + cout << TP << endl; + + auto dimComp = sqrt(TOTAL_NUM_PARAMS); int band = -1; if (dist < TARGET_SCORE_CC_BAND*dimComp){ score = 50; @@ -114,7 +121,15 @@ return result; } private: - + float calculateThroughput(int numDims, float endDistance, float startDistance, float time) const{ + + float ISSR = numDims * log2( startDistance / endDistance); + cout << "start: " << startDistance << endl; + cout << "end: " << endDistance << endl; + cout << "ISSR: " << ISSR << endl; + float TP = ISSR / time; + return TP; + } float euclideanDistance(vector<int> v1, vector<int> v2) const{ if (v1.size() != v2.size()){ cout << "ERROR ERROR: vectors must be same length for Mr Euclid";