Ejemplo n.º 1
0
        partial void test_ai_core_graphToolStripMenuItem1_Click(object sender, EventArgs e)
        {
            const int dims = 2;
            const int nofN = 5;

            const double min = 1.0;
            const double max = 9.0;

            Node <double> n; double d = max - min;

            double[] c;
            IList <Node <double> > nodes = new List <Node <double> >();

            for (int i = 0; i < nofN; i++)
            {
                c = new double[dims];
                for (int j = 0; j < dims; j++)
                {
                    c[j] = min + (Math.Daemon.Random.NextDouble() * d);
                }

                n = new Node <double>();
                n.Configure(c);

                nodes.Add(n);
            }

            string log = "";

            Graph g = new Graph();

            g.Configure(Graph.TypeOfEdge.Undirected, nodes.ToArray(), new double[] { 2.0, 1.2, 2.4, 5.6, 7.1, 2.5, 1.2,
                                                                                     6.7, 3.0, 1.3, 0.9, 0.03, 3.4, 12.1, 1.007 });

            Edge <double> e0 = g.GetEdge <double>(0, 4);
            Edge <double> e1 = g.GetEdge <double>(4, 0);

            log += "\n[" + e0.ToString() + "]";
            log += "\n[" + e1.ToString() + "]";

            Node <int> u = new Node <int>();

            u.Configure(new int[] { 3 });

            Graph h = new Graph();

            h.Configure(Graph.TypeOfEdge.Directed, 4, u, new double[] { 2.0, 1.2, 2.4, 5.6, 7.1, 2.5, 1.2,
                                                                        6.7, 3.0, 1.3, 0.9, 0.03, 3.4, 12.1, 1.007, 9.0 });

            Edge <double> e2 = h.GetEdge <double>(1, 3);
            Edge <double> e3 = h.GetEdge <double>(3, 1);

            log += "\n";
            log += "\n[" + e2.ToString() + "]";
            log += "\n[" + e3.ToString() + "]";

            richTextBox.Text = log;
        }
Ejemplo n.º 2
0
        partial void test_ai_core_nodeToolStripMenuItem_Click(object sender, EventArgs e)
        {
            string test = "";

            Node <int> node = new Node <int>();

            node.ID = 0;
            node.Configure(new int[] { 5, 3, 4, 5, 8 });
            node.Fitness = 25.0;

            test += node.ToString();

            richTextBox.Text = test;
        }