^^ I'm an engineer and just brute forced the hell out of this with a VBA script in excel. It runs through every single possible armor combination there is in my database and picks the global maximum of DPS weight while equal to or above the acc requirement i enter. But I do like your approach, would of saved me some time if I thought about it from that perspective initially. Script usually takes about 30 seconds to a minute on this machine to go through it all. However with every new piece of gear I add I double the amount of combinations by two and depending on a whole lot of things could multiply the calculation time to who knows hahah.
Edit. In between every gear set possibility I apply the food buffs to the current set and do my rounding (flooring). It should be pretty accurate provided the game doesn't have any weird order of operation/rounding/truncation rules