Scippy

SCIP

Solving Constraint Integer Programs

heur.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-2014 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 heur.h
17  * @brief internal methods for primal heuristics
18  * @author Tobias Achterberg
19  */
20 
21 /*---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0----+----1----+----2*/
22 
23 #ifndef __SCIP_HEUR_H__
24 #define __SCIP_HEUR_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_primal.h"
33 #include "scip/type_heur.h"
34 #include "scip/pub_heur.h"
35 
36 #ifdef __cplusplus
37 extern "C" {
38 #endif
39 
40 /** copies the given primal heuristic to a new scip */
41 extern
43  SCIP_HEUR* heur, /**< primal heuristic */
44  SCIP_SET* set /**< SCIP_SET of SCIP to copy to */
45  );
46 
47 /** creates a primal heuristic */
48 extern
50  SCIP_HEUR** heur, /**< pointer to primal heuristic 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 primal heuristic */
55  const char* desc, /**< description of primal heuristic */
56  char dispchar, /**< display character of primal heuristic */
57  int priority, /**< priority of the primal heuristic */
58  int freq, /**< frequency for calling primal heuristic */
59  int freqofs, /**< frequency offset for calling primal heuristic */
60  int maxdepth, /**< maximal depth level to call heuristic at (-1: no limit) */
61  unsigned int timingmask, /**< positions in the node solving loop where heuristic should be executed */
62  SCIP_Bool usessubscip, /**< does the separator use a secondary SCIP instance? */
63  SCIP_DECL_HEURCOPY ((*heurcopy)), /**< copy method of primal heuristic or NULL if you don't want to copy your plugin into sub-SCIPs */
64  SCIP_DECL_HEURFREE ((*heurfree)), /**< destructor of primal heuristic */
65  SCIP_DECL_HEURINIT ((*heurinit)), /**< initialize primal heuristic */
66  SCIP_DECL_HEUREXIT ((*heurexit)), /**< deinitialize primal heuristic */
67  SCIP_DECL_HEURINITSOL ((*heurinitsol)), /**< solving process initialization method of primal heuristic */
68  SCIP_DECL_HEUREXITSOL ((*heurexitsol)), /**< solving process deinitialization method of primal heuristic */
69  SCIP_DECL_HEUREXEC ((*heurexec)), /**< execution method of primal heuristic */
70  SCIP_HEURDATA* heurdata /**< primal heuristic data */
71  );
72 
73 /** calls destructor and frees memory of primal heuristic */
74 extern
76  SCIP_HEUR** heur, /**< pointer to primal heuristic data structure */
77  SCIP_SET* set /**< global SCIP settings */
78  );
79 
80 /** initializes primal heuristic */
81 extern
83  SCIP_HEUR* heur, /**< primal heuristic */
84  SCIP_SET* set /**< global SCIP settings */
85  );
86 
87 /** calls exit method of primal heuristic */
88 extern
90  SCIP_HEUR* heur, /**< primal heuristic */
91  SCIP_SET* set /**< global SCIP settings */
92  );
93 
94 /** informs primal heuristic that the branch and bound process is being started */
95 extern
97  SCIP_HEUR* heur, /**< primal heuristic */
98  SCIP_SET* set /**< global SCIP settings */
99  );
100 
101 /** informs primal heuristic that the branch and bound process data is being freed */
102 extern
104  SCIP_HEUR* heur, /**< primal heuristic */
105  SCIP_SET* set /**< global SCIP settings */
106  );
107 
108 /** should the heuristic be executed at the given depth, frequency, timing, ... */
109 extern
111  SCIP_HEUR* heur, /**< primal heuristic */
112  int depth, /**< depth of current node */
113  int lpstateforkdepth, /**< depth of the last node with solved LP */
114  SCIP_HEURTIMING heurtiming, /**< current point in the node solving process */
115  SCIP_Bool* delayed /**< pointer to store whether the heuristic should be delayed */
116  );
117 
118 /** calls execution method of primal heuristic */
119 extern
121  SCIP_HEUR* heur, /**< primal heuristic */
122  SCIP_SET* set, /**< global SCIP settings */
123  SCIP_PRIMAL* primal, /**< primal data */
124  int depth, /**< depth of current node */
125  int lpstateforkdepth, /**< depth of the last node with solved LP */
126  SCIP_HEURTIMING heurtiming, /**< current point in the node solving process */
127  SCIP_Bool nodeinfeasible, /**< was the current node already detected to be infeasible? */
128  int* ndelayedheurs, /**< pointer to count the number of delayed heuristics */
129  SCIP_RESULT* result /**< pointer to store the result of the callback method */
130  );
131 
132 /** sets priority of primal heuristic */
133 extern
135  SCIP_HEUR* heur, /**< primal heuristic */
136  SCIP_SET* set, /**< global SCIP settings */
137  int priority /**< new priority of the primal heuristic */
138  );
139 
140 /** sets copy callback of primal heuristic */
141 extern
142 void SCIPheurSetCopy(
143  SCIP_HEUR* heur, /**< primal heuristic */
144  SCIP_DECL_HEURCOPY ((*heurcopy)) /**< copy callback of primal heuristic or NULL if you don't want to copy your plugin into sub-SCIPs */
145  );
146 
147 /** sets destructor callback of primal heuristic */
148 extern
149 void SCIPheurSetFree(
150  SCIP_HEUR* heur, /**< primal heuristic */
151  SCIP_DECL_HEURFREE ((*heurfree)) /**< destructor of primal heuristic */
152  );
153 
154 /** sets initialization callback of primal heuristic */
155 extern
156 void SCIPheurSetInit(
157  SCIP_HEUR* heur, /**< primal heuristic */
158  SCIP_DECL_HEURINIT ((*heurinit)) /**< initialize primal heuristic */
159  );
160 
161 /** sets deinitialization callback of primal heuristic */
162 extern
163 void SCIPheurSetExit(
164  SCIP_HEUR* heur, /**< primal heuristic */
165  SCIP_DECL_HEUREXIT ((*heurexit)) /**< deinitialize primal heuristic */
166  );
167 
168 /** sets solving process initialization callback of primal heuristic */
169 extern
170 void SCIPheurSetInitsol(
171  SCIP_HEUR* heur, /**< primal heuristic */
172  SCIP_DECL_HEURINITSOL ((*heurinitsol)) /**< solving process initialization callback of primal heuristic */
173  );
174 
175 /** sets solving process deinitialization callback of primal heuristic */
176 extern
177 void SCIPheurSetExitsol(
178  SCIP_HEUR* heur, /**< primal heuristic */
179  SCIP_DECL_HEUREXITSOL ((*heurexitsol)) /**< solving process deinitialization callback of primal heuristic */
180  );
181 
182 /** enables or disables all clocks of \p heur, depending on the value of the flag */
183 extern
185  SCIP_HEUR* heur, /**< the heuristic for which all clocks should be enabled or disabled */
186  SCIP_Bool enable /**< should the clocks of the heuristic be enabled? */
187  );
188 
189 #ifdef __cplusplus
190 }
191 #endif
192 
193 #endif
enum SCIP_Result SCIP_RESULT
Definition: type_result.h:51
#define SCIP_DECL_HEURINITSOL(x)
Definition: type_heur.h:88
unsigned int SCIP_HEURTIMING
Definition: type_timing.h:79
void SCIPheurSetExitsol(SCIP_HEUR *heur, SCIP_DECL_HEUREXITSOL((*heurexitsol)))
Definition: heur.c:580
SCIP_RETCODE SCIPheurExec(SCIP_HEUR *heur, SCIP_SET *set, SCIP_PRIMAL *primal, int depth, int lpstateforkdepth, SCIP_HEURTIMING heurtiming, SCIP_Bool nodeinfeasible, int *ndelayedheurs, SCIP_RESULT *result)
Definition: heur.c:402
SCIP_RETCODE SCIPheurInitsol(SCIP_HEUR *heur, SCIP_SET *set)
Definition: heur.c:286
void SCIPheurSetPriority(SCIP_HEUR *heur, SCIP_SET *set, int priority)
Definition: heur.c:662
#define SCIP_DECL_HEURCOPY(x)
Definition: type_heur.h:53
enum SCIP_Retcode SCIP_RETCODE
Definition: type_retcode.h:53
#define SCIP_DECL_HEUREXEC(x)
Definition: type_heur.h:119
type definitions for global SCIP settings
struct SCIP_HeurData SCIP_HEURDATA
Definition: type_heur.h:44
type definitions for return codes for SCIP methods
SCIP_RETCODE SCIPheurCopyInclude(SCIP_HEUR *heur, SCIP_SET *set)
Definition: heur.c:87
type definitions for primal heuristics
SCIP_Bool SCIPheurShouldBeExecuted(SCIP_HEUR *heur, int depth, int lpstateforkdepth, SCIP_HEURTIMING heurtiming, SCIP_Bool *delayed)
Definition: heur.c:340
void SCIPheurSetCopy(SCIP_HEUR *heur, SCIP_DECL_HEURCOPY((*heurcopy)))
Definition: heur.c:525
void SCIPheurSetFree(SCIP_HEUR *heur, SCIP_DECL_HEURFREE((*heurfree)))
Definition: heur.c:536
#define SCIP_Bool
Definition: def.h:49
SCIP_RETCODE SCIPheurInit(SCIP_HEUR *heur, SCIP_SET *set)
Definition: heur.c:215
void SCIPheurEnableOrDisableClocks(SCIP_HEUR *heur, SCIP_Bool enable)
Definition: heur.c:757
SCIP_RETCODE SCIPheurExit(SCIP_HEUR *heur, SCIP_SET *set)
Definition: heur.c:256
#define SCIP_DECL_HEUREXIT(x)
Definition: type_heur.h:77
SCIP_RETCODE SCIPheurCreate(SCIP_HEUR **heur, SCIP_SET *set, SCIP_MESSAGEHDLR *messagehdlr, BMS_BLKMEM *blkmem, const char *name, const char *desc, char dispchar, int priority, int freq, int freqofs, int maxdepth, unsigned int timingmask, SCIP_Bool usessubscip, SCIP_DECL_HEURCOPY((*heurcopy)), SCIP_DECL_HEURFREE((*heurfree)), SCIP_DECL_HEURINIT((*heurinit)), SCIP_DECL_HEUREXIT((*heurexit)), SCIP_DECL_HEURINITSOL((*heurinitsol)), SCIP_DECL_HEUREXITSOL((*heurexitsol)), SCIP_DECL_HEUREXEC((*heurexec)), SCIP_HEURDATA *heurdata)
Definition: heur.c:106
#define SCIP_DECL_HEURINIT(x)
Definition: type_heur.h:69
result codes for SCIP callback methods
#define SCIP_DECL_HEURFREE(x)
Definition: type_heur.h:61
SCIP_RETCODE SCIPheurExitsol(SCIP_HEUR *heur, SCIP_SET *set)
Definition: heur.c:316
void SCIPheurSetExit(SCIP_HEUR *heur, SCIP_DECL_HEUREXIT((*heurexit)))
Definition: heur.c:558
void SCIPheurSetInit(SCIP_HEUR *heur, SCIP_DECL_HEURINIT((*heurinit)))
Definition: heur.c:547
type definitions for collecting primal CIP solutions and primal informations
public methods for primal heuristics
common defines and data types used in all packages of SCIP
struct BMS_BlkMem BMS_BLKMEM
Definition: memory.h:371
#define SCIP_DECL_HEUREXITSOL(x)
Definition: type_heur.h:99
void SCIPheurSetInitsol(SCIP_HEUR *heur, SCIP_DECL_HEURINITSOL((*heurinitsol)))
Definition: heur.c:569
SCIP_RETCODE SCIPheurFree(SCIP_HEUR **heur, SCIP_SET *set)
Definition: heur.c:189
memory allocation routines