public abstract class NeuralConnection extends java.lang.Object implements java.io.Serializable, RevisionHandler
Modifier and Type | Field and Description |
---|---|
static int |
CONNECTED
This flag is set once the unit has a connection.
|
static int |
INPUT
This unit is an input unit.
|
static int |
OUTPUT
This unit is an output unit.
|
static int |
PURE_INPUT
This unit is a pure input unit.
|
static int |
PURE_OUTPUT
This unit is a pure output unit.
|
static int |
UNCONNECTED
This unit is not connected to any others.
|
Constructor and Description |
---|
NeuralConnection(java.lang.String id)
Constructs The unit with the basic connection information prepared for
use.
|
Modifier and Type | Method and Description |
---|---|
static boolean |
connect(NeuralConnection s,
NeuralConnection t)
Connects two units together.
|
static boolean |
disconnect(NeuralConnection s,
NeuralConnection t)
Disconnects two units.
|
void |
drawHighlight(java.awt.Graphics g,
int w,
int h)
Call this function to draw the node highlighted.
|
void |
drawInputLines(java.awt.Graphics g,
int w,
int h)
Call this function to draw the nodes input connections.
|
void |
drawNode(java.awt.Graphics g,
int w,
int h)
Call this function to draw the node.
|
void |
drawOutputLines(java.awt.Graphics g,
int w,
int h)
Call this function to draw the nodes output connections.
|
abstract double |
errorValue(boolean calculate)
Call this to get the error value of this unit.
|
java.lang.String |
getId() |
int[] |
getInputNums()
Use this to get easy access to the input numbers.
|
NeuralConnection[] |
getInputs()
Use this to get easy access to the inputs.
|
int |
getNumInputs() |
int |
getNumOutputs() |
int[] |
getOutputNums()
Use this to get easy access to the output numbers.
|
NeuralConnection[] |
getOutputs()
Use this to get easy access to the outputs.
|
int |
getType() |
double |
getX() |
double |
getY() |
boolean |
onUnit(java.awt.Graphics g,
int x,
int y,
int w,
int h)
Call this function to determine if the point at x,y is on the unit.
|
abstract double |
outputValue(boolean calculate)
Call this to get the output value of this unit.
|
void |
removeAllInputs()
This function will remove all the inputs to this unit.
|
void |
removeAllOutputs()
This function will remove all outputs to this unit.
|
abstract void |
reset()
Call this to reset the unit for another run.
|
abstract void |
restoreWeights()
Call this to have the connection restore from the saved
weights.
|
abstract void |
saveWeights()
Call this to have the connection save the current
weights.
|
void |
setType(int t) |
void |
setX(double x) |
void |
setY(double y) |
void |
updateWeights(double l,
double m)
Call this function to update the weight values at this unit.
|
double |
weightValue(int n)
Call this to get the weight value on a particular connection.
|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getRevision
public static final int UNCONNECTED
public static final int PURE_INPUT
public static final int PURE_OUTPUT
public static final int INPUT
public static final int OUTPUT
public static final int CONNECTED
public NeuralConnection(java.lang.String id)
id
- the unique id of the unitpublic java.lang.String getId()
public int getType()
public void setType(int t)
t
- The new type of this unit.public abstract void reset()
public abstract double outputValue(boolean calculate)
calculate
- True if the value should be calculated if it hasn't been
already.public abstract double errorValue(boolean calculate)
calculate
- True if the value should be calculated if it hasn't been
already.public abstract void saveWeights()
public abstract void restoreWeights()
public double weightValue(int n)
n
- The connection number to get the weight for, -1 if The threshold
weight should be returned.public void updateWeights(double l, double m)
l
- The learning Rate to use.m
- The momentum to use.public NeuralConnection[] getInputs()
public NeuralConnection[] getOutputs()
public int[] getInputNums()
public int[] getOutputNums()
public double getX()
public double getY()
public void setX(double x)
x
- The new value for it's x pos.public void setY(double y)
y
- The new value for it's y pos.public boolean onUnit(java.awt.Graphics g, int x, int y, int w, int h)
g
- The graphics context for font size info.x
- The x coord.y
- The y coord.w
- The width of the display.h
- The height of the display.public void drawNode(java.awt.Graphics g, int w, int h)
g
- The graphics context.w
- The width of the drawing area.h
- The height of the drawing area.public void drawHighlight(java.awt.Graphics g, int w, int h)
g
- The graphics context.w
- The width of the drawing area.h
- The height of the drawing area.public void drawInputLines(java.awt.Graphics g, int w, int h)
g
- The graphics context.w
- The width of the drawing area.h
- The height of the drawing area.public void drawOutputLines(java.awt.Graphics g, int w, int h)
g
- The graphics context.w
- The width of the drawing area.h
- The height of the drawing area.public void removeAllInputs()
public void removeAllOutputs()
public int getNumInputs()
public int getNumOutputs()
public static boolean connect(NeuralConnection s, NeuralConnection t)
s
- The source unit.t
- The target unit.public static boolean disconnect(NeuralConnection s, NeuralConnection t)
s
- The source unit.t
- The target unit.