| 90 | }; |
| 91 | |
| 92 | int main() |
| 93 | { |
| 94 | CBiteRnd rnd; |
| 95 | rnd.init( 1 ); // Needs to be seeded with different values on each run. |
| 96 | |
| 97 | CTestOpt opt; |
| 98 | opt.updateDims( N, 6 ); |
| 99 | opt.init( rnd ); |
| 100 | |
| 101 | int i; |
| 102 | |
| 103 | for( i = 0; i < 2000000; i++ ) |
| 104 | { |
| 105 | if( opt.optimize( rnd ) > N * 128 ) |
| 106 | { |
| 107 | break; |
| 108 | } |
| 109 | } |
| 110 | |
| 111 | opt.optcost( opt.getBestParams() ); |
| 112 | |
| 113 | printf( "Finished at iteration %i\n", i + 1 ); |
| 114 | printf( "Objective = %.8g\n", opt.real_value ); |
| 115 | printf( "Constraints not met: %i\n", opt.con_notmet ); |
| 116 | |
| 117 | for( i = 0; i < N; i++ ) |
| 118 | { |
| 119 | printf( "x[%i] = %.10g\n", i, opt.getBestParams()[ i ]); |
| 120 | } |
| 121 | |
| 122 | return( 0 ); |
| 123 | } |
nothing calls this directly
no test coverage detected