1 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
2 /*                                                                           */
3 /*                  This file is part of the program and library             */
4 /*         SCIP --- Solving Constraint Integer Programs                      */
5 /*                                                                           */
6 /*    Copyright (C) 2002-2021 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 visit scipopt.org.         */
13 /*                                                                           */
14 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
15 
16 /**@file   pub_cons.h
17  * @ingroup PUBLICCOREAPI
18  * @brief  public methods for managing constraints
19  * @author Tobias Achterberg
20  */
21 
22 /*---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0----+----1----+----2*/
23 
24 #ifndef __SCIP_PUB_CONS_H__
25 #define __SCIP_PUB_CONS_H__
26 
27 
28 #include "scip/def.h"
29 #include "scip/type_misc.h"
30 #include "scip/type_cons.h"
31 
32 #ifdef NDEBUG
33 #include "scip/struct_cons.h"
34 #endif
35 
36 #ifdef __cplusplus
37 extern "C" {
38 #endif
39 
40 /*
41  * Constraint handler methods
42  */
43 
44 /**@addtogroup PublicConshdlrMethods
45  *
46  * @{
47  */
48 
49 /** compares two constraint handlers w. r. to their separation priority */
50 SCIP_EXPORT
51 SCIP_DECL_SORTPTRCOMP(SCIPconshdlrCompSepa);
52 
53 /** compares two constraint handlers w. r. to their enforcing priority */
54 SCIP_EXPORT
55 SCIP_DECL_SORTPTRCOMP(SCIPconshdlrCompEnfo);
56 
57 /** compares two constraint handlers w. r. to their feasibility check priority */
58 SCIP_EXPORT
59 SCIP_DECL_SORTPTRCOMP(SCIPconshdlrCompCheck);
60 
61 /** gets name of constraint handler */
62 SCIP_EXPORT
63 const char* SCIPconshdlrGetName(
64    SCIP_CONSHDLR*        conshdlr            /**< constraint handler */
65    );
66 
67 /** gets description of constraint handler */
68 SCIP_EXPORT
69 const char* SCIPconshdlrGetDesc(
70    SCIP_CONSHDLR*        conshdlr            /**< constraint handler */
71    );
72 
73 /** gets user data of constraint handler */
74 SCIP_EXPORT
75 SCIP_CONSHDLRDATA* SCIPconshdlrGetData(
76    SCIP_CONSHDLR*        conshdlr            /**< constraint handler */
77    );
78 
79 /** sets user data of constraint handler; user has to free old data in advance! */
80 SCIP_EXPORT
81 void SCIPconshdlrSetData(
82    SCIP_CONSHDLR*        conshdlr,           /**< constraint handler */
83    SCIP_CONSHDLRDATA*    conshdlrdata        /**< new constraint handler user data */
84    );
85 
86 /** sets all separation related callbacks of the constraint handler */
87 SCIP_EXPORT
88 void SCIPconshdlrSetSepa(
89    SCIP_CONSHDLR*        conshdlr,           /**< constraint handler */
90    SCIP_DECL_CONSSEPALP  ((*conssepalp)),    /**< separate cutting planes for LP solution */
91    SCIP_DECL_CONSSEPASOL ((*conssepasol)),   /**< separate cutting planes for arbitrary primal solution */
92    int                   sepafreq,           /**< frequency for separating cuts; zero means to separate only in the root node */
93    int                   sepapriority,       /**< priority of the constraint handler for separation */
94    SCIP_Bool             delaysepa           /**< should separation method be delayed, if other separators found cuts? */
95    );
96 
97 /** sets both the propagation callback and the propagation frequency of the constraint handler */
98 SCIP_EXPORT
99 void SCIPconshdlrSetProp(
100    SCIP_CONSHDLR*        conshdlr,           /**< constraint handler */
101    SCIP_DECL_CONSPROP    ((*consprop)),      /**< propagate variable domains */
102    int                   propfreq,           /**< frequency for propagating domains; zero means only preprocessing propagation */
103    SCIP_Bool             delayprop,          /**< should propagation method be delayed, if other propagators found reductions? */
104    SCIP_PROPTIMING       timingmask          /**< positions in the node solving loop where propagators should be executed */
105    );
106 
107 /** sets the relaxation enforcement method of the constraint handler */
108 SCIP_EXPORT
109 void SCIPconshdlrSetEnforelax(
110    SCIP_CONSHDLR*        conshdlr,           /**< constraint handler */
111    SCIP_DECL_CONSENFORELAX ((*consenforelax)) /**< constraint copying method */
112    );
113 
114 /** gets array with constraints of constraint handler; the first SCIPconshdlrGetNActiveConss() entries are the active
115  *  constraints, the last SCIPconshdlrGetNConss() - SCIPconshdlrGetNActiveConss() constraints are deactivated
116  *
117  *  @note A constraint is active if it is global and was not removed or it was added locally (in that case the local
118  *        flag is TRUE) and the current node belongs to the corresponding sub tree.
119  */
120 SCIP_EXPORT
121 SCIP_CONS** SCIPconshdlrGetConss(
122    SCIP_CONSHDLR*        conshdlr            /**< constraint handler */
123    );
124 
125 /** gets array with enforced constraints of constraint handler; this is local information */
126 SCIP_EXPORT
127 SCIP_CONS** SCIPconshdlrGetEnfoConss(
128    SCIP_CONSHDLR*        conshdlr            /**< constraint handler */
129    );
130 
131 /** gets array with checked constraints of constraint handler; this is local information */
132 SCIP_EXPORT
133 SCIP_CONS** SCIPconshdlrGetCheckConss(
134    SCIP_CONSHDLR*        conshdlr            /**< constraint handler */
135    );
136 
137 /** gets array with delayed update constraints
138  *
139  * @attention Usually, there should be no need to access this array. Use this only if you are absolutely sure what you are doing.
140  */
141 SCIP_EXPORT
142 SCIP_CONS** SCIPconshdlrGetUpdateConss(
143    SCIP_CONSHDLR*        conshdlr            /**< constraint handler */
144    );
145 
146 /** gets total number of existing transformed constraints of constraint handler */
147 SCIP_EXPORT
148 int SCIPconshdlrGetNConss(
149    SCIP_CONSHDLR*        conshdlr            /**< constraint handler */
150    );
151 
152 /** gets number of enforced constraints of constraint handler; this is local information */
153 SCIP_EXPORT
154 int SCIPconshdlrGetNEnfoConss(
155    SCIP_CONSHDLR*        conshdlr            /**< constraint handler */
156    );
157 
158 /** gets number of checked constraints of constraint handler; this is local information */
159 SCIP_EXPORT
160 int SCIPconshdlrGetNCheckConss(
161    SCIP_CONSHDLR*        conshdlr            /**< constraint handler */
162    );
163 
164 /** gets number of active constraints of constraint handler
165  *
166  *  @note A constraint is active if it is global and was not removed or it was added locally (in that case the local
167  *        flag is TRUE) and the current node belongs to the corresponding sub tree.
168  */
169 SCIP_EXPORT
170 int SCIPconshdlrGetNActiveConss(
171    SCIP_CONSHDLR*        conshdlr            /**< constraint handler */
172    );
173 
174 /** gets number of enabled constraints of constraint handler */
175 SCIP_EXPORT
176 int SCIPconshdlrGetNEnabledConss(
177    SCIP_CONSHDLR*        conshdlr            /**< constraint handler */
178    );
179 
180 /** gets number of constraints that have delayed updates */
181 SCIP_EXPORT
182 int SCIPconshdlrGetNUpdateConss(
183    SCIP_CONSHDLR*        conshdlr            /**< constraint handler */
184    );
185 
186 /** gets time in seconds used for setting up this constraint handler for new stages */
187 SCIP_EXPORT
188 SCIP_Real SCIPconshdlrGetSetupTime(
189    SCIP_CONSHDLR*        conshdlr            /**< constraint handler */
190    );
191 
192 /** gets time in seconds used for presolving in this constraint handler */
193 SCIP_EXPORT
194 SCIP_Real SCIPconshdlrGetPresolTime(
195    SCIP_CONSHDLR*        conshdlr            /**< constraint handler */
196    );
197 
198 /** gets time in seconds used for separation in this constraint handler */
199 SCIP_EXPORT
200 SCIP_Real SCIPconshdlrGetSepaTime(
201    SCIP_CONSHDLR*        conshdlr            /**< constraint handler */
202    );
203 
204 /** gets time in seconds used for LP enforcement in this constraint handler */
205 SCIP_EXPORT
206 SCIP_Real SCIPconshdlrGetEnfoLPTime(
207    SCIP_CONSHDLR*        conshdlr            /**< constraint handler */
208    );
209 
210 /** gets time in seconds used for pseudo enforcement in this constraint handler */
211 SCIP_EXPORT
212 SCIP_Real SCIPconshdlrGetEnfoPSTime(
213    SCIP_CONSHDLR*        conshdlr            /**< constraint handler */
214    );
215 
216 /** gets time in seconds used for relaxation enforcement in this constraint handler */
217 SCIP_EXPORT
218 SCIP_Real SCIPconshdlrGetEnfoRelaxTime(
219    SCIP_CONSHDLR*        conshdlr            /**< constraint handler */
220    );
221 
222 /** gets time in seconds used for propagation in this constraint handler */
223 SCIP_EXPORT
224 SCIP_Real SCIPconshdlrGetPropTime(
225    SCIP_CONSHDLR*        conshdlr            /**< constraint handler */
226    );
227 
228 /** gets time in seconds used for propagation in this constraint handler during strong branching */
229 SCIP_EXPORT
230 SCIP_Real SCIPconshdlrGetStrongBranchPropTime(
231    SCIP_CONSHDLR*        conshdlr            /**< constraint handler */
232    );
233 
234 /** gets time in seconds used for feasibility checking in this constraint handler */
235 SCIP_EXPORT
236 SCIP_Real SCIPconshdlrGetCheckTime(
237    SCIP_CONSHDLR*        conshdlr            /**< constraint handler */
238    );
239 
240 /** gets time in seconds used for resolving propagation in this constraint handler */
241 SCIP_EXPORT
242 SCIP_Real SCIPconshdlrGetRespropTime(
243    SCIP_CONSHDLR*        conshdlr            /**< constraint handler */
244    );
245 
246 /** gets number of calls to the constraint handler's separation method */
247 SCIP_EXPORT
248 SCIP_Longint SCIPconshdlrGetNSepaCalls(
249    SCIP_CONSHDLR*        conshdlr            /**< constraint handler */
250    );
251 
252 /** gets number of calls to the constraint handler's LP enforcing method */
253 SCIP_EXPORT
254 SCIP_Longint SCIPconshdlrGetNEnfoLPCalls(
255    SCIP_CONSHDLR*        conshdlr            /**< constraint handler */
256    );
257 
258 /** gets number of calls to the constraint handler's pseudo enforcing method */
259 SCIP_EXPORT
260 SCIP_Longint SCIPconshdlrGetNEnfoPSCalls(
261    SCIP_CONSHDLR*        conshdlr            /**< constraint handler */
262    );
263 
264 /** gets number of calls to the constraint handler's relaxation enforcing method */
265 SCIP_EXPORT
266 SCIP_Longint SCIPconshdlrGetNEnfoRelaxCalls(
267    SCIP_CONSHDLR*        conshdlr            /**< constraint handler */
268    );
269 
270 /** gets number of calls to the constraint handler's propagation method */
271 SCIP_EXPORT
272 SCIP_Longint SCIPconshdlrGetNPropCalls(
273    SCIP_CONSHDLR*        conshdlr            /**< constraint handler */
274    );
275 
276 /** gets number of calls to the constraint handler's checking method */
277 SCIP_EXPORT
278 SCIP_Longint SCIPconshdlrGetNCheckCalls(
279    SCIP_CONSHDLR*        conshdlr            /**< constraint handler */
280    );
281 
282 /** gets number of calls to the constraint handler's resolve propagation method */
283 SCIP_EXPORT
284 SCIP_Longint SCIPconshdlrGetNRespropCalls(
285    SCIP_CONSHDLR*        conshdlr            /**< constraint handler */
286    );
287 
288 /** gets total number of times, this constraint handler detected a cutoff */
289 SCIP_EXPORT
290 SCIP_Longint SCIPconshdlrGetNCutoffs(
291    SCIP_CONSHDLR*        conshdlr            /**< constraint handler */
292    );
293 
294 /** gets total number of cuts found by this constraint handler */
295 SCIP_EXPORT
296 SCIP_Longint SCIPconshdlrGetNCutsFound(
297    SCIP_CONSHDLR*        conshdlr            /**< constraint handler */
298    );
299 
300 /** gets total number of cuts found by this constraint handler applied to lp */
301 SCIP_EXPORT
302 SCIP_Longint SCIPconshdlrGetNCutsApplied(
303    SCIP_CONSHDLR*        conshdlr            /**< constraint handler */
304    );
305 
306 /** gets total number of additional constraints added by this constraint handler */
307 SCIP_EXPORT
308 SCIP_Longint SCIPconshdlrGetNConssFound(
309    SCIP_CONSHDLR*        conshdlr            /**< constraint handler */
310    );
311 
312 /** gets total number of domain reductions found by this constraint handler */
313 SCIP_EXPORT
314 SCIP_Longint SCIPconshdlrGetNDomredsFound(
315    SCIP_CONSHDLR*        conshdlr            /**< constraint handler */
316    );
317 
318 /** gets number of children created by this constraint handler */
319 SCIP_EXPORT
320 SCIP_Longint SCIPconshdlrGetNChildren(
321    SCIP_CONSHDLR*        conshdlr            /**< constraint handler */
322    );
323 
324 /** gets maximum number of active constraints of constraint handler existing at the same time */
325 SCIP_EXPORT
326 int SCIPconshdlrGetMaxNActiveConss(
327    SCIP_CONSHDLR*        conshdlr            /**< constraint handler */
328    );
329 
330 /** gets initial number of active constraints of constraint handler */
331 SCIP_EXPORT
332 int SCIPconshdlrGetStartNActiveConss(
333    SCIP_CONSHDLR*        conshdlr            /**< constraint handler */
334    );
335 
336 /** gets number of variables fixed in presolving method of constraint handler */
337 SCIP_EXPORT
338 int SCIPconshdlrGetNFixedVars(
339    SCIP_CONSHDLR*        conshdlr            /**< constraint handler */
340    );
341 
342 /** gets number of variables aggregated in presolving method of constraint handler */
343 SCIP_EXPORT
344 int SCIPconshdlrGetNAggrVars(
345    SCIP_CONSHDLR*        conshdlr            /**< constraint handler */
346    );
347 
348 /** gets number of variable types changed in presolving method of constraint handler */
349 SCIP_EXPORT
350 int SCIPconshdlrGetNChgVarTypes(
351    SCIP_CONSHDLR*        conshdlr            /**< constraint handler */
352    );
353 
354 /** gets number of bounds changed in presolving method of constraint handler */
355 SCIP_EXPORT
356 int SCIPconshdlrGetNChgBds(
357    SCIP_CONSHDLR*        conshdlr            /**< constraint handler */
358    );
359 
360 /** gets number of holes added to domains of variables in presolving method of constraint handler */
361 SCIP_EXPORT
362 int SCIPconshdlrGetNAddHoles(
363    SCIP_CONSHDLR*        conshdlr            /**< constraint handler */
364    );
365 
366 /** gets number of constraints deleted in presolving method of constraint handler */
367 SCIP_EXPORT
368 int SCIPconshdlrGetNDelConss(
369    SCIP_CONSHDLR*        conshdlr            /**< constraint handler */
370    );
371 
372 /** gets number of constraints added in presolving method of constraint handler */
373 SCIP_EXPORT
374 int SCIPconshdlrGetNAddConss(
375    SCIP_CONSHDLR*        conshdlr            /**< constraint handler */
376    );
377 
378 /** gets number of constraints upgraded in presolving method of constraint handler */
379 SCIP_EXPORT
380 int SCIPconshdlrGetNUpgdConss(
381    SCIP_CONSHDLR*        conshdlr            /**< constraint handler */
382    );
383 
384 /** gets number of coefficients changed in presolving method of constraint handler */
385 SCIP_EXPORT
386 int SCIPconshdlrGetNChgCoefs(
387    SCIP_CONSHDLR*        conshdlr            /**< constraint handler */
388    );
389 
390 /** gets number of constraint sides changed in presolving method of constraint handler */
391 SCIP_EXPORT
392 int SCIPconshdlrGetNChgSides(
393    SCIP_CONSHDLR*        conshdlr            /**< constraint handler */
394    );
395 
396 /** gets number of times the presolving method of the constraint handler was called and tried to find reductions */
397 SCIP_EXPORT
398 int SCIPconshdlrGetNPresolCalls(
399    SCIP_CONSHDLR*        conshdlr            /**< constraint handler */
400    );
401 
402 /** gets separation priority of constraint handler */
403 SCIP_EXPORT
404 int SCIPconshdlrGetSepaPriority(
405    SCIP_CONSHDLR*        conshdlr            /**< constraint handler */
406    );
407 
408 /** gets enforcing priority of constraint handler */
409 SCIP_EXPORT
410 int SCIPconshdlrGetEnfoPriority(
411    SCIP_CONSHDLR*        conshdlr            /**< constraint handler */
412    );
413 
414 /** gets checking priority of constraint handler */
415 SCIP_EXPORT
416 int SCIPconshdlrGetCheckPriority(
417    SCIP_CONSHDLR*        conshdlr            /**< constraint handler */
418    );
419 
420 /** gets separation frequency of constraint handler */
421 SCIP_EXPORT
422 int SCIPconshdlrGetSepaFreq(
423    SCIP_CONSHDLR*        conshdlr            /**< constraint handler */
424    );
425 
426 /** gets propagation frequency of constraint handler */
427 SCIP_EXPORT
428 int SCIPconshdlrGetPropFreq(
429    SCIP_CONSHDLR*        conshdlr            /**< constraint handler */
430    );
431 
432 /** gets frequency of constraint handler for eager evaluations in separation, propagation and enforcement */
433 SCIP_EXPORT
434 int SCIPconshdlrGetEagerFreq(
435    SCIP_CONSHDLR*        conshdlr            /**< constraint handler */
436    );
437 
438 /** needs constraint handler a constraint to be called? */
439 SCIP_EXPORT
440 SCIP_Bool SCIPconshdlrNeedsCons(
441    SCIP_CONSHDLR*        conshdlr            /**< constraint handler */
442    );
443 
444 /** does the constraint handler perform presolving? */
445 SCIP_EXPORT
446 SCIP_Bool SCIPconshdlrDoesPresolve(
447    SCIP_CONSHDLR*        conshdlr            /**< constraint handler */
448    );
449 
450 /** should separation method be delayed, if other separators found cuts? */
451 SCIP_EXPORT
452 SCIP_Bool SCIPconshdlrIsSeparationDelayed(
453    SCIP_CONSHDLR*        conshdlr            /**< constraint handler */
454    );
455 
456 /** should propagation method be delayed, if other propagators found reductions? */
457 SCIP_EXPORT
458 SCIP_Bool SCIPconshdlrIsPropagationDelayed(
459    SCIP_CONSHDLR*        conshdlr            /**< constraint handler */
460    );
461 
462 /** was LP separation method delayed at the last call? */
463 SCIP_EXPORT
464 SCIP_Bool SCIPconshdlrWasLPSeparationDelayed(
465    SCIP_CONSHDLR*        conshdlr            /**< constraint handler */
466    );
467 
468 /** was primal solution separation method delayed at the last call? */
469 SCIP_EXPORT
470 SCIP_Bool SCIPconshdlrWasSolSeparationDelayed(
471    SCIP_CONSHDLR*        conshdlr            /**< constraint handler */
472    );
473 
474 /** was propagation method delayed at the last call? */
475 SCIP_EXPORT
476 SCIP_Bool SCIPconshdlrWasPropagationDelayed(
477    SCIP_CONSHDLR*        conshdlr            /**< constraint handler */
478    );
479 
480 /** is constraint handler initialized? */
481 SCIP_EXPORT
482 SCIP_Bool SCIPconshdlrIsInitialized(
483    SCIP_CONSHDLR*        conshdlr            /**< constraint handler */
484    );
485 
486 /** does the constraint handler have a copy function? */
487 SCIP_EXPORT
488 SCIP_Bool SCIPconshdlrIsClonable(
489    SCIP_CONSHDLR*        conshdlr            /**< constraint handler */
490    );
491 
492 /** returns the timing mask of the propagation method of the constraint handler */
493 SCIP_EXPORT
494 SCIP_PROPTIMING SCIPconshdlrGetPropTiming(
495    SCIP_CONSHDLR*        conshdlr            /**< constraint handler */
496    );
497 
498 /*
499  * Methods for constraint change sets
500  */
501 /** gets added constraints data for a constraint set change */
502 SCIP_EXPORT
503 void SCIPconssetchgGetAddedConsData(
504    SCIP_CONSSETCHG*      conssetchg,         /**< constraint set change to get data from */
505    SCIP_CONS***          conss,              /**< reference to constraints array added in the conssetchg, or NULL */
506    int*                  nconss              /**< reference to store the size of the constraints array, or NULL */
507    );
508 
509 /** sets the timing mask of the propagation method of the constraint handler */
510 SCIP_EXPORT
511 void SCIPconshdlrSetPropTiming(
512    SCIP_CONSHDLR*        conshdlr,           /**< constraint handler */
513    SCIP_PROPTIMING       proptiming          /**< timing mask to be set */
514    );
515 
516 
517 /** returns the timing mask of the presolving method of the constraint handler */
518 SCIP_EXPORT
519 SCIP_PRESOLTIMING SCIPconshdlrGetPresolTiming(
520    SCIP_CONSHDLR*        conshdlr            /**< constraint handler */
521    );
522 
523 /** sets the timing mask of the presolving method of the constraint handler */
524 SCIP_EXPORT
525 void SCIPconshdlrSetPresolTiming(
526    SCIP_CONSHDLR*        conshdlr,           /**< constraint handler */
527    SCIP_PRESOLTIMING     presoltiming        /** timing mask to be set */
528    );
529 
530 /** @} */
531 
532 /*
533  * Constraint methods
534  */
535 
536 /**@addtogroup PublicConstraintMethods
537  *
538  * @{
539  */
540 
541 
542 /** returns the name of the constraint
543  *
544  *  @note to change the name of a constraint, use SCIPchgConsName() from scip.h
545  */
546 SCIP_EXPORT
547 const char* SCIPconsGetName(
548    SCIP_CONS*            cons                /**< constraint */
549    );
550 
551 /** returns the position of constraint in the corresponding handler's conss array */
552 SCIP_EXPORT
553 int SCIPconsGetPos(
554    SCIP_CONS*            cons                /**< constraint */
555    );
556 
557 /** returns the constraint handler of the constraint */
558 SCIP_EXPORT
559 SCIP_CONSHDLR* SCIPconsGetHdlr(
560    SCIP_CONS*            cons                /**< constraint */
561    );
562 
563 /** returns the constraint data field of the constraint */
564 SCIP_EXPORT
565 SCIP_CONSDATA* SCIPconsGetData(
566    SCIP_CONS*            cons                /**< constraint */
567    );
568 
569 /** gets number of times, the constraint is currently captured */
570 SCIP_EXPORT
571 int SCIPconsGetNUses(
572    SCIP_CONS*            cons                /**< constraint */
573    );
574 
575 /** for an active constraint, returns the depth in the tree at which the constraint was activated */
576 SCIP_EXPORT
577 int SCIPconsGetActiveDepth(
578    SCIP_CONS*            cons                /**< constraint */
579    );
580 
581 /** returns the depth in the tree at which the constraint is valid; returns INT_MAX, if the constraint is local
582  *  and currently not active
583  */
584 SCIP_EXPORT
585 int SCIPconsGetValidDepth(
586    SCIP_CONS*            cons                /**< constraint */
587    );
588 
589 /** returns TRUE iff constraint is active in the current node */
590 SCIP_EXPORT
591 SCIP_Bool SCIPconsIsActive(
592    SCIP_CONS*            cons                /**< constraint */
593    );
594 
595 /** returns TRUE iff constraint has to be deactivated in update phase */
596 SCIP_EXPORT
597 SCIP_Bool SCIPconsIsUpdatedeactivate(
598    SCIP_CONS*            cons                /**< constraint */
599    );
600 
601 /** returns TRUE iff constraint is enabled in the current node */
602 SCIP_EXPORT
603 SCIP_Bool SCIPconsIsEnabled(
604    SCIP_CONS*            cons                /**< constraint */
605    );
606 
607 /** returns TRUE iff constraint's separation is enabled in the current node */
608 SCIP_EXPORT
609 SCIP_Bool SCIPconsIsSeparationEnabled(
610    SCIP_CONS*            cons                /**< constraint */
611    );
612 
613 /** returns TRUE iff constraint's propagation is enabled in the current node */
614 SCIP_EXPORT
615 SCIP_Bool SCIPconsIsPropagationEnabled(
616    SCIP_CONS*            cons                /**< constraint */
617    );
618 
619 /** returns TRUE iff constraint is deleted or marked to be deleted */
620 SCIP_EXPORT
621 SCIP_Bool SCIPconsIsDeleted(
622    SCIP_CONS*            cons                /**< constraint */
623    );
624 
625 /** returns TRUE iff constraint is marked obsolete */
626 SCIP_EXPORT
627 SCIP_Bool SCIPconsIsObsolete(
628    SCIP_CONS*            cons                /**< constraint */
629    );
630 
631 /** returns TRUE iff constraint is marked as a conflict */
632 SCIP_EXPORT
633 SCIP_Bool SCIPconsIsConflict(
634    SCIP_CONS*            cons                /**< constraint */
635    );
636 
637 /** gets age of constraint */
638 SCIP_EXPORT
639 SCIP_Real SCIPconsGetAge(
640    SCIP_CONS*            cons                /**< constraint */
641    );
642 
643 /** returns TRUE iff the LP relaxation of constraint should be in the initial LP */
644 SCIP_EXPORT
645 SCIP_Bool SCIPconsIsInitial(
646    SCIP_CONS*            cons                /**< constraint */
647    );
648 
649 /** returns TRUE iff constraint should be separated during LP processing */
650 SCIP_EXPORT
651 SCIP_Bool SCIPconsIsSeparated(
652    SCIP_CONS*            cons                /**< constraint */
653    );
654 
655 /** returns TRUE iff constraint should be enforced during node processing */
656 SCIP_EXPORT
657 SCIP_Bool SCIPconsIsEnforced(
658    SCIP_CONS*            cons                /**< constraint */
659    );
660 
661 /** returns TRUE iff constraint should be checked for feasibility */
662 SCIP_EXPORT
663 SCIP_Bool SCIPconsIsChecked(
664    SCIP_CONS*            cons                /**< constraint */
665    );
666 
667 /** returns whether the constraint is marked for propagation */
668 SCIP_EXPORT
669 SCIP_Bool SCIPconsIsMarkedPropagate(
670    SCIP_CONS*            cons                /**< constraint */
671    );
672 
673 /** returns TRUE iff constraint should be propagated during node processing */
674 SCIP_EXPORT
675 SCIP_Bool SCIPconsIsPropagated(
676    SCIP_CONS*            cons                /**< constraint */
677    );
678 
679 /** returns TRUE iff constraint is globally valid */
680 SCIP_EXPORT
681 SCIP_Bool SCIPconsIsGlobal(
682    SCIP_CONS*            cons                /**< constraint */
683    );
684 
685 /** returns TRUE iff constraint is only locally valid or not added to any (sub)problem */
686 SCIP_EXPORT
687 SCIP_Bool SCIPconsIsLocal(
688    SCIP_CONS*            cons                /**< constraint */
689    );
690 
691 /** returns TRUE iff constraint is modifiable (subject to column generation) */
692 SCIP_EXPORT
693 SCIP_Bool SCIPconsIsModifiable(
694    SCIP_CONS*            cons                /**< constraint */
695    );
696 
697 /** returns TRUE iff constraint is subject to aging */
698 SCIP_EXPORT
699 SCIP_Bool SCIPconsIsDynamic(
700    SCIP_CONS*            cons                /**< constraint */
701    );
702 
703 /** returns TRUE iff constraint's relaxation should be removed from the LP due to aging or cleanup */
704 SCIP_EXPORT
705 SCIP_Bool SCIPconsIsRemovable(
706    SCIP_CONS*            cons                /**< constraint */
707    );
708 
709 /** returns TRUE iff constraint's relaxation should be removed from the LP due to aging or cleanup */
710 SCIP_EXPORT
711 SCIP_Bool SCIPconsIsStickingAtNode(
712    SCIP_CONS*            cons                /**< constraint */
713    );
714 
715 /** returns TRUE iff constraint belongs to the global problem */
716 SCIP_EXPORT
717 SCIP_Bool SCIPconsIsInProb(
718    SCIP_CONS*            cons                /**< constraint */
719    );
720 
721 /** returns TRUE iff constraint is belonging to original space */
722 SCIP_EXPORT
723 SCIP_Bool SCIPconsIsOriginal(
724    SCIP_CONS*            cons                /**< constraint */
725    );
726 
727 /** returns TRUE iff constraint is belonging to transformed space */
728 SCIP_EXPORT
729 SCIP_Bool SCIPconsIsTransformed(
730    SCIP_CONS*            cons                /**< constraint */
731    );
732 
733 /** returns TRUE iff roundings for variables in constraint are locked */
734 SCIP_EXPORT
735 SCIP_Bool SCIPconsIsLockedPos(
736    SCIP_CONS*            cons                /**< constraint */
737    );
738 
739 /** returns TRUE iff roundings for variables in constraint's negation are locked */
740 SCIP_EXPORT
741 SCIP_Bool SCIPconsIsLockedNeg(
742    SCIP_CONS*            cons                /**< constraint */
743    );
744 
745 /** returns TRUE iff roundings for variables in constraint or in constraint's negation are locked */
746 SCIP_EXPORT
747 SCIP_Bool SCIPconsIsLocked(
748    SCIP_CONS*            cons                /**< constraint */
749    );
750 
751 /** get number of times the roundings for variables in constraint are locked */
752 SCIP_EXPORT
753 int SCIPconsGetNLocksPos(
754    SCIP_CONS*            cons                /**< constraint */
755    );
756 
757 /** get number of times the roundings for variables in constraint's negation are locked */
758 SCIP_EXPORT
759 int SCIPconsGetNLocksNeg(
760    SCIP_CONS*            cons                /**< constraint */
761    );
762 
763 /** returns TRUE iff roundings of the given locktype for variables in constraint are locked */
764 SCIP_EXPORT
765 SCIP_Bool SCIPconsIsLockedTypePos(
766    SCIP_CONS*            cons,               /**< constraint */
767    SCIP_LOCKTYPE         locktype            /**< variable lock type */
768    );
769 
770 /** returns TRUE iff roundings of the given locktype for variables in constraint are locked */
771 SCIP_EXPORT
772 SCIP_Bool SCIPconsIsLockedTypeNeg(
773    SCIP_CONS*            cons,               /**< constraint */
774    SCIP_LOCKTYPE         locktype            /**< variable lock type */
775    );
776 
777 /** returns TRUE iff roundings of the given locktype for variables in constraint or in constraint's negation are locked */
778 SCIP_EXPORT
779 SCIP_Bool SCIPconsIsLockedType(
780    SCIP_CONS*            cons,               /**< constraint */
781    SCIP_LOCKTYPE         locktype            /**< variable lock type */
782    );
783 
784 /** get number of times the roundings of given locktype for variables in constraint are locked */
785 SCIP_EXPORT
786 int SCIPconsGetNLocksTypePos(
787    SCIP_CONS*            cons,               /**< constraint */
788    SCIP_LOCKTYPE         locktype            /**< variable lock type */
789    );
790 
791 /** get number of times the roundings of given locktype for variables in constraint's negation are locked */
792 SCIP_EXPORT
793 int SCIPconsGetNLocksTypeNeg(
794    SCIP_CONS*            cons,               /**< constraint */
795    SCIP_LOCKTYPE         locktype            /**< variable lock type */
796    );
797 
798 /** returns if the constraint was already added to a SCIP instance */
799 SCIP_EXPORT
800 SCIP_Bool SCIPconsIsAdded(
801    SCIP_CONS*            cons                /**< constraint */
802    );
803 
804 /** adds locks to (dis-)allow upgrading of constraint */
805 SCIP_EXPORT
806 void SCIPconsAddUpgradeLocks(
807    SCIP_CONS*            cons,               /**< constraint to add locks */
808    int                   nlocks              /**< number of locks to add */
809    );
810 
811 /** gets number of locks against upgrading the constraint, 0 means this constraint can be upgraded */
812 SCIP_EXPORT
813 int SCIPconsGetNUpgradeLocks(
814    SCIP_CONS*            cons                /**< constraint */
815    );
816 
817 #ifdef NDEBUG
818 
819 /* In optimized mode, the function calls are overwritten by defines to reduce the number of function calls and
820  * speed up the algorithms.
821  */
822 
823 #define SCIPconsGetName(cons)           (cons)->name
824 #define SCIPconsGetPos(cons)            (cons)->consspos
825 #define SCIPconsGetHdlr(cons)           (cons)->conshdlr
826 #define SCIPconsGetData(cons)           (cons)->consdata
827 #define SCIPconsGetNUses(cons)          (cons)->nuses
828 #define SCIPconsGetActiveDepth(cons)    (cons)->activedepth
829 #define SCIPconsGetValidDepth(cons)     (!(cons)->local ? 0     \
830       : !SCIPconsIsActive(cons) ? INT_MAX                       \
831       : (cons)->validdepth == -1 ? SCIPconsGetActiveDepth(cons) \
832       : (cons)->validdepth)
833 #define SCIPconsIsActive(cons)          ((cons)->updateactivate || ((cons)->active && !(cons)->updatedeactivate))
834 #define SCIPconsIsEnabled(cons)         ((cons)->updateenable || ((cons)->enabled && !(cons)->updatedisable))
835 #define SCIPconsIsSeparationEnabled(cons)                               \
836    (SCIPconsIsEnabled(cons) && ((cons)->updatesepaenable || ((cons)->sepaenabled && !(cons)->updatesepadisable)))
837 #define SCIPconsIsPropagationEnabled(cons)                              \
838    (SCIPconsIsEnabled(cons) && ((cons)->updatepropenable || ((cons)->propenabled && !(cons)->updatepropdisable)))
839 #define SCIPconsIsDeleted(cons)         ((cons)->deleted)
840 #define SCIPconsIsObsolete(cons)        ((cons)->updateobsolete || (cons)->obsolete)
841 #define SCIPconsIsConflict(cons)        ((cons)->conflict)
842 #define SCIPconsGetAge(cons)            (cons)->age
843 #define SCIPconsIsInitial(cons)         (cons)->initial
844 #define SCIPconsIsSeparated(cons)       (cons)->separate
845 #define SCIPconsIsEnforced(cons)        (cons)->enforce
846 #define SCIPconsIsChecked(cons)         (cons)->check
847 #define SCIPconsIsMarkedPropagate(cons) ((cons)->updatemarkpropagate || ((cons)->markpropagate && !(cons)->updateunmarkpropagate))
848 #define SCIPconsIsPropagated(cons)      (cons)->propagate
849 #define SCIPconsIsGlobal(cons)          !(cons)->local
850 #define SCIPconsIsLocal(cons)           (cons)->local
851 #define SCIPconsIsModifiable(cons)      (cons)->modifiable
852 #define SCIPconsIsDynamic(cons)         (cons)->dynamic
853 #define SCIPconsIsRemovable(cons)       (cons)->removable
854 #define SCIPconsIsStickingAtNode(cons)  (cons)->stickingatnode
855 #define SCIPconsIsInProb(cons)          ((cons)->addconssetchg == NULL && (cons)->addarraypos >= 0)
856 #define SCIPconsIsOriginal(cons)        (cons)->original
857 #define SCIPconsIsTransformed(cons)     !(cons)->original
858 #define SCIPconsIsLockedPos(cons)       ((cons)->nlockspos[SCIP_LOCKTYPE_MODEL] > 0)
859 #define SCIPconsIsLockedNeg(cons)       ((cons)->nlocksneg[SCIP_LOCKTYPE_MODEL] > 0)
860 #define SCIPconsIsLocked(cons)          ((cons)->nlockspos[SCIP_LOCKTYPE_MODEL] > 0 || (cons)->nlocksneg[SCIP_LOCKTYPE_MODEL] > 0)
861 #define SCIPconsGetNLocksPos(cons)      ((cons)->nlockspos[SCIP_LOCKTYPE_MODEL])
862 #define SCIPconsGetNLocksNeg(cons)      ((cons)->nlocksneg[SCIP_LOCKTYPE_MODEL])
863 #define SCIPconsIsLockedTypePos(cons, locktype)  ((cons)->nlockspos[locktype] > 0)
864 #define SCIPconsIsLockedTypeNeg(cons, locktype)  ((cons)->nlocksneg[locktype] > 0)
865 #define SCIPconsIsLockedType(cons, locktype)     ((cons)->nlockspos[locktype] > 0 || (cons)->nlocksneg[locktype] > 0)
866 #define SCIPconsGetNLocksTypePos(cons, locktype) ((cons)->nlockspos[locktype])
867 #define SCIPconsGetNLocksTypeNeg(cons, locktype) ((cons)->nlocksneg[locktype])
868 #define SCIPconsIsAdded(cons)           ((cons)->addarraypos >= 0)
869 #define SCIPconsGetNUpgradeLocks(cons)  ((cons)->nupgradelocks)
870 
871 #endif
872 
873 /** @} */
874 
875 /**@addtogroup PublicProblemMethods
876  *
877  * public methods to query linear constraint classification statistics
878  *
879  * @{
880  */
881 
882 /** create linear constraint statistics */
883 SCIP_EXPORT
884 SCIP_RETCODE SCIPlinConsStatsCreate(
885    SCIP*                 scip,               /**< scip data structure */
886    SCIP_LINCONSSTATS**   linconsstats        /**< pointer to linear constraint classification statistics */
887    );
888 
889 /** free linear constraint statistics */
890 SCIP_EXPORT
891 void SCIPlinConsStatsFree(
892    SCIP*                 scip,               /**< scip data structure */
893    SCIP_LINCONSSTATS**   linconsstats        /**< pointer to linear constraint classification statistics */
894    );
895 
896 /** resets linear constraint statistics */
897 SCIP_EXPORT
898 void SCIPlinConsStatsReset(
899    SCIP_LINCONSSTATS*    linconsstats        /**< linear constraint classification statistics */
900    );
901 
902 /** returns the number of occurrences of a specific type of linear constraint */
903 SCIP_EXPORT
904 int SCIPlinConsStatsGetTypeCount(
905    SCIP_LINCONSSTATS*    linconsstats,       /**< linear constraint classification statistics */
906    SCIP_LINCONSTYPE      linconstype         /**< linear constraint type */
907    );
908 
909 /** returns the total number of classified constraints */
910 SCIP_EXPORT
911 int SCIPlinConsStatsGetSum(
912    SCIP_LINCONSSTATS*    linconsstats        /**< linear constraint classification statistics */
913    );
914 
915 /** increases the number of occurrences of a specific type of linear constraint */
916 SCIP_EXPORT
917 void SCIPlinConsStatsIncTypeCount(
918    SCIP_LINCONSSTATS*    linconsstats,       /**< linear constraint classification statistics */
919    SCIP_LINCONSTYPE      linconstype,        /**< linear constraint type */
920    int                   increment           /**< positive increment */
921    );
922 
923 /** print linear constraint classification statistics */
924 SCIP_EXPORT
925 void SCIPprintLinConsStats(
926    SCIP*                 scip,               /**< scip data structure */
927    FILE*                 file,               /**< file handle or NULL to print to standard out */
928    SCIP_LINCONSSTATS*    linconsstats        /**< linear constraint classification statistics */
929    );
930 
931 /** @} */
932 
933 #ifdef __cplusplus
934 }
935 #endif
936 
937 #endif
938