public void generatePointTest()
        {
            RandomPointGenerator gen = new RandomPointGenerator();
            PlaneProjector proj = new PlaneProjector();

            Point p = gen.generatePoint(3);

            //Assert.IsTrue(proj.isAddingToOne(p));
        }
Example #2
0
        public List <Point> prepareVectors(Point p)
        {
            List <Point> pointList = new List <Point>();

            for (int i = 0; i < p.Dimensions - 1; i++)
            {
                pointList.Add(generator.generatePoint(p.Dimensions));
            }

            for (int i = 0; i < pointList.Count; i++)
            {
                Point point = pointList.ElementAt(i);
                pointList[i] = p.subtract(point);
            }

            return(pointList);
        }
        //public bool fitsHyperplane(double c, Point p)
        //{
        //    if (p.Mean == c)
        //    {
        //        Console.WriteLine(p.Mean.ToString(MainWindow.DOUBLE_FORMAT_STRING) + " == " +
        //            c.ToString(MainWindow.DOUBLE_FORMAT_STRING));
        //        return true;
        //    }
        //    else
        //    {
        //        Console.WriteLine(p.Mean.ToString(MainWindow.DOUBLE_FORMAT_STRING) + " != "
        //            + c.ToString(MainWindow.DOUBLE_FORMAT_STRING));
        //        return false;
        //    }
        //}
        public Point makePoint(Point X, double d, int dim)
        {
            if (generator != null)
            {
                Point p = generator.generatePoint(dim);

                Console.WriteLine("Point= " + p.ToString() + "\n");

                Point projection = this.projectPoint(p, X, d);

                Console.WriteLine("Projected= " + projection.ToString() + "\n");

                return(projection);
            }
            else
            {
                throw new ArgumentNullException("generator", "Generator is null");
            }
        }
        public bool run(int n, int dimension, double c, Point X)
        {
            generator = new RandomPointGenerator();
            planeProjector = new PlaneProjector();
            pointProcessor = new PointProcessor();

            Console.WriteLine("=================== NEW RUN ===================\n");

            if (X == null)
            {
                X = generator.generatePoint(dimension);
            }

            Console.WriteLine("X= " + X.ToString() + "\n");

            //Preparing background worker;
            prepareObjects();

            Object[] arguments = { n, dimension, c, X };

            bgWorker.RunWorkerAsync(arguments);

            return true;
        }
Example #5
0
        public bool run(int n, int dimension, double c, Point X)
        {
            generator      = new RandomPointGenerator();
            planeProjector = new PlaneProjector();
            pointProcessor = new PointProcessor();

            Console.WriteLine("=================== NEW RUN ===================\n");

            if (X == null)
            {
                X = generator.generatePoint(dimension);
            }

            Console.WriteLine("X= " + X.ToString() + "\n");

            //Preparing background worker;
            prepareObjects();

            Object[] arguments = { n, dimension, c, X };

            bgWorker.RunWorkerAsync(arguments);

            return(true);
        }