Scippy

SCIP

Solving Constraint Integer Programs

relax.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-2017 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 email to scip@zib.de. */
13 /* */
14 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
15 
16 /**@file relax.h
17  * @ingroup INTERNALAPI
18  * @brief internal methods for relaxators
19  * @author Tobias Achterberg
20  */
21 
22 /*---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0----+----1----+----2*/
23 
24 #ifndef __SCIP_RELAX_H__
25 #define __SCIP_RELAX_H__
26 
27 
28 #include "scip/def.h"
29 #include "blockmemshell/memory.h"
30 #include "scip/type_primal.h"
31 #include "scip/type_retcode.h"
32 #include "scip/type_result.h"
33 #include "scip/type_set.h"
34 #include "scip/type_sol.h"
35 #include "scip/type_stat.h"
36 #include "scip/type_tree.h"
37 #include "scip/type_relax.h"
38 #include "scip/pub_relax.h"
39 
40 #ifdef __cplusplus
41 extern "C" {
42 #endif
43 
44 /** copies the given relaxator to a new scip */
45 extern
47  SCIP_RELAX* relax, /**< relaxator */
48  SCIP_SET* set /**< SCIP_SET of SCIP to copy to */
49  );
50 
51 /** creates a relaxator */
52 extern
54  SCIP_RELAX** relax, /**< pointer to relaxator data structure */
55  SCIP_SET* set, /**< global SCIP settings */
56  SCIP_MESSAGEHDLR* messagehdlr, /**< message handler */
57  BMS_BLKMEM* blkmem, /**< block memory for parameter settings */
58  const char* name, /**< name of relaxator */
59  const char* desc, /**< description of relaxator */
60  int priority, /**< priority of the relaxator (negative: after LP, non-negative: before LP) */
61  int freq, /**< frequency for calling relaxator */
62  SCIP_Bool includeslp, /**< Does the relaxator contain all cuts in the LP? */
63  SCIP_DECL_RELAXCOPY ((*relaxcopy)), /**< copy method of relaxator or NULL if you don't want to copy your plugin into sub-SCIPs */
64  SCIP_DECL_RELAXFREE ((*relaxfree)), /**< destructor of relaxator */
65  SCIP_DECL_RELAXINIT ((*relaxinit)), /**< initialize relaxator */
66  SCIP_DECL_RELAXEXIT ((*relaxexit)), /**< deinitialize relaxator */
67  SCIP_DECL_RELAXINITSOL((*relaxinitsol)), /**< solving process initialization method of relaxator */
68  SCIP_DECL_RELAXEXITSOL((*relaxexitsol)), /**< solving process deinitialization method of relaxator */
69  SCIP_DECL_RELAXEXEC ((*relaxexec)), /**< execution method of relaxator */
70  SCIP_RELAXDATA* relaxdata /**< relaxator data */
71  );
72 
73 /** calls destructor and frees memory of relaxator */
74 extern
76  SCIP_RELAX** relax, /**< pointer to relaxator data structure */
77  SCIP_SET* set /**< global SCIP settings */
78  );
79 
80 /** initializes relaxator */
81 extern
83  SCIP_RELAX* relax, /**< relaxator */
84  SCIP_SET* set /**< global SCIP settings */
85  );
86 
87 /** calls exit method of relaxator */
88 extern
90  SCIP_RELAX* relax, /**< relaxator */
91  SCIP_SET* set /**< global SCIP settings */
92  );
93 
94 /** informs relaxator that the branch and bound process is being started */
95 extern
97  SCIP_RELAX* relax, /**< relaxator */
98  SCIP_SET* set /**< global SCIP settings */
99  );
100 
101 /** informs relaxator that the branch and bound process data is being freed */
102 extern
104  SCIP_RELAX* relax, /**< relaxator */
105  SCIP_SET* set /**< global SCIP settings */
106  );
107 
108 /** calls execution method of relaxator */
109 extern
111  SCIP_RELAX* relax, /**< relaxator */
112  SCIP_SET* set, /**< global SCIP settings */
113  SCIP_STAT* stat, /**< dynamic problem statistics */
114  int depth, /**< depth of current node */
115  SCIP_Real* lowerbound, /**< pointer to lower bound computed by the relaxator */
116  SCIP_RESULT* result /**< pointer to store the result of the callback method */
117  );
118 
119 /** sets priority of relaxator */
120 extern
122  SCIP_RELAX* relax, /**< relaxator */
123  SCIP_SET* set, /**< global SCIP settings */
124  int priority /**< new priority of the relaxator */
125  );
126 
127 /** set copy callback of relaxation handler */
128 extern
129 void SCIPrelaxSetCopy(
130  SCIP_RELAX* relax, /**< relaxation handler */
131  SCIP_DECL_RELAXCOPY ((*relaxcopy)) /**< copy method of relaxation handler */
132  );
133 
134 /** set destructor callback of relaxation handler */
135 extern
136 void SCIPrelaxSetFree(
137  SCIP_RELAX* relax, /**< relaxation handler */
138  SCIP_DECL_RELAXFREE ((*relaxfree)) /**< destructor of relaxation handler */
139  );
140 
141 /** set initialization callback of relaxation handler */
142 extern
143 void SCIPrelaxSetInit(
144  SCIP_RELAX* relax, /**< relaxation handler */
145  SCIP_DECL_RELAXINIT ((*relaxinit)) /**< initialize relaxation handler */
146  );
147 
148 /** set deinitialization callback of relaxation handler */
149 extern
150 void SCIPrelaxSetExit(
151  SCIP_RELAX* relax, /**< relaxation handler */
152  SCIP_DECL_RELAXEXIT ((*relaxexit)) /**< deinitialize relaxation handler */
153  );
154 
155 /** set solving process initialization callback of relaxation handler */
156 extern
158  SCIP_RELAX* relax, /**< relaxation handler */
159  SCIP_DECL_RELAXINITSOL((*relaxinitsol)) /**< solving process initialization method of relaxation handler */
160  );
161 
162 /** set solving process deinitialization callback of relaxation handler */
163 extern
165  SCIP_RELAX* relax, /**< relaxation handler */
166  SCIP_DECL_RELAXEXITSOL((*relaxexitsol)) /**< solving process deinitialization callback relaxation handler */
167  );
168 
169 /** returns whether the relaxation was completely solved at the current node */
170 extern
172  SCIP_RELAX* relax, /**< relaxator */
173  SCIP_STAT* stat /**< dynamic problem statistics */
174  );
175 
176 /*
177  * methods for the global relaxation data
178  */
179 
180 /** enables or disables all clocks of \p relax, depending on the value of the flag */
181 extern
183  SCIP_RELAX* relax, /**< the relaxation handler for which all clocks should be enabled or disabled */
184  SCIP_Bool enable /**< should the clocks of the relaxation handler be enabled? */
185  );
186 
187 /** creates global relaxation data */
188 extern
190  SCIP_RELAXATION** relaxation, /**< global relaxation data */
191  BMS_BLKMEM* blkmem, /**< block memory */
192  SCIP_SET* set, /**< global SCIP settings */
193  SCIP_STAT* stat, /**< problem statistics data */
194  SCIP_PRIMAL* primal, /**< primal data */
195  SCIP_TREE* tree /**< branch and bound tree */
196  );
197 
198 /** frees global relaxation data */
199 extern
201  SCIP_RELAXATION** relaxation, /**< global relaxation data */
202  BMS_BLKMEM* blkmem, /**< block memory */
203  SCIP_PRIMAL* primal /**< primal data */
204  );
205 
206 /** sets the relaxsolzero flag in the relaxation data to the given value */
207 extern
209  SCIP_RELAXATION* relaxation, /**< global relaxation data */
210  SCIP_Bool iszero /**< are all values of the relaxation solution set to zero? */
211  );
212 
213 /** returns whether the global relaxation solution is cleared and all values are set to zero */
214 extern
216  SCIP_RELAXATION* relaxation /**< global relaxation data */
217  );
218 
219 /** sets the relaxsolvalid flag in the relaxation data to the given value */
220 extern
222  SCIP_RELAXATION* relaxation, /**< global relaxation data */
223  SCIP_Bool isvalid /**< is the stored solution valid? */
224  );
225 
226 /** returns whether the global relaxation solution is valid */
227 extern
229  SCIP_RELAXATION* relaxation /**< global relaxation data */
230  );
231 
232 /** sets the objective value of the global relaxation solution */
233 extern
235  SCIP_RELAXATION* relaxation, /**< global relaxation data */
236  SCIP_Real obj /**< objective value */
237  );
238 
239 /** returns the objective value of the global relaxation solution w.r.t. the transformed problem */
240 extern
242  SCIP_RELAXATION* relaxation /**< global relaxation data */
243  );
244 
245 /** adds the given value to the global relaxation solution's objective value */
246 extern
248  SCIP_RELAXATION* relaxation, /**< global relaxation data */
249  SCIP_Real val /**< value to add to the objective value */
250  );
251 
252 /** gets pointer to best relaxation solution */
253 extern
255  SCIP_RELAXATION* relaxation /**< global relaxation data */
256  );
257 
258 /** sets the objective value of the best relaxation solution */
259 extern
261  SCIP_RELAXATION* relaxation, /**< global relaxation data */
262  SCIP_Real obj /**< objective value of best relaxation solution */
263  );
264 
265 /** returns the objective value of the best relaxation solution */
266 extern
268  SCIP_RELAXATION* relaxation /**< global relaxation data */
269  );
270 
271 /** updates objective value of current relaxation solution after change of objective coefficient */
272 extern
274  SCIP_RELAXATION* relaxation, /**< global relaxation data */
275  SCIP_SET* set, /**< global SCIP settings */
276  SCIP_VAR* var, /**< variable with changed objective coefficient */
277  SCIP_Real oldobj, /**< old objective coefficient */
278  SCIP_Real newobj /**< new objective coefficient */
279  );
280 
281 #ifdef __cplusplus
282 }
283 #endif
284 
285 #endif
enum SCIP_Result SCIP_RESULT
Definition: type_result.h:52
#define SCIP_DECL_RELAXFREE(x)
Definition: type_relax.h:55
SCIP_RETCODE SCIPrelaxCreate(SCIP_RELAX **relax, SCIP_SET *set, SCIP_MESSAGEHDLR *messagehdlr, BMS_BLKMEM *blkmem, const char *name, const char *desc, int priority, int freq, SCIP_Bool includeslp, SCIP_DECL_RELAXCOPY((*relaxcopy)), SCIP_DECL_RELAXFREE((*relaxfree)), SCIP_DECL_RELAXINIT((*relaxinit)), SCIP_DECL_RELAXEXIT((*relaxexit)), SCIP_DECL_RELAXINITSOL((*relaxinitsol)), SCIP_DECL_RELAXEXITSOL((*relaxexitsol)), SCIP_DECL_RELAXEXEC((*relaxexec)), SCIP_RELAXDATA *relaxdata)
Definition: relax.c:89
void SCIPrelaxSetExit(SCIP_RELAX *relax, SCIP_DECL_RELAXEXIT((*relaxexit)))
Definition: relax.c:413
SCIP_RETCODE SCIPrelaxInit(SCIP_RELAX *relax, SCIP_SET *set)
Definition: relax.c:179
SCIP_Real SCIPrelaxationGetBestRelaxSolObj(SCIP_RELAXATION *relaxation)
Definition: relax.c:738
void SCIPrelaxationUpdateVarObj(SCIP_RELAXATION *relaxation, SCIP_SET *set, SCIP_VAR *var, SCIP_Real oldobj, SCIP_Real newobj)
Definition: relax.c:748
void SCIPrelaxSetInit(SCIP_RELAX *relax, SCIP_DECL_RELAXINIT((*relaxinit)))
Definition: relax.c:402
void SCIPrelaxSetPriority(SCIP_RELAX *relax, SCIP_SET *set, int priority)
Definition: relax.c:476
SCIP_RETCODE SCIPrelaxFree(SCIP_RELAX **relax, SCIP_SET *set)
Definition: relax.c:153
void SCIPrelaxationSetSolValid(SCIP_RELAXATION *relaxation, SCIP_Bool isvalid)
Definition: relax.c:664
#define SCIP_DECL_RELAXINIT(x)
Definition: type_relax.h:63
#define SCIP_DECL_RELAXINITSOL(x)
Definition: type_relax.h:82
void SCIPrelaxSetCopy(SCIP_RELAX *relax, SCIP_DECL_RELAXCOPY((*relaxcopy)))
Definition: relax.c:380
enum SCIP_Retcode SCIP_RETCODE
Definition: type_retcode.h:53
type definitions for global SCIP settings
SCIP_RETCODE SCIPrelaxExit(SCIP_RELAX *relax, SCIP_SET *set)
Definition: relax.c:217
type definitions for return codes for SCIP methods
SCIP_SOL * SCIPrelaxationGetBestRelaxSol(SCIP_RELAXATION *relaxation)
Definition: relax.c:717
SCIP_Bool SCIPrelaxationIsSolZero(SCIP_RELAXATION *relaxation)
Definition: relax.c:654
void SCIPrelaxationSetBestRelaxSolObj(SCIP_RELAXATION *relaxation, SCIP_Real obj)
Definition: relax.c:727
type definitions for problem statistics
SCIP_RETCODE SCIPrelaxCopyInclude(SCIP_RELAX *relax, SCIP_SET *set)
Definition: relax.c:71
SCIP_RETCODE SCIPrelaxationFree(SCIP_RELAXATION **relaxation, BMS_BLKMEM *blkmem, SCIP_PRIMAL *primal)
Definition: relax.c:627
SCIP_Bool SCIPrelaxationIsSolValid(SCIP_RELAXATION *relaxation)
Definition: relax.c:675
#define SCIP_DECL_RELAXEXIT(x)
Definition: type_relax.h:71
void SCIPrelaxSetFree(SCIP_RELAX *relax, SCIP_DECL_RELAXFREE((*relaxfree)))
Definition: relax.c:391
void SCIPrelaxSetExitsol(SCIP_RELAX *relax, SCIP_DECL_RELAXEXITSOL((*relaxexitsol)))
Definition: relax.c:435
SCIP_RETCODE SCIPrelaxInitsol(SCIP_RELAX *relax, SCIP_SET *set)
Definition: relax.c:247
#define SCIP_DECL_RELAXCOPY(x)
Definition: type_relax.h:47
type definitions for relaxators
void SCIPrelaxationSetSolObj(SCIP_RELAXATION *relaxation, SCIP_Real obj)
Definition: relax.c:685
SCIP_Bool SCIPrelaxIsSolved(SCIP_RELAX *relax, SCIP_STAT *stat)
Definition: relax.c:573
#define SCIP_Bool
Definition: def.h:61
SCIP_RETCODE SCIPrelaxationCreate(SCIP_RELAXATION **relaxation, BMS_BLKMEM *blkmem, SCIP_SET *set, SCIP_STAT *stat, SCIP_PRIMAL *primal, SCIP_TREE *tree)
Definition: relax.c:599
type definitions for branch and bound tree
void SCIPrelaxSetInitsol(SCIP_RELAX *relax, SCIP_DECL_RELAXINITSOL((*relaxinitsol)))
Definition: relax.c:424
void SCIPrelaxEnableOrDisableClocks(SCIP_RELAX *relax, SCIP_Bool enable)
Definition: relax.c:510
type definitions for storing primal CIP solutions
struct SCIP_RelaxData SCIP_RELAXDATA
Definition: type_relax.h:38
#define SCIP_DECL_RELAXEXEC(x)
Definition: type_relax.h:118
SCIP_RETCODE SCIPrelaxExitsol(SCIP_RELAX *relax, SCIP_SET *set)
Definition: relax.c:271
void SCIPrelaxationSetSolZero(SCIP_RELAXATION *relaxation, SCIP_Bool iszero)
Definition: relax.c:643
#define SCIP_Real
Definition: def.h:135
public methods for relaxation handlers
result codes for SCIP callback methods
void SCIPrelaxationSolObjAdd(SCIP_RELAXATION *relaxation, SCIP_Real val)
Definition: relax.c:706
#define SCIP_DECL_RELAXEXITSOL(x)
Definition: type_relax.h:93
type definitions for collecting primal CIP solutions and primal informations
common defines and data types used in all packages of SCIP
struct BMS_BlkMem BMS_BLKMEM
Definition: memory.h:392
SCIP_Real SCIPrelaxationGetSolObj(SCIP_RELAXATION *relaxation)
Definition: relax.c:696
SCIP_RETCODE SCIPrelaxExec(SCIP_RELAX *relax, SCIP_SET *set, SCIP_STAT *stat, int depth, SCIP_Real *lowerbound, SCIP_RESULT *result)
Definition: relax.c:295
memory allocation routines