Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

lz_analyze fixes #135

Merged
merged 13 commits into from
May 19, 2020
Merged

lz_analyze fixes #135

merged 13 commits into from
May 19, 2020

Conversation

lemonsqueeze
Copy link
Collaborator

Fix for issue #134 and cleanup / sanity checks:

  • Handle lz-analyze <color> <freq> syntax for Sabaki
  • uct genmove / genmove_analyze: handle non-alternating play
  • lz-analyze: make sure dcnn is evaluated for root node

@lemonsqueeze lemonsqueeze force-pushed the lz_analyze_fix branch 4 times, most recently from 70f661f to 19c0928 Compare May 4, 2020 11:34
@lemonsqueeze lemonsqueeze force-pushed the lz_analyze_fix branch 2 times, most recently from d797d9d to a32a309 Compare May 12, 2020 08:15
updated doc
renamed spawn_worker()         -> worker_thread()
        spawn_thread_manager() -> thread_manager()
	spawn_logger()         -> logger_thread()
which is only valid if last move exists but half of the time we forget to check ...
can genmove b, genmove b now
works for lz-genmove_analyze too
Sabaki uses this
handle switching color to play
final newline early on confuses sabaki,
lz-analyze should just output "= \n" at first,
and send final newline when next command comes in.
leela-zero does this too

need to flush stream too otherwise hanging issue when tree overflows
gtp.c keeps track if we are in analyze mode or genmove mode.

Reset engine when switching from analyze mode <-> genmove move only.
This way we don't lose analyze state when toggling analyze on and off.
We don't want analyze tree to affect next genmove either.
if playing by time settings and we're asked to analyze after
a play command timer will be running the whole time since play
command starts the timer. by the time next genmove comes in
we're out of time:

  genmove b
  play w d4
  lz-analyze b 50
<wait>
  genmove b

so reset timer when switching back to genmove mode
@lemonsqueeze
Copy link
Collaborator Author

Getting ready, should be much better now:

  • Handle lz-analyze <color> <freq> syntax for Sabaki
  • Handle non-alternating play
  • Fixed hanging issues in Sabaki
  • Keep state when toggling analyze on/off
  • Handle pondering + analyzing
  • Fixed tree garbage collection issues when analyzing

uct:
  pondering + analyzing: just resume pondering with analyze-style output
  and resume normal pondering when told to stop analyzing.
  finish expanding dcnn nodes if we were interrupted.

gtp:
  normal:    reset engine when switching from analyze mode -> genmove mode
             analyze tree shouldn't affect next genmove.
  pondering: don't reset !
             engine handles switching from pondering <-> pondering + analyzing */
until now uct_pondering_start() always garbage collected the tree when pondering if needed.
need a way to turn it off: don't want garbage collection to happen when we resume analyzing
otherwise we lose much of the search tree.

if you want tree garbage collection:

    u->pondering_want_gc = true
    uct_pondering_start()

otherwise just:

    uct_pondering_start()
@lemonsqueeze lemonsqueeze merged commit 9842094 into pasky:master May 19, 2020
@lemonsqueeze lemonsqueeze deleted the lz_analyze_fix branch December 3, 2022 20:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant