codesimian
Class Network

java.lang.Object
  extended by codesimian.CS<CSGeneric>
      extended by codesimian.DefaultCS
          extended by codesimian.Network
All Implemented Interfaces:
CodeSimian

public class Network
extends DefaultCS

WHAT I WROTE BEFORE BUILDING THIS CLASS:

Build this node/network system. Build many types of nodes, evolve them, execute them on eachother, and use them to give CodeSimian intelligence and free-will (derived partially from pseudorandom numbers).

In all artificial-intelligence algorithms, there are many kinds of networks and nodes, but I want to build a system that uses them all interchangably. For example, bayesian-network nodes and neural-network nodes could be in the same network. To allow this, CodeSimian will use all types of nodes and networks the same way. The STANDARD is...

A NETWORK is made of NODES, and is also a kind of node, so it can be used in other networks as a node.

A NODE is a CS whose minP() is at least 2.

anyNode.P(0) returns a list of child nodes. If the node is a network, the list contains all nodes in that network, with input nodes first, then hidden nodes, then 1 output node.

anyNode.P(1) returns a list of numbers that describe the state of the node. Nodes can change any of their own numbers or they might change none. Any number can be used as input, output, or both.

anyNode.P(2 or higher...) can be anything. This definition of NETWORKS and NODES does not specify.

It is not required, but a node should try to set its value when it is asked to (by setD(double) for example). To set its value, it should not change its nodes, but it should change its numbers, and the new numbers should cause the node to return a number closest to the requested value.

You may not change P(0).countP() or P(1).countP(). All you may do is replace whats already there. Only a node itself may change the quantity of things in its P(0) or P(1). For example, a bayesNode requires that there be exactly 2^(X+1) chances if theres X nodes. The bayesian algorithm does not work any other way.

INFINITE LOOPS: When a node sets the value of numbers in its P(1) list, if any of those numbers are also nodes, it could cause a chain-reaction of nodes and numbers changing their values that becomes an infinite-loop. RULE TO PREVENT INFINITE LOOPS: A NETWORK MAY NOT CONTAIN A CYCLE THAT GOES THROUGH ANY NODE'S P(1), but it may have cycles that go through P(0) since that is supposed to contain nodes.

EXISTING NODE EXAMPLE:

bayesNode(list(other nodes...) list(chances...)) - has X other nodes and 2^(X+1) chances.

HYPOTHETICAL NODE EXAMPLES:

Some nodes could be built to modify other nodes. The nodes they modify are in P(0) and the way they modify them is a function of the numbers in P(1).

A node that trains other nodes to match its numbers as closely as possible.

A neural-network node that has an equal quantity of nodes and numbers, 1 weight for each node.

A node that returns a + b*x + c*x^2 + d*x^3... where x is the only number in P(1) and abcd... are the nodes.

A node that has no function of its own, but does whatever its P(2) tells it to. Evolve P(2).

A node that is simply a number, but since its a node it must have P(0) and P(1). They're just empty. This node is efficient and guarantees if you try to set it to some number value, it will be set. Its useful as an input node.


Field Summary
 
Fields inherited from class codesimian.CS
DESCRIPTION, END, EXECPROXY, HEAP, JAVACODE, MYFUEL, NAME, NEWINSTANCE, NULL, PARENT, PARSEPRIORITY, PREV, TESTER, THIS
 
Constructor Summary
Network()
           
 
Method Summary
 java.lang.String description()
          a short description of this CS, shorter than the javadoc, but long enough to tell what the params are for.
 double DForProxy()
          sets nodes in list P(0) to values in list P(1), then executes the output node: P(0).P(P(0).countP()-1)
 java.lang.String keyword()
          For the CodeSimian language as a String.
CodeSimian language keyword, like "+" "*" "max" ">" etc.

Override this function if you want to specify a keyword other than how I derive them from the class name, like + for Add.

Some CSs might never be intended to be used in the language by their keyword.
The best example (4/05) is Num, because it is used in the language like "3.4" instead of "num()".
 int minP()
          For DForProxy().
Minimum number of parameters in param[] needed to call DForProxy().
Defines which indexs of param[] DForProxy() can use.
Functions with a different number of parameters must override this.
OVERRIDE THIS FUNCTION IF EXEC USES A DIFFERENT NUMBER OF PARAMETERS.
Default is 1.
 
Methods inherited from class codesimian.DefaultCS
B, C, countP, decrementMyFuel, deleteP, F, fuel, getExec, getObject, heap, I, indexP, indexPName, insertB, insertC, insertD, insertF, insertI, insertJ, insertL, insertL, insertL1, insertP, insertS, insertZ, J, javaCode, LForProxy, LForProxy, myFuel, name, newInstance, objectToCS, objectToCSArray, objectToCSArray, P, prevD, prevL, PType, S, setB, setC, setCountP, setD, setD, setExec, setF, setFuel, setI, setJ, setL, setL, setL, setL1, setMyFuel, setName, setObject, setP, setPrevExec, setPType, setS, setZ, start, toString, V, Z
 
Methods inherited from class codesimian.CS
addB, addC, addD, addF, addI, addJ, addL, addP, addP, addP, addP, addP, addS, addZ, BForProxy, CForProxy, clone, cost, D, deleteP, FForProxy, GETB, GETC, GETD, GETF, GETI, GETJ, GETL, GETS, GETZ, IForProxy, isIllusion, JForProxy, L, L, L, L, L, maxD, maxP, minD, overwrites, parent, parsePriority, PB, PC, PD, PF, PI, PJ, PL, prevB, prevC, prevF, prevI, prevJ, prevS, prevZ, proxyOf, PS, PZ, reflect, reflect, reflect6, setB, SETB, setC, SETC, setCost, SETD, setDescription, setF, SETF, setHeap, setI, SETI, setJ, SETJ, SETL, setL, setL, setParent, setParsePriority, setProxyOf, setS, SETS, setTester, setZ, SETZ, SForProxy, tester, toJavaCode, VForProxy, voidReflect, ZForProxy
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Network

public Network()
Method Detail

DForProxy

public double DForProxy()
sets nodes in list P(0) to values in list P(1), then executes the output node: P(0).P(P(0).countP()-1)

Specified by:
DForProxy in class DefaultCS

minP

public int minP()
Description copied from class: DefaultCS
For DForProxy().
Minimum number of parameters in param[] needed to call DForProxy().
Defines which indexs of param[] DForProxy() can use.
Functions with a different number of parameters must override this.
OVERRIDE THIS FUNCTION IF EXEC USES A DIFFERENT NUMBER OF PARAMETERS.
Default is 1.

Overrides:
minP in class DefaultCS

keyword

public java.lang.String keyword()
Description copied from class: DefaultCS
For the CodeSimian language as a String.
CodeSimian language keyword, like "+" "*" "max" ">" etc.

Override this function if you want to specify a keyword other than how I derive them from the class name, like + for Add.

Some CSs might never be intended to be used in the language by their keyword.
The best example (4/05) is Num, because it is used in the language like "3.4" instead of "num()".
Default: Returns class name, minus package name (and its dots), and change the first letter to lowercase.

For example, CS.MaxParams does not override keyword(), which returns "maxP".

Overrides:
keyword in class DefaultCS
See Also:
CS.parent(), CS.newInstance(), CS.name()

description

public java.lang.String description()
Description copied from class: CS
a short description of this CS, shorter than the javadoc, but long enough to tell what the params are for. Example use: in automatically generated webpages for CodeSimian. Example: "returns sum of all params" for Add.

Overrides:
description in class DefaultCS