Exemple #1
0
        public ControlBaseTask(int N, double LowerBound, double UpperBound, double TMax, double x10, double x20,
                               double LambdaLower, double LambdaUpper)
        {
            if (N < 2)
            {
                throw new ArgumentException($"{nameof(N)} must be greater than 1.", nameof(N));
            }

            if (LowerBound >= UpperBound)
            {
                throw new ArgumentException($"{nameof(LowerBound)} must be less than {nameof(UpperBound)}");
            }

            if (TMax <= 0)
            {
                throw new ArgumentException($"{nameof(TMax)} must be greater than 0.");
            }

            if (LambdaLower >= LambdaUpper)
            {
                throw new ArgumentException($"{nameof(LambdaLower)} must be greater than {nameof(LambdaUpper)}.");
            }

            // Диапазон переключения и lambda1, lambda2.
            _lowerBounds = Enumerable.Repeat(LowerBound, N * 2 + 2).ToArray();
            _upperBounds = Enumerable.Repeat(UpperBound, N * 2 + 2).ToArray();

            _lowerBounds[_lowerBounds.Length - 2] = LambdaLower;
            _lowerBounds[_lowerBounds.Length - 1] = LambdaLower;

            _upperBounds[_upperBounds.Length - 2] = LambdaUpper;
            _upperBounds[_upperBounds.Length - 1] = LambdaUpper;

            _nSwitch = N;

            _step = (double)TMax / _nSwitch;

            _Tmax     = TMax;
            _valueofT = new double[_nSwitch + 1];

            for (int i = 0; i < _valueofT.Length; i++)
            {
                _valueofT[i] = i * _step;
            }

            _ode = new TargetODE(x10, x20, _Tmax, _valueofT);
        }
        public MOControlTask(int N, double LowerBound, double UpperBound, double TMax, double x10, double x20, double lambda1, double lambda2, double lambda3, double lambad4)
        {
            if (N < 2)
            {
                throw new ArgumentException($"{nameof(N)} must be greater than 1.", nameof(N));
            }

            if (LowerBound >= UpperBound)
            {
                throw new ArgumentException($"{nameof(LowerBound)} must be less than {nameof(UpperBound)}");
            }

            if (TMax <= 0)
            {
                throw new ArgumentException($"{nameof(TMax)} must be greater than 0.");
            }

            _lowerBounds = Enumerable.Repeat(LowerBound, N * 2).ToArray();
            _upperBounds = Enumerable.Repeat(UpperBound, N * 2).ToArray();

            _lambda1 = lambda1;
            _lambda2 = lambda2;
            _lambda3 = lambda3;
            _lambda4 = lambad4;

            _nSwitch = N;

            _step = (double)TMax / _nSwitch;

            _Tmax     = TMax;
            _valueofT = new double[_nSwitch + 1];

            for (int i = 0; i < _valueofT.Length; i++)
            {
                _valueofT[i] = i * _step;
            }

            _ode          = new TargetODE(x10, x20, _Tmax, _valueofT);
            _targetValues = new double[OBJ_COUNT];

            _sum = new KahanSum();
        }