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-2019 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 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_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_STAT* stat, /**< dynamic problem statistics */
106  int depth, /**< depth of current node */
107  SCIP_Real* lowerbound, /**< pointer to lower bound computed by the relaxator */
108  SCIP_RESULT* result /**< pointer to store the result of the callback method */
109  );
110 
111 /** sets priority of relaxator */
113  SCIP_RELAX* relax, /**< relaxator */
114  SCIP_SET* set, /**< global SCIP settings */
115  int priority /**< new priority of the relaxator */
116  );
117 
118 /** set copy callback of relaxation handler */
119 void SCIPrelaxSetCopy(
120  SCIP_RELAX* relax, /**< relaxation handler */
121  SCIP_DECL_RELAXCOPY ((*relaxcopy)) /**< copy method of relaxation handler */
122  );
123 
124 /** set destructor callback of relaxation handler */
125 void SCIPrelaxSetFree(
126  SCIP_RELAX* relax, /**< relaxation handler */
127  SCIP_DECL_RELAXFREE ((*relaxfree)) /**< destructor of relaxation handler */
128  );
129 
130 /** set initialization callback of relaxation handler */
131 void SCIPrelaxSetInit(
132  SCIP_RELAX* relax, /**< relaxation handler */
133  SCIP_DECL_RELAXINIT ((*relaxinit)) /**< initialize relaxation handler */
134  );
135 
136 /** set deinitialization callback of relaxation handler */
137 void SCIPrelaxSetExit(
138  SCIP_RELAX* relax, /**< relaxation handler */
139  SCIP_DECL_RELAXEXIT ((*relaxexit)) /**< deinitialize relaxation handler */
140  );
141 
142 /** set solving process initialization callback of relaxation handler */
144  SCIP_RELAX* relax, /**< relaxation handler */
145  SCIP_DECL_RELAXINITSOL((*relaxinitsol)) /**< solving process initialization method of relaxation handler */
146  );
147 
148 /** set solving process deinitialization callback of relaxation handler */
150  SCIP_RELAX* relax, /**< relaxation handler */
151  SCIP_DECL_RELAXEXITSOL((*relaxexitsol)) /**< solving process deinitialization callback relaxation handler */
152  );
153 
154 /** returns whether the relaxation was completely solved at the current node */
156  SCIP_RELAX* relax, /**< relaxator */
157  SCIP_STAT* stat /**< dynamic problem statistics */
158  );
159 
160 /*
161  * methods for the global relaxation data
162  */
163 
164 /** enables or disables all clocks of \p relax, depending on the value of the flag */
166  SCIP_RELAX* relax, /**< the relaxation handler for which all clocks should be enabled or disabled */
167  SCIP_Bool enable /**< should the clocks of the relaxation handler be enabled? */
168  );
169 
170 /** creates global relaxation data */
172  SCIP_RELAXATION** relaxation, /**< global relaxation data */
173  BMS_BLKMEM* blkmem, /**< block memory */
174  SCIP_SET* set, /**< global SCIP settings */
175  SCIP_STAT* stat, /**< problem statistics data */
176  SCIP_PRIMAL* primal, /**< primal data */
177  SCIP_TREE* tree /**< branch and bound tree */
178  );
179 
180 /** frees global relaxation data */
182  SCIP_RELAXATION** relaxation /**< global relaxation data */
183  );
184 
185 /** sets the relaxsolzero flag in the relaxation data to the given value */
187  SCIP_RELAXATION* relaxation, /**< global relaxation data */
188  SCIP_Bool iszero /**< are all values of the relaxation solution set to zero? */
189  );
190 
191 /** returns whether the global relaxation solution is cleared and all values are set to zero */
193  SCIP_RELAXATION* relaxation /**< global relaxation data */
194  );
195 
196 /** sets the relaxsolvalid and includeslp flags in the relaxation data to the given values */
198  SCIP_RELAXATION* relaxation, /**< global relaxation data */
199  SCIP_Bool isvalid, /**< is the stored solution valid? */
200  SCIP_Bool includeslp /**< does the relaxator contain all cuts in the LP? */
201  );
202 
203 /** returns whether the global relaxation solution is valid */
205  SCIP_RELAXATION* relaxation /**< global relaxation data */
206  );
207 
208 /** returns whether the global relaxation solution was computed by a relaxator which included all LP cuts */
210  SCIP_RELAXATION* relaxation /**< global relaxation data */
211  );
212 
213 /** sets the objective value of the global relaxation solution */
215  SCIP_RELAXATION* relaxation, /**< global relaxation data */
216  SCIP_Real obj /**< objective value */
217  );
218 
219 /** returns the objective value of the global relaxation solution w.r.t. the transformed problem */
221  SCIP_RELAXATION* relaxation /**< global relaxation data */
222  );
223 
224 /** adds the given value to the global relaxation solution's objective value */
226  SCIP_RELAXATION* relaxation, /**< global relaxation data */
227  SCIP_Real val /**< value to add to the objective value */
228  );
229 
230 /** updates objective value of current relaxation solution after change of objective coefficient */
232  SCIP_RELAXATION* relaxation, /**< global relaxation data */
233  SCIP_SET* set, /**< global SCIP settings */
234  SCIP_VAR* var, /**< variable with changed objective coefficient */
235  SCIP_Real oldobj, /**< old objective coefficient */
236  SCIP_Real newobj /**< new objective coefficient */
237  );
238 
239 #ifdef __cplusplus
240 }
241 #endif
242 
243 #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:447
SCIP_RETCODE SCIPrelaxInit(SCIP_RELAX *relax, SCIP_SET *set)
Definition: relax.c:213
void SCIPrelaxationSetSolValid(SCIP_RELAXATION *relaxation, SCIP_Bool isvalid, SCIP_Bool includeslp)
Definition: relax.c:672
void SCIPrelaxationUpdateVarObj(SCIP_RELAXATION *relaxation, SCIP_SET *set, SCIP_VAR *var, SCIP_Real oldobj, SCIP_Real newobj)
Definition: relax.c:737
void SCIPrelaxSetInit(SCIP_RELAX *relax, SCIP_DECL_RELAXINIT((*relaxinit)))
Definition: relax.c:436
void SCIPrelaxSetPriority(SCIP_RELAX *relax, SCIP_SET *set, int priority)
Definition: relax.c:510
SCIP_RETCODE SCIPrelaxFree(SCIP_RELAX **relax, SCIP_SET *set)
Definition: relax.c:186
SCIP_Bool SCIPrelaxationIsLpIncludedForSol(SCIP_RELAXATION *relaxation)
Definition: relax.c:695
#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:414
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:251
type definitions for return codes for SCIP methods
SCIP_Bool SCIPrelaxationIsSolZero(SCIP_RELAXATION *relaxation)
Definition: relax.c:662
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:685
#define SCIP_DECL_RELAXEXIT(x)
Definition: type_relax.h:71
void SCIPrelaxSetFree(SCIP_RELAX *relax, SCIP_DECL_RELAXFREE((*relaxfree)))
Definition: relax.c:425
void SCIPrelaxSetExitsol(SCIP_RELAX *relax, SCIP_DECL_RELAXEXITSOL((*relaxexitsol)))
Definition: relax.c:469
SCIP_RETCODE SCIPrelaxInitsol(SCIP_RELAX *relax, SCIP_SET *set)
Definition: relax.c:281
#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:154
type definitions for relaxators
SCIP_RETCODE SCIPrelaxationFree(SCIP_RELAXATION **relaxation)
Definition: relax.c:639
void SCIPrelaxationSetSolObj(SCIP_RELAXATION *relaxation, SCIP_Real obj)
Definition: relax.c:705
SCIP_Bool SCIPrelaxIsSolved(SCIP_RELAX *relax, SCIP_STAT *stat)
Definition: relax.c:586
#define SCIP_Bool
Definition: def.h:70
SCIP_RETCODE SCIPrelaxationCreate(SCIP_RELAXATION **relaxation, BMS_BLKMEM *blkmem, SCIP_SET *set, SCIP_STAT *stat, SCIP_PRIMAL *primal, SCIP_TREE *tree)
Definition: relax.c:612
type definitions for branch and bound tree
void SCIPrelaxSetInitsol(SCIP_RELAX *relax, SCIP_DECL_RELAXINITSOL((*relaxinitsol)))
Definition: relax.c:458
void SCIPrelaxEnableOrDisableClocks(SCIP_RELAX *relax, SCIP_Bool enable)
Definition: relax.c:544
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:305
void SCIPrelaxationSetSolZero(SCIP_RELAXATION *relaxation, SCIP_Bool iszero)
Definition: relax.c:651
#define SCIP_Real
Definition: def.h:164
public methods for relaxation handlers
result codes for SCIP callback methods
void SCIPrelaxationSolObjAdd(SCIP_RELAXATION *relaxation, SCIP_Real val)
Definition: relax.c:726
#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:427
SCIP_Real SCIPrelaxationGetSolObj(SCIP_RELAXATION *relaxation)
Definition: relax.c:716
SCIP_RETCODE SCIPrelaxExec(SCIP_RELAX *relax, SCIP_SET *set, SCIP_STAT *stat, int depth, SCIP_Real *lowerbound, SCIP_RESULT *result)
Definition: relax.c:329
memory allocation routines