reader_bpa.c
Go to the documentation of this file.
30 * This file implements the reader/parser used to read the binpacking input data. For more details see \ref BINPACKING_READER.
34 * In the <code>data</code> directory you find a few data files which contain each one binpacking problem. These data
35 * files have the following structure. In the first line the name of the instance is stated. In the second line you find
36 * three integer numbers. The first one gives you the capacity \f$\kappa\f$, the second the number of items, and the
37 * last integer states the value of a known feasible solution. This means an upper bound on the number of needed
40 * For parsing that data, we implemented a reader plugin for \SCIP. A reader has several callback methods and at least
41 * one interface methods (the one including the reader into \SCIP). For our purpose we only implemented the \ref
42 * READERREAD "READERREAD" callback and the interface method which adds the reader plugin to \SCIP.
46 * The interface method <code>SCIPincludeReaderBpa()</code> is called to add the reader plugin to \SCIP (see
47 * cmain.c). This means \SCIP gets informed that this reader is available for reading input files. Therefore, the
48 * function <code>SCIPincludeReader()</code> is called within this method which passes all necessary information of the
49 * reader to SCIP. This information includes the name of the reader, a description, and the file extension for which the
50 * file reader is in charge. In our case we selected the file extension "bpa". This means that all files which have
52 * <code>SCIPincludeReader()</code> also passes for each callback of the reader a function pointers
54 * pointers are used by \SCIP to run the reader. For more information about all available reader callbacks we refer to
56 * we restrict ourself to the callback <code>READERREAD</code> which is the only one we implemented for the binpacking
61 * The READERREAD callback is in charge of parsing a file and creating the problem. To see the list of arguments this
62 * functions gets see the file type_reader.h in the source of \SCIP. The following arguments are of interest in our
63 * case. First of all the \SCIP pointer, the file name, and the SCIP_RESULT pointer. The \SCIP pointer gives us the
64 * current environment. The file name states the file which we should open and parse. Last but not least, the SCIP_RESULT
66 * not. Note that in type_reader.h you also find a list of allowable result values for the SCIP_RESULT pointer and the
71 * The file can be opened and parsed with your favorite methods. In this case we are using the functionality provided by
72 * \SCIP since this has some nice side effects. We are using the function SCIPfopen() which can besides standard
73 * 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
74 * in the source of SCIP. Parsing the data out of the file is not that hard. Please look at the code and comments
79 * After parsing the file the final task for the reader is to create the problem. In our case, we pass the collected data
80 * to the \ref probdata_binpacking.h "main problem data plugin". For this, we use the interface methods
82 * problem data plugin (see probdata_binpacking.c). After that, the reader sets the result value for the SCIP_RESULT
88/*---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0----+----1----+----2*/
162 SCIPwarningMessage(scip, "invalid input line %d in file <%s>: <%s>\n", lineno, filename, buffer);
184 SCIPwarningMessage(scip, "invalid input line %d in file <%s>: <%s>\n", lineno, filename, buffer);
188 SCIPdebugMsg(scip, "capacity = <%d>, number of items = <%d>, best known solution = <%d>\n", capacity, nitems, bestsolvalue);
210 SCIPwarningMessage(scip, "invalid input line %d in file <%s>: <%s>\n", lineno, filename, buffer);
226 SCIPwarningMessage(scip, "set nitems from <%d> to <%d> since the file <%s> only contains <%d> weights\n", nitems, nweights, filename, nweights);
268 SCIP_CALL( SCIPincludeReaderBasic(scip, &reader, READER_NAME, READER_DESC, READER_EXTENSION, readerdata) );
Constraint handler for the set partitioning / packing / covering constraints .
void SCIPwarningMessage(SCIP *scip, const char *formatstr,...)
Definition: scip_message.c:120
SCIP_RETCODE SCIPincludeReaderBasic(SCIP *scip, SCIP_READER **readerptr, const char *name, const char *desc, const char *extension, SCIP_READERDATA *readerdata)
Definition: scip_reader.c:109
SCIP_RETCODE SCIPsetReaderRead(SCIP *scip, SCIP_READER *reader, SCIP_DECL_READERREAD((*readerread)))
Definition: scip_reader.c:195
Definition: objbenders.h:44
Problem data for binpacking problem.
SCIP_RETCODE SCIPprobdataCreate(SCIP *scip, const char *probname, int *demands, SCIP_Real *rints, SCIP_Real *rexts, int ntypes, SCIP_Real width, SCIP_Real height)
Definition: probdata_rpa.c:1396
Binpacking problem reader file reader.
Definition: struct_reader.h:46
Definition: struct_scip.h:70