LMR - [for starters] - [Advance] and [Expert]

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.
brtzsnr
Posts: 433
Joined: Fri Jan 16, 2015 3:02 pm
Contact:

Re: LMR - [for starters] - [Advance] and [Expert]

Post by brtzsnr » Tue May 02, 2017 4:31 pm

PK wrote:have You tried dividing history by eight at the beginning of a new search and zeroing it only when the game starts?
Thanks this was a positive Elo on my tests. I still need to run LTC tests, but it's promising.

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

Re: LMR - [for starters] - [Advance] and [Expert]

Post by op12no2 » Tue May 09, 2017 10:13 am

Hi Ed. I changed my LMR to your initial method in the doc and had a good result. Got slightly better result when also adding || numSlides > 10 and || numSlides > 20 to the expressions that further reduce. Will keep playing but thanks. Have make ack. in code.

http://op12no2.me/toys/lozzadev
http://op12no2.me/toys/lozzadev/lozza.js

CRoberson
Posts: 2008
Joined: Mon Mar 13, 2006 1:31 am
Location: North Carolina, USA
Contact:

Re: LMR - [for starters] - [Advance] and [Expert]

Post by CRoberson » Wed May 17, 2017 2:05 am

Hi Ed,

Looked it over. Very interesting, as usual. I'll try the ideas that I haven't tried before. The thing that stands out to me has to do with
passers. I don't reduce any passed pawn move. It seems you do if the passer is not well advanced.

Charles

User avatar
asanjuan
Posts: 211
Joined: Thu Sep 01, 2011 3:38 pm
Location: Seville, Spain

Re: LMR - [for starters] - [Advance] and [Expert]

Post by asanjuan » Thu Jul 06, 2017 7:11 am

how did you get the values of the reductions table?

table[depth][movecount]

last year I was fooling around with a formula to fill a similar table, but nothing succeeded.
I have a very simple approach (maximum reduction of 3 plys) and I couldn't get nothing better with a table with heavy reductions like this one.

User avatar
Rebel
Posts: 5243
Joined: Thu Aug 18, 2011 10:04 am

Re: LMR - [for starters] - [Advance] and [Expert]

Post by Rebel » Thu Jul 06, 2017 10:41 am

asanjuan wrote:how did you get the values of the reductions table?
By typing :lol:

Using logic.
asanjuan wrote:table[depth][movecount]

last year I was fooling around with a formula to fill a similar table, but nothing succeeded.
I found a formula (probably derived from SF) that does a bit better than the table.

R = (int) (0.5 + log(depth) * log(movecount) / 2.1);
asanjuan wrote:I have a very simple approach (maximum reduction of 3 plys) and I couldn't get nothing better with a table with heavy reductions like this one.

Note that in the end I use a percentage on R (currently set to 50%) making the system fractional.

Dann Corbit
Posts: 11134
Joined: Wed Mar 08, 2006 7:57 pm
Location: Redmond, WA USA
Contact:

Re: LMR - [for starters] - [Advance] and [Expert]

Post by Dann Corbit » Thu Jul 06, 2017 6:59 pm

Rebel wrote:
asanjuan wrote:how did you get the values of the reductions table?
By typing :lol:

Using logic.
asanjuan wrote:table[depth][movecount]

last year I was fooling around with a formula to fill a similar table, but nothing succeeded.
I found a formula (probably derived from SF) that does a bit better than the table.

R = (int) (0.5 + log(depth) * log(movecount) / 2.1);
asanjuan wrote:I have a very simple approach (maximum reduction of 3 plys) and I couldn't get nothing better with a table with heavy reductions like this one.

Note that in the end I use a percentage on R (currently set to 50%) making the system fractional.
Your logarithmic formula is similar to my original "smooth scaling" formula:

double delta = approximateEval - beta;
delta = max(delta, 1.0);
double ddepth = double(depth);
double r = 0.18 * ddepth + 3.1 + log(delta)/5.0;
r = r > ddepth ? ddepth : r;
int R = int(r);

Most people don't bother with log and use linear approximations or use the logistic curve.
Taking ideas is not a vice, it is a virtue. We have another word for this. It is called learning.
But sharing ideas is an even greater virtue. We have another word for this. It is called teaching.

Dann Corbit
Posts: 11134
Joined: Wed Mar 08, 2006 7:57 pm
Location: Redmond, WA USA
Contact:

Re: LMR - [for starters] - [Advance] and [Expert]

Post by Dann Corbit » Fri Jul 07, 2017 12:25 am

Rebel wrote:
asanjuan wrote:how did you get the values of the reductions table?
By typing :lol:

Using logic.
asanjuan wrote:table[depth][movecount]

last year I was fooling around with a formula to fill a similar table, but nothing succeeded.
I found a formula (probably derived from SF) that does a bit better than the table.

R = (int) (0.5 + log(depth) * log(movecount) / 2.1);
asanjuan wrote:I have a very simple approach (maximum reduction of 3 plys) and I couldn't get nothing better with a table with heavy reductions like this one.

Note that in the end I use a percentage on R (currently set to 50%) making the system fractional.
SF uses a table. It does seem to follow your formula pretty closely:

Code: Select all

void Search::init() {

    for &#40;int imp = 0; imp <= 1; ++imp&#41;
        for &#40;int d = 1; d < 64; ++d&#41;
            for &#40;int mc = 1; mc < 64; ++mc&#41;
            &#123;
                double r = log&#40;d&#41; * log&#40;mc&#41; / 1.95;

                Reductions&#91;NonPV&#93;&#91;imp&#93;&#91;d&#93;&#91;mc&#93; = int&#40;std&#58;&#58;round&#40;r&#41;);
                Reductions&#91;PV&#93;&#91;imp&#93;&#91;d&#93;&#91;mc&#93; = std&#58;&#58;max&#40;Reductions&#91;NonPV&#93;&#91;imp&#93;&#91;d&#93;&#91;mc&#93; - 1, 0&#41;;

                // Increase reduction for non-PV nodes when eval is not improving
                if (!imp && Reductions&#91;NonPV&#93;&#91;imp&#93;&#91;d&#93;&#91;mc&#93; >= 2&#41;
                    Reductions&#91;NonPV&#93;&#91;imp&#93;&#91;d&#93;&#91;mc&#93;++;
            &#125;

    for &#40;int d = 0; d < 16; ++d&#41;
    &#123;
        FutilityMoveCounts&#91;0&#93;&#91;d&#93; = int&#40;2.4 + 0.74 * pow&#40;d, 1.78&#41;);
        FutilityMoveCounts&#91;1&#93;&#91;d&#93; = int&#40;5.0 + 1.00 * pow&#40;d, 2.00&#41;);
    &#125;
&#125;
Taking ideas is not a vice, it is a virtue. We have another word for this. It is called learning.
But sharing ideas is an even greater virtue. We have another word for this. It is called teaching.

User avatar
Rebel
Posts: 5243
Joined: Thu Aug 18, 2011 10:04 am

Re: LMR - [for starters] - [Advance] and [Expert]

Post by Rebel » Fri Jul 07, 2017 4:39 am

Yep, that's the one, I recognized it from a discussion with Bob in EO.

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

Re: LMR - [for starters] - [Advance] and [Expert]

Post by Michael Sherwin » Sun Aug 13, 2017 8:53 am

Rebel wrote:
asanjuan wrote:how did you get the values of the reductions table?
By typing :lol:

Using logic.
asanjuan wrote:table[depth][movecount]

last year I was fooling around with a formula to fill a similar table, but nothing succeeded.
I found a formula (probably derived from SF) that does a bit better than the table.

R = (int) (0.5 + log(depth) * log(movecount) / 2.1);
asanjuan wrote:I have a very simple approach (maximum reduction of 3 plys) and I couldn't get nothing better with a table with heavy reductions like this one.

Note that in the end I use a percentage on R (currently set to 50%) making the system fractional.
Hi Ed, Dan, others I've not been very successful scaling my LMR so I gave the above formula a try and it does look promising. However my LMR has a bit different characteristics.

Code: Select all

        reduce = 1;
        if&#40;depth > 3 && g->phase == NEXTMOVE&#41; &#123;
          count++;
          if&#40;g->node->score + 10 < alpha&#41; &#123;
            if&#40;count > (&#40;inNull > 0&#41; << 3&#41; && cid == EMPTY&#41; &#123;
              s32 m = histTblg&#91;fig&#93;&#91;fs&#93;&#91;ts&#93;;
              s32 n = histTbln&#91;fig&#93;&#91;fs&#93;&#91;ts&#93;;
	      if&#40;n > 49 && m/n < 16&#41; &#123;
                reduce += (&#40;int&#41; &#40;0.5 + log&#40;depth&#41; * log&#40;count&#41; / &#40;log&#40;m/n+1&#41; + 1&#41;));
	      &#125; 
	    &#125;
          &#125;
        &#125;
        if&#40;reduce == 1&#41; &#123;
          g->node->score = -Search&#40;-beta, -alpha, depth-1, extendBy&#41;;
        &#125; else &#123;
          g->node->score = -Search&#40;-alpha-1, -alpha, depth - reduce, extendBy&#41;;
          if&#40;g->node->score > alpha&#41;
            g->node->score = -Search&#40;-beta, -alpha, depth - 1, extendBy&#41;;
        &#125;

Code: Select all

    case ADDMOVES&#58;
      h->phase = NEXTMOVE;
      AddMoves&#40;h->node, depth&#41;;
      if&#40;h->node == &#40;h+1&#41;->t&#41; return FALSE;
      if&#40;depth > 3&#41; &#123;
        for&#40;node = h->node; node < &#40;h+1&#41;->t; node++) &#123;
          Sort&#40;node, &#40;h+1&#41;->t&#41;;
          MakeMove&#40;&#40;moves *)&node->m&#41;;
          if&#40;GetReps&#40;))
            node->score = 0;
          else &#123;
            inShort++;
            node->score = -Search&#40;-beta - 180, -alpha + 20, depth > 7 ? 3 &#58; 1, extendBy&#41;;
            inShort--;
          &#125;
          ClrReps&#40;);
          TakeBack&#40;);
        &#125;
      &#125;        
So the score of the node is a real score from a 1 ply or a 3 ply search. I also use a history table. If history table is 15-12% then reduce one ply max, 11-8% reduce 2 ply max etc.

So I tried to include that functionality in the function. Does that look like a good approach or is there a better way. Any other observations, suggestions welcomed. Thanks.
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

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

Re: LMR - [for starters] - [Advance] and [Expert]

Post by Michael Sherwin » Sun Aug 13, 2017 9:14 am

Sorry Dann, I'm sure I hit two n but ever since I installed windows ten ...
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

Post Reply