Particle Swarm Optimization Code

Discussion of chess software programming and technical issues.

Moderators: hgm, Rebel, chrisw

Karlo Bala
Posts: 373
Joined: Wed Mar 22, 2006 10:17 am
Location: Novi Sad, Serbia
Full name: Karlo Balla

Re: Particle Swarm Optimization Code

Post by Karlo Bala »

emadsen wrote: Sat Nov 24, 2018 11:38 pm For anyone interested, I posted on my website the C# code I wrote that implements a multi-threaded particle swarm optimizer. See MadChess 3.0 Beta Build 75 (Eval Param Tuning). I find the idea rather straight-forward and easy to understand. Each iteration a particle's velocity is influenced by inertia and is a) drawn toward their individual best location and b) their swarm's best location and c) the global best location. The magnitude of each vector (a, b, and c) is randomized so the particles jitter in parameter-space.

Has anyone else used PSO to minimize evaluation error? If not, what algorithm(s) have you used? Did you write the code yourself or did you write an evaluation error cost function and plug it into a third-party optimization library? Just curious what others have done.
A few years ago when CLOP was popular, I used PSO (also GA and PBIL) as an experiment to tune Toga parameters from scratch. After a few days on a very slow computer, tuned Toga was marginally better than original. PSO worked better than GA or PBIL.
It is not at all important for PSO to be multithreaded, because 99.99% of the time was spent on engine-engine matches.
Best Regards,
Karlo Balla Jr.
User avatar
xr_a_y
Posts: 1871
Joined: Sat Nov 25, 2017 2:28 pm
Location: France

Re: Particle Swarm Optimization Code

Post by xr_a_y »

I plan to "texel tune" with PSO, not play game.
User avatar
emadsen
Posts: 434
Joined: Thu Apr 26, 2012 1:51 am
Location: Oak Park, IL, USA
Full name: Erik Madsen

Re: Particle Swarm Optimization Code

Post by emadsen »

I plan to "texel tune" with PSO, not play game.
Yeah, that's what I did. I used PSO to find a better fit of eval parameters to game outcome by minimizing the error between eval prediction of game outcome and actual game outcome. I did not use PSO in conjunction with playing actual games.
My C# chess engine: https://www.madchess.net