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