Optimization Model Constructor
Definition
Assembly: Numerics.NET (in Numerics.NET.dll) Version: 9.0.3
Overload List
Optimization | Constructs a new OptimizationModel object. |
Optimization | Constructs an optimization model with linear constraints in standard form. |
Optimization | Constructs an optimization model with linear constraints in standard form. |
Optimization | Constructs an optimization model with linear constraints in standard form. |
OptimizationModel(Func<String, DecisionVariable>)
protected OptimizationModel(
Func<string, DecisionVariable> variableConstructor
)
Parameters
- variableConstructor Func<String, DecisionVariable>
OptimizationModel(Func<String, DecisionVariable>, Matrix<Double>, Vector<Double>)
protected OptimizationModel(
Func<string, DecisionVariable> variableConstructor,
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 | constraints is null. -or- rightHandSides is null. |
Dimension | The length of rightHandSides does not equal the number of rows of constraints. |
OptimizationModel(Func<String, DecisionVariable>, Matrix<Double>, Vector<Double>, Int32)
protected OptimizationModel(
Func<string, DecisionVariable> variableConstructor,
Matrix<double> constraints,
Vector<double> rightHandSides,
int equalities
)
Parameters
- variableConstructor Func<String, DecisionVariable>
- A function that creates a decision variable from a specified name.
- 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 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 | 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. |
OptimizationModel(Func<String, DecisionVariable>, Matrix<Double>, Vector<Double>, Vector<Double>, Vector<Double>, Vector<Double>)
protected OptimizationModel(
Func<string, DecisionVariable> variableConstructor,
Matrix<double> constraints,
Vector<double> constraintLowerBounds,
Vector<double> constraintUpperBounds,
Vector<double> variableLowerBounds,
Vector<double> variableUpperBounds
)
Parameters
- variableConstructor Func<String, DecisionVariable>
- A function that creates a decision variable from a specified name.
- 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 | constraints is null. -or- constraintUpperBounds is null. |
Dimension | The length of constraintUpperBounds does not equal the number of rows 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. |