Search Algorithm

Discussion about development of draughts in the time of computer and Internet.
Post Reply
Joost Buijs
Posts: 471
Joined: Wed May 04, 2016 11:45
Real name: Joost Buijs

Re: Search Algorithm

Post by Joost Buijs » Mon Dec 26, 2016 18:05

Ed Gilbert wrote:
Another problem is how to tune the evaluation function, usually you need win/loss information but if all games you play are drawn there is not much information you will get out of this.
I used games played at very fast TC, around 0.1 sec/mv. With those quick searches there are more mistakes made. I think around 20% of the games were decisive.
Indeed, this is what was thinking about as well, when you play enough games you will at least get some statistical information, but bootstrapping does not work anymore when your program reaches the level 'draws only'.

Another possibility is to start the games from a database of positions containing all positions to a certain depth including the bad ones that are not likely to appear during normal game-play, maybe this is even better, I guess this looks a bit like what Fabien does.

Ed Gilbert
Posts: 859
Joined: Sat Apr 28, 2007 14:53
Real name: Ed Gilbert
Location: Morristown, NJ USA
Contact:

Re: Search Algorithm

Post by Ed Gilbert » Mon Dec 26, 2016 18:22

Another possibility is to start the games from a database of positions containing all positions to a certain depth including the bad ones that are not likely to appear during normal game-play, maybe this is even better, I guess this looks a bit like what Fabien does.
I had forgotten, but I did this also. It no doubt contributed to the ~20% decisive games. I eliminated the start positions that lose a man immediately, but there were still many where one side looks to be at a decided disadvantage.

Joost Buijs
Posts: 471
Joined: Wed May 04, 2016 11:45
Real name: Joost Buijs

Re: Search Algorithm

Post by Joost Buijs » Wed Dec 28, 2016 23:07

Last 24 hours I ran a test with my engine of 300 2 min. 90 move. games against Kingsrow (both without egdb) and I can estimate that the Elo of my engine is approx. 85 Elo below Kingsrow v1.58. Although my engine seems to calculate 2 to 3 times as much nodes in the same time there is still a lack of depth, in the early game stage Kingsrow calculates 2 to 3 plies deeper, later during the endgame this is reversed though but then it is in several cases already too late, I guess I have to work on better move ordering and better pruning to get the branching factor down.

First I have to write a module that will enable me to play very fast games between 2 different versions of my engine, otherwise it is undoable to tune the search and evaluation parameters. So enough to do for the coming days.

Yves
Posts: 41
Joined: Sat Feb 20, 2016 14:00

Re: Search Algorithm

Post by Yves » Sat Dec 31, 2016 20:03

First I have to write a module that will enable me to play very fast games between 2 different versions of my engine, otherwise it is undoable to tune the search and evaluation parameters. So enough to do for the coming days.[/quote]

Hi Joost
For info, here is the result of the 8 games played with Argus in DXP against
Scan, Truus, Flits, Kingsrow, Dragon, Mobydam, Tornado, and Horizon. :D
Attachments
Games.zip
(9.02 KiB) Downloaded 362 times

Joost Buijs
Posts: 471
Joined: Wed May 04, 2016 11:45
Real name: Joost Buijs

Re: Search Algorithm

Post by Joost Buijs » Sun Jan 01, 2017 13:37

Yves wrote: Hi Joost
For info, here is the result of the 8 games played with Argus in DXP against
Scan, Truus, Flits, Kingsrow, Dragon, Mobydam, Tornado, and Horizon. :D
Hi,

First of all Happy new Year everybody!

Thanks for running the games, I will take a look at them!

I wonder how you were able to get the engine? I gave the source to Bert to play with but I asked him not to distribute the engine because it is very premature and lacks many things and contains several bugs.

Did you use a version compiled for BMI2 or the other one where BMI2 is emulated in software which is about 3 times as slow? I still have to write faster emulation routines for PEXT and PDEP that will hopefully bring back the slowdown to a factor of 2 or less.

The last few days I fixed several bugs and tuned the search somewhat better, this morning I ran a (1 min. 90 moves) match of 100 games between Kingsrow and my engine (I don't know how to use other engines) and the result for Kingsrow is: 11 wins, 3 losses and 86 draws, for my engine this is 46% or roughly -28 Elo.

I don't know how to upload games here but you can download them from dropbox:
https://www.dropbox.com/s/e4wgynu5qxtwg ... 1.rar?dl=0

Joost

Yves
Posts: 41
Joined: Sat Feb 20, 2016 14:00

Re: Search Algorithm

Post by Yves » Sun Jan 01, 2017 17:16

Joost Buijs wrote:
Yves wrote: Hi Joost
For info, here is the result of the 8 games played with Argus in DXP against
Scan, Truus, Flits, Kingsrow, Dragon, Mobydam, Tornado, and Horizon. :D
Hi,

First of all Happy new Year everybody!

Thanks for running the games, I will take a look at them!

I wonder how you were able to get the engine? I gave the source to Bert to play with but I asked him not to distribute the engine because it is very premature and lacks many things and contains several bugs.

Did you use a version compiled for BMI2 or the other one where BMI2 is emulated in software which is about 3 times as slow? I still have to write faster emulation routines for PEXT and PDEP that will hopefully bring back the slowdown to a factor of 2 or less.

The last few days I fixed several bugs and tuned the search somewhat better, this morning I ran a (1 min. 90 moves) match of 100 games between Kingsrow and my engine (I don't know how to use other engines) and the result for Kingsrow is: 11 wins, 3 losses and 86 draws, for my engine this is 46% or roughly -28 Elo.

I don't know how to upload games here but you can download them from dropbox:
https://www.dropbox.com/s/e4wgynu5qxtwg ... 1.rar?dl=0

Joost



Happy New Year everyone!

Hi, Joost

I wonder how you were able to get the engine? I gave the source to Bert to play with but I asked him not to distribute the engine because it is very premature and lacks many things and contains several bugs.

Sorry, I found the random version yesterday in Damage GUI your dropbox: https://www.dropbox.com/sh/u1nekyp94kjz ... bZbka?dl=0

Did you use a version compiled for BMI2 or the other one where BMI2 is emulated in software which is about 3 times as slow? I still have to write faster emulation routines for PEXT and PDEP that will hopefully bring back the slowdown to a factor of 2 or less.

Argus played the games with the Damage interface that works just fine.

Yves

Joost Buijs
Posts: 471
Joined: Wed May 04, 2016 11:45
Real name: Joost Buijs

Re: Search Algorithm

Post by Joost Buijs » Sun Jan 01, 2017 19:48

Yves wrote: Sorry, I found the random version yesterday in Damage GUI your dropbox: https://www.dropbox.com/sh/u1nekyp94kjz ... bZbka?dl=0


I guess it was a dropbox link from Bert because I've never put a Damage GUI on dropbox.
Bert added a simple version of HUB to it, that is why it was able to work with the Damage GUI.
When the 1.0 version of the engine is finished I will release it, but this will take at least a few months, there are still so many things that need to be improved, an engine is in the contrary to a GUI never finished, you can keep working on it for the rest of your life. :mrgreen:

Joost

Yves
Posts: 41
Joined: Sat Feb 20, 2016 14:00

Re: Search Algorithm

Post by Yves » Tue Jan 03, 2017 16:59

Joost Buijs wrote:
Yves wrote: Sorry, I found the random version yesterday in Damage GUI your dropbox: https://www.dropbox.com/sh/u1nekyp94kjz ... bZbka?dl=0


I guess it was a dropbox link from Bert because I've never put a Damage GUI on dropbox.
Bert added a simple version of HUB to it, that is why it was able to work with the Damage GUI.
When the 1.0 version of the engine is finished I will release it, but this will take at least a few months, there are still so many things that need to be improved, an engine is in the contrary to a GUI never finished, you can keep working on it for the rest of your life. :mrgreen:

Joost
Thank you for those few words of sympathy.
My life is not just a game of draughts.
I only did one engine test available with the Damage interface.
Sorry to know that a simple test could be a problem.
The application will be deleted from my PC.
Have a good day.

Joost Buijs
Posts: 471
Joined: Wed May 04, 2016 11:45
Real name: Joost Buijs

Re: Search Algorithm

Post by Joost Buijs » Tue Jan 03, 2017 17:48

Yves wrote:
Joost Buijs wrote:
Yves wrote: Sorry, I found the random version yesterday in Damage GUI your dropbox: https://www.dropbox.com/sh/u1nekyp94kjz ... bZbka?dl=0


I guess it was a dropbox link from Bert because I've never put a Damage GUI on dropbox.
Bert added a simple version of HUB to it, that is why it was able to work with the Damage GUI.
When the 1.0 version of the engine is finished I will release it, but this will take at least a few months, there are still so many things that need to be improved, an engine is in the contrary to a GUI never finished, you can keep working on it for the rest of your life. :mrgreen:

Joost
Thank you for those few words of sympathy.
My life is not just a game of draughts.
I only did one engine test available with the Damage interface.
Sorry to know that a simple test could be a problem.
The application will be deleted from my PC.
Have a good day.
It seems you are making more of a problem out of it than I did, I was only surprised that you somehow got the engine and that mystery was solved.

Joost

Ed Gilbert
Posts: 859
Joined: Sat Apr 28, 2007 14:53
Real name: Ed Gilbert
Location: Morristown, NJ USA
Contact:

Sorting moves in qsearch

Post by Ed Gilbert » Wed Jan 04, 2017 13:43

I have a general question about what others are doing in qsearch. I tried to improve the qsearch in my English checkers program recently, but didn't get the results I expected. Because of the way I structured the search many years ago, it does not have a separate qsearch function. It's all done as portions of one search function, by taking different paths when depth <= 0. There is no hashtable probing or search reductions, but most other things still occur, such as repetition draw detection, egdb probing, and move sorting based on history and killers. So I thought, because it would be more efficient to move this into a separate qsearch function which could avoid multiple branches that now skip hashtable probing and storing, IID, LMR and other reductions, this should be faster. I also skipped history and killer table lookups and sorting of the movelist in this new qsearch function, so that is the primary functional difference between the original and new code. My results with the new qsearch function are that the search is about 25% faster in pure nodes/sec, but it tests a little worse in engine matches. Since the main difference is that my new qsearch no longer does movelist sorting, I'm guessing that is the reason. So I'm wondering if any of the other programmers have experience with sorting or not sorting the movelists in qsearch. I expect this also depends on what moves are searched in qsearch. If only captures are extended then probably the movelists are short and not worth sorting, but when non-side captures occur, those are just typical non-capture movelists.

-- Ed

edit: I forgot to describe, my qsearch extends on captures and non-side captures, and nothing else. When I say non-side captures, I mean that I reverse the side-to-move, and if that board position has captures then I generate a full movelist for the original board and extend the search for all the moves in the list.

Fabien Letouzey
Posts: 299
Joined: Tue Jul 07, 2015 07:48
Real name: Fabien Letouzey

Re: Sorting moves in qsearch

Post by Fabien Letouzey » Thu Jan 05, 2017 08:01

Hi Ed,
Ed Gilbert wrote:I expect this also depends on what moves are searched in qsearch. If only captures are extended then probably the movelists are short and not worth sorting, but when non-side captures occur, those are just typical non-capture movelists.
Try calling the main search with one ply left for the non-side captures. Alternatively, you can capitalize on the single-search implementation and selectively test heuristics (such as TT and MO) depending on the position type. This feels like overkill, though.

Fabien.

Joost Buijs
Posts: 471
Joined: Wed May 04, 2016 11:45
Real name: Joost Buijs

Re: Sorting moves in qsearch

Post by Joost Buijs » Thu Jan 05, 2017 17:37

Ed Gilbert wrote:I have a general question about what others are doing in qsearch. I tried to improve the qsearch in my English checkers program recently, but didn't get the results I expected. Because of the way I structured the search many years ago, it does not have a separate qsearch function. It's all done as portions of one search function, by taking different paths when depth <= 0. There is no hashtable probing or search reductions, but most other things still occur, such as repetition draw detection, egdb probing, and move sorting based on history and killers. So I thought, because it would be more efficient to move this into a separate qsearch function which could avoid multiple branches that now skip hashtable probing and storing, IID, LMR and other reductions, this should be faster. I also skipped history and killer table lookups and sorting of the movelist in this new qsearch function, so that is the primary functional difference between the original and new code. My results with the new qsearch function are that the search is about 25% faster in pure nodes/sec, but it tests a little worse in engine matches. Since the main difference is that my new qsearch no longer does movelist sorting, I'm guessing that is the reason. So I'm wondering if any of the other programmers have experience with sorting or not sorting the movelists in qsearch. I expect this also depends on what moves are searched in qsearch. If only captures are extended then probably the movelists are short and not worth sorting, but when non-side captures occur, those are just typical non-capture movelists.
To keep it fast I try to keep qsearch as simple as possible, I only sort at rank and try to move with the most advanced man first, this is accomplished by the move-generator. I don't probe the hash-table in quiescence, updating and probing the hash-table is very costly and slows down my program to a crawl, another problem is that the hash-table gets overloaded very quickly when you stuff 100 million nodes/sec. into it. The moves that I search in quiescence are captures, promotions and moves that trigger a non losing exchange and maybe I will add moves with the foremost man when it is free to move (like moves with an advanced passed pawn in chess). This scheme looks very much like what Fabien is doing, I did almost the same in my 1992 engine, it is a bit top heavy sometimes but it seems to work fine. Since most moves in quiescence are non reversible I check in the last version of my engine only at depth zero for repetitions and in this case there is no need to update the Zobrist hash in quiescence which gives it another small boost.

When I enable your EGDB (in quiescence) I only use non cached data in the PV and at non PV nodes I only use cached data, this helps to keep the slowdown in the order of a factor of 2.

Joost

Joost Buijs
Posts: 471
Joined: Wed May 04, 2016 11:45
Real name: Joost Buijs

Re: Search Algorithm

Post by Joost Buijs » Fri Jan 06, 2017 13:56

After fixing several small bugs and optimizing a few things I tried another 50 game match against Kingsrow.
The conditions were: no book, no egdb, 1 min. and 90 moves for the whole game, Kingsrow on 8 cores and my engine on 10.
The final result for Kingsrow is 7 wins, 3 losses, 39 draws and 1 unknown (draw), my engine scored 46% or -28 Elo which is exactly the same as in the previous match.

I guess I have to add a means to have my engine play many fast games against itself to determine whether it is improving or not.
First I want to start working on a better interface, a decent time-control (now it plays a more or less fixed time per move) and I want to add pondering.

The games can be downloaded here: https://www.dropbox.com/s/7hqhc1qh7ob66 ... 2.rar?dl=0

Joost

Joost Buijs
Posts: 471
Joined: Wed May 04, 2016 11:45
Real name: Joost Buijs

Re: Sorting moves in qsearch

Post by Joost Buijs » Fri Jan 06, 2017 15:25

Ed Gilbert wrote: edit: I forgot to describe, my qsearch extends on captures and non-side captures, and nothing else. When I say non-side captures, I mean that I reverse the side-to-move, and if that board position has captures then I generate a full movelist for the original board and extend the search for all the moves in the list.
I tried several times to extend my qsearch on non-side captures by generating the full movelist for the side to move, although it doesn't hurt playing strength by much it dominates the search completely, the overall depth decreases by almost 5 plies during the opening phase. Maybe I have to add some kind of pruning mechanism to my qsearch to keep it from exploding too much. At the moment I terminate qsearch when the side to move has no captures, no promotions and cannot trigger an exchange sequence, and that is already consuming a lot of time.

Joost

Ed Gilbert
Posts: 859
Joined: Sat Apr 28, 2007 14:53
Real name: Ed Gilbert
Location: Morristown, NJ USA
Contact:

Re: Search Algorithm

Post by Ed Gilbert » Fri Jan 06, 2017 15:45

I've been trying various changes, but everything tests around 48% against the baseline version that has the qsearch integrated into the main search. Instead of extending all the moves when there is a non-side capture, I tried extending only the ones that actually do lead to a capture position. This makes more sense to me and eliminated some of the explosion of qsearch nodes, but it tested the same as extending all the moves. Of course I might have a bug, but qsearch is pretty simple, and hard to imagine what could be wrong. I'm playing around 2500 games at 0.5sec increment for each test.
The moves that I search in quiescence are captures, promotions and moves that trigger a non losing exchange and maybe I will add moves with the foremost man when it is free to move (like moves with an advanced passed pawn in chess).
How do you test that a move triggers a non-losing exchange without actually making the move and reply captures (to test the non-losing)? I don't extend moves that lead to a capture if the static eval is already outside a window of 200 (2 men) from alpha or beta. I'm looking at English checkers now, but I also do something similar in 10x10.

-- Ed

Post Reply