NonlinearProgram.AddNonlinearConstraint Method

Definition

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

Overload List

AddNonlinearConstraint(Func<Vector<Double>, Double>, ConstraintType, Double)

Adds a nonlinear constraint to the nonlinear program.
C#
public NonlinearConstraint AddNonlinearConstraint(
	Func<Vector<double>, double> constraintFunction,
	ConstraintType constraintType,
	double rightHandSide
)

Parameters

constraintFunction  Func<Vector<Double>, Double>
A delegate that represents the function that defines the constraint.
constraintType  ConstraintType
A ConstraintType value that speicifies the type of constraint.
rightHandSide  Double
The right-hand side of the constraint.

Return Value

NonlinearConstraint
The new NonlinearConstraint.

AddNonlinearConstraint(Func<Vector<Double>, Double>, Double, Double)

Adds a nonlinear constraint to the nonlinear program.
C#
public NonlinearConstraint AddNonlinearConstraint(
	Func<Vector<double>, double> constraintFunction,
	double lowerBound,
	double upperBound
)

Parameters

constraintFunction  Func<Vector<Double>, Double>
A delegate that represents the function that defines the constraint.
lowerBound  Double
The lower bound of the constraint.
upperBound  Double
The upper bound of the constraint.

Return Value

NonlinearConstraint
A NonlinearConstraint object that represents the new constraint.

Exceptions

ArgumentNullException

constraintFunction is null.

AddNonlinearConstraint(Func<Vector<Double>, Double>, ConstraintType, Double, Func<Vector<Double>, Vector<Double>, Vector<Double>>)

Adds a nonlinear constraint to the nonlinear program.
C#
public NonlinearConstraint AddNonlinearConstraint(
	Func<Vector<double>, double> constraintFunction,
	ConstraintType constraintType,
	double rightHandSide,
	Func<Vector<double>, Vector<double>?, Vector<double>> constraintGradient
)

Parameters

constraintFunction  Func<Vector<Double>, Double>
A delegate that represents the function that defines the constraint.
constraintType  ConstraintType
A ConstraintType value that speicifies the type of constraint.
rightHandSide  Double
The right-hand side of the constraint.
constraintGradient  Func<Vector<Double>, Vector<Double>, Vector<Double>>
A delegate that represents the gradient of constraintFunction.

Return Value

NonlinearConstraint
The new NonlinearConstraint.

AddNonlinearConstraint(Func<Vector<Double>, Double>, Double, Double, Func<Vector<Double>, Vector<Double>, Vector<Double>>)

Adds a nonlinear constraint to the nonlinear program.
C#
public NonlinearConstraint AddNonlinearConstraint(
	Func<Vector<double>, double> constraintFunction,
	double lowerBound,
	double upperBound,
	Func<Vector<double>, Vector<double>?, Vector<double>> constraintGradient
)

Parameters

constraintFunction  Func<Vector<Double>, Double>
A delegate that represents the function that defines the constraint.
lowerBound  Double
The lower bound of the constraint.
upperBound  Double
The upper bound of the constraint.
constraintGradient  Func<Vector<Double>, Vector<Double>, Vector<Double>>
A delegate that represents the gradient of the constraint function.

Return Value

NonlinearConstraint
A NonlinearConstraint object that represents the new constraint.

Exceptions

ArgumentNullException

constraintFunction is null.

AddNonlinearConstraint(String, Func<Vector<Double>, Double>, ConstraintType, Double)

Adds a nonlinear constraint to the nonlinear program.
C#
public NonlinearConstraint AddNonlinearConstraint(
	string? name,
	Func<Vector<double>, double> constraintFunction,
	ConstraintType constraintType,
	double rightHandSide
)

Parameters

name  String
The name of the constraint.
constraintFunction  Func<Vector<Double>, Double>
A delegate that represents the function that defines the constraint.
constraintType  ConstraintType
A ConstraintType value that speicifies the type of constraint.
rightHandSide  Double
The right-hand side of the constraint.

Return Value

NonlinearConstraint
The new NonlinearConstraint.

Exceptions

ArgumentException

The nonlinear program already contains a constraint named name.

ArgumentNullException

constraintFunction is null.

AddNonlinearConstraint(String, Func<Vector<Double>, Double>, Double, Double)

Adds a nonlinear constraint to the nonlinear program.
C#
public NonlinearConstraint AddNonlinearConstraint(
	string? name,
	Func<Vector<double>, double> constraintFunction,
	double lowerBound,
	double upperBound
)

Parameters

name  String
The name of the new constraint.
constraintFunction  Func<Vector<Double>, Double>
A delegate that represents the function that defines the constraint.
lowerBound  Double
The lower bound of the constraint.
upperBound  Double
The upper bound of the constraint.

Return Value

NonlinearConstraint
A NonlinearConstraint object that represents the new constraint.

Exceptions

ArgumentException

The nonlinear program already contains a constraint named name.

ArgumentNullException

constraintFunction is null.

AddNonlinearConstraint(String, Func<Vector<Double>, Double>, ConstraintType, Double, Func<Vector<Double>, Vector<Double>, Vector<Double>>)

Adds a nonlinear constraint to the nonlinear program.
C#
public NonlinearConstraint AddNonlinearConstraint(
	string? name,
	Func<Vector<double>, double> constraintFunction,
	ConstraintType constraintType,
	double rightHandSide,
	Func<Vector<double>, Vector<double>?, Vector<double>>? constraintGradient
)

Parameters

name  String
The name of the constraint.
constraintFunction  Func<Vector<Double>, Double>
A delegate that represents the function that defines the constraint.
constraintType  ConstraintType
A ConstraintType value that speicifies the type of constraint.
rightHandSide  Double
The right-hand side of the constraint.
constraintGradient  Func<Vector<Double>, Vector<Double>, Vector<Double>>
A delegate that represents the gradient of the constraint function.

Return Value

NonlinearConstraint
The new NonlinearConstraint.

Exceptions

ArgumentException

The nonlinear program already contains a constraint named name.

ArgumentNullException

constraintFunction is null.

AddNonlinearConstraint(String, Func<Vector<Double>, Double>, Double, Double, Func<Vector<Double>, Vector<Double>, Vector<Double>>)

Adds a nonlinear constraint to the nonlinear program.
C#
public NonlinearConstraint AddNonlinearConstraint(
	string? name,
	Func<Vector<double>, double> constraintFunction,
	double lowerBound,
	double upperBound,
	Func<Vector<double>, Vector<double>?, Vector<double>>? constraintGradient
)

Parameters

name  String
The name of the new constraint.
constraintFunction  Func<Vector<Double>, Double>
A delegate that represents the function that defines the constraint.
lowerBound  Double
The lower bound of the constraint.
upperBound  Double
The upper bound of the constraint.
constraintGradient  Func<Vector<Double>, Vector<Double>, Vector<Double>>
A delegate that represents the gradient of the constraint function.

Return Value

NonlinearConstraint
A NonlinearConstraint object that represents the new constraint.

Exceptions

ArgumentException

The nonlinear program already contains a constraint named name.

ArgumentNullException

constraintFunction is null.

See Also