Peter Sels Peter Sels

Minimising Time to Rescue in the Beach Business with GPT4

I dialogued for 2 days with OpenAI’s GPT 4 in this session. The result is this article including the flawless mathematical derivations (!) and the fully working Python code (!) below. 80% of code and derivations was GPT4 generated. I tweaked and curated and rewrote about 40% of that and added 20% of my own doing. As for the article’s English text itself, GPT could generate anything I asked, but I still wrote/rewrote most of it myself. donfrodo supplied the pictures using Midjourney.

This article is meant as an example case of how AI LLMs and humans can collaborate and achieve valuable results faster. GPT4 is truly astounding in many areas: natural language comprehension and production, a high degree of reasoning, mathematical derivation, computer code understanding, production and manipulation. 

Read the full Medium post or/and see the GPT & me produced Python code on GitHub.

Read More
Peter Sels Peter Sels

Reaching Quantum Advantage on Super Sudokus with D-Wave

This article on the Medium publication “TowardsDataScience” discusses our Python experiments and results with the D-Wave Quantum Annealing Machine when we programmed and unleashed them on Super Sudokus up to size 49 * 49, so not just your regular 9 * 9 ones.

To the best of our knowledge, this has never been done successfully before. Code online never goes beyond 2x2 for the gate model quantum computers and D-waves own sudoku code online only goes up to 3x3 for their quantum annealing machines, meaning quantum advantage on Sudokus is nowhere to be found online.

With our code, we almost always get valid solutions and show quantum advantage (time to solution savings) of 31% and 82% compared to the latest and fastest MIP solver Gurobi v9.1.0 on super sudokus on classical computers.

Read here on Medium’s “Towards Data Science” publication how we did it, and how you can too, for free, with our open sourced Python QuantumSudoku code and via a developer scheme of 1 free quantum computer minute renewed every month with D-Wave.

Read More
Peter Sels Peter Sels

Geometric Optimisation for Industrial Challenges

Space … It often is a scarce and costly resource. That’s why many like to use it wisely, whether it’s industry, the restaurant business or indeed agriculture. In this article on Medium, we show how a mathematical approach to two actual industrial challenges can help find valid and even optimal solutions.

Read More
Peter Sels Peter Sels

Chain Gang on a Fence

1. Myth

Dining last night with some neighbours, one of them came with the following story. “When we were kids”, he said, “we used to give hands to each other, left to right, in a long chain and then the first one used to touch an electric fence. None of us would feel any electric current or shock, but the last one felt it all!

I reacted that this could not be the case, but he replied: “It is surely the case, since we did it and we all experienced it!” I then asked him how it could be the case ‘scientifically’ because surely, the current the last person felt should come through the arms of the previous people and he replied that this is/must be the case because “any but the last person is ‘just a conductor’.

2 Refutation

Depending on the amount of science one understands, one may use different techniques to convince people that the conclusion that the last person suffers the most as well as that the other persons would not feel anything is just wrong.

Read this article on Medium on how some people believe this and how to best refute it in different ways, using almost no, a little or a lot of science, mathematics and engineering.

Read More
Peter Sels Peter Sels

Calculator Coding

I guess that, back in 1987, there was a 5% to 95% split between people with HPs and people with the omnipresent TIs. At least, in each class of about 20 to 30 people there was only one or max two students with a HP-11C or HP-15C. It made me feel quite special already. :)

But it ran deeper than that.

RPN? Anyone?…

Read More
Peter Sels Peter Sels

Chess Concurrent Compress

Ye Olde 1985 Chess Compress Challenge

In our previous story, Chess Compress, we took up a challenge published by the kijk.nl magazine back in 1985 where we tried to put as many pieces on a chess board as possible, without any threatening any other. More accurately, we are rewarded a score of 1/n for each piece in a solution, where maximally n pieces of that type can be put on a board without any threatening another. So each queen and rook score 1/8 points, each king scores 1/16 and each bishop scores 1/14, each knight scores 1/32. One then has to come up with a bunch of chess pieces on a chess board that maximises this score. If we restrict ourselves to just one type, the optimal solution is just one. So the challenge is to smartly combine different piece types that are in some way complementary.

The New and Enhanced 2020 Challenge

Now that the optimal solution to the 1985 challenge is known, can we make the puzzle harder for humans? Would it then also be harder for the solver?…

What would be harder for humans is to restate the problem so that there are more pieces in the optimal solution. For humans, it is then harder to check the increased interplay between the higher number of pieces.

Read on on Medium, to discover the optimal solution also to this 2020 challenge and how it has a remarkable structure …

Read More
Peter Sels Peter Sels

Chess Compress

As a 14 year old boy, so in the year 1971+14=1985, my parents donated me a subscription to “Kijk”, which on its cover, in Dutch, called itself “Populair Wetenschappelijk Maandblad”. This translates as “popular science magazine” rather than “popular scientific magazine”, as it wasn’t so much trying to boast about its high subscription levels but was aiming to awaken interest with readers in general scientific and engineering topics. As for me, it managed to do so.

One month, I must have been 15, Kijk published a challenge that intrigued me. It was about trying to place as many chess pieces on a board without any being able to catch any other. You were allowed an unlimited amount (or 64 if you want) of pieces of each type. However, pawns do not participate.

Clearly, if the weight by which you count would be 1 for each type, you’d just put 32 knights on all squares of a chosen color (either black or white) and be done and the score would be 32.

However, instead, each piece is counted with a certain weight depending on its type only. This type weight is equal to one over the number of pieces of that type only you could put on the board without any of the pieces being able to catch any other piece. So a queen would get 1/8 points, as one can put maximum 8 queens on a board without any queen threatening any other queen. The “Eight Queens” problem is in fact quite well known. See https://en.wikipedia.org/wiki/Eight_queens_puzzle.

A king gets 1/16 points, a rook 1/8 points, a bishop 1/14 points and a knight 1/32 points. The idea of the weights scaling is that, the more ‘powerful’ a piece is, the fewer one can typically collect on a board and so the harder it is to get many of them, so the higher the reward must be to fit more of them on the final problem. Fitting 8 queens results in a score of 8 1/8 = 1 but fitting 8 kings only results in a score of 8 1/16 = 1/2.

I puzzled a bit and my dad also helped and then we wrote a letter back to Kijk, which I still remember contained the hand-waving sentence that “Surely, the best solution could not possibly be much better than ours.” A feeling of uncertainty about that claim stuck … until now, when we actually have some tools and some time to find a better solution and also possibly prove its optimality.

I still have all my Kijk magazines at home, bundled in 3 dark blue hard covers, one per year, which you got when you extended your membership with a year. I should look for the issue that published the results of that contest. I only remember there were quite some people that beat us at it which higher scores. So much for the hand-waving argument. But before looking things up, let’s try with a IP (Integer Programming) solver. So it took 34 years for me to have time to reconsider this gem of a challenge. :)

Read on on Medium on how to solve it.

Read More
Peter Sels Peter Sels

Super Sudoku

The Sudoku version played on a 9 x 9 squares board, is a well known puzzle game. The goal of the puzzle is for the player to put a digit from 1 to 9 in each free square, so that: (a) in every row of 9 squares, no digit occurs more than once (b) in every column of 9 squares, no digit occurs more than once (c) in every marked 3x3 subsquare, no digit occurs more than once. A given 9 * 9 Sudoku puzzle typically contains some squares that already contain a number from 1 to 9.

See how we mathematically formulate these constraints and solve it, and its big brothers, the Super Sudokus, with Integer Programming in our article on Medium.

Read More