MultiPV

Programming Topics (Computer Chess) and technical aspects as test techniques, book building, program tuning etc

Moderator: Andres Valverde

MultiPV

Postby Tord Romstad » 08 Jan 2006, 13:21

Hi all,

This morning I've added the MultiPV UCI option to Glaurung. It seems to work, but because I don't have any MultiPV capable GUI to test with I hope that someone can answer the following questions:

Is it safe to assume that "setoption name MultiPV value <n>" will not be sent to the engine while it is thinking? I currently check the values of the UCI options only when a new search starts. The engine accepts and understands "setoption ..." commands received during a search, but they will not have any effect before the next search. Changing this will be somewhat messy.

If "setoption name MultiPV" is indeed sent while the engine is thinking, how is the engine supposed to react? Is it acceptable to just abort and re-start the search?

Tord
User avatar
Tord Romstad
 
Posts: 639
Joined: 09 Oct 2004, 12:49
Location: Oslo, Norway

Re: MultiPV

Postby milix » 08 Jan 2006, 14:31

Hi Tord,

I think that multipv display must be activated as soon as possible when the user wants to see more PVs. Chessbase gui seems to act this way, it has [+] and [-] buttons to increase/decrease the number of displayed PVs and the response of the engine (F8 in my case) in these buttons is immediate.

If "setoption name MultiPV" is indeed sent while the engine is thinking, how is the engine supposed to react? Is it acceptable to just abort and re-start the search?


I guess yes :)
Anastasios Milikas
milix
 
Posts: 54
Joined: 04 Nov 2004, 19:36
Location: Greece

Re: MultiPV

Postby Marcus Prewarski » 08 Jan 2006, 15:45

Tord Romstad wrote:Hi all,

This morning I've added the MultiPV UCI option to Glaurung. It seems to work, but because I don't have any MultiPV capable GUI to test with I hope that someone can answer the following questions:

Is it safe to assume that "setoption name MultiPV value <n>" will not be sent to the engine while it is thinking? I currently check the values of the UCI options only when a new search starts. The engine accepts and understands "setoption ..." commands received during a search, but they will not have any effect before the next search. Changing this will be somewhat messy.

If "setoption name MultiPV" is indeed sent while the engine is thinking, how is the engine supposed to react? Is it acceptable to just abort and re-start the search?

Tord


The last engine I bought was Shredder 7.04. In the chessbase GUI it seems to restart the search when a PV line is added and not when one is subtracted. Maybe in that case it just shows one less line in the output.
Marcus Prewarski
 
Posts: 27
Joined: 26 Feb 2005, 16:48

Re: MultiPV

Postby Uri Blass » 08 Jan 2006, 15:49

Tord Romstad wrote:Hi all,

If "setoption name MultiPV" is indeed sent while the engine is thinking, how is the engine supposed to react? Is it acceptable to just abort and re-start the search?

Tord


some comments:
1)I prefer to use the word calculating or searching instead of thinking
because engines by definition cannot think.

2)I think that it is not the best solution but I do not complain if you do it because it is not easy to program the best solution(it is not easy to design the solution that I want because even I did not define it exactly and I will simply post examples to show what I prefer to see).


The user may want to change the number of lines during the time that the engine is calculating and even if the score for the moves is saved in the hash I do not like it to forget the depth that the lines were searched in the pv.

The best solution is probably first to remember the lines that the engine searched at all iterations and the depth that they were searched and only later to decide how to restart the search.

3 examples:
Example 1:
Suppose that the engine shows at depth 10
depth 10:1.e4 e5 0.1
depth 10:1.d4 d5 0.08

and later replace 1.d4 d5 by

depth 10 1.c4 d6 0.09

Suppose at this time I increase the number of lines to 3

I prefer that the engine shows me immediatly 1.d4 d5 0.08 because it was alreasy searched at depth 10.

I prefer that the engine does not search at all 1.e4 1.d4 1.c4 at depth<=10 when it search again and show me new information only if it finds something different with score that is more than 0.08 at depth 10 or something at depth 11.

Example 2:

Suppose that the engine has the same

depth 10:1.e4 e5 0.1
depth 10:1.d4 d5 0.08
but suppose that it also has a pv for 1.c4 at depth 9 and it had
depth 9 1.c4 e5 0.09(at depth 9 d4 and 9.e4 were better move so it change it)

In that case I prefer to see the following outpur

depth 10:1.e4 e5 0.1
depth 10:1.d4 d5 0.08
depth 9:1.c4 e5 0.09

This output should be constant when the engine searches moves at depth that is not bigger than 8 and only at depth 9 it may be changed if the engine finds something better than 1.c4 but as long as the engine does not go to depth 10 I prefer to see depth 9 in the bottom of the list except cases of mate score that I give in example 3.


Example 3:
Suppose that the engine in 2 mode at depth 10 has 2 lines

1.e4 e5 depth 10 0.1
2.d4 d5 depth 10 0.09

suppose that later when you increase the number of lines to 3 the engine does less pruning and find thanks to it at depth 8
1.Bxf7+ mate in 7

I think that in this case it is better to write 1.Bxf7+ first inspite of the fact that it has smaller depth because positive mate score at smaller depth is better than non mate score at bigger depth.

Uri
User avatar
Uri Blass
 
Posts: 727
Joined: 09 Oct 2004, 05:59
Location: Tel-Aviv

Re: MultiPV

Postby Tord Romstad » 08 Jan 2006, 16:01

Thanks for the replies!

It seems that it is safe to assume that the number of PVs will not be changed during a search (like I hoped). I also tested the behavior of a few engines with MultiPV support (Fruit 2.2, Shredder 9.11 and Ruffian 2.1.0), and none of them accepted "setoption MultiPV ..." while calculating. Marcus is probably right, the GUI always wraps the "setoption MultiPV" command between a "stop" and a "go" command when the user presses + or - during a search.

Uri, thanks for your thoughts. For the moment, I think I will keep my current, very simple implementation, but perhaps I will implement something similar to your suggestions later.

Tord
User avatar
Tord Romstad
 
Posts: 639
Joined: 09 Oct 2004, 12:49
Location: Oslo, Norway

Re: MultiPV

Postby Fabien Letouzey » 09 Jan 2006, 10:28

Tord Romstad wrote:Is it safe to assume that "setoption name MultiPV value <n>" will not be sent to the engine while it is thinking? I currently check the values of the UCI options only when a new search starts. The engine accepts and understands "setoption ..." commands received during a search, but they will not have any effect before the next search. Changing this will be somewhat messy.

Hi Tord,

Safe assumption. As I recall only "stop", "ponderhit" and "isready" are allowed during search (handling "quit"/EOF too is a safe bet though). Maybe "debug" too, I've never used it.

However I was told Arena sent multipv during search (not checked). Not that I care.

Fabien.
Fabien Letouzey
 
Posts: 110
Joined: 03 Dec 2004, 10:17
Location: France

Re: MultiPV

Postby Daniel Mehrmann » 09 Jan 2006, 16:56

Fabien Letouzey wrote:
Tord Romstad wrote:Is it safe to assume that "setoption name MultiPV value <n>" will not be sent to the engine while it is thinking? I currently check the values of the UCI options only when a new search starts. The engine accepts and understands "setoption ..." commands received during a search, but they will not have any effect before the next search. Changing this will be somewhat messy.

Hi Tord,

Safe assumption. As I recall only "stop", "ponderhit" and "isready" are allowed during search (handling "quit"/EOF too is a safe bet though). Maybe "debug" too, I've never used it.

However I was told Arena sent multipv during search (not checked). Not that I care.

Fabien.


Arena send _any_ "setoption" option during the search :(( This is not allowed.

Daniel
User avatar
Daniel Mehrmann
 
Posts: 127
Joined: 02 Oct 2004, 06:10
Location: Germany

Re: MultiPV

Postby Daniel Mehrmann » 09 Jan 2006, 17:33

Daniel Mehrmann wrote:
Fabien Letouzey wrote:
Tord Romstad wrote:Is it safe to assume that "setoption name MultiPV value <n>" will not be sent to the engine while it is thinking? I currently check the values of the UCI options only when a new search starts. The engine accepts and understands "setoption ..." commands received during a search, but they will not have any effect before the next search. Changing this will be somewhat messy.

Hi Tord,

Safe assumption. As I recall only "stop", "ponderhit" and "isready" are allowed during search (handling "quit"/EOF too is a safe bet though). Maybe "debug" too, I've never used it.

However I was told Arena sent multipv during search (not checked). Not that I care.

Fabien.


Arena send _any_ "setoption" option during the search :(( This is not allowed.

Daniel


example

Code: Select all
Arena 1.1
1360**-------------NewGame!!!-------------
15297*1*----------------------------Starte Motor 1 Homer----------------------------
15297*1*Configured Engine 1 Type:   UCI
15438*1*Engine 1 dir: E:\Homer\stable
15500*1*Engine 1 commandline: E:\Homer\stable\Homer.exe
15750<1:Chessprogram Homer
15750<1:Copyright Daniel Mehrmann 2003-2005
15750<1:http://www.homer-chess.com, info@homer-chess.de
15750<1:Version: 1.1 beta2
15750<1:Build: 23
15750<1:This program is free for personal use
15750<1:compiled Jan  9 2006 01:49:37
15750<1:CPU supported: MMX SSE
15750<1:Reading homer.ini
15750<1:Hashtable    = 8 MB
15750<1:Pawn value   = 100 points
15750<1:Knight value = 420 points
15750<1:Bishop value = 420 points
15750<1:Rook value   = 620 points
15750<1:Queen value  = 1240 points
15750<1:Max QS depth = 12 ply
15750<1:Ponder       = on
15750<1:Logging      = on (homer.log)
15750<1:Init hash memory. This may take a moment...
15750<1:info Allocate memory for hashtables,  rc = 8186
15750<1:Homer is ready for playing
15907>1:uci
15969<1:id name Homer 1.1 beta2
15969<1:id author Daniel Mehrmann
15969<1:option name Ponder type check default false
16032<1:option name HistoryPruning type check default true
16032<1:option name MultiCutPruning type check default true
16032<1:option name NoiseReduction type check default true
16032<1:option name HumanPlayStyle type check default false
16032<1:option name NullMove type combo default secure var secure var strong var low var agressive
16032<1:option name Hash type spin min 8 max 512 default 8
16032<1:option name Pawn type spin default 100 min 50 max 150
16032<1:option name Knight type spin default 420 min 370 max 470
16032<1:option name Bishop type spin default 420 min 370 max 470
16032<1:option name Rook type spin default 620 min 570 max 670
16032<1:option name Queen type spin default 1240 min 1190 max 1290
16032<1:option name Max_QS_Depth type spin default 12 min 0 max 16
16032<1:option name Clear_Hash type button
16032<1:option name MultiPV type spin min 1 max 6 default 1
16094<1:option name UCI_EngineAbout type string default Homer 1.1 beta2 by Daniel Mehrmann, http://www.homer-chess.com, info@homer-chess.de
16094<1:option name UCI_AnalyseMode type check default false
16094<1:option name UCI_ShowCurrLine type check default false
16157<1:option name UCI_Chess960 type check default false
16157<1:uciok
16360>1:setoption name Ponder value true
16360>1:setoption name UCI_EngineAbout value Homer 1.0 by Daniel Mehrmann, http://www.homer-chess.com, info@homer-chess.de
16360>1:setoption name Pawn value 102
16360>1:setoption name Hash value 128
16360>1:isready
16891<1:info string Your command is my life :),  rc = 0
16891<1:readyok
17579*1*Start calc, move no: 1
17579>1:ucinewgame
17579>1:isready
17797<1:readyok
17891>1:position startpos moves e2e4
17891>1:go wtime 126000 btime 126000 winc 6000 binc 6000
17891<1:info depth 1 seldepth 1
17891<1:info score cp -33 depth 1 seldepth 5 nodes 1467 nps 0 time 0  pv d7d5
17891<1:info depth 2 seldepth 2
17891<1:info score cp -33 depth 2 seldepth 2 nodes 1487 nps 0 time 0  pv d7d5 b1c3
17891<1:info depth 3 seldepth 3
17907<1:info score cp -22 depth 3 seldepth 8 nodes 3328 nps 208000 time 16  pv g8f6 b1c3 d7d5
17907<1:info depth 4 seldepth 4
17922<1:info score cp -43 depth 4 seldepth 9 nodes 8871 nps 286161 time 31  pv b8c6 d2d4 d7d5 e4d5 d8d5
17922<1:info depth 5 seldepth 5
17954<1:info score cp -22 depth 5 seldepth 17 nodes 19454 nps 308793 time 63  pv b8c6 f1c4 e7e5 d1h5
17954<1:info depth 6 seldepth 6
18141<1:info score cp -39 depth 6 seldepth 19 nodes 76481 nps 305924 time 250  pv b8c6 d2d4 d7d5 e4d5 d8d5 g1f3 g8f6
18141<1:info depth 7 seldepth 7
18438<1:info score cp -31 depth 7 seldepth 20 nodes 180424 nps 330446 time 546  pv e7e5 g1f3 b8c6 d2d4 e5d4 f3d4 d7d5 d4c6 b7c6
18438<1:info depth 8 seldepth 8
18594<1:info score cp -32 depth 8 seldepth 19 nodes 228234 nps 325119 time 702  pv e7e5 g1f3 b8c6 d2d4 e5d4 f3d4 g8f6 b1c3 d7d5
18657<1:info score cp -32 depth 8 seldepth 19 nodes 248827 nps 325689 time 764  pv e7e5 g1f3 b8c6 d2d4 e5d4 f3d4 g8f6 b1c3 d7d5
18657<1:info depth 9 seldepth 9
18938<1:info score cp -32 depth 9 seldepth 21 nodes 335384 nps 320941 time 1045  pv e7e5 g1f3 b8c6 d2d4 e5d4 f3d4 g8f6 b1c3 d7d5 d4c6 b7c6
19360<1:info score cp -32 depth 9 seldepth 23 nodes 459064 nps 316595 time 1450  pv e7e5 g1f3 b8c6 d2d4 e5d4 f3d4 g8f6 b1c3 d7d5 d4c6 b7c6
19360<1:info depth 10 seldepth 10
19922<1:info hashfull 64
19922<1:info depth 10 seldepth 22 nodes 630784 time 2026 nps 311344 currmove e7e5 currmovenumber 1
20719<1:info score cp -25 depth 10 seldepth 22 nodes 874699 nps 310066 time 2821  pv e7e5 g1f3 g8f6 b1c3 b8c6 d2d4 e5d4 f3d4 d7d5
20938<1:info hashfull 95
20938<1:info depth 10 seldepth 22 nodes 942080 time 3039 nps 309996 currmove f7f5 currmovenumber 11
21063<1:info score cp -25 depth 10 seldepth 22 nodes 979525 nps 309584 time 3164  pv e7e5 g1f3 g8f6 b1c3 b8c6 d2d4 e5d4 f3d4 d7d5
21063<1:info depth 11 seldepth 11
21954<1:info hashfull 123
21954<1:info depth 11 seldepth 23 nodes 1277952 time 4053 nps 315310 currmove e7e5 currmovenumber 1
22313<1:info score cp -20 depth 11 seldepth 23 nodes 1396845 nps 316673 time 4411  pv e7e5 g1f3 g8f6 b1c3 b8c6 f1b5 f8b4 e1g1 e8g8 d2d3 d7d6
22969<1:info score cp -20 depth 11 seldepth 23 nodes 1595325 nps 315905 time 5050  pv e7e5 g1f3 g8f6 b1c3 b8c6 f1b5 f8b4 e1g1 e8g8 d2d3 d7d6
22969<1:info depth 12 seldepth 12
22969<1:info hashfull 151
22969<1:info depth 12 seldepth 12 nodes 1597440 time 5066 nps 315325 currmove e7e5 currmovenumber 1
24000<1:info hashfull 175
24000<1:info depth 12 seldepth 22 nodes 1941504 time 6094 nps 318592 currmove e7e5 currmovenumber 1
25016<1:info hashfull 202
25016<1:info depth 12 seldepth 24 nodes 2244608 time 7107 nps 315830 currmove e7e5 currmovenumber 1
25204<1:info score cp -28 depth 12 seldepth 24 nodes 2300588 nps 315408 time 7294  pv e7e5 g1f3 g8f6 b1c3 b8c6 f1b5 f8b4 b5c6 d7c6 f3e5 b4c3 b2c3 d8e7 d2d4 f6e4
25969<1:bestmove e7e5 ponder g1f3
25969*1*Zug gefunden:e7-e5
26454>1:position startpos moves e2e4 e7e5 g1f3
26516>1:go ponder wtime 126000 btime 117927 winc 6000 binc 6000
26516<1:info depth 1 seldepth 1
26516<1:info score cp -27 depth 1 seldepth 6 nodes 1680 nps 0 time 0  pv b8c6
26516<1:info depth 2 seldepth 2
26516<1:info score cp -27 depth 2 seldepth 2 nodes 1709 nps 0 time 0  pv b8c6 b1c3
26516<1:info depth 3 seldepth 3
26516<1:info score cp -28 depth 3 seldepth 5 nodes 1921 nps 0 time 0  pv b8c6 b1c3 g8f6
26516<1:info depth 4 seldepth 4
26532<1:info score cp -28 depth 4 seldepth 4 nodes 2256 nps 0 time 0  pv b8c6 b1c3 g8f6 f1b5
26532<1:info depth 5 seldepth 5
26532<1:info score cp -28 depth 5 seldepth 5 nodes 2800 nps 186666 time 15  pv b8c6 b1c3 g8f6 f1b5
26532<1:info depth 6 seldepth 6
26547<1:info score cp -28 depth 6 seldepth 10 nodes 5411 nps 360733 time 15  pv b8c6 b1c3 g8f6 f1b5
26547<1:info depth 7 seldepth 7
26563<1:info score cp -28 depth 7 seldepth 13 nodes 11607 nps 252326 time 46  pv b8c6 b1c3 g8f6 f1b5
26563<1:info depth 8 seldepth 8
26579<1:info score cp -28 depth 8 seldepth 13 nodes 15319 nps 333021 time 46  pv b8c6 b1c3 g8f6 f1b5
26594<1:info score cp -28 depth 8 seldepth 18 nodes 22152 nps 287688 time 77  pv b8c6 b1c3 g8f6 f1b5
26594<1:info depth 9 seldepth 9
26672<1:info score cp -28 depth 9 seldepth 17 nodes 46870 nps 302387 time 155  pv b8c6 b1c3 g8f6 f1b5
26719<1:info score cp -28 depth 9 seldepth 21 nodes 59500 nps 294554 time 202  pv b8c6 b1c3 g8f6 f1b5
26719<1:info depth 10 seldepth 10
26985<1:info score cp -28 depth 10 seldepth 21 nodes 136672 nps 292659 time 467  pv b8c6 b1c3 g8f6 f1b5
27516<1:info score cp -28 depth 10 seldepth 21 nodes 272259 nps 273078 time 997  pv b8c6 b1c3 g8f6 f1b5
27516<1:info depth 11 seldepth 11
28344<1:info hashfull 40
28344<1:info depth 11 seldepth 25 nodes 507904 time 1823 nps 278608 currmove b8c6 currmovenumber 1
28813<1:info score cp -28 depth 11 seldepth 25 nodes 643338 nps 280810 time 2291  pv b8c6 b1c3 g8f6 f1b5 f8b4 b5c6
29360<1:info hashfull 62
29360<1:info depth 11 seldepth 25 nodes 794624 time 2836 nps 280191 currmove f8e7 currmovenumber 19
30391<1:info hashfull 85
30407<1:info depth 11 seldepth 25 nodes 1081344 time 3865 nps 279778 currmove g8f6 currmovenumber 29
31407<1:info hashfull 104
31407<1:info depth 11 seldepth 25 nodes 1400832 time 4878 nps 287173 currmove g8f6 currmovenumber 29
31422>1:setoption name UCI_Chess960 value false
31422>1:setoption name UCI_EngineAbout value Homer 1.0 by Daniel Mehrmann, http://www.homer-chess.com, info@homer-chess.de
31422>1:setoption name MultiPV value 1
31422>1:setoption name Max_QS_Depth value 12
31422>1:setoption name Queen value 1244
31422>1:setoption name Rook value 620
31422>1:setoption name Bishop value 420
31422>1:setoption name Knight value 422
31422>1:setoption name Pawn value 102
31422>1:setoption name NullMove value secure
31422>1:setoption name HumanPlayStyle value false
31422>1:setoption name NoiseReduction value true
31438>1:setoption name MultiCutPruning value true
31438>1:setoption name HistoryPruning value true
31438>1:setoption name Ponder value true
31454<1:info string UCI: setoption is not allow while engine thinking
31485<1:info string UCI: setoption is not allow while engine thinking
31516<1:info string UCI: setoption is not allow while engine thinking
31532<1:info string UCI: setoption is not allow while engine thinking
31563<1:info string UCI: setoption is not allow while engine thinking
31594<1:info string UCI: setoption is not allow while engine thinking
31625<1:info string UCI: setoption is not allow while engine thinking
31641<1:info string UCI: setoption is not allow while engine thinking
31672<1:info string UCI: setoption is not allow while engine thinking
31704<1:info string UCI: setoption is not allow while engine thinking
31719<1:info string UCI: setoption is not allow while engine thinking
31750<1:info string UCI: setoption is not allow while engine thinking
31782<1:info string UCI: setoption is not allow while engine thinking
31797<1:info string UCI: setoption is not allow while engine thinking
31829<1:info string UCI: setoption is not allow while engine thinking
32422<1:info hashfull 124
32422<1:info depth 11 seldepth 25 nodes 1687552 time 5891 nps 286462 currmove g8f6 currmovenumber 29
33016<1:info score cp -17 depth 11 seldepth 28 nodes 1875265 nps 289258 time 6483  pv g8f6 b1c3 f8b4 f3e5 d7d6 e5f3 b4c3 d2c3 f6e4 d1d5 d8e7
33032<1:info score cp -17 depth 11 seldepth 28 nodes 1875265 nps 289258 time 6483  pv g8f6 b1c3 f8b4 f3e5 d7d6 e5f3 b4c3 d2c3 f6e4 d1d5 d8e7
33032<1:info depth 12 seldepth 12
33438<1:info hashfull 143
33438<1:info depth 12 seldepth 19 nodes 2015232 time 6904 nps 291893 currmove g8f6 currmovenumber 1
34454<1:info hashfull 161
34454<1:info depth 12 seldepth 22 nodes 2318336 time 7917 nps 292830 currmove g8f6 currmovenumber 1
35469**-------------NewGame!!!-------------
35469>1:stop
35500<1:info hashfull 178
35500<1:info depth 12 seldepth 22 nodes 2629632 time 8961 nps 293452 currmove g8f6 currmovenumber 1
35500<1:bestmove g8f6
User avatar
Daniel Mehrmann
 
Posts: 127
Joined: 02 Oct 2004, 06:10
Location: Germany

Re: MultiPV

Postby smcracraft » 15 Jan 2006, 18:56

Tord Romstad wrote:Hi all,

This morning I've added the MultiPV UCI option to Glaurung. It seems to work, but because I don't have any MultiPV capable GUI to test with I hope that someone can answer the following questions:

Is it safe to assume that "setoption name MultiPV value <n>" will not be sent to the engine while it is thinking? I currently check the values of the UCI options only when a new search starts. The engine accepts and understands "setoption ..." commands received during a search, but they will not have any effect before the next search. Changing this will be somewhat messy.

If "setoption name MultiPV" is indeed sent while the engine is thinking, how is the engine supposed to react? Is it acceptable to just abort and re-start the search?

Tord


Tord - what is multiPV?

Stuart
smcracraft
 
Posts: 65
Joined: 15 Jan 2006, 05:38

Re: MultiPV

Postby Tord Romstad » 15 Jan 2006, 19:19

smcracraft wrote:Tord - what is multiPV?


Hi Stuart,

"MultiPV", or "k-best mode" as it is also called, is a special mode where the engine doesn't just print the score and the PV for the best move it can find in the position, but for the k best moves (where k is a variable which can be set by the user). Of course, this isn't possible with a plain alpha beta or PVS search, where we don't know the exact scores of any root moves except the best one. The most obvious way to implement MultiPV mode is to use a modified form of PVS at the root, where the k first moves (rather than just the first move) at each iteration are searched with an infinite window, and the remaining moves with a null window.

Of course, MultiPV mode slows down the search a lot, and is pointless if playing strength is the only thing you are interested in. However, some users find it useful when using the program for analysis, which is why I decided to implement it.

Tord
User avatar
Tord Romstad
 
Posts: 639
Joined: 09 Oct 2004, 12:49
Location: Oslo, Norway

Re: MultiPV

Postby smcracraft » 17 Jan 2006, 20:24

Thanks.
smcracraft
 
Posts: 65
Joined: 15 Jan 2006, 05:38


Return to Programming and Technical Discussions

Who is online

Users browsing this forum: No registered users and 5 guests

cron