MCPcopy Create free account
hub / github.com/avaneev/biteopt / main

Function main

constr.cpp:124–154  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

122};
123
124int 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}

Callers

nothing calls this directly

Calls 4

initMethod · 0.45
optimizeMethod · 0.45
optcostMethod · 0.45
getBestParamsMethod · 0.45

Tested by

no test coverage detected