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 presol_xyz.c
17 * @ingroup DEFPLUGINS_PRESOL
18 * @brief xyz presolver
19 * @author Tobias Achterberg
20 */
21
22 /*---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0----+----1----+----2*/
23
24 #include <assert.h>
25
26 #include "scip/presol_xyz.h"
27
28
29 #define PRESOL_NAME "xyz"
30 #define PRESOL_DESC "presolver template"
31 #define PRESOL_PRIORITY 0 /**< priority of the presolver (>= 0: before, < 0: after constraint handlers); combined with propagators */
32 #define PRESOL_MAXROUNDS -1 /**< maximal number of presolving rounds the presolver participates in (-1: no limit) */
33 #define PRESOL_TIMING SCIP_PRESOLTIMING_MEDIUM /* timing of the presolver (fast, medium, or exhaustive) */
34
35
36 /*
37 * Data structures
38 */
39
40 /* TODO: fill in the necessary presolver data */
41
42 /** presolver data */
43 struct SCIP_PresolData
44 {
45 };
46
47
48 /*
49 * Local methods
50 */
51
52 /* put your local methods here, and declare them static */
53
54
55 /*
56 * Callback methods of presolver
57 */
58
59 /* TODO: Implement all necessary presolver methods. The methods with an #if 0 ... #else #define ... are optional */
60
61
62 /** copy method for constraint handler plugins (called when SCIP copies plugins) */
63 #if 0
64 static
65 SCIP_DECL_PRESOLCOPY(presolCopyXyz)
66 { /*lint --e{715}*/
67 SCIPerrorMessage("method of xyz presolver not implemented yet\n");
68 SCIPABORT(); /*lint --e{527}*/
69
70 return SCIP_OKAY;
71 }
72 #else
73 #define presolCopyXyz NULL
74 #endif
75
76
77 /** destructor of presolver to free user data (called when SCIP is exiting) */
78 #if 0
79 static
80 SCIP_DECL_PRESOLFREE(presolFreeXyz)
81 { /*lint --e{715}*/
82 SCIPerrorMessage("method of xyz presolver not implemented yet\n");
83 SCIPABORT(); /*lint --e{527}*/
84
85 return SCIP_OKAY;
86 }
87 #else
88 #define presolFreeXyz NULL
89 #endif
90
91
92 /** initialization method of presolver (called after problem was transformed) */
93 #if 0
94 static
95 SCIP_DECL_PRESOLINIT(presolInitXyz)
96 { /*lint --e{715}*/
97 SCIPerrorMessage("method of xyz presolver not implemented yet\n");
98 SCIPABORT(); /*lint --e{527}*/
99
100 return SCIP_OKAY;
101 }
102 #else
103 #define presolInitXyz NULL
104 #endif
105
106
107 /** deinitialization method of presolver (called before transformed problem is freed) */
108 #if 0
109 static
110 SCIP_DECL_PRESOLEXIT(presolExitXyz)
111 { /*lint --e{715}*/
112 SCIPerrorMessage("method of xyz presolver not implemented yet\n");
113 SCIPABORT(); /*lint --e{527}*/
114
115 return SCIP_OKAY;
116 }
117 #else
118 #define presolExitXyz NULL
119 #endif
120
121
122 /** presolving initialization method of presolver (called when presolving is about to begin) */
123 #if 0
124 static
125 SCIP_DECL_PRESOLINITPRE(presolInitpreXyz)
126 { /*lint --e{715}*/
127 SCIPerrorMessage("method of xyz presolver not implemented yet\n");
128 SCIPABORT(); /*lint --e{527}*/
129
130 return SCIP_OKAY;
131 }
132 #else
133 #define presolInitpreXyz NULL
134 #endif
135
136
137 /** presolving deinitialization method of presolver (called after presolving has been finished) */
138 #if 0
139 static
140 SCIP_DECL_PRESOLEXITPRE(presolExitpreXyz)
141 { /*lint --e{715}*/
142 SCIPerrorMessage("method of xyz presolver not implemented yet\n");
143 SCIPABORT(); /*lint --e{527}*/
144
145 return SCIP_OKAY;
146 }
147 #else
148 #define presolExitpreXyz NULL
149 #endif
150
151
152 /** execution method of presolver */
153 static
SCIP_DECL_PRESOLEXEC(presolExecXyz)154 SCIP_DECL_PRESOLEXEC(presolExecXyz)
155 { /*lint --e{715}*/
156 SCIPerrorMessage("method of xyz presolver not implemented yet\n");
157 SCIPABORT(); /*lint --e{527}*/
158
159 return SCIP_OKAY;
160 }
161
162
163 /*
164 * presolver specific interface methods
165 */
166
167 /** creates the xyz presolver and includes it in SCIP */
SCIPincludePresolXyz(SCIP * scip)168 SCIP_RETCODE SCIPincludePresolXyz(
169 SCIP* scip /**< SCIP data structure */
170 )
171 {
172 SCIP_PRESOLDATA* presoldata;
173 SCIP_PRESOL* presol;
174
175 /* create xyz presolver data */
176 presoldata = NULL;
177 /* TODO: (optional) create presolver specific data here */
178
179 presol = NULL;
180
181 /* include presolver */
182 #if 0
183 /* use SCIPincludePresol() if you want to set all callbacks explicitly and realize (by getting compiler errors) when
184 * new callbacks are added in future SCIP versions
185 */
186 SCIP_CALL( SCIPincludePresol(scip, PRESOL_NAME, PRESOL_DESC, PRESOL_PRIORITY, PRESOL_MAXROUNDS, PRESOL_TIMING,
187 presolCopyXyz, presolFreeXyz, presolInitXyz, presolExitXyz, presolInitpreXyz, presolExitpreXyz, presolExecXyz,
188 presoldata) );
189 #else
190 /* use SCIPincludePresolBasic() plus setter functions if you want to set callbacks one-by-one and your code should
191 * compile independent of new callbacks being added in future SCIP versions
192 */
193 SCIP_CALL( SCIPincludePresolBasic(scip, &presol, PRESOL_NAME, PRESOL_DESC, PRESOL_PRIORITY, PRESOL_MAXROUNDS, PRESOL_TIMING,
194 presolExecXyz,
195 presoldata) );
196
197 assert(presol != NULL);
198
199 /* set non fundamental callbacks via setter functions */
200 SCIP_CALL( SCIPsetPresolCopy(scip, presol, presolCopyXyz) );
201 SCIP_CALL( SCIPsetPresolFree(scip, presol, presolFreeXyz) );
202 SCIP_CALL( SCIPsetPresolInit(scip, presol, presolInitXyz) );
203 SCIP_CALL( SCIPsetPresolExit(scip, presol, presolExitXyz) );
204 SCIP_CALL( SCIPsetPresolInitpre(scip, presol, presolInitpreXyz) );
205 SCIP_CALL( SCIPsetPresolExitpre(scip, presol, presolExitpreXyz) );
206 #endif
207
208 /* add xyz presolver parameters */
209 /* TODO: (optional) add presolver specific parameters with SCIPaddTypeParam() here */
210
211 return SCIP_OKAY;
212 }
213