/// <summary>
        ///   Constructs a new <see cref="GoldfarbIdnaniQuadraticSolver"/> class.
        /// </summary>
        /// 
        /// <param name="numberOfVariables">The number of variables.</param>
        /// <param name="constraints">The problem's constraints.</param>
        /// 
        public GoldfarbIdnaniQuadraticSolver(int numberOfVariables, LinearConstraintCollection constraints)
        {
            int equalities;

            // Create the constraint matrix A from the specified constraint list
            double[,] A = constraints.CreateMatrix(numberOfVariables, out constraintValues, out equalities);

            System.Diagnostics.Debug.Assert(A.GetLength(1) == numberOfVariables);

            initialize(numberOfVariables, A, constraintValues, equalities);
        }
Exemple #2
0
        /// <summary>
        ///   Constructs a new <see cref="GoldfarbIdnani"/> class.
        /// </summary>
        ///
        /// <param name="function">The objective function to be optimized.</param>
        /// <param name="constraints">The problem's constraints.</param>
        ///
        public GoldfarbIdnani(QuadraticObjectiveFunction function, LinearConstraintCollection constraints)
            : base(function.NumberOfVariables, function.Function, function.Gradient)
        {
            int equalities;

            // Create the constraint matrix A from the specified constraint list
            double[,] A = constraints.CreateMatrix(function.NumberOfVariables, out constraintValues, out equalities);

            System.Diagnostics.Debug.Assert(A.GetLength(1) == function.NumberOfVariables);

            initialize(function.NumberOfVariables,
                       function.QuadraticTerms, function.LinearTerms,
                       A, constraintValues, equalities);
        }