When I tried to solve a problem, I faced a situation when it requires solving a CLP(FD) incrementally.
For example, let M be a model of a CLP(FD). To solve it, we just need to query the model in prolog like
:- M.
Then it generates all domains for variables. But when we solve it again, the FD solver propagate the FD again. In this situation, I have questions:
Is there any way to save the result after constraint propagation about domains of all variable? And later load the saved result, and without recalculation of propagation, we can use the result in a query?
If it is possible, we can incrementally solve a model such as “M, C1, C2, C3” where “C1”, “C2” and “C3” are additional constraints. That is,
(a) first solve “M”,
(b) next add the constraint “C1” and solve the with the result of “M”. Not solve “M,C1” from scratch.
(c) next add “C2” and solve with the result of (B), and so on.
Also if we can backtrack the adding and solving in CLP(FD), it will be very helpful for my research.
I studied attribute variables for CLP(FD) but no idea. If you have any idea, please let me know it.
Thank you!
Yes, I know the use of fd_dom, and what I need is to save the information of domains as a record of the current state of FD model and load later for solving together with additional constraints. In the execution process, two queries are needed. So is there any way to save the information in a file and load it in the second query?
In fact, I am going to embed prolog app to solve FD problems in a program in C++.
In solving a problem in C++, I need to solve FD subproblems which requires embedding prolog engines. What I do is that I provide an initial FD submodel to SWI-Prolog and get some information about satisfiability. With the result, C++ part proceeds more and generate another FD subproblem to be solved in SWI-Prolog. The new submodel is almost the same as the initial submodel with additional constraints. So instead of solving the new model from scratch, I want to execute constraint propagation on the resulted state from the initial submodel. It saves computational time in long run.
Well, if it is possible, I want to generate many prolog engines, to feed submodels, which are almost the same as the initial model but a few constraints, into the engines, and to solve them in parallel processing. I tried to use many prolog engines but a problem is still I need to solve FD submodels from scratch all the time.