NonlinearProgram.AddSymbolicConstraint Method

Definition

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

Overload List

AddSymbolicConstraint(Expression<Func<Vector<Double>, Double>>, ConstraintType, Double) Adds a constraint that is defined by an expression to the nonlinear program.
AddSymbolicConstraint(Expression<Func<Vector<Double>, Double>>, Double, Double) Adds a constraint that is defined by an expression to the nonlinear program.
AddSymbolicConstraint(String, Expression<Func<Vector<Double>, Double>>, ConstraintType, Double) Adds a constraint that is defined by an expression to the nonlinear program.
AddSymbolicConstraint(String, Expression<Func<Vector<Double>, Double>>, Double, Double) Adds a constraint that is defined by an expression to the nonlinear program.

AddSymbolicConstraint(Expression<Func<Vector<Double>, Double>>, ConstraintType, Double)

Adds a constraint that is defined by an expression to the nonlinear program.
C#
public Constraint AddSymbolicConstraint(
	Expression<Func<Vector<double>, double>> constraintFunction,
	ConstraintType constraintType,
	double rightHandSide
)

Parameters

constraintFunction  Expression<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

Constraint
The new Constraint.

Remarks

The type of the return value depends on the constraint. If the constraint is linear in the variables, a LinearConstraint is returned, and the bounds of the constraint may be adjusted to take into account constant terms in the expression. Otherwise, a NonlinearConstraint is returned.

AddSymbolicConstraint(Expression<Func<Vector<Double>, Double>>, Double, Double)

Adds a constraint that is defined by an expression to the nonlinear program.
C#
public Constraint AddSymbolicConstraint(
	Expression<Func<Vector<double>, double>> constraintFunction,
	double lowerBound,
	double upperBound
)

Parameters

constraintFunction  Expression<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

Constraint
A NonlinearConstraint object that represents the new constraint.

Remarks

The type of the return value depends on the constraint. If the constraint is linear in the variables, a LinearConstraint is returned, and the bounds of the constraint may be adjusted to take into account constant terms in the expression. Otherwise, a NonlinearConstraint is returned.

Exceptions

ArgumentNullException

constraintFunction is null.

AddSymbolicConstraint(String, Expression<Func<Vector<Double>, Double>>, ConstraintType, Double)

Adds a constraint that is defined by an expression to the nonlinear program.
C#
public Constraint AddSymbolicConstraint(
	string? name,
	Expression<Func<Vector<double>, double>> constraintFunction,
	ConstraintType constraintType,
	double rightHandSide
)

Parameters

name  String
The name of the constraint.
constraintFunction  Expression<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

Constraint
The new NonlinearConstraint.

Remarks

The type of the return value depends on the constraint. If the constraint is linear in the variables, a LinearConstraint is returned, and the bounds of the constraint may be adjusted to take into account constant terms in the expression. Otherwise, a NonlinearConstraint is returned.

Exceptions

ArgumentException

The nonlinear program already contains a constraint named name.

ArgumentNullException

constraintFunction is null.

AddSymbolicConstraint(String, Expression<Func<Vector<Double>, Double>>, Double, Double)

Adds a constraint that is defined by an expression to the nonlinear program.
C#
public Constraint AddSymbolicConstraint(
	string? name,
	Expression<Func<Vector<double>, double>> constraintFunction,
	double lowerBound,
	double upperBound
)

Parameters

name  String
The name of the new constraint.
constraintFunction  Expression<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

Constraint
A NonlinearConstraint object that represents the new constraint.

Remarks

The type of the return value depends on the constraint. If the constraint is linear in the variables, a LinearConstraint is returned, and the bounds of the constraint may be adjusted to take into account constant terms in the expression. Otherwise, a NonlinearConstraint is returned.

Exceptions

ArgumentException

The nonlinear program already contains a constraint named name.

ArgumentNullException

constraintFunction is null.

See Also