Search

NOC Week 9: Genetic Algorithms

This week we started learning about genetic algorithms and how they can be used in computer science to - in short - solve a particular problem through the mimicking the process of natural selection and evolution.


For this week I wanted to do a though experiment to see if there was a way to use this process to solve a problem that I run into in my line of work. And once I started doing some research, I fell down a bit of a rabbit hole. Scroll down past the TL;DR section if you want to skip to the actual design prompt.


I work at the LaGuardia Studio at NYU, where we collaborate with members of the NYU community on their various 3D printing and 3D scanning projects. Our goal has always been to deliver the highest quality results, whether it be in the field of art, science, maths, medical, archeology, ecology, architecture...and everything in between.


Part of our job is to help our clients in deciding which materials will be best suited to their project requirements that are also cost effective, and time-efficient. All of the materials and and printers we have each have their own operational requirement, post-processing requirements, pricing and print-speed limitations to consider (we refer to is as their personalities). While thinking about ways in which I could employ some sort of algorithm that could simplify the process of determining the best material and printer for the job at hand, I realized that my team - by virtue of us working together for so long and being in this industry for so long, have already employed some of the techniques used in genetic algorithms to determine best "fitness" for each project. We know from past projects and past experiences that certain designs won't work in certain machines, with certain print orientations and certain materials.


An example of various projects that we've printed in the past in various materials


So at least in my mind, there isn't a computer trained model that can predict which printer/material is best for a specific design better and faster than my colleagues. Then I though, instead of trying to make the process of picking a material more efficient, what if we could use genetic algorithms to make the material themselves work better for the particular project.

In my own tinkering of hobby FFF (fused-filament fabrication) 3D printers at home, I've done some research in the past on how temperature fluctuations of PLA (polylactic acid) during extrusion can impact PLAs mechanical properties. Broadly speaking, and through real-world testing, it has been found that higher extrusion temperatures of PLA out of a nozzle can "result in increased thermal bonding and inter-/intralayer lamination and resulted in a higher tensile strength" (ACS Omega 2018, 3, 4, 4400–4411Publication Date:April 23, 2018 https://doi.org/10.1021/acsomega.8b00129). This specific study isn't the only one that's been done on this topic and with a variety of other materials. There was one study done where a genetic algorithm was used alter the 3D printer file (G-code) to increase the strength of ABS (acrylonitrile butadiene styrene) plastic - another common material used in FFF printing. These alterations are typically related to nozzle temperature, print speed, layer height, infill shape, outer and inner wall thickness, and bed temperature in a effort to make the material itself better.


------TL;DR------


In 3D printing, there are often sacrifices that need to be made in the service of your needs. A mechanically stronger print in ABS oftentimes take much longer to produce as it will require a higher resolution print with thicker walls and a higher infill percentage - for example. There is always a trade off for each material, especially when you're working with a variety of materials and printing technologies and not just FFF. This is why these studies are being done with genetic algorithms, to help make printing faster and cheaper without sacrificing mechanical function.


This is all well and good for single material printers, but what about printers that can print in many different materials. What about printers, like the Stratasys J850, that can print in 6 materials at once?


Is there a way to use a genetic algorithm to determine how materials should be mixed to create the best mechanical properties for any given project? This is what I was interested in and what I wanted to try to explore.


The printer I am referring to is the Stratasys line of PolyJet printers. It's an acrylic-based photopolymer resin printer that uses PolyJet technology to create really 3D prints. The printer mixes it's materials by spraying droplets roughly 27 microns in size of each material on any given layer at around 600 dpi, similar to how an inkjet printer works. The software determines the mix of materials with limited control. You can choose RGB value, or use texture images to determine how color is mixed and deposited on the print. This works the same way with other materials that work with this machine, such as clear and flexible materials. But in all of these solutions, you need to have carefully designed your model so that the mechanical and visual properties suit your needs. For many, this is a really difficult process and you need to have a knowledge of the materials, an understanding of how the machine works, along with advanced 3D modeling skills to fully utilize the printer's capabilities. With voxel printing, we can alter the mix of the various materials at the voxel level.


My idea is to use a genetic algorithm to experiment on the mixture and dot-matrix of the rubber-like resin and rigid resin to achieve various, alternative mechanical properties that can be changed throughout the print to effect different parts of the design both mechanically, and visually.


A short video explaining the benefits of voxel printing


While I don't have a specific desired output for this experiment, I think for most people it would be an increase or decrease in specific mechanical properties values depending on what the project is calling for. We can use the ASTM's lab testing standards to help determine how our voxel designs are performing, along with virtual mechanical simulations run in various CAD simulation programs.


For the purposes of simplification, let's say we want our 3D print to have the highest tensile elongation at break value. Our population will be a certain number of generated 3D model designs that have a random number of rubber-like voxels and rigid-voxels, dispersed randomly throughout the 3D model. These can be automatically generated in a program like MATLAB, and can then be printed out and tested. I like the idea of using a Perlin noise random generator because we might get more subtle variation in the material-type voxel dispersion that may yield optimal results faster (though I honestly have no idea).


An example for what the various designs could look like as part of the population


We would then take a number of the top performers with the highest value as the "parents" and compare the designs. The idea is that we would check for voxels that are shared between both parents (voxels are of the same material located in the same 3D coordinate space). Those values would remain the same in the child generation (with chance for mutation) while we continue to randomize the remaining voxels and further test the results.


The fitness function would be related to the overall score the design achieved through tensile strength testing. We could probably assign each voxel in it's specific location a relative score (a percentage of the overall elongation number) and if a specific voxel scores higher than another, it has a higher chance of having the same material assignment in the next generation).


I think mutations are important in this specific case because I could see a design getting "stuck" with a particular voxel pattern and not evolving in a way that could get us a better result. So I would definitely introduce a probability value that a voxel could change material regardless of if it was considered successful in that specific position.


I also thought that this doesn't need to extend to mechanical properties, but could be purely aesthetic driven. We could generate the voxels using RGBA values and the generations could change as a result of our response to the colors and transparencies being achieved from the various material mixing. I haven't had any time to try voxel printing out for myself yet, but it seems like the possibilities are virtually endless. Combining with a genetic algorithm or a process like the game of life, we could generate some really beautiful 3d prints. While I think this is a bit ambitious for a final project, it is something I'm interested in exploring in the future.