Previous topic  Top  Next topic  Print this Topic
 

Optimizer Commands

 

Genetic Optimizer

opt_genetic <queryID>

Commands to send an optimized query to OntoBroker

opt_genetic status

The return value is a string. The status of the last complete generation will be returned.
At least one generation has to be evaluated before valid results can be delivered.

OntoBroker Return Values: The return value is a "string" without line separators. Use | as separation character.

opt_genetic kill

Stops a running optimization. It may take a short time, you can use the -isoptimizing command to see when it is done. The timeout window has to fit into the timeout of the socket connection, so it may be to small for some cases.

opt_genetic isoptimizing

Returns if an optimization process is currently running or not.

OntoBroker Return Values: The return value is a "string".

Example:

opt_genetic file, "test.data", rewrite, timeout, 1000, module,"<http://www.NewOnto1.org/ontology>", "queryID"

Options:

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

Hillclimbing

The command

opt_hillclimbing <queryID>

optimizes the bodyordering using a hillclimbing algorithm. You can change the ordering manually.

Usage:

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

opt_hillclimbing isoptimizing

opt_hillclimbing kill

opt_hillclimbing status

Example:

opt_hillclimbing file, "test.data", rewrite, module, "<http://www.NewOnto1.org/ontology>", "queryID"

 

Options:

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.

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

BodyOrderingDataFile = mybodyordering.data

Additional information about 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, improving it a little each time. When the algorithm cannot see any more improvements, 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

record_bodyordering

With the command record_bodyordering <query id> you are able to record the bodyordering. It is displayed as plain text in the file bodyordering.data. You can rename the file in OntoConfig.prp:

BodyOrderingDataFile = mybodyordering.data

The file is equal to all optimizer files and is displayed as follows:

Syntax:

record_bodyordering <http://www.NewOnto4.org/Test#query>

First, the query is shown, and then the evaluation method and then, for each rule, the different orderings for different variables.

{} [2,0,1]        //e.g. means no variable instantiation, then the ordering is 2,0,1

{0} [0,1,2]       // e.g. means that the first variable is instantiated in the body then we have the ordering 0,1,2

NOTE: the directory of the file depends on the used OntoConfig.prp: if you use the OntoConfig.prp from c:/Ontoconfig.prp, the bodyordering.data will be written in c:/conf/.