Scippy

SCIP

Solving Constraint Integer Programs

type_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-2015 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 type_heur.h
17  * @ingroup TYPEDEFINITIONS
18  * @brief type definitions for primal heuristics
19  * @author Tobias Achterberg
20  * @author Timo Berthold
21  *
22  * This file defines the interface for primal heuristics implemented in C.
23  *
24  * - \ref HEUR "Instructions for implementing a primal heuristic"
25  * - \ref PRIMALHEURISTICS "List of available primal heuristics"
26  * - \ref scip::ObjHeur "C++ wrapper class"
27  */
28 
29 /*---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0----+----1----+----2*/
30 
31 #ifndef __SCIP_TYPE_HEUR_H__
32 #define __SCIP_TYPE_HEUR_H__
33 
34 #include "scip/def.h"
35 #include "scip/type_scip.h"
36 #include "scip/type_result.h"
37 #include "scip/type_timing.h"
38 
39 #ifdef __cplusplus
40 extern "C" {
41 #endif
42 
43 /** represents different methods for a dive set to explore the next children */
44 #define SCIP_DIVETYPE_NONE 0x000u /**< no method specified */
45 #define SCIP_DIVETYPE_INTEGRALITY 0x001u /**< use branching on a variable by shrinking the domain in the child nodes */
46 #define SCIP_DIVETYPE_SOS1VARIABLE 0x002u /**< branch on a variable solution value by exploiting special-ordered set conflict structure */
47 
48 typedef unsigned int SCIP_DIVETYPE;
49 
50 typedef struct SCIP_Heur SCIP_HEUR; /**< primal heuristic */
51 typedef struct SCIP_HeurData SCIP_HEURDATA; /**< locally defined primal heuristic data */
52 typedef struct SCIP_Diveset SCIP_DIVESET; /**< common parameters for all diving heuristics */
53 
54 /** copy method for heuristic plugins (called when SCIP copies plugins)
55  *
56  * input:
57  * - scip : SCIP main data structure
58  * - heur : the primal heuristic itself
59  */
60 #define SCIP_DECL_HEURCOPY(x) SCIP_RETCODE x (SCIP* scip, SCIP_HEUR* heur)
61 
62 /** destructor of primal heuristic to free user data (called when SCIP is exiting)
63  *
64  * input:
65  * - scip : SCIP main data structure
66  * - heur : the primal heuristic itself
67  */
68 #define SCIP_DECL_HEURFREE(x) SCIP_RETCODE x (SCIP* scip, SCIP_HEUR* heur)
69 
70 /** initialization method of primal heuristic (called after problem was transformed)
71  *
72  * input:
73  * - scip : SCIP main data structure
74  * - heur : the primal heuristic itself
75  */
76 #define SCIP_DECL_HEURINIT(x) SCIP_RETCODE x (SCIP* scip, SCIP_HEUR* heur)
77 
78 /** deinitialization method of primal heuristic (called before transformed problem is freed)
79  *
80  * input:
81  * - scip : SCIP main data structure
82  * - heur : the primal heuristic itself
83  */
84 #define SCIP_DECL_HEUREXIT(x) SCIP_RETCODE x (SCIP* scip, SCIP_HEUR* heur)
85 
86 /** solving process initialization method of primal heuristic (called when branch and bound process is about to begin)
87  *
88  * This method is called when the presolving was finished and the branch and bound process is about to begin.
89  * The primal heuristic may use this call to initialize its branch and bound specific data.
90  *
91  * input:
92  * - scip : SCIP main data structure
93  * - heur : the primal heuristic itself
94  */
95 #define SCIP_DECL_HEURINITSOL(x) SCIP_RETCODE x (SCIP* scip, SCIP_HEUR* heur)
96 
97 /** solving process deinitialization method of primal heuristic (called before branch and bound process data is freed)
98  *
99  * This method is called before the branch and bound process is freed.
100  * The primal heuristic should use this call to clean up its branch and bound data.
101  *
102  * input:
103  * - scip : SCIP main data structure
104  * - heur : the primal heuristic itself
105  */
106 #define SCIP_DECL_HEUREXITSOL(x) SCIP_RETCODE x (SCIP* scip, SCIP_HEUR* heur)
107 
108 /** execution method of primal heuristic
109  *
110  * Searches for feasible primal solutions. The method is called in the node processing loop.
111  *
112  * input:
113  * - scip : SCIP main data structure
114  * - heur : the primal heuristic itself
115  * - heurtiming : current point in the node solving loop
116  * - nodeinfeasible : was the current node already detected to be infeasible?
117  * - result : pointer to store the result of the heuristic call
118  *
119  * possible return values for *result:
120  * - SCIP_FOUNDSOL : at least one feasible primal solution was found
121  * - SCIP_DIDNOTFIND : the heuristic searched, but did not find a feasible solution
122  * - SCIP_DIDNOTRUN : the heuristic was skipped
123  * - SCIP_DELAYED : the heuristic was skipped, but should be called again as soon as possible, disregarding
124  * its frequency
125  */
126 #define SCIP_DECL_HEUREXEC(x) SCIP_RETCODE x (SCIP* scip, SCIP_HEUR* heur, SCIP_HEURTIMING heurtiming, \
127  SCIP_Bool nodeinfeasible, SCIP_RESULT* result)
128 
129 
130 /* callbacks for diving heuristic specific settings */
131 
132 /** calculate score and preferred rounding direction for the candidate variable; the best candidate maximizes the
133  * score
134  *
135  * input:
136  * - scip : SCIP main data structure
137  * - cand : Candidate variable for which the score should be determined
138  * - divetype : represents different methods for a dive set to explore the next children
139  * - candsol : solution value of variable in LP relaxation solution
140  * - candsfrac : fractional part of solution value of variable
141  * - score : pointer for diving score value - small scores are preferred
142  * - roundup : pointer to store whether the preferred rounding direction is upwards
143  *
144  * returns SCIP_OKAY if everything worked, otherwise, a suitable error code
145  */
146 #define SCIP_DECL_DIVESETGETSCORE(x) SCIP_RETCODE x (SCIP* scip, SCIP_DIVESET* diveset, SCIP_DIVETYPE divetype, SCIP_VAR* cand, SCIP_Real candsol, SCIP_Real candsfrac, \
147  SCIP_Real* score, SCIP_Bool* roundup)
148 
149 #ifdef __cplusplus
150 }
151 #endif
152 
153 #endif
struct SCIP_Heur SCIP_HEUR
Definition: type_heur.h:50
timing definitions for SCIP
struct SCIP_HeurData SCIP_HEURDATA
Definition: type_heur.h:51
unsigned int SCIP_DIVETYPE
Definition: type_heur.h:48
struct SCIP_Diveset SCIP_DIVESET
Definition: type_heur.h:52
type definitions for SCIP's main datastructure
result codes for SCIP callback methods
common defines and data types used in all packages of SCIP