Minotaur 0.4.1
Docs for developers
Public Member Functions | List of all members
Minotaur::Jacobian Class Reference

#include <Jacobian.h>

Inheritance diagram for Minotaur::Jacobian:
Inheritance graph
[legend]

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
 

Detailed Description

This class is used for the Jacobian of a Problem. When a problem has constraints of the form:

\[ g_i(x) \leq 0 \]

The Jacobian at a point $x^*$ is a matrix whose $i-$th row is the gradient, $\nabla f_i(x^*)$.

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

Member Function Documentation

◆ fillColRowIndices()

virtual void Minotaur::Jacobian::fillColRowIndices ( UInt ,
UInt  
)
inlinevirtual

Fill indices, column wise.

Reimplemented in MINOTAUR_AMPL::AMPLJacobian.

◆ fillColRowValues()

virtual void Minotaur::Jacobian::fillColRowValues ( const double *  ,
double *  ,
int *   
)
inlinevirtual

Fill values, column wise.

Reimplemented in MINOTAUR_AMPL::AMPLJacobian.

◆ fillRowColIndices()

void Jacobian::fillRowColIndices ( UInt iRow,
UInt jCol 
)
virtual

Given arrays iRow and jCol, fill in the row and column index of each non-zero in the jacobian. e.g.

\begin{eqnarray*} 
x_1x_3 + x_1^2x_4 &=& 2 \\ x_0 + x_5 &=& 0
\end{eqnarray*}

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.

◆ fillRowColValues()

void Jacobian::fillRowColValues ( const double *  x,
double *  values,
int *  error 
)
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 $x =
(-1, 1, 1, 1, 0)$, then values = [3 -1 1 1 1].

Reimplemented in MINOTAUR_AMPL::AMPLJacobian.

◆ getNumNz()

UInt Jacobian::getNumNz ( )
virtual

Return the number of nonzeros in the Jacobian.

Reimplemented in MINOTAUR_AMPL::AMPLJacobian.


The documentation for this class was generated from the following files:

Minotaur source code documented by Doxygen 1.9.4 on Thu Apr 24 2025