I am wondering if I can add a solution as a future constraint, so that if I run a subsequent search on the same CSP I would get the next solution. I want to do this as I'm using jacop to find local solutions on a distributed CSP.
I thought using XneqC for each variable and its assignment into an "And" primitive constraint would work, but then subsequent searches find no solutions. I may be coding this wrong though…
Is there a known way to do this? or can a solution result be added in as constraint more directly, or perhaps return to the search at the last exit point or something like that?
Thanks for your time
I am not sure I really understand what you want to do but it sounds wrong. If you add the current solution as a constraint that the search will try to find a next solution different from the current one and it will not find it since you already constraint it to find the current solution. Basically the constraints will be contradicting since you constraint it to current solution values and the solver constraint it to different that the current solution.
The search basically uses depth-first-search and backtracks at the end to find a new solution, in case of all solutions search. Do you try to use restart search (http://jacopguide.osolpro.com/guideJaCoP.html#x1-440001)? You should also try to set a flag in search that informs the solver to not assign a solution (method setAssignSolution in DepthFirstSearch).