Scippy

SCIP

Solving Constraint Integer Programs

objconshdlr.cpp
Go to the documentation of this file.
1/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
2/* */
3/* This file is part of the program and library */
4/* SCIP --- Solving Constraint Integer Programs */
5/* */
6/* Copyright (c) 2002-2024 Zuse Institute Berlin (ZIB) */
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 objconshdlr.cpp
26 * @brief C++ wrapper for constraint handlers
27 * @author Tobias Achterberg
28 */
29
30/*---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0----+----1----+----2*/
31
32#include <cassert>
33
34#include "objconshdlr.h"
35
36
37
38
39/*
40 * Data structures
41 */
42
43/** constraint handler data */
44struct SCIP_ConshdlrData
45{
46 scip::ObjConshdlr* objconshdlr; /**< constraint handler object */
47 SCIP_Bool deleteobject; /**< should the constraint handler object be deleted when conshdlr is freed? */
48};
49
50
51
52
53/*
54 * Callback methods of constraint handler
55 */
56
57extern "C"
58{
59
60/** copy method for constraint handler plugins (called when SCIP copies plugins) */
61static
62SCIP_DECL_CONSHDLRCOPY(conshdlrCopyObj)
63{ /*lint --e{715}*/
64 SCIP_CONSHDLRDATA* conshdlrdata;
65
66 assert(scip != NULL);
67
68 conshdlrdata = SCIPconshdlrGetData(conshdlr);
69 assert(conshdlrdata != NULL);
70 assert(conshdlrdata->objconshdlr != NULL);
71 assert(conshdlrdata->objconshdlr->scip_ != scip);
72
73 if( conshdlrdata->objconshdlr->iscloneable() )
74 {
75 scip::ObjConshdlr* newobjconshdlr;
76 newobjconshdlr = dynamic_cast<scip::ObjConshdlr*> (conshdlrdata->objconshdlr->clone(scip, valid));
77
78 /* call include method of constraint handler object */
79 SCIP_CALL( SCIPincludeObjConshdlr(scip, newobjconshdlr, TRUE) );
80 }
81
82 return SCIP_OKAY;
83}
84
85/** destructor of constraint handler to free user data (called when SCIP is exiting) */
86static
88{ /*lint --e{715}*/
89 SCIP_CONSHDLRDATA* conshdlrdata;
90
91 conshdlrdata = SCIPconshdlrGetData(conshdlr);
92 assert(conshdlrdata != NULL);
93 assert(conshdlrdata->objconshdlr != NULL);
94 assert(conshdlrdata->objconshdlr->scip_ == scip);
95
96 /* call virtual method of conshdlr object */
97 SCIP_CALL( conshdlrdata->objconshdlr->scip_free(scip, conshdlr) );
98
99 /* free conshdlr object */
100 if( conshdlrdata->deleteobject )
101 delete conshdlrdata->objconshdlr;
102
103 /* free conshdlr data */
104 delete conshdlrdata;
105 SCIPconshdlrSetData(conshdlr, NULL); /*lint !e64*/
106
107 return SCIP_OKAY;
108}
109
110
111/** initialization method of constraint handler (called after problem was transformed) */
112static
114{ /*lint --e{715}*/
115 SCIP_CONSHDLRDATA* conshdlrdata;
116
117 conshdlrdata = SCIPconshdlrGetData(conshdlr);
118 assert(conshdlrdata != NULL);
119 assert(conshdlrdata->objconshdlr != NULL);
120 assert(conshdlrdata->objconshdlr->scip_ == scip);
121
122 /* call virtual method of conshdlr object */
123 SCIP_CALL( conshdlrdata->objconshdlr->scip_init(scip, conshdlr, conss, nconss) );
124
125 return SCIP_OKAY;
126}
127
128
129/** deinitialization method of constraint handler (called before transformed problem is freed) */
130static
132{ /*lint --e{715}*/
133 SCIP_CONSHDLRDATA* conshdlrdata;
134
135 conshdlrdata = SCIPconshdlrGetData(conshdlr);
136 assert(conshdlrdata != NULL);
137 assert(conshdlrdata->objconshdlr != NULL);
138
139 /* call virtual method of conshdlr object */
140 SCIP_CALL( conshdlrdata->objconshdlr->scip_exit(scip, conshdlr, conss, nconss) );
141
142 return SCIP_OKAY;
143}
144
145
146/** presolving initialization method of constraint handler (called when presolving is about to begin) */
147static
149{ /*lint --e{715}*/
150 SCIP_CONSHDLRDATA* conshdlrdata;
151
152 conshdlrdata = SCIPconshdlrGetData(conshdlr);
153 assert(conshdlrdata != NULL);
154 assert(conshdlrdata->objconshdlr != NULL);
155
156 /* call virtual method of conshdlr object */
157 SCIP_CALL( conshdlrdata->objconshdlr->scip_initpre(scip, conshdlr, conss, nconss) );
158
159 return SCIP_OKAY;
160}
161
162
163/** presolving deinitialization method of constraint handler (called after presolving has been finished) */
164static
166{ /*lint --e{715}*/
167 SCIP_CONSHDLRDATA* conshdlrdata;
168
169 conshdlrdata = SCIPconshdlrGetData(conshdlr);
170 assert(conshdlrdata != NULL);
171 assert(conshdlrdata->objconshdlr != NULL);
172
173 /* call virtual method of conshdlr object */
174 SCIP_CALL( conshdlrdata->objconshdlr->scip_exitpre(scip, conshdlr, conss, nconss) );
175
176 return SCIP_OKAY;
177}
178
179
180/** solving process initialization method of constraint handler (called when branch and bound process is about to begin) */
181static
183{ /*lint --e{715}*/
184 SCIP_CONSHDLRDATA* conshdlrdata;
185
186 conshdlrdata = SCIPconshdlrGetData(conshdlr);
187 assert(conshdlrdata != NULL);
188 assert(conshdlrdata->objconshdlr != NULL);
189
190 /* call virtual method of conshdlr object */
191 SCIP_CALL( conshdlrdata->objconshdlr->scip_initsol(scip, conshdlr, conss, nconss) );
192
193 return SCIP_OKAY;
194}
195
196
197/** solving process deinitialization method of constraint handler (called before branch and bound process data is freed) */
198static
200{ /*lint --e{715}*/
201 SCIP_CONSHDLRDATA* conshdlrdata;
202
203 conshdlrdata = SCIPconshdlrGetData(conshdlr);
204 assert(conshdlrdata != NULL);
205 assert(conshdlrdata->objconshdlr != NULL);
206
207 /* call virtual method of conshdlr object */
208 SCIP_CALL( conshdlrdata->objconshdlr->scip_exitsol(scip, conshdlr, conss, nconss, restart) );
209
210 return SCIP_OKAY;
211}
212
213
214/** frees specific constraint data */
215static
217{ /*lint --e{715}*/
218 SCIP_CONSHDLRDATA* conshdlrdata;
219
220 conshdlrdata = SCIPconshdlrGetData(conshdlr);
221 assert(conshdlrdata != NULL);
222 assert(conshdlrdata->objconshdlr != NULL);
223
224 /* call virtual method of conshdlr object */
225 SCIP_CALL( conshdlrdata->objconshdlr->scip_delete(scip, conshdlr, cons, consdata) );
226
227 return SCIP_OKAY;
228}
229
230
231/** transforms constraint data into data belonging to the transformed problem */
232static
234{ /*lint --e{715}*/
235 SCIP_CONSHDLRDATA* conshdlrdata;
236
237 conshdlrdata = SCIPconshdlrGetData(conshdlr);
238 assert(conshdlrdata != NULL);
239 assert(conshdlrdata->objconshdlr != NULL);
240
241 /* call virtual method of conshdlr object */
242 SCIP_CALL( conshdlrdata->objconshdlr->scip_trans(scip, conshdlr, sourcecons, targetcons) );
243
244 return SCIP_OKAY;
245}
246
247
248/** LP initialization method of constraint handler */
249static
251{ /*lint --e{715}*/
252 SCIP_CONSHDLRDATA* conshdlrdata;
253
254 conshdlrdata = SCIPconshdlrGetData(conshdlr);
255 assert(conshdlrdata != NULL);
256 assert(conshdlrdata->objconshdlr != NULL);
257
258 /* call virtual method of conshdlr object */
259 SCIP_CALL( conshdlrdata->objconshdlr->scip_initlp(scip, conshdlr, conss, nconss, infeasible) );
260
261 return SCIP_OKAY;
262}
263
264
265/** separation method of constraint handler for LP solutions */
266static
268{ /*lint --e{715}*/
269 SCIP_CONSHDLRDATA* conshdlrdata;
270
271 conshdlrdata = SCIPconshdlrGetData(conshdlr);
272 assert(conshdlrdata != NULL);
273 assert(conshdlrdata->objconshdlr != NULL);
274
275 /* call virtual method of conshdlr object */
276 SCIP_CALL( conshdlrdata->objconshdlr->scip_sepalp(scip, conshdlr, conss, nconss, nusefulconss, result) );
277
278 return SCIP_OKAY;
279}
280
281
282/** separation method of constraint handler for arbitrary primal solutions */
283static
285{ /*lint --e{715}*/
286 SCIP_CONSHDLRDATA* conshdlrdata;
287
288 conshdlrdata = SCIPconshdlrGetData(conshdlr);
289 assert(conshdlrdata != NULL);
290 assert(conshdlrdata->objconshdlr != NULL);
291
292 /* call virtual method of conshdlr object */
293 SCIP_CALL( conshdlrdata->objconshdlr->scip_sepasol(scip, conshdlr, conss, nconss, nusefulconss, sol, result) );
294
295 return SCIP_OKAY;
296}
297
298
299/** constraint enforcing method of constraint handler for LP solutions */
300static
302{ /*lint --e{715}*/
303 SCIP_CONSHDLRDATA* conshdlrdata;
304
305 conshdlrdata = SCIPconshdlrGetData(conshdlr);
306 assert(conshdlrdata != NULL);
307 assert(conshdlrdata->objconshdlr != NULL);
308
309 /* call virtual method of conshdlr object */
310 SCIP_CALL( conshdlrdata->objconshdlr->scip_enfolp(scip, conshdlr, conss, nconss, nusefulconss, solinfeasible, result) );
311
312 return SCIP_OKAY;
313}
314
315
316/** constraint enforcing method of constraint handler for relaxation solutions */
317static
318SCIP_DECL_CONSENFORELAX(consEnforelaxObj)
319{ /*lint --e{715}*/
320 SCIP_CONSHDLRDATA* conshdlrdata;
321
322 conshdlrdata = SCIPconshdlrGetData(conshdlr);
323 assert(conshdlrdata != NULL);
324 assert(conshdlrdata->objconshdlr != NULL);
325
326 /* call virtual method of conshdlr object */
327 SCIP_CALL( conshdlrdata->objconshdlr->scip_enforelax(scip, sol, conshdlr, conss, nconss, nusefulconss, solinfeasible, result) );
328
329 return SCIP_OKAY;
330}
331
332
333/** constraint enforcing method of constraint handler for pseudo solutions */
334static
336{ /*lint --e{715}*/
337 SCIP_CONSHDLRDATA* conshdlrdata;
338
339 conshdlrdata = SCIPconshdlrGetData(conshdlr);
340 assert(conshdlrdata != NULL);
341 assert(conshdlrdata->objconshdlr != NULL);
342
343 /* call virtual method of conshdlr object */
344 SCIP_CALL( conshdlrdata->objconshdlr->scip_enfops(scip, conshdlr, conss, nconss, nusefulconss,
345 solinfeasible, objinfeasible, result) );
346
347 return SCIP_OKAY;
348}
349
350
351/** feasibility check method of constraint handler for primal solutions */
352static
354{ /*lint --e{715}*/
355 SCIP_CONSHDLRDATA* conshdlrdata;
356
357 conshdlrdata = SCIPconshdlrGetData(conshdlr);
358 assert(conshdlrdata != NULL);
359 assert(conshdlrdata->objconshdlr != NULL);
360
361 /* call virtual method of conshdlr object */
362 SCIP_CALL( conshdlrdata->objconshdlr->scip_check(scip, conshdlr, conss, nconss, sol,
363 checkintegrality, checklprows, printreason, completely, result) );
364
365 return SCIP_OKAY;
366}
367
368
369/** domain propagation method of constraint handler */
370static
372{ /*lint --e{715}*/
373 SCIP_CONSHDLRDATA* conshdlrdata;
374
375 conshdlrdata = SCIPconshdlrGetData(conshdlr);
376 assert(conshdlrdata != NULL);
377 assert(conshdlrdata->objconshdlr != NULL);
378
379 /* call virtual method of conshdlr object */
380 SCIP_CALL( conshdlrdata->objconshdlr->scip_prop(scip, conshdlr, conss, nconss, nusefulconss, nmarkedconss, proptiming, result) );
381
382 return SCIP_OKAY;
383}
384
385
386/** presolving method of constraint handler */
387static
389{ /*lint --e{715}*/
390 SCIP_CONSHDLRDATA* conshdlrdata;
391
392 conshdlrdata = SCIPconshdlrGetData(conshdlr);
393 assert(conshdlrdata != NULL);
394 assert(conshdlrdata->objconshdlr != NULL);
395
396 /* call virtual method of conshdlr object */
397 SCIP_CALL( conshdlrdata->objconshdlr->scip_presol(scip, conshdlr, conss, nconss, nrounds, presoltiming,
398 nnewfixedvars, nnewaggrvars, nnewchgvartypes, nnewchgbds, nnewholes,
399 nnewdelconss, nnewaddconss, nnewupgdconss, nnewchgcoefs, nnewchgsides,
400 nfixedvars, naggrvars, nchgvartypes, nchgbds, naddholes,
401 ndelconss, naddconss, nupgdconss, nchgcoefs, nchgsides, result) );
402
403 return SCIP_OKAY;
404}
405
406
407/** propagation conflict resolving method of constraint handler */
408static
410{ /*lint --e{715}*/
411 SCIP_CONSHDLRDATA* conshdlrdata;
412
413 conshdlrdata = SCIPconshdlrGetData(conshdlr);
414 assert(conshdlrdata != NULL);
415 assert(conshdlrdata->objconshdlr != NULL);
416
417 /* call virtual method of conshdlr object */
418 SCIP_CALL( conshdlrdata->objconshdlr->scip_resprop(scip, conshdlr, cons, infervar, inferinfo, boundtype, bdchgidx,
419 relaxedbd, result) );
420
421 return SCIP_OKAY;
422}
423
424
425/** variable rounding lock method of constraint handler */
426static
428{ /*lint --e{715}*/
429 SCIP_CONSHDLRDATA* conshdlrdata;
430
431 conshdlrdata = SCIPconshdlrGetData(conshdlr);
432 assert(conshdlrdata != NULL);
433 assert(conshdlrdata->objconshdlr != NULL);
434
435 /* call virtual method of conshdlr object */
436 SCIP_CALL( conshdlrdata->objconshdlr->scip_lock(scip, conshdlr, cons, locktype, nlockspos, nlocksneg) );
437
438 return SCIP_OKAY;
439}
440
441
442/** constraint activation notification method of constraint handler */
443static
445{ /*lint --e{715}*/
446 SCIP_CONSHDLRDATA* conshdlrdata;
447
448 conshdlrdata = SCIPconshdlrGetData(conshdlr);
449 assert(conshdlrdata != NULL);
450 assert(conshdlrdata->objconshdlr != NULL);
451
452 /* call virtual method of conshdlr object */
453 SCIP_CALL( conshdlrdata->objconshdlr->scip_active(scip, conshdlr, cons) );
454
455 return SCIP_OKAY;
456}
457
458
459/** constraint deactivation notification method of constraint handler */
460static
462{ /*lint --e{715}*/
463 SCIP_CONSHDLRDATA* conshdlrdata;
464
465 conshdlrdata = SCIPconshdlrGetData(conshdlr);
466 assert(conshdlrdata != NULL);
467 assert(conshdlrdata->objconshdlr != NULL);
468
469 /* call virtual method of conshdlr object */
470 SCIP_CALL( conshdlrdata->objconshdlr->scip_deactive(scip, conshdlr, cons) );
471
472 return SCIP_OKAY;
473}
474
475
476/** constraint enabling notification method of constraint handler */
477static
479{ /*lint --e{715}*/
480 SCIP_CONSHDLRDATA* conshdlrdata;
481
482 conshdlrdata = SCIPconshdlrGetData(conshdlr);
483 assert(conshdlrdata != NULL);
484 assert(conshdlrdata->objconshdlr != NULL);
485
486 /* call virtual method of conshdlr object */
487 SCIP_CALL( conshdlrdata->objconshdlr->scip_enable(scip, conshdlr, cons) );
488
489 return SCIP_OKAY;
490}
491
492
493/** constraint disabling notification method of constraint handler */
494static
496{ /*lint --e{715}*/
497 SCIP_CONSHDLRDATA* conshdlrdata;
498
499 conshdlrdata = SCIPconshdlrGetData(conshdlr);
500 assert(conshdlrdata != NULL);
501 assert(conshdlrdata->objconshdlr != NULL);
502
503 /* call virtual method of conshdlr object */
504 SCIP_CALL( conshdlrdata->objconshdlr->scip_disable(scip, conshdlr, cons) );
505
506 return SCIP_OKAY;
507}
508
509/** variable deletion method of constraint handler */
510static
512{ /*lint --e{715}*/
513 SCIP_CONSHDLRDATA* conshdlrdata;
514
515 conshdlrdata = SCIPconshdlrGetData(conshdlr);
516 assert(conshdlrdata != NULL);
517 assert(conshdlrdata->objconshdlr != NULL);
518
519 /* call virtual method of conshdlr object */
520 SCIP_CALL( conshdlrdata->objconshdlr->scip_delvars(scip, conshdlr, conss, nconss) );
521
522 return SCIP_OKAY;
523}
524
525/** constraint display method of constraint handler */
526static
528{ /*lint --e{715}*/
529 SCIP_CONSHDLRDATA* conshdlrdata;
530
531 conshdlrdata = SCIPconshdlrGetData(conshdlr);
532 assert(conshdlrdata != NULL);
533 assert(conshdlrdata->objconshdlr != NULL);
534
535 /* call virtual method of conshdlr object */
536 SCIP_CALL( conshdlrdata->objconshdlr->scip_print(scip, conshdlr, cons, file) );
537
538 return SCIP_OKAY;
539}
540
541/** constraint copying method of constraint handler */
542static
544{ /*lint --e{715}*/
545 SCIP_CONSHDLRDATA* sourceconshdlrdata;
546
547 sourceconshdlrdata = SCIPconshdlrGetData(sourceconshdlr);
548 assert(sourceconshdlrdata != NULL);
549 assert(sourceconshdlrdata->objconshdlr != NULL);
550
551 /* call virtual method of conshdlr object */
552 SCIP_CALL( sourceconshdlrdata->objconshdlr->scip_copy(scip, cons, name, sourcescip, sourceconshdlr, sourcecons, varmap, consmap,
553 initial, separate, enforce, check, propagate, local, modifiable, dynamic, removable, stickingatnode, global, valid) );
554
555 return SCIP_OKAY;
556}
557
558/** constraint parsing method of constraint handler */
559static
561{ /*lint --e{715}*/
562 SCIP_CONSHDLRDATA* conshdlrdata;
563
564 conshdlrdata = SCIPconshdlrGetData(conshdlr);
565 assert(conshdlrdata != NULL);
566 assert(conshdlrdata->objconshdlr != NULL);
567
568 /* call virtual method of conshdlr object */
569 SCIP_CALL( conshdlrdata->objconshdlr->scip_parse(scip, conshdlr, cons, name, str,
570 initial, separate, enforce, check, propagate, local, modifiable, dynamic, removable, stickingatnode, success) );
571
572 return SCIP_OKAY;
573}
574
575/** constraint method of constraint handler which returns the variables (if possible) */
576static
578{ /*lint --e{715}*/
579 SCIP_CONSHDLRDATA* conshdlrdata;
580
581 conshdlrdata = SCIPconshdlrGetData(conshdlr);
582 assert(conshdlrdata != NULL);
583 assert(conshdlrdata->objconshdlr != NULL);
584
585 /* call virtual method of conshdlr object */
586 SCIP_CALL( conshdlrdata->objconshdlr->scip_getvars(scip, conshdlr, cons, vars, varssize, success) );
587
588 return SCIP_OKAY;
589}
590
591/** constraint method of constraint handler which returns the number of variables (if possible) */
592static
594{ /*lint --e{715}*/
595 SCIP_CONSHDLRDATA* conshdlrdata;
596
597 conshdlrdata = SCIPconshdlrGetData(conshdlr);
598 assert(conshdlrdata != NULL);
599 assert(conshdlrdata->objconshdlr != NULL);
600
601 /* call virtual method of conshdlr object */
602 SCIP_CALL( conshdlrdata->objconshdlr->scip_getnvars(scip, conshdlr, cons, nvars, success) );
603
604 return SCIP_OKAY;
605}
606
607/** constraint handler method to suggest dive bound changes during the generic diving algorithm */
608static
609SCIP_DECL_CONSGETDIVEBDCHGS(consGetDiveBdChgsObj)
610{ /*lint --e{715}*/
611 SCIP_CONSHDLRDATA* conshdlrdata;
612
613 conshdlrdata = SCIPconshdlrGetData(conshdlr);
614 assert(conshdlrdata != NULL);
615 assert(conshdlrdata->objconshdlr != NULL);
616
617 /* call virtual method of conshdlr object */
618 SCIP_CALL( conshdlrdata->objconshdlr->scip_getdivebdchgs(scip, conshdlr, diveset, sol, success, infeasible) );
619
620 return SCIP_OKAY;
621}
622
623/** constraint handler method which returns the permutation symmetry detection graph of a constraint (if possible) */
624static
626{ /*lint --e{715}*/
627 SCIP_CONSHDLRDATA* conshdlrdata;
628
629 conshdlrdata = SCIPconshdlrGetData(conshdlr);
630 assert(conshdlrdata != NULL);
631 assert(conshdlrdata->objconshdlr != NULL);
632
633 /* call virtual method of conshdlr object */
634 SCIP_CALL( conshdlrdata->objconshdlr->scip_getpermsymgraph(scip, conshdlr, cons, graph, success) );
635
636 return SCIP_OKAY;
637}
638
639/** constraint handler method which returns the signed permutation symmetry detection graph of a constraint (if possible) */
640static
641SCIP_DECL_CONSGETSIGNEDPERMSYMGRAPH(consGetSignedPermsymGraph)
642{ /*lint --e{715}*/
643 SCIP_CONSHDLRDATA* conshdlrdata;
644
645 conshdlrdata = SCIPconshdlrGetData(conshdlr);
646 assert(conshdlrdata != NULL);
647 assert(conshdlrdata->objconshdlr != NULL);
648
649 /* call virtual method of conshdlr object */
650 SCIP_CALL( conshdlrdata->objconshdlr->scip_getsignedpermsymgraph(scip, conshdlr, cons, graph, success) );
651
652 return SCIP_OKAY;
653}
654}
655
656
657/*
658 * constraint handler specific interface methods
659 */
660
661/** creates the constraint handler for the given constraint handler object and includes it in SCIP */
663 SCIP* scip, /**< SCIP data structure */
664 scip::ObjConshdlr* objconshdlr, /**< constraint handler object */
665 SCIP_Bool deleteobject /**< should the constraint handler object be deleted when conshdlr is freed? */
666 )
667{
668 SCIP_CONSHDLRDATA* conshdlrdata;
669
670 assert(scip != NULL);
671 assert(objconshdlr != NULL);
672 assert(objconshdlr->scip_ == scip);
673
674 /* create obj constraint handler data */
675 conshdlrdata = new SCIP_CONSHDLRDATA;
676 conshdlrdata->objconshdlr = objconshdlr;
677 conshdlrdata->deleteobject = deleteobject;
678
679 /* include constraint handler */
680 SCIP_CALL( SCIPincludeConshdlr(scip, objconshdlr->scip_name_, objconshdlr->scip_desc_,
681 objconshdlr->scip_sepapriority_, objconshdlr->scip_enfopriority_, objconshdlr->scip_checkpriority_,
682 objconshdlr->scip_sepafreq_, objconshdlr->scip_propfreq_, objconshdlr->scip_eagerfreq_,
683 objconshdlr->scip_maxprerounds_,
684 objconshdlr->scip_delaysepa_, objconshdlr->scip_delayprop_,
685 objconshdlr->scip_needscons_, objconshdlr->scip_proptiming_, objconshdlr->scip_presoltiming_,
686 conshdlrCopyObj,
687 consFreeObj, consInitObj, consExitObj,
688 consInitpreObj, consExitpreObj, consInitsolObj, consExitsolObj,
689 consDeleteObj, consTransObj, consInitlpObj,
690 consSepalpObj, consSepasolObj, consEnfolpObj, consEnforelaxObj, consEnfopsObj, consCheckObj,
691 consPropObj, consPresolObj, consRespropObj, consLockObj,
692 consActiveObj, consDeactiveObj,
693 consEnableObj, consDisableObj, consDelVarsObj,
694 consPrintObj, consCopyObj, consParseObj,
695 consGetVarsObj, consGetNVarsObj, consGetDiveBdChgsObj,
696 consGetPermsymGraph, consGetSignedPermsymGraph, conshdlrdata) ); /*lint !e429*/
697
698 return SCIP_OKAY; /*lint !e429*/
699}
700
701/** returns the conshdlr object of the given name, or 0 if not existing */
703 SCIP* scip, /**< SCIP data structure */
704 const char* name /**< name of constraint handler */
705 )
706{
707 SCIP_CONSHDLR* conshdlr;
708 SCIP_CONSHDLRDATA* conshdlrdata;
709
710 conshdlr = SCIPfindConshdlr(scip, name);
711 if( conshdlr == NULL )
712 return 0;
713
714 conshdlrdata = SCIPconshdlrGetData(conshdlr);
715 assert(conshdlrdata != NULL);
716
717 return conshdlrdata->objconshdlr;
718}
719
720/** returns the conshdlr object for the given constraint handler */
722 SCIP* scip, /**< SCIP data structure */
723 SCIP_CONSHDLR* conshdlr /**< constraint handler */
724 )
725{
726 SCIP_CONSHDLRDATA* conshdlrdata;
727
728 assert(scip != NULL);
729 conshdlrdata = SCIPconshdlrGetData(conshdlr);
730 assert(conshdlrdata != NULL);
731
732 return conshdlrdata->objconshdlr;
733}
C++ wrapper for constraint handlers.
Definition: objconshdlr.h:57
const SCIP_PRESOLTIMING scip_presoltiming_
Definition: objconshdlr.h:104
const int scip_eagerfreq_
Definition: objconshdlr.h:86
const int scip_sepapriority_
Definition: objconshdlr.h:71
const SCIP_Bool scip_delaysepa_
Definition: objconshdlr.h:92
const SCIP_Bool scip_delayprop_
Definition: objconshdlr.h:95
const SCIP_Bool scip_needscons_
Definition: objconshdlr.h:98
const int scip_sepafreq_
Definition: objconshdlr.h:80
const int scip_propfreq_
Definition: objconshdlr.h:83
const int scip_enfopriority_
Definition: objconshdlr.h:74
const int scip_maxprerounds_
Definition: objconshdlr.h:89
const int scip_checkpriority_
Definition: objconshdlr.h:77
const SCIP_PROPTIMING scip_proptiming_
Definition: objconshdlr.h:101
#define NULL
Definition: def.h:266
#define SCIP_Bool
Definition: def.h:91
#define TRUE
Definition: def.h:93
#define SCIP_CALL(x)
Definition: def.h:373
void SCIPconshdlrSetData(SCIP_CONSHDLR *conshdlr, SCIP_CONSHDLRDATA *conshdlrdata)
Definition: cons.c:4227
SCIP_CONSHDLR * SCIPfindConshdlr(SCIP *scip, const char *name)
Definition: scip_cons.c:941
SCIP_CONSHDLRDATA * SCIPconshdlrGetData(SCIP_CONSHDLR *conshdlr)
Definition: cons.c:4217
SCIP_RETCODE SCIPincludeConshdlr(SCIP *scip, const char *name, const char *desc, int sepapriority, int enfopriority, int chckpriority, int sepafreq, int propfreq, int eagerfreq, int maxprerounds, SCIP_Bool delaysepa, SCIP_Bool delayprop, SCIP_Bool needscons, SCIP_PROPTIMING proptiming, SCIP_PRESOLTIMING presoltiming, SCIP_DECL_CONSHDLRCOPY((*conshdlrcopy)), SCIP_DECL_CONSFREE((*consfree)), SCIP_DECL_CONSINIT((*consinit)), SCIP_DECL_CONSEXIT((*consexit)), SCIP_DECL_CONSINITPRE((*consinitpre)), SCIP_DECL_CONSEXITPRE((*consexitpre)), SCIP_DECL_CONSINITSOL((*consinitsol)), SCIP_DECL_CONSEXITSOL((*consexitsol)), SCIP_DECL_CONSDELETE((*consdelete)), SCIP_DECL_CONSTRANS((*constrans)), SCIP_DECL_CONSINITLP((*consinitlp)), SCIP_DECL_CONSSEPALP((*conssepalp)), SCIP_DECL_CONSSEPASOL((*conssepasol)), SCIP_DECL_CONSENFOLP((*consenfolp)), SCIP_DECL_CONSENFORELAX((*consenforelax)), SCIP_DECL_CONSENFOPS((*consenfops)), SCIP_DECL_CONSCHECK((*conscheck)), SCIP_DECL_CONSPROP((*consprop)), SCIP_DECL_CONSPRESOL((*conspresol)), SCIP_DECL_CONSRESPROP((*consresprop)), SCIP_DECL_CONSLOCK((*conslock)), SCIP_DECL_CONSACTIVE((*consactive)), SCIP_DECL_CONSDEACTIVE((*consdeactive)), SCIP_DECL_CONSENABLE((*consenable)), SCIP_DECL_CONSDISABLE((*consdisable)), SCIP_DECL_CONSDELVARS((*consdelvars)), SCIP_DECL_CONSPRINT((*consprint)), SCIP_DECL_CONSCOPY((*conscopy)), SCIP_DECL_CONSPARSE((*consparse)), SCIP_DECL_CONSGETVARS((*consgetvars)), SCIP_DECL_CONSGETNVARS((*consgetnvars)), SCIP_DECL_CONSGETDIVEBDCHGS((*consgetdivebdchgs)), SCIP_DECL_CONSGETPERMSYMGRAPH((*consgetpermsymgraph)), SCIP_DECL_CONSGETSIGNEDPERMSYMGRAPH((*consgetsignedpermsymgraph)), SCIP_CONSHDLRDATA *conshdlrdata)
Definition: scip_cons.c:83
static SCIP_DECL_CONSENFORELAX(consEnforelaxObj)
static SCIP_DECL_CONSACTIVE(consActiveObj)
static SCIP_DECL_CONSPARSE(consParseObj)
static SCIP_DECL_CONSINITPRE(consInitpreObj)
scip::ObjConshdlr * SCIPfindObjConshdlr(SCIP *scip, const char *name)
static SCIP_DECL_CONSDEACTIVE(consDeactiveObj)
static SCIP_DECL_CONSSEPASOL(consSepasolObj)
static SCIP_DECL_CONSLOCK(consLockObj)
static SCIP_DECL_CONSGETVARS(consGetVarsObj)
static SCIP_DECL_CONSGETPERMSYMGRAPH(consGetPermsymGraph)
static SCIP_DECL_CONSPROP(consPropObj)
static SCIP_DECL_CONSDELETE(consDeleteObj)
static SCIP_DECL_CONSEXIT(consExitObj)
static SCIP_DECL_CONSPRINT(consPrintObj)
static SCIP_DECL_CONSEXITPRE(consExitpreObj)
static SCIP_DECL_CONSDELVARS(consDelVarsObj)
static SCIP_DECL_CONSCHECK(consCheckObj)
static SCIP_DECL_CONSHDLRCOPY(conshdlrCopyObj)
Definition: objconshdlr.cpp:62
static SCIP_DECL_CONSDISABLE(consDisableObj)
static SCIP_DECL_CONSENFOLP(consEnfolpObj)
static SCIP_DECL_CONSEXITSOL(consExitsolObj)
static SCIP_DECL_CONSENABLE(consEnableObj)
static SCIP_DECL_CONSFREE(consFreeObj)
Definition: objconshdlr.cpp:87
static SCIP_DECL_CONSTRANS(consTransObj)
scip::ObjConshdlr * SCIPgetObjConshdlr(SCIP *scip, SCIP_CONSHDLR *conshdlr)
static SCIP_DECL_CONSINITSOL(consInitsolObj)
SCIP_RETCODE SCIPincludeObjConshdlr(SCIP *scip, scip::ObjConshdlr *objconshdlr, SCIP_Bool deleteobject)
static SCIP_DECL_CONSINITLP(consInitlpObj)
static SCIP_DECL_CONSGETDIVEBDCHGS(consGetDiveBdChgsObj)
static SCIP_DECL_CONSENFOPS(consEnfopsObj)
static SCIP_DECL_CONSRESPROP(consRespropObj)
static SCIP_DECL_CONSGETSIGNEDPERMSYMGRAPH(consGetSignedPermsymGraph)
static SCIP_DECL_CONSINIT(consInitObj)
static SCIP_DECL_CONSPRESOL(consPresolObj)
static SCIP_DECL_CONSCOPY(consCopyObj)
static SCIP_DECL_CONSGETNVARS(consGetNVarsObj)
static SCIP_DECL_CONSSEPALP(consSepalpObj)
C++ wrapper for constraint handlers.
struct SCIP_ConshdlrData SCIP_CONSHDLRDATA
Definition: type_cons.h:64
@ SCIP_OKAY
Definition: type_retcode.h:42
enum SCIP_Retcode SCIP_RETCODE
Definition: type_retcode.h:63