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-2022 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.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_relax.h"
32 #include "scip/type_result.h"
33 #include "scip/type_retcode.h"
34 #include "scip/type_set.h"
35 #include "scip/type_sol.h"
36 #include "scip/type_stat.h"
37 #include "scip/type_tree.h"
38 #include "scip/type_var.h"
39 #include "scip/pub_relax.h"
40 
41 #ifdef __cplusplus
42 extern "C" {
43 #endif
44 
45 /** copies the given relaxator to a new scip */
47  SCIP_RELAX* relax, /**< relaxator */
48  SCIP_SET* set /**< SCIP_SET of SCIP to copy to */
49  );
50 
51 /** creates a relaxator */
53  SCIP_RELAX** relax, /**< pointer to relaxator data structure */
54  SCIP_SET* set, /**< global SCIP settings */
55  SCIP_MESSAGEHDLR* messagehdlr, /**< message handler */
56  BMS_BLKMEM* blkmem, /**< block memory for parameter settings */
57  const char* name, /**< name of relaxator */
58  const char* desc, /**< description of relaxator */
59  int priority, /**< priority of the relaxator (negative: after LP, non-negative: before LP) */
60  int freq, /**< frequency for calling relaxator */
61  SCIP_DECL_RELAXCOPY ((*relaxcopy)), /**< copy method of relaxator or NULL if you don't want to copy your plugin into sub-SCIPs */
62  SCIP_DECL_RELAXFREE ((*relaxfree)), /**< destructor of relaxator */
63  SCIP_DECL_RELAXINIT ((*relaxinit)), /**< initialize relaxator */
64  SCIP_DECL_RELAXEXIT ((*relaxexit)), /**< deinitialize relaxator */
65  SCIP_DECL_RELAXINITSOL((*relaxinitsol)), /**< solving process initialization method of relaxator */
66  SCIP_DECL_RELAXEXITSOL((*relaxexitsol)), /**< solving process deinitialization method of relaxator */
67  SCIP_DECL_RELAXEXEC ((*relaxexec)), /**< execution method of relaxator */
68  SCIP_RELAXDATA* relaxdata /**< relaxator data */
69  );
70 
71 /** calls destructor and frees memory of relaxator */
73  SCIP_RELAX** relax, /**< pointer to relaxator data structure */
74  SCIP_SET* set /**< global SCIP settings */
75  );
76 
77 /** initializes relaxator */
79  SCIP_RELAX* relax, /**< relaxator */
80  SCIP_SET* set /**< global SCIP settings */
81  );
82 
83 /** calls exit method of relaxator */
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 */
91  SCIP_RELAX* relax, /**< relaxator */
92  SCIP_SET* set /**< global SCIP settings */
93  );
94 
95 /** informs relaxator that the branch and bound process data is being freed */
97  SCIP_RELAX* relax, /**< relaxator */
98  SCIP_SET* set /**< global SCIP settings */
99  );
100 
101 /** calls execution method of relaxator */
103  SCIP_RELAX* relax, /**< relaxator */
104  SCIP_SET* set, /**< global SCIP settings */
105  SCIP_TREE* tree, /**< branch and bound tree */
106  SCIP_STAT* stat, /**< dynamic problem statistics */
107  int depth, /**< depth of current node */
108  SCIP_Real* lowerbound, /**< pointer to lower bound computed by the relaxator */
109  SCIP_RESULT* result /**< pointer to store the result of the callback method */
110  );
111 
112 /** sets priority of relaxator */
114  SCIP_RELAX* relax, /**< relaxator */
115  SCIP_SET* set, /**< global SCIP settings */
116  int priority /**< new priority of the relaxator */
117  );
118 
119 /** set copy callback of relaxation handler */
120 void SCIPrelaxSetCopy(
121  SCIP_RELAX* relax, /**< relaxation handler */
122  SCIP_DECL_RELAXCOPY ((*relaxcopy)) /**< copy method of relaxation handler */
123  );
124 
125 /** set destructor callback of relaxation handler */
126 void SCIPrelaxSetFree(
127  SCIP_RELAX* relax, /**< relaxation handler */
128  SCIP_DECL_RELAXFREE ((*relaxfree)) /**< destructor of relaxation handler */
129  );
130 
131 /** set initialization callback of relaxation handler */
132 void SCIPrelaxSetInit(
133  SCIP_RELAX* relax, /**< relaxation handler */
134  SCIP_DECL_RELAXINIT ((*relaxinit)) /**< initialize relaxation handler */
135  );
136 
137 /** set deinitialization callback of relaxation handler */
138 void SCIPrelaxSetExit(
139  SCIP_RELAX* relax, /**< relaxation handler */
140  SCIP_DECL_RELAXEXIT ((*relaxexit)) /**< deinitialize relaxation handler */
141  );
142 
143 /** set solving process initialization callback of relaxation handler */
145  SCIP_RELAX* relax, /**< relaxation handler */
146  SCIP_DECL_RELAXINITSOL((*relaxinitsol)) /**< solving process initialization method of relaxation handler */
147  );
148 
149 /** set solving process deinitialization callback of relaxation handler */
151  SCIP_RELAX* relax, /**< relaxation handler */
152  SCIP_DECL_RELAXEXITSOL((*relaxexitsol)) /**< solving process deinitialization callback relaxation handler */
153  );
154 
155 /** returns whether the relaxation was completely solved at the current node */
157  SCIP_RELAX* relax, /**< relaxator */
158  SCIP_STAT* stat /**< dynamic problem statistics */
159  );
160 
161 /*
162  * methods for the global relaxation data
163  */
164 
165 /** enables or disables all clocks of \p relax, depending on the value of the flag */
167  SCIP_RELAX* relax, /**< the relaxation handler for which all clocks should be enabled or disabled */
168  SCIP_Bool enable /**< should the clocks of the relaxation handler be enabled? */
169  );
170 
171 /** creates global relaxation data */
173  SCIP_RELAXATION** relaxation, /**< global relaxation data */
174  BMS_BLKMEM* blkmem, /**< block memory */
175  SCIP_SET* set, /**< global SCIP settings */
176  SCIP_STAT* stat, /**< problem statistics data */
177  SCIP_PRIMAL* primal, /**< primal data */
178  SCIP_TREE* tree /**< branch and bound tree */
179  );
180 
181 /** frees global relaxation data */
183  SCIP_RELAXATION** relaxation /**< global relaxation data */
184  );
185 
186 /** sets the relaxsolzero flag in the relaxation data to the given value */
188  SCIP_RELAXATION* relaxation, /**< global relaxation data */
189  SCIP_Bool iszero /**< are all values of the relaxation solution set to zero? */
190  );
191 
192 /** returns whether the global relaxation solution is cleared and all values are set to zero */
194  SCIP_RELAXATION* relaxation /**< global relaxation data */
195  );
196 
197 /** sets the relaxsolvalid and includeslp flags in the relaxation data to the given values */
199  SCIP_RELAXATION* relaxation, /**< global relaxation data */
200  SCIP_Bool isvalid, /**< is the stored solution valid? */
201  SCIP_Bool includeslp /**< does the relaxator contain all cuts in the LP? */
202  );
203 
204 /** returns whether the global relaxation solution is valid */
206  SCIP_RELAXATION* relaxation /**< global relaxation data */
207  );
208 
209 /** returns whether the global relaxation solution was computed by a relaxator which included all LP cuts */
211  SCIP_RELAXATION* relaxation /**< global relaxation data */
212  );
213 
214 /** sets the objective value of the global relaxation solution */
216  SCIP_RELAXATION* relaxation, /**< global relaxation data */
217  SCIP_Real obj /**< objective value */
218  );
219 
220 /** returns the objective value of the global relaxation solution w.r.t. the transformed problem */
222  SCIP_RELAXATION* relaxation /**< global relaxation data */
223  );
224 
225 /** adds the given value to the global relaxation solution's objective value */
227  SCIP_RELAXATION* relaxation, /**< global relaxation data */
228  SCIP_Real val /**< value to add to the objective value */
229  );
230 
231 /** updates objective value of current relaxation solution after change of objective coefficient */
233  SCIP_RELAXATION* relaxation, /**< global relaxation data */
234  SCIP_SET* set, /**< global SCIP settings */
235  SCIP_VAR* var, /**< variable with changed objective coefficient */
236  SCIP_Real oldobj, /**< old objective coefficient */
237  SCIP_Real newobj /**< new objective coefficient */
238  );
239 
240 /** store the most recent relaxation handler \p relax responsible for the solution */
242  SCIP_RELAXATION* relaxation, /**< global relaxation data */
243  SCIP_RELAX* relax /**< relaxation handler responsible for the most recent relaxation solution */
244  );
245 
246 /** returns the most recent relaxation handler responsible for the solution, or NULL if unspecified */
248  SCIP_RELAXATION* relaxation /**< global relaxation data */
249  );
250 
251 #ifdef __cplusplus
252 }
253 #endif
254 
255 #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:494
SCIP_RETCODE SCIPrelaxInit(SCIP_RELAX *relax, SCIP_SET *set)
Definition: relax.c:221
void SCIPrelaxationSetSolValid(SCIP_RELAXATION *relaxation, SCIP_Bool isvalid, SCIP_Bool includeslp)
Definition: relax.c:780
void SCIPrelaxationUpdateVarObj(SCIP_RELAXATION *relaxation, SCIP_SET *set, SCIP_VAR *var, SCIP_Real oldobj, SCIP_Real newobj)
Definition: relax.c:845
void SCIPrelaxSetInit(SCIP_RELAX *relax, SCIP_DECL_RELAXINIT((*relaxinit)))
Definition: relax.c:483
void SCIPrelaxSetPriority(SCIP_RELAX *relax, SCIP_SET *set, int priority)
Definition: relax.c:557
SCIP_RETCODE SCIPrelaxFree(SCIP_RELAX **relax, SCIP_SET *set)
Definition: relax.c:194
SCIP_Bool SCIPrelaxationIsLpIncludedForSol(SCIP_RELAXATION *relaxation)
Definition: relax.c:803
#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:461
enum SCIP_Retcode SCIP_RETCODE
Definition: type_retcode.h:54
SCIP_RELAX * SCIPrelaxationGetSolRelax(SCIP_RELAXATION *relaxation)
Definition: relax.c:876
type definitions for global SCIP settings
SCIP_RETCODE SCIPrelaxExit(SCIP_RELAX *relax, SCIP_SET *set)
Definition: relax.c:265
type definitions for return codes for SCIP methods
SCIP_Bool SCIPrelaxationIsSolZero(SCIP_RELAXATION *relaxation)
Definition: relax.c:770
type definitions for problem statistics
SCIP_RETCODE SCIPrelaxCopyInclude(SCIP_RELAX *relax, SCIP_SET *set)
Definition: relax.c:73
SCIP_Bool SCIPrelaxationIsSolValid(SCIP_RELAXATION *relaxation)
Definition: relax.c:793
#define SCIP_DECL_RELAXEXIT(x)
Definition: type_relax.h:71
void SCIPrelaxSetFree(SCIP_RELAX *relax, SCIP_DECL_RELAXFREE((*relaxfree)))
Definition: relax.c:472
void SCIPrelaxSetExitsol(SCIP_RELAX *relax, SCIP_DECL_RELAXEXITSOL((*relaxexitsol)))
Definition: relax.c:516
SCIP_RETCODE SCIPrelaxInitsol(SCIP_RELAX *relax, SCIP_SET *set)
Definition: relax.c:295
void SCIPrelaxationSetSolRelax(SCIP_RELAXATION *relaxation, SCIP_RELAX *relax)
Definition: relax.c:865
#define SCIP_DECL_RELAXCOPY(x)
Definition: type_relax.h:47
type definitions for problem variables
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:162
type definitions for relaxators
SCIP_RETCODE SCIPrelaxationFree(SCIP_RELAXATION **relaxation)
Definition: relax.c:747
void SCIPrelaxationSetSolObj(SCIP_RELAXATION *relaxation, SCIP_Real obj)
Definition: relax.c:813
SCIP_Bool SCIPrelaxIsSolved(SCIP_RELAX *relax, SCIP_STAT *stat)
Definition: relax.c:693
#define SCIP_Bool
Definition: def.h:84
SCIP_RETCODE SCIPrelaxationCreate(SCIP_RELAXATION **relaxation, BMS_BLKMEM *blkmem, SCIP_SET *set, SCIP_STAT *stat, SCIP_PRIMAL *primal, SCIP_TREE *tree)
Definition: relax.c:719
type definitions for branch and bound tree
void SCIPrelaxSetInitsol(SCIP_RELAX *relax, SCIP_DECL_RELAXINITSOL((*relaxinitsol)))
Definition: relax.c:505
void SCIPrelaxEnableOrDisableClocks(SCIP_RELAX *relax, SCIP_Bool enable)
Definition: relax.c:591
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 SCIPrelaxExec(SCIP_RELAX *relax, SCIP_SET *set, SCIP_TREE *tree, SCIP_STAT *stat, int depth, SCIP_Real *lowerbound, SCIP_RESULT *result)
Definition: relax.c:343
SCIP_RETCODE SCIPrelaxExitsol(SCIP_RELAX *relax, SCIP_SET *set)
Definition: relax.c:319
void SCIPrelaxationSetSolZero(SCIP_RELAXATION *relaxation, SCIP_Bool iszero)
Definition: relax.c:759
#define SCIP_Real
Definition: def.h:177
public methods for relaxation handlers
result codes for SCIP callback methods
void SCIPrelaxationSolObjAdd(SCIP_RELAXATION *relaxation, SCIP_Real val)
Definition: relax.c:834
#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:430
SCIP_Real SCIPrelaxationGetSolObj(SCIP_RELAXATION *relaxation)
Definition: relax.c:824
memory allocation routines