# Stack as many industrial components as possible in a crate

The exact problem is a crate of industrial parts, made by injection molding in very high quantities.

The objective is to put as much parts as possible in one crate. This is done by a small robotic arm that take the part from the injection molding machine, cold it a little and put it in the crate.

The shape of the parts can be a bit complex. It can be basically anything that can be molded into a 2 parts mold. Sometime it is simple. I mean, there is not tons of way to stack pan handles. Sometime the parts shapes are quite complex. Think about dumbbells. In some cases, stacking the parts along each other is not the best solution. Some arrangements are quite complex and implies vertical or diagonal parts. Also, the borders of the crate often break the patterns.

There is something like 20 different parts in production at the same time on different machines. Each month, there is one or several new parts designs. The minimum number of parts in the same production batch is 5000 and the maximum is several millions.

In some cases, the same crate contains a pile of one type of parts, then, above, another type of parts. 3 or 4 layers is not uncommon.

I cannot know by advance. The robot will receive a crate that is half full with other parts and it has to pile up parts starting from this surface.

The shape of the surface of already piled up parts can be scanned in 3D in real time. So somehow the problem can be simplified as a 1 part at a time problem.

The idea is that, by the end, the factory has a piling algorithm that they can easily deploy on new productions.

I'm willing to make simplifications to start exploring. I have to keep in mind that the solution has to be generic enough to be easy to deploy on new shapes of parts.

I'm currently looking a good framework to work with.

I had a look at NetLogo, with the idea to develop a simplified 2D case. I found a way to glue several agents together to make a more complex shape. But then, I found nothing linked with reinforcement learning or genetic algorithms that could work on this use case. This has to be implemented from scratch.

There are several other frameworks that seems to be interesting and use a generalist purpose language.

Julia has Agents.jl for agent based modeling that can deserve a similar purpose but with robust reinforcement learning and genetic algorithm libraries. Python similarly has AgentPy, Gym, and others.

This could be useful for first tests. Then I would need to use 3D frameworks with physic engines.

There are tons of physical simulation engines:

For the time being the one that seems to be the most complete is Unity 3D. It has a framework for agent based machine learning as well as Robotics.

Do you have some other ideas of things that I could explore ? Frameworks, algorithms...

Thanks