@@ -0,0 +1,2840 @@
+/*%0A * To change this template, choose Tools %7C Templates%0A * and open the template in the editor.%0A */%0Apackage annproj;%0A%0A%0Aimport java.util.ArrayList;%0A%0A/**%0A *%0A * @author conlejd%0A */%0Apublic final class Network %7B%0A    private ArrayList%3CDouble%3E inputs;%0A    private ArrayList%3CDouble%3E output;%0A    private ArrayList%3CArrayList%3CNode%3E%3E network;%0A    private int inputSize,layerSize,layers,numOutputs;%0A    Network(int numInputs, int layers, int layerSize,int numOutputs)%7B%0A        this.layers = layers;%0A        this.numOutputs = numOutputs;%0A        this.layerSize = layerSize;%0A        this.inputSize = numInputs;%0A        %0A        inputs = new ArrayList(numInputs);%0A        output = new ArrayList%3CDouble%3E(numOutputs);%0A        for(int i = 0; i%3CnumOutputs; i++)%7B%0A            output.add(0d);%0A        %7D%0A        network = new ArrayList%3CArrayList%3CNode%3E%3E(layers);%0A        %0A        network.add(new ArrayList%3CNode%3E(inputSize));%0A        for(int i = 1; i %3C layers-1; i++)%7B%0A            network.add( new ArrayList%3CNode%3E(layerSize));%0A        %7D%0A        network.add( new ArrayList%3CNode%3E(numOutputs));%0A        //TIE INTO THE MATRIX%0A        connectNodes();%0A    %7D%0A   /**%0A     * setInput - set the list of inputs for the network%0A     * @param inputs %0A     */%0A    public boolean setInput(ArrayList%3CDouble%3E inputs)%7B%0A        if(inputs.size() != inputSize)return false;%0A        this.inputs = inputs;%0A        return true;%0A    %7D%0A    /**%0A     * TIE INTO THE MATRIX%0A     */%0A    public void connectNodes()%7B%0A        for(int i = 0; i %3C inputSize; i++)%7B%0A            network.get(0).add(new InputNode());%0A        %7D%0A        %0A        for(int i = 1; i %3C layers; i++)%7B%0A            %0A            for(int j = 0; j %3C layerSize; j++)%7B%0A                %0A                network.get(i).add(new Node(network.get(i-1)));%0A            %7D%0A            %0A        %7D%0A        %0A    %7D%0A    // Set the inputs of all the input nodes to match the inputs arraylist in this class,and then%0A    // Calculate the outputs for the network%0A    public ArrayList%3CDouble%3E calculateOutput()%7B%0A        for(int i = 0; i %3C inputSize; i++)%7B%0A            network.get(0).get(i).setInput(inputs.get(i));%0A        %7D%0A        //Make it go through each node in the network and calculate output for each of them top down%0A        for(int i = 0; i %3C numOutputs; i++)%7B%0A            output.set(i, network.get(layers-1).get(i).calculateOutput());%0A        %7D%0A        return output;%0A    %7D%0A    public int getSize()%7B%0A        return network.size();%0A    %7D%0A    public ArrayList%3CDouble%3E getOutput()%7B%0A        return output;%0A    %7D%0A    public void setInput(int index, double value)%7B%0A        inputs.set(index, value);%0A    %7D%0A    public boolean training(ArrayList%3CDouble%3E testInputs, ArrayList%3CDouble%3E testOutputs)%7B%0A        if((testInputs.size() != inputSize) %7C%7C (testOutputs.size() != numOutputs))return false;%0A        //Outputs nodes%0A        return true;%0A    %7D%0A    %0A%7D%0A

Create Network.java