Genetic Barcode (Preview Post)
Barcode Cube Light
Project description:
This project takes two barcodes and runs them through a genetic algorithm to produce the next generation of barcodes. The two main goals are to produce a physical piece of art from this code, and to find any real world products by getting two unique barcodes to mate.
Using genetic algorithms has been extremely fascinating! Even with something as simple as a barcode. The coding portion of this project was done using Maya’s MEL language.
Why not use python or some other language? I do have plans for this code outside of this project that go way beyond the scope of a several week art piece.
The biggest challenge of this project was to design the genes. This is explained further in the Technical Statement portion. Getting a functioning barcode was a bit of a challenge, and building the next generation of barcodes took some debugging to sort through. Some interesting results were that after 2 generations, mutations were added. Somehow the code was able to mutate my barcodes to have much longer barcodes than possible.
These are some of the most common numbers from generation 3 from a set of 120 “children barcodes”
222222222722
212122222222
222292222922
777777777777
222222222222
997797777977
mutation on child 21 - 7999799777979997
For comparison - here are some of the first generation numbers
682645884669
750759955885
224285485859
A barcode can only be 12 digits for the types of barcodes used in this project, so I’m not entirely sure how these mutations are being created. Luckily, for the artistic portion of this project, I could choose the barcodes I wanted from each generation.
Artistic Statement:
The physical piece that was built using the parent barcodes, the generation 1, and second generation of barcodes. This piece is meant to showcase how some of the imperfections seen on the outside (of the physical piece) ultimately do not matter, as what’s inside projected out into the world is what is really important. This is the reason why this piece was not made using a laser cutter, but was actually made by hand using wood, paint, glue, and some screws.
There are parts of this build that were incredibly frustrating and it can be seen on the physical piece itself.
Technical statement:
This code was a bit of a massive undertaking as I wrote roughly 1500 lines of code from scratch. My best approach to this was to split things into parts. The first part, building a barcode within Maya using shapes and shaders. The goal was to give a 12 digit UPC code as an input, and then produce a physical barcode where I could control certain attributes such as height, width, and depth.
The second, more challenging part was to build the genetic algorithm that could take two inputs and give a third, completely new but valid output. This took a majority of the time spent on this project.
Lastly, some additional features were added so that I could evaluate multiple offspring at once, either over the time or spatial domain. This was crucial for bringing everything together.