NonlinearProgram Constructor

Definition

Namespace: Extreme.Mathematics.Optimization
Assembly: Extreme.Numerics (in Extreme.Numerics.dll) Version: 8.1.23

Overload List

NonlinearProgram() Constructs a new nonlinear program.
NonlinearProgram(IEnumerable<String>) Constructs a new nonlinear program with variables of the specified names.
NonlinearProgram(Int32) Constructs a new nonlinear program with the specified number of variables.
NonlinearProgram(Func<Vector<Double>, Double>, Func<Vector<Double>, Vector<Double>, Vector<Double>>, Int32) Constructs a new nonlinear program without defining any linear or nonlinear constraints.
NonlinearProgram(Func<Vector<Double>, Double>, Func<Vector<Double>, Vector<Double>, Vector<Double>>, Matrix<Double>, Vector<Double>, Int32) Constructs a new nonlinear program with linear constraints in standard form.
NonlinearProgram(Func<Vector<Double>, Double>, Func<Vector<Double>, Vector<Double>, Vector<Double>>, Matrix<Double>, Vector<Double>, Vector<Double>, Vector<Double>, Vector<Double>) Constructs a new nonlinear program with linear constraints.

NonlinearProgram

Constructs a new nonlinear program.
C#
public NonlinearProgram()

NonlinearProgram(IEnumerable<String>)

Constructs a new nonlinear program with variables of the specified names.
C#
public NonlinearProgram(
	IEnumerable<string> variableNames
)

Parameters

variableNames  IEnumerable<String>
The number of variables in the objective function.

NonlinearProgram(Int32)

Constructs a new nonlinear program with the specified number of variables.
C#
public NonlinearProgram(
	int numberOfVariables
)

Parameters

numberOfVariables  Int32
The number of variables in the objective function.

Exceptions

ArgumentOutOfRangeExceptionnumberOfVariables is less than or equal to zero.

NonlinearProgram(Func<Vector<Double>, Double>, Func<Vector<Double>, Vector<Double>, Vector<Double>>, Int32)

Constructs a new nonlinear program without defining any linear or nonlinear constraints.
C#
public NonlinearProgram(
	Func<Vector<double>, double> objective,
	Func<Vector<double>, Vector<double>, Vector<double>> objectiveGradient,
	int numberOfVariables
)

Parameters

objective  Func<Vector<Double>, Double>
A delegate that represents the objective function as a multivariate function.
objectiveGradient  Func<Vector<Double>, Vector<Double>, Vector<Double>>
A delegate that represents the gradient of the objective function and also returns the result in its second argument.
numberOfVariables  Int32
The number of variables in the objective function.

Remarks

Use this constructor to create a nonlinear program with the specified objective function and corresponding gradient, but without defining any constraints.

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

Exceptions

ArgumentOutOfRangeExceptionnumberOfVariables is less than or equal to zero.
ArgumentNullExceptionobjective is null.

NonlinearProgram(Func<Vector<Double>, Double>, Func<Vector<Double>, Vector<Double>, Vector<Double>>, Matrix<Double>, Vector<Double>, Int32)

Constructs a new nonlinear program with linear constraints in standard form.
C#
public NonlinearProgram(
	Func<Vector<double>, double> objective,
	Func<Vector<double>, Vector<double>, Vector<double>> objectiveGradient,
	Matrix<double> constraints,
	Vector<double> rightHandSides,
	int equalities
)

Parameters

objective  Func<Vector<Double>, Double>
A delegate that represents the objective function as a multivariate function.
objectiveGradient  Func<Vector<Double>, Vector<Double>, Vector<Double>>
A delegate that represents the gradient of the objective function and also returns the result in its second argument.
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 nonlinear 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

ArgumentNullExceptionobjective is null.

-or-

constraints is null.

-or-

rightHandSides is null.

ArgumentOutOfRangeExceptionequalities 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 objective does not equal the number of columns of constraints.

NonlinearProgram(Func<Vector<Double>, Double>, Func<Vector<Double>, Vector<Double>, Vector<Double>>, Matrix<Double>, Vector<Double>, Vector<Double>, Vector<Double>, Vector<Double>)

Constructs a new nonlinear program with linear constraints.
C#
public NonlinearProgram(
	Func<Vector<double>, double> objective,
	Func<Vector<double>, Vector<double>, Vector<double>> objectiveGradient,
	Matrix<double> constraints,
	Vector<double> constraintLowerBounds,
	Vector<double> constraintUpperBounds,
	Vector<double> variableLowerBounds,
	Vector<double> variableUpperBounds
)

Parameters

objective  Func<Vector<Double>, Double>
A delegate that evaluates the objective function.
objectiveGradient  Func<Vector<Double>, Vector<Double>, Vector<Double>>
A gradient that evaluates the gradient of 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 nonlinear program with the most general definition of linear constraints. Any type of linear 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

ArgumentNullExceptionobjective is null.

-or-

constraints is null.

DimensionMismatchException

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