reader_bpa.c
Go to the documentation of this file.
21 * This file implements the reader/parser used to read the binpacking input data. For more details see \ref READER. 25 * In the <code>data</code> directory you find a few data files which contain each one binpacking problem. These data 26 * files have the following structure. In the first line the name of the instance is stated. In the second line you find 27 * three integer numbers. The first one gives you the capacity \f$\kappa\f$, the second the number of items, and the 28 * last integer states the value of a known feasible solution. This means an upper bound on the number of needed 31 * For parsing that data, we implemented a reader plugin for \SCIP. A reader has several callback methods and at least 32 * one interface methods (the one including the reader into \SCIP). For our purpose we only implemented the \ref 33 * READERREAD "READERREAD" callback and the interface method which adds the reader plugin to \SCIP. 37 * The interface method <code>SCIPincludeReaderBpa()</code> is called to add the reader plugin to \SCIP (see 38 * cmain.c). This means \SCIP gets informed that this reader is available for reading input files. Therefore, the 39 * function <code>SCIPincludeReader()</code> is called within this method which passes all necessary information of the 40 * reader to SCIP. This information includes the name of the reader, a description, and the file extension for which the 41 * file reader is in charge. In our case we selected the file extension "bpa". This means that all files which have 43 * <code>SCIPincludeReader()</code> also passes for each callback of the reader a function pointers 45 * pointers are used by \SCIP to run the reader. For more information about all available reader callbacks we refer to 46 * the <a href="http://scip.zib.de/doc/html/READER.html">How to add file readers</a> tutorial. In the remaining section 47 * we restrict ourself to the callback <code>READERREAD</code> which is the only one we implemented for the binpacking 52 * The READERREAD callback is in charge of parsing a file and creating the problem. To see the list of arguments this 53 * functions gets see the file type_reader.h in the source of \SCIP. The following arguments are of interest in our 54 * case. First of all the \SCIP pointer, the file name, and the SCIP_RESULT pointer. The \SCIP pointer gives us the 55 * current environment. The file name states the file which we should open and parse. Last but not least, the SCIP_RESULT 57 * not. Note that in type_reader.h you also find a list of allowable result values for the SCIP_RESULT pointer and the 62 * The file can be opened and parsed with your favorite methods. In this case we are using the functionality provided by 63 * \SCIP since this has some nice side effects. We are using the function SCIPfopen() which can besides standard 64 * files also handle files which are packed. To find all files related to the parsing of a file, we refer to the file pub_misc.h 65 * in the source of SCIP. Parsing the data out of the file is not that hard. Please look at the code and comments 70 * After parsing the file the final task for the reader is to create the problem. In our case, we pass the collected data 71 * to the \ref probdata_binpacking.h "main problem data plugin". For this, we use the interface methods 73 * problem data plugin (see probdata_binpacking.c). After that, the reader sets the result value for the SCIP_RESULT 79 /*---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0----+----1----+----2*/ 153 SCIPwarningMessage(scip, "invalid input line %d in file <%s>: <%s>\n", lineno, filename, buffer); 175 SCIPwarningMessage(scip, "invalid input line %d in file <%s>: <%s>\n", lineno, filename, buffer); 179 SCIPdebugMessage("capacity = <%d>, number of items = <%d>, best known solution = <%d>\n", capacity, nitems, bestsolvalue); 202 SCIPwarningMessage(scip, "invalid input line %d in file <%s>: <%s>\n", lineno, filename, buffer); 218 SCIPwarningMessage(scip, "set nitems from <%d> to <%d> since the file <%s> only contains <%d> weights\n", nitems, weights, filename, weights); 260 SCIP_CALL( SCIPincludeReaderBasic(scip, &reader, READER_NAME, READER_DESC, READER_EXTENSION, readerdata) );
SCIP_RETCODE SCIPprobdataCreate(SCIP *scip, const char *probname, int *ids, SCIP_Longint *weights, int nitems, SCIP_Longint capacity) Definition: probdata_binpacking.c:363 Problem data for binpacking problem. Binpacking problem reader file reader. |