UCI multiPV specification question

Discussion of chess software programming and technical issues.

Moderators: hgm, Rebel, chrisw

elcabesa
Posts: 855
Joined: Sun May 23, 2010 1:32 pm

UCI multiPV specification question

Post by elcabesa »

I was reading UCI specifications some days ago trying to improve Vajolet compliance and a doubt arise when reading MULTIPV specification.
in the spec this is all I can find about MultiPV:
* 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.
* = MultiPV, type spin
the engine supports multi best line or k-best mode. the default value is 1
it says to send all the K best moves together, but what if in a position with only 3 legal moves multiPV is set to 12?
The implementation of the engines I know is to send the info only for the 3 legal moves, and the GUI I know ( mostly arena ) accept few lines than the specified amount without too much problems.
A solution that came to my mind was to send 12 lines to the gui with the PV set at 0000.
info multipv 4 depth 0 pv 0000 score cp 0
What is the general consensus in this case?
There are some GUI that implement multiPV in a strict way, and what is it?
User avatar
hgm
Posts: 27789
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: UCI multiPV specification question

Post by hgm »

I would be surprised if there was any GUI that required you to add artificial dummy PVs just to get the requested number.
syzygy
Posts: 5557
Joined: Tue Feb 28, 2012 11:56 pm

Re: UCI multiPV specification question

Post by syzygy »

elcabesa wrote: Thu Jan 03, 2019 5:23 pm it says to send all the K best moves together, but what if in a position with only 3 legal moves multiPV is set to 12?
The implementation of the engines I know is to send the info only for the 3 legal moves, and the GUI I know ( mostly arena ) accept few lines than the specified amount without too much problems.
A solution that came to my mind was to send 12 lines to the gui with the PV set at 0000.
Your solution does not seem to be UCI compliant, since the specification says nothing about PVs "set at 0000". It is also certain to confuse many GUIs.

I agree with you that the UCI specification is worded too loosely, but the solution adopted by most (if not all) GUIs and engines seems to be the most reasonable interpretation: if MultiPV=12 and there are just 3 legal moves, send 3 lines.
elcabesa
Posts: 855
Joined: Sun May 23, 2010 1:32 pm

Re: UCI multiPV specification question

Post by elcabesa »

this was my interpretation too, but since I have only used Arena as Giu, i don't know if there are some other interpretations
User avatar
hgm
Posts: 27789
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: UCI multiPV specification question

Post by hgm »

All I can say is that it should not be a problem for the UCI2WB adapters I know, as CECP doesn't have any restriction on the number of PVs you would sent in any situation (and indeed many engines do send multiple PVs even in single PV mode, when they overturn a previous PV). So they simply pass along to the GUI any PV+info the engine spits out that was not passed along already.
Ras
Posts: 2487
Joined: Tue Aug 30, 2016 8:19 pm
Full name: Rasmus Althoff

Re: UCI multiPV specification question

Post by Ras »

elcabesa wrote: Thu Jan 03, 2019 5:23 pmWhat is the general consensus in this case?
Send as many PVs as legally possible and drop the rest. Just tested that situation with Shredder, which should be a reference UCI implementation, and it behaves this way.
Rasmus Althoff
https://www.ct800.net
elcabesa
Posts: 855
Joined: Sun May 23, 2010 1:32 pm

Re: UCI multiPV specification question

Post by elcabesa »

Thank you all :P