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-2016 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  * @brief internal methods for relaxators
18  * @author Tobias Achterberg
19  */
20 
21 /*---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0----+----1----+----2*/
22 
23 #ifndef __SCIP_RELAX_H__
24 #define __SCIP_RELAX_H__
25 
26 
27 #include "scip/def.h"
28 #include "blockmemshell/memory.h"
29 #include "scip/type_retcode.h"
30 #include "scip/type_result.h"
31 #include "scip/type_set.h"
32 #include "scip/type_stat.h"
33 #include "scip/type_relax.h"
34 #include "scip/pub_relax.h"
35 
36 #ifdef __cplusplus
37 extern "C" {
38 #endif
39 
40 /** copies the given relaxator to a new scip */
41 extern
43  SCIP_RELAX* relax, /**< relaxator */
44  SCIP_SET* set /**< SCIP_SET of SCIP to copy to */
45  );
46 
47 /** creates a relaxator */
48 extern
50  SCIP_RELAX** relax, /**< pointer to relaxator data structure */
51  SCIP_SET* set, /**< global SCIP settings */
52  SCIP_MESSAGEHDLR* messagehdlr, /**< message handler */
53  BMS_BLKMEM* blkmem, /**< block memory for parameter settings */
54  const char* name, /**< name of relaxator */
55  const char* desc, /**< description of relaxator */
56  int priority, /**< priority of the relaxator (negative: after LP, non-negative: before LP) */
57  int freq, /**< frequency for calling relaxator */
58  SCIP_DECL_RELAXCOPY ((*relaxcopy)), /**< copy method of relaxator or NULL if you don't want to copy your plugin into sub-SCIPs */
59  SCIP_DECL_RELAXFREE ((*relaxfree)), /**< destructor of relaxator */
60  SCIP_DECL_RELAXINIT ((*relaxinit)), /**< initialize relaxator */
61  SCIP_DECL_RELAXEXIT ((*relaxexit)), /**< deinitialize relaxator */
62  SCIP_DECL_RELAXINITSOL((*relaxinitsol)), /**< solving process initialization method of relaxator */
63  SCIP_DECL_RELAXEXITSOL((*relaxexitsol)), /**< solving process deinitialization method of relaxator */
64  SCIP_DECL_RELAXEXEC ((*relaxexec)), /**< execution method of relaxator */
65  SCIP_RELAXDATA* relaxdata /**< relaxator data */
66  );
67 
68 /** calls destructor and frees memory of relaxator */
69 extern
71  SCIP_RELAX** relax, /**< pointer to relaxator data structure */
72  SCIP_SET* set /**< global SCIP settings */
73  );
74 
75 /** initializes relaxator */
76 extern
78  SCIP_RELAX* relax, /**< relaxator */
79  SCIP_SET* set /**< global SCIP settings */
80  );
81 
82 /** calls exit method of relaxator */
83 extern
85  SCIP_RELAX* relax, /**< relaxator */
86  SCIP_SET* set /**< global SCIP settings */
87  );
88 
89 /** informs relaxator that the branch and bound process is being started */
90 extern
92  SCIP_RELAX* relax, /**< relaxator */
93  SCIP_SET* set /**< global SCIP settings */
94  );
95 
96 /** informs relaxator that the branch and bound process data is being freed */
97 extern
99  SCIP_RELAX* relax, /**< relaxator */
100  SCIP_SET* set /**< global SCIP settings */
101  );
102 
103 /** calls execution method of relaxator */
104 extern
106  SCIP_RELAX* relax, /**< relaxator */
107  SCIP_SET* set, /**< global SCIP settings */
108  SCIP_STAT* stat, /**< dynamic problem statistics */
109  int depth, /**< depth of current node */
110  SCIP_Real* lowerbound, /**< pointer to lower bound computed by the relaxator */
111  SCIP_RESULT* result /**< pointer to store the result of the callback method */
112  );
113 
114 /** sets priority of relaxator */
115 extern
117  SCIP_RELAX* relax, /**< relaxator */
118  SCIP_SET* set, /**< global SCIP settings */
119  int priority /**< new priority of the relaxator */
120  );
121 
122 /** set copy callback of relaxation handler */
123 extern
124 void SCIPrelaxSetCopy(
125  SCIP_RELAX* relax, /**< relaxation handler */
126  SCIP_DECL_RELAXCOPY ((*relaxcopy)) /**< copy method of relaxation handler */
127  );
128 
129 /** set destructor callback of relaxation handler */
130 extern
131 void SCIPrelaxSetFree(
132  SCIP_RELAX* relax, /**< relaxation handler */
133  SCIP_DECL_RELAXFREE ((*relaxfree)) /**< destructor of relaxation handler */
134  );
135 
136 /** set initialization callback of relaxation handler */
137 extern
138 void SCIPrelaxSetInit(
139  SCIP_RELAX* relax, /**< relaxation handler */
140  SCIP_DECL_RELAXINIT ((*relaxinit)) /**< initialize relaxation handler */
141  );
142 
143 /** set deinitialization callback of relaxation handler */
144 extern
145 void SCIPrelaxSetExit(
146  SCIP_RELAX* relax, /**< relaxation handler */
147  SCIP_DECL_RELAXEXIT ((*relaxexit)) /**< deinitialize relaxation handler */
148  );
149 
150 /** set solving process initialization callback of relaxation handler */
151 extern
153  SCIP_RELAX* relax, /**< relaxation handler */
154  SCIP_DECL_RELAXINITSOL((*relaxinitsol)) /**< solving process initialization method of relaxation handler */
155  );
156 
157 /** set solving process deinitialization callback of relaxation handler */
158 extern
160  SCIP_RELAX* relax, /**< relaxation handler */
161  SCIP_DECL_RELAXEXITSOL((*relaxexitsol)) /**< solving process deinitialization callback relaxation handler */
162  );
163 
164 /** returns whether the relaxation was completely solved at the current node */
165 extern
167  SCIP_RELAX* relax, /**< relaxator */
168  SCIP_STAT* stat /**< dynamic problem statistics */
169  );
170 
171 /*
172  * methods for the global relaxation data
173  */
174 
175 /** enables or disables all clocks of \p relax, depending on the value of the flag */
176 extern
178  SCIP_RELAX* relax, /**< the relaxation handler for which all clocks should be enabled or disabled */
179  SCIP_Bool enable /**< should the clocks of the relaxation handler be enabled? */
180  );
181 
182 /** creates global relaxation data */
183 extern
185  SCIP_RELAXATION** relaxation /**< global relaxation data */
186  );
187 
188 /** frees global relaxation data */
189 extern
191  SCIP_RELAXATION** relaxation /**< global relaxation data */
192  );
193 
194 /** sets the relaxsolzero flag in the relaxation data to the given value */
195 extern
197  SCIP_RELAXATION* relaxation, /**< global relaxation data */
198  SCIP_Bool iszero /**< are all values of the relaxation solution set to zero? */
199  );
200 
201 /** returns whether the global relaxation solution is cleared and all values are set to zero */
202 extern
204  SCIP_RELAXATION* relaxation /**< global relaxation data */
205  );
206 
207 /** sets the relaxsolvalid flag in the relaxation data to the given value */
208 extern
210  SCIP_RELAXATION* relaxation, /**< global relaxation data */
211  SCIP_Bool isvalid /**< is the stored solution valid? */
212  );
213 
214 /** returns whether the global relaxation solution is valid */
215 extern
217  SCIP_RELAXATION* relaxation /**< global relaxation data */
218  );
219 
220 /** sets the objective value of the global relaxation solution */
221 extern
223  SCIP_RELAXATION* relaxation, /**< global relaxation data */
224  SCIP_Real obj /**< objective value */
225  );
226 
227 /** returns the objective value of the global relaxation solution w.r.t. the transformed problem */
228 extern
230  SCIP_RELAXATION* relaxation /**< global relaxation data */
231  );
232 
233 /** adds the given value to the global relaxation solution's objective value */
234 extern
236  SCIP_RELAXATION* relaxation, /**< global relaxation data */
237  SCIP_Real val /**< value to add to the objective value */
238  );
239 
240 #ifdef __cplusplus
241 }
242 #endif
243 
244 #endif
enum SCIP_Result SCIP_RESULT
Definition: type_result.h:51
#define SCIP_DECL_RELAXFREE(x)
Definition: type_relax.h:55
void SCIPrelaxSetExit(SCIP_RELAX *relax, SCIP_DECL_RELAXEXIT((*relaxexit)))
Definition: relax.c:408
SCIP_RETCODE SCIPrelaxInit(SCIP_RELAX *relax, SCIP_SET *set)
Definition: relax.c:175
void SCIPrelaxSetInit(SCIP_RELAX *relax, SCIP_DECL_RELAXINIT((*relaxinit)))
Definition: relax.c:397
void SCIPrelaxSetPriority(SCIP_RELAX *relax, SCIP_SET *set, int priority)
Definition: relax.c:471
SCIP_RETCODE SCIPrelaxFree(SCIP_RELAX **relax, SCIP_SET *set)
Definition: relax.c:149
void SCIPrelaxationSetSolValid(SCIP_RELAXATION *relaxation, SCIP_Bool isvalid)
Definition: relax.c:620
#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:375
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:213
type definitions for return codes for SCIP methods
SCIP_Bool SCIPrelaxationIsSolZero(SCIP_RELAXATION *relaxation)
Definition: relax.c:610
type definitions for problem statistics
SCIP_RETCODE SCIPrelaxCopyInclude(SCIP_RELAX *relax, SCIP_SET *set)
Definition: relax.c:69
SCIP_Bool SCIPrelaxationIsSolValid(SCIP_RELAXATION *relaxation)
Definition: relax.c:631
#define SCIP_DECL_RELAXEXIT(x)
Definition: type_relax.h:71
void SCIPrelaxSetFree(SCIP_RELAX *relax, SCIP_DECL_RELAXFREE((*relaxfree)))
Definition: relax.c:386
void SCIPrelaxSetExitsol(SCIP_RELAX *relax, SCIP_DECL_RELAXEXITSOL((*relaxexitsol)))
Definition: relax.c:430
SCIP_RETCODE SCIPrelaxInitsol(SCIP_RELAX *relax, SCIP_SET *set)
Definition: relax.c:243
SCIP_RETCODE SCIPrelaxationCreate(SCIP_RELAXATION **relaxation)
Definition: relax.c:573
#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:87
type definitions for relaxators
SCIP_RETCODE SCIPrelaxationFree(SCIP_RELAXATION **relaxation)
Definition: relax.c:587
void SCIPrelaxationSetSolObj(SCIP_RELAXATION *relaxation, SCIP_Real obj)
Definition: relax.c:641
SCIP_Bool SCIPrelaxIsSolved(SCIP_RELAX *relax, SCIP_STAT *stat)
Definition: relax.c:547
#define SCIP_Bool
Definition: def.h:53
void SCIPrelaxSetInitsol(SCIP_RELAX *relax, SCIP_DECL_RELAXINITSOL((*relaxinitsol)))
Definition: relax.c:419
void SCIPrelaxEnableOrDisableClocks(SCIP_RELAX *relax, SCIP_Bool enable)
Definition: relax.c:505
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:267
void SCIPrelaxationSetSolZero(SCIP_RELAXATION *relaxation, SCIP_Bool iszero)
Definition: relax.c:599
#define SCIP_Real
Definition: def.h:127
public methods for relaxation handlers
result codes for SCIP callback methods
void SCIPrelaxationSolObjAdd(SCIP_RELAXATION *relaxation, SCIP_Real val)
Definition: relax.c:662
#define SCIP_DECL_RELAXEXITSOL(x)
Definition: type_relax.h:93
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:652
SCIP_RETCODE SCIPrelaxExec(SCIP_RELAX *relax, SCIP_SET *set, SCIP_STAT *stat, int depth, SCIP_Real *lowerbound, SCIP_RESULT *result)
Definition: relax.c:291
memory allocation routines