示例#1
0
        /// <summary>Initializes a new instance of the <see cref="GoldfarbIdanaQuadraticProgram"/> class.
        /// </summary>
        /// <param name="abortCondition">The abort (stopping) condition for the Simulated Annealing optimizer.</param>
        public GoldfarbIdanaQuadraticProgram(GoldfarbIdanaQuadraticProgramAbortCondition abortCondition)
        {
            AbortCondition = abortCondition ?? throw new ArgumentNullException(nameof(abortCondition));

            m_Name = new IdentifierString("Quadratic programming optimizer");
            m_FunctionDescriptor   = new QuadraticProgramFunctionFactory();
            m_ConstraintDescriptor = new MultiDimOptimizerConstraintFactory(MultiDimOptimizerConstraintFactory.ConstraintType.Box | MultiDimOptimizerConstraintFactory.ConstraintType.LinearEquation | MultiDimOptimizerConstraintFactory.ConstraintType.LinearInEquation | MultiDimOptimizerConstraintFactory.ConstraintType.None);
        }
示例#2
0
        /// <summary>Initializes a new instance of the <see cref="QuadraticProgramFunction"/> class.
        /// </summary>
        /// <param name="functionDescriptor">The function descriptor, i.e. the <see cref="QuadraticProgramFunctionFactory"/> object that served as factory for the current object.</param>
        /// <param name="A">The quadratic program matrix A.</param>
        /// <param name="b">The quadratic program vector b.</param>
        public QuadraticProgramFunction(QuadraticProgramFunctionFactory functionDescriptor, DenseMatrix A, double[] b)
        {
            m_Factory = functionDescriptor;
            if (A == null)
            {
                throw new ArgumentNullException(nameof(A));
            }
            if (A.RowCount != A.ColumnCount)
            {
                throw new ArgumentException(String.Format(ExceptionMessages.ArgumentIsNoSquaredMatrix, "A"), nameof(A));
            }
            this.A = A;

            if (b == null)
            {
                throw new ArgumentNullException(nameof(b));
            }
            if (b.Length < A.RowCount)
            {
                throw new ArgumentException(String.Format(ExceptionMessages.ArgumentHasWrongDimension, "b"), nameof(b));
            }
            this.b = b;
        }