QuadraticProgram Constructor

Definition

Namespace: Numerics.NET.Optimization
Assembly: Numerics.NET (in Numerics.NET.dll) Version: 9.0.4

Overload List

QuadraticProgram

Constructs a new QuadraticProgram object.
C#
public QuadraticProgram()

QuadraticProgram(Vector<Double>, Matrix<Double>, Matrix<Double>, Vector<Double>)

Constructs a new quadratic program in standard form.
C#
public QuadraticProgram(
	Vector<double> linearObjective,
	Matrix<double> quadraticObjective,
	Matrix<double> constraints,
	Vector<double> rightHandSides
)

Parameters

linearObjective  Vector<Double>
The vector of coefficients of the objective function.
quadraticObjective  Matrix<Double>
The symmetric matrix that contains the coefficients of the quadratic terms in the objective function.
constraints  Matrix<Double>
The matrix of coefficients of the constraints.
rightHandSides  Vector<Double>
The vector of right-hand-sides of the constraints.

Remarks

Use this constructor to create a quadratic program in standard form. 'Standard form' means that all constraints are inequality constraints with an upper bound, and that all variables are positive.

Even though it is possible to transform every quadratic program into standard form, it is usually much more efficient to encode the constraints in a more compact form using one of the other constructors.

The variables are given the names x1, x2... Constraints are given the names C1, C2...

Exceptions

ArgumentNullException

linearObjective is null.

-or-

quadraticObjective is null.

-or-

constraints is null.

-or-

rightHandSides is null.

DimensionMismatchException

The length of rightHandSides does not equal the number of rows of constraints.

-or-

The length of linearObjective does not equal the number of columns of constraints.

-or-

The length of linearObjective does not equal the number of rows and columns of quadraticObjective.

QuadraticProgram(Vector<Double>, Matrix<Double>, Matrix<Double>, Vector<Double>, Int32)

Constructs a new quadratic program in standard form.
C#
public QuadraticProgram(
	Vector<double> linearObjective,
	Matrix<double> quadraticObjective,
	Matrix<double> constraints,
	Vector<double> rightHandSides,
	int equalities
)

Parameters

linearObjective  Vector<Double>
The vector of coefficients of the objective function.
quadraticObjective  Matrix<Double>
The symmetric matrix that contains the coefficients of the quadratic terms in the objective function.
constraints  Matrix<Double>
The matrix of coefficients of the constraints.
rightHandSides  Vector<Double>
The vector of right-hand-sides of the constraints.
equalities  Int32
The number of equality constraints.

Remarks

Use this constructor to create a quadratic program in standard form with equality constraints. It is more efficient to specify an equality constraint as a single constraint rather than as two inequality constraints with opposite bounds. This constructor is preferred for linear programs in standard form with equality constraints. The equalities must be listed first in the constraint matrix and in the right-hand sides, followed by the inequalities.

Note that it is much more efficient to specify bounds on variables directly than to encode the bounds in additional constraints. It is also more efficient to specify a boxed constraint as a single constraint than as two inequality constraints with opposite bounds. For linear programs with such constraints, the more general constructor is recommended.

The variables are given the names x1, x2... Constraints are given the names C1, C2...

Exceptions

ArgumentNullException

linearObjective is null.

-or-

quadraticObjective is null.

-or-

constraints is null.

-or-

rightHandSides is null.

ArgumentOutOfRangeException

equalities is less than zero or greater than the number of constraints.

DimensionMismatchException

The length of rightHandSides does not equal the number of rows of constraints.

-or-

The length of linearObjective does not equal the number of columns of constraints.

-or-

The length of linearObjective does not equal the number of rows and columns of quadraticObjective.

QuadraticProgram(Vector<Double>, Matrix<Double>, Matrix<Double>, Vector<Double>, Vector<Double>, Vector<Double>, Vector<Double>)

Constructs a new quadratic program.
C#
public QuadraticProgram(
	Vector<double> linearObjective,
	Matrix<double> quadraticObjective,
	Matrix<double> constraints,
	Vector<double> constraintLowerBounds,
	Vector<double> constraintUpperBounds,
	Vector<double> variableLowerBounds,
	Vector<double> variableUpperBounds
)

Parameters

linearObjective  Vector<Double>
The vector of coefficients of the objective function.
quadraticObjective  Matrix<Double>
The symmetric matrix that contains the coefficients of the quadratic terms in the objective function.
constraints  Matrix<Double>
The matrix of coefficients of the constraints.
constraintLowerBounds  Vector<Double>
The vector of lower bounds for the constraints.
constraintUpperBounds  Vector<Double>
The vector of upper bounds for the constraints. Must not be null.
variableLowerBounds  Vector<Double>
The vector of lower bounds for the variables.
variableUpperBounds  Vector<Double>
The vector of upper bounds for the variables.

Remarks

Use this constructor to create a quadratic program with the most general definition. Any type of constraint can be specified, including a boxed constraint with both a lower and an upper bound. Where by default, variables are restricted to be positive, this constructor allows arbitrary bounds to be set for variables.

Note that it is much more efficient to specify bounds on variables than to encode the bounds in additional constraints. It is also more efficient to specify a boxed or equality constraint as a single constraint than as two inequality constraints with opposite bounds.

The variables are given the names x1, x2... Constraints are given the names C1, C2...

Exceptions

ArgumentNullException

linearObjective is null.

-or-

quadraticObjective is null.

-or-

constraints is null.

DimensionMismatchException

The length of linearObjective does not equal the number of columns of constraints.

-or-

The length of linearObjective does not equal the number of rows and columns of quadraticObjective.

-or-

constraintLowerBounds is not null and the length of constraintLowerBounds does not equal the number of rows of constraints.

variableLowerBounds is not null and the length of variableLowerBounds does not equal the number of colunms of constraints.

variableUpperBounds is not null and the length of variableUpperBounds does not equal the number of colunms of constraints.

See Also