| 6 | #endif // !defined( sqr ) |
| 7 | |
| 8 | class CTestOpt : public CBiteOpt |
| 9 | { |
| 10 | public: |
| 11 | CTestOpt() |
| 12 | { |
| 13 | updateDims( 2 ); |
| 14 | } |
| 15 | |
| 16 | virtual void getMinValues( double* const p ) const |
| 17 | { |
| 18 | p[ 0 ] = -10.0; |
| 19 | p[ 1 ] = -10.0; |
| 20 | } |
| 21 | |
| 22 | virtual void getMaxValues( double* const p ) const |
| 23 | { |
| 24 | p[ 0 ] = 10.0; |
| 25 | p[ 1 ] = 10.0; |
| 26 | } |
| 27 | |
| 28 | virtual double optcost( const double* const p ) |
| 29 | { |
| 30 | const double x = p[ 0 ]; |
| 31 | const double y = p[ 1 ]; |
| 32 | |
| 33 | return( sqr( x + 2 * y - 7 ) + sqr( 2 * x + y - 5 )); |
| 34 | // return( 0.26 * ( x * x + y * y ) - 0.48 * x * y ); |
| 35 | // return( x * x + y * y ); |
| 36 | // return( 2 * x * x - 1.05 * sqr( sqr( x )) + sqr( sqr( sqr( x ))) / 6 + x * y + y * y ); |
| 37 | // return( 0.5 + ( sqr( sin( x * x - y * y )) - 0.5 ) / sqr( 1 + 0.001 * ( x * x + y * y ))); |
| 38 | // return( 100 * sqr( y - x * x ) + sqr( x - 1 )); |
| 39 | // return( sqr( 1.5 - x + x * y ) + sqr( 2.25 - x + x * y * y ) + sqr( 2.625 - x + x * y * y * y )); |
| 40 | } |
| 41 | }; |
| 42 | |
| 43 | int main() |
| 44 | { |
nothing calls this directly
no outgoing calls
no test coverage detected