[SCIP] Bin packing reader

Ksenia Bestuzheva bestuzheva at zib.de
Fri Aug 21 11:37:15 CEST 2020


Hi Krishnan,

On the line that you have mentioned, SCIP_DECL_READERREAD is a macro. It 
is defined on line 78 in src/scip/type_reader.h, where you can see the 
return type and parameters that the functions defined with the use of 
this macro will have (finding this if you do not know where to look can 
be made easier by using grep, an IDE or whatever tool you prefer that 
can search in the whole project). The reason this is done like this is 
that we want to have several functions of a similar type. That is, SCIP 
has a few reader plugins, and each provides its own version of the same 
methods: for example, each reader reads a problem. SCIP can call the 
"read" function in a way that is similar to all readers, which is 
possible because the functions have similar return types and arguments. 
By the way, this type of function is referred to as a "callback" and 
they are an important part of SCIP's design.

This also answers the question about the "filename" variable: if you 
look at the macro, you can see it in the list of arguments.

On 19.08.20 16:59, Krishnan Nampoothiri wrote:
> Secondly, I see usage of a few SCIP-implemented functions in the code. 
> For example, SCIPfgets(), SCIPallocBufferArray(), SCIPfeof(), 
> SCIPfreeBufferArray() etc. How are these different from the library 
> standards - fgets(), malloc/calloc(), feof(), free()?


There is an explanation of SCIP's memory functions and why it uses its 
own rather than the standard ones here: 
https://www.scipopt.org/doc/html/MEMORY.php.


> Thirdly, some of the functions seem to require a SCIP*object passed in 
> them, despite not being directly (seemingly) connected to the 
> optimization model. For example, SCIPwarningMessage()or 
> SCIPallocBufferArray() while the others like SCIPfeof()or 
> SCIPfgets()don't seem to require a SCIP*passed to the function.


The SCIP structure has more than just the problem information. For 
example, it also stores a message handler and a structure used for 
managing memory, which is why the functions you mentioned need it.

Kind regards,
Ksenia

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listserv.zib.de/pipermail/scip/attachments/20200821/b331bf0f/attachment.html>


More information about the Scip mailing list