Tuesday, June 01, 2010

Sudoku rEvolution

A couple of years ago, I posted about a pet project of mine - my Sudoku Solver program. Over the years, I have continued to tweak it and I am pleased to say that it is evolving nicely.

In my previous post, I showed the results of solving a "Super Difficult" Sudoku puzzle from Carol Vorderman's "How To Do Sudoku" book using my Sudoku2 program. This puzzle required 496 recursions to solve and was solved in 228 milliseconds on my old Pentium D 3Ghz machine.

Well, computers have evolved. The same "Super Difficult" puzzle, using the same Sudoku2 program, was solved in just 156 milliseconds on a single core Windows 7 virtual machine with 1.5GB RAM, hosted on my Macbook Pro 2.4Ghz i5 machine. Not bad!

 Sudoku2 - SOLVED after 496 recursions in 156 milliseconds

 239 485 167
 751 396 284
 846 721 593

 628 173 945
 913 542 876
 475 869 321

 187 254 639
 364 918 752
 592 637 418

My latest version, Sudoku3, makes use of the same recursive, backtracking algorithm as its predecessor, but I have used Lambda expressions to dramatically simplify the code. I also implemented an optimisation to cache row, group and column assignments for cells and changed the algorithm to reduce the number of recursions. These changes have resulted in simpler code and significant performance improvements. Sudoku3 solves the "Super Difficult" puzzle in just 94 milliseconds on the same virtual machine. I am really stoked with these results!


 Sudoku3 - SOLVED after 248 recursions in 94 milliseconds

 239 485 167
 751 396 284
 846 721 593

 628 173 945
 913 542 876
 475 869 321

 187 254 639
 364 918 752
 592 637 418

I have uploaded the code for Sudoku3 to MediaFire for those who are interested.

In future, I plan to make use of threading to see if I can further improve performance by modifying the code to run parallel solution attempts on different processors. This is more tricky than it sounds. My first attempt showed that the thread management overhead resulted in a performance degradation.

I am going to try the new the new .NET Framework 4 parallel programming features and Reactive Extensions to see whether I can harness the power of parallel processing and make it faster. Watch this space...

Monday, May 24, 2010

Working with Equitel in Bogota

Last month there were several press announcements about the partnership between MiX Telematics and Equitel. Myself and three of my colleagues from MiX Telematics have had the pleasure of working with Equitel for the last week and what a pleasure it has been!

Russell Simmonds (Team Leader, MiX Telematics) & Ricardo Correa Pulido (Development Director, Equitel) in front of the Equitel building in Bogota.

I must admit that I was somewhat apprehensive about travelling to Bogota, Colombia as it is a city that has received much bad press in the past. I am pleased to say that my concerns have been completely allayed. Apparently Colombia fell victim to a high crime rate in the past due largely to corrupt law enforcement officials. A strict national security policy and eradication of corruption has turned this around and Bogota is a city alive with construction and other development activity.

Bogota is a great city and Columbia a beautiful country! The people are friendly and helpful and have a real zest for life. Like every city, there are areas to be avoided, but we have not felt unsafe at any time during our visit. We spent the day walking around an area in the North East of the city today and thoroughly enjoyed ourselves despite getting drenched in a downpour on the way back.

The team from Equitel are extremely professional and it is truly a pleasure working with them. We have found communication easy despite the language barrier. Most of the people at Equitel speak English very well. It is exciting to participate in this integration project and we are very enthusiastic about what will arise from our partnership.

Juan, the head of Equitel, and his team have been outstanding hosts! In all my travels, I have never experienced such excellent hospitality. They have given us a taste of Colombia and we are totally hooked. We have had the privilege of visiting several fine establishments and places of interest and built relationships that will last a lifetime. I will always remember Bogota for it's vibey music.

I am grateful for the opportunity to be a part of this great venture. It will be with fond memories that I bid farewell to our colleagues from Equitel when we leave on Wednesday. I look forward to my next visit to Colombia with great anticipation.

A panoramic view of Bogota with the Andes mountain range in the background.

Dusting off Wayne's Spot

I think the time has come to dust off this old blog of mine. It's been a while since I posted anything and I plan to pick up the pen again so to speak. Watch this space...

Friday, December 05, 2008

Breakthrough

Looking in through tear-stained aching eyes,
Swirling threads of choking pain engulf the one I love.
The ever-tightening, overwhelming web keeps closing in.
Helplessly I cling to the One who shares our pain.

Faith the shield that quenches fiery darts,
Too small it seems to raise us from the depths.
In quiet desperation I call upon His precious name.
I wrestle with all my might to leave it with Him.

Building up, the wave intensifies,
Dark blue turns to deepest, blackest night.
Every fiber of my being stretched in burning anguish,
Breathing hurts too much and tears run dry.

When will You reach out and hold her hand?
Will You fill the gulf that can’t be crossed?
You speak of purifying fire that will burn up every thread.
I trust in You alone my God and King.

Wednesday, September 10, 2008

In loving memory of Gag

G and James

Hey G,

I can't believe you've been gone a year. It feels like yesterday that we were enjoying those lovely low clouds on a cold winter's morning. I miss you now more than ever! I'll never stop missing you my boet!

I miss flying with you so much! I really miss your smile! I miss your enthusiasm, your zest for life and your handshake! The world is not as bright since you left but you left us with memories that will never fade. I am so grateful for all the awesome times we had together.

I love you and I'm looking forward to seeing you again some day. Have a ball up there and enjoy the flying!

Lots of love,
Your big boet.

Thursday, November 22, 2007

Fun at Keisie

We had a great weekend riding our bikes on a beautiful farm in Keisie Valley near Montague this weekend. The terrain is absolutely fantastic with great riding for all tastes. GraZer organised the trip for us after thoroughly enjoying the regional enduro event which took place there earlier this year.

I managed to drop my bike on a rocky section and smash my odo on the first day. Francois had a nasty fall in the same spot the following day. Charles got a puncture and little Jonathan almost passed out from heat exhaustion and dehydration at one point. But despite all that, we had a ball!

GraZer was an outstanding host as always and patiently led us all through a variety of terrain ranging from easy to eish! The man is a machine! I don't know where he gets the energy from. The family rode like champions and thoroughly enjoyed themselves.

This was taken on top of a koppie on the farm. There is an awesome 360 degree panoramic view from the top of it. We were so proud of Reece for making it to the top! It was the steepest hill climb he's ever done on his little bike.

Keisie

GraZer managed to pack all our bikes into the braai lapa at night. The sun shining on the bikes in the morning reminded me of a bike shop showroom window.

Bike Shop

We're hoping to go back again in January. It was really excellent fun!

Monday, November 05, 2007

It hurts!

Since Gareth died, I just haven't had anything to write about. Things I used to enjoy (like blogging) just seem so irrelevant now.

I have always sympathised with people who have lost a loved one but I never imagined how difficult it would be to bear the tremendous grief that comes with the sudden, unexpected loss of a brother in the prime of his life.

This grief is like an unbearable weight that never seems to lift. It comes in waves. Its effects are profound. There are good days and bad days. Life goes on but it will never be the same again. The world somehow seems just a little bit darker.

I know Gareth is having a ball! He is with his Lord and Saviour, Jesus Christ. He is rejoicing, reunited with Laddie, Nana and all the others who went before him. I know that we will meet again when my time comes, but I miss him so much! I am so grateful for the wonderful memories. Memories which I will treasure forever.