iterators
Class ModelIterator

java.lang.Object
  extended byiterators.ModelIterator
All Implemented Interfaces:
java.lang.Runnable
Direct Known Subclasses:
ACSC_SwitchIterator, ACSCIterator, EllipIterator, FilterCamIterator, FindVolumeIterator, MatingIterator, PhasePortraitIterator, PopEvolveExpanderIterator, PowellIterator, RandInitRunIterator, SteepestDescentIterator, SurfaceIterator, TransectIterator, UberIterator, VulvaClassifyIterator

public class ModelIterator
extends java.lang.Object
implements java.lang.Runnable


Field Summary
 Cell[] cells
           
protected  float finalScore
           
protected  Model model
           
protected  Network network
           
protected  int nParsTV
           
 int numCells
           
 int numFunctionCalls
           
 SimpleStop origStopper
           
protected  java.lang.String outFileName
           
protected  float[] p
          local copy of Parameters.
protected  ParameterSet parsTV
          Local copy of Parameters.nParsTV
protected  java.io.PrintWriter ps
          The general purpose output file from an iterator.
protected  boolean running
           
protected  java.lang.Thread runThread
           
 Function theFunction
           
protected  IteratorViewer TheIteratorViewer
          Pointer the the viewer that displays results for this iterator
protected  boolean verbose
          This is here to say whether the iterator should be saving stuff out to a file or not.
 
Constructor Summary
ModelIterator()
           
 
Method Summary
 float continueF(float[] thePoint)
          //ELI 7/7/99 This method calls Function.continueEvaluate() to continue evaluating whatever function was running before.
 ModelIterator copy()
           
 boolean didBomb()
           
 boolean didPass()
           
 void doRun()
           
 void doStartRun()
           
 float F(float[] thePoint)
           
 java.lang.String getOutputFileName()
          Returns the name of the iterator output file.
 ParameterSet getParameterSet()
          Returns the current ParameterSet for the Iterator
 void getState(ParameterSet state)
           
 SimpleStop getStopper()
           
 float getValue()
           
 void init(Network network, Model model)
           
 boolean isRunning()
           
 boolean isSaveExtra()
          If an iterator wants to save large amounts of information that doesn't fit into the tag format above, then it should return true in this method.
 void iterError(java.lang.String err)
           
protected  void loadParameter(java.lang.String info, BetterTokenizer tokenizer)
           
 void loadParameters(BetterTokenizer tokenizer)
           
 void print(java.lang.String outString)
           
 void println()
           
 void println(java.lang.String outString)
           
 void quit()
           
 void reset()
          Called before each run of an iterator.
 void resetStopper()
           
 void run()
           
 void saveExtra(java.io.PrintWriter ps)
          Called when the iterator finishes running if isSaveExtra returns true.
 void saveOutput(java.io.PrintWriter ps, java.lang.String inset)
          Saves tagged output from this iterator to a cam file.
 void saveOutputTags(java.io.PrintWriter ps, java.lang.String inset)
          This is called when a cam file is being set up.
 void setFunction(Function fun)
           
 void setIteratorViewer(IteratorViewer viewer)
          Sets the IteratorViewer that this iterator reports to.
 void setOutputFile(java.lang.String fileName)
          Called when the output file is changed.
 void setPrint(boolean m)
           
 void setPrintStream(java.io.PrintWriter ps)
           
 void setState(ParameterSet state)
           
 void setStopper(SimpleStop stop)
           
 void startRun()
           
 void stopRun()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

network

protected Network network

model

protected Model model

ps

protected java.io.PrintWriter ps
The general purpose output file from an iterator. This is also the output file used by UberIterator.


outFileName

protected java.lang.String outFileName

origStopper

public SimpleStop origStopper

cells

public Cell[] cells

numCells

public int numCells

runThread

protected java.lang.Thread runThread

running

protected boolean running

theFunction

public Function theFunction

finalScore

protected float finalScore

parsTV

protected ParameterSet parsTV
Local copy of Parameters.nParsTV


nParsTV

protected int nParsTV

p

protected float[] p
local copy of Parameters.


verbose

protected boolean verbose
This is here to say whether the iterator should be saving stuff out to a file or not.


numFunctionCalls

public int numFunctionCalls

TheIteratorViewer

protected IteratorViewer TheIteratorViewer
Pointer the the viewer that displays results for this iterator

Constructor Detail

ModelIterator

public ModelIterator()
Method Detail

init

public void init(Network network,
                 Model model)

reset

public void reset()
Called before each run of an iterator. This reset contains code that all iterators should do when they are reset. Subclasses should override to perform any additional operations they need to do when reset, but they should also call super.reset().


copy

public ModelIterator copy()
                   throws java.lang.Exception
Throws:
java.lang.Exception

getOutputFileName

public java.lang.String getOutputFileName()
Returns the name of the iterator output file.


getParameterSet

public ParameterSet getParameterSet()
Returns the current ParameterSet for the Iterator

Returns:
ParameterSet

setOutputFile

public void setOutputFile(java.lang.String fileName)
                   throws java.lang.Exception
Called when the output file is changed.

Throws:
java.lang.Exception

setStopper

public void setStopper(SimpleStop stop)

getStopper

public SimpleStop getStopper()

resetStopper

public void resetStopper()

setFunction

public void setFunction(Function fun)

setPrint

public void setPrint(boolean m)

print

public void print(java.lang.String outString)

println

public void println(java.lang.String outString)

println

public void println()

setPrintStream

public void setPrintStream(java.io.PrintWriter ps)

saveOutputTags

public void saveOutputTags(java.io.PrintWriter ps,
                           java.lang.String inset)
This is called when a cam file is being set up. It should print a list of the tags which this iterator will be outputting for each parameter set saved in the file. Following each tag should be either the string "number" or the string "flag", indicating whether the output will be numerical or text. Most iterators will not need to implement this function since they have no extra information to save beyond score, num function calls, and the parameters themselves


saveOutput

public void saveOutput(java.io.PrintWriter ps,
                       java.lang.String inset)
Saves tagged output from this iterator to a cam file. This is called by the UberIteratorFunction whenever it gets a good score. This function should save any useful information the iterator possesses about the set of parameters using the standard &tag format. The data should be either a number or a string. The cam file can't handle more complex data objects currently. Note that the Score is saved directly by the UberIteratorFunction. Other Iterators should call super.saveOutput() to get things that are general to all iterators saved (i.e. NumFunctionCalls).

Most iterators will not need to implement this function since they have no extra information to save beyond score, num function calls, and the parameters themselves


isSaveExtra

public boolean isSaveExtra()
If an iterator wants to save large amounts of information that doesn't fit into the tag format above, then it should return true in this method. If its running in an UberIterator, it will then get its 'ps' variable set to an appropriate file for dumping data.


saveExtra

public void saveExtra(java.io.PrintWriter ps)
Called when the iterator finishes running if isSaveExtra returns true.


loadParameters

public void loadParameters(BetterTokenizer tokenizer)
                    throws java.lang.Exception
Throws:
java.lang.Exception

loadParameter

protected void loadParameter(java.lang.String info,
                             BetterTokenizer tokenizer)
                      throws java.lang.Exception
Throws:
java.lang.Exception

setIteratorViewer

public void setIteratorViewer(IteratorViewer viewer)
Sets the IteratorViewer that this iterator reports to.


startRun

public void startRun()

doStartRun

public void doStartRun()

run

public void run()
Specified by:
run in interface java.lang.Runnable

doRun

public void doRun()

stopRun

public void stopRun()

didPass

public boolean didPass()

isRunning

public boolean isRunning()

didBomb

public boolean didBomb()

getValue

public float getValue()

setState

public void setState(ParameterSet state)

getState

public void getState(ParameterSet state)

quit

public void quit()

iterError

public void iterError(java.lang.String err)

F

public float F(float[] thePoint)

continueF

public float continueF(float[] thePoint)
//ELI 7/7/99 This method calls Function.continueEvaluate() to continue evaluating whatever function was running before. Before calling this, you should call F(). If F() returns and you then want to continue running the function (for instance to continue running a model with the default function) then call continueF(). continueF() will not reset the model before continuing the run. It also does not increment the numFunctionCalls variable.