Exemplo n.º 1
0
        /// <summary>
        /// Proces of conversion listItems strored in ListView in to collection of Ternimas
        /// </summary>
        private void FromDirToFuns()
        {
            terminals = new Dictionary <int, GPTerminal>();

            var list   = inputVars.Where(x => x.Key.Contains("X")).OrderBy(x => x.Key);;
            int numVar = list.Count();

            for (int i = 0; i < numVar; i++)
            {
                var t = new GPTerminal();
                t.IsConstant = false;
                t.Name       = list.ElementAt(i).Key;
                t.Index      = i;
                terminals.Add(t.Index, t);
            }

            list = inputVars.Where(x => x.Key.Contains("C")).OrderBy(x => x.Key);
            for (int i = 0; i < list.Count(); i++)
            {
                var t = new GPTerminal();
                t.IsConstant = true;
                t.Name       = list.ElementAt(i).Key;
                t.fValue     = float.Parse(list.ElementAt(i).Value.ToString());
                t.Index      = numVar + i;
                terminals.Add(t.Index, t);
            }
        }
Exemplo n.º 2
0
        private void TerminateExperiments()
        {
            int numVariable = terminalSet.NumVariables;
            int numConst    = terminalSet.NumConstants;

            if (functionSet.terminals == null)
            {
                functionSet.terminals = new List <GPTerminal>();
            }
            else
            {
                functionSet.terminals.Clear();
            }

            //Definisanje terminala
            for (int i = 0; i < numVariable; i++)
            {
                //Terminali
                GPTerminal ter = new GPTerminal();
                ter.IsConstant = false;
                ter.Name       = "X" + (i + 1).ToString();
                ter.Value      = i;
                functionSet.terminals.Add(ter);
            }
            for (int j = 0; j < numConst; j++)
            {
                //Terminali
                GPTerminal ter = new GPTerminal();
                ter.IsConstant = true;
                ter.Name       = "R" + (j + 1).ToString();
                ter.Value      = j + numVariable;
                functionSet.terminals.Add(ter);
            }
        }
Exemplo n.º 3
0
        /// <summary>
        /// Returns list of Terminals with min and max values. The values is read fro listView
        /// </summary>
        /// <returns></returns>
        public List <GPTerminal> GetTerminalBounds()
        {
            var terms = new List <GPTerminal>();

            for (int i = 0; i < listView1.Items.Count; i++)
            {
                ListViewItem LVI = listView1.Items[i];
                GPTerminal   t   = new GPTerminal();
                t.Name     = LVI.SubItems[0].Text;
                t.minValue = float.Parse(LVI.SubItems[1].Text);
                t.maxValue = float.Parse(LVI.SubItems[2].Text);
                terms.Add(t);
            }

            return(terms);
        }