Scippy

SCIP

Solving Constraint Integer Programs

pub_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-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 pub_heur.h
17  * @ingroup PUBLICCOREAPI
18  * @brief public methods for primal heuristics
19  * @author Tobias Achterberg
20  */
21 
22 /*---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0----+----1----+----2*/
23 
24 #ifndef __SCIP_PUB_HEUR_H__
25 #define __SCIP_PUB_HEUR_H__
26 
27 
28 #include "scip/def.h"
29 #include "scip/type_misc.h"
30 #include "scip/type_heur.h"
31 
32 #ifdef __cplusplus
33 extern "C" {
34 #endif
35 
36 /**@addtogroup PublicHeuristicMethods
37  *
38  * @{
39  */
40 
41 
42 
43 /** compares two heuristics w. r. to their priority */
44 extern
45 SCIP_DECL_SORTPTRCOMP(SCIPheurComp);
46 
47 /** comparison method for sorting heuristics w.r.t. to their name */
48 extern
49 SCIP_DECL_SORTPTRCOMP(SCIPheurCompName);
50 
51 /** gets user data of primal heuristic */
52 extern
54  SCIP_HEUR* heur /**< primal heuristic */
55  );
56 
57 /** sets user data of primal heuristic; user has to free old data in advance! */
58 extern
59 void SCIPheurSetData(
60  SCIP_HEUR* heur, /**< primal heuristic */
61  SCIP_HEURDATA* heurdata /**< new primal heuristic user data */
62  );
63 
64 /** gets name of primal heuristic */
65 extern
66 const char* SCIPheurGetName(
67  SCIP_HEUR* heur /**< primal heuristic */
68  );
69 
70 /** gets description of primal heuristic */
71 extern
72 const char* SCIPheurGetDesc(
73  SCIP_HEUR* heur /**< primal heuristic */
74  );
75 
76 /** gets display character of primal heuristic */
77 extern
79  SCIP_HEUR* heur /**< primal heuristic */
80  );
81 
82 /** returns the timing mask of the heuristic */
83 extern
85  SCIP_HEUR* heur /**< primal heuristic */
86  );
87 
88 /** sets new timing mask for heuristic */
89 extern
91  SCIP_HEUR* heur, /**< primal heuristic */
92  SCIP_HEURTIMING timingmask /**< new timing mask of heuristic */
93  );
94 
95 /** does the heuristic use a secondary SCIP instance? */
96 extern
98  SCIP_HEUR* heur /**< primal heuristic */
99  );
100 
101 /** gets priority of primal heuristic */
102 extern
104  SCIP_HEUR* heur /**< primal heuristic */
105  );
106 
107 /** gets frequency of primal heuristic */
108 extern
109 int SCIPheurGetFreq(
110  SCIP_HEUR* heur /**< primal heuristic */
111  );
112 
113 /** sets frequency of primal heuristic */
114 extern
115 void SCIPheurSetFreq(
116  SCIP_HEUR* heur, /**< primal heuristic */
117  int freq /**< new frequency of heuristic */
118  );
119 
120 /** gets frequency offset of primal heuristic */
121 extern
123  SCIP_HEUR* heur /**< primal heuristic */
124  );
125 
126 /** gets maximal depth level for calling primal heuristic (returns -1, if no depth limit exists) */
127 extern
129  SCIP_HEUR* heur /**< primal heuristic */
130  );
131 
132 /** gets the number of times, the heuristic was called and tried to find a solution */
133 extern
135  SCIP_HEUR* heur /**< primal heuristic */
136  );
137 
138 /** gets the number of primal feasible solutions found by this heuristic */
139 extern
141  SCIP_HEUR* heur /**< primal heuristic */
142  );
143 
144 /** gets the number of new best primal feasible solutions found by this heuristic */
145 extern
147  SCIP_HEUR* heur /**< primal heuristic */
148  );
149 
150 /** is primal heuristic initialized? */
151 extern
153  SCIP_HEUR* heur /**< primal heuristic */
154  );
155 
156 /** gets time in seconds used in this heuristic for setting up for next stages */
157 extern
159  SCIP_HEUR* heur /**< primal heuristic */
160  );
161 
162 /** gets time in seconds used in this heuristic */
163 extern
165  SCIP_HEUR* heur /**< primal heuristic */
166  );
167 
168 /** returns array of divesets of this primal heuristic, or NULL if it has no divesets */
169 extern
171  SCIP_HEUR* heur /**< primal heuristic */
172  );
173 
174 /** returns the number of divesets of this primal heuristic */
175 extern
177  SCIP_HEUR* heur /**< primal heuristic */
178  );
179 
180 /* @} */
181 
182 /** get the heuristic to which this diving setting belongs */
183 extern
185  SCIP_DIVESET* diveset /**< diving settings */
186  );
187 
188 /** get the working solution of this dive set */
189 extern
191  SCIP_DIVESET* diveset /**< diving settings */
192  );
193 
194 /** set the working solution for this dive set */
195 extern
197  SCIP_DIVESET* diveset, /**< diving settings */
198  SCIP_SOL* sol /**< new working solution for this dive set, or NULL */
199  );
200 
201 /**@addtogroup PublicDivesetMethods
202  *
203  * @{
204  */
205 
206 /** get the name of the dive set */
207 extern
208 const char* SCIPdivesetGetName(
209  SCIP_DIVESET* diveset /**< diving settings */
210  );
211 
212 /** get the minimum relative depth of the diving settings */
213 extern
215  SCIP_DIVESET* diveset /**< diving settings */
216  );
217 
218 /** get the maximum relative depth of the diving settings */
219 extern
221  SCIP_DIVESET* diveset /**< diving settings */
222  );
223 
224 /** get the number of successful runs of the diving settings */
225 extern
227  SCIP_DIVESET* diveset /**< diving settings */
228  );
229 
230 /** get the number of calls to this dive set */
231 extern
233  SCIP_DIVESET* diveset /**< diving settings */
234  );
235 
236 /** get the number of calls successfully terminated at a feasible leaf node */
237 extern
239  SCIP_DIVESET* diveset /**< diving settings */
240  );
241 
242 /** get the minimum depth reached by this dive set */
243 extern
245  SCIP_DIVESET* diveset /**< diving settings */
246  );
247 
248 /** get the maximum depth reached by this dive set */
249 extern
251  SCIP_DIVESET* diveset /**< diving settings */
252  );
253 
254 /** get the average depth this dive set reached during execution */
255 extern
257  SCIP_DIVESET* diveset /**< diving settings */
258  );
259 
260 /** get the minimum depth at which this dive set found a solution */
261 extern
263  SCIP_DIVESET* diveset /**< diving settings */
264  );
265 
266 /** get the maximum depth at which this dive set found a solution */
267 extern
269  SCIP_DIVESET* diveset /**< diving settings */
270  );
271 
272 /** get the average depth at which this dive set found a solution */
273 extern
275  SCIP_DIVESET* diveset /**< diving settings */
276  );
277 
278 /** get the total number of LP iterations used by this dive set */
279 extern
281  SCIP_DIVESET* diveset /**< diving settings */
282  );
283 
284 /** get the total number of probing nodes used by this dive set */
285 extern
287  SCIP_DIVESET* diveset /**< diving settings */
288  );
289 
290 /** get the total number of backtracks performed by this dive set */
291 extern
293  SCIP_DIVESET* diveset /**< diving settings */
294  );
295 
296 /** get the total number of solutions (leaf and rounded solutions) found by the dive set */
297 extern
299  SCIP_DIVESET* diveset /**< diving settings */
300  );
301 
302 /** get the maximum LP iterations quotient of the diving settings */
303 extern
305  SCIP_DIVESET* diveset /**< diving settings */
306  );
307 
308 /** get the maximum LP iterations offset of the diving settings */
309 extern
311  SCIP_DIVESET* diveset /**< diving settings */
312  );
313 
314 /** get the maximum upper bound quotient parameter of the diving settings if no solution is available */
315 extern
317  SCIP_DIVESET* diveset /**< diving settings */
318  );
319 
320 /** get the average quotient parameter of the diving settings if no solution is available */
321 extern
323  SCIP_DIVESET* diveset /**< diving settings */
324  );
325 
326 /** get the maximum upper bound quotient parameter of the diving settings if an incumbent solution exists */
327 extern
329  SCIP_DIVESET* diveset /**< diving settings */
330  );
331 
332 /** get the average upper bound quotient parameter of the diving settings if an incumbent solution exists */
333 extern
335  SCIP_DIVESET* diveset /**< diving settings */
336  );
337 
338 /** should backtracking be applied? */
339 extern
341  SCIP_DIVESET* diveset /**< diving settings */
342  );
343 
344 /** returns the LP solve frequency for diving LPs (0: dynamically based on number of intermediate domain reductions) */
345 extern
347  SCIP_DIVESET* diveset /**< diving settings */
348  );
349 
350 /** returns the domain reduction quotient for triggering an immediate resolve of the diving LP (0.0: always resolve)*/
351 extern
353  SCIP_DIVESET* diveset /**< diving settings */
354  );
355 
356 /** should only LP branching candidates be considered instead of the slower but
357  * more general constraint handler diving variable selection?
358  */
359 extern
361  SCIP_DIVESET* diveset /**< diving settings */
362  );
363 
364 /** returns TRUE if dive set supports diving of the specified type */
365 extern
367  SCIP_DIVESET* diveset, /**< diving settings */
368  SCIP_DIVETYPE divetype /**< bit mask that represents the supported dive types by this dive set */
369  );
370 
371 /** returns the random number generator of this \p diveset for tie-breaking */
372 extern
374  SCIP_DIVESET* diveset /**< diving settings */
375  );
376 
377 /* @} */
378 
379 /**@defgroup PublicVariableGraphMethods Public Variable Graph Methods
380  * @ingroup MiscellaneousMethods
381  *
382  * @brief methods to create a variable graph and perform breadth-first search
383  *
384  * @{
385  */
386 
387 /** Perform breadth-first (BFS) search on the variable constraint graph.
388  *
389  * The result of the algorithm is that the \p distances array contains the correct distances for
390  * every variable from the start variables. The distance of a variable can then be accessed through its
391  * problem index (calling SCIPvarGetProbindex()).
392  * Hence, The method assumes that the length of \p distances is at least
393  * SCIPgetNVars().
394  * Variables that are not connected through constraints to the start variables have a distance of -1.
395  *
396  * Limits can be provided to further restrict the breadth-first search. If a distance limit is given,
397  * the search will be performed until the first variable at this distance is popped from the queue, i.e.,
398  * all variables with a distance < maxdistance have been labeled by the search.
399  * If a variable limit is given, the search stops after it completes the distance level at which
400  * the limit was reached. Hence, more variables may be actually labeled.
401  * The start variables are accounted for those variable limits.
402  *
403  * If no variable variable constraint graph is provided, the method will create one and free it at the end
404  * This is useful for a single use of the variable constraint graph. For several consecutive uses,
405  * it is advised to create a variable constraint graph via SCIPvariableGraphCreate().
406  */
407 extern
409  SCIP* scip, /**< SCIP data structure */
410  SCIP_VGRAPH* vargraph, /**< pointer to the variable graph, or NULL to let the function create a local graph */
411  SCIP_VAR** startvars, /**< array of start variables to calculate distance from */
412  int nstartvars, /**< number of starting variables, at least 1 */
413  int* distances, /**< array to keep distance in vargraph from start variables for every variable */
414  int maxdistance, /**< maximum distance >= 0 from start variable (INT_MAX for complete BFS) */
415  int maxvars, /**< maximum number of variables to compute distance for */
416  int maxbinintvars /**< maximum number of binary or integer variables to compute distance for */
417  );
418 
419 /** initialization method of variable graph data structure */
420 extern
422  SCIP* scip, /**< SCIP data structure */
423  SCIP_VGRAPH** vargraph, /**< pointer to the variable graph */
424  SCIP_Bool relaxdenseconss, /**< should dense constraints (at least as dense as \p density) be
425  * ignored by connectivity graph? */
426  SCIP_Real relaxdensity, /**< density (with respect to number of variables) to relax constraint from graph */
427  int* nrelaxedconstraints /**< pointer to store the number of constraints that were relaxed, or NULL if not needed */
428  );
429 
430 /** deinitialization method of variable graph data structure */
431 extern
433  SCIP* scip, /**< SCIP data structure */
434  SCIP_VGRAPH** vargraph /**< pointer to the variable graph */
435  );
436 
437 /* @} */
438 
439 
440 #ifdef __cplusplus
441 }
442 #endif
443 
444 #endif
SCIP_HEURTIMING SCIPheurGetTimingmask(SCIP_HEUR *heur)
Definition: heur.c:1228
int SCIPdivesetGetMinSolutionDepth(SCIP_DIVESET *diveset)
Definition: heur.c:435
int SCIPheurGetPriority(SCIP_HEUR *heur)
Definition: heur.c:1259
SCIP_Real SCIPheurGetSetupTime(SCIP_HEUR *heur)
Definition: heur.c:1376
type definitions for miscellaneous datastructures
SCIP_SOL * SCIPdivesetGetWorkSolution(SCIP_DIVESET *diveset)
Definition: heur.c:330
SCIP_Longint SCIPdivesetGetNBacktracks(SCIP_DIVESET *diveset)
Definition: heur.c:485
SCIP_Bool SCIPdivesetUseBacktrack(SCIP_DIVESET *diveset)
Definition: heur.c:553
SCIP_Longint SCIPheurGetNBestSolsFound(SCIP_HEUR *heur)
Definition: heur.c:1344
void SCIPvariableGraphFree(SCIP *scip, SCIP_VGRAPH **vargraph)
Definition: heur.c:1776
unsigned int SCIP_HEURTIMING
Definition: type_timing.h:97
SCIP_Real SCIPdivesetGetUbQuot(SCIP_DIVESET *diveset)
Definition: heur.c:537
int SCIPdivesetGetMaxLPIterOffset(SCIP_DIVESET *diveset)
Definition: heur.c:514
SCIP_DIVESET ** SCIPheurGetDivesets(SCIP_HEUR *heur)
Definition: heur.c:1396
SCIP_Real SCIPdivesetGetAvgQuotNoSol(SCIP_DIVESET *diveset)
Definition: heur.c:530
enum SCIP_Retcode SCIP_RETCODE
Definition: type_retcode.h:53
SCIP_Real SCIPdivesetGetMaxRelDepth(SCIP_DIVESET *diveset)
Definition: heur.c:369
int SCIPheurGetFreqofs(SCIP_HEUR *heur)
Definition: heur.c:1304
SCIP_Longint SCIPdivesetGetNSols(SCIP_DIVESET *diveset)
Definition: heur.c:495
struct SCIP_HeurData SCIP_HEURDATA
Definition: type_heur.h:51
SCIP_Longint SCIPdivesetGetNLPIterations(SCIP_DIVESET *diveset)
Definition: heur.c:465
SCIP_Bool SCIPheurUsesSubscip(SCIP_HEUR *heur)
Definition: heur.c:1249
unsigned int SCIP_DIVETYPE
Definition: type_heur.h:48
SCIP_Real SCIPdivesetGetMinRelDepth(SCIP_DIVESET *diveset)
Definition: heur.c:361
int SCIPdivesetGetNSolutionCalls(SCIP_DIVESET *diveset)
Definition: heur.c:395
SCIP_Real SCIPdivesetGetAvgSolutionDepth(SCIP_DIVESET *diveset)
Definition: heur.c:455
void SCIPheurSetData(SCIP_HEUR *heur, SCIP_HEURDATA *heurdata)
Definition: heur.c:1119
void SCIPheurSetFreq(SCIP_HEUR *heur, int freq)
Definition: heur.c:1293
SCIP_Bool SCIPdivesetUseOnlyLPBranchcands(SCIP_DIVESET *diveset)
Definition: heur.c:594
SCIP_Real SCIPdivesetGetMaxLPIterQuot(SCIP_DIVESET *diveset)
Definition: heur.c:506
SCIP_RETCODE SCIPvariableGraphCreate(SCIP *scip, SCIP_VGRAPH **vargraph, SCIP_Bool relaxdenseconss, SCIP_Real relaxdensity, int *nrelaxedconstraints)
Definition: heur.c:1738
int SCIPdivesetGetMaxSolutionDepth(SCIP_DIVESET *diveset)
Definition: heur.c:445
const char * SCIPheurGetName(SCIP_HEUR *heur)
Definition: heur.c:1198
int SCIPheurGetMaxdepth(SCIP_HEUR *heur)
Definition: heur.c:1314
type definitions for primal heuristics
int SCIPdivesetGetMaxDepth(SCIP_DIVESET *diveset)
Definition: heur.c:415
SCIP_Real SCIPdivesetGetAvgQuot(SCIP_DIVESET *diveset)
Definition: heur.c:545
SCIP_Real SCIPdivesetGetAvgDepth(SCIP_DIVESET *diveset)
Definition: heur.c:425
const char * SCIPheurGetDesc(SCIP_HEUR *heur)
Definition: heur.c:1208
int SCIPheurGetFreq(SCIP_HEUR *heur)
Definition: heur.c:1283
SCIP_Real SCIPdivesetGetLPResolveDomChgQuot(SCIP_DIVESET *diveset)
Definition: heur.c:582
int SCIPheurGetNDivesets(SCIP_HEUR *heur)
Definition: heur.c:1406
SCIP_HEUR * SCIPdivesetGetHeur(SCIP_DIVESET *diveset)
Definition: heur.c:322
SCIP_Longint SCIPheurGetNCalls(SCIP_HEUR *heur)
Definition: heur.c:1324
SCIP_Bool SCIPdivesetSupportsType(SCIP_DIVESET *diveset, SCIP_DIVETYPE divetype)
Definition: heur.c:604
#define SCIP_Bool
Definition: def.h:61
SCIP_RETCODE SCIPvariablegraphBreadthFirst(SCIP *scip, SCIP_VGRAPH *vargraph, SCIP_VAR **startvars, int nstartvars, int *distances, int maxdistance, int maxvars, int maxbinintvars)
Definition: heur.c:1435
SCIP_Real SCIPdivesetGetUbQuotNoSol(SCIP_DIVESET *diveset)
Definition: heur.c:522
SCIP_RANDNUMGEN * SCIPdivesetGetRandnumgen(SCIP_DIVESET *diveset)
Definition: heur.c:571
void SCIPdivesetSetWorkSolution(SCIP_DIVESET *diveset, SCIP_SOL *sol)
Definition: heur.c:340
SCIP_DECL_SORTPTRCOMP(SCIPheurComp)
Definition: heur.c:41
#define SCIP_Real
Definition: def.h:149
char SCIPheurGetDispchar(SCIP_HEUR *heur)
Definition: heur.c:1218
void SCIPheurSetTimingmask(SCIP_HEUR *heur, SCIP_HEURTIMING timingmask)
Definition: heur.c:1238
#define SCIP_Longint
Definition: def.h:134
SCIP_Longint SCIPheurGetNSolsFound(SCIP_HEUR *heur)
Definition: heur.c:1334
SCIP_Longint SCIPdivesetGetSolSuccess(SCIP_DIVESET *diveset)
Definition: heur.c:377
SCIP_Bool SCIPheurIsInitialized(SCIP_HEUR *heur)
Definition: heur.c:1354
common defines and data types used in all packages of SCIP
SCIP_HEURDATA * SCIPheurGetData(SCIP_HEUR *heur)
Definition: heur.c:1109
SCIP_Real SCIPheurGetTime(SCIP_HEUR *heur)
Definition: heur.c:1386
int SCIPdivesetGetNCalls(SCIP_DIVESET *diveset)
Definition: heur.c:385
SCIP_Longint SCIPdivesetGetNProbingNodes(SCIP_DIVESET *diveset)
Definition: heur.c:475
int SCIPdivesetGetLPSolveFreq(SCIP_DIVESET *diveset)
Definition: heur.c:561
const char * SCIPdivesetGetName(SCIP_DIVESET *diveset)
Definition: heur.c:351
int SCIPdivesetGetMinDepth(SCIP_DIVESET *diveset)
Definition: heur.c:405