Previous topic  Top  Next topic  Print this Topic

Hillclimbing Optimizer


The command opt_hillclimbing <queryID> optimizes the bodyordering using a hillclimbing algorithm. You can change the ordering manually.


opt_hillclimbing [file, filename], [rewrite], module, modulename, queryID

opt_hillclimbing isoptimizing

opt_hillclimbing kill

opt_hillclimbing status


opt_hillclimbing file, "", rewrite, module, "<>", "queryID"


command.cmd "opt_hillclimbing file, \"\", rewrite, module, <>, \"queryID"s\"


file filename - file name for optimization data.
rewrite - rewrites the file with optimization data if it exists.
kill - stops the optimization. 
isoptimizing - checks whether the optimization is already running.
status - returns the best result of the running optimization.

for all rules r

 := max

 fomintime r all body permuations  p of r

         evaluate query

         if evaltime < mintime

                 mintime = evaltime

                 minpermutation = p

 set body permutation of r to minpermutation        

It is displayed as plain text in the file You can rename the file in OntoConfig.prp:

BodyOrderingDataFile =

Additional information on the hillclimbing algorithm

Hill climbing can be used to solve problems that have many solutions, some of which are better than others. It starts with a random (potentially poor) solution, and iteratively makes small changes to the solution, each time improving it a little. When the algorithm cannot see any improvement anymore, it terminates. Ideally, at that point the current solution is close to optimal, but it is not guaranteed that hill climbing will ever come close to the optimal solution


Rule bodies should not have many literals! If you have e.g. 10 rule bodies you have to deal with 10 permutations. In this case it would be better to deactivate the unfolding.