File numerics/src/Relay/Relay_Solvers.h#

Go to the source code of this file

Subroutines for the resolution of relay problems.

Functions

void relay_pgs(RelayProblem *problem, double *z, double *w, int *info, SolverOptions *options)#

relay_pgs is a projected Gauss-Seidel solver for relay problems.

Parameters:
  • problem[in] structure that represents the Relay (M, q…)

  • z[inout] a n-vector of doubles which contains the initial solution and returns the solution of the problem.

  • w[inout] a n-vector of doubles which returns the solution of the problem.

  • options – the pointer to options to set

  • info[out] an integer which returns the termination value: 0 = convergence, 1 = no convergence, 2 = Null diagonal term

void relay_lexicolemke(RelayProblem *problem, double *z, double *w, int *info, SolverOptions *options)#

relay_lexicolemke is a Lemke solver for relay problems.

Parameters:
  • problem[in] structure that represents the Relay (M, q…)

  • z[inout] a n-vector of doubles which contains the initial solution and returns the solution of the problem.

  • w[inout] a n-vector of doubles which returns the solution of the problem.

  • options – struct used to define the solver(s) and its (their) parameters

  • info[out] an integer which returns the termination value: 0 = convergence, 1 = no convergence,

void relay_enum(RelayProblem *problem, double *z, double *w, int *info, SolverOptions *options)#

relay_enum is enum solver for relay problems.

Parameters:
  • problem[in] structure that represents the Relay (M, q…)

  • z[inout] a n-vector of doubles which contains the initial solution and returns the solution of the problem.

  • w[inout] a n-vector of doubles which returns the solution of the problem.

  • options – struct used to define the solver(s) and its (their) parameters

  • info[out] an integer which returns the termination value: 0 = convergence, 1 = no convergence, 2 = Null diagonal term

void relay_path(RelayProblem *problem, double *z, double *w, int *info, SolverOptions *options)#

relay_path is a resolution of the Relay with its inherent MCP formulation and using path.

Parameters:
  • problem[in] structure that represents the Relay (M, q…)

  • z[inout] a n-vector of doubles which contains the initial solution and returns the solution of the problem.

  • w[inout] a n-vector of doubles which returns the solution of the problem.

  • options – struct used to define the solver(s) and its (their) parameters

  • info[out] an integer which returns the termination value: 0 = convergence, 1 = no convergence, 2 = Nul diagonal term

void relay_avi_caoferris (RelayProblem *problem, double *restrict z, double *restrict w, int *info, SolverOptions *options)

Solve a Relay problem using the AVI framework and the solver by Cao and Ferris.

Parameters:
  • problem[in] structure that represents the Relay (M, q, …)

  • z[inout] vector which on call is the initial point and on exit is the solution of the problem.

  • w[inout] vector for computations

  • options – struct used to define the solver(s) and its (their) parameters

  • info[out] an integer which returns the termination value: 0 = convergence, 1 = no convergence,

void relay_avi_caoferris_test (RelayProblem *problem, double *restrict z, double *restrict w, int *info, SolverOptions *options)

Solve a Relay problem using the AVI framework and the solver by Cao and Ferris.

Warning

This is only a test version. It does not take into account the specificities of the problem like relay_avi_caoferris() does. Please do not use this solver unless you have a pretty good reason.

Parameters:
  • problem[in] structure that represents the Relay (M, q, …)

  • z[inout] vector which on call is the initial point and on exit is the solution of the problem.

  • w[inout] vector for computations

  • options – struct used to define the solver(s) and its (their) parameters

  • info[out] an integer which returns the termination value: 0 = convergence, 1 = no convergence,

void dr_latin(RelayProblem *problem, double *z, double *w, int *info, SolverOptions *options)#

dr_latin is a specific latin (LArge Time INcrement)solver for dual relay problems.

Parameters:
  • problem[in] structure that represents the Relay (M, q…)

  • z[inout] a n-vector of doubles which contains the initial solution and returns the solution of the problem.

  • w[inout] a n-vector of doubles which returns the solution of the problem.

  • info[out] an integer which returns the termination value: 0 = convergence, 1 = no convergence, 2 = Cholesky factorization failed, 3 = Nul diagonal term

  • options – struct used to define the solver(s) and its (their) parameters

void dr_nlgs(RelayProblem *problem, double *z, double *w, int *info, SolverOptions *options)#

dr_nlgs is a specific nlgs (Non Linear Gauss Seidel) solver for dual relay problems.

Parameters:
  • problem[in] structure that represents the Relay (M, q…)

  • z[inout] a n-vector of doubles which contains the initial solution and returns the solution of the problem.

  • w[inout] a n-vector of doubles which returns the solution of the problem.

  • info[out] an integer which returns the termination value: 0 = convergence, 1 = no convergence, 2 = Nul diagonal term

  • options – struct used to define the solver(s) and its (their) parameters

int relay_compute_error (RelayProblem *problem, double *restrict z, double *restrict w, double tolerance, double *restrict error)

This function computes the input vector \( w = Mz + q \) and checks the validity of the vector z as a solution of the LCP : \( -(Mz + q) \in N_{[lb,ub]}(z) \) The criterion is based on \( error = \|z- proj_{[lb,ub]}(z - \rho * (M*z+q)) \|, \rho >0\) This error is divided by \( \|q\| \) and then compared to tol.

Parameters:
  • problem[in] structure that represents the Relay (M, q…)

  • z[inout] a n-vector of doubles which contains the initial solution and returns the solution of the problem.

  • w[inout] a n-vector of doubles which returns the solution of the problem.

  • tolerance[in] threshold used to validate the solution: if the error is less than this value, the solution is accepted

  • error[inout] the actual error of the solution with respect to the problem

Returns:

status: 0 : convergence, 1: error > tolerance

void project_on_box (int n, double *restrict z, double *restrict lb, double *restrict ub)

This function computes the projection on the boxr \( [lb,ub]\) of the vector \(z\).

Parameters:
  • z[inout] a n-vector of doubles which returns the projection

  • ub[inout] a n-vector of doubles which contains the upper bounds

  • lb[inout] a n-vector of doubles which contains the lower bounds

  • n[inout] size of the a n-vector

void relay_to_lcp(RelayProblem *problem, LinearComplementarityProblem *lcp_problem)#

This function transform a RelayProblem into a LinearComplementarityProblem.

Parameters:
  • problem[in] A pointer to a Relay_problem to transform

  • lcp_problem[out] A pointer to a LinearComplementarity_problem resulting from the reformulation