# File numerics/src/Relay/Relay_Solvers.h¶

Go to the source code of this file

Subroutines for the resolution of relay problems.

Functions

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
• [in] problem: structure that represents the Relay (M, q…)

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

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

• [out] info: 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
• [in] problem: structure that represents the Relay (M, q…)

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

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

• [out] info: 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

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
• [inout] z: a n-vector of doubles which returns the projection

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

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

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

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
• [in] problem: structure that represents the Relay (M, q, …)

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

• [inout] w: vector for computations

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

• [out] info: 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
• [in] problem: structure that represents the Relay (M, q, …)

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

• [inout] w: vector for computations

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

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

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.

Return

status: 0 : convergence, 1: error > tolerance

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

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

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

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

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

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

relay_enum is enum solver for relay problems.

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

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

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

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

• [out] info: 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
• [in] problem: structure that represents the Relay (M, q…)

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

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

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

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

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
• [in] problem: structure that represents the Relay (M, q…)

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

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

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

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

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
• [in] problem: structure that represents the Relay (M, q…)

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

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

• options: the pointer to options to set

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

void relay_to_lcp(RelayProblem *problem, LinearComplementarityProblem *lcp_problem)

This function transform a RelayProblem into a LinearComplementarityProblem.

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

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