reader_rpa.c
Go to the documentation of this file.
29 * This file implements the reader/parser used to read the ringpacking input data. For more details see \ref RINGPACKING_READER.
33 * In the <code>data</code> directory you find a few data files which contain each one ringpacking problem. They have
34 * the following structure. In the first line the name of the instance is stated. In the second line you find three
35 * integer numbers. The first one gives you the number of different ring types \f$T\f$, the second and third the width
36 * and height of the rectangles, respectively. The remaining lines each contain one integer and two floats which
37 * together specify one ring type. The integer gives the demand and the floats correspond to the inner and outer radius
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>SCIPincludeReaderRpa()</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 "rpa". This means that all files which have
52 * <code>SCIPincludeReader()</code> also passes for each callback of the reader a function pointers
53 * (some of them might be NULL pointers). These function pointers are used by \SCIP to run the reader. For more
54 * information about all available reader callbacks we refer to the \ref READER "How to add file readers" tutorial. In
55 * the remaining section we restrict ourself to the callback <code>READERREAD</code> which is the only one we
56 * implemented for the ringpacking example. All other callbacks are not required for this example.
60 * The READERREAD callback is in charge of parsing a file and creating the problem. To see the list of arguments this
61 * functions gets to see the file type_reader.h in the source of \SCIP. The following arguments are of interest in our
62 * case. First of all the \SCIP pointer, the file name, and the SCIP_RESULT pointer. The \SCIP pointer gives us the
63 * current environment. The file name states the file which we should open and parse. Last but not least, the SCIP_RESULT
64 * pointer is required to tell \SCIP if the parsing process was successfully or not. Note that in type_reader.h you also
65 * find a list of allowable result values for the SCIP_RESULT pointer and the <code>SCIP_RETCODE</code> which is the
70 * The file can be opened and parsed with your favorite methods. In this case we are using the functionality provided by
71 * \SCIP since this has some nice side effects. We are using the function SCIPfopen() which can besides standard
72 * 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
73 * in the source of SCIP. Parsing the data out of the file is not that hard. Please look at the code and comments
78 * After parsing the file the final task for the reader is to create the problem. In our case, we pass the collected data
81 * problem data plugin (see probdata_rpa.c). After that, the reader sets the result value for the SCIP_RESULT
86 /*---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0----+----1----+----2*/
106 #define DEFAULT_VERIFICATION_NLPTILIMSOFT 1e+20 /**< soft time limit for each verification NLP */
107 #define DEFAULT_VERIFICATION_NLPNODELIMSOFT 100L /**< soft node limit for each verification NLP */
108 #define DEFAULT_VERIFICATION_HEURTILIMSOFT 1e+20 /**< soft time limit for heuristic verification */
109 #define DEFAULT_VERIFICATION_HEURITERLIMSOFT 100 /**< soft iteration limit for each heuristic verification */
110 #define DEFAULT_VERIFICATION_TOTALTILIMSOFT 1e+20 /**< total time limit for all verification problems during the enumeration */
168 SCIPwarningMessage(scip, "invalid input line %d in file <%s>: <%s>\n", lineno, filename, buffer);
178 nread = sscanf(buffer, "%d %" SCIP_REAL_FORMAT " %" SCIP_REAL_FORMAT "\n", &ntypes, &width, &height);
181 SCIPwarningMessage(scip, "invalid input line %d in file <%s>: <%s>\n", lineno, filename, buffer);
209 nread = sscanf(buffer, "%d %" SCIP_REAL_FORMAT " %" SCIP_REAL_FORMAT "\n", &demand, &r_int, &r_ext);
212 SCIPwarningMessage(scip, "invalid input line %d in file <%s>: <%s>\n", lineno, filename, buffer);
219 SCIPwarningMessage(scip, "invalid input line %d in file <%s>: internal radius is greater than the external one\n", lineno, filename);
226 SCIPwarningMessage(scip, "invalid input line %d in file <%s>: demand has to be positive\n", lineno, filename);
258 SCIP_CALL( SCIPprobdataCreate(scip, filename, demands, rints, rexts, ntypes, MAX(width,height), MIN(width,height)) );
295 SCIP_CALL( SCIPincludeReaderBasic(scip, &reader, READER_NAME, READER_DESC, READER_EXTENSION, readerdata) );
299 SCIP_CALL( SCIPaddRealParam(scip, "ringpacking/verification/nlptilimsoft", "soft time limit for verification NLP",
void SCIPsortDownRealRealInt(SCIP_Real *realarray1, SCIP_Real *realarray2, int *intarray, int len)
Definition: type_result.h:42
Definition: struct_reader.h:45
Definition: struct_scip.h:68
Definition: type_result.h:58
Problem data for ringpacking problem.
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:111
#define DEFAULT_VERIFICATION_HEURTILIMSOFT
Definition: reader_rpa.c:108
#define DEFAULT_VERIFICATION_TOTALTILIMSOFT
Definition: reader_rpa.c:110
Definition: type_retcode.h:47
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:1395
void SCIPwarningMessage(SCIP *scip, const char *formatstr,...)
Definition: scip_message.c:120
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:83
Definition: type_retcode.h:45
Definition: type_retcode.h:42
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
#define DEFAULT_VERIFICATION_NLPTILIMSOFT
Definition: reader_rpa.c:106
#define DEFAULT_VERIFICATION_HEURITERLIMSOFT
Definition: reader_rpa.c:109
SCIP_RETCODE SCIPsetReaderRead(SCIP *scip, SCIP_READER *reader, SCIP_DECL_READERREAD((*readerread)))
Definition: scip_reader.c:195
#define DEFAULT_VERIFICATION_NLPNODELIMSOFT
Definition: reader_rpa.c:107
SCIP_RETCODE SCIPprobdataSetupProblem(SCIP *scip)
Definition: probdata_rpa.c:1442
Definition: objbenders.h:43
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:139