Reputation: 145
I'd like to use an ILP solver (e.g. lp_solve
) to find the solution for an optimization problem.
The challenge is that some constraints are too complex to be formalized as linear statements, but may be validated using a simulation framework.
So I'd need to run the solver, check the solution against my complex constraints, and in case they are not satisfied, continue with the second-best solution etc.
Is there a solver that does not only provide the optimal solution, but the best n solutions regarding the give objective function?
Upvotes: 1
Views: 1108
Reputation: 58501
Yes, there is:
Either the solver supports it through a solution pool,
or you have to build this solution pool yourself through the callback functions provided by the API of the solver.
In the latter case, the corresponding callback function is called whenever a new, better solution is found than the best known solution up to that point. The second option is supported by all the notable solvers I know of.
Upvotes: 2