# 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
• problem: structure that represents the Relay (M, q…)
• z: a n-vector of doubles which contains the initial solution and returns the solution of the problem.
• w: a n-vector of doubles which returns the solution of the problem.
• 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
• problem: structure that represents the Relay (M, q…)
• z: a n-vector of doubles which contains the initial solution and returns the solution of the problem.
• w: a n-vector of doubles which returns the solution of the problem.
• 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
• z: a n-vector of doubles which returns the projection
• ub: a n-vector of doubles which contains the upper bounds
• lb: a n-vector of doubles which contains the lower bounds
• 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
• problem: structure that represents the Relay (M, q, …)
• z: vector which on call is the initial point and on exit is the solution of the problem.
• w: vector for computations
• options: struct used to define the solver(s) and its (their) parameters
• info: an integer which returns the termination value: 0 = convergence, 1 = no convergence,

int relay_avi_caoferris_setDefaultSolverOptions(SolverOptions *options)

set the default solver parameters and perform memory allocation for AVI_CAOFERRIS

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

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: structure that represents the Relay (M, q, …)
• z: vector which on call is the initial point and on exit is the solution of the problem.
• w: vector for computations
• options: struct used to define the solver(s) and its (their) parameters
• info: an integer which returns the termination value: 0 = convergence, 1 = no convergence,

int relay_avi_caoferris_test_setDefaultSolverOptions(SolverOptions *options)

set the default solver parameters and perform memory allocation for AVI_CAOFERRIS

Parameters
• 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.

Return
status: 0 : convergence, 1: error > tolerance
Parameters
• problem: structure that represents the Relay (M, q…)
• z: a n-vector of doubles which contains the initial solution and returns the solution of the problem.
• w: a n-vector of doubles which returns the solution of the problem.
• tolerance: threshold used to validate the solution: if the error is less than this value, the solution is accepted
• 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
• problem: structure that represents the Relay (M, q…)
• z: a n-vector of doubles which contains the initial solution and returns the solution of the problem.
• 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
• info: an integer which returns the termination value: 0 = convergence, 1 = no convergence, 2 = Null diagonal term

int relay_enum_setDefaultSolverOptions(RelayProblem *problem, SolverOptions *options)

set the default solver parameters and perform memory allocation for ENUM

Parameters
• problem: structure that represents the Relay (M, q…)
• options: SolverOptions * the pointer to options to set

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

relay_lexicolemke is a Lemke solver for relay problems.

Parameters
• problem: structure that represents the Relay (M, q…)
• z: a n-vector of doubles which contains the initial solution and returns the solution of the problem.
• 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
• info: an integer which returns the termination value: 0 = convergence, 1 = no convergence,

int relay_lexicolemke_setDefaultSolverOptions(SolverOptions *options)

set the default solver parameters and perform memory allocation for Lemke

Parameters
• options: the pointer to options to set

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: structure that represents the Relay (M, q…)
• z: a n-vector of doubles which contains the initial solution and returns the solution of the problem.
• 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
• info: an integer which returns the termination value: 0 = convergence, 1 = no convergence, 2 = Nul diagonal term

int relay_path_setDefaultSolverOptions(SolverOptions *options)

set the default solver parameters and perform memory allocation for PATH

Parameters
• options: the pointer to options to set

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: structure that represents the Relay (M, q…)
• z: a n-vector of doubles which contains the initial solution and returns the solution of the problem.
• w: a n-vector of doubles which returns the solution of the problem.
• options: the pointer to options to set
• info: an integer which returns the termination value: 0 = convergence, 1 = no convergence, 2 = Null diagonal term

int relay_pgs_setDefaultSolverOptions(SolverOptions *options)

set the default solver parameters and perform memory allocation for PGS

Parameters
• options: SolverOptions * the pointer to options to set

int relay_setDefaultSolverOptions(RelayProblem *problem, SolverOptions *options, int solverId)

set the default solver parameters and perform memory allocation for Relay

Parameters
• problem: the RelayProblem structure which handles the problem (M,q)
• options: the pointer to options to set
• solverId: the identifier of the solver

void relay_to_lcp(RelayProblem *problem, LinearComplementarityProblem *lcp_problem)

This function transform a RelayProblem into a LinearComplementarityProblem.

Parameters
• problem: A pointer to a Relay_problem to transform
• lcp_problem: A pointer to a LinearComplementarity_problem resulting from the reformulation