Im trying to create a program that would input a csv file with two lists of plate thicknesses, in this case tungsten and quartz, and their ID numbers. Then sort them, returning a CSV file with “stacks” of 8 plates (4 tungsten and 4 quartz) that are as close to the goal thickness as possible.
Mathematically I have an idea to break it down into sections, ie. Take a quartz plate and subtract it from a quarter of the goal thickness then find a tungsten plate that is the closest to that difference. Repeating until I have a list of pairs of tungsten and quartz.
I would then repeat with these pair subtracting their sum from half of the goal thickness matching them to another pair of tungsten and quarts returning a list of “halves” (2quartz 2tungsten)
Doing this one more time with the halves returning a csv file with packages of plates optimized to fit with eachother to get as close to the goal thickness.
Its been a long time since I worked with python and I was looking for some advice on how to make this come together so I apologize if I havent used the proper terms.
I have done some reading and found examples of the stable marriage problem but my issue is that Im working with unequat data sets, specifically there are more tungsten plates than quartz.
Im also lost whether its an appropriate application compared to concepts like the knapsack problem.
PhysicsMajor is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.