Removed "#if 0" and "#if 1".

This commit is contained in:
nodchip
2020-09-08 23:08:39 +09:00
parent 458771a181
commit 04a9a951b8
2 changed files with 3 additions and 71 deletions
+3 -21
View File
@@ -166,7 +166,7 @@ namespace Learner
output_file_stream.write(reinterpret_cast<const char*>(buf->data()), sizeof(PackedSfenValue) * buf->size());
sfen_write_count += buf->size();
#if 1
// Add the processed number here, and if it exceeds save_every,
// change the file name and reset this counter.
sfen_write_count_current_file += buf->size();
@@ -186,7 +186,7 @@ namespace Learner
output_file_stream.open(new_filename, ios::out | ios::binary | ios::app);
cout << endl << "output sfen file = " << new_filename << endl;
}
#endif
// Output '.' every time when writing a game record.
std::cout << ".";
@@ -519,10 +519,6 @@ namespace Learner
{
// Write out one sfen.
sfen_writer.write(thread_id, *it);
#if 0
pos.set_from_packed_sfen(it->sfen);
cout << pos << "Win : " << it->is_win << " , " << it->score << endl;
#endif
}
return quit;
@@ -667,13 +663,12 @@ namespace Learner
for (auto m : pv)
{
#if 1
// There should be no illegal move. This is as a debugging precaution.
if (!pos.pseudo_legal(m) || !pos.legal(m))
{
cout << "Error! : " << pos.fen() << m << endl;
}
#endif
pos.do_move(m, states[ply++]);
// Because the difference calculation of evaluate() cannot be
@@ -803,19 +798,6 @@ namespace Learner
// Save the move score for adjudication.
move_hist_scores.push_back(search_value);
#if 0
dbg_hit_on(search_value == leaf_value);
// gensfen depth 3 eval_limit 32000
// Total 217749 Hits 203579 hit rate (%) 93.490
// gensfen depth 6 eval_limit 32000
// Total 78407 Hits 69190 hit rate (%) 88.245
// gensfen depth 6 eval_limit 3000
// Total 53879 Hits 43713 hit rate (%) 81.132
// Problems such as pruning with moves in the substitution table.
// This is a little uncomfortable as a teacher...
#endif
// If depth 0, pv is not obtained, so search again at depth 2.
if (search_depth_min <= 0)
{
-50
View File
@@ -1163,11 +1163,6 @@ namespace Learner
if (ps.gamePly < prng.rand(reduction_gameply))
goto RETRY_READ;
#if 0
auto sfen = pos.sfen_unpack(ps.data);
pos.set(sfen);
#endif
// ↑ Since it is slow when passing through sfen, I made a dedicated function.
StateInfo si;
const bool mirror = prng.rand(100) < mirror_percentage;
if (pos.set_from_packed_sfen(ps.sfen, &si, th, mirror) != 0)
@@ -1207,28 +1202,6 @@ namespace Learner
// If it is the result of searching a completely different place, it may become noise.
// It may be better not to study where the difference in evaluation values is too large.
#if 0
// If you do this, about 13% of the phases will be excluded
// from the learning target. Good and bad are subtle.
if (pv.size() >= 1 && (uint16_t)pv[0] != ps.move)
{
//dbg_hit_on(false);
continue;
}
#endif
#if 0
// It may be better not to study where the difference in evaluation values is too large.
// → It's okay because it passes the win rate function...
// About 30% of the phases are out of the scope of learning...
if (abs((int16_t)r.first - ps.score) >= Eval::PawnValue * 4)
{
//dbg_hit_on(false);
continue;
}
//dbg_hit_on(true);
#endif
int ply = 0;
// A helper function that adds the gradient to the current phase.
@@ -1315,17 +1288,6 @@ namespace Learner
// rewind the phase
for (auto it = pv.rbegin(); it != pv.rend(); ++it)
pos.undo_move(*it);
#if 0
// When adding the gradient to the root phase
shallow_value =
(rootColor == pos.side_to_move())
? Eval::evaluate(pos)
: -Eval::evaluate(pos);
dj_dw = calc_grad(deep_value, shallow_value, ps);
Eval::add_grad(pos, rootColor, dj_dw, without_kpp);
#endif
}
}
@@ -2058,18 +2020,6 @@ namespace Learner
learn_think.best_nn_directory = std::string(Options["EvalDir"]);
}
#if 0
// A test to give a gradient of 1.0 to the initial stage of Hirate.
pos.set_hirate();
cout << Eval::evaluate(pos) << endl;
//Eval::print_eval_stat(pos);
Eval::add_grad(pos, BLACK, 32.0, false);
Eval::update_weights(1);
pos.state()->sum.p[2][0] = VALUE_NOT_EVALUATED;
cout << Eval::evaluate(pos) << endl;
//Eval::print_eval_stat(pos);
#endif
cout << "init done." << endl;
// Reflect other option settings.