I am a student of computer science and mathematics at the University of Ljubljana, Slovenia. I am interested into discrete mathematics, operating systems, music and everything in between.
One of the things I learned while computing sequences for OEIS is that even though it is in some cases beneficial to convert a generic problem (such as the problem of factorization) into a optimization problem, it is not even nearly always so, even if the resulting optimization problem is unconstrained. If the objective function of the resulting optimization problem has no usable properties or is perhaps too random, it is probably not worth the effort.
Therefore, one cannot easily convert a generic factorization problem (factor the number N) into a optimization problem, due to the objective function that maps candidates for factors into being too random.