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 BINPACKING_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
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 SCIPdebugMsg(scip, "capacity = <%d>, number of items = <%d>, best known solution = <%d>\n", capacity, nitems, bestsolvalue);
201 SCIPwarningMessage(scip, "invalid input line %d in file <%s>: <%s>\n", lineno, filename, buffer);
217 SCIPwarningMessage(scip, "set nitems from <%d> to <%d> since the file <%s> only contains <%d> weights\n", nitems, weights, filename, weights);
259 SCIP_CALL( SCIPincludeReaderBasic(scip, &reader, READER_NAME, READER_DESC, READER_EXTENSION, readerdata) );
Definition: type_result.h:33
Definition: struct_reader.h:36
Definition: struct_scip.h:58
void SCIPwarningMessage(SCIP *scip, const char *formatstr,...)
Definition: scip_message.c:122
Definition: type_result.h:49
SCIP_RETCODE SCIPsetReaderRead(SCIP *scip, SCIP_READER *reader, SCIP_DECL_READERREAD((*readerread)))
Definition: scip_reader.c:185
Definition: type_retcode.h:38
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:1387
Constraint handler for the set partitioning / packing / covering constraints .
Definition: type_retcode.h:36
Definition: type_retcode.h:33
Problem data for binpacking problem.
SCIP_RETCODE SCIPincludeReaderBasic(SCIP *scip, SCIP_READER **readerptr, const char *name, const char *desc, const char *extension, SCIP_READERDATA *readerdata)
Definition: scip_reader.c:99
Binpacking problem reader file reader.
Definition: objbenders.h:33