[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[gnugo-devel] a script that can potentially be used in move ordering tu
From: |
Paul Pogonyshev |
Subject: |
[gnugo-devel] a script that can potentially be used in move ordering tuning |
Date: |
Wed, 30 Apr 2003 00:51:44 -0400 |
User-agent: |
KMail/1.5.9 |
i tried to use the attached script to tune move ordering. the technique
is very same to the one used in dfa optimization. however, here it is
horribly slow and doesn't give good results (some reduction is possible
but i was unable to eliminate regression breakage).
in case anyone is going to give it a try, here are some advices:
- don't use the default reading.tst for tuning, use test files with
gg_genmove's (one decently large or several cat'ed together, don't
forget to remove reset_reading_node_counter lines)
- do change the output of the script by hands. some changes are
stupid even if on overall they might give an improvement.
the patch below is necessary for the script to work. the patch should
probably go in cvs anyway. the script may be placed in regression/ or
left in mailing list archive.
Paul
Index: engine/liberty.h
===================================================================
RCS file: /cvsroot/gnugo/gnugo/engine/liberty.h,v
retrieving revision 1.164
diff -u -p -r1.164 liberty.h
--- engine/liberty.h 22 Apr 2003 02:48:04 -0000 1.164
+++ engine/liberty.h 29 Apr 2003 21:35:34 -0000
@@ -320,7 +320,8 @@ int restricted_attack2(int str, int *mov
int simple_ladder(int str, int *move);
#define MOVE_ORDERING_PARAMETERS 67
-void tune_move_ordering(int params[MOVE_ORDERING_PARAMETERS]);
+void tune_move_ordering(const int params[MOVE_ORDERING_PARAMETERS]);
+void get_move_ordering_parameters(int params[MOVE_ORDERING_PARAMETERS]);
void draw_reading_shadow(void);
/* persistent.c */
Index: engine/reading.c
===================================================================
RCS file: /cvsroot/gnugo/gnugo/engine/reading.c,v
retrieving revision 1.112
diff -u -p -r1.112 reading.c
--- engine/reading.c 22 Apr 2003 15:44:44 -0000 1.112
+++ engine/reading.c 29 Apr 2003 21:36:11 -0000
@@ -5224,7 +5228,7 @@ order_moves(int str, struct reading_move
/* Set new values for the move ordering parameters. */
void
-tune_move_ordering(int params[MOVE_ORDERING_PARAMETERS])
+tune_move_ordering(const int params[MOVE_ORDERING_PARAMETERS])
{
int k;
for (k = 0; k < 6; k++) {
@@ -5303,6 +5307,36 @@ tune_move_ordering(int params[MOVE_ORDER
}
}
+
+/* Get the current values of the move ordering parameters. */
+void
+get_move_ordering_parameters(int params[MOVE_ORDERING_PARAMETERS])
+{
+ int k;
+
+ for (k = 0; k < 6; k++) {
+ params[k] = defend_lib_score[k];
+ if (k < 5)
+ params[k + 6] = defend_not_adjacent_lib_score[k];
+ params[k + 11] = defend_capture_score[k];
+ params[k + 17] = defend_atari_score[k];
+ params[k + 23] = defend_save_score[k];
+ if (k < 5) {
+ params[k + 29] = defend_open_score[k];
+ params[k + 34] = attack_own_lib_score[k];
+ }
+ params[k + 39] = attack_string_lib_score[k];
+ params[k + 45] = attack_capture_score[k];
+ params[k + 51] = attack_save_score[k];
+ if (k < 5)
+ params[k + 57] = attack_open_score[k];
+ }
+ params[62] = defend_not_edge_score;
+ params[63] = attack_not_edge_score;
+ params[64] = attack_ko_score;
+ params[65] = cannot_defend_penalty;
+ params[66] = safe_atari_score;
+}
/* ================================================================ */
Index: interface/play_gtp.c
===================================================================
RCS file: /cvsroot/gnugo/gnugo/interface/play_gtp.c,v
retrieving revision 1.115
diff -u -p -r1.115 play_gtp.c
--- interface/play_gtp.c 22 Apr 2003 02:48:05 -0000 1.115
+++ interface/play_gtp.c 29 Apr 2003 21:36:20 -0000
@@ -159,6 +159,7 @@ DECLARE(gtp_top_moves_black);
DECLARE(gtp_trymove);
DECLARE(gtp_tryko);
DECLARE(gtp_tune_move_ordering);
+DECLARE(gtp_get_move_ordering_parameters);
DECLARE(gtp_undo);
DECLARE(gtp_program_version);
DECLARE(gtp_what_color);
@@ -278,6 +279,7 @@ static struct gtp_command commands[] = {
{"trymove", gtp_trymove},
{"tryko", gtp_tryko},
{"tune_move_ordering", gtp_tune_move_ordering},
+ {"get_move_ordering_parameters", gtp_get_move_ordering_parameters},
{"undo", gtp_undo},
{"version", gtp_program_version},
{"white", gtp_playwhite},
@@ -1114,6 +1116,7 @@ static int
gtp_clear_cache(char *s)
{
UNUSED(s);
+ reading_cache_clear();
clear_persistent_reading_cache();
clear_persistent_owl_cache();
return gtp_success("");
@@ -3423,6 +3426,32 @@ gtp_tune_move_ordering(char *s)
return gtp_success("");
}
+
+/* Function: Get the current list of tactical reading move ordering
parameters.
+ * Arguments: none
+ * Fails: never
+ * Returns: MOVE_ORDERING_PARAMETERS integers
+ */
+static int
+gtp_get_move_ordering_parameters(char *s)
+{
+ int params[MOVE_ORDERING_PARAMETERS];
+ int k;
+ UNUSED(s);
+
+ get_move_ordering_parameters(params);
+
+ gtp_start_response(GTP_SUCCESS);
+ for (k = 0; k < MOVE_ORDERING_PARAMETERS; k++) {
+ if (k > 0)
+ gtp_printf(" ");
+ gtp_printf("%d", params[k]);
+ }
+
+ return gtp_finish_response();
+}
+
+
/* Function: Echo the parameter
* Arguments: string
* Fails: never
@@ -3448,6 +3477,7 @@ gtp_echo_err(char *s)
fflush(stderr);
return gtp_success("%s", s);
}
+
/* Function: List all known commands
* Arguments: none
moveordering
Description: Text Data
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [gnugo-devel] a script that can potentially be used in move ordering tuning,
Paul Pogonyshev <=