Scippy

SCIP

Solving Constraint Integer Programs

scip_reader.h
Go to the documentation of this file.
1 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
2 /* */
3 /* This file is part of the program and library */
4 /* SCIP --- Solving Constraint Integer Programs */
5 /* */
6 /* Copyright (c) 2002-2023 Zuse Institute Berlin (ZIB) */
7 /* */
8 /* Licensed under the Apache License, Version 2.0 (the "License"); */
9 /* you may not use this file except in compliance with the License. */
10 /* You may obtain a copy of the License at */
11 /* */
12 /* http://www.apache.org/licenses/LICENSE-2.0 */
13 /* */
14 /* Unless required by applicable law or agreed to in writing, software */
15 /* distributed under the License is distributed on an "AS IS" BASIS, */
16 /* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. */
17 /* See the License for the specific language governing permissions and */
18 /* limitations under the License. */
19 /* */
20 /* You should have received a copy of the Apache-2.0 license */
21 /* along with SCIP; see the file LICENSE. If not visit scipopt.org. */
22 /* */
23 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
24 
25 /**@file scip_reader.h
26  * @ingroup PUBLICCOREAPI
27  * @brief public methods for reader plugins
28  * @author Tobias Achterberg
29  * @author Timo Berthold
30  * @author Thorsten Koch
31  * @author Alexander Martin
32  * @author Marc Pfetsch
33  * @author Kati Wolter
34  * @author Gregor Hendel
35  * @author Leona Gottwald
36  */
37 
38 /*---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0----+----1----+----2*/
39 
40 #ifndef __SCIP_SCIP_READER_H__
41 #define __SCIP_SCIP_READER_H__
42 
43 
44 #include "scip/def.h"
45 #include "scip/type_cons.h"
46 #include "scip/type_prob.h"
47 #include "scip/type_reader.h"
48 #include "scip/type_result.h"
49 #include "scip/type_retcode.h"
50 #include "scip/type_scip.h"
51 #include "scip/type_var.h"
52 
53 #ifdef __cplusplus
54 extern "C" {
55 #endif
56 
57 /**@addtogroup PublicReaderMethods
58  *
59  * @{
60  */
61 
62 /** creates a reader and includes it in SCIP
63  *
64  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
65  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
66  *
67  * @pre This method can be called if SCIP is in one of the following stages:
68  * - \ref SCIP_STAGE_INIT
69  * - \ref SCIP_STAGE_PROBLEM
70  *
71  * @note method has all reader callbacks as arguments and is thus changed every time a new callback is added
72  * in future releases; consider using SCIPincludeReaderBasic() and setter functions
73  * if you seek for a method which is less likely to change in future releases
74  */
75 SCIP_EXPORT
77  SCIP* scip, /**< SCIP data structure */
78  const char* name, /**< name of reader */
79  const char* desc, /**< description of reader */
80  const char* extension, /**< file extension that reader processes */
81  SCIP_DECL_READERCOPY ((*readercopy)), /**< copy method of reader or NULL if you don't want to copy your plugin into sub-SCIPs */
82  SCIP_DECL_READERFREE ((*readerfree)), /**< destructor of reader */
83  SCIP_DECL_READERREAD ((*readerread)), /**< read method */
84  SCIP_DECL_READERWRITE ((*readerwrite)), /**< write method */
85  SCIP_READERDATA* readerdata /**< reader data */
86  );
87 
88 /** creates a reader and includes it in SCIP. All non-fundamental (or optional) callbacks will be set to NULL.
89  * Optional callbacks can be set via specific setter functions, see
90  * SCIPsetReaderCopy(), SCIPsetReaderFree(), SCIPsetReaderRead(), SCIPsetReaderWrite().
91  *
92  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
93  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
94  *
95  * @pre This method can be called if SCIP is in one of the following stages:
96  * - \ref SCIP_STAGE_INIT
97  * - \ref SCIP_STAGE_PROBLEM
98  *
99  * @note if you want to set all callbacks with a single method call, consider using SCIPincludeReader() instead
100  */
101 SCIP_EXPORT
103  SCIP* scip, /**< SCIP data structure */
104  SCIP_READER** readerptr, /**< reference to reader pointer, or NULL */
105  const char* name, /**< name of reader */
106  const char* desc, /**< description of reader */
107  const char* extension, /**< file extension that reader processes */
108  SCIP_READERDATA* readerdata /**< reader data */
109  );
110 
111 /** set copy method of reader
112  *
113  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
114  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
115  *
116  * @pre This method can be called if SCIP is in one of the following stages:
117  * - \ref SCIP_STAGE_INIT
118  * - \ref SCIP_STAGE_PROBLEM
119  */
120 SCIP_EXPORT
122  SCIP* scip, /**< SCIP data structure */
123  SCIP_READER* reader, /**< reader */
124  SCIP_DECL_READERCOPY ((*readercopy)) /**< copy method of reader or NULL if you don't want to copy your plugin into sub-SCIPs */
125  );
126 
127 /** set deinitialization method of reader
128  *
129  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
130  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
131  *
132  * @pre This method can be called if SCIP is in one of the following stages:
133  * - \ref SCIP_STAGE_INIT
134  * - \ref SCIP_STAGE_PROBLEM
135  */
136 SCIP_EXPORT
138  SCIP* scip, /**< SCIP data structure */
139  SCIP_READER* reader, /**< reader */
140  SCIP_DECL_READERFREE ((*readerfree)) /**< destructor of reader */
141  );
142 
143 /** set read method of reader
144  *
145  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
146  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
147  *
148  * @pre This method can be called if SCIP is in one of the following stages:
149  * - \ref SCIP_STAGE_INIT
150  * - \ref SCIP_STAGE_PROBLEM
151  */
152 SCIP_EXPORT
154  SCIP* scip, /**< SCIP data structure */
155  SCIP_READER* reader, /**< reader */
156  SCIP_DECL_READERREAD ((*readerread)) /**< read method of reader */
157  );
158 
159 /** set write method of reader
160  *
161  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
162  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
163  *
164  * @pre This method can be called if SCIP is in one of the following stages:
165  * - \ref SCIP_STAGE_INIT
166  * - \ref SCIP_STAGE_PROBLEM
167  */
168 SCIP_EXPORT
170  SCIP* scip, /**< SCIP data structure */
171  SCIP_READER* reader, /**< reader */
172  SCIP_DECL_READERWRITE ((*readerwrite)) /**< write method of reader */
173  );
174 
175 /** returns the reader of the given name, or NULL if not existing */
176 SCIP_EXPORT
178  SCIP* scip, /**< SCIP data structure */
179  const char* name /**< name of reader */
180  );
181 
182 /** returns the array of currently available readers */
183 SCIP_EXPORT
185  SCIP* scip /**< SCIP data structure */
186  );
187 
188 /** returns the number of currently available readers */
189 SCIP_EXPORT
190 int SCIPgetNReaders(
191  SCIP* scip /**< SCIP data structure */
192  );
193 
194 /** @} */
195 
196 #ifdef __cplusplus
197 }
198 #endif
199 
200 #endif
SCIP_DECL_READERFREE(ReaderTSP::scip_free)
Definition: ReaderTSP.cpp:152
enum SCIP_Retcode SCIP_RETCODE
Definition: type_retcode.h:63
SCIP_DECL_READERWRITE(ReaderTSP::scip_write)
Definition: ReaderTSP.cpp:496
SCIP_READER * SCIPfindReader(SCIP *scip, const char *name)
Definition: scip_reader.c:235
type definitions for return codes for SCIP methods
SCIP_READER ** SCIPgetReaders(SCIP *scip)
Definition: scip_reader.c:248
type definitions for SCIP&#39;s main datastructure
type definitions for problem variables
struct SCIP_ReaderData SCIP_READERDATA
Definition: type_reader.h:53
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
type definitions for input file readers
SCIP_RETCODE SCIPincludeReader(SCIP *scip, const char *name, const char *desc, const char *extension, SCIP_DECL_READERCOPY((*readercopy)), SCIP_DECL_READERFREE((*readerfree)), SCIP_DECL_READERREAD((*readerread)), SCIP_DECL_READERWRITE((*readerwrite)), SCIP_READERDATA *readerdata)
Definition: scip_reader.c:66
SCIP_RETCODE SCIPsetReaderWrite(SCIP *scip, SCIP_READER *reader, SCIP_DECL_READERWRITE((*readerwrite)))
Definition: scip_reader.c:219
SCIP_RETCODE SCIPsetReaderCopy(SCIP *scip, SCIP_READER *reader, SCIP_DECL_READERCOPY((*readercopy)))
Definition: scip_reader.c:147
type definitions for storing and manipulating the main problem
#define SCIP_DECL_READERCOPY(x)
Definition: type_reader.h:62
int SCIPgetNReaders(SCIP *scip)
Definition: scip_reader.c:259
result codes for SCIP callback methods
SCIP_DECL_READERREAD(ReaderTSP::scip_read)
Definition: ReaderTSP.cpp:165
SCIP_RETCODE SCIPsetReaderRead(SCIP *scip, SCIP_READER *reader, SCIP_DECL_READERREAD((*readerread)))
Definition: scip_reader.c:195
common defines and data types used in all packages of SCIP
SCIP_RETCODE SCIPsetReaderFree(SCIP *scip, SCIP_READER *reader, SCIP_DECL_READERFREE((*readerfree)))
Definition: scip_reader.c:171
type definitions for constraints and constraint handlers