Code: Select all
child_value/child_visits + sqrt(2log(parent_visits)/child_visits)
==
child_value/child_visits + C * inv_sqrt(child_visits/log2(parent_visits))
Also dont do the first term in integers. Cast to float before! Integer division is much slower than float and the + will cast it to float anyway.
Later advanced hint:
Code: Select all
(AVX1) _mm256_rsqrt_ps
(unfortunately avx512) _mm256_lzcnt_epi64
To find the best UCB1 value you can use _mm256_cmpgt_epi64 + mask.
But keep the hardcore optimisation for when your search is good and everything works

No paper on the topic uses this as far as I have seen. Leaving performance on the table.
I am not built that way. When I see the optimum is not reached I will optimize more. Letting me take 2 years for a movegen alone... Not recommended.