mirror of
https://github.com/sockspls/badfish
synced 2025-07-11 19:49:14 +00:00
Fixed compile errors when EVAL_LEARN or EVAL_NNUE are defined.
This commit is contained in:
parent
bcd6985871
commit
f58d616198
8 changed files with 34 additions and 13 deletions
|
@ -3,7 +3,7 @@
|
|||
|
||||
// いまどきの手番つき評価関数(EVAL_KPPTとEVAL_KPP_KKPT)の共用header的なもの。
|
||||
|
||||
#if defined (EVAL_KPPT) || defined(EVAL_KPP_KKPT) || defined(EVAL_NNUE)
|
||||
#if defined(EVAL_NNUE) || defined(EVAL_LEARN)
|
||||
#include <functional>
|
||||
|
||||
// KKファイル名
|
||||
|
@ -77,7 +77,6 @@ namespace Eval
|
|||
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
#endif // defined(EVAL_NNUE) || defined(EVAL_LEARN)
|
||||
|
||||
#endif // _EVALUATE_KPPT_COMMON_H_
|
|
@ -1,4 +1,6 @@
|
|||
#include "evaluate_mir_inv_tools.h"
|
||||
#if defined(EVAL_NNUE) || defined(EVAL_LEARN)
|
||||
|
||||
#include "evaluate_mir_inv_tools.h"
|
||||
|
||||
namespace Eval
|
||||
{
|
||||
|
@ -184,3 +186,5 @@ namespace Eval
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
#endif // defined(EVAL_NNUE) || defined(EVAL_LEARN)
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
#ifndef _EVALUATE_MIR_INV_TOOLS_
|
||||
#define _EVALUATE_MIR_INV_TOOLS_
|
||||
|
||||
#if defined(EVAL_NNUE) || defined(EVAL_LEARN)
|
||||
|
||||
// BonaPieceのmirror(左右反転)やinverse(盤上の180度回転)させた駒を得るためのツール類。
|
||||
|
||||
#include "../types.h"
|
||||
|
@ -40,4 +42,6 @@ namespace Eval
|
|||
extern void init_mir_inv_tables();
|
||||
}
|
||||
|
||||
#endif // defined(EVAL_NNUE) || defined(EVAL_LEARN)
|
||||
|
||||
#endif
|
||||
|
|
|
@ -911,7 +911,7 @@ std::string Eval::trace(const Position& pos) {
|
|||
return ss.str();
|
||||
}
|
||||
|
||||
#if defined(EVAL_NNUE)
|
||||
#if defined(EVAL_NNUE) || defined(EVAL_LEARN)
|
||||
namespace Eval {
|
||||
ExtBonaPiece kpp_board_index[PIECE_NB] = {
|
||||
{ BONA_PIECE_ZERO, BONA_PIECE_ZERO },
|
||||
|
@ -980,4 +980,15 @@ bool EvalList::is_valid(const Position& pos)
|
|||
return true;
|
||||
}
|
||||
}
|
||||
#endif // defined(EVAL_NNUE) || defined(EVAL_LEARN)
|
||||
|
||||
#if !defined(EVAL_NNUE)
|
||||
namespace Eval {
|
||||
void evaluate_with_no_return(const Position& pos) {}
|
||||
void update_weights(uint64_t epoch, const std::array<bool, 4> & freeze) {}
|
||||
void init_grad(double eta1, uint64_t eta_epoch, double eta2, uint64_t eta2_epoch, double eta3) {}
|
||||
void add_grad(Position& pos, Color rootColor, double delt_grad, const std::array<bool, 4> & freeze) {}
|
||||
void save_eval(std::string suffix) {}
|
||||
double get_eta() {}
|
||||
}
|
||||
#endif // defined(EVAL_NNUE)
|
||||
|
|
|
@ -37,7 +37,7 @@ Value evaluate(const Position& pos);
|
|||
|
||||
void evaluate_with_no_return(const Position& pos);
|
||||
|
||||
#if defined(EVAL_NNUE)
|
||||
#if defined(EVAL_NNUE) || defined(EVAL_LEARN)
|
||||
// 評価関数ファイルを読み込む。
|
||||
// これは、"is_ready"コマンドの応答時に1度だけ呼び出される。2度呼び出すことは想定していない。
|
||||
// (ただし、EvalDir(評価関数フォルダ)が変更になったあと、isreadyが再度送られてきたら読みなおす。)
|
||||
|
@ -216,7 +216,7 @@ struct DirtyPiece
|
|||
int dirty_num;
|
||||
|
||||
};
|
||||
#endif // defined(EVAL_NNUE)
|
||||
#endif // defined(EVAL_NNUE) || defined(EVAL_LEARN)
|
||||
}
|
||||
|
||||
#endif // #ifndef EVALUATE_H_INCLUDED
|
||||
|
|
|
@ -5,6 +5,8 @@
|
|||
|
||||
#include "learn.h"
|
||||
#if defined (EVAL_LEARN)
|
||||
#include <array>
|
||||
|
||||
#include "../eval/evaluate_mir_inv_tools.h"
|
||||
|
||||
#if defined(SGD_UPDATE) || defined(USE_KPPP_MIRROR_WRITE)
|
||||
|
|
|
@ -28,6 +28,7 @@
|
|||
#include <string>
|
||||
|
||||
#include "bitboard.h"
|
||||
#include "evaluate.h"
|
||||
#include "misc.h"
|
||||
#include "types.h"
|
||||
|
||||
|
@ -179,7 +180,7 @@ public:
|
|||
bool pos_is_ok() const;
|
||||
void flip();
|
||||
|
||||
#if defined(EVAL_NNUE)
|
||||
#if defined(EVAL_NNUE) || defined(EVAL_LEARN)
|
||||
// --- StateInfo
|
||||
|
||||
// 現在の局面に対応するStateInfoを返す。
|
||||
|
@ -188,7 +189,7 @@ public:
|
|||
|
||||
// 評価関数で使うための、どの駒番号の駒がどこにあるかなどの情報。
|
||||
const Eval::EvalList* eval_list() const { return &evalList; }
|
||||
#endif // defined(EVAL_NNUE)
|
||||
#endif // defined(EVAL_NNUE) || defined(EVAL_LEARN)
|
||||
|
||||
#if defined(EVAL_LEARN)
|
||||
// 現局面で指し手がないかをテストする。指し手生成ルーチンを用いるので速くない。探索中には使わないこと。
|
||||
|
@ -248,10 +249,10 @@ private:
|
|||
StateInfo* st;
|
||||
bool chess960;
|
||||
|
||||
#if defined(EVAL_NNUE)
|
||||
#if defined(EVAL_NNUE) || defined(EVAL_LEARN)
|
||||
// 評価関数で用いる駒のリスト
|
||||
Eval::EvalList evalList;
|
||||
#endif // defined(EVAL_NNUE)
|
||||
#endif // defined(EVAL_NNUE) || defined(EVAL_LEARN)
|
||||
};
|
||||
|
||||
namespace PSQT {
|
||||
|
|
|
@ -466,7 +466,7 @@ constexpr Square Inv(Square sq) { return (Square)((SQUARE_NB - 1) - sq); }
|
|||
// 盤面をミラーしたときの升目を返す
|
||||
constexpr Square Mir(Square sq) { return make_square(File(7 - (int)file_of(sq)), rank_of(sq)); }
|
||||
|
||||
#if defined(EVAL_NNUE)
|
||||
#if defined(EVAL_NNUE) || defined(EVAL_LEARN)
|
||||
// --------------------
|
||||
// 駒箱
|
||||
// --------------------
|
||||
|
@ -496,6 +496,6 @@ inline PieceNumber& operator--(PieceNumber& d) { return d = PieceNumber(int8_t(d
|
|||
|
||||
// PieceNumberの整合性の検査。assert用。
|
||||
constexpr bool is_ok(PieceNumber pn) { return pn < PIECE_NUMBER_NB; }
|
||||
#endif // defined(EVAL_NNUE)
|
||||
#endif // defined(EVAL_NNUE) || defined(EVAL_LEARN)
|
||||
|
||||
#endif // #ifndef TYPES_H_INCLUDED
|
||||
|
|
Loading…
Add table
Reference in a new issue