From 7e24634cbf5c192c92463e3696149b53c5a96162 Mon Sep 17 00:00:00 2001 From: boufaras Date: Wed, 14 Sep 2011 12:01:22 +0000 Subject: [PATCH] code optimization git-svn-id: svn://scm.gforge.inria.fr/svnroot/paradiseo@2359 331e1502-861f-0410-8da2-ba01fb791d7f --- .../ParadisEO-GPU/src/problems/eval/PPPEval.h | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/branches/ParadisEO-GPU/src/problems/eval/PPPEval.h b/branches/ParadisEO-GPU/src/problems/eval/PPPEval.h index e4b374640..7691e432d 100644 --- a/branches/ParadisEO-GPU/src/problems/eval/PPPEval.h +++ b/branches/ParadisEO-GPU/src/problems/eval/PPPEval.h @@ -66,22 +66,21 @@ public: void operator()(EOT & _sol) { int *H; - int *S; + int tmp; int tmp_1 = 0; int tmp_2 = 0; H = new int[Nd]; - S = new int[Md]; for (int i = 0; i < Md; i++) { - S[i] = 0; + tmp = 0; for (int j = 0; j < Nd; j++) { - S[i] += pppData.a_h[i * Nd + j] * _sol[j]; + tmp += pppData.a_h[i * Nd + j] * _sol[j]; } - tmp_1 += abs(S[i]) - S[i]; - if (S[i] > 0) - H[S[i]-1]++; + tmp_1 += abs(tmp) - tmp; + if (tmp > 0) + H[tmp-1]++; } for (int j = 0; j < Nd; j++) { @@ -91,7 +90,7 @@ public: _sol.fitness(ca * tmp_1 + cb * tmp_2); delete[] H; - delete[] S; + } protected: