Forum Discussion
FICO
1 year agoCommunity Manager
Is it possible to count all possible Solutions of a Problem?
I wondered wether its possible to either get the number of all possible solutions of a problem or to actually block a solution after an optimization (in my case its minimize an IP) is done to search in the next iteration for another solution?
3 Replies
- FICOCommunity Manager
In principle, it is possible to enumerate "all" solutions of a problem. How to do this with Xpress is described in the manual here.
However, there are some caveats:
- You can only enumerate different integer solutions and even that only makes sense if all variables are bounded. Consider for example the problem "min x, x >= 0, no further restrictions". Any positive real number is a solution, so there are infinitely many solutions. Even if x is required to be integer, there are infinitely many solutions.
- Even if all variables are bounded, there may be a lot of solutions, so enumeration may take time.
- If you have integer and continuous variables in your model then enumeration is only on integer variables. If two solutions differ only in the continuous variables they will be considered equal with respect to enumeration by Xpress.
If you want to avoid a particular solution to be found (again) then you can add a (no good) constraint that explicitly forbids that solution: Assume your problem is all binary and has N binary variables x. Also suppose you want to forbid the solution represented by s. Then the constraint
sum(i in N with s == 1) x + sum(i in N with s == 0) (1 - x) < N
forbids exactly that solution.
If you only want to find solutions that are better than a certain value then you can add a constraint that requires the objective value to be better than that value. However, having a constraint that is parallel to the objective function can hurt numerics and it may be better to use the MIPABSCUTOFF control. This has the same effect without explicitly introducing that constraint.
Note however that as soon as Xpress finds a feasible solution, it automatically sets the cutoff so that only better solutions are found. So doing repeated solves will by default only find better solutions.
- FICOCommunity Manager
All right, thank you for the quick and detailed response. I appreciate the new insights into the solution finding process very much. I guess that leads to the conclusion, that it is not really implementable in my case (at least in a non tedious and non laborious way) since the explicitly forbidding 'method' seems to be the only way to get the job done.
Perhaps it was not quite thought through to think there could be something like a 'block()' method to just iterate through until no more new solution is found.
Again, thanks for the effort.
- FICOCommunity Manager
There may be something else you can do: You could use a preintsol callback to just reject any solution Xpress finds and also inject a no-good cut for that solution to avoid finding it again.
With this strategy you would have to collect the solutions yourself (because Xpress would never see a feasible solution) and you may not get all solutions to your problem.
But maybe the set of solutions you get is still good enough in this case?
Related Content
Related Content
Is it possible to output the used solving algorithm?
I'm usually working with Xpress Workbench or the optimizer via bash on Linux. Out of curiosity I compared its performances with the Xpress IVE 64bit and there I noticed the statistics tab with detail...1 year agoPlace FICO® Xpress Optimization ForumFICO® Xpress Optimization Forum6 unread comments6 unread0Views0likes6CommentsMIP solution status
Hello, I've been using code like this to get the solution status of a MIP: case getprobstat of XPRS_OPT: status:="Optimum found" XPRS_UNF: status:="Unfinished" XPRS_INF: status:="Infeasib...5 months agoPlace FICO® Xpress Optimization ForumFICO® Xpress Optimization Forum3 unread comments3 unread7Views0likes3CommentsIs it possible to output wether or not Branch and Bound was used during optimization?
On my current MIP model I'm checking the value of the ALGORITHM attribute to see which algorithm is used. This works fine for smaller parameters, but via setparam("XPRS_verbose", true) I noticed that...1 year agoPlace FICO® Xpress Optimization ForumFICO® Xpress Optimization Forum4 unread comments4 unread0Views0likes4Comments