Example #1
0
        public ConvexHull(List <double[]> basePoints)
        {
            int dimension = basePoints[0].Count();

            if (dimension == 0)
            {
                throw new ArgumentException();
            }
            if (basePoints.Any(x => x.Count() != dimension))
            {
                throw new ArgumentException();
            }

            Dimension      = dimension;
            _basePoints    = AlgorithmHelper.RemoveDuplicates(basePoints);
            _max           = AlgorithmHelper.GetMaxInListByComponents(_basePoints);
            _min           = AlgorithmHelper.GetMinInListByComponents(_basePoints);
            _notEqMask     = _max.Zip(_min, (x, y) => x != y).ToArray();
            _realDimension = _notEqMask.Count(x => x);

            if (_realDimension > 0)
            {
                _realPoints = AlgorithmHelper.RemoveDuplicates(AlgorithmHelper.MaskListOfArrays(_basePoints, _notEqMask));
                _realMax    = AlgorithmHelper.GetArrayByMask(_max, _notEqMask);
                _realMin    = AlgorithmHelper.GetArrayByMask(_min, _notEqMask);

                if (_realDimension > 1)
                {
                    _convexHull = MIConvexHull.ConvexHull.Create(_realPoints);
                }
            }

            CalculateInequalities();
        }
Example #2
0
        public FakeTechnologicalSectionAlgorithm(List <double[]> schedule)
        {
            _schedule    = schedule;
            _regimes     = AlgorithmHelper.RemoveDuplicates(_schedule);
            _normRegimes = AlgorithmHelper.NormalizeByComponents(_regimes);

            Period    = schedule.Count();
            Dimension = schedule[0].Count();
        }