private double SearchMeanPercentForSize(int size, int matrixQuantity, double averChange, Solver solver, Random random)
        {
            PercentFinder.PercentDelegate SearchPercent = GetPercentOfChange;
            var parameters = new ParametersForRandom(size, matrixQuantity, _cChangeParameters);

            return(PercentFinder.SearchMeanPercent(SearchPercent, parameters, averChange, solver, random));
        }
        private int GetPercentOfChange(SearchParameters parameters, Solver solver, Random random)
        {
            if (!(parameters is ParametersForRandom))
            {
                throw new ArgumentException("Wrong parameters type in method Experiment.GetPercentOfChange. Need to be ParametersForRandom.");
            }
            var param = (ParametersForRandom)parameters;
            int percent;

            double[]   x     = new double[param.Size * param.Size];
            double[][] cs    = new double[param.MatrixQuantity][];
            double[]   a     = new double[param.Size];
            double[]   b     = new double[param.Size];
            double[]   l     = new double[param.MatrixQuantity];
            double[]   alpha = new double[param.MatrixQuantity];
            double[]   solutions;

            bool success = false;

            while (!success)
            {
                (a, b) = _generator.GenerateAB(param.Size, random);
                l      = _generator.GenerateL(param.MatrixQuantity, random);
                alpha  = _generator.GenerateAlpha(param.MatrixQuantity);
                for (int i = 0; i < param.MatrixQuantity; i++)
                {
                    cs[i] = _generator.GenerateMatrix(param.Size, random);
                }
                (_, solutions) = solver.GetSolutions(cs, a, b);
                (x, _)         = solver.SolveSeveral(cs, a, b, l, alpha, solutions);
                x = solver.DivideX(solver.RoundVector(x), param.MatrixQuantity);
                if (!solver.CheckABConstraints(x, a, b))
                {
                    continue;
                }
                success = true;
            }
            var parametersForDefined = new ParametersForDefined(x, cs, a, b, l, alpha, _cChangeParameters);

            percent = PercentFinder.FindPercentOfChange(parametersForDefined, solver, random);
            return(percent);
        }