File numerics/src/tools/SolverOptions.h

Go to the source code of this file

Structure used to send options (name, parameters and so on) to a specific solver-driver (mainly from Kernel to Numerics).

Enums

enum SICONOS_DPARAM

Some values for dparam index.

Values:

SICONOS_DPARAM_TOL = 0
SICONOS_DPARAM_RESIDU = 1
enum SICONOS_IPARAM

Some value for iparam index.

Values:

SICONOS_IPARAM_MAX_ITER = 0
SICONOS_IPARAM_ITER_DONE = 1
SICONOS_IPARAM_PREALLOC = 2
enum SICONOS_NUMERICS_PROBLEM_TYPE

Values:

SICONOS_NUMERICS_PROBLEM_LCP = 0
SICONOS_NUMERICS_PROBLEM_MLCP = 1
SICONOS_NUMERICS_PROBLEM_EQUALITY = 2
SICONOS_NUMERICS_PROBLEM_FC2D = 3
SICONOS_NUMERICS_PROBLEM_FC3D = 4
SICONOS_NUMERICS_PROBLEM_NCP = 5
SICONOS_NUMERICS_PROBLEM_MCP = 6
SICONOS_NUMERICS_PROBLEM_VI = 7
SICONOS_NUMERICS_PROBLEM_AVI = 8
SICONOS_NUMERICS_PROBLEM_RELAY = 9

Functions

const char *ns_problem_id_to_name(int id)

return the name of a problem type (LCP, NCP, VI, …) based on its id

Return
the name of the problem
Parameters
  • id: the id of the problem

void solver_options_copy(SolverOptions *options_ori, SolverOptions *options)

copy SolverOptions

Parameters
  • options_ori: the structure to copy
  • options: the output structure

void solver_options_delete(SolverOptions *options)

free some SolverOptions fields;

Parameters
  • options: the structure to clean

void solver_options_fill(SolverOptions *options, int solverId, int iSize, int dSize, int iter_max, double tol)

fill a SolverOptions struct: set fields, allocate memory and set common values

Parameters
  • options: struct to fill
  • solverId: identity of the solver
  • iSize: size of the iparam field (integer parameters)
  • dSize: size of the dparam field (double parameters)
  • iter_max: maximum number of iterations before the solver stops if this does not make sense or is unwanted, give inf as value
  • tol: tolerance for the solution. if this does not make sense or is unwanted, give inf as value

void solver_options_free_solver_specific_data(SolverOptions *options)

free the solverData structure

Parameters
  • options: the structure to free

SolverOptions *solver_options_get_internal_solver(SolverOptions *options, int n)
const char *solver_options_id_to_name(int Id)

return the name of a solver given its id

Return
the name of the solver
Parameters
  • Id: the id of the solver

int solver_options_name_to_id(char *pName)

return the id of a solver based on its name

Return
the id of the solver or 0 if it failed
Parameters
  • pName: the name of the solver

void solver_options_nullify(SolverOptions *options)
void solver_options_print(SolverOptions *options)

screen display of solver parameters

Parameters
  • options: the structure to be displayed

void solver_options_set(SolverOptions *options, int solverId)

set parameters in SolverOption.

This function should be used instead of rewrittent each time a new function for setting the parameters

Parameters
  • options: the struct to set
  • solverId: the id of the solver

Variables

const char *const SICONOS_NUMERICS_PROBLEM_AVI_STR
const char *const SICONOS_NUMERICS_PROBLEM_EQUALITY_STR
const char *const SICONOS_NUMERICS_PROBLEM_FC2D_STR
const char *const SICONOS_NUMERICS_PROBLEM_FC3D_STR
const char *const SICONOS_NUMERICS_PROBLEM_LCP_STR
const char *const SICONOS_NUMERICS_PROBLEM_MCP_STR
const char *const SICONOS_NUMERICS_PROBLEM_MLCP_STR
const char *const SICONOS_NUMERICS_PROBLEM_NCP_STR
const char *const SICONOS_NUMERICS_PROBLEM_RELAY_STR
const char *const SICONOS_NUMERICS_PROBLEM_VI_STR
struct Callback
#include <SolverOptions.h>

Structure used to store user callbacks inside solvers.

Public Members

void (*collectStatsIteration)(void *env, int size, double *reaction, double *velocity, double error, void *extra_data)

pointer on a function Its signature is: user env, problem size, reaction, velocity, error at end of solver iteration (when this makes sense) and an extra data structure

void *env

general user environment

struct SolverOptions

Public Members

Callback *callback

callback a pointer to user Callback

double *dparam

dparam a list of double parameters (depends on each solver, see solver doc)

int dSize

dSize size of vector dparam

double *dWork

dWork is a pointer on a working memory zone (for doubles) reserved for the solver .

int dWorkSize

dWorkSize size of vector iWork

int filterOn

filterOn 1 to check solution validity after the driver call, else 0.

Default = 1. (For example if filterOn = 1 for a LCP, lcp_compute_error() will be called at the end of the process)

struct SolverOptions *internalSolvers

internalSolvers pointer to sub-solvers

int *iparam

iparam a list of int parameters (depends on each solver, see solver doc)

int iSize

iSize size of vector iparam

int isSet

isSet int equal to false(0) if the parameters below have not been set (ie need to read default values) else true(1)

int *iWork

iWork is a pointer on a working memory zone (for integers) reserved for the solver .

int iWorkSize

iWorkSize size of vector iWork

int numberOfInternalSolvers

numberOfInternalSolvers the number of internal or local ‘sub-solvers’ used by the solver

void *solverData

additional data specific to the solver

int solverId

solverId Id of the solver (see )

void *solverParameters

additional parameters specific to the solver