Linear Program Constructor
Definition
Assembly: Numerics.NET (in Numerics.NET.dll) Version: 9.0.4
Overload List
Linear | Constructs a new LinearProgram object. |
Linear | Constructs a new linear program in standard form. |
Linear | Constructs a new linear program in standard form. |
Linear | Constructs a new linear program. |
LinearProgram
public LinearProgram()
LinearProgram(Vector<Double>, Matrix<Double>, Vector<Double>)
public LinearProgram(
Vector<double> objective,
Matrix<double> constraints,
Vector<double> rightHandSides
)
Parameters
Remarks
Use this constructor to create a linear 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 linear 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
Argument | objective is null. -or- constraints is null. -or- rightHandSides is null. |
Dimension | 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. |
LinearProgram(Vector<Double>, Matrix<Double>, Vector<Double>, Int32)
public LinearProgram(
Vector<double> objective,
Matrix<double> constraints,
Vector<double> rightHandSides,
int equalities
)
Parameters
Remarks
Use this constructor to create a linear 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
Argument | objective is null. -or- constraints is null. -or- rightHandSides is null. |
Argument | equalities is less than zero or greater than the number of constraints. |
Dimension | 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. |
LinearProgram(Vector<Double>, Matrix<Double>, Vector<Double>, Vector<Double>, Vector<Double>, Vector<Double>)
public LinearProgram(
Vector<double> objective,
Matrix<double> constraints,
Vector<double> constraintLowerBounds,
Vector<double> constraintUpperBounds,
Vector<double> variableLowerBounds,
Vector<double> variableUpperBounds
)
Parameters
- objective Vector<Double>
- The vector of coefficients 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 linear 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
Argument | objective is null. -or- constraints is null. -or- constraintUpperBounds is null. |
Dimension | The length of constraintUpperBounds does not equal the number of rows of constraints. -or- The length of objective does not equal the number of columns of constraints. -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. |