multipv UCI question

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.
Post Reply
User avatar
xr_a_y
Posts: 988
Joined: Sat Nov 25, 2017 1:28 pm
Location: France

multipv UCI question

Post by xr_a_y » Mon Mar 23, 2020 6:47 pm

The protocol says

* multipv
this for the multi pv mode.
for the best move/pv add "multipv 1" in the string when you send the pv.
in k-best mode always send all k variants in k strings together.

But as often I don't get it well.

What shall I print ?

SF is looping other each pv and printing a full info string (https://github.com/official-stockfish/S ... .cpp#L1787)

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

Re: multipv UCI question

Post by hgm » Mon Mar 23, 2020 7:49 pm

When MultiPV is set to N > 1, you will always have to send bunches of N info commands with a PV in it (and the accompanying stuff, such as depth, score). In addition, these info commands will also have to contain one "multipv k" each, k = 1 to N.

When MultiPV is set to 1, there is no obligation for the info command that sends the PV to contain a 'multipv' item.

User avatar
xr_a_y
Posts: 988
Joined: Sat Nov 25, 2017 1:28 pm
Location: France

Re: multipv UCI question

Post by xr_a_y » Mon Mar 23, 2020 8:35 pm

hgm wrote:
Mon Mar 23, 2020 7:49 pm
When MultiPV is set to N > 1, you will always have to send bunches of N info commands with a PV in it (and the accompanying stuff, such as depth, score). In addition, these info commands will also have to contain one "multipv k" each, k = 1 to N.

When MultiPV is set to 1, there is no obligation for the info command that sends the PV to contain a 'multipv' item.
Ok thanks

User avatar
xr_a_y
Posts: 988
Joined: Sat Nov 25, 2017 1:28 pm
Location: France

Re: multipv UCI question

Post by xr_a_y » Tue Mar 24, 2020 7:11 am

Does the same exist for xboard protocol ?

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

Re: multipv UCI question

Post by hgm » Tue Mar 24, 2020 12:04 pm

In XBoard protocol an engine can always send as many PVs as it likes. And there is no requirement to send any duplicats. (In fact this should be discouraged.)

An engine can define an option 'MultiPV' or 'Multi-PV margin' to let the user control its behavior in this respect, through the normal option definition mechanism (feature option="MultiPV -spin 1 1 100"). XBoard will recognize these options, and allow the user to modify them also from the engine-output window (rather than just the Engine Settings dialog), by right-clicking on the 'more' or 'fewer' in the header. Or right-clicking on the setting and move the mouse with the button kept down to change the margin, for engines that work by score margin rather than by number of PVs.

User avatar
xr_a_y
Posts: 988
Joined: Sat Nov 25, 2017 1:28 pm
Location: France

Re: multipv UCI question

Post by xr_a_y » Tue Mar 24, 2020 1:46 pm

hgm wrote:
Tue Mar 24, 2020 12:04 pm
In XBoard protocol an engine can always send as many PVs as it likes. And there is no requirement to send any duplicats. (In fact this should be discouraged.)

An engine can define an option 'MultiPV' or 'Multi-PV margin' to let the user control its behavior in this respect, through the normal option definition mechanism (feature option="MultiPV -spin 1 1 100"). XBoard will recognize these options, and allow the user to modify them also from the engine-output window (rather than just the Engine Settings dialog), by right-clicking on the 'more' or 'fewer' in the header. Or right-clicking on the setting and move the mouse with the button kept down to change the margin, for engines that work by score margin rather than by number of PVs.
ok but what would you add to the classic line in order to show if it is the first, second, ... pv ?

something like this ?

Code: Select all

19 -65 504 4443510 32 881 0	pv1: f6d5 d3e4 a8c8 e2h5 f7f5 e4d5 d8d5 c1b1 f8f7 h1g1 d5d6 g2g3 c6e4 d1c1 d6c5 g1f1 c5a3 f1e1 f7d7 h5e2 

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

Re: multipv UCI question

Post by hgm » Tue Mar 24, 2020 9:10 pm

Nothing. This already follows from the score. The highest score for a given depth will be the first PV, then next-highest score the second, etc.

You can warn the GUI that the score or PV is not real, but a fail high or fail low, by terminating the PV with ! or ?, respectively.

User avatar
xr_a_y
Posts: 988
Joined: Sat Nov 25, 2017 1:28 pm
Location: France

Re: multipv UCI question

Post by xr_a_y » Wed Mar 25, 2020 6:42 pm

What would be the best GUI to test multi-pv in action ?

Minic is outputing this in uci mode

Code: Select all

uci
id name Minic dev
id author Vivien Clauzon
option name Level type spin default 100 min 0 max 100
option name Hash type spin default 256 min 1 max 256000
option name Threads type spin default 1 min 1 max 256
option name UCI_Chess960 type check default false
option name Ponder type check default false
option name MultiPV type spin default 1 min 1 max 4
uciok
setoption name MultiPV value 4
go
info multipv 1 depth 1 score cp 57 time 1 nodes 22 nps 21999 seldepth 1 pv e2e4  tbhits 0
info multipv 2 depth 1 score cp 51 time 1 nodes 43 nps 42999 seldepth 1 pv g1f3  tbhits 0
info multipv 3 depth 1 score cp 42 time 1 nodes 64 nps 63999 seldepth 1 pv e2e3  tbhits 0
info multipv 4 depth 1 score cp 40 time 1 nodes 83 nps 82999 seldepth 1 pv b1c3  tbhits 0
info multipv 1 depth 2 score cp 0 time 1 nodes 127 nps 126999 seldepth 2 pv e2e4 e7e5  tbhits 0
info multipv 2 depth 2 score cp 0 time 1 nodes 149 nps 149000 seldepth 2 pv g1f3 g8f6  tbhits 0
info multipv 3 depth 2 score cp 0 time 1 nodes 183 nps 182999 seldepth 3 pv d2d4 g8f6  tbhits 0
info multipv 4 depth 2 score cp -3 time 1 nodes 214 nps 213999 seldepth 3 pv e2e3 e7e5  tbhits 0
info multipv 1 depth 3 score cp 43 time 1 nodes 256 nps 255999 seldepth 5 pv e2e4 e7e5 g1f3  tbhits 0
info multipv 2 depth 3 score cp 40 time 1 nodes 288 nps 288000 seldepth 5 pv g1f3 g8f6 b1c3  tbhits 0
info multipv 3 depth 3 score cp 31 time 1 nodes 320 nps 320000 seldepth 5 pv d2d4 g8f6 g1f3  tbhits 0
info multipv 4 depth 3 score cp 29 time 1 nodes 353 nps 352999 seldepth 5 pv e2e3 e7e5 b1c3  tbhits 0
info multipv 1 depth 4 score cp 1 time 1 nodes 597 nps 597000 seldepth 7 pv e2e4 e7e5 d2d4 b8c6  tbhits 0
info multipv 2 depth 4 score cp 0 time 1 nodes 651 nps 651000 seldepth 7 pv g1f3 g8f6 b1c3 b8c6  tbhits 0
info multipv 3 depth 4 score cp 0 time 1 nodes 696 nps 695999 seldepth 7 pv d2d4 g8f6 g1f3 b8c6  tbhits 0
info multipv 4 depth 4 score cp 0 time 1 nodes 768 nps 767999 seldepth 7 pv e2e3 e7e5 d2d4 b8c6  tbhits 0
info multipv 1 depth 5 score cp 23 time 1 nodes 896 nps 895999 seldepth 9 pv e2e4 c7c5  tbhits 0
info multipv 1 depth 5 score cp 13 time 1 nodes 943 nps 942999 seldepth 9 pv e2e4 c7c5 b1c3 b8c6  tbhits 0
info multipv 2 depth 5 score cp 24 time 1 nodes 1123 nps 1123000 seldepth 9 pv g1f3 g8f6 b1c3 d7d5 d2d4  tbhits 0
info multipv 3 depth 5 score cp 24 time 1 nodes 1281 nps 1281000 seldepth 9 pv d2d4 g8f6 g1f3 d7d5 b1c3  tbhits 0
info multipv 4 depth 5 score cp 17 time 1 nodes 1497 nps 1496999 seldepth 9 pv e2e3 d7d5 b1c3 g8f6 g1f3  tbhits 0
info multipv 1 depth 6 score cp 0 time 2 nodes 2632 nps 1315999 seldepth 10 pv e2e4 e7e5 g1f3 b8c6 b1c3 g8f6  tbhits 0
info multipv 2 depth 6 score cp 0 time 3 nodes 2790 nps 930000 seldepth 10 pv g1f3 g8f6 b1c3 d7d5 d2d4 b8c6  tbhits 0
info multipv 3 depth 6 score cp 0 time 3 nodes 2947 nps 982333 seldepth 10 pv d2d4 g8f6 g1f3 d7d5 b1c3 b8c6  tbhits 0
info multipv 4 depth 6 score cp 0 time 3 nodes 3199 nps 1066333 seldepth 10 pv e2e3 d7d5 b1c3 g8f6 d2d4 b8c6  tbhits 0
info multipv 1 depth 7 score cp 19 time 4 nodes 3958 nps 989499 seldepth 11 pv e2e4 e7e5 g1f3 g8f6 b1c3 d7d5 e4d5 f6d5  tbhits 0
info multipv 1 depth 7 score cp 0 time 4 nodes 4123 nps 1030749 seldepth 12 pv e2e4 e7e5 g1f3 g8f6 b1c3 b8c6  tbhits 0
info multipv 2 depth 7 score cp 18 time 4 nodes 4966 nps 1241500 seldepth 12 pv g1f3 g8f6 b1c3 d7d5 e2e3 b8c6 d2d4  tbhits 0
info multipv 3 depth 7 score cp 18 time 5 nodes 5521 nps 1104200 seldepth 12 pv d2d4 g8f6 g1f3 d7d5 b1c3 b8c6 e2e3  tbhits 0
info multipv 4 depth 7 score cp 18 time 6 nodes 6298 nps 1049666 seldepth 12 pv e2e3 d7d5 b1c3 g8f6 d2d4 b8c6 g1f3  tbhits 0
info multipv 1 depth 8 score cp 7 time 17 nodes 11205 nps 659117 seldepth 17 pv e2e4 c7c5 g1f3 b8c6 d2d4 c5d4 f3d4 g8f6  tbhits 0
info multipv 2 depth 8 score cp 0 time 19 nodes 12457 nps 655631 seldepth 17 pv g1f3 g8f6 e2e3 d7d5 b1c3 e7e6 d2d4 b8c6  tbhits 0
bestmove g1f3 ponder g8f6

Post Reply