question: protected void project_to_constraint ( ) { double alpha_sum = sum_alpha - 1 ; int SVcount = 0 ; double alpha ; int i ; for ( i = 0 ; i < examples_total ; i ++ ) { alpha = alphas [ i ] ; alpha_sum += alpha ; if ( alpha > 0 && alpha < C ) { SVcount ++ ; } ; } ; if ( alpha_sum != 0.0d ) { double alpha_delta ; if ( SVcount > 0 ) { double [ ] kernel_row ; alpha_delta = alpha_sum / SVcount ; alpha_sum = sum_alpha - 1 ; for ( i = 0 ; i < examples_total ; i ++ ) { alpha = alphas [ i ] ; if ( alpha > 0 && alpha < C ) { alphas [ i ] -= alpha_delta ; kernel_row = kernel . get_row ( i ) ; for ( int j = 0 ; j < examples_total ; j ++ ) { sum [ j ] -= alpha_delta * kernel_row [ j ] ; } ; } ; alpha_sum += alpha ; } ; } ; if ( Math . abs ( alpha_sum ) > is_zero ) { i = 0 ; while ( i < examples_total && alpha_sum != 0.0 ) { alpha = alphas [ i ] ; if ( alpha_sum > 0 ) { if ( alpha > 0 ) { if ( alpha < alpha_sum ) { alpha_sum -= alpha ; alphas [ i ] = 0 ; } else { alphas [ i ] -= alpha_sum ; alpha_sum = 0 ; } ; } ; } else { if ( alpha < C ) { if ( C - alpha < - alpha_sum ) { alpha_sum += C - alpha ; alphas [ i ] = C ; } else { alphas [ i ] -= alpha_sum ; alpha_sum = 0 ; } ; } ; } ; } } ; } ; }
target:  Project variables to constraints