Scippy

SCIP

Solving Constraint Integer Programs

retcode.c
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 retcode.c
26  * @ingroup OTHER_CFILES
27  * @brief methods for return codes for SCIP methods
28  * @author Tobias Achterberg
29  */
30 
31 /*---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0----+----1----+----2*/
32 
33 #include <stdio.h>
34 
35 #include "scip/retcode.h"
36 
37 /** prints error message for return code via message handler */
39  SCIP_MESSAGEHDLR* messagehdlr, /**< message handler */
40  FILE* file, /**< file stream to write error message */
41  SCIP_RETCODE retcode /**< SCIP return code causing the error */
42  )
43 {
44  switch( retcode )
45  {
46  case SCIP_OKAY:
47  SCIPmessageFPrintInfo(messagehdlr, file, "normal termination");
48  break;
49  case SCIP_ERROR:
50  SCIPmessageFPrintInfo(messagehdlr, file, "unspecified error");
51  break;
52  case SCIP_NOMEMORY:
53  SCIPmessageFPrintInfo(messagehdlr, file, "insufficient memory error");
54  break;
55  case SCIP_READERROR:
56  SCIPmessageFPrintInfo(messagehdlr, file, "read error");
57  break;
58  case SCIP_WRITEERROR:
59  SCIPmessageFPrintInfo(messagehdlr, file, "write error");
60  break;
61  case SCIP_NOFILE:
62  SCIPmessageFPrintInfo(messagehdlr, file, "file not found error");
63  break;
65  SCIPmessageFPrintInfo(messagehdlr, file, "cannot create file");
66  break;
67  case SCIP_LPERROR:
68  SCIPmessageFPrintInfo(messagehdlr, file, "error in LP solver");
69  break;
70  case SCIP_NOPROBLEM:
71  SCIPmessageFPrintInfo(messagehdlr, file, "no problem exists");
72  break;
73  case SCIP_INVALIDCALL:
74  SCIPmessageFPrintInfo(messagehdlr, file, "method cannot be called at this time in solution process");
75  break;
76  case SCIP_INVALIDDATA:
77  SCIPmessageFPrintInfo(messagehdlr, file, "method cannot be called with this type of data");
78  break;
79  case SCIP_INVALIDRESULT:
80  SCIPmessageFPrintInfo(messagehdlr, file, "method returned an invalid result code");
81  break;
83  SCIPmessageFPrintInfo(messagehdlr, file, "a required plugin was not found");
84  break;
86  SCIPmessageFPrintInfo(messagehdlr, file, "the parameter with the given name was not found");
87  break;
89  SCIPmessageFPrintInfo(messagehdlr, file, "the parameter is not of the expected type");
90  break;
92  SCIPmessageFPrintInfo(messagehdlr, file, "the value is invalid for the given parameter");
93  break;
95  SCIPmessageFPrintInfo(messagehdlr, file, "the given key is already existing in table");
96  break;
97  case SCIP_MAXDEPTHLEVEL:
98  SCIPmessageFPrintInfo(messagehdlr, file, "maximal branching depth level exceeded");
99  break;
100  case SCIP_BRANCHERROR:
101  SCIPmessageFPrintInfo(messagehdlr, file, "branching could not be performed (e.g. too large values in variable domain)");
102  break;
103  case SCIP_NOTIMPLEMENTED:
104  SCIPmessageFPrintInfo(messagehdlr, file, "function not implemented");
105  break;
106  default:
107  SCIPmessageFPrintInfo(messagehdlr, file, "unknown error code");
108  break;
109  }
110 }
111 
112 /** prints error message for return code via error message */
114  SCIP_RETCODE retcode /**< SCIP return code causing the error */
115  )
116 {
117  switch( retcode )
118  {
119  case SCIP_OKAY:
120  SCIPmessagePrintError("normal termination");
121  break;
122  case SCIP_ERROR:
123  SCIPmessagePrintError("unspecified error");
124  break;
125  case SCIP_NOMEMORY:
126  SCIPmessagePrintError("insufficient memory error");
127  break;
128  case SCIP_READERROR:
129  SCIPmessagePrintError("read error");
130  break;
131  case SCIP_WRITEERROR:
132  SCIPmessagePrintError("write error");
133  break;
134  case SCIP_NOFILE:
135  SCIPmessagePrintError("file not found error");
136  break;
138  SCIPmessagePrintError("cannot create file");
139  break;
140  case SCIP_LPERROR:
141  SCIPmessagePrintError("error in LP solver");
142  break;
143  case SCIP_NOPROBLEM:
144  SCIPmessagePrintError("no problem exists");
145  break;
146  case SCIP_INVALIDCALL:
147  SCIPmessagePrintError("method cannot be called at this time in solution process");
148  break;
149  case SCIP_INVALIDDATA:
150  SCIPmessagePrintError("method cannot be called with this type of data");
151  break;
152  case SCIP_INVALIDRESULT:
153  SCIPmessagePrintError("method returned an invalid result code");
154  break;
155  case SCIP_PLUGINNOTFOUND:
156  SCIPmessagePrintError("a required plugin was not found");
157  break;
159  SCIPmessagePrintError("the parameter with the given name was not found");
160  break;
162  SCIPmessagePrintError("the parameter is not of the expected type");
163  break;
165  SCIPmessagePrintError("the value is invalid for the given parameter");
166  break;
168  SCIPmessagePrintError("the given key is already existing in table");
169  break;
170  case SCIP_MAXDEPTHLEVEL:
171  SCIPmessagePrintError("maximal branching depth level exceeded");
172  break;
173  case SCIP_BRANCHERROR:
174  SCIPmessagePrintError("branching could not be performed (e.g. too large values in variable domain)");
175  break;
176  case SCIP_NOTIMPLEMENTED:
177  SCIPmessagePrintError("function not implemented");
178  break;
179  default:
180  SCIPmessagePrintError("unknown error code");
181  break;
182  }
183 }
enum SCIP_Retcode SCIP_RETCODE
Definition: type_retcode.h:63
void SCIPretcodePrint(SCIP_MESSAGEHDLR *messagehdlr, FILE *file, SCIP_RETCODE retcode)
Definition: retcode.c:38
void SCIPmessagePrintError(const char *formatstr,...)
Definition: message.c:791
void SCIPretcodePrintError(SCIP_RETCODE retcode)
Definition: retcode.c:113
internal methods for return codes for SCIP methods
void SCIPmessageFPrintInfo(SCIP_MESSAGEHDLR *messagehdlr, FILE *file, const char *formatstr,...)
Definition: message.c:618