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