Scippy

SCIP

Solving Constraint Integer Programs

type_cons.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_cons.h
17  * @ingroup TYPEDEFINITIONS
18  * @brief type definitions for constraints and constraint handlers
19  * @author Tobias Achterberg
20  * @author Stefan Heinz
21  *
22  * This file defines the interface for constraint handlers implemented in C.
23  *
24  * - \ref CONS "Instructions for implementing a constraint handler"
25  * - \ref CONSHDLRS "List of available constraint handlers"
26  * - \ref scip::ObjConshdlr "C++ wrapper class"
27  */
28 
29 /*---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0----+----1----+----2*/
30 
31 #ifndef __SCIP_TYPE_CONS_H__
32 #define __SCIP_TYPE_CONS_H__
33 
34 #include "scip/def.h"
35 #include "scip/type_retcode.h"
36 #include "scip/type_result.h"
37 #include "scip/type_var.h"
38 #include "scip/type_sol.h"
39 #include "scip/type_scip.h"
40 #include "scip/type_timing.h"
41 
42 #ifdef __cplusplus
43 extern "C" {
44 #endif
45 
46 typedef struct SCIP_Conshdlr SCIP_CONSHDLR; /**< constraint handler for a specific constraint type */
47 typedef struct SCIP_Cons SCIP_CONS; /**< constraint data structure */
48 typedef struct SCIP_ConshdlrData SCIP_CONSHDLRDATA; /**< constraint handler data */
49 typedef struct SCIP_ConsData SCIP_CONSDATA; /**< locally defined constraint type specific data */
50 typedef struct SCIP_ConsSetChg SCIP_CONSSETCHG; /**< tracks additions and removals of the set of active constraints */
51 
52 /** copy method for constraint handler plugins (called when SCIP copies plugins)
53  *
54  * If the copy process was a one to one the valid pointer can set to TRUE. Otherwise, you have to set this pointer to
55  * FALSE. In case all problem defining objects (constraint handlers and variable pricers) return a valid TRUE for all
56  * their copying calls, SCIP assumes that it is a overall one to one copy of the original instance. In this case any
57  * reductions made in the copied SCIP instance can be transfer to the original SCIP instance. If the valid pointer is
58  * set to TRUE and it was not one to one copy, it might happen that optimal solutions are cut off.
59  *
60  * input:
61  * - scip : SCIP main data structure
62  * - conshdlr : the constraint handler itself
63  * - valid : was the copying process valid?
64  */
65 #define SCIP_DECL_CONSHDLRCOPY(x) SCIP_RETCODE x (SCIP* scip, SCIP_CONSHDLR* conshdlr, SCIP_Bool* valid)
66 
67 /** destructor of constraint handler to free constraint handler data (called when SCIP is exiting)
68  *
69  * input:
70  * - scip : SCIP main data structure
71  * - conshdlr : the constraint handler itself
72  */
73 #define SCIP_DECL_CONSFREE(x) SCIP_RETCODE x (SCIP* scip, SCIP_CONSHDLR* conshdlr)
74 
75 /** initialization method of constraint handler (called after problem was transformed)
76  *
77  * input:
78  * - scip : SCIP main data structure
79  * - conshdlr : the constraint handler itself
80  * - conss : array of constraints in transformed problem
81  * - nconss : number of constraints in transformed problem
82  */
83 #define SCIP_DECL_CONSINIT(x) SCIP_RETCODE x (SCIP* scip, SCIP_CONSHDLR* conshdlr, SCIP_CONS** conss, int nconss)
84 
85 /** deinitialization method of constraint handler (called before transformed problem is freed)
86  *
87  * input:
88  * - scip : SCIP main data structure
89  * - conshdlr : the constraint handler itself
90  * - conss : array of constraints in transformed problem
91  * - nconss : number of constraints in transformed problem
92  */
93 #define SCIP_DECL_CONSEXIT(x) SCIP_RETCODE x (SCIP* scip, SCIP_CONSHDLR* conshdlr, SCIP_CONS** conss, int nconss)
94 
95 /** presolving initialization method of constraint handler (called when presolving is about to begin)
96  *
97  * This method is called when the presolving process is about to begin, even if presolving is turned off.
98  * The constraint handler may use this call to initialize its data structures.
99  *
100  * Necessary modifications that have to be performed even if presolving is turned off should be done here or in the
101  * presolving deinitialization call (SCIP_DECL_CONSEXITPRE()).
102  *
103  * @note Note that the constraint array might contain constraints that were created but not added to the problem.
104  * Constraints that are not added, i.e., for which SCIPconsIsAdded() returns FALSE, cannot be used for problem
105  * reductions.
106  *
107  * input:
108  * - scip : SCIP main data structure
109  * - conshdlr : the constraint handler itself
110  * - conss : array of constraints in transformed problem
111  * - nconss : number of constraints in transformed problem
112  */
113 #define SCIP_DECL_CONSINITPRE(x) SCIP_RETCODE x (SCIP* scip, SCIP_CONSHDLR* conshdlr, SCIP_CONS** conss, int nconss)
114 
115 /** presolving deinitialization method of constraint handler (called after presolving has been finished)
116  *
117  * This method is called after the presolving has been finished, even if presolving is turned off.
118  * The constraint handler may use this call e.g. to clean up or modify its data structures.
119  *
120  * Necessary modifications that have to be performed even if presolving is turned off should be done here or in the
121  * presolving initialization call (SCIP_DECL_CONSINITPRE()).
122  *
123  * Besides necessary modifications and clean up, no time consuming operations should be performed, especially if the
124  * problem has already been solved. Use the method SCIPgetStatus(), which in this case returns SCIP_STATUS_OPTIMAL,
125  * SCIP_STATUS_INFEASIBLE, SCIP_STATUS_UNBOUNDED, or SCIP_STATUS_INFORUNBD.
126  *
127  * @note Note that the constraint array might contain constraints that were created but not added to the problem.
128  * Constraints that are not added, i.e., for which SCIPconsIsAdded() returns FALSE, cannot be used for problem
129  * reductions.
130  *
131  * input:
132  * - scip : SCIP main data structure
133  * - conshdlr : the constraint handler itself
134  * - conss : final array of constraints in transformed problem
135  * - nconss : final number of constraints in transformed problem
136  */
137 #define SCIP_DECL_CONSEXITPRE(x) SCIP_RETCODE x (SCIP* scip, SCIP_CONSHDLR* conshdlr, SCIP_CONS** conss, int nconss)
138 
139 /** solving process initialization method of constraint handler (called when branch and bound process is about to begin)
140  *
141  * This method is called when the presolving was finished and the branch and bound process is about to begin.
142  * The constraint handler may use this call to initialize its branch and bound specific data.
143  *
144  * Besides necessary modifications and clean up, no time consuming operations should be performed, especially if the
145  * problem has already been solved. Use the method SCIPgetStatus(), which in this case returns SCIP_STATUS_OPTIMAL,
146  * SCIP_STATUS_INFEASIBLE, SCIP_STATUS_UNBOUNDED, or SCIP_STATUS_INFORUNBD.
147  *
148  * @note Note that the constraint array might contain constraints that were created but not added to the problem.
149  * Constraints that are not added, i.e., for which SCIPconsIsAdded() returns FALSE, cannot be used for problem
150  * reductions.
151  *
152  * input:
153  * - scip : SCIP main data structure
154  * - conshdlr : the constraint handler itself
155  * - conss : array of constraints of the constraint handler
156  * - nconss : number of constraints of the constraint handler
157  */
158 #define SCIP_DECL_CONSINITSOL(x) SCIP_RETCODE x (SCIP* scip, SCIP_CONSHDLR* conshdlr, SCIP_CONS** conss, int nconss)
159 
160 /** solving process deinitialization method of constraint handler (called before branch and bound process data is freed)
161  *
162  * This method is called before the branch and bound process is freed.
163  * The constraint handler should use this call to clean up its branch and bound data, in particular to release
164  * all LP rows that he has created or captured.
165  *
166  * input:
167  * - scip : SCIP main data structure
168  * - conshdlr : the constraint handler itself
169  * - conss : array of constraints of the constraint handler
170  * - nconss : number of constraints of the constraint handler
171  * - restart : was this exit solve call triggered by a restart?
172  */
173 #define SCIP_DECL_CONSEXITSOL(x) SCIP_RETCODE x (SCIP* scip, SCIP_CONSHDLR* conshdlr, SCIP_CONS** conss, int nconss, SCIP_Bool restart)
174 
175 /** frees specific constraint data
176  *
177  * @warning There may exist unprocessed events. For example, a variable's bound may have been already changed, but the
178  * corresponding bound change event was not yet processed.
179  *
180  * input:
181  * - scip : SCIP main data structure
182  * - conshdlr : the constraint handler itself
183  * - cons : the constraint belonging to the constraint data
184  * - consdata : pointer to the constraint data to free
185  */
186 #define SCIP_DECL_CONSDELETE(x) SCIP_RETCODE x (SCIP* scip, SCIP_CONSHDLR* conshdlr, SCIP_CONS* cons, SCIP_CONSDATA** consdata)
187 
188 /** transforms constraint data into data belonging to the transformed problem
189  *
190  * input:
191  * - scip : SCIP main data structure
192  * - conshdlr : the constraint handler itself
193  * - sourcecons : source constraint to transform
194  * - targetcons : pointer to store created target constraint
195  */
196 #define SCIP_DECL_CONSTRANS(x) SCIP_RETCODE x (SCIP* scip, SCIP_CONSHDLR* conshdlr, SCIP_CONS* sourcecons, SCIP_CONS** targetcons)
197 
198 /** LP initialization method of constraint handler (called before the initial LP relaxation at a node is solved)
199  *
200  * Puts the LP relaxations of all "initial" constraints into the LP. The method should put a canonic LP relaxation
201  * of all given constraints to the LP with calls to SCIPaddCut().
202  *
203  * input:
204  * - scip : SCIP main data structure
205  * - conshdlr : the constraint handler itself
206  * - conss : array of constraints to process
207  * - nconss : number of constraints to process
208  */
209 #define SCIP_DECL_CONSINITLP(x) SCIP_RETCODE x (SCIP* scip, SCIP_CONSHDLR* conshdlr, SCIP_CONS** conss, int nconss)
210 
211 /** separation method of constraint handler for LP solution
212  *
213  * Separates all constraints of the constraint handler. The method is called in the LP solution loop,
214  * which means that a valid LP solution exists.
215  *
216  * The first nusefulconss constraints are the ones, that are identified to likely be violated. The separation
217  * method should process only the useful constraints in most runs, and only occasionally the remaining
218  * nconss - nusefulconss constraints.
219  *
220  * input:
221  * - scip : SCIP main data structure
222  * - conshdlr : the constraint handler itself
223  * - conss : array of constraints to process
224  * - nconss : number of constraints to process
225  * - nusefulconss : number of useful (non-obsolete) constraints to process
226  * - result : pointer to store the result of the separation call
227  *
228  * possible return values for *result (if more than one applies, the first in the list should be used):
229  * - SCIP_CUTOFF : the node is infeasible in the variable's bounds and can be cut off
230  * - SCIP_CONSADDED : an additional constraint was generated
231  * - SCIP_REDUCEDDOM : a variable's domain was reduced
232  * - SCIP_SEPARATED : a cutting plane was generated
233  * - SCIP_NEWROUND : a cutting plane was generated and a new separation round should immediately start
234  * - SCIP_DIDNOTFIND : the separator searched, but did not find domain reductions, cutting planes, or cut constraints
235  * - SCIP_DIDNOTRUN : the separator was skipped
236  * - SCIP_DELAYED : the separator was skipped, but should be called again
237  */
238 #define SCIP_DECL_CONSSEPALP(x) SCIP_RETCODE x (SCIP* scip, SCIP_CONSHDLR* conshdlr, SCIP_CONS** conss, \
239  int nconss, int nusefulconss, SCIP_RESULT* result)
240 
241 /** separation method of constraint handler for arbitrary primal solution
242  *
243  * Separates all constraints of the constraint handler. The method is called outside the LP solution loop (e.g., by
244  * a relaxator or a primal heuristic), which means that there is no valid LP solution.
245  * Instead, the method should produce cuts that separate the given solution.
246  *
247  * The first nusefulconss constraints are the ones, that are identified to likely be violated. The separation
248  * method should process only the useful constraints in most runs, and only occasionally the remaining
249  * nconss - nusefulconss constraints.
250  *
251  * input:
252  * - scip : SCIP main data structure
253  * - conshdlr : the constraint handler itself
254  * - conss : array of constraints to process
255  * - nconss : number of constraints to process
256  * - nusefulconss : number of useful (non-obsolete) constraints to process
257  * - sol : primal solution that should be separated
258  * - result : pointer to store the result of the separation call
259  *
260  * possible return values for *result (if more than one applies, the first in the list should be used):
261  * - SCIP_CUTOFF : the node is infeasible in the variable's bounds and can be cut off
262  * - SCIP_CONSADDED : an additional constraint was generated
263  * - SCIP_REDUCEDDOM : a variable's domain was reduced
264  * - SCIP_SEPARATED : a cutting plane was generated
265  * - SCIP_NEWROUND : a cutting plane was generated and a new separation round should immediately start
266  * - SCIP_DIDNOTFIND : the separator searched, but did not find domain reductions, cutting planes, or cut constraints
267  * - SCIP_DIDNOTRUN : the separator was skipped
268  * - SCIP_DELAYED : the separator was skipped, but should be called again
269  */
270 #define SCIP_DECL_CONSSEPASOL(x) SCIP_RETCODE x (SCIP* scip, SCIP_CONSHDLR* conshdlr, SCIP_CONS** conss, \
271  int nconss, int nusefulconss, SCIP_SOL* sol, SCIP_RESULT* result)
272 
273 /** constraint enforcing method of constraint handler for LP solutions
274  *
275  * The method is called at the end of the node processing loop for a node where the LP was solved.
276  * The LP solution has to be checked for feasibility. If possible, an infeasibility should be resolved by
277  * branching, reducing a variable's domain to exclude the solution or separating the solution with a valid
278  * cutting plane.
279  *
280  * The enforcing methods of the active constraint handlers are called in decreasing order of their enforcing
281  * priorities until the first constraint handler returned with the value SCIP_CUTOFF, SCIP_SEPARATED,
282  * SCIP_REDUCEDDOM, SCIP_CONSADDED, or SCIP_BRANCHED.
283  * The integrality constraint handler has an enforcing priority of zero. A constraint handler which can
284  * (or wants) to enforce its constraints only for integral solutions should have a negative enforcing priority
285  * (e.g. the alldiff-constraint can only operate on integral solutions).
286  * A constraint handler which wants to incorporate its own branching strategy even on non-integral
287  * solutions must have an enforcing priority greater than zero (e.g. the SOS-constraint incorporates
288  * SOS-branching on non-integral solutions).
289  *
290  * The first nusefulconss constraints are the ones, that are identified to likely be violated. The enforcing
291  * method should process the useful constraints first. The other nconss - nusefulconss constraints should only
292  * be enforced, if no violation was found in the useful constraints.
293  *
294  * input:
295  * - scip : SCIP main data structure
296  * - conshdlr : the constraint handler itself
297  * - conss : array of constraints to process
298  * - nconss : number of constraints to process
299  * - nusefulconss : number of useful (non-obsolete) constraints to process
300  * - solinfeasible : was the solution already declared infeasible by a constraint handler?
301  * - result : pointer to store the result of the enforcing call
302  *
303  * possible return values for *result (if more than one applies, the first in the list should be used):
304  * - SCIP_CUTOFF : the node is infeasible in the variable's bounds and can be cut off
305  * - SCIP_CONSADDED : an additional constraint was generated
306  * - SCIP_REDUCEDDOM : a variable's domain was reduced
307  * - SCIP_SEPARATED : a cutting plane was generated
308  * - SCIP_BRANCHED : no changes were made to the problem, but a branching was applied to resolve an infeasibility
309  * - SCIP_INFEASIBLE : at least one constraint is infeasible, but it was not resolved
310  * - SCIP_FEASIBLE : all constraints of the handler are feasible
311  */
312 #define SCIP_DECL_CONSENFOLP(x) SCIP_RETCODE x (SCIP* scip, SCIP_CONSHDLR* conshdlr, SCIP_CONS** conss, int nconss, int nusefulconss, \
313  SCIP_Bool solinfeasible, SCIP_RESULT* result)
314 
315 /** constraint enforcing method of constraint handler for pseudo solutions
316  *
317  * The method is called at the end of the node processing loop for a node where the LP was not solved.
318  * The pseudo solution has to be checked for feasibility. If possible, an infeasibility should be resolved by
319  * branching, reducing a variable's domain to exclude the solution or adding an additional constraint.
320  * Separation is not possible, since the LP is not processed at the current node. All LP informations like
321  * LP solution, slack values, or reduced costs are invalid and must not be accessed.
322  *
323  * Like in the enforcing method for LP solutions, the enforcing methods of the active constraint handlers are
324  * called in decreasing order of their enforcing priorities until the first constraint handler returned with
325  * the value SCIP_CUTOFF, SCIP_REDUCEDDOM, SCIP_CONSADDED, SCIP_BRANCHED, or SCIP_SOLVELP.
326  *
327  * The first nusefulconss constraints are the ones, that are identified to likely be violated. The enforcing
328  * method should process the useful constraints first. The other nconss - nusefulconss constraints should only
329  * be enforced, if no violation was found in the useful constraints.
330  *
331  * If the pseudo solution's objective value is lower than the lower bound of the node, it cannot be feasible
332  * and the enforcing method may skip it's check and set *result to SCIP_DIDNOTRUN. However, it can also process
333  * its constraints and return any other possible result code.
334  *
335  * input:
336  * - scip : SCIP main data structure
337  * - conshdlr : the constraint handler itself
338  * - conss : array of constraints to process
339  * - nconss : number of constraints to process
340  * - nusefulconss : number of useful (non-obsolete) constraints to process
341  * - solinfeasible : was the solution already declared infeasible by a constraint handler?
342  * - objinfeasible : is the solution infeasible anyway due to violating lower objective bound?
343  * - result : pointer to store the result of the enforcing call
344  *
345  * possible return values for *result (if more than one applies, the first in the list should be used):
346  * - SCIP_CUTOFF : the node is infeasible in the variable's bounds and can be cut off
347  * - SCIP_CONSADDED : an additional constraint was generated
348  * - SCIP_REDUCEDDOM : a variable's domain was reduced
349  * - SCIP_BRANCHED : no changes were made to the problem, but a branching was applied to resolve an infeasibility
350  * - SCIP_SOLVELP : at least one constraint is infeasible, and this can only be resolved by solving the LP
351  * - SCIP_INFEASIBLE : at least one constraint is infeasible, but it was not resolved
352  * - SCIP_FEASIBLE : all constraints of the handler are feasible
353  * - SCIP_DIDNOTRUN : the enforcement was skipped (only possible, if objinfeasible is true)
354  */
355 #define SCIP_DECL_CONSENFOPS(x) SCIP_RETCODE x (SCIP* scip, SCIP_CONSHDLR* conshdlr, SCIP_CONS** conss, int nconss, int nusefulconss, \
356  SCIP_Bool solinfeasible, SCIP_Bool objinfeasible, SCIP_RESULT* result)
357 
358 /** feasibility check method of constraint handler for integral solutions
359  *
360  * The given solution has to be checked for feasibility.
361  *
362  * The check methods of the active constraint handlers are called in decreasing order of their check
363  * priorities until the first constraint handler returned with the result SCIP_INFEASIBLE.
364  * The integrality constraint handler has a check priority of zero. A constraint handler which can
365  * (or wants) to check its constraints only for integral solutions should have a negative check priority
366  * (e.g. the alldiff-constraint can only operate on integral solutions).
367  * A constraint handler which wants to check feasibility even on non-integral solutions must have a
368  * check priority greater than zero (e.g. if the check is much faster than testing all variables for
369  * integrality).
370  *
371  * In some cases, integrality conditions or rows of the current LP don't have to be checked, because their
372  * feasibility is already checked or implicitly given. In these cases, 'checkintegrality' or
373  * 'checklprows' is FALSE.
374  *
375  * input:
376  * - scip : SCIP main data structure
377  * - conshdlr : the constraint handler itself
378  * - conss : array of constraints to process
379  * - nconss : number of constraints to process
380  * - sol : the solution to check feasibility for
381  * - checkintegrality: has integrality to be checked?
382  * - checklprows : have current LP rows to be checked?
383  * - printreason : should the reason for the violation be printed?
384  * - result : pointer to store the result of the feasibility checking call
385  *
386  * possible return values for *result:
387  * - SCIP_INFEASIBLE : at least one constraint of the handler is infeasible
388  * - SCIP_FEASIBLE : all constraints of the handler are feasible
389  */
390 #define SCIP_DECL_CONSCHECK(x) SCIP_RETCODE x (SCIP* scip, SCIP_CONSHDLR* conshdlr, SCIP_CONS** conss, int nconss, SCIP_SOL* sol, \
391  SCIP_Bool checkintegrality, SCIP_Bool checklprows, SCIP_Bool printreason, SCIP_RESULT* result)
392 
393 /** domain propagation method of constraint handler
394  *
395  * The first nusefulconss constraints are the ones, that are identified to likely be violated. The propagation
396  * method should process only the useful constraints in most runs, and only occasionally the remaining
397  * nconss - nusefulconss constraints.
398  *
399  * input:
400  * - scip : SCIP main data structure
401  * - conshdlr : the constraint handler itself
402  * - conss : array of constraints to process
403  * - nconss : number of constraints to process
404  * - nusefulconss : number of useful (non-obsolete) constraints to process
405  * - nmarkedconss : number of constraints which are marked to be definitely propagated
406  * - proptiming : current point in the node solving loop
407  * - result : pointer to store the result of the propagation call
408  *
409  * possible return values for *result:
410  * - SCIP_CUTOFF : the node is infeasible in the variable's bounds and can be cut off
411  * - SCIP_REDUCEDDOM : at least one domain reduction was found
412  * - SCIP_DIDNOTFIND : the propagator searched but did not find any domain reductions
413  * - SCIP_DIDNOTRUN : the propagator was skipped
414  * - SCIP_DELAYED : the propagator was skipped, but should be called again
415  */
416 #define SCIP_DECL_CONSPROP(x) SCIP_RETCODE x (SCIP* scip, SCIP_CONSHDLR* conshdlr, SCIP_CONS** conss, int nconss, int nusefulconss, int nmarkedconss, \
417  SCIP_PROPTIMING proptiming, SCIP_RESULT* result)
418 
419 /** presolving method of constraint handler
420  *
421  * The presolver should go through the variables and constraints and tighten the domains or
422  * constraints. Each tightening should increase the given total number of changes.
423  *
424  * input:
425  * - scip : SCIP main data structure
426  * - conshdlr : the constraint handler itself
427  * - conss : array of constraints to process
428  * - nconss : number of constraints to process
429  * - nrounds : number of presolving rounds already done
430  * - nnewfixedvars : number of variables fixed since the last call to the presolving method
431  * - nnewaggrvars : number of variables aggregated since the last call to the presolving method
432  * - nnewchgvartypes : number of variable type changes since the last call to the presolving method
433  * - nnewchgbds : number of variable bounds tightened since the last call to the presolving method
434  * - nnewholes : number of domain holes added since the last call to the presolving method
435  * - nnewdelconss : number of deleted constraints since the last call to the presolving method
436  * - nnewaddconss : number of added constraints since the last call to the presolving method
437  * - nnewupgdconss : number of upgraded constraints since the last call to the presolving method
438  * - nnewchgcoefs : number of changed coefficients since the last call to the presolving method
439  * - nnewchgsides : number of changed left or right hand sides since the last call to the presolving method
440  *
441  * @note the counters state the changes since the last call including the changes of this presolving method during its
442  * call
443  *
444  * input/output:
445  * - nfixedvars : pointer to count total number of variables fixed of all presolvers
446  * - naggrvars : pointer to count total number of variables aggregated of all presolvers
447  * - nchgvartypes : pointer to count total number of variable type changes of all presolvers
448  * - nchgbds : pointer to count total number of variable bounds tightened of all presolvers
449  * - naddholes : pointer to count total number of domain holes added of all presolvers
450  * - ndelconss : pointer to count total number of deleted constraints of all presolvers
451  * - naddconss : pointer to count total number of added constraints of all presolvers
452  * - nupgdconss : pointer to count total number of upgraded constraints of all presolvers
453  * - nchgcoefs : pointer to count total number of changed coefficients of all presolvers
454  * - nchgsides : pointer to count total number of changed left/right hand sides of all presolvers
455  *
456  * @todo: implement a final round of presolving after SCIPisPresolveFinished(),
457  * therefore, duplicate counters to a "relevant for finishing presolve" version
458  *
459  * output:
460  * - result : pointer to store the result of the presolving call
461  *
462  * possible return values for *result:
463  * - SCIP_UNBOUNDED : at least one variable is not bounded by any constraint in obj. direction -> problem is unbounded
464  * - SCIP_CUTOFF : at least one constraint is infeasible in the variable's bounds -> problem is infeasible
465  * - SCIP_SUCCESS : the presolving method found a reduction
466  * - SCIP_DIDNOTFIND : the presolving method searched, but did not find a presolving change
467  * - SCIP_DIDNOTRUN : the presolving method was skipped
468  * - SCIP_DELAYED : the presolving method was skipped, but should be called again
469  */
470 #define SCIP_DECL_CONSPRESOL(x) SCIP_RETCODE x (SCIP* scip, SCIP_CONSHDLR* conshdlr, SCIP_CONS** conss, int nconss, int nrounds, \
471  int nnewfixedvars, int nnewaggrvars, int nnewchgvartypes, int nnewchgbds, int nnewholes, \
472  int nnewdelconss, int nnewaddconss, int nnewupgdconss, int nnewchgcoefs, int nnewchgsides, \
473  int* nfixedvars, int* naggrvars, int* nchgvartypes, int* nchgbds, int* naddholes, \
474  int* ndelconss, int* naddconss, int* nupgdconss, int* nchgcoefs, int* nchgsides, SCIP_RESULT* result)
475 
476 /** propagation conflict resolving method of constraint handler
477  *
478  * This method is called during conflict analysis. If the constraint handler wants to support conflict analysis,
479  * it should call SCIPinferVarLbCons() or SCIPinferVarUbCons() in domain propagation instead of SCIPchgVarLb() or
480  * SCIPchgVarUb() in order to deduce bound changes on variables.
481  * In the SCIPinferVarLbCons() and SCIPinferVarUbCons() calls, the handler provides the constraint, that deduced the
482  * variable's bound change, and an integer value "inferinfo" that can be arbitrarily chosen.
483  * The propagation conflict resolving method can then be implemented, to provide a "reasons" for the bound
484  * changes, i.e. the bounds of variables at the time of the propagation, that forced the constraint to set the
485  * conflict variable's bound to its current value. It can use the "inferinfo" tag to identify its own propagation
486  * rule and thus identify the "reason" bounds. The bounds that form the reason of the assignment must then be provided
487  * by calls to SCIPaddConflictLb(), SCIPaddConflictUb(), SCIPaddConflictBd(), SCIPaddConflictRelaxedLb(),
488  * SCIPaddConflictRelaxedUb(), SCIPaddConflictRelaxedBd(), and/or SCIPaddConflictBinvar() in the propagation conflict
489  * resolving method.
490  *
491  * For example, the logicor constraint c = "x or y or z" fixes variable z to TRUE (i.e. changes the lower bound of z
492  * to 1.0), if both, x and y, are assigned to FALSE (i.e. if the upper bounds of these variables are 0.0). It uses
493  * SCIPinferVarLbCons(scip, z, 1.0, c, 0) to apply this assignment (an inference information tag is not needed by the
494  * constraint handler and is set to 0).
495  * In the conflict analysis, the constraint handler may be asked to resolve the lower bound change on z with
496  * constraint c, that was applied at a time given by a bound change index "bdchgidx".
497  * With a call to SCIPvarGetLbAtIndex(z, bdchgidx, TRUE), the handler can find out, that the lower bound of
498  * variable z was set to 1.0 at the given point of time, and should call SCIPaddConflictUb(scip, x, bdchgidx) and
499  * SCIPaddConflictUb(scip, y, bdchgidx) to tell SCIP, that the upper bounds of x and y at this point of time were
500  * the reason for the deduction of the lower bound of z.
501  *
502  * input:
503  * - scip : SCIP main data structure
504  * - conshdlr : the constraint handler itself
505  * - cons : the constraint that deduced the bound change of the conflict variable
506  * - infervar : the conflict variable whose bound change has to be resolved
507  * - inferinfo : the user information passed to the corresponding SCIPinferVarLbCons() or SCIPinferVarUbCons() call
508  * - boundtype : the type of the changed bound (lower or upper bound)
509  * - bdchgidx : the index of the bound change, representing the point of time where the change took place
510  * - relaxedbd : the relaxed bound which is sufficient to be explained
511  *
512  * output:
513  * - result : pointer to store the result of the propagation conflict resolving call
514  *
515  * possible return values for *result:
516  * - SCIP_SUCCESS : the conflicting bound change has been successfully resolved by adding all reason bounds
517  * - SCIP_DIDNOTFIND : the conflicting bound change could not be resolved and has to be put into the conflict set
518  *
519  * @note it is sufficient to explain/resolve the relaxed bound
520  */
521 #define SCIP_DECL_CONSRESPROP(x) SCIP_RETCODE x (SCIP* scip, SCIP_CONSHDLR* conshdlr, SCIP_CONS* cons, \
522  SCIP_VAR* infervar, int inferinfo, SCIP_BOUNDTYPE boundtype, SCIP_BDCHGIDX* bdchgidx, SCIP_Real relaxedbd, \
523  SCIP_RESULT* result)
524 
525 /** variable rounding lock method of constraint handler
526  *
527  * This method is called, after a constraint is added or removed from the transformed problem.
528  * It should update the rounding locks of all associated variables with calls to SCIPaddVarLocks(),
529  * depending on the way, the variable is involved in the constraint:
530  * - If the constraint may get violated by decreasing the value of a variable, it should call
531  * SCIPaddVarLocks(scip, var, nlockspos, nlocksneg), saying that rounding down is potentially rendering the
532  * (positive) constraint infeasible and rounding up is potentially rendering the negation of the constraint
533  * infeasible.
534  * - If the constraint may get violated by increasing the value of a variable, it should call
535  * SCIPaddVarLocks(scip, var, nlocksneg, nlockspos), saying that rounding up is potentially rendering the
536  * constraint's negation infeasible and rounding up is potentially rendering the constraint itself
537  * infeasible.
538  * - If the constraint may get violated by changing the variable in any direction, it should call
539  * SCIPaddVarLocks(scip, var, nlockspos + nlocksneg, nlockspos + nlocksneg).
540  *
541  * Consider the linear constraint "3x -5y +2z <= 7" as an example. The variable rounding lock method of the
542  * linear constraint handler should call SCIPaddVarLocks(scip, x, nlocksneg, nlockspos),
543  * SCIPaddVarLocks(scip, y, nlockspos, nlocksneg) and SCIPaddVarLocks(scip, z, nlocksneg, nlockspos) to tell SCIP,
544  * that rounding up of x and z and rounding down of y can destroy the feasibility of the constraint, while rounding
545  * down of x and z and rounding up of y can destroy the feasibility of the constraint's negation "3x -5y +2z > 7".
546  * A linear constraint "2 <= 3x -5y +2z <= 7" should call
547  * SCIPaddVarLocks(scip, ..., nlockspos + nlocksneg, nlockspos + nlocksneg) on all variables, since rounding in both
548  * directions of each variable can destroy both the feasibility of the constraint and it's negation
549  * "3x -5y +2z < 2 or 3x -5y +2z > 7".
550  *
551  * If the constraint itself contains other constraints as sub constraints (e.g. the "or" constraint concatenation
552  * "c(x) or d(x)"), the rounding lock methods of these constraints should be called in a proper way.
553  * - If the constraint may get violated by the violation of the sub constraint c, it should call
554  * SCIPaddConsLocks(scip, c, nlockspos, nlocksneg), saying that infeasibility of c may lead to infeasibility of
555  * the (positive) constraint, and infeasibility of c's negation (i.e. feasibility of c) may lead to infeasibility
556  * of the constraint's negation (i.e. feasibility of the constraint).
557  * - If the constraint may get violated by the feasibility of the sub constraint c, it should call
558  * SCIPaddConsLocks(scip, c, nlocksneg, nlockspos), saying that infeasibility of c may lead to infeasibility of
559  * the constraint's negation (i.e. feasibility of the constraint), and infeasibility of c's negation (i.e. feasibility
560  * of c) may lead to infeasibility of the (positive) constraint.
561  * - If the constraint may get violated by any change in the feasibility of the sub constraint c, it should call
562  * SCIPaddConsLocks(scip, c, nlockspos + nlocksneg, nlockspos + nlocksneg).
563  *
564  * Consider the or concatenation "c(x) or d(x)". The variable rounding lock method of the or constraint handler
565  * should call SCIPaddConsLocks(scip, c, nlockspos, nlocksneg) and SCIPaddConsLocks(scip, d, nlockspos, nlocksneg)
566  * to tell SCIP, that infeasibility of c and d can lead to infeasibility of "c(x) or d(x)".
567  *
568  * As a second example, consider the equivalence constraint "y <-> c(x)" with variable y and constraint c. The
569  * constraint demands, that y == 1 if and only if c(x) is satisfied. The variable lock method of the corresponding
570  * constraint handler should call SCIPaddVarLocks(scip, y, nlockspos + nlocksneg, nlockspos + nlocksneg) and
571  * SCIPaddConsLocks(scip, c, nlockspos + nlocksneg, nlockspos + nlocksneg), because any modification to the
572  * value of y or to the feasibility of c can alter the feasibility of the equivalence constraint.
573  *
574  * input:
575  * - scip : SCIP main data structure
576  * - conshdlr : the constraint handler itself
577  * - cons : the constraint that should lock rounding of its variables, or NULL if the constraint handler
578  * does not need constraints
579  * - nlockspos : number of times, the roundings should be locked for the constraint (may be negative)
580  * - nlocksneg : number of times, the roundings should be locked for the constraint's negation (may be negative)
581  */
582 #define SCIP_DECL_CONSLOCK(x) SCIP_RETCODE x (SCIP* scip, SCIP_CONSHDLR* conshdlr, SCIP_CONS* cons, int nlockspos, int nlocksneg)
583 
584 /** constraint activation notification method of constraint handler
585  *
586  * WARNING! There may exist unprocessed events. For example, a variable's bound may have been already changed, but
587  * the corresponding bound change event was not yet processed.
588  *
589  * This method is always called after a constraint of the constraint handler was activated. The constraint
590  * handler may use this call to update his own (statistical) data.
591  *
592  * input:
593  * - scip : SCIP main data structure
594  * - conshdlr : the constraint handler itself
595  * - cons : the constraint that has been activated
596  */
597 #define SCIP_DECL_CONSACTIVE(x) SCIP_RETCODE x (SCIP* scip, SCIP_CONSHDLR* conshdlr, SCIP_CONS* cons)
598 
599 /** constraint deactivation notification method of constraint handler
600  *
601  * WARNING! There may exist unprocessed events. For example, a variable's bound may have been already changed, but
602  * the corresponding bound change event was not yet processed.
603  *
604  * This method is always called before a constraint of the constraint handler is deactivated. The constraint
605  * handler may use this call to update his own (statistical) data.
606  *
607  * input:
608  * - scip : SCIP main data structure
609  * - conshdlr : the constraint handler itself
610  * - cons : the constraint that will be deactivated
611  */
612 #define SCIP_DECL_CONSDEACTIVE(x) SCIP_RETCODE x (SCIP* scip, SCIP_CONSHDLR* conshdlr, SCIP_CONS* cons)
613 
614 /** constraint enabling notification method of constraint handler
615  *
616  * WARNING! There may exist unprocessed events. For example, a variable's bound may have been already changed, but
617  * the corresponding bound change event was not yet processed.
618  *
619  * This method is always called after a constraint of the constraint handler was enabled. The constraint
620  * handler may use this call to update his own (statistical) data.
621  *
622  * input:
623  * - scip : SCIP main data structure
624  * - conshdlr : the constraint handler itself
625  * - cons : the constraint that has been enabled
626  */
627 #define SCIP_DECL_CONSENABLE(x) SCIP_RETCODE x (SCIP* scip, SCIP_CONSHDLR* conshdlr, SCIP_CONS* cons)
628 
629 /** constraint disabling notification method of constraint handler
630  *
631  * WARNING! There may exist unprocessed events. For example, a variable's bound may have been already changed, but
632  * the corresponding bound change event was not yet processed.
633  *
634  * This method is always called before a constraint of the constraint handler is disabled. The constraint
635  * handler may use this call to update his own (statistical) data.
636  *
637  * input:
638  * - scip : SCIP main data structure
639  * - conshdlr : the constraint handler itself
640  * - cons : the constraint that will be disabled
641  */
642 #define SCIP_DECL_CONSDISABLE(x) SCIP_RETCODE x (SCIP* scip, SCIP_CONSHDLR* conshdlr, SCIP_CONS* cons)
643 
644 /** variable deletion method of constraint handler
645  *
646  * This method is optinal and only of interest if you are using SCIP as a branch-and-price framework. That means, you
647  * are generating new variables during the search. If you are not doing that just define the function pointer to be
648  * NULL.
649  *
650  * If this method gets implemented you should iterate over all constraints of the constraint handler and delete all
651  * variables that were marked for deletion by SCIPdelVar().
652  *
653  * input:
654  * - scip : SCIP main data structure
655  * - conshdlr : the constraint handler itself
656  * - conss : array of constraints in transformed problem
657  * - nconss : number of constraints in transformed problem
658  */
659 #define SCIP_DECL_CONSDELVARS(x) SCIP_RETCODE x (SCIP* scip, SCIP_CONSHDLR* conshdlr, SCIP_CONS** conss, int nconss)
660 
661 /** constraint display method of constraint handler
662  *
663  * The constraint handler can store a representation of the constraint into the given text file. Use the method
664  * SCIPinfoMessage() to push a string into the file stream.
665  *
666  * @note There are several methods which help to display variables. These are SCIPwriteVarName(), SCIPwriteVarsList(),
667  * SCIPwriteVarsLinearsum(), and SCIPwriteVarsPolynomial().
668  *
669  * input: - scip : SCIP main data structure - conshdlr : the constraint handler itself - cons : the constraint that
670  * should be displayed - file : the text file to store the information into
671  *
672  */
673 #define SCIP_DECL_CONSPRINT(x) SCIP_RETCODE x (SCIP* scip, SCIP_CONSHDLR* conshdlr, SCIP_CONS* cons, FILE* file)
674 
675 /** constraint copying method of constraint handler
676  *
677  * The constraint handler can provide a copy method which copies a constraint from one SCIP data structure into a other
678  * SCIP data structure. If a copy of a constraint is created the constraint has to be captured (The capture is usually
679  * already done due to the creation of the constraint).
680  *
681  * If the copy process was a one to one the valid pointer can set to TRUE. Otherwise, you have to set this pointer to
682  * FALSE. In case all problem defining objects (constraint handlers and variable pricers) return a valid TRUE for all
683  * their copying calls, SCIP assumes that it is a overall one to one copy of the original instance. In this case any
684  * reductions made in the copied SCIP instance can be transfer to the original SCIP instance. If the valid pointer is
685  * set to TRUE and it was not one to one copy, it might happen that optimal solutions are cut off.
686  *
687  * To get a copy of a variable in the target SCIP you should use the function SCIPgetVarCopy().
688  *
689  * input:
690  * - scip : target SCIP data structure
691  * - cons : pointer to store the created target constraint
692  * - name : name of constraint, or NULL if the name of the source constraint should be used
693  * - sourcescip : source SCIP data structure
694  * - sourceconshdlr : source constraint handler of the source SCIP
695  * - sourcecons : source constraint of the source SCIP
696  * - varmap : a SCIP_HASHMAP mapping variables of the source SCIP to corresponding variables of the target SCIP
697  * - consmap : a SCIP_HASHMAP mapping constraints of the source SCIP to corresponding constraints of the target SCIP
698  * - initial : should the LP relaxation of constraint be in the initial LP?
699  * - separate : should the constraint be separated during LP processing?
700  * - enforce : should the constraint be enforced during node processing?
701  * - check : should the constraint be checked for feasibility?
702  * - propagate : should the constraint be propagated during node processing?
703  * - local : is constraint only valid locally?
704  * - modifiable : is constraint modifiable (subject to column generation)?
705  * - dynamic : is constraint subject to aging?
706  * - removable : should the relaxation be removed from the LP due to aging or cleanup?
707  * - stickingatnode : should the constraint always be kept at the node where it was added, even
708  * if it may be moved to a more global node?
709  * - global : should a global or a local copy be created?
710  *
711  * output:
712  * - valid : pointer to store whether the copying was valid or not
713  */
714 #define SCIP_DECL_CONSCOPY(x) SCIP_RETCODE x (SCIP* scip, SCIP_CONS** cons, const char* name, \
715  SCIP* sourcescip, SCIP_CONSHDLR* sourceconshdlr, SCIP_CONS* sourcecons, SCIP_HASHMAP* varmap, SCIP_HASHMAP* consmap, \
716  SCIP_Bool initial, SCIP_Bool separate, SCIP_Bool enforce, SCIP_Bool check, SCIP_Bool propagate, \
717  SCIP_Bool local, SCIP_Bool modifiable, SCIP_Bool dynamic, SCIP_Bool removable, SCIP_Bool stickingatnode, \
718  SCIP_Bool global, SCIP_Bool* valid)
719 
720 /** constraint parsing method of constraint handler
721  *
722  * The constraint handler can provide a callback to parse the output created by the display method
723  * (\ref SCIP_DECL_CONSPRINT) and to create a constraint out of it.
724  *
725  * @note For parsing there are several methods which are handy. Have a look at: SCIPparseVarName(),
726  * SCIPparseVarsList(), SCIPparseVarsLinearsum(), SCIPparseVarsPolynomial(), SCIPstrToRealValue(), and
727  * SCIPstrCopySection().
728  *
729  * input:
730  * - scip : SCIP main data structure
731  * - conshdlr : the constraint handler itself
732  * - cons : pointer to store the created constraint
733  * - name : name of the constraint
734  * - str : string to parse
735  * - initial : should the LP relaxation of constraint be in the initial LP?
736  * - separate : should the constraint be separated during LP processing?
737  * - enforce : should the constraint be enforced during node processing?
738  * - check : should the constraint be checked for feasibility?
739  * - propagate : should the constraint be propagated during node processing?
740  * - local : is constraint only valid locally?
741  * - modifiable : is constraint modifiable (subject to column generation)?
742  * - dynamic : is constraint subject to aging?
743  * - removable : should the relaxation be removed from the LP due to aging or cleanup?
744  * - stickingatnode : should the constraint always be kept at the node where it was added, even
745  * if it may be moved to a more global node?
746  * output:
747  * - success : pointer to store whether the parsing was successful or not
748  */
749 #define SCIP_DECL_CONSPARSE(x) SCIP_RETCODE x (SCIP* scip, SCIP_CONSHDLR* conshdlr, SCIP_CONS** cons, \
750  const char* name, const char* str, \
751  SCIP_Bool initial, SCIP_Bool separate, SCIP_Bool enforce, SCIP_Bool check, SCIP_Bool propagate, SCIP_Bool local, \
752  SCIP_Bool modifiable, SCIP_Bool dynamic, SCIP_Bool removable, SCIP_Bool stickingatnode, SCIP_Bool* success)
753 
754 /** constraint method of constraint handler which returns the variables (if possible)
755  *
756  * The constraint handler can (this callback is optional) provide this callback to return the variables which are
757  * involved in that particular constraint. If this is possible, the variables should be copyied into the variables
758  * array and the success pointers has to be set to TRUE. Otherwise the success has to be set FALSE or the callback
759  * should not be implemented.
760  *
761  * input:
762  * - scip : SCIP main data structure
763  * - conshdlr : the constraint handler itself
764  * - cons : the constraint that should return its variable data
765  *
766  * output:
767  * - vars : array to store/copy the involved variables of the constraint
768  * - varssize : available slots in vars array which is needed to check if the array is large enough
769  * - success : pointer to store whether the variables are successfully copied
770  */
771 #define SCIP_DECL_CONSGETVARS(x) SCIP_RETCODE x (SCIP* scip, SCIP_CONSHDLR* conshdlr, SCIP_CONS* cons, \
772  SCIP_VAR** vars, int varssize, SCIP_Bool* success)
773 
774 /** constraint method of constraint handler which returns the number of variables (if possible)
775  *
776  * The constraint handler can (this callback is optional) provide this callback to return the number variable which are
777  * involved in that particular constraint. If this is not possible, the success pointers has to be set to FALSE or the
778  * callback should not be implemented.
779  *
780  * input:
781  * - scip : SCIP main data structure
782  * - conshdlr : the constraint handler itself
783  * - cons : constraint for which the number of variables is wanted
784  *
785  * output:
786  * - nvars : pointer to store the number of variables
787  * - success : pointer to store whether the constraint successfully returned the number of variables
788  */
789 #define SCIP_DECL_CONSGETNVARS(x) SCIP_RETCODE x (SCIP* scip, SCIP_CONSHDLR* conshdlr, SCIP_CONS* cons, \
790  int* nvars, SCIP_Bool* success)
791 
792 #ifdef __cplusplus
793 }
794 #endif
795 
796 #endif
797