iterator
Class AbstractOptimizer<T extends OptimizationProblem>

java.lang.Object
  extended by iterator.AbstractIterator
      extended by iterator.AbstractOptimizer<T>
Type Parameters:
T - a subclass of OptimizationProblem.
All Implemented Interfaces:
DataListener, Iterable, LoggableIterator
Direct Known Subclasses:
AbstractInitialSampleBasedOptimizer, AbstractPointOptimizer

public abstract class AbstractOptimizer<T extends OptimizationProblem>
extends AbstractIterator
implements LoggableIterator, DataListener

Abstract class that provides some basic methods for any optimization algorithm. Parametrized by the kind of OptimizationProblem under consideration.

Author:
dgorur

Field Summary
protected static corejava.Format doubleFormat
           
protected  int funEvalCount
           
protected  java.io.PrintWriter logWriter
           
 
Fields inherited from class iterator.AbstractIterator
diagnosticString, iter
 
Constructor Summary
AbstractOptimizer()
           
 
Method Summary
 void clear()
          Notification that all data has been removed.
 int dataAdded(DataBlock block)
          Notification that a DataBlock has been added.
 boolean dataAdded(DataPoint dataPoint)
          Notification that a single DataPoint has been added.
 int dataRemoved(DataBlock dataBlock)
          Notification that a DataBlock has been removed.
 boolean dataRemoved(DataPoint dataPoint)
          Notification that a single DataPoint has been removed.
 OptimizationDataHandler getDataHandler()
          Returns the OptimizationDataHandler that handles the data for this problem.
protected  int getFunEvalCount()
          Returns the number of function evaluations.
 java.lang.String getLogFileName()
          Returns the name of the log file name for this optimizer.
 int getMaxFunEval()
          Returns the maximum number of allowed function evaluations.
 T getProblem()
          Returns the problem that this iterator tries to solve.
 void init()
          Initialization routine
 boolean isTerminated()
          Returns true if termination criteria are satisfied.
 void iterate()
          Iterates until termination.
 void setDataHandler(OptimizationDataHandler dataHandler)
          Sets the data handler for this problem.
protected  void setFunEvalCount(int funEvalCount)
          Sets the number of function evaluations.
 void setLogFileName(java.lang.String logFileName)
          Sets the log file name.
 void setMaxFunEval(int maxFunEval)
          Sets the maximum number of allowed function evaluations.
 void setProblem(T problem)
          Sets the problem for this iterator to solve.
protected  void updateDiagnostics()
          Provides access to the diagnosticString, so that the user has flexibility over multiple methods accessing this string at different times.
protected  void writeInitialRunLog()
           
 
Methods inherited from class iterator.AbstractIterator
isVerbose, printDiagnostics, setVerbose
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface iterator.Iterable
singleIteration
 

Field Detail

doubleFormat

protected static final corejava.Format doubleFormat

funEvalCount

protected int funEvalCount

logWriter

protected java.io.PrintWriter logWriter
Constructor Detail

AbstractOptimizer

public AbstractOptimizer()
Method Detail

clear

public void clear()
Description copied from interface: DataListener
Notification that all data has been removed.

Specified by:
clear in interface DataListener

dataAdded

public int dataAdded(DataBlock block)
Description copied from interface: DataListener
Notification that a DataBlock has been added.

Specified by:
dataAdded in interface DataListener
Parameters:
block - the DataBlock added.
Returns:
number of points successfully added.

dataAdded

public boolean dataAdded(DataPoint dataPoint)
Description copied from interface: DataListener
Notification that a single DataPoint has been added.

Specified by:
dataAdded in interface DataListener
Parameters:
dataPoint - the DataPoint added.
Returns:
true if the DataPoint was successfully added.

dataRemoved

public int dataRemoved(DataBlock dataBlock)
Description copied from interface: DataListener
Notification that a DataBlock has been removed.

Specified by:
dataRemoved in interface DataListener
Parameters:
dataBlock - the DataBlock removed.
Returns:
the number of DataPoints successfully removed.

dataRemoved

public boolean dataRemoved(DataPoint dataPoint)
Description copied from interface: DataListener
Notification that a single DataPoint has been removed.

Specified by:
dataRemoved in interface DataListener
Parameters:
dataPoint - the DataPointremoved.
Returns:
true if the DataPoint was successfully removed.

getDataHandler

public OptimizationDataHandler getDataHandler()
Returns the OptimizationDataHandler that handles the data for this problem.

Returns:
the data handler for this problem.

getLogFileName

public java.lang.String getLogFileName()
Returns the name of the log file name for this optimizer.

Specified by:
getLogFileName in interface LoggableIterator
Returns:
the name of the log file.

getMaxFunEval

public int getMaxFunEval()
Returns the maximum number of allowed function evaluations.

Returns:
max function evaluations allowed.

getProblem

public T getProblem()
Returns the problem that this iterator tries to solve.

Returns:
the problem that this iterator tries to solve.

init

public void init()
Description copied from interface: Iterable
Initialization routine

Specified by:
init in interface Iterable

isTerminated

public boolean isTerminated()
Description copied from interface: Iterable
Returns true if termination criteria are satisfied.

Specified by:
isTerminated in interface Iterable
Returns:
true when done.

iterate

public void iterate()
Description copied from interface: Iterable
Iterates until termination.

Specified by:
iterate in interface Iterable
Overrides:
iterate in class AbstractIterator

setDataHandler

public void setDataHandler(OptimizationDataHandler dataHandler)
Sets the data handler for this problem. This should be an OptimizationDataHandler that can process the designs that this iterator finds during optimization.

Parameters:
dataHandler - the given OptimizationDataHandler.

setLogFileName

public void setLogFileName(java.lang.String logFileName)
Description copied from interface: LoggableIterator
Sets the log file name.

Specified by:
setLogFileName in interface LoggableIterator
Parameters:
logFileName -

setMaxFunEval

public void setMaxFunEval(int maxFunEval)
Sets the maximum number of allowed function evaluations.

Parameters:
maxFunEval - the given maxFunEval.

setProblem

public void setProblem(T problem)
Sets the problem for this iterator to solve.

Parameters:
problem - the given optimization problem.

getFunEvalCount

protected int getFunEvalCount()
Returns the number of function evaluations.

Returns:
the number of function evaluations.

setFunEvalCount

protected void setFunEvalCount(int funEvalCount)
Sets the number of function evaluations.

Parameters:
funEvalCount - the given number of evaluations.

updateDiagnostics

protected void updateDiagnostics()
Description copied from class: AbstractIterator
Provides access to the diagnosticString, so that the user has flexibility over multiple methods accessing this string at different times.

Specified by:
updateDiagnostics in class AbstractIterator

writeInitialRunLog

protected void writeInitialRunLog()