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   relax_xyz.c
17  * @ingroup OTHER_CFILES
18  * @brief  xyz relaxator
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/relax_xyz.h"
27 
28 
29 #define RELAX_NAME             "xyz"
30 #define RELAX_DESC             "relaxator template"
31 #define RELAX_PRIORITY         0
32 #define RELAX_FREQ             1
33 
34 
35 
36 
37 /*
38  * Data structures
39  */
40 
41 /* TODO: fill in the necessary relaxator data */
42 
43 /** relaxator data */
44 struct SCIP_RelaxData
45 {
46 };
47 
48 
49 
50 
51 /*
52  * Local methods
53  */
54 
55 /* put your local methods here, and declare them static */
56 
57 
58 
59 
60 /*
61  * Callback methods of relaxator
62  */
63 
64 /* TODO: Implement all necessary relaxator methods. The methods with an #if 0 ... #else #define ... are optional */
65 
66 /** copy method for relaxator plugins (called when SCIP copies plugins) */
67 #if 0
68 static
69 SCIP_DECL_RELAXCOPY(relaxCopyXyz)
70 {  /*lint --e{715}*/
71    SCIPerrorMessage("method of xyz relaxator not implemented yet\n");
72    SCIPABORT(); /*lint --e{527}*/
73 
74    return SCIP_OKAY;
75 }
76 #else
77 #define relaxCopyXyz NULL
78 #endif
79 
80 /** destructor of relaxator to free user data (called when SCIP is exiting) */
81 #if 0
82 static
83 SCIP_DECL_RELAXFREE(relaxFreeXyz)
84 {  /*lint --e{715}*/
85    SCIPerrorMessage("method of xyz relaxator not implemented yet\n");
86    SCIPABORT(); /*lint --e{527}*/
87 
88    return SCIP_OKAY;
89 }
90 #else
91 #define relaxFreeXyz NULL
92 #endif
93 
94 
95 /** initialization method of relaxator (called after problem was transformed) */
96 #if 0
97 static
98 SCIP_DECL_RELAXINIT(relaxInitXyz)
99 {  /*lint --e{715}*/
100    SCIPerrorMessage("method of xyz relaxator not implemented yet\n");
101    SCIPABORT(); /*lint --e{527}*/
102 
103    return SCIP_OKAY;
104 }
105 #else
106 #define relaxInitXyz NULL
107 #endif
108 
109 
110 /** deinitialization method of relaxator (called before transformed problem is freed) */
111 #if 0
112 static
113 SCIP_DECL_RELAXEXIT(relaxExitXyz)
114 {  /*lint --e{715}*/
115    SCIPerrorMessage("method of xyz relaxator not implemented yet\n");
116    SCIPABORT(); /*lint --e{527}*/
117 
118    return SCIP_OKAY;
119 }
120 #else
121 #define relaxExitXyz NULL
122 #endif
123 
124 
125 /** solving process initialization method of relaxator (called when branch and bound process is about to begin) */
126 #if 0
127 static
128 SCIP_DECL_RELAXINITSOL(relaxInitsolXyz)
129 {  /*lint --e{715}*/
130    SCIPerrorMessage("method of xyz relaxator not implemented yet\n");
131    SCIPABORT(); /*lint --e{527}*/
132 
133    return SCIP_OKAY;
134 }
135 #else
136 #define relaxInitsolXyz NULL
137 #endif
138 
139 
140 /** solving process deinitialization method of relaxator (called before branch and bound process data is freed) */
141 #if 0
142 static
143 SCIP_DECL_RELAXEXITSOL(relaxExitsolXyz)
144 {  /*lint --e{715}*/
145    SCIPerrorMessage("method of xyz relaxator not implemented yet\n");
146    SCIPABORT(); /*lint --e{527}*/
147 
148    return SCIP_OKAY;
149 }
150 #else
151 #define relaxExitsolXyz NULL
152 #endif
153 
154 
155 /** execution method of relaxator */
156 static
SCIP_DECL_RELAXEXEC(relaxExecXyz)157 SCIP_DECL_RELAXEXEC(relaxExecXyz)
158 {  /*lint --e{715}*/
159    SCIPerrorMessage("method of xyz relaxator not implemented yet\n");
160    SCIPABORT(); /*lint --e{527}*/
161 
162    return SCIP_OKAY;
163 }
164 
165 
166 
167 
168 
169 /*
170  * relaxator specific interface methods
171  */
172 
173 /** creates the xyz relaxator and includes it in SCIP */
SCIPincludeRelaxXyz(SCIP * scip)174 SCIP_RETCODE SCIPincludeRelaxXyz(
175    SCIP*                 scip                /**< SCIP data structure */
176    )
177 {
178    SCIP_RELAXDATA* relaxdata;
179    SCIP_RELAX* relax;
180 
181    /* create xyz relaxator data */
182    relaxdata = NULL;
183    /* TODO: (optional) create relaxator specific data here */
184 
185    relax = NULL;
186 
187    /* include relaxator */
188 #if 0
189    /* use SCIPincludeRelax() if you want to set all callbacks explicitly and realize (by getting compiler errors) when
190     * new callbacks are added in future SCIP versions
191     */
192    SCIP_CALL( SCIPincludeRelax(scip, RELAX_NAME, RELAX_DESC, RELAX_PRIORITY, RELAX_FREQ, RELAX_INCLUDESLP,
193          relaxCopyXyz, relaxFreeXyz, relaxInitXyz, relaxExitXyz, relaxInitsolXyz, relaxExitsolXyz, relaxExecXyz,
194          relaxdata) );
195 #else
196    /* use SCIPincludeRelaxBasic() plus setter functions if you want to set callbacks one-by-one and your code should
197     * compile independent of new callbacks being added in future SCIP versions
198     */
199    SCIP_CALL( SCIPincludeRelaxBasic(scip, &relax, RELAX_NAME, RELAX_DESC, RELAX_PRIORITY, RELAX_FREQ,
200          relaxExecXyz, relaxdata) );
201 
202    assert(relax != NULL);
203 
204    /* set non fundamental callbacks via setter functions */
205    SCIP_CALL( SCIPsetRelaxCopy(scip, relax, relaxCopyXyz) );
206    SCIP_CALL( SCIPsetRelaxFree(scip, relax, relaxFreeXyz) );
207    SCIP_CALL( SCIPsetRelaxInit(scip, relax, relaxInitXyz) );
208    SCIP_CALL( SCIPsetRelaxExit(scip, relax, relaxExitXyz) );
209    SCIP_CALL( SCIPsetRelaxInitsol(scip, relax, relaxInitsolXyz) );
210    SCIP_CALL( SCIPsetRelaxExitsol(scip, relax, relaxExitsolXyz) );
211 #endif
212 
213    /* add xyz relaxator parameters */
214    /* TODO: (optional) add relaxator specific parameters with SCIPaddTypeParam() here */
215 
216    return SCIP_OKAY;
217 }
218