| 122 | }; |
| 123 | |
| 124 | int main() |
| 125 | { |
| 126 | CBiteRnd rnd; |
| 127 | rnd.init( 1 ); // Needs to be seeded with different values on each run. |
| 128 | |
| 129 | CTestOpt opt; |
| 130 | opt.init( rnd ); |
| 131 | |
| 132 | int i; |
| 133 | |
| 134 | for( i = 0; i < 500000; i++ ) |
| 135 | { |
| 136 | if( opt.optimize( rnd ) > N * 128 ) |
| 137 | { |
| 138 | break; |
| 139 | } |
| 140 | } |
| 141 | |
| 142 | opt.optcost( opt.getBestParams() ); |
| 143 | |
| 144 | printf( "Finished at iteration %i\n", i + 1 ); |
| 145 | printf( "Objective = %.8g\n", opt.real_value ); |
| 146 | printf( "Constraints not met: %i\n", opt.con_notmet ); |
| 147 | |
| 148 | for( i = 0; i < N; i++ ) |
| 149 | { |
| 150 | printf( "x[%i] = %f\n", i, opt.getBestParams()[ i ]); |
| 151 | } |
| 152 | |
| 153 | return( 0 ); |
| 154 | } |
nothing calls this directly
no test coverage detected