# LCP_Solvers (functions)¶

siconos.numerics.lcp_ConvexQP_ProjectedGradient(LinearComplementarityProblem *problem, array_like (np.float64, 1D)reaction, array_like (np.float64, 1D)velocity, int *info, SolverOptions *options) → None[source]

siconos.numerics.lcp_avi_caoferris(LinearComplementarityProblem *problem, array_like (np.float64, 1D)z, array_like (np.float64, 1D)w, int *info, SolverOptions *options) → None[source]

lcp_avi_caoferris is a direct solver for LCP based on an Affine Variational Inequalities (AVI) reformulation The AVI solver is here the one from Cao and Ferris Ref: “A Pivotal Method for Affine Variational Inequalities” Menglin Cao et Michael Ferris (1996)

Parameters: problem – structure that represents the LCP (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 : iter = itermax options – structure used to define the solver and its parameters.

siconos.numerics.lcp_compute_error(LinearComplementarityProblem *problem, array_like (np.float64, 1D)z, array_like (np.float64, 1D)w, double tolerance, array_like (np.float64, 1D)error) → int[source]

This function computes the input vector $$w = Mz + q$$ and checks the validity of the vector z as a solution of the LCP : $$0 \le z \perp Mz + q \ge 0$$ The criterion is based on $$\sum [ (z[i]*(Mz+q)[i])_{pos} + (z[i])_{neg} + (Mz+q)[i])_{neg} ]$$ with $$x_{pos} = max(0,x)$$ and $$xneg = max(0,-x)$$.

This sum is divided by $$\|q\|$$ and then compared to tol.

Parameters: problem – structure that represents the LCP (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 status (0 : convergence, 1: error > tolerance)

siconos.numerics.lcp_cpg(LinearComplementarityProblem *problem, array_like (np.float64, 1D)z, array_like (np.float64, 1D)w, int *info, SolverOptions *options) → None[source]

lcp_cpg is a CPG (Conjugated Projected Gradient) solver for LCP based on quadratic minimization.

Parameters: problem – structure that represents the LCP (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: iter = itermax 2: negative diagonal term 3: pWp nul options – structure used to define the solver and its parameters.

siconos.numerics.lcp_driver_DenseMatrix(LinearComplementarityProblem *problem, array_like (np.float64, 1D)z, array_like (np.float64, 1D)w, SolverOptions *options) → int[source]

Interface to solvers for Linear Complementarity Problems, dedicated to dense matrix storage.

Parameters: problem – the LinearComplementarityProblem structure which handles the problem (M,q) z – a n-vector of doubles which contains the solution of the problem. w – a n-vector of doubles which contains the solution of the problem. options – structure used to define the solver(s) and their parameters info termination value * 0 (successful) * >0 (otherwise see each solver for more information about the log info)

siconos.numerics.lcp_enum(LinearComplementarityProblem *problem, array_like (np.float64, 1D)z, array_like (np.float64, 1D)w, int *info, SolverOptions *options) → None[source]

enumerative solver

Parameters: problem – structure that represents the LCP (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 : success 1 : failed options – structure used to define the solver and its parameters.

siconos.numerics.lcp_enum_init(LinearComplementarityProblem *problem, SolverOptions *options, int withMemAlloc) → None[source]
Parameters: problem – structure that represents the LCP (M, q…) options – structure used to define the solver and its parameters. withMemAlloc – If it is not 0, then the necessary work memory is allocated.

siconos.numerics.lcp_enum_reset(LinearComplementarityProblem *problem, SolverOptions *options, int withMemAlloc) → None[source]
Parameters: problem – structure that represents the LCP (M, q…) options – structure used to define the solver and its parameters. withMemAlloc – If it is not 0, then the work memory is free.

siconos.numerics.lcp_gams(LinearComplementarityProblem *problem, array_like (np.float64, 1D)z, array_like (np.float64, 1D)w, int *info, SolverOptions *options) → None[source]

lcp_gams uses the solver provided by GAMS

Parameters: problem – structure that represents the LCP (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 : iter = itermax options – structure used to define the solver and its parameters.

siconos.numerics.lcp_latin(LinearComplementarityProblem *problem, array_like (np.float64, 1D)z, array_like (np.float64, 1D)w, int *info, SolverOptions *options) → None[source]

lcp_latin (LArge Time INcrements) is a basic latin solver for LCP.

Parameters: problem – structure that represents the LCP (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 : iter = itermax 2 : Cholesky Factorization failed 3 : nul diagonal term options – structure used to define the solver and its parameters.

siconos.numerics.lcp_latin_w(LinearComplementarityProblem *problem, array_like (np.float64, 1D)z, array_like (np.float64, 1D)w, int *info, SolverOptions *options) → None[source]

lcp_latin_w (LArge Time INcrements) is a basic latin solver with relaxation for LCP.

Parameters: problem – structure that represents the LCP (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 : iter = itermax 2 : Cholesky Factorization failed 3 : nul diagonal term options – structure used to define the solver and its parameters.

siconos.numerics.lcp_lexicolemke(LinearComplementarityProblem *problem, array_like (np.float64, 1D)z, array_like (np.float64, 1D)w, int *info, SolverOptions *options) → None[source]

lcp_lexicolemke is a direct solver for LCP based on pivoting method principle for degenerate problem Choice of pivot variable is performed via lexicographic ordering Ref: “The Linear Complementarity Problem” Cottle, Pang, Stone (1992)

Parameters: problem – structure that represents the LCP (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 : iter = itermax 2 : negative diagonal term options – structure used to define the solver and its parameters.

siconos.numerics.lcp_newton_FB(LinearComplementarityProblem *problem, array_like (np.float64, 1D)z, array_like (np.float64, 1D)w, int *info, SolverOptions *options) → None[source]

lcp_newton_FB use a nonsmooth newton method based on the Fischer-Bursmeister convex function

$$0 \le z \perp w \ge 0 \Longrightarrow \phi(z,w)=\sqrt{z^2+w^2}-(z+w)=0$$

$$\Phi(z) = \left[ \begin{array}{c} \phi(z_1,w_1) \\ \phi(z_1,w_1) \\ \vdots \\ \phi(z_n,w_n) \end{array}\right] =0\\$$

References: Alart & Curnier 1990, Pang 1990

Parameters: problem – structure that represents the LCP (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 - iter = itermax 2 - failure in the descent direction search (in LAPACK) options – structure used to define the solver and its parameters.

siconos.numerics.lcp_newton_min(LinearComplementarityProblem *problem, array_like (np.float64, 1D)z, array_like (np.float64, 1D)w, int *info, SolverOptions *options) → None[source]

lcp_newton_min uses a nonsmooth Newton method based on the min formulation (or max formulation) of the LCP $$0 \le z \perp w \ge 0 \Longrightarrow \min(w,\rho z)=0 \Longrightarrow w = \max(0,w - \rho z)$$

$$H(z) = H(\left[ \begin{array}{c} z \\ w \end{array}\right])= \left[ \begin{array}{c} w-Mz-q \\ min(w,\rho z) \end{array}\right] =0\\$$

References: Alart & Curnier 1990, Pang 1990

Parameters: problem – structure that represents the LCP (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 : iter = itermax 2 : Problem in resolution in DGESV 0 : convergence / minimization sucessfull 1 : Too Many iterations 2 : Accuracy insuficient to satisfy convergence criterion 5 : Length of working array insufficient Other : The constraints are inconstent options – structure used to define the solver and its parameters.

siconos.numerics.lcp_newton_minFB(LinearComplementarityProblem *problem, array_like (np.float64, 1D)z, array_like (np.float64, 1D)w, int *info, SolverOptions *options) → None[source]

lcp_newton_minFB use a nonsmooth newton method based on both a min and Fischer- Bursmeister reformulation References: Facchinei–Pang (2003)

Parameters: problem – structure that represents the LCP (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 - iter = itermax 2 - failure in the descent direction search (in LAPACK) options – structure used to define the solver and its parameters.

siconos.numerics.lcp_nsgs_SBM(LinearComplementarityProblem *problem, array_like (np.float64, 1D)z, array_like (np.float64, 1D)w, int *info, SolverOptions *options) → None[source]

generic interface used to call any LCP solver applied on a Sparse-Block structured matrix M, with a Gauss-Seidel process to solve the global problem (formulation/solving of local problems for each row of blocks)

Parameters: problem – structure that represents the LCP (M, q…). M must be a SparseBlockStructuredMatrix 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 >0 : failed, depends on local solver options – structure used to define the solver and its parameters.

siconos.numerics.lcp_nsgs_SBM_buildLocalProblem(int rowNumber, SparseBlockStructuredMatrix * blmat, LinearComplementarityProblem *local_problem, array_like (np.float64, 1D)q, array_like (np.float64, 1D)z) → None[source]

Construct local problem from a “global” one.

Parameters: rowNumber – index of the local problem blmat – matrix containing the problem local_problem – problem to fill q – big q z – big z

siconos.numerics.lcp_nsqp(LinearComplementarityProblem *problem, array_like (np.float64, 1D)z, array_like (np.float64, 1D)w, int *info, SolverOptions *options) → None[source]

lcp_nsqp use a quadratic programm formulation for solving an non symmetric LCP

Parameters: problem – structure that represents the LCP (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 / minimization sucessfull 1 : Too Many iterations 2 : Accuracy insuficient to satisfy convergence criterion 5 : Length of working array insufficient Other : The constraints are inconstent options – structure used to define the solver and its parameters.

siconos.numerics.lcp_path(LinearComplementarityProblem *problem, array_like (np.float64, 1D)z, array_like (np.float64, 1D)w, int *info, SolverOptions *options) → None[source]
Parameters: problem – structure that represents the LCP (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 : iter = itermax 2 : negative diagonal term options – structure used to define the solver and its parameters.

siconos.numerics.lcp_pathsearch(LinearComplementarityProblem *problem, array_like (np.float64, 1D)z, array_like (np.float64, 1D)w, int *info, SolverOptions *options) → None[source]

lcp_pathsearch is a direct solver for LCP based on the pathsearch algorithm

Warning: this solver is available for testing purposes only! consider using
lcp_pivot() if you are looking for simular solvers
Parameters: problem – structure that represents the LCP (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 : iter = itermax options – structure used to define the solver and its parameters.

siconos.numerics.lcp_pgs(LinearComplementarityProblem *problem, array_like (np.float64, 1D)z, array_like (np.float64, 1D)w, int *info, SolverOptions *options) → None[source]

lcp_pgs (Projected Gauss-Seidel) is a basic Projected Gauss-Seidel solver for LCP.

Parameters: problem – structure that represents the LCP (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 : iter = itermax 2 : negative diagonal term options – structure used to define the solver and its parameters.

siconos.numerics.lcp_pivot(LinearComplementarityProblem *problem, array_like (np.float64, 1D)z, array_like (np.float64, 1D)w, int *info, SolverOptions *options) → None[source]

lcp_pivot is a direct solver for LCP based on a pivoting method It can currently use Bard, Murty’s least-index or Lemke rule for choosing the pivot.

The default one is Lemke and it cam be changed by setting iparam[2]. The list of choices are in the enum LCP_PIVOT (see lcp_cst.h).

Parameters: problem – structure that represents the LCP (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 : iter = itermax options – structure used to define the solver and its parameters.

siconos.numerics.lcp_pivot_covering_vector(LinearComplementarityProblem *problem, array_like (np.float64, 1D)u, array_like (np.float64, 1D)s, int *info, SolverOptions *options, array_like (np.float64, 1D)cov_vec) → None[source]

siconos.numerics.lcp_pivot_lumod(LinearComplementarityProblem *problem, array_like (np.float64, 1D)z, array_like (np.float64, 1D)w, int *info, SolverOptions *options) → None[source]

siconos.numerics.lcp_pivot_lumod_covering_vector(LinearComplementarityProblem *problem, array_like (np.float64, 1D)u, array_like (np.float64, 1D)s, int *info, SolverOptions *options, array_like (np.float64, 1D)cov_vec) → None[source]

siconos.numerics.lcp_psor(LinearComplementarityProblem *problem, array_like (np.float64, 1D)z, array_like (np.float64, 1D)w, int *info, SolverOptions *options) → None[source]

lcp_psor Projected Succesive over relaxation solver for LCP.

See cottle, Pang Stone Chap 5

Parameters: problem – structure that represents the LCP (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 : iter = itermax 2 : negative diagonal term options – structure used to define the solver and its parameters.

siconos.numerics.lcp_qp(LinearComplementarityProblem *problem, array_like (np.float64, 1D)z, array_like (np.float64, 1D)w, int *info, SolverOptions *options) → None[source]

lcp_qp uses a quadratic programm formulation for solving a LCP

Parameters: problem – structure that represents the LCP (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 / minimization sucessfull 1 : Too Many iterations 2 : Accuracy insuficient to satisfy convergence criterion 5 : Length of working array insufficient Other : The constraints are inconstent options – structure used to define the solver and its parameters.

siconos.numerics.lcp_rpgs(LinearComplementarityProblem *problem, array_like (np.float64, 1D)z, array_like (np.float64, 1D)w, int *info, SolverOptions *options) → None[source]

lcp_rpgs (Regularized Projected Gauss-Seidel ) is a solver for LCP, able to handle matrices with null diagonal terms.

Parameters: problem – structure that represents the LCP (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 : iter = itermax 2 : negative diagonal term options – structure used to define the solver and its parameters.

siconos.numerics.linearComplementarity_ConvexQP_ProjectedGradient_setDefaultSolverOptions(SolverOptions *options) → int[source]

siconos.numerics.linearComplementarity_cpg_setDefaultSolverOptions(SolverOptions *options) → int[source]

set the default solver parameters and perform memory allocation for LinearComplementarity

Parameters: options – the pointer to the array of options to set

siconos.numerics.linearComplementarity_enum_setDefaultSolverOptions(LinearComplementarityProblem *problem, SolverOptions *options) → int[source]

set the default solver parameters and perform memory allocation for LinearComplementarity

Parameters: problem – structure that represents the LCP (M, q…) options – the pointer to the array of options to set

siconos.numerics.linearComplementarity_latin_setDefaultSolverOptions(SolverOptions *options) → int[source]

set the default solver parameters and perform memory allocation for LinearComplementarity

Parameters: options – the pointer to the array of options to set

siconos.numerics.linearComplementarity_latin_w_setDefaultSolverOptions(SolverOptions *options) → int[source]

set the default solver parameters and perform memory allocation for LinearComplementarity

Parameters: options – the pointer to the array of options to set

siconos.numerics.linearComplementarity_lexicolemke_setDefaultSolverOptions(SolverOptions *options) → int[source]

set the default solver parameters and perform memory allocation for LinearComplementarity

Parameters: options – the pointer to the array of options to set

siconos.numerics.linearComplementarity_newton_min_setDefaultSolverOptions(SolverOptions *options) → int[source]

set the default solver parameters and perform memory allocation for LinearComplementarity

Parameters: options – the pointer to the array of options to set

siconos.numerics.linearComplementarity_nsgs_SBM_setDefaultSolverOptions(SolverOptions *options) → int[source]

set the default solver parameters and perform memory allocation for LinearComplementarity

Parameters: options – the pointer to the array of options to set

siconos.numerics.linearComplementarity_nsqp_setDefaultSolverOptions(SolverOptions *options) → int[source]

set the default solver parameters and perform memory allocation for LinearComplementarity

Parameters: options – the pointer to the array of options to set

siconos.numerics.linearComplementarity_pgs_setDefaultSolverOptions(SolverOptions *options) → int[source]

set the default solver parameters and perform memory allocation for LinearComplementarity

Parameters: options – the pointer to the array of options to set

siconos.numerics.linearComplementarity_psor_setDefaultSolverOptions(SolverOptions *options) → int[source]

set the default solver parameters and perform memory allocation for LinearComplementarity

Parameters: options – the pointer to the array of options to set

siconos.numerics.linearComplementarity_qp_setDefaultSolverOptions(SolverOptions *options) → int[source]

set the default solver parameters and perform memory allocation for LinearComplementarity

Parameters: options – the pointer to the array of options to set

siconos.numerics.linearComplementarity_rpgs_setDefaultSolverOptions(SolverOptions *options) → int[source]

set the default solver parameters and perform memory allocation for LinearComplementarity

Parameters: options – the pointer to the array of options to set

siconos.numerics.linearComplementarity_setDefaultSolverOptions(LinearComplementarityProblem *problem, SolverOptions *options, int) → int[source]

set the default solver parameters and perform memory allocation for LinearComplementarity

Parameters: problem – the LinearComplementarityProblem structure which handles the problem (M,q) options – the pointer to the array of options to set info termination value