Example #1
0
        public int            oldSynapseInnovationId; // The id of the synapse gene it split

        public Innovation(InnovationType type, int innovationId, int fromNeuronId, int toNeuronId, int oldSynapseInnovationId)
        {
            this.type                   = type;
            this.innovationId           = innovationId;
            this.fromNeuronId           = fromNeuronId;
            this.toNeuronId             = toNeuronId;
            this.oldSynapseInnovationId = oldSynapseInnovationId;
        }
Example #2
0
 public void Insert(InnovationType innovationType)
 {
     using (_dbContext)
     {
         _dbContext.InnovationTypes.Add(innovationType);
         _dbContext.SaveChanges();
     }
 }
 public Innovation(InnovationType type, int innovationId, int fromNeuronId, int toNeuronId, int oldSynapseInnovationId)
 {
     this.type = type;
       		this.innovationId = innovationId;
       		this.fromNeuronId = fromNeuronId;
       		this.toNeuronId = toNeuronId;
       this.oldSynapseInnovationId = oldSynapseInnovationId;
 }
Example #4
0
 public Innovation(int percepIn, int percepOut, InnovationType type, int ID, NodeType percepType, Vector2 splitValues)
 {
     this.percepIn    = percepIn;
     this.percepOut   = percepOut;
     this.type        = type;
     this.ID          = ID;
     percepID         = 0;
     this.percepType  = percepType;
     this.splitValues = splitValues;
 }
Example #5
0
 public Innovation(int percepIn, int percepOut, InnovationType type, int ID)
 {
     this.percepIn  = percepIn;
     this.percepOut = percepOut;
     this.type      = type;
     this.ID        = ID;
     percepID       = 0;
     splitValues    = new Vector2(0, 0);
     percepType     = NodeType.none;
 }
Example #6
0
 public InnovationContainer(int input, int output, InnovationType innovationType, int inov_id)
 {
     NeuronIn            = input;
     NeuronOut           = output;
     InnovationTypevalue = innovationType;
     InnovationID        = inov_id;
     NeuronID            = 0;
     SplitX          = 0;
     SplitY          = 0;
     NeuronTypeValue = NeuronType.None;
 }
Example #7
0
 public InnovationContainer(int input, int output, InnovationType innovationType, int inovation_id, NeuronType neuronType, double x, double y)
 {
     NeuronIn  = input;
     NeuronOut = output;
     this.InnovationTypevalue = innovationType;
     InnovationID             = inovation_id;
     NeuronID        = 0;
     NeuronTypeValue = neuronType;
     SplitX          = x;
     SplitY          = y;
 }
Example #8
0
    public int CheckInnovation(int from, int to, InnovationType type)
    {
        for (int i = 0; i < innovations.Count; i++)
        {
            if (innovations[i].percepIn == from && innovations[i].percepOut == to && innovations[i].type == type)
            {
                return(innovations[i].ID);
            }
        }

        return(-1);
    }
Example #9
0
 SInnovation(int inID, int outID, InnovationType type,
             int innovationID, NeuronType neuron_type, float x, float y)
 {
     NeuronIn   = inID;
     NeuronOut  = outID;
     Type       = type;
     ID         = innovationID;
     NeuronID   = 0;
     SplitX     = x;
     SplitY     = y;
     neuronType = neuron_type;
 }
Example #10
0
 SInnovation(int inID, int outID, InnovationType type,
             int innovationID)
 {
     NeuronIn   = inID;
     NeuronOut  = outID;
     Type       = type;
     ID         = innovationID;
     NeuronID   = 0;
     SplitX     = 0;
     SplitY     = 0;
     neuronType = GA.NeuronType.None;
 }
Example #11
0
        CreateNewInnovation(int inID, int outID, InnovationType type)
        {
            SInnovation innovation = new SInnovation(inID, outID, type,
                                                     m_NextInnovationID++);

            if (type == InnovationType.NewNeuron)
            {
                innovation.NeuronID = m_NextNeuronID++;
            }

            m_vecInnovations.Add(innovation);

            return(m_NextNeuronID - 1);
        }
Example #12
0
    public int CreateNewInnovation(int from, int to, InnovationType type)
    {
        Innovation innovation = new Innovation(from, to, type, nextInnovationNumber);

        if (type == InnovationType.Perceptron)
        {
            innovation.percepID = nextNeuronID;
            nextNeuronID++;
        }

        innovations.Add(innovation);
        nextInnovationNumber++;

        return(nextNeuronID - 1);
    }
Example #13
0
        CheckInnovation(int inID, int outID, InnovationType type)
        {
            for (int i = 0; i < m_vecInnovations.Count; i++)
            {
                SInnovation innovation = m_vecInnovations[i];
                if (innovation.NeuronIn == inID &&
                    innovation.NeuronOut == outID &&
                    innovation.Type == type)
                {
                    return(innovation.ID);
                }
            }

            return(-1);
        }
Example #14
0
    public int CreateNewInnovation(int from, int to, InnovationType innovType, NodeType nodeType, Vector2 splitValues)
    {
        Innovation innovation = new Innovation(from, to, innovType, nextInnovationNumber, nodeType, splitValues);

        if (innovType == InnovationType.Perceptron)
        {
            innovation.percepID = nextNeuronID;
            nextNeuronID++;
        }

        innovations.Add(innovation);
        nextInnovationNumber++;

        return(nextNeuronID - 1);
    }
Example #15
0
        CreateNewInnovation(int from, int to, InnovationType type,
                            NeuronType neuron_type, float x, float y)
        {
            SInnovation innovation = new SInnovation(from, to, type,
                                                     m_NextInnovationID++,
                                                     neuron_type, x, y);

            if (type == InnovationType.NewNeuron)
            {
                innovation.NeuronID = m_NextNeuronID++;
            }

            m_vecInnovations.Add(innovation);

            return(m_NextNeuronID - 1);
        }
        /// <summary>
        /// checks to see if this innovation has already occurred. If it has it returns the innovation ID. If not it returns a negative value.
        /// </summary>
        /// <param name="input"></param>
        /// <param name="output"></param>
        /// <param name="type"></param>
        /// <returns></returns>
        public int CheckInnovation(int input, int output, InnovationType type)
        {
            //iterate through the innovations looking for a match on all
            //three parameters
            for (int inv = 0; inv < this.Innovations.Count; ++inv)
            {
                if ((this.Innovations[inv].NeuronIn == input) && (this.Innovations[inv].NeuronOut == output) && (this.Innovations[inv].InnovationTypevalue == type))
                {
                    //found a match so assign this innovation number to id
                    return(this.Innovations[inv].InnovationID);
                }
            }

            //if no match return a negative value
            return(-1);
        }
        /// <summary>
        /// creates a new innovation and returns its ID
        /// </summary>
        /// <param name="input"></param>
        /// <param name="output"></param>
        /// <param name="type"></param>
        /// <returns></returns>
        public int CreateNewInnovation(int input, int output, InnovationType type)
        {
            InnovationContainer new_innov = new InnovationContainer(input, output, type, this.NextInnovationNumber);

            if (type == InnovationType.NewNeuron)
            {
                new_innov.NeuronID = this.NextNeuronID;

                ++this.NextNeuronID;
            }

            this.Innovations.Add(new_innov);

            ++this.NextInnovationNumber;

            return(this.NextNeuronID - 1);
        }
        /// <summary>
        /// as above but includes adding x/y position of new neuron
        /// </summary>
        /// <param name="from"></param>
        /// <param name="to"></param>
        /// <param name="InnovType"></param>
        /// <param name="NeuronType"></param>
        /// <param name="x"></param>
        /// <param name="y"></param>
        /// <returns></returns>
        public int CreateNewInnovation(int from,
                                       int to,
                                       InnovationType innovType,
                                       NeuronType neuronType,
                                       double x,
                                       double y)
        {
            InnovationContainer new_innov = new InnovationContainer(from, to, innovType, this.NextInnovationNumber, neuronType, x, y);

            if (innovType == InnovationType.NewNeuron)
            {
                new_innov.NeuronID = this.NextNeuronID;

                ++this.NextNeuronID;
            }

            this.Innovations.Add(new_innov);

            ++this.NextInnovationNumber;

            return(this.NextNeuronID - 1);
        }
Example #19
0
 public void Post([FromBody] InnovationType innovationType)
 {
     _innovationTypeRepository.Insert(innovationType);
 }