Skip to content

Commit 65ec4af

Browse files
author
Emmanuel Benazera
committed
tiny TPA cleanup, ref #88
1 parent 29fb1a4 commit 65ec4af

File tree

1 file changed

+2
-7
lines changed

1 file changed

+2
-7
lines changed

src/esostrategy.cc

+2-7
Original file line numberDiff line numberDiff line change
@@ -338,33 +338,28 @@ namespace libcmaes
338338
}
339339
_solutions._candidates = ncandidates;
340340
}
341-
341+
342342
template<class TParameters,class TSolutions,class TStopCriteria>
343343
void ESOStrategy<TParameters,TSolutions,TStopCriteria>::tpa_update()
344344
{
345345
int r1 = -1;
346346
int r2 = -1;
347-
double fval1;
348-
double fval2;
349347
for (size_t i=0;i<_solutions._candidates.size();i++)
350348
{
351349
if (r1 == -1 && (_solutions._candidates.at(i).get_x_dvec()-_solutions._tpa_x1).isMuchSmallerThan(1e-15))
352350
{
353351
r1 = i;
354-
fval1 = _solutions._candidates.at(i).get_fvalue();
355352
}
356353
if (r2 == -1 && (_solutions._candidates.at(i).get_x_dvec()-_solutions._tpa_x2).isMuchSmallerThan(1e-15))
357354
{
358355
r2 = i;
359-
fval2 = _solutions._candidates.at(i).get_fvalue();
360356
}
361357
if (r1 != -1 && r2 != -1)
362358
{
363-
//std::cout << "r1=" << r1 << " / r2=" << r2 << " / fval1=" << fval1 << " / fval2=" << fval2 << std::endl;
364359
break;
365360
}
366361
}
367-
int rank_diff = r2-r1;//std::floor((r2 - r1)/4.0);
362+
int rank_diff = r2-r1;
368363
_solutions._tpa_s = (1.0 - _parameters._tpa_csigma) * _solutions._tpa_s
369364
+ _parameters._tpa_csigma * rank_diff / (_parameters._lambda - 1.0);
370365
}

0 commit comments

Comments
 (0)