I recently improved my implementation of iterative deepening to feed the principal variation into the next iteration, meaning the PV from the last iteration is tried first (it sorts first). I thoroughly tested it to make it really is doing that, and it is working perfectly.
However, surprisingly, I found no significant improvement over feeding just the root move of the previous iterations's PV (the first move of the PV). I was expecting a large improvement.
I presently do not have QS or SEE implemented, and I suspect that is the problem. Because I don't have those implemented, a later iteration is in fact returning quite a different PV than before, whereas with QS and SEE, the iterations should return very similar PVs, hence improving iterative deepening.
[In my implementation of ID, I am incrementing the depth by 1, not 2, because with no QS and no SEE, the scores vary widely from one depth to another, but they do not vary widely if I skip by 2 (same side to move). So skipping by 2 allows me to use a smaller aspiration window]
Does that sound right? Is not having QS or SEE my problem? Or have you found that feeding the PV into the next iteration is generally no better than just feeding the root?
Iterative deepening and the principal variation
Moderator: Ras
-
- Posts: 20943
- Joined: Mon Feb 27, 2006 7:30 pm
- Location: Birmingham, AL
Re: Iterative deepening and the principal variation
You are overlooking the hash move.AndrewShort wrote:I recently improved my implementation of iterative deepening to feed the principal variation into the next iteration, meaning the PV from the last iteration is tried first (it sorts first). I thoroughly tested it to make it really is doing that, and it is working perfectly.
However, surprisingly, I found no significant improvement over feeding just the root move of the previous iterations's PV (the first move of the PV). I was expecting a large improvement.
I presently do not have QS or SEE implemented, and I suspect that is the problem. Because I don't have those implemented, a later iteration is in fact returning quite a different PV than before, whereas with QS and SEE, the iterations should return very similar PVs, hence improving iterative deepening.
[In my implementation of ID, I am incrementing the depth by 1, not 2, because with no QS and no SEE, the scores vary widely from one depth to another, but they do not vary widely if I skip by 2 (same side to move). So skipping by 2 allows me to use a smaller aspiration window]
Does that sound right? Is not having QS or SEE my problem? Or have you found that feeding the PV into the next iteration is generally no better than just feeding the root?

-
- Posts: 12777
- Joined: Wed Mar 08, 2006 8:57 pm
- Location: Redmond, WA USA
Re: Iterative deepening and the principal variation
That makes no sense to me. If you skip only one ply, it is the other side's turn to move.AndrewShort wrote:I recently improved my implementation of iterative deepening to feed the principal variation into the next iteration, meaning the PV from the last iteration is tried first (it sorts first). I thoroughly tested it to make it really is doing that, and it is working perfectly.
However, surprisingly, I found no significant improvement over feeding just the root move of the previous iterations's PV (the first move of the PV). I was expecting a large improvement.
I presently do not have QS or SEE implemented, and I suspect that is the problem. Because I don't have those implemented, a later iteration is in fact returning quite a different PV than before, whereas with QS and SEE, the iterations should return very similar PVs, hence improving iterative deepening.
[In my implementation of ID, I am incrementing the depth by 1, not 2, because with no QS and no SEE, the scores vary widely from one depth to another, but they do not vary widely if I skip by 2 (same side to move). So skipping by 2 allows me to use a smaller aspiration window]
Do you have a hash table? It seems fairly likely that you will fish the pv node out of the hash table anyway.
Does that sound right? Is not having QS or SEE my problem? Or have you found that feeding the PV into the next iteration is generally no better than just feeding the root?
Re: Iterative deepening and the principal variation
well, I do have a hash table, and I am sorting the hash move 1st. It's just that when I'm sorting the princ variation first, the hash move (if different) ends up 2nd, not 1st (by design). I only sort the principal variation once, so it affects very few sorts. The rest of the sorts use hash best move on top.
in effect what I'm seeing is that feeding the PV into the next iteration is not much better than feeding just the root move, I guess because my sorting (with hash move, etc) is already pretty good.
is that what you meant?
in effect what I'm seeing is that feeding the PV into the next iteration is not much better than feeding just the root move, I guess because my sorting (with hash move, etc) is already pretty good.
is that what you meant?
-
- Posts: 838
- Joined: Thu Jul 05, 2007 5:03 pm
- Location: British Columbia, Canada
Re: Iterative deepening and the principal variation
He probably meant that at the end of the iteration, most of the PV nodes are still in the hash table, so the hash moves from those nodes give you almost as much info as feeding an entire PV into it does...AndrewShort wrote:well, I do have a hash table, and I am sorting the hash move 1st. It's just that when I'm sorting the princ variation first, the hash move (if different) ends up 2nd, not 1st (by design). I only sort the principal variation once, so it affects very few sorts. The rest of the sorts use hash best move on top.
in effect what I'm seeing is that feeding the PV into the next iteration is not much better than feeding just the root move, I guess because my sorting (with hash move, etc) is already pretty good.
is that what you meant?
I think some programs don't represent the PV anywhere other than the hash table? Should a hash replacement scheme prefer not to replace PV nodes?
-
- Posts: 12777
- Joined: Wed Mar 08, 2006 8:57 pm
- Location: Redmond, WA USA
Re: Iterative deepening and the principal variation
A hash replacement scheme should never replace a PV node unless it has already been played or is no longer possible to play. Which nodes are pv nodes is the most important information contained in the hash table, by far.wgarvin wrote:He probably meant that at the end of the iteration, most of the PV nodes are still in the hash table, so the hash moves from those nodes give you almost as much info as feeding an entire PV into it does...AndrewShort wrote:well, I do have a hash table, and I am sorting the hash move 1st. It's just that when I'm sorting the princ variation first, the hash move (if different) ends up 2nd, not 1st (by design). I only sort the principal variation once, so it affects very few sorts. The rest of the sorts use hash best move on top.
in effect what I'm seeing is that feeding the PV into the next iteration is not much better than feeding just the root move, I guess because my sorting (with hash move, etc) is already pretty good.
is that what you meant?
I think some programs don't represent the PV anywhere other than the hash table? Should a hash replacement scheme prefer not to replace PV nodes?
-
- Posts: 20943
- Joined: Mon Feb 27, 2006 7:30 pm
- Location: Birmingham, AL
Re: Iterative deepening and the principal variation
The problem is, you can't recognize a PV node...wgarvin wrote:He probably meant that at the end of the iteration, most of the PV nodes are still in the hash table, so the hash moves from those nodes give you almost as much info as feeding an entire PV into it does...AndrewShort wrote:well, I do have a hash table, and I am sorting the hash move 1st. It's just that when I'm sorting the princ variation first, the hash move (if different) ends up 2nd, not 1st (by design). I only sort the principal variation once, so it affects very few sorts. The rest of the sorts use hash best move on top.
in effect what I'm seeing is that feeding the PV into the next iteration is not much better than feeding just the root move, I guess because my sorting (with hash move, etc) is already pretty good.
is that what you meant?
I think some programs don't represent the PV anywhere other than the hash table? Should a hash replacement scheme prefer not to replace PV nodes?
-
- Posts: 838
- Joined: Thu Jul 05, 2007 5:03 pm
- Location: British Columbia, Canada
Re: Iterative deepening and the principal variation
But as you finish searching nodes and unmake moves and go back up to the parent, can you mark the "best child" with a flag? I.e. a flag that means, "The best move, or hash move, in some parent node led to this node".bob wrote:The problem is, you can't recognize a PV node...
Then replacement would just always prefer to replace non-flagged ones instead of flagged ones.
-
- Posts: 12777
- Joined: Wed Mar 08, 2006 8:57 pm
- Location: Redmond, WA USA
Re: Iterative deepening and the principal variation
There are some programs that reconstruct the pv purely from the hash (admittedly, this does not work perfectly). I have also seen programs that tag one of the flag bits if it is a pv node (but this is also problematic because pv nodes can change during the search). However, on average the best nodes from the transposition table should approximate closely the pv nodes.bob wrote:The problem is, you can't recognize a PV node...wgarvin wrote:He probably meant that at the end of the iteration, most of the PV nodes are still in the hash table, so the hash moves from those nodes give you almost as much info as feeding an entire PV into it does...AndrewShort wrote:well, I do have a hash table, and I am sorting the hash move 1st. It's just that when I'm sorting the princ variation first, the hash move (if different) ends up 2nd, not 1st (by design). I only sort the principal variation once, so it affects very few sorts. The rest of the sorts use hash best move on top.
in effect what I'm seeing is that feeding the PV into the next iteration is not much better than feeding just the root move, I guess because my sorting (with hash move, etc) is already pretty good.
is that what you meant?
I think some programs don't represent the PV anywhere other than the hash table? Should a hash replacement scheme prefer not to replace PV nodes?
Re: Iterative deepening and the principal variation
So it seems to me that if you already have hash-best-move implemented, that the only benefits of iterative deepening are:
(1) the ability to time-out with a good move at hand
(2) increased efficiency by filling up the hash table between iterations
Seems to me you don't have to bother with passing each iteration the previous iteration's PV, as the hash table gives you all that benefit already.
(1) the ability to time-out with a good move at hand
(2) increased efficiency by filling up the hash table between iterations
Seems to me you don't have to bother with passing each iteration the previous iteration's PV, as the hash table gives you all that benefit already.