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).

Defines

OPTIONS_PARAM_SIZE

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
SICONOS_IPARAM_NSGS_SHUFFLE = 5
SICONOS_IPARAM_ERROR_EVALUATION = 3
SICONOS_IPARAM_PATHSEARCH_STACKSIZE = 19
enum SICONOS_IPARAM_ERROR_EVALUATION_ENUM

allowed values for iparam[SICONOS_IPARAM_ERROR_EVALUATION

Values:

SICONOS_ERROR_FULL_EVALUATION = 0

Complete error computation, including v computation.

SICONOS_ERROR_LIGHT_EVALUATION = 1

Light error computation with incremental values on r verification of absolute error at the end.

SICONOS_ERROR_LIGHT_EVALUATION_NO_UPDATE = 2

only light error computation, do not update v unknown)

Functions

SolverOptions *solver_options_copy(SolverOptions *source)

Copy an existing set of options, to create a new one.

Warning : callback, solverData and solverParameters of the new structure are pointer links to those of the original one!

Return

a pointer to options set, ready to use by a driver.

Parameters
  • source: an existing solver options structure

SolverOptions *solver_options_create(int solverId)

Create and initialize a SolverOptions struct: allocate internal memories, set default values depending on the id.

Return

a pointer to options set, ready to use by a driver.

Parameters

void solver_options_delete(SolverOptions *options)

Clear and free all pointer members of the structure, then release memory.

Parameters
  • options: the structure to be cleared.

SolverOptions *solver_options_get_internal_solver(SolverOptions *options, size_t n)

return the an internal solver options set

Return

a pointer to the internal solver options set

Parameters
  • options: parent options

  • number: of the targeted solver

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(const 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_print(SolverOptions *options)

screen display of solver parameters

Parameters
  • options: the structure to be displayed

void solver_options_update_internal(SolverOptions *parent, size_t internal_solver_number, int solver_id)

Change one of the internal solver of a previously defined SolverOptions set.

Allocate internal memories and set default values for the internal solver.

Warning : the actual internal solver in position internal_solver_number and all its content will be destroyed and replaced by a new one.

Parameters
  • parent: the top-level SolverOptions which contains the internal solver to be updated

  • internal_solver_number: number of the internal solver to be update (warning : this is the position in the list of internal solvers, not the id!)

  • solver_id: id number of the new internal solver to be created/updated

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

pointer to user-defined callback

double *dparam

list of solver parameters (double type); Check solvers doc for details.

int dSize

size of vector dparam

double *dWork

internal (double type) work array.

size_t dWorkSize

size of double type internal work array.

bool filterOn

if true (1), check solution validity after the driver call.

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

list of internal solver options

int *iparam

list of solver parameters (integer type); Check solvers doc for details.

int iSize

iSize size of vector iparam

bool isSet

true(1) if the structure is ready to be used by a numerics driver.

int *iWork

internal (integer type) work array.

size_t iWorkSize

size of integer type internal work array.

size_t numberOfInternalSolvers

the number of internal or local ‘sub-solvers’ used by the solver (size of internalSolvers) .

void *solverData

additional data specific to the solver

int solverId

id number of the solver.

void *solverParameters

additional parameters specific to the solver (GAMS and NewtonMethod only)