com.penguinwerks.jodene.managers
Class PocketManager

java.lang.Object
  extended bycom.penguinwerks.jodene.managers.PocketManager

public class PocketManager
extends java.lang.Object

The pocket manager used to manage the networks in the pocket.

Author:
Paul Hoehne

Constructor Summary
PocketManager(java.lang.String pocketName, java.lang.String error)
          Creates a new instance of PocketManager
 
Method Summary
 void cleanup()
          Clean up the pocket contents at the end of training.
 int getLastUpdateEpoch()
          Returns the epoch number when the pocket was last updated.
 double getLastUpdateError()
          Returns the error of the network in the pocket.
 Network getNetwork()
          Returns the network from the pocket.
 void saveNetwork(Network network, Trainer trainer)
          Saves the network to the pocket if it has a lower error than the existing version of the network.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PocketManager

public PocketManager(java.lang.String pocketName,
                     java.lang.String error)
Creates a new instance of PocketManager

Parameters:
pocketName - The name of the pocket.
error - The name of the error used for the pocket.
Method Detail

saveNetwork

public void saveNetwork(Network network,
                        Trainer trainer)
                 throws java.io.IOException,
                        java.io.FileNotFoundException,
                        java.lang.ClassNotFoundException
Saves the network to the pocket if it has a lower error than the existing version of the network.

Parameters:
network - The network to add to the pocket.
trainer - The trainer training the network.
Throws:
IOException - Thrown if there is a problem saving the network.
FileNotFoundException - Thrown if there is a problem saving the network.
java.lang.ClassNotFoundException - Thrown if there is a problem saving the network.

cleanup

public void cleanup()
Clean up the pocket contents at the end of training.


getNetwork

public Network getNetwork()
                   throws java.io.IOException,
                          java.lang.ClassNotFoundException
Returns the network from the pocket.

Returns:
The network in pocket.
Throws:
IOException - Thrown if ther is a problem getting the network.
java.lang.ClassNotFoundException - Thrown if there is a problem getting the network.

getLastUpdateEpoch

public int getLastUpdateEpoch()
                       throws java.io.FileNotFoundException,
                              java.io.IOException,
                              java.lang.ClassNotFoundException
Returns the epoch number when the pocket was last updated.

Returns:
The epoch number.
Throws:
FileNotFoundException - Thrown if there is a problem reading the epoch number.
IOException - Thrown if there is a problem reading the epoch number.
java.lang.ClassNotFoundException - Thrown if there is a problem reading the epoch number.

getLastUpdateError

public double getLastUpdateError()
                          throws java.io.FileNotFoundException,
                                 java.io.IOException,
                                 java.lang.ClassNotFoundException
Returns the error of the network in the pocket.

Returns:
The error.
Throws:
FileNotFoundException - Thrown if there is a problem.
IOException - Thrown if there is a problem.
java.lang.ClassNotFoundException - Thrown if there is a problem.