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

Method optimize

smaesopt.h:163–198  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

161 */
162
163 int optimize( CBiteRnd& rnd )
164 {
165 double* const Params = getCurParams();
166
167 sample( rnd, Params );
168
169 const double NewCost = fixCostNaN( optcost( Params ));
170 NewCosts[ 0 ] = NewCost;
171 LastValues = Params;
172
173 updatePop( NewCost, Params );
174 updateBestCost( NewCost, Params );
175
176 AvgCost += NewCost;
177 cure++;
178
179 if( cure >= curem )
180 {
181 AvgCost /= cure;
182
183 if( AvgCost < HiBound )
184 {
185 HiBound = AvgCost;
186 }
187
188 resetCurPopPos();
189 AvgCost = 0.0;
190 cure = 0;
191
192 Ort.update( *this );
193 }
194
195 StallCount = ( NewCost < HiBound ? 0 : StallCount + 1 );
196
197 return( StallCount );
198 }
199
200protected:
201 CBiteOrt Ort; ///< Rotation vector and orthogonalization calculator.

Callers

nothing calls this directly

Calls 1

updateMethod · 0.45

Tested by

no test coverage detected