net.obsearch.index.utils
Class AbstractCommandLine<O extends OB,I extends Index<O>,A extends Ambient<O,I>>

java.lang.Object
  extended by net.obsearch.index.utils.AbstractCommandLine<O,I,A>
All Implemented Interfaces:
org.opt4j.core.problem.Evaluator<org.opt4j.benchmark.DoubleString>
Direct Known Subclasses:
AbstractNewLineCommandLine

public abstract class AbstractCommandLine<O extends OB,I extends Index<O>,A extends Ambient<O,I>>
extends Object
implements org.opt4j.core.problem.Evaluator<org.opt4j.benchmark.DoubleString>


Nested Class Summary
protected static class AbstractCommandLine.Mode
           
 
Field Summary
protected  double approxEvalEp
           
protected  double approxEvalRecall
           
protected  boolean bulkMode
           
protected  String experimentName
           
protected  String experimentResultFileName
           
protected  String experimentSet
           
protected  int iterations
          Options related to opt4j optimization
protected  int k
           
protected  int maxQueries
           
protected  AbstractCommandLine.Mode mode
           
protected  int optNumChildren
           
protected  int optNumParents
           
protected  int optPopulationSize
           
protected  int pivots
           
protected  Properties props
          Properties that modify the behavior of this application.
protected  int queries
          Number of queries executed.
protected  double r
           
protected  long time
          Total ellapsed time during each query.
protected  boolean validate
           
 
Constructor Summary
AbstractCommandLine()
           
 
Method Summary
protected  void add()
           
protected abstract  void addObjects(I index, File load)
          Adds objects to the index.
protected  void closeAll(FileWriter[] files)
           
protected  void create()
           
 org.opt4j.core.Objectives evaluate(org.opt4j.benchmark.DoubleString config)
           
protected abstract  String expDetails()
           
protected  String expName()
           
protected abstract  org.opt4j.core.problem.Creator<org.opt4j.benchmark.DoubleString> getCreator()
          Returns the creator used to generate new configurations for this index.
protected  I getIndex()
           
 Collection<org.opt4j.core.Objective> getObjectives()
           
protected abstract  AbstractCommandLine getReference()
          Return the "this" reference, used to access all the command line options.
 void initProperties()
           
protected abstract  A instantiateAmbient(File dbFolder)
           
protected abstract  A instantiateNewAmbient(File dbFolder)
           
protected  boolean isApproxMode()
           
 void processUserCommands(String[] args)
          This method must be called by the children of this class.
protected  void search()
          Perform one search for a given k and r.
protected  Pair<Statistics,Statistics> searchAux()
           
protected abstract  void searchObjects(I index, File query, Statistics other)
          Opens a query file and queries the index storing all the results there.
protected abstract  void updateIndexConfig(org.opt4j.benchmark.DoubleString phenotype)
          Updates the configuration of the index with the given phenotype.
protected abstract  void updateParams()
          Updates the underlying index based on different parameters
protected  void writeAll(FileWriter[] files, String str)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

props

protected Properties props
Properties that modify the behavior of this application.


pivots

protected int pivots

k

protected int k

mode

protected AbstractCommandLine.Mode mode

maxQueries

protected int maxQueries

experimentName

protected String experimentName

experimentResultFileName

protected String experimentResultFileName

bulkMode

protected boolean bulkMode

experimentSet

protected String experimentSet

r

protected double r

approxEvalEp

protected double approxEvalEp

approxEvalRecall

protected double approxEvalRecall

iterations

protected int iterations
Options related to opt4j optimization


optPopulationSize

protected int optPopulationSize

optNumParents

protected int optNumParents

optNumChildren

protected int optNumChildren

validate

protected boolean validate

queries

protected int queries
Number of queries executed.


time

protected long time
Total ellapsed time during each query.

Constructor Detail

AbstractCommandLine

public AbstractCommandLine()
Method Detail

initProperties

public void initProperties()
                    throws IOException
Throws:
IOException

getReference

protected abstract AbstractCommandLine getReference()
Return the "this" reference, used to access all the command line options.

Returns:
The reference of the bottommost class that contains parameters.

getIndex

protected I getIndex()

processUserCommands

public void processUserCommands(String[] args)
This method must be called by the children of this class.

Parameters:
thisReference - this reference of the subclass.
args - Arguments sent to the application.

instantiateNewAmbient

protected abstract A instantiateNewAmbient(File dbFolder)
                                                         throws OBStorageException,
                                                                OBException,
                                                                FileNotFoundException,
                                                                IllegalAccessException,
                                                                InstantiationException,
                                                                IOException
Throws:
OBStorageException
OBException
FileNotFoundException
IllegalAccessException
InstantiationException
IOException

instantiateAmbient

protected abstract A instantiateAmbient(File dbFolder)
                                                      throws OBStorageException,
                                                             OBException,
                                                             FileNotFoundException,
                                                             IllegalAccessException,
                                                             InstantiationException,
                                                             IOException
Throws:
OBStorageException
OBException
FileNotFoundException
IllegalAccessException
InstantiationException
IOException

addObjects

protected abstract void addObjects(I index,
                                   File load)
                            throws FileNotFoundException,
                                   IOException,
                                   OBStorageException,
                                   OBException,
                                   IllegalAccessException,
                                   InstantiationException
Adds objects to the index. Loads the objects from File.

Parameters:
index - Index to load the objects into.
load - File to load.
Throws:
FileNotFoundException
IOException
OBStorageException
OBException
IllegalAccessException
InstantiationException

searchObjects

protected abstract void searchObjects(I index,
                                      File query,
                                      Statistics other)
                               throws IOException,
                                      OBException,
                                      InstantiationException,
                                      IllegalAccessException
Opens a query file and queries the index storing all the results there.

Parameters:
index - The index to query.
query - The query to load.
Throws:
IOException
OBException
InstantiationException
IllegalAccessException

create

protected void create()
               throws IOException,
                      OBStorageException,
                      OBException,
                      com.sleepycat.je.DatabaseException,
                      InstantiationException,
                      IllegalAccessException,
                      PivotsUnavailableException
Throws:
IOException
OBStorageException
OBException
com.sleepycat.je.DatabaseException
InstantiationException
IllegalAccessException
PivotsUnavailableException

add

protected void add()
            throws IOException,
                   OBStorageException,
                   OBException,
                   com.sleepycat.je.DatabaseException,
                   InstantiationException,
                   IllegalAccessException
Throws:
IOException
OBStorageException
OBException
com.sleepycat.je.DatabaseException
InstantiationException
IllegalAccessException

getObjectives

public Collection<org.opt4j.core.Objective> getObjectives()
Specified by:
getObjectives in interface org.opt4j.core.problem.Evaluator<org.opt4j.benchmark.DoubleString>

getCreator

protected abstract org.opt4j.core.problem.Creator<org.opt4j.benchmark.DoubleString> getCreator()
                                                                                        throws OBException
Returns the creator used to generate new configurations for this index.

Returns:
a new creator
Throws:
OBException

evaluate

public org.opt4j.core.Objectives evaluate(org.opt4j.benchmark.DoubleString config)
Specified by:
evaluate in interface org.opt4j.core.problem.Evaluator<org.opt4j.benchmark.DoubleString>

updateIndexConfig

protected abstract void updateIndexConfig(org.opt4j.benchmark.DoubleString phenotype)
Updates the configuration of the index with the given phenotype.

Parameters:
phenotype -

expName

protected String expName()

writeAll

protected void writeAll(FileWriter[] files,
                        String str)
                 throws IOException
Throws:
IOException

closeAll

protected void closeAll(FileWriter[] files)
                 throws IOException
Throws:
IOException

updateParams

protected abstract void updateParams()
Updates the underlying index based on different parameters


searchAux

protected Pair<Statistics,Statistics> searchAux()
                                         throws IOException,
                                                OBStorageException,
                                                OBException,
                                                com.sleepycat.je.DatabaseException,
                                                InstantiationException,
                                                IllegalAccessException
Throws:
IOException
OBStorageException
OBException
com.sleepycat.je.DatabaseException
InstantiationException
IllegalAccessException

isApproxMode

protected boolean isApproxMode()

expDetails

protected abstract String expDetails()

search

protected void search()
               throws IOException,
                      OBStorageException,
                      OBException,
                      com.sleepycat.je.DatabaseException,
                      InstantiationException,
                      IllegalAccessException
Perform one search for a given k and r.

Throws:
IOException
OBStorageException
OBException
com.sleepycat.je.DatabaseException
InstantiationException
IllegalAccessException


Copyright © 2007-2011 Arnoldo Jose Muller Molina. All Rights Reserved.