Scippy

SCIP

Solving Constraint Integer Programs

type_prop.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 type_prop.h
17  * @ingroup TYPEDEFINITIONS
18  * @brief type definitions for propagators
19  * @author Tobias Achterberg
20  */
21 
22 /*---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0----+----1----+----2*/
23 
24 #ifndef __SCIP_TYPE_PROP_H__
25 #define __SCIP_TYPE_PROP_H__
26 
27 #include "scip/def.h"
28 #include "scip/type_retcode.h"
29 #include "scip/type_result.h"
30 #include "scip/type_scip.h"
31 #include "scip/type_timing.h"
32 
33 #ifdef __cplusplus
34 extern "C" {
35 #endif
36 
37 typedef struct SCIP_Prop SCIP_PROP; /**< propagator */
38 typedef struct SCIP_PropData SCIP_PROPDATA; /**< locally defined propagator data */
39 
40 
41 /** copy method for propagator plugins (called when SCIP copies plugins)
42  *
43  * input:
44  * - scip : SCIP main data structure
45  * - prop : the propagator itself
46  */
47 #define SCIP_DECL_PROPCOPY(x) SCIP_RETCODE x (SCIP* scip, SCIP_PROP* prop)
48 
49 /** destructor of propagator to free user data (called when SCIP is exiting)
50  *
51  * input:
52  * - scip : SCIP main data structure
53  * - prop : the propagator itself
54  */
55 #define SCIP_DECL_PROPFREE(x) SCIP_RETCODE x (SCIP* scip, SCIP_PROP* prop)
56 
57 /** initialization method of propagator (called after problem was transformed)
58  *
59  * input:
60  * - scip : SCIP main data structure
61  * - prop : the propagator itself
62  */
63 #define SCIP_DECL_PROPINIT(x) SCIP_RETCODE x (SCIP* scip, SCIP_PROP* prop)
64 
65 /** deinitialization method of propagator (called before transformed problem is freed)
66  *
67  * input:
68  * - scip : SCIP main data structure
69  * - prop : the propagator itself
70  */
71 #define SCIP_DECL_PROPEXIT(x) SCIP_RETCODE x (SCIP* scip, SCIP_PROP* prop)
72 
73 /** presolving initialization method of propagator (called when presolving is about to begin)
74  *
75  * This method is called when the presolving process is about to begin, even if presolving is turned off. The
76  * propagator may use this call to initialize its presolving data, before the presolving process begins.
77  *
78  * Necessary modifications that have to be performed even if presolving is turned off should be done here or in the
79  * presolving deinitialization call (SCIP_DECL_PROPEXITPRE()).
80  *
81  * input:
82  * - scip : SCIP main data structure
83  * - prop : the propagator itself
84  */
85 #define SCIP_DECL_PROPINITPRE(x) SCIP_RETCODE x (SCIP* scip, SCIP_PROP* prop)
86 
87 /** presolving deinitialization method of propagator (called after presolving has been finished)
88  *
89  * This method is called after the presolving has been finished, even if presolving is turned off.
90  * The propagator may use this call e.g. to clean up its presolving data.
91  *
92  * Besides necessary modifications and clean up, no time consuming operations should be performed, especially if the
93  * problem has already been solved. Use the method SCIPgetStatus(), which in this case returns SCIP_STATUS_OPTIMAL,
94  * SCIP_STATUS_INFEASIBLE, SCIP_STATUS_UNBOUNDED, or SCIP_STATUS_INFORUNBD.
95  *
96  * input:
97  * - scip : SCIP main data structure
98  * - prop : the propagator itself
99  */
100 #define SCIP_DECL_PROPEXITPRE(x) SCIP_RETCODE x (SCIP* scip, SCIP_PROP* prop)
101 
102 /** solving process initialization method of propagator (called when branch and bound process is about to begin)
103  *
104  * This method is called when the presolving was finished and the branch and bound process is about to begin.
105  * The propagator may use this call to initialize its branch and bound specific data.
106  *
107  * Besides necessary modifications and clean up, no time consuming operations should be performed, especially if the
108  * problem has already been solved. Use the method SCIPgetStatus(), which in this case returns SCIP_STATUS_OPTIMAL,
109  * SCIP_STATUS_INFEASIBLE, SCIP_STATUS_UNBOUNDED, or SCIP_STATUS_INFORUNBD.
110  *
111  * input:
112  * - scip : SCIP main data structure
113  * - prop : the propagator itself
114  */
115 #define SCIP_DECL_PROPINITSOL(x) SCIP_RETCODE x (SCIP* scip, SCIP_PROP* prop)
116 
117 /** solving process deinitialization method of propagator (called before branch and bound process data is freed)
118  *
119  * This method is called before the branch and bound process is freed.
120  * The propagator should use this call to clean up its branch and bound data.
121  *
122  * input:
123  * - scip : SCIP main data structure
124  * - prop : the propagator itself
125  * - restart : was this exit solve call triggered by a restart?
126  */
127 #define SCIP_DECL_PROPEXITSOL(x) SCIP_RETCODE x (SCIP* scip, SCIP_PROP* prop, SCIP_Bool restart)
128 
129 /** presolving method of propagator
130  *
131  * The presolver should go through the variables and constraints and tighten the domains or
132  * constraints. Each tightening should increase the given total numbers of changes.
133  *
134  * input:
135  * - scip : SCIP main data structure
136  * - prop : the propagator itself
137  * - nrounds : number of presolving rounds already done
138  * - nnewfixedvars : number of variables fixed since the last call to the presolving method
139  * - nnewaggrvars : number of variables aggregated since the last call to the presolving method
140  * - nnewchgvartypes : number of variable type changes since the last call to the presolving method
141  * - nnewchgbds : number of variable bounds tightened since the last call to the presolving method
142  * - nnewholes : number of domain holes added since the last call to the presolving method
143  * - nnewdelconss : number of deleted constraints since the last call to the presolving method
144  * - nnewaddconss : number of added constraints since the last call to the presolving method
145  * - nnewupgdconss : number of upgraded constraints since the last call to the presolving method
146  * - nnewchgcoefs : number of changed coefficients since the last call to the presolving method
147  * - nnewchgsides : number of changed left or right hand sides since the last call to the presolving method
148  *
149  * @note the counters state the changes since the last call including the changes of this presolving method during its
150  * last call
151  *
152  * input/output:
153  * - nfixedvars : pointer to total number of variables fixed of all presolvers
154  * - naggrvars : pointer to total number of variables aggregated of all presolvers
155  * - nchgvartypes : pointer to total number of variable type changes of all presolvers
156  * - nchgbds : pointer to total number of variable bounds tightened of all presolvers
157  * - naddholes : pointer to total number of domain holes added of all presolvers
158  * - ndelconss : pointer to total number of deleted constraints of all presolvers
159  * - naddconss : pointer to total number of added constraints of all presolvers
160  * - nupgdconss : pointer to total number of upgraded constraints of all presolvers
161  * - nchgcoefs : pointer to total number of changed coefficients of all presolvers
162  * - nchgsides : pointer to total number of changed left/right hand sides of all presolvers
163  *
164  * output:
165  * - result : pointer to store the result of the presolving call
166  *
167  * possible return values for *result:
168  * - SCIP_UNBOUNDED : at least one variable is not bounded by any constraint in obj. direction -> problem is unbounded
169  * - SCIP_CUTOFF : at least one constraint is infeasible in the variable's bounds -> problem is infeasible
170  * - SCIP_SUCCESS : the presolving method found a reduction
171  * - SCIP_DIDNOTFIND : the presolving method searched, but did not find a presolving change
172  * - SCIP_DIDNOTRUN : the presolving method was skipped
173  * - SCIP_DELAYED : the presolving method was skipped, but should be called again
174  */
175 #define SCIP_DECL_PROPPRESOL(x) SCIP_RETCODE x (SCIP* scip, SCIP_PROP* prop, int nrounds, \
176  int nnewfixedvars, int nnewaggrvars, int nnewchgvartypes, int nnewchgbds, int nnewholes, \
177  int nnewdelconss, int nnewaddconss, int nnewupgdconss, int nnewchgcoefs, int nnewchgsides, \
178  int* nfixedvars, int* naggrvars, int* nchgvartypes, int* nchgbds, int* naddholes, \
179  int* ndelconss, int* naddconss, int* nupgdconss, int* nchgcoefs, int* nchgsides, SCIP_RESULT* result)
180 
181 /** execution method of propagator
182  *
183  * Searches for domain propagations. The method is called in the node processing loop.
184  *
185  * input:
186  * - scip : SCIP main data structure
187  * - prop : the propagator itself
188  * - proptiming : current point in the node solving loop
189  * - result : pointer to store the result of the propagation call
190  *
191  * possible return values for *result:
192  * - SCIP_CUTOFF : the current node is infeasible for the current domains
193  * - SCIP_REDUCEDDOM : at least one domain reduction was found
194  * - SCIP_DIDNOTFIND : the propagator searched, but did not find a domain reduction
195  * - SCIP_DIDNOTRUN : the propagator was skipped
196  * - SCIP_DELAYED : the propagator was skipped, but should be called again
197  */
198 #define SCIP_DECL_PROPEXEC(x) SCIP_RETCODE x (SCIP* scip, SCIP_PROP* prop, SCIP_PROPTIMING proptiming, SCIP_RESULT* result)
199 
200 
201 /** propagation conflict resolving method of propagator
202  *
203  * This method is called during conflict analysis. If the propagator wants to support conflict analysis,
204  * it should call SCIPinferVarLbProp() or SCIPinferVarUbProp() in domain propagation instead of SCIPchgVarLb() or
205  * SCIPchgVarUb() in order to deduce bound changes on variables.
206  * In the SCIPinferVarLbProp() and SCIPinferVarUbProp() calls, the propagator provides a pointer to itself
207  * and an integer value "inferinfo" that can be arbitrarily chosen.
208  * The propagation conflict resolving method can then be implemented, to provide a "reasons" for the bound
209  * changes, i.e. the bounds of variables at the time of the propagation, that forced the propagator to set the
210  * conflict variable's bound to its current value. It can use the "inferinfo" tag to identify its own propagation
211  * rule and thus identify the "reason" bounds. The bounds that form the reason of the assignment must then be provided
212  * by calls to SCIPaddConflictLb(), SCIPaddConflictUb(), SCIPaddConflictBd(), SCIPaddConflictRelaxedLb(),
213  * SCIPaddConflictRelaxedUb(), SCIPaddConflictRelaxedBd(), and/or SCIPaddConflictBinvar() in the propagation conflict
214  * resolving method.
215  *
216  * See the description of the propagation conflict resolving method of constraint handlers for further details.
217  *
218  * input:
219  * - scip : SCIP main data structure
220  * - prop : the propagator itself
221  * - infervar : the conflict variable whose bound change has to be resolved
222  * - inferinfo : the user information passed to the corresponding SCIPinferVarLbProp() or SCIPinferVarUbProp() call
223  * - boundtype : the type of the changed bound (lower or upper bound)
224  * - bdchgidx : the index of the bound change, representing the point of time where the change took place
225  * - relaxedbd : the relaxed bound which is sufficient to be explained
226  *
227  * output:
228  * - result : pointer to store the result of the propagation conflict resolving call
229  *
230  * possible return values for *result:
231  * - SCIP_SUCCESS : the conflicting bound change has been successfully resolved by adding all reason bounds
232  * - SCIP_DIDNOTFIND : the conflicting bound change could not be resolved and has to be put into the conflict set
233  *
234  * @note it is sufficient to explain/resolve the relaxed bound
235  */
236 #define SCIP_DECL_PROPRESPROP(x) SCIP_RETCODE x (SCIP* scip, SCIP_PROP* prop, SCIP_VAR* infervar, int inferinfo, \
237  SCIP_BOUNDTYPE boundtype, SCIP_BDCHGIDX* bdchgidx, SCIP_Real relaxedbd, SCIP_RESULT* result)
238 
239 #ifdef __cplusplus
240 }
241 #endif
242 
243 #endif
244