reader_rpa.c
Go to the documentation of this file.
20 * This file implements the reader/parser used to read the ringpacking input data. For more details see \ref RINGPACKING_READER.
24 * In the <code>data</code> directory you find a few data files which contain each one ringpacking problem. They have
25 * the following structure. In the first line the name of the instance is stated. In the second line you find three
26 * integer numbers. The first one gives you the number of different ring types \f$T\f$, the second and third the width
27 * and height of the rectangles, respectively. The remaining lines each contain one integer and two floats which
28 * together specify one ring type. The integer gives the demand and the floats correspond to the inner and outer radius
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>SCIPincludeReaderRpa()</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 "rpa". This means that all files which have
43 * <code>SCIPincludeReader()</code> also passes for each callback of the reader a function pointers
44 * (some of them might be NULL pointers). These function pointers are used by \SCIP to run the reader. For more
45 * information about all available reader callbacks we refer to the \ref READER "How to add file readers" tutorial. In
46 * the remaining section we restrict ourself to the callback <code>READERREAD</code> which is the only one we
47 * implemented for the ringpacking example. All other callbacks are not required for this example.
51 * The READERREAD callback is in charge of parsing a file and creating the problem. To see the list of arguments this
52 * functions gets to see the file type_reader.h in the source of \SCIP. The following arguments are of interest in our
53 * case. First of all the \SCIP pointer, the file name, and the SCIP_RESULT pointer. The \SCIP pointer gives us the
54 * current environment. The file name states the file which we should open and parse. Last but not least, the SCIP_RESULT
55 * pointer is required to tell \SCIP if the parsing process was successfully or not. Note that in type_reader.h you also
56 * find a list of allowable result values for the SCIP_RESULT pointer and the <code>SCIP_RETCODE</code> which is the
61 * The file can be opened and parsed with your favorite methods. In this case we are using the functionality provided by
62 * \SCIP since this has some nice side effects. We are using the function SCIPfopen() which can besides standard
63 * 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
64 * in the source of SCIP. Parsing the data out of the file is not that hard. Please look at the code and comments
69 * After parsing the file the final task for the reader is to create the problem. In our case, we pass the collected data
72 * problem data plugin (see probdata_rpa.c). After that, the reader sets the result value for the SCIP_RESULT
77 /*---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0----+----1----+----2*/
97 #define DEFAULT_VERIFICATION_NLPTILIMSOFT 1e+20 /**< soft time limit for each verification NLP */
98 #define DEFAULT_VERIFICATION_NLPNODELIMSOFT 100L /**< soft node limit for each verification NLP */
99 #define DEFAULT_VERIFICATION_HEURTILIMSOFT 1e+20 /**< soft time limit for heuristic verification */
100 #define DEFAULT_VERIFICATION_HEURITERLIMSOFT 100 /**< soft iteration limit for each heuristic verification */
101 #define DEFAULT_VERIFICATION_TOTALTILIMSOFT 1e+20 /**< total time limit for all verification problems during the enumeration */
159 SCIPwarningMessage(scip, "invalid input line %d in file <%s>: <%s>\n", lineno, filename, buffer);
169 nread = sscanf(buffer, "%d %" SCIP_REAL_FORMAT " %" SCIP_REAL_FORMAT "\n", &ntypes, &width, &height);
172 SCIPwarningMessage(scip, "invalid input line %d in file <%s>: <%s>\n", lineno, filename, buffer);
200 nread = sscanf(buffer, "%d %" SCIP_REAL_FORMAT " %" SCIP_REAL_FORMAT "\n", &demand, &r_int, &r_ext);
203 SCIPwarningMessage(scip, "invalid input line %d in file <%s>: <%s>\n", lineno, filename, buffer);
210 SCIPwarningMessage(scip, "invalid input line %d in file <%s>: internal radius is greater than the external one\n", lineno, filename);
217 SCIPwarningMessage(scip, "invalid input line %d in file <%s>: demand has to be positive\n", lineno, filename);
249 SCIP_CALL( SCIPprobdataCreate(scip, filename, demands, rints, rexts, ntypes, MAX(width,height), MIN(width,height)) );
286 SCIP_CALL( SCIPincludeReaderBasic(scip, &reader, READER_NAME, READER_DESC, READER_EXTENSION, readerdata) );
290 SCIP_CALL( SCIPaddRealParam(scip, "ringpacking/verification/nlptilimsoft", "soft time limit for verification NLP",
Definition: type_result.h:33
Definition: struct_reader.h:36
Definition: struct_scip.h:59
void SCIPwarningMessage(SCIP *scip, const char *formatstr,...)
Definition: scip_message.c:123
Definition: type_result.h:49
Problem data for ringpacking problem.
SCIP_RETCODE SCIPsetReaderRead(SCIP *scip, SCIP_READER *reader, SCIP_DECL_READERREAD((*readerread)))
Definition: scip_reader.c:186
#define DEFAULT_VERIFICATION_HEURTILIMSOFT
Definition: reader_rpa.c:99
#define DEFAULT_VERIFICATION_TOTALTILIMSOFT
Definition: reader_rpa.c:101
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:1386
Definition: type_retcode.h:36
SCIP_EXPORT void SCIPsortDownRealRealInt(SCIP_Real *realarray1, SCIP_Real *realarray2, int *intarray, int len)
Definition: type_retcode.h:33
#define DEFAULT_VERIFICATION_NLPTILIMSOFT
Definition: reader_rpa.c:97
SCIP_RETCODE SCIPincludeReaderBasic(SCIP *scip, SCIP_READER **readerptr, const char *name, const char *desc, const char *extension, SCIP_READERDATA *readerdata)
Definition: scip_reader.c:100
SCIP_RETCODE SCIPaddRealParam(SCIP *scip, const char *name, const char *desc, SCIP_Real *valueptr, SCIP_Bool isadvanced, SCIP_Real defaultvalue, SCIP_Real minvalue, SCIP_Real maxvalue, SCIP_DECL_PARAMCHGD((*paramchgd)), SCIP_PARAMDATA *paramdata)
Definition: scip_param.c:130
#define DEFAULT_VERIFICATION_HEURITERLIMSOFT
Definition: reader_rpa.c:100
SCIP_RETCODE SCIPaddIntParam(SCIP *scip, const char *name, const char *desc, int *valueptr, SCIP_Bool isadvanced, int defaultvalue, int minvalue, int maxvalue, SCIP_DECL_PARAMCHGD((*paramchgd)), SCIP_PARAMDATA *paramdata)
Definition: scip_param.c:74
SCIP_RETCODE SCIPaddLongintParam(SCIP *scip, const char *name, const char *desc, SCIP_Longint *valueptr, SCIP_Bool isadvanced, SCIP_Longint defaultvalue, SCIP_Longint minvalue, SCIP_Longint maxvalue, SCIP_DECL_PARAMCHGD((*paramchgd)), SCIP_PARAMDATA *paramdata)
Definition: scip_param.c:102
#define DEFAULT_VERIFICATION_NLPNODELIMSOFT
Definition: reader_rpa.c:98
SCIP_RETCODE SCIPprobdataSetupProblem(SCIP *scip)
Definition: probdata_rpa.c:1433
Definition: objbenders.h:33