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 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 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 */
44 struct 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 
57 extern "C"
58 {
59 
60 /** copy method for constraint handler plugins (called when SCIP copies plugins) */
61 static
62 SCIP_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) */
86 static
87 SCIP_DECL_CONSFREE(consFreeObj)
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) */
112 static
113 SCIP_DECL_CONSINIT(consInitObj)
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) */
130 static
131 SCIP_DECL_CONSEXIT(consExitObj)
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) */
147 static
148 SCIP_DECL_CONSINITPRE(consInitpreObj)
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) */
164 static
165 SCIP_DECL_CONSEXITPRE(consExitpreObj)
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) */
181 static
182 SCIP_DECL_CONSINITSOL(consInitsolObj)
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) */
198 static
199 SCIP_DECL_CONSEXITSOL(consExitsolObj)
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 */
215 static
216 SCIP_DECL_CONSDELETE(consDeleteObj)
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 */
232 static
233 SCIP_DECL_CONSTRANS(consTransObj)
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 */
249 static
250 SCIP_DECL_CONSINITLP(consInitlpObj)
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 */
266 static
267 SCIP_DECL_CONSSEPALP(consSepalpObj)
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 */
283 static
284 SCIP_DECL_CONSSEPASOL(consSepasolObj)
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 */
300 static
301 SCIP_DECL_CONSENFOLP(consEnfolpObj)
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 */
317 static
318 SCIP_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 */
334 static
335 SCIP_DECL_CONSENFOPS(consEnfopsObj)
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 */
352 static
353 SCIP_DECL_CONSCHECK(consCheckObj)
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 */
370 static
371 SCIP_DECL_CONSPROP(consPropObj)
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 */
387 static
388 SCIP_DECL_CONSPRESOL(consPresolObj)
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 */
408 static
409 SCIP_DECL_CONSRESPROP(consRespropObj)
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 */
426 static
427 SCIP_DECL_CONSLOCK(consLockObj)
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 */
443 static
444 SCIP_DECL_CONSACTIVE(consActiveObj)
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 */
460 static
461 SCIP_DECL_CONSDEACTIVE(consDeactiveObj)
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 */
477 static
478 SCIP_DECL_CONSENABLE(consEnableObj)
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 */
494 static
495 SCIP_DECL_CONSDISABLE(consDisableObj)
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 */
510 static
511 SCIP_DECL_CONSDELVARS(consDelVarsObj)
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 */
526 static
527 SCIP_DECL_CONSPRINT(consPrintObj)
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 */
542 static
543 SCIP_DECL_CONSCOPY(consCopyObj)
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 */
559 static
560 SCIP_DECL_CONSPARSE(consParseObj)
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) */
576 static
577 SCIP_DECL_CONSGETVARS(consGetVarsObj)
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) */
592 static
593 SCIP_DECL_CONSGETNVARS(consGetNVarsObj)
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 */
608 static
609 SCIP_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 
624 
625 /*
626  * constraint handler specific interface methods
627  */
628 
629 /** creates the constraint handler for the given constraint handler object and includes it in SCIP */
631  SCIP* scip, /**< SCIP data structure */
632  scip::ObjConshdlr* objconshdlr, /**< constraint handler object */
633  SCIP_Bool deleteobject /**< should the constraint handler object be deleted when conshdlr is freed? */
634  )
635 {
636  SCIP_CONSHDLRDATA* conshdlrdata;
637 
638  assert(scip != NULL);
639  assert(objconshdlr != NULL);
640  assert(objconshdlr->scip_ == scip);
641 
642  /* create obj constraint handler data */
643  conshdlrdata = new SCIP_CONSHDLRDATA;
644  conshdlrdata->objconshdlr = objconshdlr;
645  conshdlrdata->deleteobject = deleteobject;
646 
647  /* include constraint handler */
648  SCIP_CALL( SCIPincludeConshdlr(scip, objconshdlr->scip_name_, objconshdlr->scip_desc_,
649  objconshdlr->scip_sepapriority_, objconshdlr->scip_enfopriority_, objconshdlr->scip_checkpriority_,
650  objconshdlr->scip_sepafreq_, objconshdlr->scip_propfreq_, objconshdlr->scip_eagerfreq_,
651  objconshdlr->scip_maxprerounds_,
652  objconshdlr->scip_delaysepa_, objconshdlr->scip_delayprop_,
653  objconshdlr->scip_needscons_, objconshdlr->scip_proptiming_, objconshdlr->scip_presoltiming_,
654  conshdlrCopyObj,
655  consFreeObj, consInitObj, consExitObj,
656  consInitpreObj, consExitpreObj, consInitsolObj, consExitsolObj,
657  consDeleteObj, consTransObj, consInitlpObj,
658  consSepalpObj, consSepasolObj, consEnfolpObj, consEnforelaxObj, consEnfopsObj, consCheckObj,
659  consPropObj, consPresolObj, consRespropObj, consLockObj,
660  consActiveObj, consDeactiveObj,
661  consEnableObj, consDisableObj, consDelVarsObj,
662  consPrintObj, consCopyObj, consParseObj,
663  consGetVarsObj, consGetNVarsObj, consGetDiveBdChgsObj, conshdlrdata) ); /*lint !e429*/
664 
665  return SCIP_OKAY; /*lint !e429*/
666 }
667 
668 /** returns the conshdlr object of the given name, or 0 if not existing */
670  SCIP* scip, /**< SCIP data structure */
671  const char* name /**< name of constraint handler */
672  )
673 {
674  SCIP_CONSHDLR* conshdlr;
675  SCIP_CONSHDLRDATA* conshdlrdata;
676 
677  conshdlr = SCIPfindConshdlr(scip, name);
678  if( conshdlr == NULL )
679  return 0;
680 
681  conshdlrdata = SCIPconshdlrGetData(conshdlr);
682  assert(conshdlrdata != NULL);
683 
684  return conshdlrdata->objconshdlr;
685 }
686 
687 /** returns the conshdlr object for the given constraint handler */
689  SCIP* scip, /**< SCIP data structure */
690  SCIP_CONSHDLR* conshdlr /**< constraint handler */
691  )
692 {
693  SCIP_CONSHDLRDATA* conshdlrdata;
694 
695  assert(scip != NULL);
696  conshdlrdata = SCIPconshdlrGetData(conshdlr);
697  assert(conshdlrdata != NULL);
698 
699  return conshdlrdata->objconshdlr;
700 }
static SCIP_DECL_CONSDISABLE(consDisableObj)
void SCIPconshdlrSetData(SCIP_CONSHDLR *conshdlr, SCIP_CONSHDLRDATA *conshdlrdata)
Definition: cons.c:4214
static SCIP_DECL_CONSPRESOL(consPresolObj)
const SCIP_Bool scip_delaysepa_
Definition: objconshdlr.h:93
static SCIP_DECL_CONSEXITPRE(consExitpreObj)
const int scip_eagerfreq_
Definition: objconshdlr.h:87
static SCIP_DECL_CONSINIT(consInitObj)
SCIP_CONSHDLR * SCIPfindConshdlr(SCIP *scip, const char *name)
Definition: scip_cons.c:886
const SCIP_Bool scip_needscons_
Definition: objconshdlr.h:99
static SCIP_DECL_CONSDEACTIVE(consDeactiveObj)
static SCIP_DECL_CONSRESPROP(consRespropObj)
static SCIP_DECL_CONSCHECK(consCheckObj)
const int scip_propfreq_
Definition: objconshdlr.h:84
static SCIP_DECL_CONSGETDIVEBDCHGS(consGetDiveBdChgsObj)
static SCIP_DECL_CONSGETVARS(consGetVarsObj)
static SCIP_DECL_CONSEXIT(consExitObj)
#define TRUE
Definition: def.h:95
enum SCIP_Retcode SCIP_RETCODE
Definition: type_retcode.h:63
static SCIP_DECL_CONSINITSOL(consInitsolObj)
static SCIP_DECL_CONSENFOPS(consEnfopsObj)
static SCIP_DECL_CONSLOCK(consLockObj)
static SCIP_DECL_CONSGETNVARS(consGetNVarsObj)
const SCIP_PROPTIMING scip_proptiming_
Definition: objconshdlr.h:102
C++ wrapper for constraint handlers.
static SCIP_DECL_CONSHDLRCOPY(conshdlrCopyObj)
Definition: objconshdlr.cpp:62
SCIP_RETCODE SCIPincludeObjConshdlr(SCIP *scip, scip::ObjConshdlr *objconshdlr, SCIP_Bool deleteobject)
scip::ObjConshdlr * SCIPfindObjConshdlr(SCIP *scip, const char *name)
static SCIP_DECL_CONSENABLE(consEnableObj)
const int scip_maxprerounds_
Definition: objconshdlr.h:90
const int scip_sepapriority_
Definition: objconshdlr.h:72
SCIP_CONSHDLRDATA * SCIPconshdlrGetData(SCIP_CONSHDLR *conshdlr)
Definition: cons.c:4204
const SCIP_Bool scip_delayprop_
Definition: objconshdlr.h:96
#define NULL
Definition: lpi_spx1.cpp:164
static SCIP_DECL_CONSACTIVE(consActiveObj)
#define SCIP_CALL(x)
Definition: def.h:393
static SCIP_DECL_CONSENFOLP(consEnfolpObj)
#define SCIP_Bool
Definition: def.h:93
static SCIP_DECL_CONSTRANS(consTransObj)
const int scip_sepafreq_
Definition: objconshdlr.h:81
static SCIP_DECL_CONSDELVARS(consDelVarsObj)
static SCIP_DECL_CONSENFORELAX(consEnforelaxObj)
C++ wrapper for constraint handlers.
Definition: objconshdlr.h:57
static SCIP_DECL_CONSINITLP(consInitlpObj)
static SCIP_DECL_CONSPROP(consPropObj)
scip::ObjConshdlr * SCIPgetObjConshdlr(SCIP *scip, SCIP_CONSHDLR *conshdlr)
static SCIP_DECL_CONSEXITSOL(consExitsolObj)
static SCIP_DECL_CONSDELETE(consDeleteObj)
const int scip_checkpriority_
Definition: objconshdlr.h:78
static SCIP_DECL_CONSSEPASOL(consSepasolObj)
static SCIP_DECL_CONSCOPY(consCopyObj)
const SCIP_PRESOLTIMING scip_presoltiming_
Definition: objconshdlr.h:105
static SCIP_DECL_CONSPARSE(consParseObj)
static SCIP_DECL_CONSINITPRE(consInitpreObj)
static SCIP_DECL_CONSFREE(consFreeObj)
Definition: objconshdlr.cpp:87
struct SCIP_ConshdlrData SCIP_CONSHDLRDATA
Definition: type_cons.h:64
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_CONSHDLRDATA *conshdlrdata)
Definition: scip_cons.c:82
static SCIP_DECL_CONSPRINT(consPrintObj)
const int scip_enfopriority_
Definition: objconshdlr.h:75
static SCIP_DECL_CONSSEPALP(consSepalpObj)