Users may add their own parameters to SCIP by calling SCIPaddXyzParam(). Using this method, there are two possibilities for where to store the actual parameter value:
- If the given valueptr is NULL, SCIP stores the parameter value internally, and the user can only access the value with the SCIPgetXyzParam() and SCIPsetXyzParam() calls.
- If the given valueptr is not NULL, SCIP stores the parameter value at the given address, and the user can directly manipulate the value at this address. (S)he has to be careful with memory management in string parameters: when the SCIPaddStringParam() method is called, the given address must hold a char* pointer with value NULL. The default value is then copied into this pointer, allocating memory with BMSallocMemoryArray(). If the parameter is changed, the old string is freed with BMSfreeMemoryArray() and the new one is copied to a new memory area allocated with BMSallocMemoryArray(). When the parameter is freed, the memory is freed with BMSfreeMemoryArray(). The user should not interfere with this internal memory management. Accessing the string parameter through the given valueptr is okay as long as it does not involve reallocating memory for the string.
In some cases, it is necessary to keep track of changes in a parameter. If this is the case, the user can define a method by the PARAMCHGD callback and use this method as the paramchgd
parameter of the SCIPaddXyzParam()
method, also giving a pointer to the data, which is needed in this method, as paramdata
. If this method is not NULL, it is called every time the value of the parameter is changed.