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-2018 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_DECL_RELAXCOPY ((*relaxcopy)), /**< copy method of relaxator or NULL if you don't want to copy your plugin into sub-SCIPs */
63  SCIP_DECL_RELAXFREE ((*relaxfree)), /**< destructor of relaxator */
64  SCIP_DECL_RELAXINIT ((*relaxinit)), /**< initialize relaxator */
65  SCIP_DECL_RELAXEXIT ((*relaxexit)), /**< deinitialize relaxator */
66  SCIP_DECL_RELAXINITSOL((*relaxinitsol)), /**< solving process initialization method of relaxator */
67  SCIP_DECL_RELAXEXITSOL((*relaxexitsol)), /**< solving process deinitialization method of relaxator */
68  SCIP_DECL_RELAXEXEC ((*relaxexec)), /**< execution method of relaxator */
69  SCIP_RELAXDATA* relaxdata /**< relaxator data */
70  );
71 
72 /** calls destructor and frees memory of relaxator */
73 extern
75  SCIP_RELAX** relax, /**< pointer to relaxator data structure */
76  SCIP_SET* set /**< global SCIP settings */
77  );
78 
79 /** initializes relaxator */
80 extern
82  SCIP_RELAX* relax, /**< relaxator */
83  SCIP_SET* set /**< global SCIP settings */
84  );
85 
86 /** calls exit method of relaxator */
87 extern
89  SCIP_RELAX* relax, /**< relaxator */
90  SCIP_SET* set /**< global SCIP settings */
91  );
92 
93 /** informs relaxator that the branch and bound process is being started */
94 extern
96  SCIP_RELAX* relax, /**< relaxator */
97  SCIP_SET* set /**< global SCIP settings */
98  );
99 
100 /** informs relaxator that the branch and bound process data is being freed */
101 extern
103  SCIP_RELAX* relax, /**< relaxator */
104  SCIP_SET* set /**< global SCIP settings */
105  );
106 
107 /** calls execution method of relaxator */
108 extern
110  SCIP_RELAX* relax, /**< relaxator */
111  SCIP_SET* set, /**< global SCIP settings */
112  SCIP_STAT* stat, /**< dynamic problem statistics */
113  int depth, /**< depth of current node */
114  SCIP_Real* lowerbound, /**< pointer to lower bound computed by the relaxator */
115  SCIP_RESULT* result /**< pointer to store the result of the callback method */
116  );
117 
118 /** sets priority of relaxator */
119 extern
121  SCIP_RELAX* relax, /**< relaxator */
122  SCIP_SET* set, /**< global SCIP settings */
123  int priority /**< new priority of the relaxator */
124  );
125 
126 /** set copy callback of relaxation handler */
127 extern
128 void SCIPrelaxSetCopy(
129  SCIP_RELAX* relax, /**< relaxation handler */
130  SCIP_DECL_RELAXCOPY ((*relaxcopy)) /**< copy method of relaxation handler */
131  );
132 
133 /** set destructor callback of relaxation handler */
134 extern
135 void SCIPrelaxSetFree(
136  SCIP_RELAX* relax, /**< relaxation handler */
137  SCIP_DECL_RELAXFREE ((*relaxfree)) /**< destructor of relaxation handler */
138  );
139 
140 /** set initialization callback of relaxation handler */
141 extern
142 void SCIPrelaxSetInit(
143  SCIP_RELAX* relax, /**< relaxation handler */
144  SCIP_DECL_RELAXINIT ((*relaxinit)) /**< initialize relaxation handler */
145  );
146 
147 /** set deinitialization callback of relaxation handler */
148 extern
149 void SCIPrelaxSetExit(
150  SCIP_RELAX* relax, /**< relaxation handler */
151  SCIP_DECL_RELAXEXIT ((*relaxexit)) /**< deinitialize relaxation handler */
152  );
153 
154 /** set solving process initialization callback of relaxation handler */
155 extern
157  SCIP_RELAX* relax, /**< relaxation handler */
158  SCIP_DECL_RELAXINITSOL((*relaxinitsol)) /**< solving process initialization method of relaxation handler */
159  );
160 
161 /** set solving process deinitialization callback of relaxation handler */
162 extern
164  SCIP_RELAX* relax, /**< relaxation handler */
165  SCIP_DECL_RELAXEXITSOL((*relaxexitsol)) /**< solving process deinitialization callback relaxation handler */
166  );
167 
168 /** returns whether the relaxation was completely solved at the current node */
169 extern
171  SCIP_RELAX* relax, /**< relaxator */
172  SCIP_STAT* stat /**< dynamic problem statistics */
173  );
174 
175 /*
176  * methods for the global relaxation data
177  */
178 
179 /** enables or disables all clocks of \p relax, depending on the value of the flag */
180 extern
182  SCIP_RELAX* relax, /**< the relaxation handler for which all clocks should be enabled or disabled */
183  SCIP_Bool enable /**< should the clocks of the relaxation handler be enabled? */
184  );
185 
186 /** creates global relaxation data */
187 extern
189  SCIP_RELAXATION** relaxation, /**< global relaxation data */
190  BMS_BLKMEM* blkmem, /**< block memory */
191  SCIP_SET* set, /**< global SCIP settings */
192  SCIP_STAT* stat, /**< problem statistics data */
193  SCIP_PRIMAL* primal, /**< primal data */
194  SCIP_TREE* tree /**< branch and bound tree */
195  );
196 
197 /** frees global relaxation data */
198 extern
200  SCIP_RELAXATION** relaxation /**< global relaxation data */
201  );
202 
203 /** sets the relaxsolzero flag in the relaxation data to the given value */
204 extern
206  SCIP_RELAXATION* relaxation, /**< global relaxation data */
207  SCIP_Bool iszero /**< are all values of the relaxation solution set to zero? */
208  );
209 
210 /** returns whether the global relaxation solution is cleared and all values are set to zero */
211 extern
213  SCIP_RELAXATION* relaxation /**< global relaxation data */
214  );
215 
216 /** sets the relaxsolvalid and includeslp flags in the relaxation data to the given values */
217 extern
219  SCIP_RELAXATION* relaxation, /**< global relaxation data */
220  SCIP_Bool isvalid, /**< is the stored solution valid? */
221  SCIP_Bool includeslp /**< does the relaxator contain all cuts in the LP? */
222  );
223 
224 /** returns whether the global relaxation solution is valid */
225 extern
227  SCIP_RELAXATION* relaxation /**< global relaxation data */
228  );
229 
230 /** returns whether the global relaxation solution was computed by a relaxator which included all LP cuts */
231 extern
233  SCIP_RELAXATION* relaxation /**< global relaxation data */
234  );
235 
236 /** sets the objective value of the global relaxation solution */
237 extern
239  SCIP_RELAXATION* relaxation, /**< global relaxation data */
240  SCIP_Real obj /**< objective value */
241  );
242 
243 /** returns the objective value of the global relaxation solution w.r.t. the transformed problem */
244 extern
246  SCIP_RELAXATION* relaxation /**< global relaxation data */
247  );
248 
249 /** adds the given value to the global relaxation solution's objective value */
250 extern
252  SCIP_RELAXATION* relaxation, /**< global relaxation data */
253  SCIP_Real val /**< value to add to the objective value */
254  );
255 
256 /** updates objective value of current relaxation solution after change of objective coefficient */
257 extern
259  SCIP_RELAXATION* relaxation, /**< global relaxation data */
260  SCIP_SET* set, /**< global SCIP settings */
261  SCIP_VAR* var, /**< variable with changed objective coefficient */
262  SCIP_Real oldobj, /**< old objective coefficient */
263  SCIP_Real newobj /**< new objective coefficient */
264  );
265 
266 #ifdef __cplusplus
267 }
268 #endif
269 
270 #endif
enum SCIP_Result SCIP_RESULT
Definition: type_result.h:52
#define SCIP_DECL_RELAXFREE(x)
Definition: type_relax.h:55
void SCIPrelaxSetExit(SCIP_RELAX *relax, SCIP_DECL_RELAXEXIT((*relaxexit)))
Definition: relax.c:411
SCIP_RETCODE SCIPrelaxInit(SCIP_RELAX *relax, SCIP_SET *set)
Definition: relax.c:177
void SCIPrelaxationSetSolValid(SCIP_RELAXATION *relaxation, SCIP_Bool isvalid, SCIP_Bool includeslp)
Definition: relax.c:636
void SCIPrelaxationUpdateVarObj(SCIP_RELAXATION *relaxation, SCIP_SET *set, SCIP_VAR *var, SCIP_Real oldobj, SCIP_Real newobj)
Definition: relax.c:701
void SCIPrelaxSetInit(SCIP_RELAX *relax, SCIP_DECL_RELAXINIT((*relaxinit)))
Definition: relax.c:400
void SCIPrelaxSetPriority(SCIP_RELAX *relax, SCIP_SET *set, int priority)
Definition: relax.c:474
SCIP_RETCODE SCIPrelaxFree(SCIP_RELAX **relax, SCIP_SET *set)
Definition: relax.c:151
SCIP_Bool SCIPrelaxationIsLpIncludedForSol(SCIP_RELAXATION *relaxation)
Definition: relax.c:659
#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:378
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:215
type definitions for return codes for SCIP methods
SCIP_Bool SCIPrelaxationIsSolZero(SCIP_RELAXATION *relaxation)
Definition: relax.c:626
type definitions for problem statistics
SCIP_RETCODE SCIPrelaxCopyInclude(SCIP_RELAX *relax, SCIP_SET *set)
Definition: relax.c:71
SCIP_Bool SCIPrelaxationIsSolValid(SCIP_RELAXATION *relaxation)
Definition: relax.c:649
#define SCIP_DECL_RELAXEXIT(x)
Definition: type_relax.h:71
void SCIPrelaxSetFree(SCIP_RELAX *relax, SCIP_DECL_RELAXFREE((*relaxfree)))
Definition: relax.c:389
void SCIPrelaxSetExitsol(SCIP_RELAX *relax, SCIP_DECL_RELAXEXITSOL((*relaxexitsol)))
Definition: relax.c:433
SCIP_RETCODE SCIPrelaxInitsol(SCIP_RELAX *relax, SCIP_SET *set)
Definition: relax.c:245
#define SCIP_DECL_RELAXCOPY(x)
Definition: type_relax.h:47
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_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
type definitions for relaxators
SCIP_RETCODE SCIPrelaxationFree(SCIP_RELAXATION **relaxation)
Definition: relax.c:603
void SCIPrelaxationSetSolObj(SCIP_RELAXATION *relaxation, SCIP_Real obj)
Definition: relax.c:669
SCIP_Bool SCIPrelaxIsSolved(SCIP_RELAX *relax, SCIP_STAT *stat)
Definition: relax.c:550
#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:576
type definitions for branch and bound tree
void SCIPrelaxSetInitsol(SCIP_RELAX *relax, SCIP_DECL_RELAXINITSOL((*relaxinitsol)))
Definition: relax.c:422
void SCIPrelaxEnableOrDisableClocks(SCIP_RELAX *relax, SCIP_Bool enable)
Definition: relax.c:508
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:269
void SCIPrelaxationSetSolZero(SCIP_RELAXATION *relaxation, SCIP_Bool iszero)
Definition: relax.c:615
#define SCIP_Real
Definition: def.h:149
public methods for relaxation handlers
result codes for SCIP callback methods
void SCIPrelaxationSolObjAdd(SCIP_RELAXATION *relaxation, SCIP_Real val)
Definition: relax.c:690
#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:419
SCIP_Real SCIPrelaxationGetSolObj(SCIP_RELAXATION *relaxation)
Definition: relax.c:680
SCIP_RETCODE SCIPrelaxExec(SCIP_RELAX *relax, SCIP_SET *set, SCIP_STAT *stat, int depth, SCIP_Real *lowerbound, SCIP_RESULT *result)
Definition: relax.c:293
memory allocation routines