Skip to content

Commit

Permalink
Simplification: use Arctan for the optimism S-curve
Browse files Browse the repository at this point in the history
This was an idea of Gontran Lemaire (gonlem), but the graphs
he published did not seem accurate to me. I did my own graphs,
got my own constants and here is the result:

STC:
LLR: 2.95 (-2.94,2.94) [-3.00,1.00]
Total: 42179 W: 8704 L: 8622 D: 24853
http://tests.stockfishchess.org/tests/view/5a9db6270ebc590297cb611b

LTC:
LLR: 2.96 (-2.94,2.94) [-3.00,1.00]
Total: 17737 W: 2702 L: 2577 D: 12458
http://tests.stockfishchess.org/tests/view/5a9eb5b20ebc590297cb61b2

Note: we are now back to 70% draw rate in selfplay mode!

Bench: 5544908
  • Loading branch information
IIvec authored and snicolet committed Mar 7, 2018
1 parent 65c3bb8 commit 82697f1
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions src/search.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -351,10 +351,7 @@ void Thread::search() {
ct = Options["Contempt"] * PawnValueEg / 100; // From centipawns

// Adjust contempt based on current bestValue (dynamic contempt)
int sign = (bestValue > 0) - (bestValue < 0);
ct += bestValue > 500 ? 70 :
bestValue < -500 ? -70 :
bestValue / 10 + sign * int(std::round(3.22 * log(1 + abs(bestValue))));
ct += int(std::round(48 * atan(float(bestValue) / 128)));

Eval::Contempt = (us == WHITE ? make_score(ct, ct / 2)
: -make_score(ct, ct / 2));
Expand Down

4 comments on commit 82697f1

@AlexandreMasta
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After this patch Im having losses with SF dev that didnt have before. Hope it is just a fluke. BTW I look the *note with some concerns about draw rate back to 70%. This cant be a good thing.

@Hanamuke
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wouldn't worry too much, as the ongoing regression test against SF9 and the previous one have respectively 73.9% and 73.5% draw, i.e. same drawrate within margin of error. I think the 70% from the note is at STC, and against different opponents, i don't think it is very significative.

@AlexandreMasta
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Current tests (regression tests) show that this patch is increasing loss rate.

@buhf
Copy link

@buhf buhf commented on 82697f1 Jun 5, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

arctan ~ A/(1+abs(A))

Please sign in to comment.