I think it very much depends on how hard your problem is. Small problems / search spaces will be fine in Prolog, but most realistic sized problems will quickly exhaust brute force search, and you will need to consider Local Search (like OptaPlanner), or Mixed Integer Programming, specialised Constraint Programming etc. There is a whole field of study on this - https://en.wikipedia.org/wiki/Discrete_optimization