1 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
2 /*                                                                           */
3 /*                  This file is part of the program and library             */
4 /*         SCIP --- Solving Constraint Integer Programs                      */
5 /*                                                                           */
6 /*    Copyright (C) 2002-2021 Konrad-Zuse-Zentrum                            */
7 /*                            fuer Informationstechnik Berlin                */
8 /*                                                                           */
9 /*  SCIP is distributed under the terms of the ZIB Academic License.         */
10 /*                                                                           */
11 /*  You should have received a copy of the ZIB Academic License              */
12 /*  along with SCIP; see the file COPYING. If not visit scipopt.org.         */
13 /*                                                                           */
14 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
15 
16 /**@file   type_reader.h
17  * @ingroup TYPEDEFINITIONS
18  * @brief  type definitions for input file readers
19  * @author Tobias Achterberg
20  */
21 
22 /** @defgroup DEFPLUGINS_READER Default Readers
23  *  @ingroup DEFPLUGINS
24  *  @brief implementation files (.c files) of the default readers of SCIP
25  */
26 
27 /*---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0----+----1----+----2*/
28 
29 #ifndef __SCIP_TYPE_READER_H__
30 #define __SCIP_TYPE_READER_H__
31 
32 #include "scip/def.h"
33 #include "scip/type_cons.h"
34 #include "scip/type_retcode.h"
35 #include "scip/type_result.h"
36 #include "scip/type_scip.h"
37 #include "scip/type_var.h"
38 
39 #ifdef __cplusplus
40 extern "C" {
41 #endif
42 
43 typedef struct SCIP_Reader SCIP_READER;               /**< reader data structure */
44 typedef struct SCIP_ReaderData SCIP_READERDATA;       /**< reader specific data */
45 
46 
47 /** copy method for reader plugins (called when SCIP copies plugins)
48  *
49  *  input:
50  *  - scip            : SCIP main data structure
51  *  - reader          : the reader itself
52  */
53 #define SCIP_DECL_READERCOPY(x) SCIP_RETCODE x (SCIP* scip, SCIP_READER* reader)
54 
55 
56 /** destructor of reader to free user data (called when SCIP is exiting)
57  *
58  *  input:
59  *  - scip            : SCIP main data structure
60  *  - reader          : the reader itself
61  */
62 #define SCIP_DECL_READERFREE(x) SCIP_RETCODE x (SCIP* scip, SCIP_READER* reader)
63 
64 /** problem reading method of reader
65  *
66  *  input:
67  *  - scip            : SCIP main data structure
68  *  - reader          : the reader itself
69  *  - filename        : full path and name of file to read, or NULL if stdin should be used
70  *  - result          : pointer to store the result of the file reading call
71  *
72  *  possible return values for *result:
73  *  - SCIP_SUCCESS    : the reader read the file correctly and created an appropriate problem
74  *  - SCIP_DIDNOTRUN  : the reader is not responsible for given input file
75  *
76  *  If the reader detected an error in the input file, it should return with RETCODE SCIP_READERROR or SCIP_NOFILE.
77  */
78 #define SCIP_DECL_READERREAD(x) SCIP_RETCODE x (SCIP* scip, SCIP_READER* reader, const char* filename, SCIP_RESULT* result)
79 
80 /** problem writing method of reader; NOTE: if the parameter "genericnames" is TRUE, then
81  *  SCIP already set all variable and constraint names to generic names; therefore, this
82  *  method should always use SCIPvarGetName() and SCIPconsGetName();
83  *
84  *  input:
85  *  - scip            : SCIP main data structure
86  *  - reader          : the reader itself
87  *  - file            : output file, or NULL if standard output should be used
88  *  - name            : problem name
89  *  - probdata        : user problem data set by the reader
90  *  - transformed     : TRUE iff problem is the transformed problem
91  *  - objsense        : objective sense
92  *  - objscale        : scalar applied to objective function; external objective value is
93                         extobj = objsense * objscale * (intobj + objoffset)
94  *  - objoffset       : objective offset from bound shifting and fixing
95  *  - vars            : array with active variables ordered binary, integer, implicit, continuous
96  *  - nvars           : number of active variables in the problem
97  *  - nbinvars        : number of binary variables
98  *  - nintvars        : number of general integer variables
99  *  - nimplvars       : number of implicit integer variables
100  *  - ncontvars;      : number of continuous variables
101  *  - fixedvars       : array with fixed and aggregated variables
102  *  - nfixedvars      : number of fixed and aggregated variables in the problem
103  *  - startnvars      : number of variables existing when problem solving started
104  *  - conss           : array with constraints of the problem
105  *  - nconss          : number of constraints in the problem
106  *  - maxnconss       : maximum number of constraints existing at the same time
107  *  - startnconss     : number of constraints existing when problem solving started
108  *  - genericnames    : using generic variable and constraint names?
109  *  - result          : pointer to store the result of the file reading call
110  *
111  *  possible return values for *result:
112  *  - SCIP_SUCCESS    : the reader wrote the file correctly
113  *  - SCIP_DIDNOTRUN  : the reader is not responsible for given input file
114  *
115  *  If the reader detected an error while writing the output file, it should return with RETCODE SCIP_WRITEERROR
116  */
117 #define SCIP_DECL_READERWRITE(x) SCIP_RETCODE x (SCIP* scip, SCIP_READER* reader, FILE* file, \
118       const char* name, SCIP_PROBDATA* probdata, SCIP_Bool transformed, \
119       SCIP_OBJSENSE objsense, SCIP_Real objscale, SCIP_Real objoffset,  \
120       SCIP_VAR** vars, int nvars, int nbinvars, int nintvars, int nimplvars, int ncontvars, \
121       SCIP_VAR** fixedvars, int nfixedvars, int startnvars, \
122       SCIP_CONS** conss, int nconss, int maxnconss, int startnconss, \
123       SCIP_Bool genericnames, SCIP_RESULT* result)
124 
125 #ifdef __cplusplus
126 }
127 #endif
128 
129 #endif
130