mirror of
https://github.com/opelly27/Stockfish.git
synced 2026-05-20 16:47:37 +00:00
Translation
Files in /eval, /extra, & /learn - comments translated from Japanese to English
This commit is contained in:
@@ -23,15 +23,15 @@ namespace EvalLearningTools
|
||||
|
||||
std::vector<bool> min_index_flag;
|
||||
|
||||
// --- 個別のテーブルごとの初期化
|
||||
// --- initialization for each individual table
|
||||
|
||||
void init_min_index_flag()
|
||||
{
|
||||
// mir_piece、inv_pieceの初期化が終わっていなければならない。
|
||||
// Initialization of mir_piece and inv_piece must be completed.
|
||||
assert(mir_piece(Eval::f_pawn) == Eval::e_pawn);
|
||||
|
||||
// 次元下げ用フラグ配列の初期化
|
||||
// KPPPに関しては関与しない。
|
||||
// Initialize the flag array for dimension reduction
|
||||
// Not involved in KPPP.
|
||||
|
||||
KK g_kk;
|
||||
g_kk.set(SQUARE_NB, Eval::fe_end, 0);
|
||||
@@ -46,9 +46,9 @@ namespace EvalLearningTools
|
||||
#pragma omp parallel
|
||||
{
|
||||
#if defined(_OPENMP)
|
||||
// Windows環境下でCPUが2つあるときに、論理64コアまでしか使用されないのを防ぐために
|
||||
// ここで明示的にCPUに割り当てる
|
||||
int thread_index = omp_get_thread_num(); // 自分のthread numberを取得
|
||||
// To prevent the logical 64 cores from being used when there are two CPUs under Windows
|
||||
// explicitly assign to CPU here
|
||||
int thread_index = omp_get_thread_num(); // get your thread number
|
||||
WinProcGroup::bindThisThread(thread_index);
|
||||
#endif
|
||||
|
||||
@@ -56,20 +56,20 @@ namespace EvalLearningTools
|
||||
|
||||
for (int64_t index_ = 0; index_ < (int64_t)size; ++index_)
|
||||
{
|
||||
// OpenMPの制約からループ変数は符号型でないといけないらしいのだが、
|
||||
// さすがに使いにくい。
|
||||
// It seems that the loop variable must be a sign type due to OpenMP restrictions, but
|
||||
// It's really difficult to use.
|
||||
uint64_t index = (uint64_t)index_;
|
||||
|
||||
if (g_kk.is_ok(index))
|
||||
{
|
||||
// indexからの変換と逆変換によって元のindexに戻ることを確認しておく。
|
||||
// 起動時に1回しか実行しない処理なのでassertで書いておく。
|
||||
// Make sure that the original index will be restored by conversion from index and reverse conversion.
|
||||
// It is a process that is executed only once at startup, so write it in assert.
|
||||
assert(g_kk.fromIndex(index).toIndex() == index);
|
||||
|
||||
KK a[KK_LOWER_COUNT];
|
||||
g_kk.fromIndex(index).toLowerDimensions(a);
|
||||
|
||||
// 次元下げの1つ目の要素が元のindexと同一であることを確認しておく。
|
||||
// Make sure that the first element of dimension reduction is the same as the original index.
|
||||
assert(a[0].toIndex() == index);
|
||||
|
||||
uint64_t min_index = UINT64_MAX;
|
||||
@@ -118,9 +118,9 @@ namespace EvalLearningTools
|
||||
void learning_tools_unit_test_kpp()
|
||||
{
|
||||
|
||||
// KPPの三角配列化にバグがないかテストする
|
||||
// k-p0-p1のすべての組み合わせがきちんとKPPの扱う対象になっていかと、そのときの次元下げが
|
||||
// 正しいかを判定する。
|
||||
// test KPP triangulation for bugs
|
||||
// All combinations of k-p0-p1 are properly handled by KPP, and the dimension reduction at that time is
|
||||
// Determine if it is correct.
|
||||
|
||||
KK g_kk;
|
||||
g_kk.set(SQUARE_NB, Eval::fe_end, 0);
|
||||
@@ -159,24 +159,24 @@ namespace EvalLearningTools
|
||||
f[index - g_kpp.min_index()] = f[index2-g_kpp.min_index()] = true;
|
||||
}
|
||||
|
||||
// 抜けてるindexがなかったかの確認。
|
||||
// Check if there is no missing index.
|
||||
for(size_t index = 0 ; index < f.size(); index++)
|
||||
if (!f[index])
|
||||
{
|
||||
std::cout << index << g_kpp.fromIndex(index + g_kpp.min_index()) << std::endl;
|
||||
std::cout << index << g_kpp.fromIndex(index + g_kpp.min_index()) << std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
void learning_tools_unit_test_kppp()
|
||||
{
|
||||
// KPPPの計算に抜けがないかをテストする
|
||||
// Test for missing KPPP calculations
|
||||
|
||||
KPPP g_kppp;
|
||||
g_kppp.set(15, Eval::fe_end,0);
|
||||
uint64_t min_index = g_kppp.min_index();
|
||||
uint64_t max_index = g_kppp.max_index();
|
||||
|
||||
// 最後の要素の確認。
|
||||
// Confirm last element.
|
||||
//KPPP x = KPPP::fromIndex(max_index-1);
|
||||
//std::cout << x << std::endl;
|
||||
|
||||
@@ -208,10 +208,10 @@ namespace EvalLearningTools
|
||||
void learning_tools_unit_test_kkpp()
|
||||
{
|
||||
KKPP g_kkpp;
|
||||
g_kkpp.set(SQUARE_NB, 10000 , 0);
|
||||
g_kkpp.set(SQUARE_NB, 10000, 0);
|
||||
uint64_t n = 0;
|
||||
for (int k = 0; k<SQUARE_NB; ++k)
|
||||
for (int i = 0; i<10000; ++i) // 試しに、かなり大きなfe_endを想定して10000で回してみる。
|
||||
for (int i = 0; i<10000; ++i) // As a test, assuming a large fe_end, try turning at 10000.
|
||||
for (int j = 0; j < i; ++j)
|
||||
{
|
||||
auto kkpp = g_kkpp.fromKKPP(k, (BonaPiece)i, (BonaPiece)j);
|
||||
@@ -222,27 +222,27 @@ namespace EvalLearningTools
|
||||
}
|
||||
}
|
||||
|
||||
// このEvalLearningTools全体の初期化
|
||||
// Initialize this entire EvalLearningTools
|
||||
void init()
|
||||
{
|
||||
// 初期化は、起動後1回限りで良いのでそのためのフラグ。
|
||||
// Initialization is required only once after startup, so a flag for that.
|
||||
static bool first = true;
|
||||
|
||||
if (first)
|
||||
{
|
||||
std::cout << "EvalLearningTools init..";
|
||||
|
||||
// mir_piece()とinv_piece()を利用可能にする。
|
||||
// このあとmin_index_flagの初期化を行なうが、そこが
|
||||
// これに依存しているので、こちらを先に行なう必要がある。
|
||||
// Make mir_piece() and inv_piece() available.
|
||||
// After this, the min_index_flag is initialized, but
|
||||
// It depends on this, so you need to do this first.
|
||||
init_mir_inv_tables();
|
||||
|
||||
//learning_tools_unit_test_kpp();
|
||||
//learning_tools_unit_test_kppp();
|
||||
//learning_tools_unit_test_kkpp();
|
||||
|
||||
// UnitTestを実行するの最後でも良いのだが、init_min_index_flag()にとても時間がかかるので
|
||||
// デバッグ時はこのタイミングで行いたい。
|
||||
// It may be the last time to execute UnitTest, but since init_min_index_flag() takes a long time,
|
||||
// I want to do this at the time of debugging.
|
||||
|
||||
init_min_index_flag();
|
||||
|
||||
@@ -253,4 +253,4 @@ namespace EvalLearningTools
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
#endif
|
||||
Reference in New Issue
Block a user