My Project
Classes | Macros | Typedefs | Enumerations | Functions | Variables
eval_builder.c File Reference
#include "const.h"
#include "clock.h"
#include "gamebase.h"
#include "eval.h"
#include "stat.h"
#include <assert.h>
#include <ctype.h>
#include <string.h>
#include <stdlib.h>
#include <math.h>
#include <float.h>

Classes

struct  EvalBuilder
 
struct  EvalOption
 

Macros

#define EDAX_BUILDER_REGULAR
 
#define EVAL   0x4556414c
 
#define LAVE   0x4c415645
 

Typedefs

typedef struct EvalBuilder EvalBuilder
 
typedef struct EvalOption EvalOption
 

Enumerations

enum  { EVAL_STEEPEST_DESCENT , EVAL_FLETCHER_REEVES , EVAL_POLAK_RIBIERE }
 
enum  { FILTER_NONE , FILTER_SPATIAL , FILTER_TEMPORAL }
 
enum  {
  EVAL_EDAX_v3 , EVAL_EDAX_v5 , EVAL_LOGISTELLO , EVAL_CORNER3x3 ,
  EVAL_CORNER3x3_B , EVAL_CORNER5x2 , EVAL_CORNER6x2 , EVAL_EDGE ,
  EVAL_EDGE_X , EVAL_EDGE_C , EVAL_EDGE_CX , EVAL_EDGE_FG ,
  EVAL_ABFG , EVAL_CC , EVAL_AA , EVAL_BB ,
  EVAL_D8 , EVAL_D7 , EVAL_D6 , EVAL_D5 ,
  EVAL_D4 , EVAL_D3
}
 
enum  { EVAL_ABS_ERROR , EVAL_SQUARED_ERROR , EVAL_KALMAN_ERROR , EVAL_SQUARED_ERROR_WEIGHT }
 

Functions

EvalBuildereval_builder_create (int n_vectors, int *vector_size, int *vector_times, int n_features, int n_games)
 
void eval_builder_destroy (EvalBuilder *eval)
 
void eval_builder_set_ply (EvalBuilder *eval, int ply)
 
void eval_builder_read (EvalBuilder *eval, const char *file)
 
void eval_builder_write (EvalBuilder *eval, const char *file)
 
void eval_builder_logistello_get_features (const Board *b, int *X)
 
void eval_builder_get_corner5x2_features (const Board *b, int *X)
 
void eval_builder_get_corner3x3_features (const Board *b, int *X)
 
void eval_builder_get_edge_features (const Board *b, int *X)
 
void eval_builder_get_edge_X_features (const Board *b, int *X)
 
void eval_builder_get_edge_C_features (const Board *b, int *X)
 
void eval_builder_get_edge_CX_features (const Board *b, int *X)
 
void eval_builder_get_ABFG_features (const Board *b, int *X)
 
void eval_builder_get_edge_FG_features (const Board *b, int *X)
 
void eval_builder_get_CC_features (const Board *b, int *X)
 
void eval_builder_get_AA_features (const Board *b, int *X)
 
void eval_builder_get_BB_features (const Board *b, int *X)
 
void eval_builder_get_d8_features (const Board *b, int *X)
 
void eval_builder_get_d7_features (const Board *b, int *X)
 
void eval_builder_get_d6_features (const Board *b, int *X)
 
void eval_builder_get_d5_features (const Board *b, int *X)
 
void eval_builder_get_d4_features (const Board *b, int *X)
 
void eval_builder_get_d3_features (const Board *b, int *X)
 
EvalBuildereval_builder_create_edax3c (int n_games)
 
EvalBuildereval_builder_create_edax3d (int n_games)
 
EvalBuildereval_builder_create_logistello (int n_games)
 
EvalBuildereval_builder_create_feature (int n_games, int feature)
 
void eval_builder_build_features (EvalBuilder *eval, Gamebase *base, int ply)
 
void eval_builder_equalize (EvalBuilder *eval, double *w)
 
void eval_builder_zero (EvalBuilder *eval, double *w, int *N, int N_min)
 
void eval_builder_eval (EvalBuilder *eval, int ply, double *x, double *y)
 
int eval_builder_count_features (EvalBuilder *eval, int ply)
 
int eval_builder_count_significant_coefficients (EvalBuilder *eval, int ply)
 
void eval_builder_get_feature_frequency (EvalBuilder *eval, int *N)
 
void eval_builder_get_coefficient (EvalBuilder *eval, double *w)
 
void eval_builder_get_score (EvalBuilder *eval, double *y)
 
void eval_builder_set_coefficient (EvalBuilder *eval, double *w)
 
double eval_builder_get_abs_error (EvalBuilder *eval, double *w, double *e)
 
void eval_builder_get_abs_error_gradient (EvalBuilder *eval, double *e, double *g, int *N, int N_min)
 
double eval_builder_get_squared_error (EvalBuilder *eval, double *w, double *e)
 
void eval_builder_get_squared_error_gradient (EvalBuilder *eval, double *e, double *g, int *N, int N_min)
 
double eval_builder_get_dir_squared_error (EvalBuilder *eval, double *w, double *d, double l)
 
double eval_builder_minimize_dir_abs_error (EvalBuilder *eval, double *w, double *d)
 
double eval_builder_minimize_dir_squared_error (EvalBuilder *eval, double *w, double *d)
 
double eval_builder_minimize_dir_squared_error_using_brent (EvalBuilder *eval, double *w, double *d, double accuracy)
 
int eval_builder_conjugate_gradient (EvalBuilder *eval, int ply, EvalOption *option)
 
void eval_builder_build (EvalBuilder *eval, Gamebase *base, EvalOption *option)
 
void eval_builder_temporal_filter (EvalBuilder *eval, Gamebase *base, int max_iter, double accuracy)
 
void print_feature (int n, int i)
 
void eval_builder_get_feature (int n, int offset, int *feature)
 
void eval_builder_get_sub_features (int n, int offset, int feature, int **subfeature, int *P, int *L)
 
void eval_builder_spatial_filter (EvalBuilder *eval, Gamebase *base, int max_iter, double accuracy)
 
void eval_builder_equalize_all (EvalBuilder *eval)
 
void eval_builder_zero_rare_features (EvalBuilder *eval, Gamebase *base)
 
void eval_builder_merge (EvalBuilder *eval_1, EvalBuilder *eval_2, int split)
 
void eval_builder_unbias (EvalBuilder *eval, Gamebase *base, int error_type)
 
void eval_builder_stat (EvalBuilder *eval, Gamebase *base)
 
void eval_builder_diff (EvalBuilder *eval_1, EvalBuilder *eval_2)
 
void eval_builder_plot (EvalBuilder *eval, Gamebase *base, const char *plot_file)
 
void eval_builder_show_feature_weights (EvalBuilder *eval, int type, const char *feature)
 
void print_version (void)
 
void print_usage (void)
 
int main (int argc, char **argv)
 

Variables

int s12 [2][531441]
 
int s10 [2][59049]
 
int c10 [2][59049]
 
int i10 [2][59049]
 
int c9 [2][19683]
 
int s8 [2][6561]
 
int s7 [2][2187]
 
int s6 [2][729]
 
int s5 [2][243]
 
int s4 [2][81]
 
int s3 [2][27]
 
int MAX_P =3
 
int MAX_L =12
 
int MIN_SQUARE =3
 

Detailed Description

Set of tools to build evaluation functions This code is not used. This or similar code has been used to build current evaluation function. It will be reused to build a new evaluation function for Edax version 5.0

Date
1998 - 201?
Author
Richard Delorme
Version
5.0

Macro Definition Documentation

◆ EDAX_BUILDER_REGULAR

#define EDAX_BUILDER_REGULAR

◆ EVAL

#define EVAL   0x4556414c

◆ LAVE

#define LAVE   0x4c415645

Typedef Documentation

◆ EvalBuilder

typedef struct EvalBuilder EvalBuilder

◆ EvalOption

typedef struct EvalOption EvalOption

Enumeration Type Documentation

◆ anonymous enum

anonymous enum

filter

Enumerator
FILTER_NONE 
FILTER_SPATIAL 
FILTER_TEMPORAL 

◆ anonymous enum

anonymous enum

evaluation function

Enumerator
EVAL_EDAX_v3 
EVAL_EDAX_v5 
EVAL_LOGISTELLO 
EVAL_CORNER3x3 
EVAL_CORNER3x3_B 
EVAL_CORNER5x2 
EVAL_CORNER6x2 
EVAL_EDGE 
EVAL_EDGE_X 
EVAL_EDGE_C 
EVAL_EDGE_CX 
EVAL_EDGE_FG 
EVAL_ABFG 
EVAL_CC 
EVAL_AA 
EVAL_BB 
EVAL_D8 
EVAL_D7 
EVAL_D6 
EVAL_D5 
EVAL_D4 
EVAL_D3 

◆ anonymous enum

anonymous enum
Enumerator
EVAL_ABS_ERROR 
EVAL_SQUARED_ERROR 
EVAL_KALMAN_ERROR 
EVAL_SQUARED_ERROR_WEIGHT 

◆ anonymous enum

anonymous enum

minimization algorithm

Enumerator
EVAL_STEEPEST_DESCENT 
EVAL_FLETCHER_REEVES 
EVAL_POLAK_RIBIERE 

Function Documentation

◆ eval_builder_build()

void eval_builder_build ( EvalBuilder eval,
Gamebase *  base,
EvalOption option 
)

◆ eval_builder_build_features()

void eval_builder_build_features ( EvalBuilder eval,
Gamebase *  base,
int  ply 
)

◆ eval_builder_conjugate_gradient()

int eval_builder_conjugate_gradient ( EvalBuilder eval,
int  ply,
EvalOption option 
)

◆ eval_builder_count_features()

int eval_builder_count_features ( EvalBuilder eval,
int  ply 
)

◆ eval_builder_count_significant_coefficients()

int eval_builder_count_significant_coefficients ( EvalBuilder eval,
int  ply 
)

◆ eval_builder_create()

EvalBuilder * eval_builder_create ( int  n_vectors,
int *  vector_size,
int *  vector_times,
int  n_features,
int  n_games 
)

◆ eval_builder_create_edax3c()

EvalBuilder * eval_builder_create_edax3c ( int  n_games)

◆ eval_builder_create_edax3d()

EvalBuilder * eval_builder_create_edax3d ( int  n_games)

◆ eval_builder_create_feature()

EvalBuilder * eval_builder_create_feature ( int  n_games,
int  feature 
)

◆ eval_builder_create_logistello()

EvalBuilder * eval_builder_create_logistello ( int  n_games)

◆ eval_builder_destroy()

void eval_builder_destroy ( EvalBuilder eval)

◆ eval_builder_diff()

void eval_builder_diff ( EvalBuilder eval_1,
EvalBuilder eval_2 
)

◆ eval_builder_equalize()

void eval_builder_equalize ( EvalBuilder eval,
double *  w 
)

◆ eval_builder_equalize_all()

void eval_builder_equalize_all ( EvalBuilder eval)

◆ eval_builder_eval()

void eval_builder_eval ( EvalBuilder eval,
int  ply,
double *  x,
double *  y 
)

◆ eval_builder_get_AA_features()

void eval_builder_get_AA_features ( const Board b,
int *  X 
)

◆ eval_builder_get_ABFG_features()

void eval_builder_get_ABFG_features ( const Board b,
int *  X 
)

◆ eval_builder_get_abs_error()

double eval_builder_get_abs_error ( EvalBuilder eval,
double *  w,
double *  e 
)

◆ eval_builder_get_abs_error_gradient()

void eval_builder_get_abs_error_gradient ( EvalBuilder eval,
double *  e,
double *  g,
int *  N,
int  N_min 
)

◆ eval_builder_get_BB_features()

void eval_builder_get_BB_features ( const Board b,
int *  X 
)

◆ eval_builder_get_CC_features()

void eval_builder_get_CC_features ( const Board b,
int *  X 
)

◆ eval_builder_get_coefficient()

void eval_builder_get_coefficient ( EvalBuilder eval,
double *  w 
)

◆ eval_builder_get_corner3x3_features()

void eval_builder_get_corner3x3_features ( const Board b,
int *  X 
)

◆ eval_builder_get_corner5x2_features()

void eval_builder_get_corner5x2_features ( const Board b,
int *  X 
)

◆ eval_builder_get_d3_features()

void eval_builder_get_d3_features ( const Board b,
int *  X 
)

◆ eval_builder_get_d4_features()

void eval_builder_get_d4_features ( const Board b,
int *  X 
)

◆ eval_builder_get_d5_features()

void eval_builder_get_d5_features ( const Board b,
int *  X 
)

◆ eval_builder_get_d6_features()

void eval_builder_get_d6_features ( const Board b,
int *  X 
)

◆ eval_builder_get_d7_features()

void eval_builder_get_d7_features ( const Board b,
int *  X 
)

◆ eval_builder_get_d8_features()

void eval_builder_get_d8_features ( const Board b,
int *  X 
)

◆ eval_builder_get_dir_squared_error()

double eval_builder_get_dir_squared_error ( EvalBuilder eval,
double *  w,
double *  d,
double  l 
)

◆ eval_builder_get_edge_C_features()

void eval_builder_get_edge_C_features ( const Board b,
int *  X 
)

◆ eval_builder_get_edge_CX_features()

void eval_builder_get_edge_CX_features ( const Board b,
int *  X 
)

◆ eval_builder_get_edge_features()

void eval_builder_get_edge_features ( const Board b,
int *  X 
)

◆ eval_builder_get_edge_FG_features()

void eval_builder_get_edge_FG_features ( const Board b,
int *  X 
)

◆ eval_builder_get_edge_X_features()

void eval_builder_get_edge_X_features ( const Board b,
int *  X 
)

◆ eval_builder_get_feature()

void eval_builder_get_feature ( int  n,
int  offset,
int *  feature 
)

◆ eval_builder_get_feature_frequency()

void eval_builder_get_feature_frequency ( EvalBuilder eval,
int *  N 
)

◆ eval_builder_get_score()

void eval_builder_get_score ( EvalBuilder eval,
double *  y 
)

◆ eval_builder_get_squared_error()

double eval_builder_get_squared_error ( EvalBuilder eval,
double *  w,
double *  e 
)

◆ eval_builder_get_squared_error_gradient()

void eval_builder_get_squared_error_gradient ( EvalBuilder eval,
double *  e,
double *  g,
int *  N,
int  N_min 
)

◆ eval_builder_get_sub_features()

void eval_builder_get_sub_features ( int  n,
int  offset,
int  feature,
int **  subfeature,
int *  P,
int *  L 
)

◆ eval_builder_logistello_get_features()

void eval_builder_logistello_get_features ( const Board b,
int *  X 
)

◆ eval_builder_merge()

void eval_builder_merge ( EvalBuilder eval_1,
EvalBuilder eval_2,
int  split 
)

◆ eval_builder_minimize_dir_abs_error()

double eval_builder_minimize_dir_abs_error ( EvalBuilder eval,
double *  w,
double *  d 
)

◆ eval_builder_minimize_dir_squared_error()

double eval_builder_minimize_dir_squared_error ( EvalBuilder eval,
double *  w,
double *  d 
)

◆ eval_builder_minimize_dir_squared_error_using_brent()

double eval_builder_minimize_dir_squared_error_using_brent ( EvalBuilder eval,
double *  w,
double *  d,
double  accuracy 
)

◆ eval_builder_plot()

void eval_builder_plot ( EvalBuilder eval,
Gamebase *  base,
const char *  plot_file 
)

◆ eval_builder_read()

void eval_builder_read ( EvalBuilder eval,
const char *  file 
)

◆ eval_builder_set_coefficient()

void eval_builder_set_coefficient ( EvalBuilder eval,
double *  w 
)

◆ eval_builder_set_ply()

void eval_builder_set_ply ( EvalBuilder eval,
int  ply 
)

◆ eval_builder_show_feature_weights()

void eval_builder_show_feature_weights ( EvalBuilder eval,
int  type,
const char *  feature 
)

◆ eval_builder_spatial_filter()

void eval_builder_spatial_filter ( EvalBuilder eval,
Gamebase *  base,
int  max_iter,
double  accuracy 
)

◆ eval_builder_stat()

void eval_builder_stat ( EvalBuilder eval,
Gamebase *  base 
)

◆ eval_builder_temporal_filter()

void eval_builder_temporal_filter ( EvalBuilder eval,
Gamebase *  base,
int  max_iter,
double  accuracy 
)

◆ eval_builder_unbias()

void eval_builder_unbias ( EvalBuilder eval,
Gamebase *  base,
int  error_type 
)

◆ eval_builder_write()

void eval_builder_write ( EvalBuilder eval,
const char *  file 
)

◆ eval_builder_zero()

void eval_builder_zero ( EvalBuilder eval,
double *  w,
int *  N,
int  N_min 
)

◆ eval_builder_zero_rare_features()

void eval_builder_zero_rare_features ( EvalBuilder eval,
Gamebase *  base 
)

◆ main()

int main ( int  argc,
char **  argv 
)

◆ print_feature()

void print_feature ( int  n,
int  i 
)

◆ print_usage()

void print_usage ( void  )

◆ print_version()

void print_version ( void  )

Variable Documentation

◆ c10

int c10[2][59049]

◆ c9

int c9[2][19683]

◆ i10

int i10[2][59049]

◆ MAX_L

int MAX_L =12

◆ MAX_P

int MAX_P =3

◆ MIN_SQUARE

int MIN_SQUARE =3

◆ s10

int s10[2][59049]

◆ s12

int s12

◆ s3

int s3[2][27]

◆ s4

int s4[2][81]

◆ s5

int s5[2][243]

◆ s6

int s6[2][729]

◆ s7

int s7[2][2187]

◆ s8

int s8[2][6561]