Exemplo n.º 1
0
 private void CheckChromosome()
 {
     if (Chromosome == null)
     {
         Chromosome = new float[LayersList.Sum(x => x.TotalParamCount)];
     }
 }
Exemplo n.º 2
0
        public Points3dMain(List <Node> nodes, LayersList layersList)
        {
            InitializeComponent();

            RotateSetup();

            Init(nodes, layersList);
        }
Exemplo n.º 3
0
        private EvolvableNet(EvolvableNet other) : base(other)
        {
            Fitness    = other.Fitness;
            Chromosome = new float[LayersList.Sum(x => x.TotalParamCount)];
            other.Chromosome.CopyTo(Chromosome, 0);

            //clones have different IDs!
            Id = GetId();
        }
Exemplo n.º 4
0
        public EvolvableNet(int xSize, int hSize, int ySize)
            : base(1, 1, new GruLayer <float>(xSize, hSize),
                   new LinearLayer <float>(hSize, ySize),
                   new SoftMaxLayer <float>(ySize))
        {
            Chromosome = new float[LayersList.Sum(x => x.TotalParamCount)];

            Id = GetId();
        }
Exemplo n.º 5
0
        public Points3dMain(List <Node> nodes, LayersList layersList, TriangleTable triangleTable)
        {
            InitializeComponent();

            RotateSetup();

            Init(nodes, layersList);

            _triangleTable  = triangleTable;
            button2.Enabled = true;
        }
Exemplo n.º 6
0
        public static void DrawList(PresetLayers bufferLayers, string name, LayersList layerList, bool drawType)
        {
            bool foldout = GUIFoldout.Draw(name, bufferLayers);

            if (foldout == false)
            {
                return;
            }

            EditorGUI.indentLevel++;

            LightingLayerSetting[] layerSettings = bufferLayers.Get();

            int layerCount = EditorGUILayout.IntSlider("Count", layerSettings.Length, 0, 10);

            EditorGUILayout.Space();

            if (layerCount != layerSettings.Length)
            {
                int oldCount = layerSettings.Length;

                System.Array.Resize(ref layerSettings, layerCount);

                for (int i = oldCount; i < layerCount; i++)
                {
                    if (layerSettings[i] == null)
                    {
                        layerSettings[i]       = new LightingLayerSetting();
                        layerSettings[i].layer = i;
                    }
                }

                bufferLayers.SetArray(layerSettings);
            }

            for (int i = 0; i < layerSettings.Length; i++)
            {
                layerSettings[i].layer = EditorGUILayout.Popup("Layer", layerSettings[i].layer, layerList.GetNames());

                if (drawType)
                {
                    layerSettings[i].type = (LayerType)EditorGUILayout.EnumPopup("Type", layerSettings[i].type);
                }

                layerSettings[i].sorting = (LayerSorting)EditorGUILayout.EnumPopup("Sorting", layerSettings[i].sorting);


                EditorGUILayout.Space();
            }

            EditorGUI.indentLevel--;
        }
Exemplo n.º 7
0
        public PointView(List <Node> nodes, LayersList layers)
        {
            InitializeComponent();

            _nodes  = nodes;
            _layers = layers;

            dataGridView1.DataSource = _nodes;
            dataGridView2.DataSource = _layers.GetLayer(ind);

            hScrollBar1.Maximum = layers.GetLayersCount() + 8;

            label3.Text = ind.ToString();
        }
Exemplo n.º 8
0
        public Layers(List <object[]> listNode)
        {
            InitializeComponent();

            _nodes = CreateListOfNode(listNode);

            _layers = new LayersList();

            _triangleSearcher = new TriangleSearcher();

            pictureBox1.Image = Properties.Resources.emptyCoube;
            pictureBox2.Image = Properties.Resources.Axes;

            radioButton4.Checked = false;
            radioButton4.Checked = false;
        }
Exemplo n.º 9
0
        private void Init(List <Node> nodes, LayersList layersList)
        {
            _nodes      = nodes;
            _layersList = layersList;

            hScrollBar4.Maximum = layersList.GetLayersCount() + 8;
            layerInd            = hScrollBar4.Value;

            x0 = pictureBox1.Width / 2;
            y0 = pictureBox1.Height - pictureBox1.Height / 3;
            z0 = 0;

            bmp = new Bitmap(pictureBox1.Width, pictureBox1.Height);
            gr  = Graphics.FromImage(bmp);

            AddPoints(_nodes);
        }
Exemplo n.º 10
0
 private void RedrawButton_Click(object sender, EventArgs e)
 {
     FullUpdateCanvas();
     LayersList.ClearSelected();
 }
        public void ReadWeightsFromFile(string path)
        {
            layersList.Clear();
            layersCount = 0;
            string[] input = System.IO.File.ReadAllLines(@path);

            int           na = input.Count(i => i == "{");
            List <string> s  = input.ToList();
            int           p  = 1;

            for (int i = 0; i < na; i++)
            {
                if (s[p] == "0")
                {
                    int inputH            = int.Parse(s[p + 1]);
                    int inputW            = int.Parse(s[p + 2]);
                    Input_Layers_List inp = new Input_Layers_List(inputH, inputW);
                    LayersList.Add(inp);
                    layersCount++;
                    p = s.IndexOf("{", p + 2);
                }
                else
                {
                    List <List <List <double> > > weights = new List <List <List <double> > >();
                    int    n    = s.IndexOf("}", p);
                    var    s1   = s.GetRange(p + 1, n - p - 1);
                    int    nn   = s1.Count(l => l == "<");
                    string type = s1[0];

                    int pp = 0;
                    for (int j = 0; j < nn; j++)
                    {
                        List <List <double> > w = new List <List <double> >();
                        pp = s1.IndexOf("<", pp) + 1;
                        int endIndex = s1.IndexOf(">", pp);


                        for (int str = pp; str < endIndex; str++)
                        {
                            List <double> temp     = new List <double>();
                            string[]      splitStr = s1[str].Split();
                            for (int l = 0; l < splitStr.Length - 1; l++)
                            {
                                temp.Add(double.Parse(splitStr[l]));
                            }
                            w.Add(temp);
                        }

                        weights.Add(w);
                    }

                    if (type == "2")
                    {
                        AddConvolutionalLayer(weights.Count / LayersList.Last().TablesCount, weights[0].Count, weights[0][0].Count);
                        LayersList.Last().SetWeigths(weights);
                    }
                    else
                    {
                        AddPullingLayer(weights[0].Count, weights[0][0].Count);
                    }


                    p = n + 1;
                }
            }
        }