Freewill in progress (6)

17 novembre 2017

After a rather very long break, I just restarted working on Freewill.  I always like to step away from a project for a while : it helps you spot problems in your code or design whenever you have those « what the f*uck is this code doing? » moments!  I had a few of those and this will make the code much cleaner hopefully!  Besides, one very bad design decision I made early on will be corrected!

I am also currently adding (as you can see) more and more examples.

Expect Freewill by Xmas!

P.S. And expect it to be 100% Squeak compatible as well!  ;)


Ruzzle : mise à jour (2)

7 décembre 2016

ruzzle-7-dec-2016

Ce soir, dans le cadre du petit défi (tous mes articles concernant le Ruzzle sont ici) que j’avais relevé il y a de ça belle lurette, j’ai dépassé le cap des 630 millions de grilles générées à l’aide de mon algorithme génétique Freewill sans avoir encore pu dépasser la marque de la meilleure grille de ruzzle (comportant 1634 mots) établie par Didier Müller.  J’ai trouvé plusieurs fois des transpositions des 2 meilleures grilles que lui-même avait trouvé mais je n’ai jamais pu faire mieux!

La recherche de cette meilleure grille va tout de même se poursuivre jusqu’à ce que j’aie terminé la première version de Freewill mais à moindre vitesse!  Il est temps que je me réapproprie quelques CPUs de mon ordinateur!


Freewill in progress (5)

22 novembre 2016

freewill-logo

Not much new code was done since the last update.  But since I usually like to put my projects aside for a while just to have those « WTF-was-I-thinking » moments looking back at my own code, I took some time to scribble a skeleton of a FAQ and design a logo.

So coding of Freewill restarts today… with a fresh look at my code!

Save


Gnochon

14 octobre 2016

Thanks to Twipply, ZirconiumX and JoshS (regulars of ##chessprogramming on IRC), I finally decided to go ahead with my chess engine named Gnochon!  At first, development will be slow as I am still working on Freewill and plan on finishing it before mid-November.

In case you asked, Gnochon is a French slang word in Quebec meaning someone *really* stupid!

gnochon(click on image to enlarge)

Save


Freewill in progress (4)

3 octobre 2016

I’m done working on the 8-queens problem.  But while I was at it, I though I’d try something a little bit harder to solve.

30-queens(Click on image to enlarge)

Eight queens is fun. Ten queens is better.  But 30 queens is even better!


Freewill in progress (3)

2 octobre 2016

freewill_oct_2

(Click on image to enlarge)

What’s new?

After a break from Freewill (I like to put projects aside for a while, it gives me another perspective on my own code!), I just came back to it yesterday.  I had a few WTF moments (it’s usually a good indication that your code is not clear!), renamed some methods with imprecise names, cleaned up some of Ruzzle’s crumbs that were sprinkled everywhere, refactored code here and there, looked at what Code Critics came up with and corrected some of the issues, ran a few tests and finally got fed up by performance issues.

I got rid of the SharedRandom number generator that was previously used in Freewill.  This resulted in a huge speedup! From what I measured, the Random class is 2.1 times faster than the SharedRandom one! This change alone brought a performance boost of 31-48% !  I also cached the cumulative weights for the Roulette Wheel selection policy which gave me a 14% speedup!  There are still a few things I want to optimize here and there and my estimates tell me I could get another 15-45% speedup.

What’s next?

I’ll start adding tests to cover all policies (creation, selection, crossover, mutation, termination) to make sure the next changes don’t break anything.  This will also give me reproduceable tests against which I’ll get more precise statistics to measure performance.  I will also start working on another example, most likely the 8 queens problem.

To Do List Until Next Update

  • 8 queens problem
  • Policies Tests
  • Speed up Roulette Wheel selection
  • Start to add class/method comments
  • Code 2-3 more termination policies
  • Think about Freewill’ community (Google group?  Mailing List? Repository? etc.)

Freewill and Ruzzle

8 août 2016

Muller Record

(Click to enlarge)

Freewill already shows very good results!

My heart just stopped when I read the last results on the Transcript!  I had done it!  1634, my goal, had been achieved [1]!  I had broken Didier Müller’ record!  The maximum number of French words a ruzzle grid could contain was 1634!

The joy didn’t last long! I quickly realized that I had only equaled Müller’s record (see his results here), finding just another transposition of the 2 grids he had found.

But it’s promising!  The same iteration also found a grid with 1625 words in it, which is still better than Müller’s second best!  I’m currently setting up parallel workers to run 5 genetic algorithms at the same time. And this time, I’ll be looking for grids with more than 1634 words!

I want to break that record!

[1] Note: for those who are wondering what I am talking about, I explain that ruzzle quest here (in French).

Save

Save

Save

Save


Freewill in progress (2)

3 août 2016

Freewill Selection Policies(Click to enlarge)

What’s up?

As you can see, Freewill now supports 17 different selection policies.  At this point, all of them are coded but only half of them have been tested.

The 11 available termination policies are coded, half of them tested.

So far, only 2 mutation policies are available.  Both of them are coded and tested. I will probably need a few extras for TSP type of problems as well as numerically parametrized problems (e.g. De Jong functions with a domain for each variable).  I’ll probably add 3-4 other ones specific to the problem that started all this adventure!

Only one immigration policy (no immigration!) is available and it will stay that way for a long time.  I’ll wait until I am hyper confident that this framework is rock solid before introducing parallelism and exchange of individuals between « islands » (i.e. simulations).  This one is a faaaaaaar away!

Six crossover policies are available as of now .  This area will require some (minor I think at first glance) changes for the TSP type of problems : not quite decided on the approach I will take to solve this.  Since crossover is often very problem/chromosome specific, I’ll probably delay those change until the end, once I have all examples coded and ready to be tested to have a better idea of what is needed.  But I will definitely add a few (3-4) crossover policies tailored for the Ruzzle problem.

I have solved the discrepancy (see here and here) between my results and the TSPLIB ones regarding the tour length of the Burma14 problem.  Will probably add a lot bigger TSP problem to see how the framework can handle an extremely huge search space! Oh!  And I need to clean up all the crap I added/modified while looking for the problem of « distance difference » : 2 classes were butchered in the process!

I need to add a few « crash test dummy » classes to test all those different selection policies (and crossover) in a simpler and more efficient manner!  Or I should kick myself in the %*&#$!@ and code the « bits » example classes…

I will soon work on a customizable display of statistics.  All that’s needed is already there, it’s just a matter of gluing everything together!

Once I’m done with the 8 queens problems, I’ll attack the numerically parametrized problems.  Will probably have 2-3 examples (from De Jong functions) as well as the INSANE Griewank function.

The classes used for randomly choosing the next parent chromosomes as well as scaling/ranking can be optimized.  But since they just work great since day 1, I’ll keep that for the very end.  But I know they can be a lot faster than what they are right now.

I also plan on having a very basic export mechanism so I can dump all those ruzzle chromosomes in a MySQL database to be able to do some reporting and study the various policies and their effects.

I started adding comments to the classes, mostly to keep references, maintain a todo list per class and add some notes for myself to quickly remember why things work that way!

I’ll probably have an image by tomorrow that will run simulations for the ruzzle problem full-time. I wanna beat that record!

 

Save

Save

Save

Save


Freewill in action

19 juillet 2016

The very first image of Freewill (see here for details) in action, trying to solve a ruzzle problem as well as a TSP problem (Burma14) and a simple diophantine equation (Hermawanto)! Click on picture to enlarge!

First look at Freewill in action


What’s new?

19 juillet 2016

What’s new?

After a major data loss (I haven’t given up on getting back all my data, mostly code repositories and databases!), I had to start all my pet projects from scratch. Luckily, it’s easier second time around as they say! And, lucky me, I store all my personal stuff on the web! So here’s a list of what’s coming up on this blog.

Ruzzle

Even though I had a decent working version of the genetic algorithm program to find the best ruzzle grid (original posts in French here, here and here), I wasn’t satisfied with the code.  It slowly evolved from a bunch of code snippets into something I could somehow call a genetic algorithm.  Problem was that my solution was tailored for this specific problem only!  Since I lost all the Smalltalk code, I redid the whole thing from scratch : better design, simpler API, more flexible framework.  I can currently solve a TSP problem, the best ruzzle grid search and a diophantine equation.

I also plan to provide examples of the 8 queens problem, the knapsack problem, a quadratic equation problem, a resource-constrained problem and a simple bit-based example with the GA framework.  Besides, the are now more selection operators, more crossover operators, more termination detectors (as well as support for sets of termination criteria!), cleaner code and the list goes on!  So I’ll soon publish a GA framework for Pharo.

As most of you know, the Rush fan in me had to pick a project name in some way related to my favorite band!  So the framework will be called Freewill, for the lyrics in the song :

Each of us
A cell of awareness
Imperfect and incomplete
Genetic blends
With uncertain ends
On a fortune hunt that’s far too fleet

Bingo

A stupid quest I’ll address after the first version of my GA framework is published.  It all started with a simple question related to the game of bingo (don’t ask!) : can we estimate the number of bingo cards sold in an event based on how many numbers it takes for each card configuration to have a winner?  So it’s just a matter of generating millions of draws and cards à la Monte Carlo and averaging how many numbers it takes for every configuration.  Why am I doing that?  Just because I’m curious!

Glorp

There’s been a lot of action on the Pharo side and Glorp.  I plan on having a serious look at the latest Glorp/Pharo combo and even participate to the development!

Sudoku

I’ll translate my articles (in French here, here and here) on the SQL sudoku solver in English and test the whole thing on the latest MySQL server.  Besides, db4free has upgraded to a new MySQL server version!

NeoCSV

I had done a port of NeoCSV to Dolphin right before losing all my code data.  Wasn’t hard to port so I’ll redo it as soon as I reinstall Dolphin!

Smalltalk

It’s time to reinstall VisualAge, VisualWorks, Squeak, ObjectStudio and Dolphin and see what’s new in each environment!  From what I saw, there’s a lot of new and interesting stuff on the web side.  Add to that the fact that most social media platforms have had significant changes in their respective APIs recently, so there’s a lot to learn there!

 

That’s a wrap folks!