Note: ONCE, the Spanish National Organization of the Blind, is a not-for-profit organization established in 1938. It is the only organization of blind and visually impaired persons in the whole country. Its aim is to provide to its members with the widest range of services possible, from education to employment, from rehabilitation to reading services. ONCE is a self-funded organization, with the selling of tickets for its own lottery as its main means of funding.
For Spanish readers, the title of this article will remind them of a bygone era in which ONCE sellers, walking the streets with their lottery tickets hanging from their chests or from their newly installed booths, called us to participate in what would later be called “la ilusión de todos los días” [every day’s dream].
What few people know is that this activity entailed solving an interesting and complex mathematical problem derived from ONCE’s concern for facilitating the job of its sellers, many of whom are blind.
The organization allowed each seller to choose the variety (number of attached columns of different numbers) and height (number of equal numbers in said columns) of those panels on which they hanged their lottery tickets for display, which they called “topes”. In this way, the offer could be adjusted to the usual clientele of each seller, who would sometimes be inclined to buy several identical numbers to share among friends, and some other times would buy different numbers to have more chances of winning the draw. Each seller chose how many tops of different sizes they wanted to have for sale.
The numbering of the adjacent columns in each top was tricky, since it had to give the impression of being very varied, having both high and low digits, rich in different digits and endings, and they had to be different every day. To facilitate the job of the sellers and prevent them from having to learn the list of all the numbers for sale every day, the organization thought of a series of rules that would make it possible to deduce, from the ticket number in the first column of each top, those of the tickets in the following columns, simply by adding certain amounts to the number of the previous column.
In addition, the printing of the coupons was also intended to prevent a seller from receiving too many tickets having what they considered as “less sellable” numbers such as, according to their own jargon, ugly numbers (because they have too many repeated digits) or the “pelaos” (those ending in several zeros), to mention just two examples.
As a consequence of all of the above, the printing of lottery tickets entailed configuring the arrangement of a series of rectangles of different sizes (the topes) inside a rectangle with a larger area (the plate of the ticket-printing machine). Thus, the different printed sheets would contain the numbered topes according to the established rules, ready to be cut, selected, and distributed.
The mathematical problem of locating rectangles is as simple to formulate as it is complex to solve. At ONCE, a blind person was in charge of figuring out how to best fit the different-sized topes requested by the sellers inside the rectangles of the printing plates. Armed with a voice recorder to record the positions as he was thinking about it, he gradually adjusted the settings of the topes to optimize the settings for the printing of the tickets, so that paper was not wasted and the cutting process was simplified for distribution among the sellers.
This was an arduous task, taking weeks to complete. Therefore, sellers were allowed to request to change their ticket portfolio only a few times a year, typically once a quarter.
To improve this situation, ONCE asked AIA to create an algorithm for optimizing the printing of tickets that would make it possible to have different topes each week and even each day. It is curious to note that the problem of placing several rectangles within a larger one is one of the first use cases of quantum computers currently under development. Following the same algorithmic ideas, about 20 years ago, AIA created this algorithm and included it in a complete solution that contemplated vendor requests, planned optimal printing, and assigned printed and cut topes to vendors.
Thanks to this solution, the frequency with which sellers could change their ticket portfolio increased, allowing variations to be set for key dates or periods, such as holidays or vacation periods in which the clientele of the seller can vary substantially. Today, two decades later, this solution created by AIA continues to be used every day by ONCE, being one of our most beloved and present success stories.
This December 13, 2022, on the day of its patron Saint Lucia, ONCE turns 84. From AIA we want to congratulate the organization on this day and thank you for allowing us to put our slogan “algorithms for a better world” into practice, with our humble contribution to the work of the organization.