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_IPARAM

Some value for iparam index.

Values:

enumerator SICONOS_IPARAM_MAX_ITER
enumerator SICONOS_IPARAM_ITER_DONE
enumerator SICONOS_IPARAM_PREALLOC
enumerator SICONOS_IPARAM_NSGS_SHUFFLE
enumerator SICONOS_IPARAM_ERROR_EVALUATION
enumerator SICONOS_IPARAM_PATHSEARCH_STACKSIZE
enum SICONOS_IPARAM_ERROR_EVALUATION_ENUM

allowed values for iparam[SICONOS_IPARAM_ERROR_EVALUATION

Values:

enumerator SICONOS_ERROR_FULL_EVALUATION

Complete error computation, including v computation.

enumerator SICONOS_ERROR_LIGHT_EVALUATION

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

enumerator SICONOS_ERROR_LIGHT_EVALUATION_NO_UPDATE

only light error computation, do not update v unknown)

enum SICONOS_DPARAM

Some values for dparam index.

Values:

enumerator SICONOS_DPARAM_TOL
enumerator SICONOS_DPARAM_RESIDU

Functions

void solver_options_print(SolverOptions *options)

screen display of solver parameters

Parameters

options – the structure to be displayed

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_create(int solverId)

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

Parameters

id – solver id number It must belong to one of the available ids defined for each formulation, see users’guide for details

Returns

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

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!

Parameters

source – an existing solver options structure

Returns

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

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

int solver_options_name_to_id(const char *pName)

return the id of a solver based on its name

Parameters

pName – the name of the solver

Returns

the id of the solver or 0 if it failed

const char *solver_options_id_to_name(int Id)

return the name of a solver given its id

Parameters

Id – the id of the solver

Returns

the name of the solver

SolverOptions *solver_options_get_internal_solver(SolverOptions *options, size_t n)

return the internal solver options set

Parameters
  • options – parent options

  • number – of the targeted solver

Returns

a pointer to the internal solver options set

void solver_options_set_internal_solver(SolverOptions *options, size_t n, SolverOptions *NSO)

set internal solver

Parameters
  • options – parent options

  • number – of the targeted solver

  • the – solver options to be used as internal solver number n

struct Callback
#include <>

Structure used to store user callbacks inside solvers.

Public Members

void *env

general user environment

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

struct SolverOptions
#include <>

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

Creation, update and destruction:

Details in users’guide.

Public Members

int solverId

id number of the solver.

bool isSet

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

int iSize

iSize size of vector iparam

int *iparam

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

int dSize

size of vector dparam

double *dparam

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

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

size_t dWorkSize

size of double type internal work array.

double *dWork

internal (double type) work array.

size_t iWorkSize

size of integer type internal work array.

int *iWork

internal (integer type) work array.

size_t numberOfInternalSolvers

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

struct SolverOptions **internalSolvers

list of internal solver options

Callback *callback

pointer to user-defined callback

void *solverParameters

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

void *solverData

additional data specific to the solver