Dear Jonathan, If I remember correctly, someone already wrote a variant of that search engine that stops after a certain time, and returns the best solution so far. I think Renaud De Landtsheer did this. It had the nice property that you could guarantee to have an answer after some user-defined time (provided at least an answer could be found within that time).
I will try to retrieve some links to that search engine... Cheers, Raphael On Fri, Jan 1, 2010 at 6:16 PM, Wolfgang Meyer < [email protected]> wrote: > Dear Jonathan, > > I don't think such a predefined way exists. (Otherwise somebody would > probably have answered to your previous requests.) > > However, it is possible to implement your own search strategies in Oz. > I have never done that, but two possible starting points are: > http://www.mozart-oz.org/papers/abstracts/Engines.html > http://www.mozart-oz.org/mogul/doc/tack/iozsef/iozsef.html > > You could also try to check the number of failed spaces in your > ordering predicate and fail if too many spaces were created: > > --------------------------- > declare > proc {Script Root} > X={FD.int 1#1000} > Y={FD.int 1#1000} > in > Y =: 1000 - X*X - 2*Y > Root = X#Y > {FD.distribute ff Root} > end > > fun {CreateOrder MaxSpaces} > OldSpaces = {Property.get 'spaces.failed'} > in > proc {$ Old New} > if {Property.get 'spaces.failed'} < OldSpaces + MaxSpaces then > Old.1 + Old.2 <: New.1 + New.2 > else > fail > end > end > end > > Time0 = {Property.get 'time.user'} > {System.printInfo "with max 100 spaces: "} {Show {SearchBest Script > {CreateOrder 100}}} > Time1 = {Property.get 'time.user'} > {System.showInfo "time ellapsed: "#Time1-Time0} > {System.printInfo "with max 1000 spaces: "} {Show {SearchBest Script > {CreateOrder 1000}}} > Time2 = {Property.get 'time.user'} > {System.showInfo "time ellapsed: "#Time2-Time1} > > --------------------------- > > This 'solution' has a BIG PROBLEM, though. > If other searches are running in parallel, the space counting will go > wrong and the search will stop too soon. > > Cheers, > Wolfgang > > > On 1/1/10, Jonathan Vivanco Navarro <[email protected]> wrote: > > > > Dears > > > > I would like to know if there is a predefined or automatic way, that > allow me stop the "explorebest" and "Search.best" given a number of spaces > generated. > > > > e.g.: > > > > > > proc {TSP_Orden2 Old New} > > > > (Old.costo_total >: New.costo_total) > > > > end > > > > {ExploreBest TSP TSP_Orden} > > > > Stop the searches when find an optimal amount certain (e.g.:20). > > > > Thanks is advance > > > > > > Sincererely. > > > > > > Jonathan > > > > > _________________________________________________________________________________ > > mozart-users mailing list > [email protected] > > http://www.mozart-oz.org/mailman/listinfo/mozart-users > > > > _________________________________________________________________________________ > mozart-users mailing list > [email protected] > http://www.mozart-oz.org/mailman/listinfo/mozart-users >
_________________________________________________________________________________ mozart-users mailing list [email protected] http://www.mozart-oz.org/mailman/listinfo/mozart-users
