[gecode-users] Multiple separate searches

Milton Friedman aemhm1 at hotmail.com
Fri Apr 20 06:36:46 CEST 2012


I'm working on a problem with many cases, encoded into an IntArray A, 
of which some branchings are valid according to a set of constraints, 
and for each of those valid cases, 
another IntArray B describes a more detailed analysis, 
subject to other constraints.

I only need one solution of B for each case.

So what I think I should do in Gecode, is create a loop down in main 
that runs DFS on Space/model IntArray A, 
and for each sequential solution A that returns, 
call a different instance of DFS on Space/model IntArray B DFS 
to get just one solution.  
Does that sound like a reasonable approach?

When I tried to do this, I ran into a problem.  
The MwG document explains how to loop on DFS, 
using s<-e.next to find the next space, etc, 
and I've done that for another application.  
But when I tried to feed DFS the new s, 
I got an error in Gecode's DFS destructor on the line where it's trying 
to delete e (called by the end bracket of my loop).  
So is it legal to have multiple separate DFS engines?  
Do you need to delete them when you're creating the next one? 
(delete e didn't work in my code any better than in the destructor).  
I don't see any examples of this on the Gecode examples page...
they all look like single calls to the search engine. 

Any thoughts?  Am I going about this w/the right approach?
Thanks,
-Milt




More information about the users mailing list