Class PATH

Nested Relationships

Nested Types

Class Documentation

class PATH

This class manages the external solver PATH, for mixed-complementarity problems.

Public Functions

PATH() = delete
PATH(const arma::sp_mat &M, const arma::vec &q, const perps &Compl, const VariableBounds &Bounds, arma::vec &z, arma::vec &x, double timeLimit, bool verbose)

Main public method to use the solver.

Parameters
  • M – The matrix M in the LCP

  • q – The vector q in the LCP

  • Compl – Pairs of complementarities <Eqn, Var>

  • Bounds – Bounds on variables

  • z – Output vector of x

  • x – Output vector of z equation values

  • timeLimit – A double timelimit

  • verbose – True if verbosity is required

inline ZEROStatus getStatus() const

Read-only getter for the status.

Public Static Functions

static void *messageCB(void *dat, int mode, char *buf)

Message callback for path.

Parameters
  • dat – The data passed by the PATH callback. Usually, it is an instance of the class

  • mode – Print-mode. Currently unused, see PATH documentation for more

  • buf – The char buffer

Returns

Not used. An instance of this

static void *mcp_typ(void *dat, int nnz, int *typ)

Presolving type for the variable. See PATH documentation for more.

Parameters
  • dat – The data passed by the PATH callback. Usually, it is an instance of the class

  • nnz – Number of non-zeros in M

  • typ – The output vector for presolve

Returns

Not used. An instance of this

static int jacobian_evaluation(void *dat, int n, double *x, int wantf, double *f, int *nnz, int *col_start, int *col_len, int *row, double *data)

Static wrapper for PATH::c_jacobian_evaluation. See PATH documentation for more.

Parameters
  • dat – The data passed by the PATH callback. Usually, it is an instance of the class

  • n – Number of variables

  • x – Vector of variables for the lcp. Here we call them

  • wantf – True (positive) if the function value is needed

  • f – The output object for the function value

  • nnz – Number of non-zeros

  • col_start – Column start vector

  • col_len – Column length vector

  • row – Row vector

  • data – M_Data vector

Returns

Unused. This is a callback function

static int function_evaluation(void *dat, int n, double *x, double *f)

Static wrapper for PATH::c_function_evaluation. See PATH documentation for more.

Parameters
  • dat – The data passed by the PATH callback. Usually, it is an instance of the class

  • n – Number of variables

  • x – Vector of variables for the lcp. Here we call them

  • f – The output object for the function value

Returns

Unused. This is a callback function

static void start(void *dat)

Starting function for PATH. This is called whenever the solver is initialized.

Parameters

dat – The data passed by the PATH callback. Usually, it is an instance of the class

static void bounds(void *dat, int n, double *x, double *lb, double *ub)

Static wrapper for PATH::c_bounds. See PATH documentation for more.

Parameters
  • dat – The data passed by the PATH callback. Usually, it is an instance of the class

  • n – Number of variables

  • x – Pointer to variables

  • lb – Lower bounds on variables

  • ub – Upper bounds on variables

static void problem_size(void *dat, int *n, int *nnz)

Static wrapper for PATH::c_problem_size. See PATH documentation for more.

Parameters
  • dat – The data passed by the PATH callback. Usually, it is an instance of the class

  • n – Number of variables

  • nnz – Number of non-zeros in M

Private Functions

int CreateLMCP(int n, int m_nnz, int m_i[], int m_j[], double m_ij[], double q[], double lb[], double ub[], double x[], double z[], int verbose, double timeLimit)

Internal method to create the linear mixed-complemetarity problem.

Parameters
  • n – Number of x variables

  • m_nnz – Number of non-zeros in M

  • m_i – Row indexes for M non-zeros. Fortran style: start is 1 (not 0)

  • m_j – Column indexes for M non-zeros. Fortran style: start is 1 (not 0)

  • m_ij – The data in M corresponding to row m_i and column m_j

  • q – The q vector

  • lb – Vector of lower bounds on x

  • ub – Vector of upper bounds on x

  • x – Output vector of x variables

  • z – Output vector of z equation values

  • verbose – True if PATH will be verbose

  • timeLimit – A double timelimit

Returns

The PATH MCP_Termination code

void sort(int rows, int cols, int elements, int *row, int *col, double *data)

This function is from PATH. Sorts the data in M.

Parameters
  • rows – Row count

  • cols – Column counts

  • elements – Element counts

  • row – Row data pointer

  • col – Column data pointer

  • data – M-data pointer

void C_problem_size(int *n, int *nnz)

Fills the problem size. See PATH documentation for more.

Parameters
  • n – Number of variables

  • nnz – Number of non-zeros in M

void C_bounds(int n, double *z, double *lb, double *ub)

Assigns bounds to variables. See PATH documentation for more.

Parameters
  • n – Number of variables

  • x – Pointer to variables

  • lb – Lower bounds on variables

  • ub – Upper bounds on variables

int C_function_evaluation(int n, double *x, double *f)

Static wrapper for PATH::c_function_evaluation. See PATH documentation for more.

Parameters
  • n – Number of variables

  • x – Vector of variables for the lcp. Here we call them

  • f – The output object for the function value

Returns

Unused. This is a callback function

int C_jacobian_evaluation(int n, double *x, int wantf, double *f, int *nnz, int *col_start, int *col_len, int *row, double *data)

Evaluates the jacobian at a given point. Eventually, returns the value of the complementarity. See PATH documentation for more.

Parameters
  • n – Number of variables

  • x – Vector of variables for the lcp. Here we call them

  • wantf – True (positive) if the function value is needed

  • f – The output object for the function value

  • nnz – Number of non-zeros

  • col_start – Column start vector

  • col_len – Column length vector

  • row – Row vector

  • data – M_Data vector

Returns

Unused. This is a callback function

Private Members

ZEROStatus status = ZEROStatus::Numerical

Status for the solver’ instance.

bool Filled

Boolean controlling instance’s filling.

PATHProblem Problem
MCP_Interface PATH_Interface = {this, reinterpret_cast<void (*)(void*, int*, int*)>(this->problem_size), reinterpret_cast<void (*)(void*, int, double*, double*, double*)>(this->bounds), reinterpret_cast<int (*)(void*, int, double*, double*)>(&this->function_evaluation), reinterpret_cast<int (*)(void*, int, double*, int, double*, int*, int*, int*, int*, double*)>(&this->jacobian_evaluation), static_cast<void (*)(void*)>(this->start), NULL, NULL, NULL, NULL}

The MCP_Interface initializer. See PATH documentation for more.

Presolve_Interface PATH_Presolve = {NULL, NULL, NULL, NULL, NULL, reinterpret_cast<void (*)(void*, int, int*)>(this->mcp_typ), NULL}

The Presolve_Interface initializer. See PATH documentation for more.

Output_Interface PATH_Output = {NULL, reinterpret_cast<void (*)(void*, int, char*)>(this->messageCB), NULL}

The Output_Interface initializer. See PATH documentation for more.

struct PATHProblem

This struct manages an LCP where each complementarity is given by \(x \perp z=(Mx+q)\).

Public Members

int n

Number of x variables, namely complementarities.

int nnz

Number of non-zeros in M.

double *x

Pointer to x values.

double *lb

n-dimensional array of lower bounds

double *ub

n-dimensional array of upper bounds

int *m_start

Fortran like start of M.

int *m_len

Fortran like length of M.

int *m_row

Fortran like row of M.

double *m_data

Fortran like data of M.

double *q

q vector