Aspiration window problem

Discussion of chess software programming and technical issues.

Moderators: bob, hgm, Harvey Williamson

Forum rules
This textbox is used to restore diagrams posted with the [d] tag before the upgrade.
sandermvdb
Posts: 160
Joined: Sat Jan 28, 2017 12:29 pm
Location: The Netherlands

Aspiration window problem

Post by sandermvdb » Mon Oct 30, 2017 8:54 pm

My aspiration window gives an advantage of about 15 elo. Still there are certain positions where it is behaving pretty badly. This is one of them:

[d]8/1p3pk1/1q1P1bp1/4P3/n1p1P3/P5P1/1PBQ2K1/8 b - - 0 50

With aspiration enabled, it takes 7 seconds to find the best move, at ply 17.
With aspiration disabled, it takes 0 seconds, at ply 10!

Are there some known issues with aspiration windows and other search techniques? The cpw contains a page about PVS and AW, but if I disable PVS, the problem is still there.

The output while analyzing is below (chess22k-ex has AW disabled).
Very strange that the score with AW enabled goes up again at ply 11...

Code: Select all

chess22k:
 1/6	00:00	 102	4k	+1,03	Bf6xe5
 2/6	00:00	 284	3k	+1,03	Bf6xe5 Bc2xa4
 3/6	00:00	 526	5k	+1,03	Bf6xe5 Bc2xa4 Qb6xd6
 4/7	00:00	 878	7k	+1,03	Bf6xe5 Bc2xa4 Qb6xd6 Qd2xd6
 5/10-	00:00	 3k	20k	+0,83	Bf6xe5 d6-d7 Kg7-g8 d7-d8Q+ Qb6xd8 Qd2xd8+
 5/10-	00:00	 3k	22k	+0,63	Bf6xe5 d6-d7 Kg7-g8 d7-d8Q+ Qb6xd8 Qd2xd8+
 5/10	00:00	 4k	26k	+0,59	Bf6xe5 d6-d7 c4-c3 b2xc3 Be5xc3
 6/11	00:00	 6k	31k	+0,59	Bf6xe5 d6-d7 c4-c3 b2xc3 Be5xc3 d7-d8Q
 7/12	00:00	 10k	48k	+0,59	Bf6xe5 d6-d7 c4-c3 b2xc3 Be5xc3 d7-d8Q Bc3xd2
 8/13-	00:00	 15k	72k	+0,39	Bf6xe5 d6-d7 c4-c3 b2xc3 Be5xc3 Qd2-d5 f7-f6 d7-d8Q
 8/13-	00:00	 19k	87k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 Nc5-d7 Bc2-a4 Nd7xe5 Qc1-d2 f7-f6
 15/28	00:01	 1.626k	821k	-1,29	Bf6-g5 Qd2xg5 Na4-c5 Qg5-c1 Nc5-d7 Bc2-a4 Nd7xe5 Qc1-d2 f7-f6
 16/30	00:02	 2.743k	998k	-1,34	Bf6-g5 Qd2xg5 Na4-c5 Qg5-c1 Nc5-d7 Bc2-a4 Nd7xe5 Qc1-d2 f7-f6
 17/30	00:03	 4.417k	1.142k	-1,10	Bf6-g5 Qd2xg5 Na4-c5 Qg5-c1 Kg7-g8 Bc2-b1 Nc5-d7 e5-e6 f7xe6
 18/32	00:05	 6.904k	1.286k	-1,19	Bf6-g5 Qd2xg5 Na4-c5 Qg5-c1 Nc5-d7 Bc2-a4 Nd7xe5 Qc1-d2 c4-c3
 19/35	00:06	 9.313k	1.364k	-1,12	Bf6-g5 Qd2xg5 Na4-c5 Qg5-c1 Nc5-d7 Bc2-a4 Nd7xe5 Qc1-d2 c4-c3
 20/38	00:08	 12.165k	1.422k	-1,12	Bf6-g5 Qd2xg5 Na4-c5 Qg5-c1 Nc5-d7 Bc2-a4 Nd7xe5 Qc1-d2 c4-c3



Michael Sherwin
Posts: 3196
Joined: Fri May 26, 2006 1:00 am
Location: WY, USA
Full name: Michael Sherwin

Re: Aspiration window problem

Post by Michael Sherwin » Mon Oct 30, 2017 9:09 pm

Aspiration window should affect the time a search takes, not the result. If a search with an aspiration window falls outside the window the search is done with a bigger window or a full window until the result is inside the window. If your search is returning different results depending on if the window is deactivated or not then that reveals a bug.

Edit: Try clearing the hash before to see if it is a hash problem.
If you are on a sidewalk and the covid goes beep beep
Just step aside or you might have a bit of heat
Covid covid runs through the town all day
Can the people ever change their ways
Sherwin the covid's after you
Sherwin if it catches you you're through

elpapa
Posts: 203
Joined: Sun Jan 18, 2009 10:27 pm
Location: Sweden
Full name: Patrik Karlsson

Re: Aspiration window problem

Post by elpapa » Mon Oct 30, 2017 10:39 pm

Are you sure Bg5 is the best move?

Code: Select all

SF8 depth 39, multiPV=4:

Bxe5 -0.44
Bd8  -1.11
Bg5  -1.68
Nc5  -2.82

sandermvdb
Posts: 160
Joined: Sat Jan 28, 2017 12:29 pm
Location: The Netherlands

Re: Aspiration window problem

Post by sandermvdb » Tue Oct 31, 2017 11:33 am

elpapa wrote:Are you sure Bg5 is the best move?

Code: Select all

SF8 depth 39, multiPV=4:

Bxe5 -0.44
Bd8  -1.11
Bg5  -1.68
Nc5  -2.82
You are right, Bg5 is not the best move.
However it is still strange (bug?) that the outcome of the search is so different when the aspiration window is enabled or disabled: between ply 11-16, AW enabled even thinks it is ahead!

User avatar
hgm
Posts: 24605
Joined: Fri Mar 10, 2006 9:06 am
Location: Amsterdam
Full name: H G Muller
Contact:

Re: Aspiration window problem

Post by hgm » Tue Oct 31, 2017 12:08 pm

Indeed, this is very suspect. I always hate it when things like that happen in my own engines. Debugging it is tedious, and can easily mean a full day of hard work.

Note that with AW the score goes up at 11 ply for another move (Bf6xe5, instead of Bf6-g5). It could very well be that the searches agree on the score of Bg5, but you are sure they must disagree on the score of Bxe5. So the thing you want to know is how the search without AW though it could refute Bxe5. I always do that by priting the list of all searched moves and scores in all the nodes along the path I am interested in. In this case doing that both for the 11-ply search with and without AW, to see how they differ, and then extending the path one ply alog the move that is responsible for the difference.

E.g. at ply level 1 the search without AW must have had a move (say X) which scored above +1.21 after Bxe5; in the search with AW that same move X will certainly have been searched (as this was a PV node there), but cannot have scored better than -1.12. Then you go to comparing the scores in the node after Bxe5, X to see what causes that difference. Typically what was an all-node in one search will be a cut-node in the other, ad the cut-move will have been searched in both cases, and you can follow that. In the end you must come to something that explains the different scores. E.g. the all node could have failed to search the cut-move of the other, because of a bug. Or you got a hash hit in one with an erroneous score, perhaps due to a key collision or a hash bug. Or the moves are searched at different depths due to your extension/reduction scheme. It ca be a lot of work before you have followed the line 11 ply deep. And if you get to a hash hit you would haveto figure out whwre in the tree that hash entry was stored (i.e. the path that led to the node that stored it), and then (after checking this was indeed the same position) proceed stepping through the tree from there.

sandermvdb
Posts: 160
Joined: Sat Jan 28, 2017 12:29 pm
Location: The Netherlands

Re: Aspiration window problem

Post by sandermvdb » Tue Oct 31, 2017 12:41 pm

I just noticed it is related to storing and retrieving upper- and lower-bound scores from the transposition table.

Tx hgm for your debugging approach :)
Investigation continues...

CheckersGuy
Posts: 273
Joined: Wed Aug 24, 2016 7:49 pm

Re: Aspiration window problem

Post by CheckersGuy » Thu Nov 02, 2017 11:44 pm

Hey guys,
I have a question about aspiration search as well and don't want to create another thread about it (Since this one is about aspiration search as well)

The implementation of PVS+ aspiration windows I found on the chessprogramming wiki seems to be a implementation for fail-soft. What`s the difference when implementing aspiration search with a fail-hard-framework ?

Would appreciate an explanation and/or pseudocode

Stan Arts
Posts: 179
Joined: Fri Feb 14, 2014 9:53 pm
Location: the Netherlands

Re: Aspiration window problem

Post by Stan Arts » Fri Nov 03, 2017 10:49 am

CheckersGuy wrote:Hey guys,
I have a question about aspiration search as well and don't want to create another thread about it (Since this one is about aspiration search as well)

The implementation of PVS+ aspiration windows I found on the chessprogramming wiki seems to be a implementation for fail-soft. What`s the difference when implementing aspiration search with a fail-hard-framework ?

Would appreciate an explanation and/or pseudocode
There is no huge difference. But with fail soft you might get a score outside the window and with that a quicker guess as to the range of the new score. Let's say you open up your window in steps and we now find a mate. With fail soft you might return a mate score right away to center your window around saving you a few researches.
In practise as my fail soft engine Nemeton became more complex getting scores back from outside the window became increasingly rare.

Henk
Posts: 6385
Joined: Mon May 27, 2013 8:31 am

Re: Aspiration window problem

Post by Henk » Fri Nov 03, 2017 12:39 pm

Never been able to get aspiration search working correctly. If time is up there is no time for research and a bad move is returned. Trying to correct that never worked for Skipper. Perhaps transposition table got corrupt too by aspiration search (when time is up) I don't know

op12no2
Posts: 349
Joined: Tue Feb 04, 2014 11:25 am
Location: Mumbles, Wales, UK.
Full name: Colin Jenkins
Contact:

Re: Aspiration window problem

Post by op12no2 » Fri Nov 03, 2017 1:58 pm

Henk wrote:Never been able to get aspiration search working correctly. If time is up there is no time for research and a bad move is returned. Trying to correct that never worked for Skipper. Perhaps transposition table got corrupt too by aspiration search (when time is up) I don't know
As I see it, if search returns <= alpha to the ID loop, by implication it didn't update the best move, so it's safe to use that best move if out of time. If search returns > beta it may also have updated the best move, but that seems OK to me.

As long as the TT holds the value type alpna, exact or beta then it should not get 'corrupt'; you just need to make the appropriate tests to use the TT value. e.g. if the TT says alpha x and x <= current alpha then bingo; it all naturally adapts to a shrinking window.

Post Reply