Consider a different package - problems is the package for the problems.
I'm not sure if anyone has an algorithm like yours (I didn't see one), but check around. Someone may have made a suitable package. If not, think about making one.