OptimizationModel.AddLinearConstraint Method

Definition

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

Overload List

AddLinearConstraint(String, ConstraintType, Double) Adds a linear constraint to the optimization model.
AddLinearConstraint(String, Double, Double) Adds a linear constraint to the optimization model.
AddLinearConstraint(IList<DecisionVariable>, IList<Double>, ConstraintType, Double) Adds a linear constraint to the optimization model.
AddLinearConstraint(String, IList<Double>, ConstraintType, Double) Adds a linear constraint to the optimization model.
AddLinearConstraint(String, IList<Double>, Double, Double) Adds a linear constraint to the optimization model.
AddLinearConstraint(String, IList<DecisionVariable>, IList<Double>, ConstraintType, Double) Adds a linear constraint to the optimization model.

AddLinearConstraint(String, ConstraintType, Double)

Adds a linear constraint to the optimization model.
C#
public LinearConstraint AddLinearConstraint(
	string name,
	ConstraintType constraintType,
	double rightHandSide
)

Parameters

name  String
The name of the new constraint.
constraintType  ConstraintType
A ConstraintType value that specifies the type of constraint.
rightHandSide  Double
The right-hand side of the constraint.

Return Value

LinearConstraint
A LinearConstraint object that represents the new constraint.

Exceptions

ArgumentException

The optimization model already contains a constraint named name.

AddLinearConstraint(String, Double, Double)

Adds a linear constraint to the optimization model.
C#
public LinearConstraint AddLinearConstraint(
	string name,
	double lowerBound,
	double upperBound
)

Parameters

name  String
The name of the new constraint.
lowerBound  Double
The lower bound of the constraint.
upperBound  Double
The upper bound of the constraint.

Return Value

LinearConstraint
A LinearConstraint object that represents the new constraint.

Exceptions

ArgumentException

The optimization model already contains a constraint named name.

AddLinearConstraint(IList<DecisionVariable>, IList<Double>, ConstraintType, Double)

Adds a linear constraint to the optimization model.
C#
public LinearConstraint AddLinearConstraint(
	IList<DecisionVariable> variables,
	IList<double> coefficients,
	ConstraintType constraintType,
	double rightHandSide
)

Parameters

variables  IList<DecisionVariable>
A list of the variables that appear in the constraint.
coefficients  IList<Double>
A list of corresponding coefficients.
constraintType  ConstraintType
A ConstraintType value that speicifies the type of constraint.
rightHandSide  Double
The right-hand side of the constraint.

Return Value

LinearConstraint
The new LinearConstraint.

AddLinearConstraint(String, IList<Double>, ConstraintType, Double)

Adds a linear constraint to the optimization model.
C#
public LinearConstraint AddLinearConstraint(
	string name,
	IList<double> coefficients,
	ConstraintType constraintType,
	double rightHandSide
)

Parameters

name  String
The name of the constraint.
coefficients  IList<Double>
A list of real numbers containing the coefficients of the variables in the constraint.
constraintType  ConstraintType
A ConstraintType value that speicifies the type of constraint.
rightHandSide  Double
The right-hand side of the constraint.

Return Value

LinearConstraint
The new LinearConstraint.

Exceptions

ArgumentException

The optimization model already contains a constraint named name.

ArgumentNullException

coefficients is null.

AddLinearConstraint(String, IList<Double>, Double, Double)

Adds a linear constraint to the optimization model.
C#
public LinearConstraint AddLinearConstraint(
	string name,
	IList<double> coefficients,
	double lowerBound,
	double upperBound
)

Parameters

name  String
The name of the new constraint.
coefficients  IList<Double>
A vector containing the coefficients in the constraint.
lowerBound  Double
The lower bound of the constraint.
upperBound  Double
The upper bound of the constraint.

Return Value

LinearConstraint
A LinearConstraint object that represents the new constraint.

Exceptions

ArgumentException

The optimization model already contains a constraint named name.

ArgumentNullException

coefficients is null.

AddLinearConstraint(String, IList<DecisionVariable>, IList<Double>, ConstraintType, Double)

Adds a linear constraint to the optimization model.
C#
public LinearConstraint AddLinearConstraint(
	string? name,
	IList<DecisionVariable> variables,
	IList<double> coefficients,
	ConstraintType constraintType,
	double rightHandSide
)

Parameters

name  String
The name of the constraint.
variables  IList<DecisionVariable>
A list of the variables that appear in the constraint.
coefficients  IList<Double>
A list of corresponding coefficients.
constraintType  ConstraintType
A ConstraintType value that speicifies the type of constraint.
rightHandSide  Double
The right-hand side of the constraint.

Return Value

LinearConstraint
The new LinearConstraint.

Exceptions

ArgumentException

The optimization model already contains a constraint named name.

ArgumentNullException

coefficients is null.

See Also