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

Function main

constr2.cpp:92–123  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

90};
91
92int 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}

Callers

nothing calls this directly

Calls 5

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

Tested by

no test coverage detected