| 289 | } |
| 290 | |
| 291 | virtual double optcost( const double* const p ) |
| 292 | { |
| 293 | #if OPT_THREADS && OPT_TIME |
| 294 | TClock t1( CSystem :: getClock() ); |
| 295 | #endif // OPT_THREADS && OPT_TIME |
| 296 | |
| 297 | if( !DoRandomize ) |
| 298 | { |
| 299 | const double fv = (*fn -> CalcFunc)( p, Dims ); |
| 300 | |
| 301 | #if OPT_THREADS && OPT_TIME |
| 302 | funct += CSystem :: getClockDiffSec( t1 ); |
| 303 | #endif // OPT_THREADS && OPT_TIME |
| 304 | |
| 305 | return( fv ); |
| 306 | } |
| 307 | |
| 308 | int i; |
| 309 | |
| 310 | for( i = 0; i < Dims; i++ ) |
| 311 | { |
| 312 | tp2[ i ] = p[ i ] * signs[ i ] + shifts[ i ]; |
| 313 | } |
| 314 | |
| 315 | if( !DoRandomizeAll ) |
| 316 | { |
| 317 | const double fv = (*fn -> CalcFunc)( tp2, Dims ); |
| 318 | |
| 319 | #if OPT_THREADS && OPT_TIME |
| 320 | funct += CSystem :: getClockDiffSec( t1 ); |
| 321 | #endif // OPT_THREADS && OPT_TIME |
| 322 | |
| 323 | return( fv ); |
| 324 | } |
| 325 | |
| 326 | for( i = 0; i < Dims; i++ ) |
| 327 | { |
| 328 | tp[ i ] = 0.0; |
| 329 | int j; |
| 330 | |
| 331 | for( j = 0; j < Dims; j++ ) |
| 332 | { |
| 333 | tp[ i ] += rots[ i ][ j ] * tp2[ j ]; |
| 334 | } |
| 335 | } |
| 336 | |
| 337 | const double fv = (*fn -> CalcFunc)( tp, Dims ); |
| 338 | |
| 339 | #if OPT_THREADS && OPT_TIME |
| 340 | funct += CSystem :: getClockDiffSec( t1 ); |
| 341 | #endif // OPT_THREADS && OPT_TIME |
| 342 | |
| 343 | return( fv ); |
| 344 | } |
| 345 | |
| 346 | #if OPT_STATS |
| 347 | double calcDevSel( const int h, const int c, const double avg, |
nothing calls this directly
no outgoing calls
no test coverage detected