Skip to content
Snippets Groups Projects
NeuralNetwork.h 2.31 KiB
Newer Older
  • Learn to ignore specific revisions
  • /**
     * DESCRIPTION OF THE FILE
     *
     * @author Michal Kravčenko
     * @date 13.6.18 -
     */
    
    
     //TODO pouvazovat o pridani indexu k neuronum, abychom meli urcitou kontrolu nad poradim vstupu a vystupu?
    
    
    #ifndef INC_4NEURO_NEURALNETWORK_H
    #define INC_4NEURO_NEURALNETWORK_H
    
    
    #include <vector>
    #include "../Neuron/Neuron.h"
    
    
    /**
     *
     */
    class NeuralNetwork {
    private:
        /**
         *
         */
        NET_TYPE network_type = GENERAL;
    
    
    
         /**
          *
          */
         std::vector<Neuron*> *neurons = nullptr;
    
         /**
          *
          */
         std::vector<Neuron*>* input_neurons = nullptr;
    
         /**
          *
          */
         std::vector<Neuron*>* output_neurons = nullptr;
    
    
         std::vector<double>* connection_weights = nullptr;
    
    
         /**
          *
          */
         int n_inputs = -1;
    
         /**
          *
          */
         int n_outputs = -1;
    
         /**
          *
          */
         bool in_out_determined = false;
    
    
         std::vector<Neuron*>* active_eval_set = nullptr;
    
    
    
    
         /**
          *
          */
         void determine_inputs_outputs();
    
        NeuralNetwork();
    
        /**
         *
         */
        ~NeuralNetwork();
    
        /**
         *
         * @param[in] input
         * @param[in,out] output
         */
        void eval_single(std::vector<double> &input, std::vector<double> &output);
    
    
    
        /**
         *
    
         * @param[in] n
         * @return
         */
        int add_neuron(Neuron* n);
    
    
        /**
         *
         * @param n1_idx
         * @param n2_idx
         */
        void add_connection_simple(int n1_idx, int n2_idx);
    
        /**
         *
         * @param n1_idx
         * @param n2_idx
         * @param weight_idx
         */
        void add_connection_simple(int n1_idx, int n2_idx, int weight_idx);
    
    
        /**
         *
         * @param[in] n1_idx
         * @param[in] n2_idx
         * @param[in] weight_idx
         * @param[in] weight_value
         */
        void add_connection_simple(int n1_idx, int n2_idx, int weight_idx, double weight_value);
    
        /**
         *
         * @param n1_idx
         * @param n2_idx
         * @param f
         * @param weight_indices
         * @param weight_values
         * @param n_weights
    
        void add_connection_general(int n1_idx, int n2_idx, std::function<double(double *, int*, int)> *f, int* weight_indices, double* weight_values, int n_weights);