protected void updateSolution ( double [ ] [ ] sol , double [ ] meta , int it ) { final double mom = ( it < momentumSwitch && initialMomentum < finalMomentum ) ? initialMomentum : finalMomentum ; final int dim3 = dim * 3 ; for ( int i = 0 , off = 0 ; i < sol . length ; i ++ , off += dim3 ) { final double [ ] sol_i = sol [ i ] ; for ( int k = 0 ; k < dim ; k ++ ) { // Indexes in meta array final int gradk = off + k , movk = gradk + dim , gaink = movk + dim ; // Adjust learning rate: meta [ gaink ] = MathUtil . max ( ( ( meta [ gradk ] > 0 ) != ( meta [ movk ] > 0 ) ) ? ( meta [ gaink ] + 0.2 ) : ( meta [ gaink ] * 0.8 ) , MIN_GAIN ) ; meta [ movk ] *= mom ; // Dampening the previous momentum meta [ movk ] -= learningRate * meta [ gradk ] * meta [ gaink ] ; // Learn sol_i [ k ] += meta [ movk ] ; } } }
Update the current solution on iteration .