Minotaur 0.4.1
Docs for developers
|
#include <Jacobian.h>
Public Member Functions | |
Jacobian () | |
Default constructor. | |
Jacobian (const std::vector< ConstraintPtr > &cons, const UInt n) | |
Constructor using constraints. | |
virtual | ~Jacobian () |
Destroy. | |
virtual UInt | getNumNz () |
Return the number of nonzeros in the Jacobian. More... | |
virtual void | fillRowColIndices (UInt *iRow, UInt *jCol) |
virtual void | fillRowColValues (const double *x, double *values, int *error) |
virtual void | fillColRowIndices (UInt *, UInt *) |
Fill indices, column wise. More... | |
virtual void | fillColRowValues (const double *, double *, int *) |
Fill values, column wise. More... | |
void | write (std::ostream &out) const |
This class is used for the Jacobian of a Problem. When a problem has constraints of the form:
The Jacobian at a point is a matrix whose
th row is the gradient,
.
This class also provides the sparsity pattern of the non-zeros in the Jacobian. By default, we save the Jacobian constraint-wise and then variable-wise. Thus, if we a have the constraints:
x_0^2 + x1^3 \leq 3 x_0 + x_2 + x_3 \leq 4 x_1 + x_3 \leq 4 x_3^3 \leq 8
We will save the indices of nonzeros in a 2-d matrix, rows corresponding to constraints and columns corresponding to variables. The matrix will have entries: 0 1 0 2 3 1 3 3
The above scheme makes it easy to fill nonzeros in Constraint-Ordered manner, but more expensive to fill in Variable-Ordered manner. So we also use another 2-d matrix as above, but the matrix now looks like: 0 0 1 1 1 2 2 3
Fill indices, column wise.
Reimplemented in MINOTAUR_AMPL::AMPLJacobian.
|
inlinevirtual |
Fill values, column wise.
Reimplemented in MINOTAUR_AMPL::AMPLJacobian.
Given arrays iRow and jCol, fill in the row and column index of each non-zero in the jacobian. e.g.
then, iRow = [1 0 0 0 1], jCol = [0 1 3 4 5]. These indices are arranged first in the order of increasing jCol and then increasing iRow.
Reimplemented in MINOTAUR_AMPL::AMPLJacobian.
|
virtual |
Given arrays iRow and jCol as above, fill in the row and column index of each non-zero in the jacobian. For the above example, when , then values = [3 -1 1 1 1].
Reimplemented in MINOTAUR_AMPL::AMPLJacobian.
|
virtual |
Return the number of nonzeros in the Jacobian.
Reimplemented in MINOTAUR_AMPL::AMPLJacobian.