Scippy

SCIP

Solving Constraint Integer Programs

scip.c
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-2014 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 scip.c
17  * @brief SCIP callable library
18  * @author Tobias Achterberg
19  * @author Timo Berthold
20  * @author Gerald Gamrath
21  * @author Stefan Heinz
22  * @author Thorsten Koch
23  * @author Alexander Martin
24  * @author Marc Pfetsch
25  * @author Michael Winkler
26  * @author Kati Wolter
27  *
28  * @todo check all checkStage() calls, use bit flags instead of the SCIP_Bool parameters
29  * @todo check all SCIP_STAGE_* switches, and include the new stages TRANSFORMED and INITSOLVE
30  */
31 
32 /*---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0----+----1----+----2*/
33 
34 #include <ctype.h>
35 #include <stdarg.h>
36 #include <assert.h>
37 #include <string.h>
38 
39 #ifdef WITH_ZLIB
40 #include <zlib.h>
41 #endif
42 
43 #include "scip/def.h"
44 #include "scip/retcode.h"
45 #include "scip/set.h"
46 #include "scip/stat.h"
47 #include "scip/clock.h"
48 #include "scip/vbc.h"
49 #include "scip/interrupt.h"
50 #include "scip/mem.h"
51 #include "scip/misc.h"
52 #include "scip/history.h"
53 #include "scip/event.h"
54 #include "scip/lp.h"
55 #include "scip/nlp.h"
56 #include "scip/var.h"
57 #include "scip/implics.h"
58 #include "scip/prob.h"
59 #include "scip/sol.h"
60 #include "scip/primal.h"
61 #include "scip/tree.h"
62 #include "scip/pricestore.h"
63 #include "scip/sepastore.h"
64 #include "scip/cutpool.h"
65 #include "scip/solve.h"
66 #include "scip/scipgithash.h"
67 #include "scip/scip.h"
68 #include "lpi/lpi.h"
69 
70 #include "scip/branch.h"
71 #include "scip/conflict.h"
72 #include "scip/cons.h"
73 #include "scip/dialog.h"
74 #include "scip/disp.h"
75 #include "scip/heur.h"
76 #include "scip/nodesel.h"
77 #include "scip/reader.h"
78 #include "scip/presol.h"
79 #include "scip/pricer.h"
80 #include "scip/relax.h"
81 #include "scip/sepa.h"
82 #include "scip/prop.h"
83 #include "nlpi/nlpi.h"
84 #include "nlpi/exprinterpret.h"
85 #include "scip/debug.h"
86 #include "scip/dialog_default.h"
87 #include "scip/message_default.h"
88 
89 /* We include the linear constraint handler to be able to copy a (multi)aggregation of variables (to a linear constraint).
90  * The better way would be to handle the distinction between original and transformed variables via a flag 'isoriginal'
91  * in the variable data structure. This would allow to have (multi)aggregated variables in the original problem.
92  *
93  * A second reason for including the linear constraint handler is for copying cuts to linear constraints.
94  */
95 #include "scip/cons_linear.h"
96 
97 /* In debug mode, we include the SCIP's structure in scip.c, such that no one can access
98  * this structure except the interface methods in scip.c.
99  * In optimized mode, the structure is included in scip.h, because some of the methods
100  * are implemented as defines for performance reasons (e.g. the numerical comparisons)
101  */
102 #ifndef NDEBUG
103 #include "scip/struct_scip.h"
104 #endif
105 
106 
107 /*
108  * Local methods
109  */
110 
111 
112 /** checks, if SCIP is in one of the feasible stages */
113 #ifndef NDEBUG
114 static
116  SCIP* scip, /**< SCIP data structure */
117  const char* method, /**< method that was called */
118  SCIP_Bool init, /**< may method be called in the INIT stage? */
119  SCIP_Bool problem, /**< may method be called in the PROBLEM stage? */
120  SCIP_Bool transforming, /**< may method be called in the TRANSFORMING stage? */
121  SCIP_Bool transformed, /**< may method be called in the TRANSFORMED stage? */
122  SCIP_Bool initpresolve, /**< may method be called in the INITPRESOLVE stage? */
123  SCIP_Bool presolving, /**< may method be called in the PRESOLVING stage? */
124  SCIP_Bool exitpresolve, /**< may method be called in the EXITPRESOLE stage? */
125  SCIP_Bool presolved, /**< may method be called in the PRESOLVED stage? */
126  SCIP_Bool initsolve, /**< may method be called in the INITSOLVE stage? */
127  SCIP_Bool solving, /**< may method be called in the SOLVING stage? */
128  SCIP_Bool solved, /**< may method be called in the SOLVED stage? */
129  SCIP_Bool exitsolve, /**< may method be called in the EXITSOLVE stage? */
130  SCIP_Bool freetrans, /**< may method be called in the FREETRANS stage? */
131  SCIP_Bool freescip /**< may method be called in the FREE stage? */
132  )
133 {
134  assert(scip != NULL);
135  assert(method != NULL);
136 
137  /*SCIPdebugMessage("called method <%s> at stage %d ------------------------------------------------\n",
138  method, scip->set->stage);*/
139 
140  assert(scip->mem != NULL);
141  assert(scip->set != NULL);
142  assert(scip->interrupt != NULL);
143  assert(scip->dialoghdlr != NULL);
144  assert(scip->totaltime != NULL);
145 
146  switch( scip->set->stage )
147  {
148  case SCIP_STAGE_INIT:
149  assert(scip->stat == NULL);
150  assert(scip->origprob == NULL);
151  assert(scip->eventfilter == NULL);
152  assert(scip->eventqueue == NULL);
153  assert(scip->branchcand == NULL);
154  assert(scip->lp == NULL);
155  assert(scip->nlp == NULL);
156  assert(scip->primal == NULL);
157  assert(scip->tree == NULL);
158  assert(scip->conflict == NULL);
159  assert(scip->transprob == NULL);
160  assert(scip->pricestore == NULL);
161  assert(scip->sepastore == NULL);
162  assert(scip->cutpool == NULL);
163  assert(scip->delayedcutpool == NULL);
164 
165  if( !init )
166  {
167  SCIPerrorMessage("cannot call method <%s> in initialization stage\n", method);
168  return SCIP_INVALIDCALL;
169  }
170  return SCIP_OKAY;
171 
172  case SCIP_STAGE_PROBLEM:
173  assert(scip->stat != NULL);
174  assert(scip->origprob != NULL);
175  assert(scip->eventfilter == NULL);
176  assert(scip->eventqueue == NULL);
177  assert(scip->branchcand == NULL);
178  assert(scip->lp == NULL);
179  assert(scip->nlp == NULL);
180  assert(scip->primal == NULL);
181  assert(scip->tree == NULL);
182  assert(scip->conflict == NULL);
183  assert(scip->transprob == NULL);
184  assert(scip->pricestore == NULL);
185  assert(scip->sepastore == NULL);
186  assert(scip->cutpool == NULL);
187  assert(scip->delayedcutpool == NULL);
188 
189  if( !problem )
190  {
191  SCIPerrorMessage("cannot call method <%s> in problem creation stage\n", method);
192  return SCIP_INVALIDCALL;
193  }
194  return SCIP_OKAY;
195 
197  assert(scip->stat != NULL);
198  assert(scip->origprob != NULL);
199  assert(scip->eventfilter != NULL);
200  assert(scip->eventqueue != NULL);
201  assert(scip->branchcand != NULL);
202  assert(scip->lp != NULL);
203  assert(scip->primal != NULL);
204  assert(scip->tree != NULL);
205  assert(scip->conflict != NULL);
206  assert(scip->transprob != NULL);
207  assert(scip->pricestore == NULL);
208  assert(scip->sepastore == NULL);
209  assert(scip->cutpool == NULL);
210  assert(scip->delayedcutpool == NULL);
211 
212  if( !transforming )
213  {
214  SCIPerrorMessage("cannot call method <%s> in problem transformation stage\n", method);
215  return SCIP_INVALIDCALL;
216  }
217  return SCIP_OKAY;
218 
220  assert(scip->stat != NULL);
221  assert(scip->origprob != NULL);
222  assert(scip->eventfilter != NULL);
223  assert(scip->eventqueue != NULL);
224  assert(scip->branchcand != NULL);
225  assert(scip->lp != NULL);
226  assert(scip->primal != NULL);
227  assert(scip->tree != NULL);
228  assert(scip->conflict != NULL);
229  assert(scip->transprob != NULL);
230  assert(scip->pricestore == NULL);
231  assert(scip->sepastore == NULL);
232  assert(scip->cutpool == NULL);
233  assert(scip->delayedcutpool == NULL);
234 
235  if( !transformed )
236  {
237  SCIPerrorMessage("cannot call method <%s> in problem transformed stage\n", method);
238  return SCIP_INVALIDCALL;
239  }
240  return SCIP_OKAY;
241 
243  assert(scip->stat != NULL);
244  assert(scip->origprob != NULL);
245  assert(scip->eventfilter != NULL);
246  assert(scip->eventqueue != NULL);
247  assert(scip->branchcand != NULL);
248  assert(scip->lp != NULL);
249  assert(scip->primal != NULL);
250  assert(scip->tree != NULL);
251  assert(scip->conflict != NULL);
252  assert(scip->transprob != NULL);
253  assert(scip->pricestore == NULL);
254  assert(scip->sepastore == NULL);
255  assert(scip->cutpool == NULL);
256  assert(scip->delayedcutpool == NULL);
257 
258  if( !initpresolve )
259  {
260  SCIPerrorMessage("cannot call method <%s> in init presolving stage\n", method);
261  return SCIP_INVALIDCALL;
262  }
263  return SCIP_OKAY;
264 
266  assert(scip->stat != NULL);
267  assert(scip->origprob != NULL);
268  assert(scip->eventfilter != NULL);
269  assert(scip->eventqueue != NULL);
270  assert(scip->branchcand != NULL);
271  assert(scip->lp != NULL);
272  assert(scip->primal != NULL);
273  assert(scip->tree != NULL);
274  assert(scip->conflict != NULL);
275  assert(scip->transprob != NULL);
276  assert(scip->pricestore == NULL);
277  assert(scip->sepastore == NULL);
278  assert(scip->cutpool == NULL);
279  assert(scip->delayedcutpool == NULL);
280 
281  if( !presolving )
282  {
283  SCIPerrorMessage("cannot call method <%s> in presolving stage\n", method);
284  return SCIP_INVALIDCALL;
285  }
286  return SCIP_OKAY;
287 
289  assert(scip->stat != NULL);
290  assert(scip->origprob != NULL);
291  assert(scip->eventfilter != NULL);
292  assert(scip->eventqueue != NULL);
293  assert(scip->branchcand != NULL);
294  assert(scip->lp != NULL);
295  assert(scip->primal != NULL);
296  assert(scip->tree != NULL);
297  assert(scip->conflict != NULL);
298  assert(scip->transprob != NULL);
299  assert(scip->pricestore == NULL);
300  assert(scip->sepastore == NULL);
301  assert(scip->cutpool == NULL);
302  assert(scip->delayedcutpool == NULL);
303 
304  if( !exitpresolve )
305  {
306  SCIPerrorMessage("cannot call method <%s> in exit presolving stage\n", method);
307  return SCIP_INVALIDCALL;
308  }
309  return SCIP_OKAY;
310 
312  assert(scip->stat != NULL);
313  assert(scip->origprob != NULL);
314  assert(scip->eventfilter != NULL);
315  assert(scip->eventqueue != NULL);
316  assert(scip->branchcand != NULL);
317  assert(scip->lp != NULL);
318  assert(scip->primal != NULL);
319  assert(scip->tree != NULL);
320  assert(scip->conflict != NULL);
321  assert(scip->transprob != NULL);
322  assert(scip->pricestore == NULL);
323  assert(scip->sepastore == NULL);
324  assert(scip->cutpool == NULL);
325  assert(scip->delayedcutpool == NULL);
326 
327  if( !presolved )
328  {
329  SCIPerrorMessage("cannot call method <%s> in problem presolved stage\n", method);
330  return SCIP_INVALIDCALL;
331  }
332  return SCIP_OKAY;
333 
335  assert(scip->stat != NULL);
336  assert(scip->origprob != NULL);
337  assert(scip->eventfilter != NULL);
338  assert(scip->eventqueue != NULL);
339  assert(scip->branchcand != NULL);
340  assert(scip->lp != NULL);
341  assert(scip->primal != NULL);
342  assert(scip->tree != NULL);
343  assert(scip->transprob != NULL);
344 
345  if( !initsolve )
346  {
347  SCIPerrorMessage("cannot call method <%s> in init solve stage\n", method);
348  return SCIP_INVALIDCALL;
349  }
350  return SCIP_OKAY;
351 
352  case SCIP_STAGE_SOLVING:
353  assert(scip->stat != NULL);
354  assert(scip->origprob != NULL);
355  assert(scip->eventfilter != NULL);
356  assert(scip->eventqueue != NULL);
357  assert(scip->branchcand != NULL);
358  assert(scip->lp != NULL);
359  assert(scip->primal != NULL);
360  assert(scip->tree != NULL);
361  assert(scip->conflict != NULL);
362  assert(scip->transprob != NULL);
363  assert(scip->pricestore != NULL);
364  assert(scip->sepastore != NULL);
365  assert(scip->cutpool != NULL);
366  assert(scip->delayedcutpool != NULL);
367 
368  if( !solving )
369  {
370  SCIPerrorMessage("cannot call method <%s> in solving stage\n", method);
371  return SCIP_INVALIDCALL;
372  }
373  return SCIP_OKAY;
374 
375  case SCIP_STAGE_SOLVED:
376  assert(scip->stat != NULL);
377  assert(scip->origprob != NULL);
378  assert(scip->eventfilter != NULL);
379  assert(scip->eventqueue != NULL);
380  assert(scip->branchcand != NULL);
381  assert(scip->lp != NULL);
382  assert(scip->primal != NULL);
383  assert(scip->tree != NULL);
384  assert(scip->conflict != NULL);
385  assert(scip->transprob != NULL);
386  assert(scip->pricestore != NULL);
387  assert(scip->sepastore != NULL);
388  assert(scip->cutpool != NULL);
389  assert(scip->delayedcutpool != NULL);
390 
391  if( !solved )
392  {
393  SCIPerrorMessage("cannot call method <%s> in problem solved stage\n", method);
394  return SCIP_INVALIDCALL;
395  }
396  return SCIP_OKAY;
397 
399  assert(scip->stat != NULL);
400  assert(scip->origprob != NULL);
401  assert(scip->eventfilter != NULL);
402  assert(scip->eventqueue != NULL);
403  assert(scip->branchcand != NULL);
404  assert(scip->lp != NULL);
405  assert(scip->primal != NULL);
406  assert(scip->tree != NULL);
407  assert(scip->transprob != NULL);
408 
409  if( !exitsolve )
410  {
411  SCIPerrorMessage("cannot call method <%s> in solve deinitialization stage\n", method);
412  return SCIP_INVALIDCALL;
413  }
414  return SCIP_OKAY;
415 
417  assert(scip->stat != NULL);
418  assert(scip->origprob != NULL);
419  assert(scip->pricestore == NULL);
420  assert(scip->sepastore == NULL);
421  assert(scip->cutpool == NULL);
422  assert(scip->delayedcutpool == NULL);
423 
424  if( !freetrans )
425  {
426  SCIPerrorMessage("cannot call method <%s> in free transformed problem stage\n", method);
427  return SCIP_INVALIDCALL;
428  }
429  return SCIP_OKAY;
430 
431  case SCIP_STAGE_FREE:
432  if( !freescip )
433  {
434  SCIPerrorMessage("cannot call method <%s> in free stage\n", method);
435  return SCIP_INVALIDCALL;
436  }
437  return SCIP_OKAY;
438 
439  default:
440  /* note that this is in an internal SCIP error since all SCIP stages are covert in the switch above */
441  SCIPerrorMessage("invalid SCIP stage <%d>\n", scip->set->stage);
442  return SCIP_ERROR;
443  }
444 }
445 #else
446 #define checkStage(scip,method,init,problem,transforming,transformed,initpresolve,presolving,exitpresolve,presolved, \
447  initsolve,solving,solved,exitsolve,freetrans,freescip) SCIP_OKAY
448 #endif
449 
450 
451 /** gets global primal bound (objective value of best solution or user objective limit) */
452 static
454  SCIP* scip /**< SCIP data structure */
455  )
456 {
457  return SCIPprobExternObjval(scip->transprob, scip->origprob, scip->set, scip->primal->upperbound);
458 }
459 
460 /** gets global dual bound */
461 static
463  SCIP* scip /**< SCIP data structure */
464  )
465 {
466  SCIP_Real lowerbound;
467 
468  if( scip->set->stage <= SCIP_STAGE_INITSOLVE )
469  {
470  /* in case we are in presolving we use the stored dual bound if it exits, otherwise, minus or plus infinity
471  * depending on the objective sense
472  */
473  if( scip->transprob->dualbound < SCIP_INVALID )
474  lowerbound = SCIPprobInternObjval(scip->transprob, scip->origprob, scip->set, scip->transprob->dualbound);
475  else
476  return SCIPprobExternObjval(scip->transprob, scip->origprob, scip->set, -SCIPinfinity(scip));
477  }
478  else
479  lowerbound = SCIPtreeGetLowerbound(scip->tree, scip->set);
480 
481 
482  if( SCIPsetIsInfinity(scip->set, lowerbound) )
483  {
484  /* in case we could not prove whether the problem is unbounded or infeasible, we want to terminate with
485  * dual bound = -inf instead of dual bound = primal bound = +inf
486  * also in case we prove that the problem is unbounded, it seems to make sense to return with dual bound = -inf,
487  * since -infinity is the only valid lower bound
488  */
490  return SCIPprobExternObjval(scip->transprob, scip->origprob, scip->set, -SCIPinfinity(scip));
491  else
492  return getPrimalbound(scip);
493  }
494  else
495  return SCIPprobExternObjval(scip->transprob, scip->origprob, scip->set, lowerbound);
496 }
497 
498 /** gets global lower (dual) bound in transformed problem */
499 static
501  SCIP* scip /**< SCIP data structure */
502  )
503 {
504  if( scip->set->stage <= SCIP_STAGE_INITSOLVE )
505  return -SCIPinfinity(scip);
506 
507  return SCIPtreeGetLowerbound(scip->tree, scip->set);
508 }
509 
510 /** gets global upper (primal) bound in transformed problem (objective value of best solution or user objective limit) */
511 static
513  SCIP* scip /**< SCIP data structure */
514  )
515 {
516  return scip->primal->upperbound;
517 }
518 
519 
520 /*
521  * miscellaneous methods
522  */
523 
524 /** returns complete SCIP version number in the format "major . minor tech"
525  *
526  * @return complete SCIP version
527  */
529  void
530  )
531 {
532  return (SCIP_Real)(SCIP_VERSION)/100.0;
533 }
534 
535 /** returns SCIP major version
536  *
537  * @return major SCIP version
538  */
540  void
541  )
542 {
543  return SCIP_VERSION/100;
544 }
545 
546 /** returns SCIP minor version
547  *
548  * @return minor SCIP version
549  */
551  void
552  )
553 {
554  return (SCIP_VERSION/10) % 10;
555 }
556 
557 /** returns SCIP technical version
558  *
559  * @return technical SCIP version
560  */
562  void
563  )
564 {
565  return SCIP_VERSION % 10; /*lint !e778*/
566 }
567 
568 /** returns SCIP sub version number
569  *
570  * @return subversion SCIP version
571  */
573  void
574  )
575 {
576  return SCIP_SUBVERSION;
577 }
578 
579 /** prints a version information line to a file stream via the message handler system
580  *
581  * @note If the message handler is set to a NULL pointer nothing will be printed
582  */
584  SCIP* scip, /**< SCIP data structure */
585  FILE* file /**< output file (or NULL for standard output) */
586  )
587 {
588  assert( scip != NULL );
589 
590  SCIPmessageFPrintInfo(scip->messagehdlr, file, "SCIP version %d.%d.%d",
592 #if SCIP_SUBVERSION > 0
593  SCIPmessageFPrintInfo(scip->messagehdlr, file, ".%d", SCIPsubversion());
594 #endif
595 
596  SCIPmessageFPrintInfo(scip->messagehdlr, file, " [precision: %d byte]", (int)sizeof(SCIP_Real));
597 
598 #ifndef BMS_NOBLOCKMEM
599  SCIPmessageFPrintInfo(scip->messagehdlr, file, " [memory: block]");
600 #else
601  SCIPmessageFPrintInfo(scip->messagehdlr, file, " [memory: standard]");
602 #endif
603 #ifndef NDEBUG
604  SCIPmessageFPrintInfo(scip->messagehdlr, file, " [mode: debug]");
605 #else
606  SCIPmessageFPrintInfo(scip->messagehdlr, file, " [mode: optimized]");
607 #endif
608  SCIPmessageFPrintInfo(scip->messagehdlr, file, " [LP solver: %s]", SCIPlpiGetSolverName());
609  SCIPmessageFPrintInfo(scip->messagehdlr, file, " [GitHash: %s]", SCIPgetGitHash());
610  SCIPmessageFPrintInfo(scip->messagehdlr, file, "\n");
611  SCIPmessageFPrintInfo(scip->messagehdlr, file, "%s\n", SCIP_COPYRIGHT);
612 }
613 
614 /** prints error message for the given SCIP_RETCODE via the error prints method */
616  SCIP_RETCODE retcode /**< SCIP return code causing the error */
617  )
618 {
619  SCIPmessagePrintError("SCIP Error (%d): ", retcode);
620  SCIPretcodePrintError(retcode);
621  SCIPmessagePrintError("\n");
622 }
623 
624 /** update statistical information when a new solution was found */
626  SCIP* scip /**< SCIP data structure */
627  )
628 {
629  SCIP_Real primalbound;
630  SCIP_Real dualbound;
631 
632  primalbound = getPrimalbound(scip);
633  dualbound = getDualbound(scip);
634 
635  if( SCIPsetIsEQ(scip->set, primalbound, dualbound) )
636  scip->stat->lastsolgap = 0.0;
637 
638  else if( SCIPsetIsZero(scip->set, dualbound)
639  || SCIPsetIsZero(scip->set, primalbound)
640  || SCIPsetIsInfinity(scip->set, REALABS(primalbound))
641  || SCIPsetIsInfinity(scip->set, REALABS(dualbound))
642  || primalbound * dualbound < 0.0 )
643  {
644  scip->stat->lastsolgap = SCIPsetInfinity(scip->set);
645  }
646  else
647  {
648  SCIP_Real absdual = REALABS(dualbound);
649  SCIP_Real absprimal = REALABS(primalbound);
650 
651  scip->stat->lastsolgap = REALABS((primalbound - dualbound)/MIN(absdual, absprimal));
652  }
653 
654  if( scip->primal->nsols == 1 )
655  scip->stat->firstsolgap = scip->stat->lastsolgap;
656 
657  if( scip->set->stage == SCIP_STAGE_SOLVING && scip->set->misc_calcintegral )
658  {
660  }
661 }
662 
663 /*
664  * general SCIP methods
665  */
666 
667 /** creates and initializes SCIP data structures
668  *
669  * @note The SCIP default message handler is installed. Use the method SCIPsetMessagehdlr() to install your own
670  * message handler or SCIPsetMessagehdlrLogfile() and SCIPsetMessagehdlrQuiet() to write into a log
671  * file and turn off/on the display output, respectively.
672  *
673  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
674  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
675  *
676  * @post After calling this method \SCIP reached the solving stage \ref SCIP_STAGE_INIT
677  *
678  * See \ref SCIP_Stage "SCIP_STAGE" for a complete list of all possible solving stages.
679  */
681  SCIP** scip /**< pointer to SCIP data structure */
682  )
683 {
684  assert(scip != NULL);
685 
686  SCIP_ALLOC( BMSallocMemory(scip) );
687 
688  /* create a default message handler */
689  SCIP_CALL( SCIPcreateMessagehdlrDefault(&(*scip)->messagehdlr, TRUE, NULL, FALSE) );
690 
691  SCIP_CALL( SCIPmemCreate(&(*scip)->mem) );
692  SCIP_CALL( SCIPsetCreate(&(*scip)->set, (*scip)->messagehdlr, (*scip)->mem->setmem, *scip) );
693  SCIP_CALL( SCIPinterruptCreate(&(*scip)->interrupt) );
694  SCIP_CALL( SCIPdialoghdlrCreate((*scip)->set, &(*scip)->dialoghdlr) );
695  SCIP_CALL( SCIPclockCreate(&(*scip)->totaltime, SCIP_CLOCKTYPE_DEFAULT) );
696  SCIPclockStart((*scip)->totaltime, (*scip)->set);
697  (*scip)->stat = NULL;
698  (*scip)->origprob = NULL;
699  (*scip)->origprimal = NULL;
700  (*scip)->eventfilter = NULL;
701  (*scip)->eventqueue = NULL;
702  (*scip)->branchcand = NULL;
703  (*scip)->lp = NULL;
704  (*scip)->nlp = NULL;
705  (*scip)->primal = NULL;
706  (*scip)->tree = NULL;
707  (*scip)->conflict = NULL;
708  (*scip)->transprob = NULL;
709  (*scip)->pricestore = NULL;
710  (*scip)->sepastore = NULL;
711  (*scip)->cutpool = NULL;
712  (*scip)->delayedcutpool = NULL;
713 
714  SCIP_CALL( SCIPnlpInclude((*scip)->set, SCIPblkmem(*scip)) );
715 
716  if( strcmp(SCIPlpiGetSolverName(), "NONE") != 0 )
717  {
719  }
720  if( strcmp(SCIPexprintGetName(), "NONE") != 0 )
721  {
723  }
724 
725 #ifdef WITH_ZLIB
726  SCIP_CALL( SCIPsetIncludeExternalCode((*scip)->set, "ZLIB " ZLIB_VERSION, "General purpose compression library by J. Gailly and M. Adler (zlib.net)") );
727 #endif
728 
729  return SCIP_OKAY;
730 }
731 
732 /** frees SCIP data structures
733  *
734  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
735  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
736  *
737  * @pre This method can be called if @p scip is in one of the following stages:
738  * - \ref SCIP_STAGE_INIT
739  * - \ref SCIP_STAGE_PROBLEM
740  * - \ref SCIP_STAGE_TRANSFORMED
741  * - \ref SCIP_STAGE_INITPRESOLVE
742  * - \ref SCIP_STAGE_PRESOLVING
743  * - \ref SCIP_STAGE_PRESOLVED
744  * - \ref SCIP_STAGE_EXITPRESOLVE
745  * - \ref SCIP_STAGE_SOLVING
746  * - \ref SCIP_STAGE_SOLVED
747  * - \ref SCIP_STAGE_FREE
748  *
749  * @post After calling this method \SCIP reached the solving stage \ref SCIP_STAGE_FREE
750  *
751  * See \ref SCIP_Stage "SCIP_STAGE" for a complete list of all possible solving stages.
752  */
754  SCIP** scip /**< pointer to SCIP data structure */
755  )
756 {
757  assert(scip != NULL);
758  assert(*scip != NULL);
759 
760  SCIP_CALL( checkStage(*scip, "SCIPfree", TRUE, TRUE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, TRUE, TRUE, FALSE, FALSE, TRUE) );
761 
762  SCIP_CALL( SCIPfreeProb(*scip) );
763  assert((*scip)->set->stage == SCIP_STAGE_INIT);
764 
765  /* switch stage to FREE */
766  (*scip)->set->stage = SCIP_STAGE_FREE;
767 
768  SCIP_CALL( SCIPsetFree(&(*scip)->set, (*scip)->mem->setmem) );
769  SCIP_CALL( SCIPdialoghdlrFree(*scip, &(*scip)->dialoghdlr) );
770  SCIPclockFree(&(*scip)->totaltime);
771  SCIPinterruptFree(&(*scip)->interrupt);
772  SCIP_CALL( SCIPmemFree(&(*scip)->mem) );
773 
774  /* release message handler */
775  SCIP_CALL( SCIPmessagehdlrRelease(&(*scip)->messagehdlr) );
776 
777  BMSfreeMemory(scip);
778 
779  return SCIP_OKAY;
780 }
781 
782 /** returns current stage of SCIP
783  *
784  * @return the current SCIP stage
785  *
786  * See \ref SCIP_Stage "SCIP_STAGE" for a complete list of all possible solving stages.
787  */
789  SCIP* scip /**< SCIP data structure */
790  )
791 {
792  assert(scip != NULL);
793  assert(scip->set != NULL);
794 
795  return scip->set->stage;
796 }
797 
798 /** outputs SCIP stage and solution status if applicable via the message handler
799  *
800  * @note If the message handler is set to a NULL pointer nothing will be printed
801  *
802  * @note If limits have been changed between the solution and the call to this function, the status is recomputed and
803  * thus may to correspond to the original status.
804  *
805  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
806  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
807  *
808  * See \ref SCIP_Stage "SCIP_STAGE" for a complete list of all possible solving stages.
809  */
811  SCIP* scip, /**< SCIP data structure */
812  FILE* file /**< output file (or NULL for standard output) */
813  )
814 {
815  SCIP_CALL( checkStage(scip, "SCIPprintStage", TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE) );
816 
817  switch( scip->set->stage )
818  {
819  case SCIP_STAGE_INIT:
820  SCIPmessageFPrintInfo(scip->messagehdlr, file, "initialization");
821  break;
822  case SCIP_STAGE_PROBLEM:
823  SCIPmessageFPrintInfo(scip->messagehdlr, file, "problem creation / modification");
824  break;
826  SCIPmessageFPrintInfo(scip->messagehdlr, file, "problem transformation");
827  break;
829  SCIPmessageFPrintInfo(scip->messagehdlr, file, "problem transformed");
830  break;
832  SCIPmessageFPrintInfo(scip->messagehdlr, file, "presolving is being initialized");
833  break;
835  if( SCIPsolveIsStopped(scip->set, scip->stat, TRUE) )
836  {
837  SCIPmessageFPrintInfo(scip->messagehdlr, file, "solving was interrupted [");
838  SCIP_CALL( SCIPprintStatus(scip, file) );
839  SCIPmessageFPrintInfo(scip->messagehdlr, file, "]");
840  }
841  else
842  SCIPmessageFPrintInfo(scip->messagehdlr, file, "presolving process is running");
843  break;
845  SCIPmessageFPrintInfo(scip->messagehdlr, file, "presolving is being exited");
846  break;
848  SCIPmessageFPrintInfo(scip->messagehdlr, file, "problem is presolved");
849  break;
851  SCIPmessageFPrintInfo(scip->messagehdlr, file, "solving process initialization");
852  break;
853  case SCIP_STAGE_SOLVING:
854  if( SCIPsolveIsStopped(scip->set, scip->stat, TRUE) )
855  {
856  SCIPmessageFPrintInfo(scip->messagehdlr, file, "solving was interrupted [");
857  SCIP_CALL( SCIPprintStatus(scip, file) );
858  SCIPmessageFPrintInfo(scip->messagehdlr, file, "]");
859  }
860  else
861  SCIPmessageFPrintInfo(scip->messagehdlr, file, "solving process is running");
862  break;
863  case SCIP_STAGE_SOLVED:
864  SCIPmessageFPrintInfo(scip->messagehdlr, file, "problem is solved [");
865  SCIP_CALL( SCIPprintStatus(scip, file) );
866  SCIPmessageFPrintInfo(scip->messagehdlr, file, "]");
867 
868  if( scip->primal->nlimsolsfound == 0 && !SCIPisInfinity(scip, getPrimalbound(scip)) )
869  SCIPmessageFPrintInfo(scip->messagehdlr, file, " (objective limit reached)");
870 
871  break;
873  SCIPmessageFPrintInfo(scip->messagehdlr, file, "solving process deinitialization");
874  break;
876  SCIPmessageFPrintInfo(scip->messagehdlr, file, "freeing transformed problem");
877  break;
878  case SCIP_STAGE_FREE:
879  SCIPmessageFPrintInfo(scip->messagehdlr, file, "freeing SCIP");
880  break;
881  default:
882  SCIPerrorMessage("invalid SCIP stage <%d>\n", scip->set->stage);
883  return SCIP_INVALIDDATA;
884  }
885 
886  return SCIP_OKAY;
887 }
888 
889 /** gets solution status
890  *
891  * @return SCIP solution status
892  *
893  * See \ref SCIP_Status "SCIP_STATUS" for a complete list of all possible solving status.
894  */
896  SCIP* scip /**< SCIP data structure */
897  )
898 {
899  SCIP_CALL_ABORT( checkStage(scip, "SCIPgetStatus", TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE) );
900 
901  if( scip->set->stage == SCIP_STAGE_INIT || scip->set->stage == SCIP_STAGE_FREE )
902  return SCIP_STATUS_UNKNOWN;
903  else
904  {
905  assert(scip->stat != NULL);
906 
907  return scip->stat->status;
908  }
909 }
910 
911 /** outputs solution status
912  *
913  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
914  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
915  *
916  * See \ref SCIP_Status "SCIP_STATUS" for a complete list of all possible solving status.
917  */
919  SCIP* scip, /**< SCIP data structure */
920  FILE* file /**< output file (or NULL for standard output) */
921  )
922 {
923  SCIP_CALL( checkStage(scip, "SCIPprintStatus", TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE) );
924 
925  switch( SCIPgetStatus(scip) )
926  {
927  case SCIP_STATUS_UNKNOWN:
928  SCIPmessageFPrintInfo(scip->messagehdlr, file, "unknown");
929  break;
931  SCIPmessageFPrintInfo(scip->messagehdlr, file, "user interrupt");
932  break;
934  SCIPmessageFPrintInfo(scip->messagehdlr, file, "node limit reached");
935  break;
937  SCIPmessageFPrintInfo(scip->messagehdlr, file, "total node limit reached");
938  break;
940  SCIPmessageFPrintInfo(scip->messagehdlr, file, "stall node limit reached");
941  break;
943  SCIPmessageFPrintInfo(scip->messagehdlr, file, "time limit reached");
944  break;
946  SCIPmessageFPrintInfo(scip->messagehdlr, file, "memory limit reached");
947  break;
949  SCIPmessageFPrintInfo(scip->messagehdlr, file, "gap limit reached");
950  break;
952  SCIPmessageFPrintInfo(scip->messagehdlr, file, "solution limit reached");
953  break;
955  SCIPmessageFPrintInfo(scip->messagehdlr, file, "solution improvement limit reached");
956  break;
957  case SCIP_STATUS_OPTIMAL:
958  SCIPmessageFPrintInfo(scip->messagehdlr, file, "optimal solution found");
959  break;
961  SCIPmessageFPrintInfo(scip->messagehdlr, file, "infeasible");
962  break;
964  SCIPmessageFPrintInfo(scip->messagehdlr, file, "unbounded");
965  break;
967  SCIPmessageFPrintInfo(scip->messagehdlr, file, "infeasible or unbounded");
968  break;
969  default:
970  SCIPerrorMessage("invalid status code <%d>\n", SCIPgetStatus(scip));
971  return SCIP_INVALIDDATA;
972  }
973 
974  return SCIP_OKAY;
975 }
976 
977 /** returns whether the current stage belongs to the transformed problem space
978  *
979  * @return Returns TRUE if the \SCIP instance is transformed, otherwise FALSE
980  */
982  SCIP* scip /**< SCIP data structure */
983  )
984 {
985  assert(scip != NULL);
986 
987  return ((int)scip->set->stage >= (int)SCIP_STAGE_TRANSFORMING);
988 }
989 
990 /** returns whether the solution process should be probably correct
991  *
992  * @note This feature is not supported yet!
993  *
994  * @return Returns TRUE if \SCIP is exact solving mode, otherwise FALSE
995  */
997  SCIP* scip /**< SCIP data structure */
998  )
999 {
1000  assert(scip != NULL);
1001  assert(scip->set != NULL);
1002 
1003  return (scip->set->misc_exactsolve);
1004 }
1005 
1006 /** returns whether the presolving process would be finished given no more presolving reductions are found in this
1007  * presolving round
1008  *
1009  * Checks whether the number of presolving rounds is not exceeded and the presolving reductions found in the current
1010  * presolving round suffice to trigger another presolving round.
1011  *
1012  * @note if subsequent presolvers find more reductions, presolving might continue even if the method returns FALSE
1013  * @note does not check whether infeasibility or unboundedness was already detected in presolving (which would result
1014  * in presolving being stopped although the method returns TRUE)
1015  *
1016  * @return Returns TRUE if presolving is finished if no further reductions are detected
1017  */
1019  SCIP* scip /**< SCIP data structure */
1020  )
1021 {
1022  int maxnrounds;
1023  SCIP_Bool finished;
1024 
1025  assert(scip != NULL);
1026  assert(scip->stat != NULL);
1027  assert(scip->transprob != NULL);
1028 
1029  SCIP_CALL_ABORT( checkStage(scip, "SCIPisPresolveFinished", FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE) );
1030 
1031  /* get maximum number of presolving rounds */
1032  maxnrounds = scip->set->presol_maxrounds;
1033  if( maxnrounds == -1 )
1034  maxnrounds = INT_MAX;
1035 
1036  /* don't abort, if enough changes were applied to the variables */
1037  finished = (scip->transprob->nvars == 0
1038  || (scip->stat->npresolfixedvars - scip->stat->lastnpresolfixedvars
1039  + scip->stat->npresolaggrvars - scip->stat->lastnpresolaggrvars
1041  + (scip->stat->npresolchgbds - scip->stat->lastnpresolchgbds)/10.0
1042  + (scip->stat->npresoladdholes - scip->stat->lastnpresoladdholes)/10.0
1043  <= scip->set->presol_abortfac * scip->transprob->nvars)); /*lint !e653*/
1044 
1045  /* don't abort, if enough changes were applied to the constraints */
1046  finished = finished
1047  && (scip->transprob->nconss == 0
1048  || (scip->stat->npresoldelconss - scip->stat->lastnpresoldelconss
1049  + scip->stat->npresoladdconss - scip->stat->lastnpresoladdconss
1051  + scip->stat->npresolchgsides - scip->stat->lastnpresolchgsides
1052  <= scip->set->presol_abortfac * scip->transprob->nconss));
1053 
1054  /* don't abort, if enough changes were applied to the coefficients (assume a 1% density of non-zero elements) */
1055  finished = finished
1056  && (scip->transprob->nvars == 0 || scip->transprob->nconss == 0
1057  || (scip->stat->npresolchgcoefs - scip->stat->lastnpresolchgcoefs
1058  <= scip->set->presol_abortfac * 0.01 * scip->transprob->nvars * scip->transprob->nconss));
1059 
1060 #if 0
1061  /* don't abort, if enough new implications or cliques were found (assume 100 implications per variable) */
1062  finished = finished
1063  && (scip->stat->nimplications - scip->stat->lastnpresolimplications
1064  <= scip->set->presol_abortfac * 100 * scip->transprob->nbinvars)
1065  && (SCIPcliquetableGetNCliques(scip->cliquetable) - scip->stat->lastnpresolcliques
1066  <= scip->set->presol_abortfac * scip->transprob->nbinvars);
1067 #endif
1068 
1069  /* abort if maximal number of presolving rounds is reached */
1070  finished = finished || (scip->stat->npresolrounds + 1 >= maxnrounds);
1071 
1072  return finished;
1073 }
1074 
1075 /** returns whether the user pressed CTRL-C to interrupt the solving process
1076  *
1077  * @return Returns TRUE if Ctrl-C was pressed, otherwise FALSE.
1078  */
1080  SCIP* scip /**< SCIP data structure */
1081  )
1082 {
1083  return SCIPinterrupted();
1084 }
1085 
1086 /** returns whether the solving process should be / was stopped before proving optimality;
1087  * if the solving process should be / was stopped, the status returned by SCIPgetStatus() yields
1088  * the reason for the premature abort
1089  *
1090  * @return Returns TRUE if solving process is stopped/interrupted, otherwise FALSE.
1091  */
1093  SCIP* scip /**< SCIP data structure */
1094  )
1095 {
1096  SCIP_CALL_ABORT( checkStage(scip, "SCIPisStopped", FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE) );
1097 
1098  return SCIPsolveIsStopped(scip->set, scip->stat, FALSE);
1099 }
1100 
1101 
1102 
1103 
1104 /*
1105  * message output methods
1106  */
1107 
1108 /** installs the given message handler, such that all messages are passed to this handler. A messages handler can be
1109  * created via SCIPmessagehdlrCreate().
1110  *
1111  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
1112  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
1113  *
1114  * @pre this method can be called in one of the following stages of the SCIP solving process:
1115  * - \ref SCIP_STAGE_INIT
1116  * - \ref SCIP_STAGE_PROBLEM
1117  *
1118  * @note The currently installed messages handler gets freed if this SCIP instance is its last user (w.r.t. capture/release).
1119  */
1121  SCIP* scip, /**< SCIP data structure */
1122  SCIP_MESSAGEHDLR* messagehdlr /**< message handler to install, or NULL to suppress all output */
1123  )
1124 {
1125  int i;
1126 
1127  SCIP_CALL( checkStage(scip, "SCIPsetMessagehdlr", TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE) );
1128 
1129  assert(scip != NULL);
1130  assert(scip->set != NULL);
1131  assert(scip->set->nlpis != NULL || scip->set->nnlpis == 0);
1132 
1133  /* update message handler in NLP solver interfaces */
1134  for( i = 0; i < scip->set->nnlpis; ++i )
1135  {
1136  assert(scip->set->nlpis[i] != NULL);
1137 
1138  SCIP_CALL( SCIPnlpiSetMessageHdlr(scip->set->nlpis[i], messagehdlr) );
1139  }
1140 
1141  SCIPmessagehdlrCapture(messagehdlr);
1142 
1144  assert(scip->messagehdlr == NULL);
1145 
1146  scip->messagehdlr = messagehdlr;
1147 
1148  return SCIP_OKAY;
1149 }
1150 
1151 /** returns the currently installed message handler
1152  *
1153  * @return the currently installed message handler, or NULL if messages are currently suppressed
1154  */
1156  SCIP* scip /**< SCIP data structure */
1157  )
1158 {
1159  return scip->messagehdlr;
1160 }
1161 
1162 /** sets the log file name for the currently installed message handler */
1164  SCIP* scip, /**< SCIP data structure */
1165  const char* filename /**< name of log file, or NULL (no log) */
1166  )
1167 {
1168  if( scip->messagehdlr != NULL )
1169  {
1170  SCIPmessagehdlrSetLogfile(scip->messagehdlr, filename);
1171  }
1172 }
1173 
1174 /** sets the currently installed message handler to be quiet (or not) */
1176  SCIP* scip, /**< SCIP data structure */
1177  SCIP_Bool quiet /**< should screen messages be suppressed? */
1178  )
1179 {
1180  if( scip->messagehdlr != NULL )
1181  {
1182  SCIPmessagehdlrSetQuiet(scip->messagehdlr, quiet);
1183  }
1184 }
1185 
1186 /** prints a warning message via the message handler */
1188  SCIP* scip, /**< SCIP data structure */
1189  const char* formatstr, /**< format string like in printf() function */
1190  ... /**< format arguments line in printf() function */
1191  )
1192 {
1193  va_list ap;
1194 
1195  assert(scip != NULL);
1196 
1197  va_start(ap, formatstr); /*lint !e826*/
1198  SCIPmessageVFPrintWarning(scip->messagehdlr, formatstr, ap);
1199  va_end(ap);
1200 }
1201 
1202 /** prints a dialog message that requests user interaction or is a direct response to a user interactive command */
1204  SCIP* scip, /**< SCIP data structure */
1205  FILE* file, /**< file stream to print into, or NULL for stdout */
1206  const char* formatstr, /**< format string like in printf() function */
1207  ... /**< format arguments line in printf() function */
1208  )
1209 {
1210  va_list ap;
1211 
1212  assert(scip != NULL);
1213 
1214  va_start(ap, formatstr); /*lint !e826*/
1215  SCIPmessageVFPrintDialog(scip->messagehdlr, file, formatstr, ap);
1216  va_end(ap);
1217 }
1218 
1219 /** prints a message */
1221  SCIP* scip, /**< SCIP data structure */
1222  FILE* file, /**< file stream to print into, or NULL for stdout */
1223  const char* formatstr, /**< format string like in printf() function */
1224  ... /**< format arguments line in printf() function */
1225  )
1226 {
1227  va_list ap;
1228 
1229  assert(scip != NULL);
1230 
1231  va_start(ap, formatstr); /*lint !e826*/
1232  SCIPmessageVFPrintInfo(scip->messagehdlr, file, formatstr, ap);
1233  va_end(ap);
1234 }
1235 
1236 /** prints a message depending on the verbosity level */
1238  SCIP* scip, /**< SCIP data structure */
1239  SCIP_VERBLEVEL msgverblevel, /**< verbosity level of this message */
1240  FILE* file, /**< file stream to print into, or NULL for stdout */
1241  const char* formatstr, /**< format string like in printf() function */
1242  ... /**< format arguments line in printf() function */
1243  )
1244 {
1245  va_list ap;
1246 
1247  assert(scip != NULL);
1248  assert(scip->set != NULL);
1249 
1250  va_start(ap, formatstr); /*lint !e826*/
1251  SCIPmessageVFPrintVerbInfo(scip->messagehdlr, scip->set->disp_verblevel, msgverblevel, file, formatstr, ap);
1252  va_end(ap);
1253 }
1254 
1255 /** returns the current message verbosity level
1256  *
1257  * @return message verbosity level of SCIP
1258  *
1259  * @see \ref SCIP_VerbLevel "SCIP_VERBLEVEL" for a list of all verbosity levels
1260  */
1262  SCIP* scip /**< SCIP data structure */
1263  )
1264 {
1265  assert(scip != NULL);
1266  assert(scip->set != NULL);
1267 
1268  return scip->set->disp_verblevel;
1269 }
1270 
1271 
1272 /*
1273  * SCIP copy methods
1274  */
1275 
1276 /** copy active and tight cuts from one SCIP instance to linear constraints of another SCIP instance */
1277 static
1279  SCIP* sourcescip, /**< source SCIP data structure */
1280  SCIP* targetscip, /**< target SCIP data structure */
1281  SCIP_CUT** cuts, /**< cuts to copy */
1282  int ncuts, /**< number of cuts to copy */
1283  SCIP_HASHMAP* varmap, /**< a hashmap to store the mapping of source variables corresponding
1284  * target variables, or NULL */
1285  SCIP_HASHMAP* consmap, /**< a hashmap to store the mapping of source constraints to the corresponding
1286  * target constraints, or NULL */
1287  SCIP_Bool global, /**< create a global or a local copy? */
1288  int* ncutsadded /**< pointer to store number of copied cuts */
1289  )
1290 {
1291  int c;
1292 
1293  assert(sourcescip != NULL);
1294  assert(targetscip != NULL);
1295  assert(cuts != NULL || ncuts == 0);
1296  assert(ncutsadded != NULL);
1297 
1298  *ncutsadded = 0;
1299 
1300  for( c = 0; c < ncuts; ++c )
1301  {
1302  SCIP_ROW* row;
1303 
1304  row = SCIPcutGetRow(cuts[c]); /*lint !e613*/
1305  assert(!SCIProwIsLocal(row));
1306  assert(!SCIProwIsModifiable(row));
1307 
1308  /* create a linear constraint out of the cut */
1309  if( SCIPcutGetAge(cuts[c]) == 0 && SCIProwIsInLP(row) ) /*lint !e613*/
1310  {
1311  char name[SCIP_MAXSTRLEN];
1312  SCIP_CONS* cons;
1313  SCIP_COL** cols;
1314  SCIP_VAR** vars;
1315  int ncols;
1316  int i;
1317 
1318  cols = SCIProwGetCols(row);
1319  ncols = SCIProwGetNNonz(row);
1320 
1321  /* get all variables of the row */
1322  SCIP_CALL( SCIPallocBufferArray(targetscip, &vars, ncols) );
1323  for( i = 0; i < ncols; ++i )
1324  vars[i] = SCIPcolGetVar(cols[i]);
1325 
1326  /* get corresponding variables in targetscip if necessary */
1327  if( sourcescip != targetscip )
1328  {
1329  SCIP_Bool success;
1330 
1331  for( i = 0; i < ncols; ++i )
1332  {
1333  SCIP_CALL( SCIPgetVarCopy(sourcescip, targetscip, vars[i], &vars[i], varmap, consmap, global, &success) );
1334 
1335  if( !success )
1336  {
1337  SCIPdebugMessage("Converting cuts to constraints failed.\n");
1338 
1339  /* free temporary memory */
1340  SCIPfreeBufferArray(targetscip, &vars);
1341  return SCIP_OKAY;
1342  }
1343  }
1344  }
1345 
1346  (void) SCIPsnprintf(name, SCIP_MAXSTRLEN, "%s_%d", SCIProwGetName(row), SCIPgetNRuns(sourcescip));
1347  SCIP_CALL( SCIPcreateConsLinear(targetscip, &cons, name, ncols, vars, SCIProwGetVals(row),
1350  SCIP_CALL( SCIPaddCons(targetscip, cons) );
1351 
1352  SCIPdebugMessage("Converted cut <%s> to constraint <%s>.\n", SCIProwGetName(row), SCIPconsGetName(cons));
1353  SCIPdebugPrintCons(targetscip, cons, NULL);
1354  SCIP_CALL( SCIPreleaseCons(targetscip, &cons) );
1355 
1356  /* free temporary memory */
1357  SCIPfreeBufferArray(targetscip, &vars);
1358 
1359  ++(*ncutsadded);
1360  }
1361  }
1362 
1363  return SCIP_OKAY;
1364 }
1365 
1366 #define HASHTABLESIZE_FACTOR 5
1367 
1368 /** copies plugins from sourcescip to targetscip; in case that a constraint handler which does not need constraints
1369  * cannot be copied, valid will return FALSE. All plugins can declare that, if their copy process failed, the
1370  * copied SCIP instance might not represent the same problem semantics as the original.
1371  * Note that in this case dual reductions might be invalid.
1372  *
1373  * @note In a multi thread case, you need to lock the copying procedure from outside with a mutex.
1374  * Also, 'passmessagehdlr' should be set to FALSE.
1375  * @note Do not change the source SCIP environment during the copying process
1376  *
1377  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
1378  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
1379  *
1380  * @pre This method can be called if sourcescip is in one of the following stages:
1381  * - \ref SCIP_STAGE_PROBLEM
1382  * - \ref SCIP_STAGE_TRANSFORMED
1383  * - \ref SCIP_STAGE_INITPRESOLVE
1384  * - \ref SCIP_STAGE_PRESOLVING
1385  * - \ref SCIP_STAGE_EXITPRESOLVE
1386  * - \ref SCIP_STAGE_PRESOLVED
1387  * - \ref SCIP_STAGE_INITSOLVE
1388  * - \ref SCIP_STAGE_SOLVING
1389  * - \ref SCIP_STAGE_SOLVED
1390  *
1391  * @pre This method can be called if targetscip is in one of the following stages:
1392  * - \ref SCIP_STAGE_INIT
1393  * - \ref SCIP_STAGE_FREE
1394  *
1395  * @post After calling this method targetscip reaches one of the following stages depending on if and when the solution
1396  * process was interrupted:
1397  * - \ref SCIP_STAGE_PROBLEM
1398  *
1399  * @note sourcescip stage does not get changed
1400  *
1401  * See \ref SCIP_Stage "SCIP_STAGE" for a complete list of all possible solving stages.
1402  */
1404  SCIP* sourcescip, /**< source SCIP data structure */
1405  SCIP* targetscip, /**< target SCIP data structure */
1406  SCIP_Bool copyreaders, /**< should the file readers be copied */
1407  SCIP_Bool copypricers, /**< should the variable pricers be copied */
1408  SCIP_Bool copyconshdlrs, /**< should the constraint handlers be copied */
1409  SCIP_Bool copyconflicthdlrs, /**< should the conflict handlers be copied */
1410  SCIP_Bool copypresolvers, /**< should the presolvers be copied */
1411  SCIP_Bool copyrelaxators, /**< should the relaxation handlers be copied */
1412  SCIP_Bool copyseparators, /**< should the separators be copied */
1413  SCIP_Bool copypropagators, /**< should the propagators be copied */
1414  SCIP_Bool copyheuristics, /**< should the heuristics be copied */
1415  SCIP_Bool copyeventhdlrs, /**< should the event handlers be copied */
1416  SCIP_Bool copynodeselectors, /**< should the node selectors be copied */
1417  SCIP_Bool copybranchrules, /**< should the branchrules be copied */
1418  SCIP_Bool copydisplays, /**< should the display columns be copied */
1419  SCIP_Bool copydialogs, /**< should the dialogs be copied */
1420  SCIP_Bool copynlpis, /**< should the NLPIs be copied */
1421  SCIP_Bool passmessagehdlr, /**< should the message handler be passed */
1422  SCIP_Bool* valid /**< pointer to store whether plugins, in particular all constraint
1423  * handlers which do not need constraints were validly copied */
1424  )
1425 {
1426  assert(sourcescip != NULL);
1427  assert(targetscip != NULL);
1428  assert(sourcescip->set != NULL);
1429  assert(targetscip->set != NULL);
1430 
1431  /* check stages for both, the source and the target SCIP data structure */
1432  SCIP_CALL( checkStage(sourcescip, "SCIPcopyPlugins", FALSE, TRUE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE) );
1433  SCIP_CALL( checkStage(targetscip, "SCIPcopyPlugins", TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE) );
1434 
1435  /* passes the message handler of the source SCIP to the target SCIP, also if NULL */
1436  if( passmessagehdlr )
1437  {
1438  SCIP_CALL( SCIPsetMessagehdlr(targetscip, SCIPgetMessagehdlr(sourcescip)) );
1439  }
1440 
1441  SCIP_CALL( SCIPsetCopyPlugins(sourcescip->set, targetscip->set,
1442  copyreaders, copypricers, copyconshdlrs, copyconflicthdlrs, copypresolvers, copyrelaxators, copyseparators, copypropagators,
1443  copyheuristics, copyeventhdlrs, copynodeselectors, copybranchrules, copydisplays, copydialogs, copynlpis, valid) );
1444 
1445  return SCIP_OKAY;
1446 }
1447 
1448 /** create a problem by copying the problem data of the source SCIP */
1449 static
1451  SCIP* sourcescip, /**< source SCIP data structure */
1452  SCIP* targetscip, /**< target SCIP data structure */
1453  SCIP_HASHMAP* varmap, /**< a hashmap to store the mapping of source variables corresponding
1454  * target variables, or NULL */
1455  SCIP_HASHMAP* consmap, /**< a hashmap to store the mapping of source constraints to the corresponding
1456  * target constraints, or NULL */
1457  SCIP_Bool original, /**< should the original problem be copied? */
1458  SCIP_Bool global, /**< create a global or a local copy? (set to TRUE for original copy) */
1459  const char* name /**< problem name of target */
1460  )
1461 {
1462  SCIP_PROB* sourceprob;
1463  SCIP_HASHMAP* localvarmap;
1464  SCIP_HASHMAP* localconsmap;
1465  SCIP_Bool uselocalvarmap;
1466  SCIP_Bool uselocalconsmap;
1467 
1468  assert(sourcescip != NULL);
1469  assert(targetscip != NULL);
1470  assert(!original || global);
1471 
1472  /* free old problem */
1473  SCIP_CALL( SCIPfreeProb(targetscip) );
1474  assert(targetscip->set->stage == SCIP_STAGE_INIT);
1475 
1476  uselocalvarmap = (varmap == NULL);
1477  uselocalconsmap = (consmap == NULL);
1478 
1479  if( uselocalvarmap )
1480  {
1481  /* create the variable mapping hash map */
1482  SCIP_CALL( SCIPhashmapCreate(&localvarmap, SCIPblkmem(targetscip), SCIPcalcHashtableSize(HASHTABLESIZE_FACTOR * SCIPgetNVars(sourcescip))) );
1483  }
1484  else
1485  localvarmap = varmap;
1486 
1487  if( uselocalconsmap )
1488  {
1489  /* create the constraint mapping hash map */
1490  SCIP_CALL( SCIPhashmapCreate(&localconsmap, SCIPblkmem(targetscip), SCIPcalcHashtableSize(HASHTABLESIZE_FACTOR * SCIPgetNConss(sourcescip))) );
1491  }
1492  else
1493  localconsmap = consmap;
1494 
1495  /* switch stage to PROBLEM */
1496  targetscip->set->stage = SCIP_STAGE_PROBLEM;
1497 
1498  if( !original && SCIPisTransformed(sourcescip) )
1499  sourceprob = sourcescip->transprob;
1500  else
1501  sourceprob = sourcescip->origprob;
1502 
1503  /* create the statistics data structure */
1504  SCIP_CALL( SCIPstatCreate(&targetscip->stat, targetscip->mem->probmem, targetscip->set, targetscip->messagehdlr) );
1505  targetscip->stat->subscipdepth = sourcescip->stat->subscipdepth + 1;
1506 
1507  /* create the problem by copying the source problem */
1508  SCIP_CALL( SCIPprobCopy(&targetscip->origprob, targetscip->mem->probmem, targetscip->set, name, sourcescip, sourceprob, localvarmap, localconsmap, global) );
1509 
1510  /* creating the solution candidates storage */
1511  /**@todo copy solution of source SCIP as candidates for the target SCIP */
1512  SCIP_CALL( SCIPprimalCreate(&targetscip->origprimal) );
1513 
1514  if( uselocalvarmap )
1515  {
1516  /* free hash map */
1517  SCIPhashmapFree(&localvarmap);
1518  }
1519 
1520  if( uselocalconsmap )
1521  {
1522  /* free hash map */
1523  SCIPhashmapFree(&localconsmap);
1524  }
1525 
1526  return SCIP_OKAY;
1527 }
1528 
1529 
1530 /** create a problem by copying the problem data of the source SCIP
1531  *
1532  * @note In a multi thread case, you need to lock the copying procedure from outside with a mutex.
1533  * @note Do not change the source SCIP environment during the copying process
1534  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
1535  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
1536  *
1537  * @pre This method can be called if sourcescip is in one of the following stages:
1538  * - \ref SCIP_STAGE_PROBLEM
1539  * - \ref SCIP_STAGE_TRANSFORMED
1540  * - \ref SCIP_STAGE_INITPRESOLVE
1541  * - \ref SCIP_STAGE_PRESOLVING
1542  * - \ref SCIP_STAGE_EXITPRESOLVE
1543  * - \ref SCIP_STAGE_PRESOLVED
1544  * - \ref SCIP_STAGE_INITSOLVE
1545  * - \ref SCIP_STAGE_SOLVING
1546  * - \ref SCIP_STAGE_SOLVED
1547  *
1548  * @pre This method can be called if targetscip is in one of the following stages:
1549  * - \ref SCIP_STAGE_INIT
1550  * - \ref SCIP_STAGE_FREE
1551  *
1552  * @post After calling this method targetscip reaches one of the following stages depending on if and when the solution
1553  * process was interrupted:
1554  * - \ref SCIP_STAGE_PROBLEM
1555  *
1556  * @note sourcescip stage does not get changed
1557  *
1558  * See \ref SCIP_Stage "SCIP_STAGE" for a complete list of all possible solving stages.
1559  */
1561  SCIP* sourcescip, /**< source SCIP data structure */
1562  SCIP* targetscip, /**< target SCIP data structure */
1563  SCIP_HASHMAP* varmap, /**< a hashmap to store the mapping of source variables corresponding
1564  * target variables, or NULL */
1565  SCIP_HASHMAP* consmap, /**< a hashmap to store the mapping of source constraints to the corresponding
1566  * target constraints, or NULL */
1567  SCIP_Bool global, /**< create a global or a local copy? */
1568  const char* name /**< problem name of target */
1569  )
1570 {
1571  assert(sourcescip != NULL);
1572  assert(targetscip != NULL);
1573 
1574  /* check stages for both, the source and the target SCIP data structure */
1575  SCIP_CALL( checkStage(sourcescip, "SCIPcopyProb", FALSE, TRUE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE) );
1576  SCIP_CALL( checkStage(targetscip, "SCIPcopyProb", TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE) );
1577 
1578  SCIP_CALL( copyProb(sourcescip, targetscip, varmap, consmap, FALSE, global, name) );
1579 
1580  return SCIP_OKAY;
1581 }
1582 
1583 /** create a problem by copying the original problem data of the source SCIP
1584  *
1585  * @note In a multi thread case, you need to lock the copying procedure from outside with a mutex.
1586  * @note Do not change the source SCIP environment during the copying process
1587  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
1588  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
1589  *
1590  * @pre This method can be called if sourcescip is in one of the following stages:
1591  * - \ref SCIP_STAGE_PROBLEM
1592  * - \ref SCIP_STAGE_TRANSFORMED
1593  * - \ref SCIP_STAGE_INITPRESOLVE
1594  * - \ref SCIP_STAGE_PRESOLVING
1595  * - \ref SCIP_STAGE_EXITPRESOLVE
1596  * - \ref SCIP_STAGE_PRESOLVED
1597  * - \ref SCIP_STAGE_INITSOLVE
1598  * - \ref SCIP_STAGE_SOLVING
1599  * - \ref SCIP_STAGE_SOLVED
1600  *
1601  * @pre This method can be called if targetscip is in one of the following stages:
1602  * - \ref SCIP_STAGE_INIT
1603  * - \ref SCIP_STAGE_FREE
1604  *
1605  * @post After calling this method targetscip reaches one of the following stages depending on if and when the solution
1606  * process was interrupted:
1607  * - \ref SCIP_STAGE_PROBLEM
1608  *
1609  * @note sourcescip stage does not get changed
1610  *
1611  * See \ref SCIP_Stage "SCIP_STAGE" for a complete list of all possible solving stages.
1612  */
1614  SCIP* sourcescip, /**< source SCIP data structure */
1615  SCIP* targetscip, /**< target SCIP data structure */
1616  SCIP_HASHMAP* varmap, /**< a hashmap to store the mapping of source variables corresponding
1617  * target variables, or NULL */
1618  SCIP_HASHMAP* consmap, /**< a hashmap to store the mapping of source constraints to the corresponding
1619  * target constraints, or NULL */
1620  const char* name /**< problem name of target */
1621  )
1622 {
1623  assert(sourcescip != NULL);
1624  assert(targetscip != NULL);
1625 
1626  /* check stages for both, the source and the target SCIP data structure */
1627  SCIP_CALL( checkStage(sourcescip, "SCIPcopyOrigProb", FALSE, TRUE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE) );
1628  SCIP_CALL( checkStage(targetscip, "SCIPcopyOrigProb", TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE) );
1629 
1630  SCIP_CALL( copyProb(sourcescip, targetscip, varmap, consmap, TRUE, TRUE, name) );
1631 
1632  return SCIP_OKAY;
1633 }
1634 
1635 /** returns copy of the source variable; if there already is a copy of the source variable in the variable hash map,
1636  * it is just returned as target variable; elsewise a new variable will be created and added to the target SCIP; this
1637  * created variable is added to the variable hash map and returned as target variable
1638  *
1639  * @note In a multi thread case, you need to lock the copying procedure from outside with a mutex.
1640  * @note Do not change the source SCIP environment during the copying process
1641  * @note if a new variable was created, this variable will be added to the target-SCIP, but it is not captured
1642  *
1643  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
1644  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
1645  *
1646  * @pre This method can be called if sourcescip is in one of the following stages:
1647  * - \ref SCIP_STAGE_PROBLEM
1648  * - \ref SCIP_STAGE_TRANSFORMED
1649  * - \ref SCIP_STAGE_INITPRESOLVE
1650  * - \ref SCIP_STAGE_PRESOLVING
1651  * - \ref SCIP_STAGE_EXITPRESOLVE
1652  * - \ref SCIP_STAGE_PRESOLVED
1653  * - \ref SCIP_STAGE_INITSOLVE
1654  * - \ref SCIP_STAGE_SOLVING
1655  * - \ref SCIP_STAGE_SOLVED
1656  *
1657  * @pre This method can be called if targetscip is in one of the following stages:
1658  * - \ref SCIP_STAGE_PROBLEM
1659  * - \ref SCIP_STAGE_TRANSFORMED
1660  * - \ref SCIP_STAGE_INITPRESOLVE
1661  * - \ref SCIP_STAGE_PRESOLVING
1662  * - \ref SCIP_STAGE_EXITPRESOLVE
1663  * - \ref SCIP_STAGE_SOLVING
1664  *
1665  * @note targetscip stage does not get changed
1666  *
1667  * @note sourcescip stage does not get changed
1668  *
1669  * See \ref SCIP_Stage "SCIP_STAGE" for a complete list of all possible solving stages.
1670  */
1672  SCIP* sourcescip, /**< source SCIP data structure */
1673  SCIP* targetscip, /**< target SCIP data structure */
1674  SCIP_VAR* sourcevar, /**< source variable */
1675  SCIP_VAR** targetvar, /**< pointer to store the target variable */
1676  SCIP_HASHMAP* varmap, /**< a hashmap to store the mapping of source variables to the corresponding
1677  * target variables, or NULL */
1678  SCIP_HASHMAP* consmap, /**< a hashmap to store the mapping of source constraints to the corresponding
1679  * target constraints, or NULL */
1680  SCIP_Bool global, /**< should global or local bounds be used? */
1681  SCIP_Bool* success /**< pointer to store whether the copying was successful or not */
1682  )
1683 {
1684  SCIP_HASHMAP* localvarmap;
1685  SCIP_HASHMAP* localconsmap;
1686  SCIP_VAR* var;
1687  SCIP_Bool uselocalvarmap;
1688  SCIP_Bool uselocalconsmap;
1689 
1690  assert(sourcescip != NULL);
1691  assert(targetscip != NULL);
1692  assert(sourcevar != NULL);
1693  assert(targetvar != NULL);
1694 
1695  /* check stages for both, the source and the target SCIP data structure */
1696  SCIP_CALL( checkStage(sourcescip, "SCIPgetVarCopy", FALSE, TRUE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE) );
1697  SCIP_CALL( checkStage(targetscip, "SCIPgetVarCopy", FALSE, TRUE, FALSE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) );
1698 
1699  uselocalvarmap = (varmap == NULL);
1700  uselocalconsmap = (consmap == NULL);
1701  *success = TRUE;
1702 
1703  /* try to retrieve copied variable from hashmap */
1704  if( !uselocalvarmap )
1705  {
1706  *targetvar = (SCIP_VAR*) SCIPhashmapGetImage(varmap, sourcevar);
1707  if( *targetvar != NULL )
1708  return SCIP_OKAY;
1709  }
1710 
1711  /* if the target SCIP is already in solving stage we currently are not copying the variable!
1712  * this has to be done because we cannot simply add variables to SCIP during solving and thereby enlarge the search
1713  * space.
1714  * unlike column generation we cannot assume here that the variable could be implicitly set to zero in all prior
1715  * computations
1716  */
1717  if( SCIPgetStage(targetscip) > SCIP_STAGE_PROBLEM )
1718  {
1719  *success = FALSE;
1720  *targetvar = NULL;
1721 
1722  return SCIP_OKAY;
1723  }
1724 
1725  /* create the variable mapping hash map */
1726  if( uselocalvarmap )
1727  {
1728  SCIP_CALL( SCIPhashmapCreate(&localvarmap, SCIPblkmem(targetscip), SCIPcalcHashtableSize(HASHTABLESIZE_FACTOR * SCIPgetNVars(sourcescip))) );
1729  }
1730  else
1731  localvarmap = varmap;
1732 
1733  if( uselocalconsmap )
1734  {
1735  /* create the constraint mapping hash map */
1736  SCIP_CALL( SCIPhashmapCreate(&localconsmap, SCIPblkmem(targetscip), SCIPcalcHashtableSize(HASHTABLESIZE_FACTOR * SCIPgetNConss(sourcescip))) );
1737  }
1738  else
1739  localconsmap = consmap;
1740 
1741  /* if variable does not exists yet in target SCIP, create it */
1742  switch( SCIPvarGetStatus(sourcevar) )
1743  {
1745  SCIP_CALL( SCIPvarCopy(&var, targetscip->mem->probmem, targetscip->set, targetscip->stat,
1746  sourcescip, sourcevar, localvarmap, localconsmap, global) );
1747  break;
1748  case SCIP_VARSTATUS_COLUMN:
1749  case SCIP_VARSTATUS_LOOSE:
1750  case SCIP_VARSTATUS_FIXED:
1751  SCIP_CALL( SCIPvarCopy(&var, targetscip->mem->probmem, targetscip->set, targetscip->stat,
1752  sourcescip, sourcevar, localvarmap, localconsmap, global) );
1753  break;
1754 
1756  {
1757  SCIP_CONS* cons;
1758  char name[SCIP_MAXSTRLEN];
1759 
1760  SCIP_VAR* sourceaggrvar;
1761  SCIP_VAR* targetaggrvar;
1762  SCIP_Real aggrcoef;
1763  SCIP_Real constant;
1764 
1765  /* get aggregation data */
1766  sourceaggrvar = SCIPvarGetAggrVar(sourcevar);
1767  aggrcoef = SCIPvarGetAggrScalar(sourcevar);
1768  constant = SCIPvarGetAggrConstant(sourcevar);
1769 
1770  /* get copy of the aggregation variable */
1771  SCIP_CALL( SCIPgetVarCopy(sourcescip, targetscip, sourceaggrvar, &targetaggrvar, localvarmap, localconsmap, global, success) );
1772  assert(*success);
1773 
1774  /* create copy of the aggregated variable */
1775  SCIP_CALL( SCIPvarCopy(&var, targetscip->mem->probmem, targetscip->set, targetscip->stat,
1776  sourcescip, sourcevar, localvarmap, localconsmap, global) );
1777 
1778  (void) SCIPsnprintf(name, SCIP_MAXSTRLEN, "%s_aggr", SCIPvarGetName(sourcevar));
1779 
1780  /* add aggregation x = a*y + c as linear constraint x - a*y = c */
1781  SCIP_CALL( SCIPcreateConsLinear(targetscip, &cons, name, 0, NULL, NULL, constant,
1782  constant, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE) );
1783  SCIP_CALL( SCIPaddCoefLinear(targetscip, cons, var, 1.0) );
1784  SCIP_CALL( SCIPaddCoefLinear(targetscip, cons, targetaggrvar, -aggrcoef) );
1785 
1786  SCIP_CALL( SCIPaddCons(targetscip, cons) );
1787  SCIP_CALL( SCIPreleaseCons(targetscip, &cons) );
1788 
1789  break;
1790  }
1792  {
1793  SCIP_CONS* cons;
1794  char name[SCIP_MAXSTRLEN];
1795 
1796  SCIP_VAR** sourceaggrvars;
1797  SCIP_VAR** targetaggrvars;
1798  SCIP_Real* aggrcoefs;
1799  SCIP_Real constant;
1800 
1801  int naggrvars;
1802  int i;
1803 
1804  /* get the active representation */
1805  SCIP_CALL( SCIPflattenVarAggregationGraph(sourcescip, sourcevar) );
1806 
1807  /* get multi-aggregation data */
1808  naggrvars = SCIPvarGetMultaggrNVars(sourcevar);
1809  sourceaggrvars = SCIPvarGetMultaggrVars(sourcevar);
1810  aggrcoefs = SCIPvarGetMultaggrScalars(sourcevar);
1811  constant = SCIPvarGetMultaggrConstant(sourcevar);
1812 
1813  SCIP_CALL( SCIPallocBufferArray(targetscip, &targetaggrvars, naggrvars) );
1814 
1815  /* get copies of the active variables of the multi-aggregation */
1816  for( i = 0; i < naggrvars; ++i )
1817  {
1818  SCIP_CALL( SCIPgetVarCopy(sourcescip, targetscip, sourceaggrvars[i], &targetaggrvars[i], localvarmap, localconsmap, global, success) );
1819  assert(*success);
1820  }
1821 
1822  /* create copy of the multi-aggregated variable */
1823  SCIP_CALL( SCIPvarCopy(&var, targetscip->mem->probmem, targetscip->set, targetscip->stat,
1824  sourcescip, sourcevar, localvarmap, localconsmap, global) );
1825 
1826  (void) SCIPsnprintf(name, SCIP_MAXSTRLEN, "%s_multaggr", SCIPvarGetName(sourcevar));
1827 
1828  /* add multi-aggregation x = a^T y + c as linear constraint a^T y - x = -c */
1829  SCIP_CALL( SCIPcreateConsLinear(targetscip, &cons, name, naggrvars, targetaggrvars, aggrcoefs, -constant,
1830  -constant, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE) );
1831  SCIP_CALL( SCIPaddCoefLinear(targetscip, cons, var, -1.0) );
1832  SCIP_CALL( SCIPaddCons(targetscip, cons) );
1833  SCIP_CALL( SCIPreleaseCons(targetscip, &cons) );
1834 
1835  SCIPfreeBufferArray(targetscip, &targetaggrvars);
1836 
1837  break;
1838  }
1840  {
1841  SCIP_VAR* sourcenegatedvar;
1842  SCIP_VAR* targetnegatedvar;
1843 
1844  /* get negated source variable */
1845  sourcenegatedvar = SCIPvarGetNegationVar(sourcevar);
1846  assert(sourcenegatedvar != NULL);
1847  assert(SCIPvarGetStatus(sourcenegatedvar) != SCIP_VARSTATUS_NEGATED);
1848 
1849  /* get copy of negated source variable */
1850  SCIP_CALL( SCIPgetVarCopy(sourcescip, targetscip, sourcenegatedvar, &targetnegatedvar, localvarmap, localconsmap, global, success) );
1851  assert(*success);
1852  assert(SCIPvarGetStatus(targetnegatedvar) != SCIP_VARSTATUS_NEGATED);
1853 
1854  /* get negation of copied negated source variable, this is the target variable */
1855  SCIP_CALL( SCIPgetNegatedVar(targetscip, targetnegatedvar, targetvar) );
1856  assert(SCIPvarGetStatus(*targetvar) == SCIP_VARSTATUS_NEGATED);
1857 
1858  /* free local hash maps if necessary */
1859  if( uselocalvarmap )
1860  SCIPhashmapFree(&localvarmap);
1861 
1862  if( uselocalconsmap )
1863  SCIPhashmapFree(&localconsmap);
1864 
1865  /* we have to return right away, to avoid adding the negated variable to the problem since the "not negated"
1866  * variable was already added */
1867  return SCIP_OKAY;
1868  }
1869  default:
1870  /* note that this is in an internal SCIP error since the variable status is only handled by the core */
1871  SCIPerrorMessage("unknown variable status\n");
1872  SCIPABORT();
1873  return SCIP_ERROR; /*lint !e527*/
1874  }
1875 
1876  /* add the (new) target variable to the target problem */
1877  SCIP_CALL( SCIPaddVar(targetscip, var) );
1878 
1879  *targetvar = var;
1880 
1881  /* remove the variable capture which was done due to the creation of the variable */
1882  SCIP_CALL( SCIPreleaseVar(targetscip, &var) );
1883 
1884  /* free local hash maps if necessary */
1885  if( uselocalvarmap )
1886  SCIPhashmapFree(&localvarmap);
1887 
1888  if( uselocalconsmap )
1889  SCIPhashmapFree(&localconsmap);
1890 
1891  return SCIP_OKAY;
1892 }
1893 
1894 /** copies all original or active variables from source-SCIP and adds these variable to the target-SCIP; the mapping
1895  * between these variables are stored in the variable hashmap, target-SCIP has to be in problem creation stage, fixed
1896  * and aggregated variables do not get copied
1897  */
1898 static
1900  SCIP* sourcescip, /**< source SCIP data structure */
1901  SCIP* targetscip, /**< target SCIP data structure */
1902  SCIP_HASHMAP* varmap, /**< a hashmap to store the mapping of source variables to the corresponding
1903  * target variables, or NULL */
1904  SCIP_HASHMAP* consmap, /**< a hashmap to store the mapping of source constraints to the corresponding
1905  * target constraints, or NULL */
1906  SCIP_Bool original, /**< should original variables be copied? */
1907  SCIP_Bool global /**< should global or local bounds be used? (for original=FALSE) */
1908  )
1909 {
1910  SCIP_VAR** sourcevars;
1911  SCIP_HASHMAP* localvarmap;
1912  SCIP_HASHMAP* localconsmap;
1913  SCIP_Bool uselocalvarmap;
1914  SCIP_Bool uselocalconsmap;
1915  int nsourcevars;
1916  int i;
1917 
1918  assert(sourcescip != NULL);
1919  assert(targetscip != NULL);
1920 
1921  if( original )
1922  {
1923  /* get original variables of the source SCIP */
1924  SCIP_CALL( SCIPgetOrigVarsData(sourcescip, &sourcevars, &nsourcevars, NULL, NULL, NULL, NULL) );
1925  }
1926  else
1927  {
1928  /* get active variables of the source SCIP */
1929  SCIP_CALL( SCIPgetVarsData(sourcescip, &sourcevars, &nsourcevars, NULL, NULL, NULL, NULL) );
1930  }
1931 
1932  uselocalvarmap = (varmap == NULL);
1933  uselocalconsmap = (consmap == NULL);
1934 
1935  if( uselocalvarmap )
1936  {
1937  /* create the variable mapping hash map */
1938  SCIP_CALL( SCIPhashmapCreate(&localvarmap, SCIPblkmem(targetscip), SCIPcalcHashtableSize(HASHTABLESIZE_FACTOR * SCIPgetNVars(sourcescip))) );
1939  }
1940  else
1941  localvarmap = varmap;
1942 
1943  if( uselocalconsmap )
1944  {
1945  /* create the constraint mapping hash map */
1946  SCIP_CALL( SCIPhashmapCreate(&localconsmap, SCIPblkmem(targetscip), SCIPcalcHashtableSize(HASHTABLESIZE_FACTOR * SCIPgetNConss(sourcescip))) );
1947  }
1948  else
1949  localconsmap = consmap;
1950 
1951  /* create the variables of the target SCIP */
1952  for( i = 0; i < nsourcevars; ++i )
1953  {
1954  SCIP_Bool success;
1955  SCIP_VAR* targetvar;
1956 
1957  /* copy variable and add this copy to the target SCIP if the copying was valid */
1958  SCIP_CALL( SCIPgetVarCopy(sourcescip, targetscip, sourcevars[i], &targetvar, localvarmap, localconsmap, global, &success) );
1959  assert(success);
1960  assert(targetvar != NULL);
1961  }
1962 
1963  /* integer variables that are fixed to zero or one or have bounds [0,1] will be converted to binaries */
1964 #ifndef NDEBUG
1965  if( original )
1966  {
1967  assert(SCIPgetNOrigBinVars(sourcescip) == SCIPgetNOrigBinVars(targetscip));
1968  assert(SCIPgetNOrigIntVars(sourcescip) == SCIPgetNOrigIntVars(targetscip));
1969  assert(SCIPgetNOrigImplVars(sourcescip) == SCIPgetNOrigImplVars(targetscip));
1970  assert(SCIPgetNOrigContVars(sourcescip) == SCIPgetNOrigContVars(targetscip));
1971  }
1972  else
1973  {
1974  SCIP_VAR** fixedvars;
1975  int nfixedvars;
1976  int nfixedbinvars;
1977  int nfixedintvars;
1978  int nfixedimplvars;
1979  int nfixedcontvars;
1980 
1981  fixedvars = SCIPgetFixedVars(sourcescip);
1982  nfixedvars = SCIPgetNFixedVars(sourcescip);
1983  nfixedbinvars = 0;
1984  nfixedintvars = 0;
1985  nfixedimplvars = 0;
1986  nfixedcontvars = 0;
1987 
1988  /* count number of fixed variables for all variable types */
1989  for( i = 0; i < nfixedvars; ++i )
1990  {
1991  switch( SCIPvarGetType(fixedvars[i]) )
1992  {
1993  case SCIP_VARTYPE_BINARY:
1994  nfixedbinvars++;
1995  break;
1996  case SCIP_VARTYPE_INTEGER:
1997  nfixedintvars++;
1998  break;
1999  case SCIP_VARTYPE_IMPLINT:
2000  nfixedimplvars++;
2001  break;
2003  nfixedcontvars++;
2004  break;
2005  default:
2006  SCIPerrorMessage("unknown variable type\n");
2007  return SCIP_INVALIDDATA;
2008  }
2009  }
2010  assert(nfixedvars == nfixedbinvars + nfixedintvars + nfixedimplvars + nfixedcontvars);
2011  assert(SCIPgetNBinVars(sourcescip) <= SCIPgetNBinVars(targetscip));
2012  assert(SCIPgetNIntVars(sourcescip) + SCIPgetNBinVars(sourcescip) <= SCIPgetNIntVars(targetscip) + SCIPgetNBinVars(targetscip)
2013  && SCIPgetNIntVars(targetscip) + SCIPgetNBinVars(targetscip) <= SCIPgetNIntVars(sourcescip) + SCIPgetNBinVars(sourcescip) + nfixedbinvars + nfixedintvars );
2014  assert(SCIPgetNImplVars(sourcescip) <= SCIPgetNImplVars(targetscip)
2015  && SCIPgetNImplVars(targetscip) <= SCIPgetNImplVars(sourcescip) + nfixedimplvars);
2016  assert(SCIPgetNContVars(sourcescip) <= SCIPgetNContVars(targetscip)
2017  && SCIPgetNContVars(targetscip) <= SCIPgetNContVars(targetscip) + nfixedcontvars);
2018  }
2019 #endif
2020 
2021  if( uselocalvarmap )
2022  {
2023  /* free hash map */
2024  SCIPhashmapFree(&localvarmap);
2025  }
2026 
2027  if( uselocalconsmap )
2028  {
2029  /* free hash map */
2030  SCIPhashmapFree(&localconsmap);
2031  }
2032 
2033  return SCIP_OKAY;
2034 }
2035 
2036 /** copies all active variables from source-SCIP and adds these variable to the target-SCIP; the mapping between these
2037  * variables are stored in the variable hashmap, target-SCIP has to be in problem creation stage, fixed and aggregated
2038  * variables do not get copied
2039  *
2040  * @note the variables are added to the target-SCIP but not captured
2041  *
2042  * @note In a multi thread case, you need to lock the copying procedure from outside with a mutex.
2043  * @note Do not change the source SCIP environment during the copying process
2044  *
2045  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
2046  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
2047  *
2048  * @pre This method can be called if sourcescip is in one of the following stages:
2049  * - \ref SCIP_STAGE_PROBLEM
2050  * - \ref SCIP_STAGE_TRANSFORMED
2051  * - \ref SCIP_STAGE_INITPRESOLVE
2052  * - \ref SCIP_STAGE_PRESOLVING
2053  * - \ref SCIP_STAGE_EXITPRESOLVE
2054  * - \ref SCIP_STAGE_PRESOLVED
2055  * - \ref SCIP_STAGE_INITSOLVE
2056  * - \ref SCIP_STAGE_SOLVING
2057  * - \ref SCIP_STAGE_SOLVED
2058  *
2059  * @pre This method can be called if targetscip is in one of the following stages:
2060  * - \ref SCIP_STAGE_PROBLEM
2061  *
2062  * @note sourcescip stage does not get changed
2063  *
2064  * @note targetscip stage does not get changed
2065  *
2066  * See \ref SCIP_Stage "SCIP_STAGE" for a complete list of all possible solving stages.
2067  */
2069  SCIP* sourcescip, /**< source SCIP data structure */
2070  SCIP* targetscip, /**< target SCIP data structure */
2071  SCIP_HASHMAP* varmap, /**< a hashmap to store the mapping of source variables to the corresponding
2072  * target variables, or NULL */
2073  SCIP_HASHMAP* consmap, /**< a hashmap to store the mapping of source constraints to the corresponding
2074  * target constraints, or NULL */
2075  SCIP_Bool global /**< should global or local bounds be used? */
2076  )
2077 {
2078  assert(sourcescip != NULL);
2079  assert(targetscip != NULL);
2080 
2081  /* check stages for both, the source and the target SCIP data structure */
2082  SCIP_CALL( checkStage(sourcescip, "SCIPcopyVars", FALSE, TRUE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE) );
2083  SCIP_CALL( checkStage(targetscip, "SCIPcopyVars", FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE) );
2084 
2085  SCIP_CALL( copyVars(sourcescip, targetscip, varmap, consmap, FALSE, global) );
2086 
2087  return SCIP_OKAY;
2088 }
2089 
2090 /** copies all original variables from source-SCIP and adds these variable to the target-SCIP; the mapping between these
2091  * variables are stored in the variable hashmap, target-SCIP has to be in problem creation stage, fixed and aggregated
2092  * variables do not get copied
2093  *
2094  * @note the variables are added to the target-SCIP but not captured
2095  *
2096  * @note In a multi thread case, you need to lock the copying procedure from outside with a mutex.
2097  * @note Do not change the source SCIP environment during the copying process
2098  *
2099  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
2100  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
2101  *
2102  * @pre This method can be called if sourcescip is in one of the following stages:
2103  * - \ref SCIP_STAGE_PROBLEM
2104  * - \ref SCIP_STAGE_TRANSFORMED
2105  * - \ref SCIP_STAGE_INITPRESOLVE
2106  * - \ref SCIP_STAGE_PRESOLVING
2107  * - \ref SCIP_STAGE_EXITPRESOLVE
2108  * - \ref SCIP_STAGE_PRESOLVED
2109  * - \ref SCIP_STAGE_INITSOLVE
2110  * - \ref SCIP_STAGE_SOLVING
2111  * - \ref SCIP_STAGE_SOLVED
2112  *
2113  * @pre This method can be called if targetscip is in one of the following stages:
2114  * - \ref SCIP_STAGE_PROBLEM
2115  *
2116  * @note sourcescip stage does not get changed
2117  *
2118  * @note targetscip stage does not get changed
2119  *
2120  * See \ref SCIP_Stage "SCIP_STAGE" for a complete list of all possible solving stages.
2121  */
2123  SCIP* sourcescip, /**< source SCIP data structure */
2124  SCIP* targetscip, /**< target SCIP data structure */
2125  SCIP_HASHMAP* varmap, /**< a hashmap to store the mapping of source variables to the corresponding
2126  * target variables, or NULL */
2127  SCIP_HASHMAP* consmap /**< a hashmap to store the mapping of source constraints to the corresponding
2128  * target constraints, or NULL */
2129  )
2130 {
2131  assert(sourcescip != NULL);
2132  assert(targetscip != NULL);
2133 
2134  /* check stages for both, the source and the target SCIP data structure */
2135  SCIP_CALL( checkStage(sourcescip, "SCIPcopyOrigVars", FALSE, TRUE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE) );
2136  SCIP_CALL( checkStage(targetscip, "SCIPcopyOrigVars", FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE) );
2137 
2138  SCIP_CALL( copyVars(sourcescip, targetscip, varmap, consmap, TRUE, TRUE) );
2139 
2140  return SCIP_OKAY;
2141 }
2142 
2143 /** returns copy of the source constraint; if there already is a copy of the source constraint in the constraint hash
2144  * map, it is just returned as target constraint; elsewise a new constraint will be created; this created constraint is
2145  * added to the constraint hash map and returned as target constraint; the variable map is used to map the variables of
2146  * the source SCIP to the variables of the target SCIP
2147  *
2148  * @warning If a constraint is marked to be checked for feasibility but not to be enforced, a LP or pseudo solution may
2149  * be declared feasible even if it violates this particular constraint. This constellation should only be
2150  * used, if no LP or pseudo solution can violate the constraint -- e.g. if a local constraint is redundant due
2151  * to the variable's local bounds.
2152  *
2153  * @note The constraint is not added to the target SCIP. You can check whether a constraint is added by calling
2154  * SCIPconsIsAdded(). (If you mix SCIPgetConsCopy() with SCIPcopyConss() you should pay attention to what you add
2155  * explicitly and what is already added.)
2156  *
2157  * @note The constraint is always captured, either during the creation of the copy or after finding the copy of the
2158  * constraint in the constraint hash map
2159  *
2160  * @note In a multi thread case, you need to lock the copying procedure from outside with a mutex.
2161  * @note Do not change the source SCIP environment during the copying process
2162  *
2163  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
2164  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
2165  *
2166  * @pre This method can be called if sourcescip is in one of the following stages:
2167  * - \ref SCIP_STAGE_PROBLEM
2168  * - \ref SCIP_STAGE_TRANSFORMED
2169  * - \ref SCIP_STAGE_INITPRESOLVE
2170  * - \ref SCIP_STAGE_PRESOLVING
2171  * - \ref SCIP_STAGE_EXITPRESOLVE
2172  * - \ref SCIP_STAGE_PRESOLVED
2173  * - \ref SCIP_STAGE_INITSOLVE
2174  * - \ref SCIP_STAGE_SOLVING
2175  * - \ref SCIP_STAGE_SOLVED
2176  *
2177  * @pre This method can be called if targetscip is in one of the following stages:
2178  * - \ref SCIP_STAGE_PROBLEM
2179  * - \ref SCIP_STAGE_TRANSFORMING
2180  * - \ref SCIP_STAGE_INITPRESOLVE
2181  * - \ref SCIP_STAGE_PRESOLVING
2182  * - \ref SCIP_STAGE_EXITPRESOLVE
2183  * - \ref SCIP_STAGE_PRESOLVED
2184  * - \ref SCIP_STAGE_SOLVING
2185  * - \ref SCIP_STAGE_EXITSOLVE
2186  *
2187  * @note sourcescip stage does not get changed
2188  *
2189  * @note targetscip stage does not get changed
2190  *
2191  * See \ref SCIP_Stage "SCIP_STAGE" for a complete list of all possible solving stages.
2192  */
2194  SCIP* sourcescip, /**< source SCIP data structure */
2195  SCIP* targetscip, /**< target SCIP data structure */
2196  SCIP_CONS* sourcecons, /**< source constraint of the source SCIP */
2197  SCIP_CONS** targetcons, /**< pointer to store the created target constraint */
2198  SCIP_CONSHDLR* sourceconshdlr, /**< source constraint handler for this constraint */
2199  SCIP_HASHMAP* varmap, /**< a SCIP_HASHMAP mapping variables of the source SCIP to the corresponding
2200  * variables of the target SCIP, or NULL */
2201  SCIP_HASHMAP* consmap, /**< a hashmap to store the mapping of source constraints to the corresponding
2202  * target constraints, or NULL */
2203  const char* name, /**< name of constraint, or NULL if the name of the source constraint should be used */
2204  SCIP_Bool initial, /**< should the LP relaxation of constraint be in the initial LP? */
2205  SCIP_Bool separate, /**< should the constraint be separated during LP processing? */
2206  SCIP_Bool enforce, /**< should the constraint be enforced during node processing? */
2207  SCIP_Bool check, /**< should the constraint be checked for feasibility? */
2208  SCIP_Bool propagate, /**< should the constraint be propagated during node processing? */
2209  SCIP_Bool local, /**< is constraint only valid locally? */
2210  SCIP_Bool modifiable, /**< is constraint modifiable (subject to column generation)? */
2211  SCIP_Bool dynamic, /**< is constraint subject to aging? */
2212  SCIP_Bool removable, /**< should the relaxation be removed from the LP due to aging or cleanup? */
2213  SCIP_Bool stickingatnode, /**< should the constraint always be kept at the node where it was added, even
2214  * if it may be moved to a more global node? */
2215  SCIP_Bool global, /**< create a global or a local copy? */
2216  SCIP_Bool* success /**< pointer to store whether the copying was successful or not */
2217  )
2218 {
2219  SCIP_HASHMAP* localvarmap;
2220  SCIP_HASHMAP* localconsmap;
2221  SCIP_Bool uselocalvarmap;
2222  SCIP_Bool uselocalconsmap;
2223 
2224  assert(targetcons != NULL);
2225  assert(sourceconshdlr != NULL);
2226 
2227  SCIP_CALL( checkStage(sourcescip, "SCIPgetConsCopy", FALSE, TRUE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE) );
2228  SCIP_CALL( checkStage(targetscip, "SCIPgetConsCopy", FALSE, TRUE, TRUE, FALSE, TRUE, TRUE, TRUE, TRUE, FALSE, TRUE, FALSE, TRUE, FALSE, FALSE) );
2229 
2230  uselocalvarmap = (varmap == NULL);
2231  uselocalconsmap = (consmap == NULL);
2232 
2233  /* a variables map and a constraint map is needed to avoid infinite recursion */
2234  if( uselocalvarmap )
2235  {
2236  /* create the variable mapping hash map */
2237  SCIP_CALL( SCIPhashmapCreate(&localvarmap, SCIPblkmem(targetscip), SCIPcalcHashtableSize(HASHTABLESIZE_FACTOR * SCIPgetNVars(sourcescip))) );
2238  }
2239  else
2240  localvarmap = varmap;
2241 
2242  if( uselocalconsmap )
2243  {
2244  /* create the constraint mapping hash map */
2245  SCIP_CALL( SCIPhashmapCreate(&localconsmap, SCIPblkmem(targetscip), SCIPcalcHashtableSize(HASHTABLESIZE_FACTOR * SCIPgetNConss(sourcescip))) );
2246  }
2247  else
2248  {
2249  localconsmap = consmap;
2250 
2251  /* try to retrieve copied constraint from hash map */
2252  *targetcons = (SCIP_CONS*) SCIPhashmapGetImage(localconsmap, sourcecons);
2253  if( *targetcons != NULL )
2254  {
2255  SCIP_CALL( SCIPcaptureCons(targetscip, *targetcons) );
2256  *success = TRUE;
2257  return SCIP_OKAY;
2258  }
2259  }
2260 
2261  /* copy the constraint */
2262  SCIP_CALL( SCIPconsCopy(targetcons, targetscip->set, name, sourcescip, sourceconshdlr, sourcecons, localvarmap, localconsmap,
2263  initial, separate, enforce, check, propagate, local, modifiable, dynamic, removable, stickingatnode, global, success) );
2264 
2265  if( uselocalvarmap )
2266  {
2267  /* free hash map */
2268  SCIPhashmapFree(&localvarmap);
2269  }
2270 
2271  if( uselocalconsmap )
2272  {
2273  /* free hash map */
2274  SCIPhashmapFree(&localconsmap);
2275  }
2276  else if( *success )
2277  {
2278  /* insert constraint into mapping between source SCIP and the target SCIP */
2279  SCIP_CALL( SCIPhashmapInsert(consmap, sourcecons, *targetcons) );
2280  }
2281 
2282  return SCIP_OKAY;
2283 }
2284 
2285 /** copies constraints from the source-SCIP and adds these to the target-SCIP; for mapping the
2286  * variables between the source and the target SCIP a hash map can be given; if the variable hash
2287  * map is NULL or necessary variable mapping is missing, the required variables are created in the
2288  * target-SCIP and added to the hash map, if not NULL; all variables which are created are added to
2289  * the target-SCIP but not (user) captured; if the constraint hash map is not NULL the mapping
2290  * between the constraints of the source and target-SCIP is stored
2291  *
2292  * @note the constraints are added to the target-SCIP but are not (user) captured in the target SCIP. (If you mix
2293  * SCIPgetConsCopy() with SCIPcopyConss() you should pay attention to what you add explicitly and what is already
2294  * added.) You can check whether a constraint is added by calling SCIPconsIsAdded().
2295  *
2296  * @note In a multi thread case, you need to lock the copying procedure from outside with a mutex.
2297  * @note Do not change the source SCIP environment during the copying process
2298  *
2299  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
2300  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
2301  *
2302  * @pre This method can be called if sourcescip is in one of the following stages:
2303  * - \ref SCIP_STAGE_PROBLEM
2304  * - \ref SCIP_STAGE_TRANSFORMED
2305  * - \ref SCIP_STAGE_INITPRESOLVE
2306  * - \ref SCIP_STAGE_PRESOLVING
2307  * - \ref SCIP_STAGE_EXITPRESOLVE
2308  * - \ref SCIP_STAGE_PRESOLVED
2309  * - \ref SCIP_STAGE_INITSOLVE
2310  * - \ref SCIP_STAGE_SOLVING
2311  * - \ref SCIP_STAGE_SOLVED
2312  *
2313  * @pre This method can be called if targetscip is in one of the following stages:
2314  * - \ref SCIP_STAGE_PROBLEM
2315  *
2316  * @note sourcescip stage does not get changed
2317  *
2318  * @note targetscip stage does not get changed
2319  *
2320  * See \ref SCIP_Stage "SCIP_STAGE" for a complete list of all possible solving stages.
2321  */
2323  SCIP* sourcescip, /**< source SCIP data structure */
2324  SCIP* targetscip, /**< target SCIP data structure */
2325  SCIP_HASHMAP* varmap, /**< a SCIP_HASHMAP mapping variables of the source SCIP to the corresponding
2326  * variables of the target SCIP, or NULL */
2327  SCIP_HASHMAP* consmap, /**< a hashmap to store the mapping of source constraints to the corresponding
2328  * target constraints, or NULL */
2329  SCIP_Bool global, /**< create a global or a local copy? */
2330  SCIP_Bool enablepricing, /**< should pricing be enabled in copied SCIP instance?
2331  * If TRUE, the modifiable flag of constraints will be copied. */
2332  SCIP_Bool* valid /**< pointer to store whether all constraints were validly copied */
2333  )
2334 {
2335  SCIP_CONSHDLR** sourceconshdlrs;
2336  SCIP_HASHMAP* localvarmap;
2337  SCIP_HASHMAP* localconsmap;
2338  SCIP_Bool uselocalvarmap;
2339  SCIP_Bool uselocalconsmap;
2340  int nsourceconshdlrs;
2341  int i;
2342 
2343  assert(sourcescip != NULL);
2344  assert(targetscip != NULL);
2345  assert(valid != NULL);
2346 
2347  /* check stages for both, the source and the target SCIP data structure */
2348  SCIP_CALL( checkStage(sourcescip, "SCIPcopyConss", FALSE, TRUE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE) );
2349  SCIP_CALL( checkStage(targetscip, "SCIPcopyConss", FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE) );
2350 
2351  /* check if we locally need to create a variable or constraint hash map */
2352  uselocalvarmap = (varmap == NULL);
2353  uselocalconsmap = (consmap == NULL);
2354 
2355  if( uselocalvarmap )
2356  {
2357  /* create the variable mapping hash map */
2358  SCIP_CALL( SCIPhashmapCreate(&localvarmap, SCIPblkmem(targetscip), SCIPcalcHashtableSize(HASHTABLESIZE_FACTOR * SCIPgetNVars(sourcescip))) );
2359  }
2360  else
2361  localvarmap = varmap;
2362 
2363  if( uselocalconsmap )
2364  {
2365  /* create the constraint mapping hash map */
2366  SCIP_CALL( SCIPhashmapCreate(&localconsmap, SCIPblkmem(targetscip), SCIPcalcHashtableSize(HASHTABLESIZE_FACTOR * SCIPgetNConss(sourcescip))) );
2367  }
2368  else
2369  localconsmap = consmap;
2370 
2371  nsourceconshdlrs = SCIPgetNConshdlrs(sourcescip);
2372  sourceconshdlrs = SCIPgetConshdlrs(sourcescip);
2373  assert(nsourceconshdlrs == 0 || sourceconshdlrs != NULL);
2374  assert(SCIPisTransformed(sourcescip));
2375 
2376  *valid = TRUE;
2377 
2378  /* copy constraints: loop through all (source) constraint handlers */
2379  for( i = 0; i < nsourceconshdlrs; ++i )
2380  {
2381  SCIP_CONS** sourceconss;
2382  SCIP_CONS* targetcons;
2383  SCIP_Bool success;
2384  int nsourceconss;
2385  int c;
2386 
2387  assert(sourceconshdlrs[i] != NULL);
2388 
2389  /* constraint handlers have to explicitly set the success pointer to TRUE */
2390  success = FALSE;
2391 
2392  /* Get all active constraints for copying; this array contains all active constraints;
2393  * constraints are active if they are globally valid and not deleted after presolving OR they
2394  * were locally added during the search and we are currently in a node which belongs to the
2395  * corresponding subtree.
2396  */
2397  nsourceconss = SCIPconshdlrGetNActiveConss(sourceconshdlrs[i]);
2398  sourceconss = SCIPconshdlrGetConss(sourceconshdlrs[i]);
2399 
2400 #if 0
2401  /* @todo using the following might reduce the number of copied constraints - check whether this is better */
2402  /* Get all checked constraints for copying; this included local constraints */
2403  if( !global )
2404  {
2405  nsourceconss = SCIPconshdlrGetNCheckConss(sourceconshdlrs[i]);
2406  sourceconss = SCIPconshdlrGetCheckConss(sourceconshdlrs[i]);
2407  }
2408 #endif
2409 
2410  assert(nsourceconss == 0 || sourceconss != NULL);
2411 
2412  if( nsourceconss > 0 )
2413  {
2414  SCIPdebugMessage("Attempting to copy %d %s constraints\n", nsourceconss, SCIPconshdlrGetName(sourceconshdlrs[i]));
2415  }
2416 
2417  /* copy all constraints of one constraint handler */
2418  for( c = 0; c < nsourceconss; ++c )
2419  {
2420  /* all constraints have to be active */
2421  assert(sourceconss[c] != NULL);
2422  assert(SCIPconsIsActive(sourceconss[c]));
2423  assert(!SCIPconsIsDeleted(sourceconss[c]));
2424 
2425  /* in case of copying the global problem we have to ignore the local constraints which are active */
2426  if( global && SCIPconsIsLocal(sourceconss[c]) )
2427  {
2428  SCIPdebugMessage("did not copy active local constraint <%s> when creating global copy\n", SCIPconsGetName(sourceconss[c]));
2429  continue;
2430  }
2431 
2432  /* use the copy constructor of the constraint handler and creates and captures the constraint if possible */
2433  targetcons = NULL;
2434  SCIP_CALL( SCIPgetConsCopy(sourcescip, targetscip, sourceconss[c], &targetcons, sourceconshdlrs[i], localvarmap, localconsmap, NULL,
2435  SCIPconsIsInitial(sourceconss[c]), SCIPconsIsSeparated(sourceconss[c]),
2436  SCIPconsIsEnforced(sourceconss[c]), SCIPconsIsChecked(sourceconss[c]),
2437  SCIPconsIsPropagated(sourceconss[c]), FALSE, SCIPconsIsModifiable(sourceconss[c]),
2438  SCIPconsIsDynamic(sourceconss[c]), SCIPconsIsRemovable(sourceconss[c]), FALSE, global, &success) );
2439 
2440  /* add the copied constraint to target SCIP if the copying process was valid */
2441  if( success )
2442  {
2443  assert(targetcons != NULL);
2444 
2445  if( !enablepricing )
2446  SCIPconsSetModifiable(targetcons, FALSE);
2447 
2448  /* add constraint to target SCIP */
2449  SCIP_CALL( SCIPaddCons(targetscip, targetcons) );
2450 
2451  /* release constraint once for the creation capture */
2452  SCIP_CALL( SCIPreleaseCons(targetscip, &targetcons) );
2453  }
2454  else
2455  {
2456  *valid = FALSE;
2457  SCIPdebugMessage("failed to copy constraint %s\n", SCIPconsGetName(sourceconss[c]));
2458  }
2459  }
2460  }
2461 
2462  if( uselocalvarmap )
2463  {
2464  /* free hash map */
2465  SCIPhashmapFree(&localvarmap);
2466  }
2467 
2468  if( uselocalconsmap )
2469  {
2470  /* free hash map */
2471  SCIPhashmapFree(&localconsmap);
2472  }
2473 
2474  return SCIP_OKAY;
2475 }
2476 
2477 /** copies all original constraints from the source-SCIP and adds these to the target-SCIP; for mapping the
2478  * variables between the source and the target SCIP a hash map can be given; if the variable hash
2479  * map is NULL or necessary variable mapping is missing, the required variables are created in the
2480  * target-SCIP and added to the hash map, if not NULL; all variables which are created are added to
2481  * the target-SCIP but not (user) captured; if the constraint hash map is not NULL the mapping
2482  * between the constraints of the source and target-SCIP is stored
2483  *
2484  * @note the constraints are added to the target-SCIP but are not (user) captured in the target SCIP. (If you mix
2485  * SCIPgetConsCopy() with SCIPcopyConss() you should pay attention to what you add explicitly and what is already
2486  * added.) You can check whether a constraint is added by calling SCIPconsIsAdded().
2487  *
2488  * @note In a multi thread case, you need to lock the copying procedure from outside with a mutex.
2489  * @note Do not change the source SCIP environment during the copying process
2490  *
2491  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
2492  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
2493  *
2494  * @pre This method can be called if sourcescip is in one of the following stages:
2495  * - \ref SCIP_STAGE_PROBLEM
2496  * - \ref SCIP_STAGE_TRANSFORMED
2497  * - \ref SCIP_STAGE_INITPRESOLVE
2498  * - \ref SCIP_STAGE_PRESOLVING
2499  * - \ref SCIP_STAGE_EXITPRESOLVE
2500  * - \ref SCIP_STAGE_PRESOLVED
2501  * - \ref SCIP_STAGE_INITSOLVE
2502  * - \ref SCIP_STAGE_SOLVING
2503  * - \ref SCIP_STAGE_SOLVED
2504  *
2505  * @pre This method can be called if targetscip is in one of the following stages:
2506  * - \ref SCIP_STAGE_PROBLEM
2507  *
2508  * @note sourcescip stage does not get changed
2509  *
2510  * @note targetscip stage does not get changed
2511  *
2512  * See \ref SCIP_Stage "SCIP_STAGE" for a complete list of all possible solving stages.
2513  */
2515  SCIP* sourcescip, /**< source SCIP data structure */
2516  SCIP* targetscip, /**< target SCIP data structure */
2517  SCIP_HASHMAP* varmap, /**< a SCIP_HASHMAP mapping variables of the source SCIP to the corresponding
2518  * variables of the target SCIP, or NULL */
2519  SCIP_HASHMAP* consmap, /**< a hashmap to store the mapping of source constraints to the corresponding
2520  * target constraints, or NULL */
2521  SCIP_Bool enablepricing, /**< should pricing be enabled in copied SCIP instance?
2522  * If TRUE, the modifiable flag of constraints will be copied. */
2523  SCIP_Bool* valid /**< pointer to store whether all constraints were validly copied */
2524  )
2525 {
2526  SCIP_CONS** sourceconss;
2527  SCIP_HASHMAP* localvarmap;
2528  SCIP_HASHMAP* localconsmap;
2529  SCIP_Bool uselocalvarmap;
2530  SCIP_Bool uselocalconsmap;
2531  int nsourceconss;
2532  int c;
2533 
2534  assert(sourcescip != NULL);
2535  assert(targetscip != NULL);
2536  assert(valid != NULL);
2537 
2538  /* check stages for both, the source and the target SCIP data structure */
2539  SCIP_CALL( checkStage(sourcescip, "SCIPcopyOrigConss", FALSE, TRUE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE) );
2540  SCIP_CALL( checkStage(targetscip, "SCIPcopyOrigConss", FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE) );
2541 
2542  /* check if we locally need to create a variable or constraint hash map */
2543  uselocalvarmap = (varmap == NULL);
2544  uselocalconsmap = (consmap == NULL);
2545 
2546  if( uselocalvarmap )
2547  {
2548  /* create the variable mapping hash map */
2549  SCIP_CALL( SCIPhashmapCreate(&localvarmap, SCIPblkmem(targetscip), SCIPcalcHashtableSize(HASHTABLESIZE_FACTOR * SCIPgetNVars(sourcescip))) );
2550  }
2551  else
2552  localvarmap = varmap;
2553 
2554  if( uselocalconsmap )
2555  {
2556  /* create the constraint mapping hash map */
2557  SCIP_CALL( SCIPhashmapCreate(&localconsmap, SCIPblkmem(targetscip), SCIPcalcHashtableSize(HASHTABLESIZE_FACTOR * SCIPgetNConss(sourcescip))) );
2558  }
2559  else
2560  localconsmap = consmap;
2561 
2562  sourceconss = SCIPgetOrigConss(sourcescip);
2563  nsourceconss = SCIPgetNOrigConss(sourcescip);
2564 
2565  *valid = TRUE;
2566 
2567  SCIPdebugMessage("Attempting to copy %d original constraints\n", nsourceconss);
2568 
2569  /* copy constraints: loop through all (source) constraint handlers */
2570  for( c = 0; c < nsourceconss; ++c )
2571  {
2572  SCIP_CONS* targetcons;
2573  SCIP_Bool success;
2574 
2575  /* constraint handlers have to explicitly set the success pointer to TRUE */
2576  success = FALSE;
2577 
2578  /* all constraints have to be active */
2579  assert(sourceconss[c] != NULL);
2580  assert(SCIPconsIsOriginal(sourceconss[c]));
2581 
2582  /* use the copy constructor of the constraint handler and creates and captures the constraint if possible */
2583  targetcons = NULL;
2584  SCIP_CALL( SCIPgetConsCopy(sourcescip, targetscip, sourceconss[c], &targetcons, SCIPconsGetHdlr(sourceconss[c]), localvarmap, localconsmap, NULL,
2585  SCIPconsIsInitial(sourceconss[c]), SCIPconsIsSeparated(sourceconss[c]),
2586  SCIPconsIsEnforced(sourceconss[c]), SCIPconsIsChecked(sourceconss[c]),
2587  SCIPconsIsPropagated(sourceconss[c]), FALSE, SCIPconsIsModifiable(sourceconss[c]),
2588  SCIPconsIsDynamic(sourceconss[c]), SCIPconsIsRemovable(sourceconss[c]), FALSE, TRUE, &success) );
2589 
2590  /* add the copied constraint to target SCIP if the copying process was valid */
2591  if( success )
2592  {
2593  assert(targetcons != NULL);
2594 
2595  if( !enablepricing )
2596  SCIPconsSetModifiable(targetcons, FALSE);
2597 
2598  /* add constraint to target SCIP */
2599  SCIP_CALL( SCIPaddCons(targetscip, targetcons) );
2600 
2601  /* release constraint once for the creation capture */
2602  SCIP_CALL( SCIPreleaseCons(targetscip, &targetcons) );
2603  }
2604  else
2605  {
2606  *valid = FALSE;
2607  SCIPdebugMessage("failed to copy constraint %s\n", SCIPconsGetName(sourceconss[c]));
2608  }
2609  }
2610 
2611  if( uselocalvarmap )
2612  {
2613  /* free hash map */
2614  SCIPhashmapFree(&localvarmap);
2615  }
2616 
2617  if( uselocalconsmap )
2618  {
2619  /* free hash map */
2620  SCIPhashmapFree(&localconsmap);
2621  }
2622 
2623  return SCIP_OKAY;
2624 }
2625 
2626 
2627 /** convert all active cuts from cutpool to linear constraints
2628  *
2629  * @note Do not change the source SCIP environment during the copying process
2630  *
2631  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
2632  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
2633  *
2634  * @pre This method can be called if SCIP is in one of the following stages:
2635  * - \ref SCIP_STAGE_PROBLEM
2636  * - \ref SCIP_STAGE_INITPRESOLVE
2637  * - \ref SCIP_STAGE_PRESOLVING
2638  * - \ref SCIP_STAGE_EXITPRESOLVE
2639  * - \ref SCIP_STAGE_PRESOLVED
2640  * - \ref SCIP_STAGE_SOLVING
2641  * - \ref SCIP_STAGE_EXITSOLVE
2642  *
2643  * @note SCIP stage does not get changed
2644  *
2645  * See \ref SCIP_Stage "SCIP_STAGE" for a complete list of all possible solving stages.
2646  */
2648  SCIP* scip, /**< SCIP data structure */
2649  SCIP_HASHMAP* varmap, /**< a hashmap to store the mapping of source variables corresponding
2650  * target variables, or NULL */
2651  SCIP_HASHMAP* consmap, /**< a hashmap to store the mapping of source constraints to the corresponding
2652  * target constraints, or NULL */
2653  SCIP_Bool global, /**< create a global or a local copy? */
2654  int* ncutsadded /**< pointer to store number of added cuts, or NULL */
2655  )
2656 {
2657  assert(scip != NULL);
2658  assert(scip->set != NULL);
2659 
2660  /* check stages for the SCIP data structure */
2661  SCIP_CALL( checkStage(scip, "SCIPconvertCutsToConss", FALSE, TRUE, FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, FALSE, TRUE, FALSE, TRUE, FALSE, FALSE) );
2662 
2663  /* if we do not have any cuts, nothing can be converted */
2664  if( scip->set->stage < SCIP_STAGE_SOLVING )
2665  return SCIP_OKAY;
2666 
2667  /* create out of all active cuts in cutpool linear constraints in targetscip */
2668  SCIP_CALL( SCIPcopyCuts(scip, scip, varmap, consmap, global, ncutsadded) );
2669 
2670  return SCIP_OKAY;
2671 }
2672 
2673 /** copies all active cuts from cutpool of sourcescip to linear constraints in targetscip
2674  *
2675  * @note In a multi thread case, you need to lock the copying procedure from outside with a mutex.
2676  * @note Do not change the source SCIP environment during the copying process
2677  *
2678  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
2679  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
2680  *
2681  * @pre This method can be called if sourcescip is in one of the following stages:
2682  * - \ref SCIP_STAGE_PROBLEM
2683  * - \ref SCIP_STAGE_TRANSFORMED
2684  * - \ref SCIP_STAGE_INITPRESOLVE
2685  * - \ref SCIP_STAGE_PRESOLVING
2686  * - \ref SCIP_STAGE_EXITPRESOLVE
2687  * - \ref SCIP_STAGE_PRESOLVED
2688  * - \ref SCIP_STAGE_SOLVING
2689  * - \ref SCIP_STAGE_SOLVED
2690  * - \ref SCIP_STAGE_EXITSOLVE
2691  *
2692  * @pre This method can be called if targetscip is in one of the following stages:
2693  * - \ref SCIP_STAGE_PROBLEM
2694  * - \ref SCIP_STAGE_INITPRESOLVE
2695  * - \ref SCIP_STAGE_PRESOLVING
2696  * - \ref SCIP_STAGE_EXITPRESOLVE
2697  * - \ref SCIP_STAGE_PRESOLVED
2698  * - \ref SCIP_STAGE_SOLVING
2699  * - \ref SCIP_STAGE_EXITSOLVE
2700  *
2701  * @note sourcescip stage does not get changed
2702  *
2703  * @note targetscip stage does not get changed
2704  *
2705  * See \ref SCIP_Stage "SCIP_STAGE" for a complete list of all possible solving stages.
2706  */
2708  SCIP* sourcescip, /**< source SCIP data structure */
2709  SCIP* targetscip, /**< target SCIP data structure */
2710  SCIP_HASHMAP* varmap, /**< a hashmap to store the mapping of source variables corresponding
2711  * target variables, or NULL */
2712  SCIP_HASHMAP* consmap, /**< a hashmap to store the mapping of source constraints to the corresponding
2713  * target constraints, or NULL */
2714  SCIP_Bool global, /**< create a global or a local copy? */
2715  int* ncutsadded /**< pointer to store number of copied cuts, or NULL */
2716  )
2717 {
2718  SCIP_CUT** cuts;
2719  int ncuts;
2720  int nlocalcutsadded;
2721 
2722  assert(sourcescip != NULL);
2723  assert(targetscip != NULL);
2724 
2725  /* check stages for both, the source and the target SCIP data structure */
2726  SCIP_CALL( checkStage(sourcescip, "SCIPcopyCuts", FALSE, TRUE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, TRUE, TRUE, TRUE, FALSE, FALSE) );
2727  SCIP_CALL( checkStage(targetscip, "SCIPcopyCuts", FALSE, TRUE, FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, FALSE, TRUE, FALSE, TRUE, FALSE, FALSE) );
2728 
2729  if ( ncutsadded != NULL )
2730  *ncutsadded = 0;
2731  nlocalcutsadded = 0;
2732 
2733  /* if we do not have any cuts, nothing can be converted */
2734  if( sourcescip->set->stage < SCIP_STAGE_SOLVING )
2735  return SCIP_OKAY;
2736 
2737  if( SCIPfindConshdlr(targetscip, "linear") == NULL )
2738  {
2739  SCIPdebugMessage("No linear constraint handler available. Cannot convert cuts.\n");
2740  return SCIP_OKAY;
2741  }
2742 
2743  /* convert cut from global cut pool */
2744  cuts = SCIPgetPoolCuts(sourcescip);
2745  ncuts = SCIPgetNPoolCuts(sourcescip);
2746 
2747  SCIP_CALL( copyCuts(sourcescip, targetscip, cuts, ncuts, varmap, consmap, global, &nlocalcutsadded) );
2748 
2749  if( ncutsadded != NULL )
2750  *ncutsadded = nlocalcutsadded;
2751 
2752  SCIPdebugMessage("Converted %d active cuts to constraints.\n", nlocalcutsadded);
2753 
2754  /* convert delayed cuts from global delayed cut pool */
2755  cuts = SCIPgetDelayedPoolCuts(sourcescip);
2756  ncuts = SCIPgetNDelayedPoolCuts(sourcescip);
2757 
2758  SCIP_CALL( copyCuts(sourcescip, targetscip, cuts, ncuts, varmap, consmap, global, &nlocalcutsadded) );
2759 
2760  if( ncutsadded != NULL )
2761  *ncutsadded += nlocalcutsadded;
2762 
2763  SCIPdebugMessage("Converted %d active cuts to constraints.\n", nlocalcutsadded);
2764 
2765  return SCIP_OKAY;
2766 }
2767 
2768 /** copies implications and cliques of sourcescip to targetscip
2769  *
2770  * This function should be called for a targetscip in transformed stage. It can save time in presolving of the
2771  * targetscip, since implications and cliques are copied.
2772  *
2773  * @note In a multi thread case, you need to lock the copying procedure from outside with a mutex.
2774  * @note Do not change the source SCIP environment during the copying process
2775  *
2776  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
2777  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
2778  *
2779  * @pre This method can be called if sourcescip is in one of the following stages:
2780  * - \ref SCIP_STAGE_TRANSFORMED
2781  * - \ref SCIP_STAGE_INITPRESOLVE
2782  * - \ref SCIP_STAGE_PRESOLVING
2783  * - \ref SCIP_STAGE_EXITPRESOLVE
2784  * - \ref SCIP_STAGE_PRESOLVED
2785  * - \ref SCIP_STAGE_SOLVING
2786  * - \ref SCIP_STAGE_SOLVED
2787  * - \ref SCIP_STAGE_EXITSOLVE
2788  *
2789  * @pre This method can be called if targetscip is in one of the following stages:
2790  * - \ref SCIP_STAGE_TRANSFORMED
2791  * - \ref SCIP_STAGE_INITPRESOLVE
2792  * - \ref SCIP_STAGE_PRESOLVING
2793  * - \ref SCIP_STAGE_EXITPRESOLVE
2794  * - \ref SCIP_STAGE_PRESOLVED
2795  * - \ref SCIP_STAGE_INITSOLVE
2796  * - \ref SCIP_STAGE_SOLVING
2797  *
2798  * @note sourcescip stage does not get changed
2799  *
2800  * @note targetscip stage does not get changed
2801  *
2802  * See \ref SCIP_Stage "SCIP_STAGE" for a complete list of all possible solving stages.
2803  */
2805  SCIP* sourcescip, /**< source SCIP data structure */
2806  SCIP* targetscip, /**< target SCIP data structure */
2807  SCIP_HASHMAP* varmap, /**< a hashmap to store the mapping of source variables corresponding
2808  * target variables, or NULL */
2809  SCIP_HASHMAP* consmap, /**< a hashmap to store the mapping of source constraints to the corresponding
2810  * target constraints, or NULL */
2811  SCIP_Bool global, /**< create a global or a local copy? */
2812  SCIP_Bool* infeasible, /**< pointer to store whether an infeasibility was detected */
2813  int* nbdchgs, /**< pointer to store the number of performed bound changes, or NULL */
2814  int* ncopied /**< pointer to store number of copied implications and cliques, or NULL */
2815  )
2816 {
2817  SCIP_CLIQUE** cliques;
2818  SCIP_VAR** sourcevars;
2819  SCIP_Bool success;
2820  int nvars;
2821  int nbinvars;
2822  int ncliques;
2823  int j;
2824  int c;
2825 
2826  assert( sourcescip != NULL );
2827  assert( targetscip != NULL );
2828  assert( sourcescip != targetscip );
2829  assert( infeasible != NULL );
2830 
2831  /* check stages for both, the source and the target SCIP data structure */
2832  SCIP_CALL( checkStage(sourcescip, "SCIPcopyImplicationsCliques", FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, TRUE, TRUE, TRUE, FALSE, FALSE) );
2833  SCIP_CALL( checkStage(targetscip, "SCIPcopyImplicationsCliques", FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE) );
2834 
2835  if ( ncopied != NULL )
2836  *ncopied = 0;
2837  if ( nbdchgs != NULL )
2838  *nbdchgs = 0;
2839 
2840  /* get all active variables */
2841  SCIP_CALL( SCIPgetVarsData(sourcescip, &sourcevars, &nvars, &nbinvars, NULL, NULL, NULL) );
2842 
2843  /* stop if no possible variables for cliques exist */
2844  if ( nbinvars == 0 )
2845  return SCIP_OKAY;
2846 
2847  /* get cliques */
2848  ncliques = SCIPgetNCliques(sourcescip);
2849  if ( ncliques > 0 )
2850  {
2851  SCIP_VAR** targetclique;
2852 
2853  /* get space for target cliques */
2854  SCIP_CALL( SCIPallocBufferArray(targetscip, &targetclique, nvars) );
2855  cliques = SCIPgetCliques(sourcescip);
2856 
2857  /* loop through all cliques */
2858  for (c = 0; c < ncliques; ++c)
2859  {
2860  SCIP_VAR** cliquevars;
2861  SCIP_Bool* cliquevals;
2862  int cliquesize;
2863  int nboundchg = 0;
2864 
2865  assert( cliques[c] != NULL );
2866  cliquevals = SCIPcliqueGetValues(cliques[c]);
2867  cliquevars = SCIPcliqueGetVars(cliques[c]);
2868  cliquesize = SCIPcliqueGetNVars(cliques[c]);
2869 
2870  /* get target variables of clique */
2871  for (j = 0; j < cliquesize; ++j)
2872  {
2873  SCIP_CALL( SCIPgetVarCopy(sourcescip, targetscip, cliquevars[j], &targetclique[j], varmap, consmap, global, &success) );
2874  if ( ! success )
2875  {
2876  SCIPdebugMessage("Getting copy for variable <%s> failed.\n", SCIPvarGetName(cliquevars[j]));
2877  SCIPfreeBufferArray(targetscip, &targetclique);
2878  return SCIP_OKAY;
2879  }
2880  }
2881 
2882  /* create clique */
2883  SCIP_CALL( SCIPaddClique(targetscip, targetclique, cliquevals, cliquesize, infeasible, &nboundchg) );
2884  if ( *infeasible )
2885  {
2886  SCIPfreeBufferArray(targetscip, &targetclique);
2887  return SCIP_OKAY;
2888  }
2889  if ( ncopied != NULL )
2890  ++(*ncopied);
2891  if ( nbdchgs != NULL )
2892  *nbdchgs += nboundchg;
2893  }
2894  SCIPfreeBufferArray(targetscip, &targetclique);
2895  }
2896 
2897  /* create binary implications */
2898  for (j = 0; j < nbinvars; ++j)
2899  {
2900  SCIP_VAR* sourcevar;
2901  SCIP_VAR* targetvar;
2902  SCIP_Bool d;
2903 
2904  sourcevar = sourcevars[j];
2905  SCIP_CALL( SCIPgetVarCopy(sourcescip, targetscip, sourcevar, &targetvar, varmap, consmap, global, &success) );
2906  if ( ! success )
2907  {
2908  SCIPdebugMessage("Getting copy for variable <%s> failed.\n", SCIPvarGetName(sourcevar));
2909  return SCIP_OKAY;
2910  }
2911 
2912  /* consider both possible implications */
2913  for (d = 0; d <= 1; ++d)
2914  {
2915  SCIP_BOUNDTYPE* impltypes;
2916  SCIP_VAR** implvars;
2917  SCIP_Real* implbounds;
2918  int nimpls;
2919  int l;
2920 
2921  nimpls = SCIPvarGetNImpls(sourcevar, d);
2922  if ( nimpls == 0 )
2923  continue;
2924 
2925  impltypes = SCIPvarGetImplTypes(sourcevar, d);
2926  implvars = SCIPvarGetImplVars(sourcevar, d);
2927  implbounds = SCIPvarGetImplBounds(sourcevar, d);
2928 
2929  /* create implications */
2930  for (l = 0; l < nimpls; ++l)
2931  {
2932  SCIP_VAR* implvar;
2933  int nboundchg = 0;
2934 
2935  SCIP_CALL( SCIPgetVarCopy(sourcescip, targetscip, implvars[l], &implvar, varmap, consmap, global, &success) );
2936  if ( ! success )
2937  {
2938  SCIPdebugMessage("Getting copy for variable <%s> failed.\n", SCIPvarGetName(implvars[l]));
2939  return SCIP_OKAY;
2940  }
2941 
2942  SCIP_CALL( SCIPaddVarImplication(targetscip, targetvar, d, implvar, impltypes[l], implbounds[l], infeasible, &nboundchg) );
2943  if ( *infeasible )
2944  return SCIP_OKAY;
2945  if ( ncopied != NULL )
2946  ++(*ncopied);
2947  if ( nbdchgs != NULL )
2948  *nbdchgs += nboundchg;
2949  }
2950  }
2951  }
2952 
2953  return SCIP_OKAY;
2954 }
2955 
2956 /** copies parameter settings from sourcescip to targetscip
2957  *
2958  * @note In a multi thread case, you need to lock the copying procedure from outside with a mutex.
2959  * @note Do not change the source SCIP environment during the copying process
2960  *
2961  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
2962  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
2963  *
2964  * @pre This method can be called if sourcescip is in one of the following stages:
2965  * - \ref SCIP_STAGE_PROBLEM
2966  * - \ref SCIP_STAGE_TRANSFORMED
2967  * - \ref SCIP_STAGE_INITPRESOLVE
2968  * - \ref SCIP_STAGE_PRESOLVING
2969  * - \ref SCIP_STAGE_EXITPRESOLVE
2970  * - \ref SCIP_STAGE_PRESOLVED
2971  * - \ref SCIP_STAGE_INITSOLVE
2972  * - \ref SCIP_STAGE_SOLVING
2973  * - \ref SCIP_STAGE_SOLVED
2974  *
2975  * @pre This method can be called if targetscip is in one of the following stages:
2976  * - \ref SCIP_STAGE_INIT
2977  * - \ref SCIP_STAGE_PROBLEM
2978  * - \ref SCIP_STAGE_FREE
2979  *
2980  * @note sourcescip stage does not get changed
2981  *
2982  * @note targetscip stage does not get changed
2983  *
2984  * See \ref SCIP_Stage "SCIP_STAGE" for a complete list of all possible solving stages.
2985  */
2987  SCIP* sourcescip, /**< source SCIP data structure */
2988  SCIP* targetscip /**< target SCIP data structure */
2989  )
2990 {
2991  assert(sourcescip != NULL);
2992  assert(targetscip != NULL);
2993  assert(sourcescip->set != NULL);
2994  assert(targetscip->set != NULL);
2995 
2996  /* check stages for both, the source and the target SCIP data structure */
2997  SCIP_CALL( checkStage(sourcescip, "SCIPcopyParamSettings", FALSE, TRUE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE) );
2998  SCIP_CALL( checkStage(targetscip, "SCIPcopyParamSettings", TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE) );
2999 
3000  SCIP_CALL( SCIPsetCopyParams(sourcescip->set, targetscip->set, targetscip->messagehdlr) );
3001 
3002  return SCIP_OKAY;
3003 }
3004 
3005 /** gets depth of current scip instance (increased by each copy call)
3006  *
3007  * @return Depth of subscip of SCIP is returned.
3008  *
3009  * @pre This method can be called if SCIP is in one of the following stages:
3010  * - \ref SCIP_STAGE_PROBLEM
3011  * - \ref SCIP_STAGE_TRANSFORMING
3012  * - \ref SCIP_STAGE_TRANSFORMED
3013  * - \ref SCIP_STAGE_INITPRESOLVE
3014  * - \ref SCIP_STAGE_PRESOLVING
3015  * - \ref SCIP_STAGE_EXITPRESOLVE
3016  * - \ref SCIP_STAGE_PRESOLVED
3017  * - \ref SCIP_STAGE_INITSOLVE
3018  * - \ref SCIP_STAGE_SOLVING
3019  * - \ref SCIP_STAGE_SOLVED
3020  * - \ref SCIP_STAGE_EXITSOLVE
3021  * - \ref SCIP_STAGE_FREETRANS
3022  *
3023  * @note SCIP stage does not get changed
3024  *
3025  * See \ref SCIP_Stage "SCIP_STAGE" for a complete list of all possible solving stages.
3026  */
3028  SCIP* scip /**< SCIP data structure */
3029  )
3030 {
3031  assert( scip != NULL );
3032  assert( scip->stat != NULL );
3033 
3034  SCIP_CALL_ABORT( checkStage(scip, "SCIPgetSubscipDepth", FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE) );
3035 
3036  return scip->stat->subscipdepth;
3037 }
3038 
3039 /** copies source SCIP to target SCIP; the copying process is done in the following order:
3040  * 1) copy the plugins
3041  * 2) copy the settings
3042  * 3) create problem data in target-SCIP and copy the problem data of the source-SCIP
3043  * 4) copy all active variables
3044  * 5) copy all constraints
3045  *
3046  * @note all variables and constraints which are created in the target-SCIP are not (user) captured
3047  *
3048  * @note In a multi thread case, you need to lock the copying procedure from outside with a mutex.
3049  * Also, 'passmessagehdlr' should be set to FALSE.
3050  * @note Do not change the source SCIP environment during the copying process
3051  *
3052  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
3053  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
3054  *
3055  * @pre This method can be called if sourcescip is in one of the following stages:
3056  * - \ref SCIP_STAGE_PROBLEM
3057  * - \ref SCIP_STAGE_TRANSFORMED
3058  * - \ref SCIP_STAGE_INITPRESOLVE
3059  * - \ref SCIP_STAGE_PRESOLVING
3060  * - \ref SCIP_STAGE_EXITPRESOLVE
3061  * - \ref SCIP_STAGE_PRESOLVED
3062  * - \ref SCIP_STAGE_INITSOLVE
3063  * - \ref SCIP_STAGE_SOLVING
3064  * - \ref SCIP_STAGE_SOLVED
3065  *
3066  * @pre This method can be called if targetscip is in one of the following stages:
3067  * - \ref SCIP_STAGE_INIT
3068  * - \ref SCIP_STAGE_FREE
3069  *
3070  * @note sourcescip stage does not get changed
3071  *
3072  * @note targetscip stage does not get changed
3073  *
3074  * See \ref SCIP_Stage "SCIP_STAGE" for a complete list of all possible solving stages.
3075  */
3077  SCIP* sourcescip, /**< source SCIP data structure */
3078  SCIP* targetscip, /**< target SCIP data structure */
3079  SCIP_HASHMAP* varmap, /**< a hashmap to store the mapping of source variables corresponding
3080  * target variables, or NULL */
3081  SCIP_HASHMAP* consmap, /**< a hashmap to store the mapping of source constraints to the corresponding
3082  * target constraints, or NULL */
3083  const char* suffix, /**< suffix which will be added to the names of the target SCIP, might be empty */
3084  SCIP_Bool global, /**< create a global or a local copy? */
3085  SCIP_Bool enablepricing, /**< should pricing be enabled in copied SCIP instance? If TRUE, pricer
3086  * plugins will be copied and activated, and the modifiable flag of
3087  * constraints will be respected. If FALSE, valid will be set to FALSE, when
3088  * there are pricers present */
3089  SCIP_Bool passmessagehdlr, /**< should the message handler be passed */
3090  SCIP_Bool* valid /**< pointer to store whether the copying was valid or not */
3091  )
3092 {
3093  SCIP_HASHMAP* localvarmap;
3094  SCIP_HASHMAP* localconsmap;
3095  SCIP_Real startcopytime;
3096  SCIP_Real copytime;
3097  SCIP_Bool uselocalvarmap;
3098  SCIP_Bool uselocalconsmap;
3099  SCIP_Bool consscopyvalid;
3100  char name[SCIP_MAXSTRLEN];
3101 
3102  assert(sourcescip != NULL);
3103  assert(targetscip != NULL);
3104  assert(suffix != NULL);
3105  assert(valid != NULL);
3106 
3107  /* check stages for both, the source and the target SCIP data structure */
3108  SCIP_CALL( checkStage(sourcescip, "SCIPcopy", FALSE, TRUE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE) );
3109  SCIP_CALL( checkStage(targetscip, "SCIPcopy", TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE) );
3110 
3111  /* get time before start of copy procedure */
3112  startcopytime = SCIPclockGetTime(sourcescip->stat->copyclock);
3113 
3114  /* start time measuring */
3115  SCIPclockStart(sourcescip->stat->copyclock, sourcescip->set);
3116 
3117  /* in case there are active pricers and pricing is disabled the target SCIP will not be a valid copy of the source
3118  * SCIP
3119  */
3120  (*valid) = enablepricing || (SCIPgetNActivePricers(sourcescip) == 0);
3121 
3122  /* copy all plugins */
3123  SCIP_CALL( SCIPcopyPlugins(sourcescip, targetscip, TRUE, enablepricing, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE,
3124  TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, passmessagehdlr, valid) );
3125 
3126  SCIPdebugMessage("Copying plugins was%s valid.\n", *valid ? "" : " not");
3127 
3128  uselocalvarmap = (varmap == NULL);
3129  uselocalconsmap = (consmap == NULL);
3130 
3131  if( uselocalvarmap )
3132  {
3133  /* create the variable mapping hash map */
3134  SCIP_CALL( SCIPhashmapCreate(&localvarmap, SCIPblkmem(targetscip), SCIPcalcHashtableSize(HASHTABLESIZE_FACTOR * SCIPgetNVars(sourcescip))) );
3135  }
3136  else
3137  localvarmap = varmap;
3138 
3139  if( uselocalconsmap )
3140  {
3141  /* create the constraint mapping hash map */
3142  SCIP_CALL( SCIPhashmapCreate(&localconsmap, SCIPblkmem(targetscip), SCIPcalcHashtableSize(HASHTABLESIZE_FACTOR * SCIPgetNConss(sourcescip))) );
3143  }
3144  else
3145  localconsmap = consmap;
3146 
3147  /* construct name for the target SCIP using the source problem name and the given suffix string */
3148  (void) SCIPsnprintf(name, SCIP_MAXSTRLEN, "%s_%s", SCIPgetProbName(sourcescip), suffix);
3149 
3150  /* copy all settings */
3151  SCIP_CALL( SCIPcopyParamSettings(sourcescip, targetscip) );
3152 
3153  /* create problem in the target SCIP and copying the source original problem data */
3154  SCIP_CALL( SCIPcopyProb(sourcescip, targetscip, localvarmap, localconsmap, global, name) );
3155 
3156  /* copy all original variables */
3157  SCIP_CALL( SCIPcopyVars(sourcescip, targetscip, localvarmap, localconsmap, global) );
3158 
3159  /* copy all original constraints */
3160  SCIP_CALL( SCIPcopyConss(sourcescip, targetscip, localvarmap, localconsmap, global, enablepricing, &consscopyvalid) );
3161  (*valid) = *valid && consscopyvalid;
3162 
3163  SCIPdebugMessage("Copying constraints was%s valid.\n", consscopyvalid ? "" : " not");
3164 
3165  if( uselocalvarmap )
3166  {
3167  /* free hash map */
3168  SCIPhashmapFree(&localvarmap);
3169  }
3170 
3171  if( uselocalconsmap )
3172  {
3173  /* free hash map */
3174  SCIPhashmapFree(&localconsmap);
3175  }
3176 
3177  /* stop time measuring */
3178  SCIPclockStop(sourcescip->stat->copyclock, sourcescip->set);
3179 
3180  /* get time after copying procedure */
3181  copytime = SCIPclockGetTime(sourcescip->stat->copyclock) - startcopytime;
3182 
3183  if( copytime > sourcescip->stat->maxcopytime )
3184  sourcescip->stat->maxcopytime = copytime;
3185  if( copytime < sourcescip->stat->mincopytime )
3186  sourcescip->stat->mincopytime = copytime;
3187 
3188  /* increase copy counter */
3189  ++(sourcescip->stat->ncopies);
3190 
3191  return SCIP_OKAY;
3192 }
3193 
3194 
3195 /** copies source SCIP original problem to target SCIP; the copying process is done in the following order:
3196  * 1) copy the plugins
3197  * 2) copy the settings
3198  * 3) create problem data in target-SCIP and copy the original problem data of the source-SCIP
3199  * 4) copy all original variables
3200  * 5) copy all original constraints
3201  *
3202  * @note all variables and constraints which are created in the target-SCIP are not (user) captured
3203  *
3204  * @note In a multi thread case, you need to lock the copying procedure from outside with a mutex.
3205  * Also, 'passmessagehdlr' should be set to FALSE.
3206  * @note Do not change the source SCIP environment during the copying process
3207  *
3208  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
3209  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
3210  *
3211  * @pre This method can be called if sourcescip is in one of the following stages:
3212  * - \ref SCIP_STAGE_PROBLEM
3213  * - \ref SCIP_STAGE_TRANSFORMED
3214  * - \ref SCIP_STAGE_INITPRESOLVE
3215  * - \ref SCIP_STAGE_PRESOLVING
3216  * - \ref SCIP_STAGE_EXITPRESOLVE
3217  * - \ref SCIP_STAGE_PRESOLVED
3218  * - \ref SCIP_STAGE_INITSOLVE
3219  * - \ref SCIP_STAGE_SOLVING
3220  * - \ref SCIP_STAGE_SOLVED
3221  *
3222  * @pre This method can be called if targetscip is in one of the following stages:
3223  * - \ref SCIP_STAGE_INIT
3224  * - \ref SCIP_STAGE_FREE
3225  *
3226  * @note sourcescip stage does not get changed
3227  *
3228  * @note targetscip stage does not get changed
3229  *
3230  * See \ref SCIP_Stage "SCIP_STAGE" for a complete list of all possible solving stages.
3231  */
3233  SCIP* sourcescip, /**< source SCIP data structure */
3234  SCIP* targetscip, /**< target SCIP data structure */
3235  SCIP_HASHMAP* varmap, /**< a hashmap to store the mapping of source variables corresponding
3236  * target variables, or NULL */
3237  SCIP_HASHMAP* consmap, /**< a hashmap to store the mapping of source constraints to the corresponding
3238  * target constraints, or NULL */
3239  const char* suffix, /**< suffix which will be added to the names of the target SCIP, might be empty */
3240  SCIP_Bool enablepricing, /**< should pricing be enabled in copied SCIP instance? If TRUE, pricer
3241  * plugins will be copied and activated, and the modifiable flag of
3242  * constraints will be respected. If FALSE, valid will be set to FALSE, when
3243  * there are pricers present */
3244  SCIP_Bool passmessagehdlr, /**< should the message handler be passed */
3245  SCIP_Bool* valid /**< pointer to store whether the copying was valid or not */
3246  )
3247 {
3248  SCIP_HASHMAP* localvarmap;
3249  SCIP_HASHMAP* localconsmap;
3250  SCIP_Real startcopytime;
3251  SCIP_Real copytime;
3252  SCIP_Bool uselocalvarmap;
3253  SCIP_Bool uselocalconsmap;
3254  SCIP_Bool consscopyvalid;
3255  char name[SCIP_MAXSTRLEN];
3256 
3257  assert(sourcescip != NULL);
3258  assert(targetscip != NULL);
3259  assert(suffix != NULL);
3260  assert(valid != NULL);
3261 
3262  /* check stages for both, the source and the target SCIP data structure */
3263  SCIP_CALL( checkStage(sourcescip, "SCIPcopyOrig", FALSE, TRUE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE) );
3264  SCIP_CALL( checkStage(targetscip, "SCIPcopyOrig", TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE) );
3265 
3266  /* get time before start of copy procedure */
3267  startcopytime = SCIPclockGetTime(sourcescip->stat->copyclock);
3268 
3269  /* start time measuring */
3270  SCIPclockStart(sourcescip->stat->copyclock, sourcescip->set);
3271 
3272  /* in case there are active pricers and pricing is disabled the target SCIP will not be a valid copy of the source
3273  * SCIP
3274  */
3275  (*valid) = enablepricing || (SCIPgetNActivePricers(sourcescip) == 0);
3276 
3277  /* copy all plugins */
3278  SCIP_CALL( SCIPcopyPlugins(sourcescip, targetscip, TRUE, enablepricing, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE,
3279  TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, passmessagehdlr, valid) );
3280 
3281  SCIPdebugMessage("Copying plugins was%s valid.\n", *valid ? "" : " not");
3282 
3283  uselocalvarmap = (varmap == NULL);
3284  uselocalconsmap = (consmap == NULL);
3285 
3286  if( uselocalvarmap )
3287  {
3288  /* create the variable mapping hash map */
3289  SCIP_CALL( SCIPhashmapCreate(&localvarmap, SCIPblkmem(targetscip), SCIPcalcHashtableSize(HASHTABLESIZE_FACTOR * SCIPgetNVars(sourcescip))) );
3290  }
3291  else
3292  localvarmap = varmap;
3293 
3294  if( uselocalconsmap )
3295  {
3296  /* create the constraint mapping hash map */
3297  SCIP_CALL( SCIPhashmapCreate(&localconsmap, SCIPblkmem(targetscip), SCIPcalcHashtableSize(HASHTABLESIZE_FACTOR * SCIPgetNConss(sourcescip))) );
3298  }
3299  else
3300  localconsmap = consmap;
3301 
3302  /* construct name for the target SCIP using the source problem name and the given suffix string */
3303  (void) SCIPsnprintf(name, SCIP_MAXSTRLEN, "%s_%s", SCIPgetProbName(sourcescip), suffix);
3304 
3305  /* copy all settings */
3306  SCIP_CALL( SCIPcopyParamSettings(sourcescip, targetscip) );
3307 
3308  /* create problem in the target SCIP and copying the source problem data */
3309  SCIP_CALL( SCIPcopyOrigProb(sourcescip, targetscip, localvarmap, localconsmap, name) );
3310 
3311  /* copy all active variables */
3312  SCIP_CALL( SCIPcopyOrigVars(sourcescip, targetscip, localvarmap, localconsmap) );
3313 
3314  /* copy all constraints */
3315  SCIP_CALL( SCIPcopyOrigConss(sourcescip, targetscip, localvarmap, localconsmap, enablepricing, &consscopyvalid) );
3316  (*valid) = *valid && consscopyvalid;
3317 
3318  SCIPdebugMessage("Copying constraints was%s valid.\n", consscopyvalid ? "" : " not");
3319 
3320  if( uselocalvarmap )
3321  {
3322  /* free hash map */
3323  SCIPhashmapFree(&localvarmap);
3324  }
3325 
3326  if( uselocalconsmap )
3327  {
3328  /* free hash map */
3329  SCIPhashmapFree(&localconsmap);
3330  }
3331 
3332  /* stop time measuring */
3333  SCIPclockStop(sourcescip->stat->copyclock, sourcescip->set);
3334 
3335  /* get time after copying procedure */
3336  copytime = SCIPclockGetTime(sourcescip->stat->copyclock) - startcopytime;
3337 
3338  if( copytime > sourcescip->stat->maxcopytime )
3339  sourcescip->stat->maxcopytime = copytime;
3340  if( copytime < sourcescip->stat->mincopytime )
3341  sourcescip->stat->mincopytime = copytime;
3342 
3343  /* increase copy counter */
3344  ++(sourcescip->stat->ncopies);
3345 
3346  return SCIP_OKAY;
3347 }
3348 
3349 
3350 
3351 /*
3352  * parameter settings
3353  */
3354 
3355 /** creates a SCIP_Bool parameter, sets it to its default value, and adds it to the parameter set
3356  *
3357  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
3358  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
3359  */
3361  SCIP* scip, /**< SCIP data structure */
3362  const char* name, /**< name of the parameter */
3363  const char* desc, /**< description of the parameter */
3364  SCIP_Bool* valueptr, /**< pointer to store the current parameter value, or NULL */
3365  SCIP_Bool isadvanced, /**< is this parameter an advanced parameter? */
3366  SCIP_Bool defaultvalue, /**< default value of the parameter */
3367  SCIP_DECL_PARAMCHGD ((*paramchgd)), /**< change information method of parameter */
3368  SCIP_PARAMDATA* paramdata /**< locally defined parameter specific data */
3369  )
3370 {
3371  assert(scip != NULL);
3372  assert(scip->set != NULL);
3373  assert(scip->mem != NULL);
3374 
3375  SCIP_CALL( SCIPsetAddBoolParam(scip->set, scip->messagehdlr, scip->mem->setmem, name, desc, valueptr, isadvanced,
3376  defaultvalue, paramchgd, paramdata) );
3377 
3378  return SCIP_OKAY;
3379 }
3380 
3381 /** creates a int parameter, sets it to its default value, and adds it to the parameter set
3382  *
3383  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
3384  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
3385  */
3387  SCIP* scip, /**< SCIP data structure */
3388  const char* name, /**< name of the parameter */
3389  const char* desc, /**< description of the parameter */
3390  int* valueptr, /**< pointer to store the current parameter value, or NULL */
3391  SCIP_Bool isadvanced, /**< is this parameter an advanced parameter? */
3392  int defaultvalue, /**< default value of the parameter */
3393  int minvalue, /**< minimum value for parameter */
3394  int maxvalue, /**< maximum value for parameter */
3395  SCIP_DECL_PARAMCHGD ((*paramchgd)), /**< change information method of parameter */
3396  SCIP_PARAMDATA* paramdata /**< locally defined parameter specific data */
3397  )
3398 {
3399  assert(scip != NULL);
3400  assert(scip->set != NULL);
3401  assert(scip->mem != NULL);
3402 
3403  SCIP_CALL( SCIPsetAddIntParam(scip->set, scip->messagehdlr, scip->mem->setmem, name, desc, valueptr, isadvanced,
3404  defaultvalue, minvalue, maxvalue, paramchgd, paramdata) );
3405 
3406  return SCIP_OKAY;
3407 }
3408 
3409 /** creates a SCIP_Longint parameter, sets it to its default value, and adds it to the parameter set
3410  *
3411  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
3412  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
3413  */
3415  SCIP* scip, /**< SCIP data structure */
3416  const char* name, /**< name of the parameter */
3417  const char* desc, /**< description of the parameter */
3418  SCIP_Longint* valueptr, /**< pointer to store the current parameter value, or NULL */
3419  SCIP_Bool isadvanced, /**< is this parameter an advanced parameter? */
3420  SCIP_Longint defaultvalue, /**< default value of the parameter */
3421  SCIP_Longint minvalue, /**< minimum value for parameter */
3422  SCIP_Longint maxvalue, /**< maximum value for parameter */
3423  SCIP_DECL_PARAMCHGD ((*paramchgd)), /**< change information method of parameter */
3424  SCIP_PARAMDATA* paramdata /**< locally defined parameter specific data */
3425  )
3426 {
3427  assert(scip != NULL);
3428  assert(scip->set != NULL);
3429  assert(scip->mem != NULL);
3430 
3431  SCIP_CALL( SCIPsetAddLongintParam(scip->set, scip->messagehdlr, scip->mem->setmem, name, desc, valueptr, isadvanced,
3432  defaultvalue, minvalue, maxvalue, paramchgd, paramdata) );
3433 
3434  return SCIP_OKAY;
3435 }
3436 
3437 /** creates a SCIP_Real parameter, sets it to its default value, and adds it to the parameter set
3438  *
3439  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
3440  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
3441  */
3443  SCIP* scip, /**< SCIP data structure */
3444  const char* name, /**< name of the parameter */
3445  const char* desc, /**< description of the parameter */
3446  SCIP_Real* valueptr, /**< pointer to store the current parameter value, or NULL */
3447  SCIP_Bool isadvanced, /**< is this parameter an advanced parameter? */
3448  SCIP_Real defaultvalue, /**< default value of the parameter */
3449  SCIP_Real minvalue, /**< minimum value for parameter */
3450  SCIP_Real maxvalue, /**< maximum value for parameter */
3451  SCIP_DECL_PARAMCHGD ((*paramchgd)), /**< change information method of parameter */
3452  SCIP_PARAMDATA* paramdata /**< locally defined parameter specific data */
3453  )
3454 {
3455  assert(scip != NULL);
3456  assert(scip->set != NULL);
3457  assert(scip->mem != NULL);
3458 
3459  SCIP_CALL( SCIPsetAddRealParam(scip->set, scip->messagehdlr, scip->mem->setmem, name, desc, valueptr, isadvanced,
3460  defaultvalue, minvalue, maxvalue, paramchgd, paramdata) );
3461 
3462  return SCIP_OKAY;
3463 }
3464 
3465 /** creates a char parameter, sets it to its default value, and adds it to the parameter set
3466  *
3467  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
3468  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
3469  */
3471  SCIP* scip, /**< SCIP data structure */
3472  const char* name, /**< name of the parameter */
3473  const char* desc, /**< description of the parameter */
3474  char* valueptr, /**< pointer to store the current parameter value, or NULL */
3475  SCIP_Bool isadvanced, /**< is this parameter an advanced parameter? */
3476  char defaultvalue, /**< default value of the parameter */
3477  const char* allowedvalues, /**< array with possible parameter values, or NULL if not restricted */
3478  SCIP_DECL_PARAMCHGD ((*paramchgd)), /**< change information method of parameter */
3479  SCIP_PARAMDATA* paramdata /**< locally defined parameter specific data */
3480  )
3481 {
3482  assert(scip != NULL);
3483  assert(scip->set != NULL);
3484  assert(scip->mem != NULL);
3485 
3486  SCIP_CALL( SCIPsetAddCharParam(scip->set, scip->messagehdlr, scip->mem->setmem, name, desc, valueptr, isadvanced,
3487  defaultvalue, allowedvalues, paramchgd, paramdata) );
3488 
3489  return SCIP_OKAY;
3490 }
3491 
3492 /** creates a string(char*) parameter, sets it to its default value, and adds it to the parameter set
3493  *
3494  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
3495  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
3496  */
3498  SCIP* scip, /**< SCIP data structure */
3499  const char* name, /**< name of the parameter */
3500  const char* desc, /**< description of the parameter */
3501  char** valueptr, /**< pointer to store the current parameter value, or NULL; if not NULL then *valueptr should be NULL */
3502  SCIP_Bool isadvanced, /**< is this parameter an advanced parameter? */
3503  const char* defaultvalue, /**< default value of the parameter */
3504  SCIP_DECL_PARAMCHGD ((*paramchgd)), /**< change information method of parameter */
3505  SCIP_PARAMDATA* paramdata /**< locally defined parameter specific data */
3506  )
3507 {
3508  assert(scip != NULL);
3509  assert(scip->set != NULL);
3510  assert(scip->mem != NULL);
3511 
3512  SCIP_CALL( SCIPsetAddStringParam(scip->set, scip->messagehdlr, scip->mem->setmem, name, desc, valueptr, isadvanced,
3513  defaultvalue, paramchgd, paramdata) );
3514 
3515  return SCIP_OKAY;
3516 }
3517 
3518 /** gets the fixing status of an existing parameter
3519  *
3520  * @return TRUE if the parameter is fixed to a value, otherwise FALSE.
3521  */
3523  SCIP* scip, /**< SCIP data structure */
3524  const char* name /**< name of the parameter */
3525  )
3526 {
3527  assert(scip != NULL);
3528  assert(scip->set != NULL);
3529 
3530  return SCIPsetIsParamFixed(scip->set, name);
3531 }
3532 
3533 /** returns the pointer to the SCIP parameter with the given name
3534  *
3535  * @return pointer to the parameter with the given name
3536  */
3538  SCIP* scip, /**< SCIP data structure */
3539  const char* name /**< name of the parameter */
3540  )
3541 {
3542  assert(scip != NULL);
3543  assert(scip->set != NULL);
3544 
3545  return SCIPsetGetParam(scip->set, name);
3546 }
3547 
3548 /** gets the value of an existing SCIP_Bool parameter
3549  *
3550  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
3551  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
3552  */
3554  SCIP* scip, /**< SCIP data structure */
3555  const char* name, /**< name of the parameter */
3556  SCIP_Bool* value /**< pointer to store the parameter */
3557  )
3558 {
3559  assert(scip != NULL);
3560  assert(scip->set != NULL);
3561 
3562  SCIP_CALL( SCIPsetGetBoolParam(scip->set, name, value) );
3563 
3564  return SCIP_OKAY;
3565 }
3566 
3567 /** gets the value of an existing int parameter
3568  *
3569  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
3570  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
3571  */
3573  SCIP* scip, /**< SCIP data structure */
3574  const char* name, /**< name of the parameter */
3575  int* value /**< pointer to store the parameter */
3576  )
3577 {
3578  assert(scip != NULL);
3579  assert(scip->set != NULL);
3580 
3581  SCIP_CALL( SCIPsetGetIntParam(scip->set, name, value) );
3582 
3583  return SCIP_OKAY;
3584 }
3585 
3586 /** gets the value of an existing SCIP_Longint parameter
3587  *
3588  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
3589  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
3590  */
3592  SCIP* scip, /**< SCIP data structure */
3593  const char* name, /**< name of the parameter */
3594  SCIP_Longint* value /**< pointer to store the parameter */
3595  )
3596 {
3597  assert(scip != NULL);
3598  assert(scip->set != NULL);
3599 
3600  SCIP_CALL( SCIPsetGetLongintParam(scip->set, name, value) );
3601 
3602  return SCIP_OKAY;
3603 }
3604 
3605 /** gets the value of an existing SCIP_Real parameter
3606  *
3607  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
3608  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
3609  */
3611  SCIP* scip, /**< SCIP data structure */
3612  const char* name, /**< name of the parameter */
3613  SCIP_Real* value /**< pointer to store the parameter */
3614  )
3615 {
3616  assert(scip != NULL);
3617  assert(scip->set != NULL);
3618 
3619  SCIP_CALL( SCIPsetGetRealParam(scip->set, name, value) );
3620 
3621  return SCIP_OKAY;
3622 }
3623 
3624 /** gets the value of an existing char parameter
3625  *
3626  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
3627  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
3628  */
3630  SCIP* scip, /**< SCIP data structure */
3631  const char* name, /**< name of the parameter */
3632  char* value /**< pointer to store the parameter */
3633  )
3634 {
3635  assert(scip != NULL);
3636  assert(scip->set != NULL);
3637 
3638  SCIP_CALL( SCIPsetGetCharParam(scip->set, name, value) );
3639 
3640  return SCIP_OKAY;
3641 }
3642 
3643 /** gets the value of an existing string(char*) parameter
3644  *
3645  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
3646  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
3647  */
3649  SCIP* scip, /**< SCIP data structure */
3650  const char* name, /**< name of the parameter */
3651  char** value /**< pointer to store the parameter */
3652  )
3653 {
3654  assert(scip != NULL);
3655  assert(scip->set != NULL);
3656 
3657  SCIP_CALL( SCIPsetGetStringParam(scip->set, name, value) );
3658 
3659  return SCIP_OKAY;
3660 }
3661 
3662 /** fixes the value of an existing parameter
3663  *
3664  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
3665  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
3666  *
3667  * @note: Be careful with this method! Some general settings, e.g., the time or node limit, should not be fixed because
3668  * they have to be changed for sub-SCIPs.
3669  */
3671  SCIP* scip, /**< SCIP data structure */
3672  const char* name /**< name of the parameter */
3673  )
3674 {
3675  assert(scip != NULL);
3676  assert(scip->set != NULL);
3677 
3678  SCIP_CALL( SCIPsetChgParamFixed(scip->set, name, TRUE) );
3679 
3680  return SCIP_OKAY;
3681 }
3682 
3683 /** unfixes the value of an existing parameter
3684  *
3685  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
3686  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
3687  */
3689  SCIP* scip, /**< SCIP data structure */
3690  const char* name /**< name of the parameter */
3691  )
3692 {
3693  assert(scip != NULL);
3694  assert(scip->set != NULL);
3695 
3696  SCIP_CALL( SCIPsetChgParamFixed(scip->set, name, FALSE) );
3697 
3698  return SCIP_OKAY;
3699 }
3700 
3701 /** changes the value of an existing parameter
3702  *
3703  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
3704  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
3705  */
3707  SCIP* scip, /**< SCIP data structure */
3708  const char* name, /**< name of the parameter */
3709  void* value /**< new value of the parameter */
3710  )
3711 {
3712  assert(scip != NULL);
3713  assert(scip->set != NULL);
3714 
3715  SCIP_CALL( SCIPsetSetParam(scip->set, scip->messagehdlr, name, value) );
3716 
3717  return SCIP_OKAY;
3718 }
3719 
3720 /** changes the value of an existing SCIP_Bool parameter
3721  *
3722  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
3723  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
3724  */
3726  SCIP* scip, /**< SCIP data structure */
3727  SCIP_PARAM* param, /**< parameter */
3728  SCIP_Bool value /**< new value of the parameter */
3729  )
3730 {
3731  SCIP_RETCODE retcode;
3732 
3733  assert(scip != NULL);
3734  assert(scip->set != NULL);
3735 
3736  retcode = SCIPsetChgBoolParam(scip->set, scip->messagehdlr, param, value);
3737 
3738  if( retcode != SCIP_PARAMETERWRONGVAL )
3739  {
3740  SCIP_CALL( retcode );
3741  }
3742 
3743  return retcode;
3744 }
3745 
3746 /** changes the value of an existing SCIP_Bool parameter
3747  *
3748  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
3749  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
3750  */
3752  SCIP* scip, /**< SCIP data structure */
3753  const char* name, /**< name of the parameter */
3754  SCIP_Bool value /**< new value of the parameter */
3755  )
3756 {
3757  assert(scip != NULL);
3758  assert(scip->set != NULL);
3759 
3760  SCIP_CALL( SCIPsetSetBoolParam(scip->set, scip->messagehdlr, name, value) );
3761 
3762  return SCIP_OKAY;
3763 }
3764 
3765 /** changes the value of an existing int parameter
3766  *
3767  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
3768  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
3769  */
3771  SCIP* scip, /**< SCIP data structure */
3772  SCIP_PARAM* param, /**< parameter */
3773  int value /**< new value of the parameter */
3774  )
3775 {
3776  SCIP_RETCODE retcode;
3777 
3778  assert(scip != NULL);
3779  assert(scip->set != NULL);
3780 
3781  retcode = SCIPsetChgIntParam(scip->set, scip->messagehdlr, param, value);
3782 
3783  if( retcode != SCIP_PARAMETERWRONGVAL )
3784  {
3785  SCIP_CALL( retcode );
3786  }
3787 
3788  return retcode;
3789 }
3790 
3791 /** changes the value of an existing int parameter
3792  *
3793  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
3794  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
3795  */
3797  SCIP* scip, /**< SCIP data structure */
3798  const char* name, /**< name of the parameter */
3799  int value /**< new value of the parameter */
3800  )
3801 {
3802  assert(scip != NULL);
3803  assert(scip->set != NULL);
3804 
3805  SCIP_CALL( SCIPsetSetIntParam(scip->set, scip->messagehdlr, name, value) );
3806 
3807  return SCIP_OKAY;
3808 }
3809 
3810 /** changes the value of an existing SCIP_Longint parameter
3811  *
3812  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
3813  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
3814  */
3816  SCIP* scip, /**< SCIP data structure */
3817  SCIP_PARAM* param, /**< parameter */
3818  SCIP_Longint value /**< new value of the parameter */
3819  )
3820 {
3821  SCIP_RETCODE retcode;
3822 
3823  assert(scip != NULL);
3824  assert(scip->set != NULL);
3825 
3826  retcode = SCIPsetChgLongintParam(scip->set, scip->messagehdlr, param, value);
3827 
3828  if( retcode != SCIP_PARAMETERWRONGVAL )
3829  {
3830  SCIP_CALL( retcode );
3831  }
3832 
3833  return retcode;
3834 }
3835 
3836 /** changes the value of an existing SCIP_Longint parameter
3837  *
3838  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
3839  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
3840  */
3842  SCIP* scip, /**< SCIP data structure */
3843  const char* name, /**< name of the parameter */
3844  SCIP_Longint value /**< new value of the parameter */
3845  )
3846 {
3847  assert(scip != NULL);
3848  assert(scip->set != NULL);
3849 
3850  SCIP_CALL( SCIPsetSetLongintParam(scip->set, scip->messagehdlr, name, value) );
3851 
3852  return SCIP_OKAY;
3853 }
3854 
3855 /** changes the value of an existing SCIP_Real parameter
3856  *
3857  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
3858  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
3859  */
3861  SCIP* scip, /**< SCIP data structure */
3862  SCIP_PARAM* param, /**< parameter */
3863  SCIP_Real value /**< new value of the parameter */
3864  )
3865 {
3866  SCIP_RETCODE retcode;
3867 
3868  assert(scip != NULL);
3869  assert(scip->set != NULL);
3870 
3871  retcode = SCIPsetChgRealParam(scip->set, scip->messagehdlr, param, value);
3872 
3873  if( retcode != SCIP_PARAMETERWRONGVAL )
3874  {
3875  SCIP_CALL( retcode );
3876  }
3877 
3878  return retcode;
3879 }
3880 
3881 /** changes the value of an existing SCIP_Real parameter
3882  *
3883  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
3884  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
3885  */
3887  SCIP* scip, /**< SCIP data structure */
3888  const char* name, /**< name of the parameter */
3889  SCIP_Real value /**< new value of the parameter */
3890  )
3891 {
3892  assert(scip != NULL);
3893  assert(scip->set != NULL);
3894 
3895  SCIP_CALL( SCIPsetSetRealParam(scip->set, scip->messagehdlr, name, value) );
3896 
3897  return SCIP_OKAY;
3898 }
3899 
3900 /** changes the value of an existing char parameter
3901  *
3902  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
3903  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
3904  */
3906  SCIP* scip, /**< SCIP data structure */
3907  SCIP_PARAM* param, /**< parameter */
3908  char value /**< new value of the parameter */
3909  )
3910 {
3911  SCIP_RETCODE retcode;
3912 
3913  assert(scip != NULL);
3914  assert(scip->set != NULL);
3915 
3916  retcode = SCIPsetChgCharParam(scip->set, scip->messagehdlr, param, value);
3917 
3918  if( retcode != SCIP_PARAMETERWRONGVAL )
3919  {
3920  SCIP_CALL( retcode );
3921  }
3922 
3923  return retcode;
3924 }
3925 
3926 /** changes the value of an existing char parameter
3927  *
3928  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
3929  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
3930  */
3932  SCIP* scip, /**< SCIP data structure */
3933  const char* name, /**< name of the parameter */
3934  char value /**< new value of the parameter */
3935  )
3936 {
3937  assert(scip != NULL);
3938  assert(scip->set != NULL);
3939 
3940  SCIP_CALL( SCIPsetSetCharParam(scip->set, scip->messagehdlr, name, value) );
3941 
3942  return SCIP_OKAY;
3943 }
3944 
3945 /** changes the value of an existing string(char*) parameter
3946  *
3947  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
3948  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
3949  */
3951  SCIP* scip, /**< SCIP data structure */
3952  SCIP_PARAM* param, /**< parameter */
3953  const char* value /**< new value of the parameter */
3954  )
3955 {
3956  SCIP_RETCODE retcode;
3957 
3958  assert(scip != NULL);
3959  assert(scip->set != NULL);
3960 
3961  retcode = SCIPsetChgStringParam(scip->set, scip->messagehdlr, param, value);
3962 
3963  if( retcode != SCIP_PARAMETERWRONGVAL )
3964  {
3965  SCIP_CALL( retcode );
3966  }
3967 
3968  return retcode;
3969 }
3970 
3971 /** changes the value of an existing string(char*) parameter
3972  *
3973  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
3974  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
3975  */
3977  SCIP* scip, /**< SCIP data structure */
3978  const char* name, /**< name of the parameter */
3979  const char* value /**< new value of the parameter */
3980  )
3981 {
3982  assert(scip != NULL);
3983  assert(scip->set != NULL);
3984 
3985  SCIP_CALL( SCIPsetSetStringParam(scip->set, scip->messagehdlr, name, value) );
3986 
3987  return SCIP_OKAY;
3988 }
3989 
3990 /** reads parameters from a file
3991  *
3992  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
3993  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
3994  */
3996  SCIP* scip, /**< SCIP data structure */
3997  const char* filename /**< file name */
3998  )
3999 {
4000  assert(scip != NULL);
4001  assert(scip->set != NULL);
4002 
4003  SCIP_CALL( SCIPsetReadParams(scip->set, scip->messagehdlr, filename) );
4004 
4005  return SCIP_OKAY;
4006 }
4007 
4008 /** writes all parameters in the parameter set to a file
4009  *
4010  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
4011  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
4012  */
4014  SCIP* scip, /**< SCIP data structure */
4015  const char* filename, /**< file name, or NULL for stdout */
4016  SCIP_Bool comments, /**< should parameter descriptions be written as comments? */
4017  SCIP_Bool onlychanged /**< should only the parameters been written, that are changed from default? */
4018  )
4019 {
4020  assert(scip != NULL);
4021  assert(scip->set != NULL);
4022 
4023  SCIP_CALL( SCIPsetWriteParams(scip->set, scip->messagehdlr, filename, comments, onlychanged) );
4024 
4025  return SCIP_OKAY;
4026 }
4027 
4028 /** resets a single parameter to its default value
4029  *
4030  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
4031  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
4032  */
4034  SCIP* scip, /**< SCIP data structure */
4035  const char* name /**< name of the parameter */
4036  )
4037 {
4038  assert(scip != NULL);
4039  assert(scip->set != NULL);
4040 
4041  SCIP_CALL( SCIPsetResetParam(scip->set, scip->messagehdlr, name) );
4042 
4043  return SCIP_OKAY;
4044 }
4045 
4046 /** resets all parameters to their default values
4047  *
4048  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
4049  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
4050  */
4052  SCIP* scip /**< SCIP data structure */
4053  )
4054 {
4055  assert(scip != NULL);
4056  assert(scip->set != NULL);
4057 
4058  SCIP_CALL( SCIPsetResetParams(scip->set, scip->messagehdlr) );
4059 
4060  return SCIP_OKAY;
4061 }
4062 
4063 /** sets parameters to
4064  *
4065  * - SCIP_PARAMEMPHASIS_DEFAULT to use default values (see also SCIPresetParams())
4066  * - SCIP_PARAMEMPHASIS_COUNTER to get feasible and "fast" counting process
4067  * - SCIP_PARAMEMPHASIS_CPSOLVER to get CP like search (e.g. no LP relaxation)
4068  * - SCIP_PARAMEMPHASIS_EASYCIP to solve easy problems fast
4069  * - SCIP_PARAMEMPHASIS_FEASIBILITY to detect feasibility fast
4070  * - SCIP_PARAMEMPHASIS_HARDLP to be capable to handle hard LPs
4071  * - SCIP_PARAMEMPHASIS_OPTIMALITY to prove optimality fast
4072  *
4073  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
4074  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
4075  */
4077  SCIP* scip, /**< SCIP data structure */
4078  SCIP_PARAMEMPHASIS paramemphasis, /**< parameter settings */
4079  SCIP_Bool quiet /**< should the parameter be set quiet (no output) */
4080  )
4081 {
4082  assert(scip != NULL);
4083  assert(scip->set != NULL);
4084 
4085  SCIP_CALL( SCIPsetSetEmphasis(scip->set, scip->messagehdlr, paramemphasis, quiet) );
4086 
4087  return SCIP_OKAY;
4088 }
4089 
4090 /** sets parameters to deactivate separators and heuristics that use auxiliary SCIP instances; should be called for
4091  * auxiliary SCIP instances to avoid recursion
4092  *
4093  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
4094  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
4095  */
4097  SCIP* scip, /**< (auxiliary) SCIP data structure */
4098  SCIP_Bool quiet /**< should the parameter be set quiet (no output) */
4099  )
4100 {
4101  assert(scip != NULL);
4102  assert(scip->set != NULL);
4103 
4104  SCIP_CALL( SCIPsetSetSubscipsOff(scip->set, scip->messagehdlr, quiet) );
4105 
4106  return SCIP_OKAY;
4107 }
4108 
4109 /** sets heuristic parameters values to
4110  *
4111  * - SCIP_PARAMSETTING_DEFAULT which are the default values of all heuristic parameters
4112  * - SCIP_PARAMSETTING_FAST such that the time spend for heuristic is decreased
4113  * - SCIP_PARAMSETTING_AGGRESSIVE such that the heuristic are called more aggregative
4114  * - SCIP_PARAMSETTING_OFF which turn off all heuristics
4115  *
4116  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
4117  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
4118  */
4120  SCIP* scip, /**< SCIP data structure */
4121  SCIP_PARAMSETTING paramsetting, /**< parameter settings */
4122  SCIP_Bool quiet /**< should the parameter be set quiet (no output) */
4123  )
4124 {
4125  assert(scip != NULL);
4126  assert(scip->set != NULL);
4127  assert(paramsetting == SCIP_PARAMSETTING_DEFAULT || paramsetting == SCIP_PARAMSETTING_FAST
4128  || paramsetting == SCIP_PARAMSETTING_AGGRESSIVE || paramsetting == SCIP_PARAMSETTING_OFF);
4129 
4130  SCIP_CALL( SCIPsetSetHeuristics(scip->set, scip->messagehdlr, paramsetting, quiet) );
4131 
4132  return SCIP_OKAY;
4133 }
4134 
4135 /** sets presolving parameters to
4136  *
4137  * - SCIP_PARAMSETTING_DEFAULT which are the default values of all presolving parameters
4138  * - SCIP_PARAMSETTING_FAST such that the time spend for presolving is decreased
4139  * - SCIP_PARAMSETTING_AGGRESSIVE such that the presolving is more aggregative
4140  * - SCIP_PARAMSETTING_OFF which turn off all presolving
4141  *
4142  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
4143  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
4144  */
4146  SCIP* scip, /**< SCIP data structure */
4147  SCIP_PARAMSETTING paramsetting, /**< parameter settings */
4148  SCIP_Bool quiet /**< should the parameter be set quiet (no output) */
4149  )
4150 {
4151  assert(scip != NULL);
4152  assert(scip->set != NULL);
4153  assert(paramsetting == SCIP_PARAMSETTING_DEFAULT || paramsetting == SCIP_PARAMSETTING_FAST
4154  || paramsetting == SCIP_PARAMSETTING_AGGRESSIVE || paramsetting == SCIP_PARAMSETTING_OFF);
4155 
4156  SCIP_CALL( SCIPsetSetPresolving(scip->set, scip->messagehdlr, paramsetting, quiet) );
4157 
4158  return SCIP_OKAY;
4159 }
4160 
4161 /** sets separating parameters to
4162  *
4163  * - SCIP_PARAMSETTING_DEFAULT which are the default values of all separating parameters
4164  * - SCIP_PARAMSETTING_FAST such that the time spend for separating is decreased
4165  * - SCIP_PARAMSETTING_AGGRESSIVE such that the separating is done more aggregative
4166  * - SCIP_PARAMSETTING_OFF which turn off all separating
4167  *
4168  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
4169  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
4170  */
4172  SCIP* scip, /**< SCIP data structure */
4173  SCIP_PARAMSETTING paramsetting, /**< parameter settings */
4174  SCIP_Bool quiet /**< should the parameter be set quiet (no output) */
4175  )
4176 {
4177  assert(scip != NULL);
4178  assert(scip->set != NULL);
4179  assert(paramsetting == SCIP_PARAMSETTING_DEFAULT || paramsetting == SCIP_PARAMSETTING_FAST
4180  || paramsetting == SCIP_PARAMSETTING_AGGRESSIVE || paramsetting == SCIP_PARAMSETTING_OFF);
4181 
4182  SCIP_CALL( SCIPsetSetSeparating(scip->set, scip->messagehdlr, paramsetting, quiet) );
4183 
4184  return SCIP_OKAY;
4185 }
4186 
4187 /** returns the array of all available SCIP parameters
4188  *
4189  * @return SCIP_PARAM* array, containing all SCIP parameters.
4190  */
4192  SCIP* scip /**< SCIP data structure */
4193  )
4194 {
4195  assert(scip != NULL);
4196  assert(scip->set != NULL);
4197 
4198  return SCIPsetGetParams(scip->set);
4199 }
4200 
4201 /** returns the total number of all available SCIP parameters
4202  *
4203  * @return number of all SCIP parameters.
4204  */
4206  SCIP* scip /**< SCIP data structure */
4207  )
4208 {
4209  assert(scip != NULL);
4210  assert(scip->set != NULL);
4211 
4212  return SCIPsetGetNParams(scip->set);
4213 }
4214 
4215 
4216 
4217 
4218 /*
4219  * SCIP user functionality methods: managing plugins
4220  */
4221 
4222 /** creates a reader and includes it in SCIP
4223  *
4224  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
4225  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
4226  *
4227  * @pre This method can be called if SCIP is in one of the following stages:
4228  * - \ref SCIP_STAGE_INIT
4229  * - \ref SCIP_STAGE_PROBLEM
4230  *
4231  * @note method has all reader callbacks as arguments and is thus changed every time a new callback is added
4232  * in future releases; consider using SCIPincludeReaderBasic() and setter functions
4233  * if you seek for a method which is less likely to change in future releases
4234  */
4236  SCIP* scip, /**< SCIP data structure */
4237  const char* name, /**< name of reader */
4238  const char* desc, /**< description of reader */
4239  const char* extension, /**< file extension that reader processes */
4240  SCIP_DECL_READERCOPY ((*readercopy)), /**< copy method of reader or NULL if you don't want to copy your plugin into sub-SCIPs */
4241  SCIP_DECL_READERFREE ((*readerfree)), /**< destructor of reader */
4242  SCIP_DECL_READERREAD ((*readerread)), /**< read method */
4243  SCIP_DECL_READERWRITE ((*readerwrite)), /**< write method */
4244  SCIP_READERDATA* readerdata /**< reader data */
4245  )
4246 {
4247  SCIP_READER* reader;
4248 
4249  SCIP_CALL( checkStage(scip, "SCIPincludeReader", TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE) );
4250 
4251  /* check whether reader is already present */
4252  if( SCIPfindReader(scip, name) != NULL )
4253  {
4254  SCIPerrorMessage("reader <%s> already included.\n", name);
4255  return SCIP_INVALIDDATA;
4256  }
4257 
4258  SCIP_CALL( SCIPreaderCreate(&reader, name, desc, extension, readercopy, readerfree, readerread, readerwrite, readerdata) );
4259  SCIP_CALL( SCIPsetIncludeReader(scip->set, reader) );
4260 
4261  return SCIP_OKAY;
4262 }
4263 
4264 /** creates a reader and includes it in SCIP. All non-fundamental (or optional) callbacks will be set to NULL.
4265  * Optional callbacks can be set via specific setter functions, see
4266  * SCIPsetReaderCopy(), SCIPsetReaderFree(), SCIPsetReaderRead(), SCIPsetReaderWrite().
4267  *
4268  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
4269  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
4270  *
4271  * @pre This method can be called if SCIP is in one of the following stages:
4272  * - \ref SCIP_STAGE_INIT
4273  * - \ref SCIP_STAGE_PROBLEM
4274  *
4275  * @note if you want to set all callbacks with a single method call, consider using SCIPincludeReader() instead
4276  */
4278  SCIP* scip, /**< SCIP data structure */
4279  SCIP_READER** readerptr, /**< reference to reader pointer, or NULL */
4280  const char* name, /**< name of reader */
4281  const char* desc, /**< description of reader */
4282  const char* extension, /**< file extension that reader processes */
4283  SCIP_READERDATA* readerdata /**< reader data */
4284  )
4285 {
4286  SCIP_READER* reader;
4287 
4288  SCIP_CALL( checkStage(scip, "SCIPincludeReaderBasic", TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE) );
4289 
4290  /* check whether reader is already present */
4291  if( SCIPfindReader(scip, name) != NULL )
4292  {
4293  SCIPerrorMessage("reader <%s> already included.\n", name);
4294  return SCIP_INVALIDDATA;
4295  }
4296 
4297  SCIP_CALL( SCIPreaderCreate(&reader, name, desc, extension, NULL, NULL, NULL, NULL, readerdata) );
4298  SCIP_CALL( SCIPsetIncludeReader(scip->set, reader) );
4299 
4300  if( readerptr != NULL )
4301  *readerptr = reader;
4302 
4303  return SCIP_OKAY;
4304 }
4305 
4306 /** set copy method of reader
4307  *
4308  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
4309  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
4310  *
4311  * @pre This method can be called if SCIP is in one of the following stages:
4312  * - \ref SCIP_STAGE_INIT
4313  * - \ref SCIP_STAGE_PROBLEM
4314  */
4316  SCIP* scip, /**< SCIP data structure */
4317  SCIP_READER* reader, /**< reader */
4318  SCIP_DECL_READERCOPY ((*readercopy)) /**< copy method of reader or NULL if you don't want to copy your plugin into sub-SCIPs */
4319  )
4320 {
4321  assert(scip != NULL);
4322 
4323  SCIP_CALL( checkStage(scip, "SCIPsetReaderCopy", TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE) );
4324 
4325  SCIPreaderSetCopy(reader, readercopy);
4326 
4327  return SCIP_OKAY;
4328 }
4329 
4330 /** set deinitialization method of reader
4331  *
4332  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
4333  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
4334  *
4335  * @pre This method can be called if SCIP is in one of the following stages:
4336  * - \ref SCIP_STAGE_INIT
4337  * - \ref SCIP_STAGE_PROBLEM
4338  */
4340  SCIP* scip, /**< SCIP data structure */
4341  SCIP_READER* reader, /**< reader */
4342  SCIP_DECL_READERFREE ((*readerfree)) /**< destructor of reader */
4343  )
4344 {
4345  assert(scip != NULL);
4346 
4347  SCIP_CALL( checkStage(scip, "SCIPsetReaderFree", TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE) );
4348 
4349  SCIPreaderSetFree(reader, readerfree);
4350 
4351  return SCIP_OKAY;
4352 }
4353 
4354 /** set read method of reader
4355  *
4356  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
4357  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
4358  *
4359  * @pre This method can be called if SCIP is in one of the following stages:
4360  * - \ref SCIP_STAGE_INIT
4361  * - \ref SCIP_STAGE_PROBLEM
4362  */
4364  SCIP* scip, /**< SCIP data structure */
4365  SCIP_READER* reader, /**< reader */
4366  SCIP_DECL_READERREAD ((*readerread)) /**< read method of reader */
4367  )
4368 {
4369  assert(scip != NULL);
4370 
4371  SCIP_CALL( checkStage(scip, "SCIPsetReaderRead", TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE) );
4372 
4373  SCIPreaderSetRead(reader, readerread);
4374 
4375  return SCIP_OKAY;
4376 }
4377 
4378 /** set write method of reader
4379  *
4380  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
4381  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
4382  *
4383  * @pre This method can be called if SCIP is in one of the following stages:
4384  * - \ref SCIP_STAGE_INIT
4385  * - \ref SCIP_STAGE_PROBLEM
4386  */
4388  SCIP* scip, /**< SCIP data structure */
4389  SCIP_READER* reader, /**< reader */
4390  SCIP_DECL_READERWRITE ((*readerwrite)) /**< write method of reader */
4391  )
4392 {
4393  assert(scip != NULL);
4394 
4395  SCIP_CALL( checkStage(scip, "SCIPsetReaderWrite", TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE) );
4396 
4397  SCIPreaderSetWrite(reader, readerwrite);
4398 
4399  return SCIP_OKAY;
4400 }
4401 
4402 /** returns the reader of the given name, or NULL if not existing */
4404  SCIP* scip, /**< SCIP data structure */
4405  const char* name /**< name of constraint handler */
4406  )
4407 {
4408  assert(scip != NULL);
4409  assert(scip->set != NULL);
4410  assert(name != NULL);
4411 
4412  return SCIPsetFindReader(scip->set, name);
4413 }
4414 
4415 /** returns the array of currently available readers */
4417  SCIP* scip /**< SCIP data structure */
4418  )
4419 {
4420  assert(scip != NULL);
4421  assert(scip->set != NULL);
4422 
4423  return scip->set->readers;
4424 }
4425 
4426 /** returns the number of currently available readers */
4428  SCIP* scip /**< SCIP data structure */
4429  )
4430 {
4431  assert(scip != NULL);
4432  assert(scip->set != NULL);
4433 
4434  return scip->set->nreaders;
4435 }
4436 
4437 /** creates a variable pricer and includes it in SCIP
4438  * To use the variable pricer for solving a problem, it first has to be activated with a call to SCIPactivatePricer().
4439  * This should be done during the problem creation stage.
4440  *
4441  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
4442  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
4443  *
4444  * @pre This method can be called if SCIP is in one of the following stages:
4445  * - \ref SCIP_STAGE_INIT
4446  * - \ref SCIP_STAGE_PROBLEM
4447  *
4448  * @note method has all pricer callbacks as arguments and is thus changed every time a new callback is added
4449  * in future releases; consider using SCIPincludePricerBasic() and setter functions
4450  * if you seek for a method which is less likely to change in future releases
4451  */
4453  SCIP* scip, /**< SCIP data structure */
4454  const char* name, /**< name of variable pricer */
4455  const char* desc, /**< description of variable pricer */
4456  int priority, /**< priority of the variable pricer */
4457  SCIP_Bool delay, /**< should the pricer be delayed until no other pricers or already existing
4458  * problem variables with negative reduced costs are found?
4459  * if this is set to FALSE it may happen that the pricer produces columns
4460  * that already exist in the problem (which are also priced in by the
4461  * default problem variable pricing in the same round)
4462  */
4463  SCIP_DECL_PRICERCOPY ((*pricercopy)), /**< copy method of variable pricer or NULL if you don't want to copy your plugin into sub-SCIPs */
4464  SCIP_DECL_PRICERFREE ((*pricerfree)), /**< destructor of variable pricer */
4465  SCIP_DECL_PRICERINIT ((*pricerinit)), /**< initialize variable pricer */
4466  SCIP_DECL_PRICEREXIT ((*pricerexit)), /**< deinitialize variable pricer */
4467  SCIP_DECL_PRICERINITSOL((*pricerinitsol)),/**< solving process initialization method of variable pricer */
4468  SCIP_DECL_PRICEREXITSOL((*pricerexitsol)),/**< solving process deinitialization method of variable pricer */
4469  SCIP_DECL_PRICERREDCOST((*pricerredcost)),/**< reduced cost pricing method of variable pricer for feasible LPs */
4470  SCIP_DECL_PRICERFARKAS((*pricerfarkas)), /**< Farkas pricing method of variable pricer for infeasible LPs */
4471  SCIP_PRICERDATA* pricerdata /**< variable pricer data */
4472  )
4473 {
4474  SCIP_PRICER* pricer;
4475 
4476  SCIP_CALL( checkStage(scip, "SCIPincludePricer", TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE) );
4477 
4478  /* check whether pricer is already present */
4479  if( SCIPfindPricer(scip, name) != NULL )
4480  {
4481  SCIPerrorMessage("pricer <%s> already included.\n", name);
4482  return SCIP_INVALIDDATA;
4483  }
4484 
4485  SCIP_CALL( SCIPpricerCreate(&pricer, scip->set, scip->messagehdlr, scip->mem->setmem,
4486  name, desc, priority, delay,
4487  pricercopy,
4488  pricerfree, pricerinit, pricerexit, pricerinitsol, pricerexitsol, pricerredcost, pricerfarkas, pricerdata) );
4489  SCIP_CALL( SCIPsetIncludePricer(scip->set, pricer) );
4490 
4491  return SCIP_OKAY;
4492 }
4493 
4494 /** creates a variable pricer and includes it in SCIP with all non-fundamental callbacks set to NULL;
4495  * if needed, these can be added afterwards via setter functions SCIPsetPricerCopy(), SCIPsetPricerFree(),
4496  * SCIPsetPricerInity(), SCIPsetPricerExit(), SCIPsetPricerInitsol(), SCIPsetPricerExitsol(),
4497  * SCIPsetPricerFarkas();
4498  *
4499  * To use the variable pricer for solving a problem, it first has to be activated with a call to SCIPactivatePricer().
4500  * This should be done during the problem creation stage.
4501  *
4502  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
4503  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
4504  *
4505  * @pre This method can be called if SCIP is in one of the following stages:
4506  * - \ref SCIP_STAGE_INIT
4507  * - \ref SCIP_STAGE_PROBLEM
4508  *
4509  * @note if you want to set all callbacks with a single method call, consider using SCIPincludePricer() instead
4510  */
4512  SCIP* scip, /**< SCIP data structure */
4513  SCIP_PRICER** pricerptr, /**< reference to a pricer, or NULL */
4514  const char* name, /**< name of variable pricer */
4515  const char* desc, /**< description of variable pricer */
4516  int priority, /**< priority of the variable pricer */
4517  SCIP_Bool delay, /**< should the pricer be delayed until no other pricers or already existing
4518  * problem variables with negative reduced costs are found?
4519  * if this is set to FALSE it may happen that the pricer produces columns
4520  * that already exist in the problem (which are also priced in by the
4521  * default problem variable pricing in the same round)
4522  */
4523  SCIP_DECL_PRICERREDCOST((*pricerredcost)),/**< reduced cost pricing method of variable pricer for feasible LPs */
4524  SCIP_DECL_PRICERFARKAS((*pricerfarkas)), /**< Farkas pricing method of variable pricer for infeasible LPs */
4525  SCIP_PRICERDATA* pricerdata /**< variable pricer data */
4526  )
4527 {
4528  SCIP_PRICER* pricer;
4529 
4530  SCIP_CALL( checkStage(scip, "SCIPincludePricerBasic", TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE) );
4531 
4532  /* check whether pricer is already present */
4533  if( SCIPfindPricer(scip, name) != NULL )
4534  {
4535  SCIPerrorMessage("pricer <%s> already included.\n", name);
4536  return SCIP_INVALIDDATA;
4537  }
4538 
4539  SCIP_CALL( SCIPpricerCreate(&pricer, scip->set, scip->messagehdlr, scip->mem->setmem,
4540  name, desc, priority, delay,
4541  NULL,
4542  NULL, NULL, NULL, NULL, NULL, pricerredcost, pricerfarkas, pricerdata) );
4543  SCIP_CALL( SCIPsetIncludePricer(scip->set, pricer) );
4544 
4545  if( pricerptr != NULL )
4546  *pricerptr = pricer;
4547 
4548  return SCIP_OKAY;
4549 }
4550 
4551 /** sets copy method of pricer
4552  *
4553  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
4554  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
4555  *
4556  * @pre This method can be called if SCIP is in one of the following stages:
4557  * - \ref SCIP_STAGE_INIT
4558  * - \ref SCIP_STAGE_PROBLEM
4559  */
4561  SCIP* scip, /**< SCIP data structure */
4562  SCIP_PRICER* pricer, /**< pricer */
4563  SCIP_DECL_PRICERCOPY ((*pricercopy)) /**< copy method of pricer or NULL if you don't want to copy your plugin into sub-SCIPs */
4564  )
4565 {
4566  SCIP_CALL( checkStage(scip, "SCIPsetPricerCopy", TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE) );
4567 
4568  assert(pricer != NULL);
4569 
4570  SCIPpricerSetCopy(pricer, pricercopy);
4571 
4572  return SCIP_OKAY;
4573 }
4574 
4575 /** sets destructor method of pricer
4576  *
4577  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
4578  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
4579  *
4580  * @pre This method can be called if SCIP is in one of the following stages:
4581  * - \ref SCIP_STAGE_INIT
4582  * - \ref SCIP_STAGE_PROBLEM
4583  */
4585  SCIP* scip, /**< SCIP data structure */
4586  SCIP_PRICER* pricer, /**< pricer */
4587  SCIP_DECL_PRICERFREE ((*pricerfree)) /**< destructor of pricer */
4588  )
4589 {
4590  SCIP_CALL( checkStage(scip, "SCIPsetPricerFree", TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE) );
4591 
4592  assert(pricer != NULL);
4593 
4594  SCIPpricerSetFree(pricer, pricerfree);
4595 
4596  return SCIP_OKAY;
4597 }
4598 
4599 /** sets initialization method of pricer
4600  *
4601  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
4602  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
4603  *
4604  * @pre This method can be called if SCIP is in one of the following stages:
4605  * - \ref SCIP_STAGE_INIT
4606  * - \ref SCIP_STAGE_PROBLEM
4607  */
4609  SCIP* scip, /**< SCIP data structure */
4610  SCIP_PRICER* pricer, /**< pricer */
4611  SCIP_DECL_PRICERINIT ((*pricerinit)) /**< initialize pricer */
4612  )
4613 {
4614  SCIP_CALL( checkStage(scip, "SCIPsetPricerInit", TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE) );
4615 
4616  assert(pricer != NULL);
4617 
4618  SCIPpricerSetInit(pricer, pricerinit);
4619 
4620  return SCIP_OKAY;
4621 }
4622 
4623 /** sets deinitialization method of pricer
4624  *
4625  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
4626  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
4627  *
4628  * @pre This method can be called if SCIP is in one of the following stages:
4629  * - \ref SCIP_STAGE_INIT
4630  * - \ref SCIP_STAGE_PROBLEM
4631  */
4633  SCIP* scip, /**< SCIP data structure */
4634  SCIP_PRICER* pricer, /**< pricer */
4635  SCIP_DECL_PRICEREXIT ((*pricerexit)) /**< deinitialize pricer */
4636  )
4637 {
4638  SCIP_CALL( checkStage(scip, "SCIPsetPricerExit", TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE) );
4639 
4640  assert(pricer != NULL);
4641 
4642  SCIPpricerSetExit(pricer, pricerexit);
4643 
4644  return SCIP_OKAY;
4645 }
4646 
4647 /** sets solving process initialization method of pricer
4648  *
4649  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
4650  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
4651  *
4652  * @pre This method can be called if SCIP is in one of the following stages:
4653  * - \ref SCIP_STAGE_INIT
4654  * - \ref SCIP_STAGE_PROBLEM
4655  */
4657  SCIP* scip, /**< SCIP data structure */
4658  SCIP_PRICER* pricer, /**< pricer */
4659  SCIP_DECL_PRICERINITSOL ((*pricerinitsol))/**< solving process initialization method of pricer */
4660  )
4661 {
4662  SCIP_CALL( checkStage(scip, "SCIPsetPricerInitsol", TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE) );
4663 
4664  assert(pricer != NULL);
4665 
4666  SCIPpricerSetInitsol(pricer, pricerinitsol);
4667 
4668  return SCIP_OKAY;
4669 }
4670 
4671 /** sets solving process deinitialization method of pricer
4672  *
4673  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
4674  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
4675  *
4676  * @pre This method can be called if SCIP is in one of the following stages:
4677  * - \ref SCIP_STAGE_INIT
4678  * - \ref SCIP_STAGE_PROBLEM
4679  */
4681  SCIP* scip, /**< SCIP data structure */
4682  SCIP_PRICER* pricer, /**< pricer */
4683  SCIP_DECL_PRICEREXITSOL((*pricerexitsol)) /**< solving process deinitialization method of pricer */
4684  )
4685 {
4686  SCIP_CALL( checkStage(scip, "SCIPsetPricerExitsol", TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE) );
4687 
4688  assert(pricer != NULL);
4689 
4690  SCIPpricerSetExitsol(pricer, pricerexitsol);
4691 
4692  return SCIP_OKAY;
4693 }
4694 
4695 /** returns the variable pricer of the given name, or NULL if not existing */
4697  SCIP* scip, /**< SCIP data structure */
4698  const char* name /**< name of variable pricer */
4699  )
4700 {
4701  assert(scip != NULL);
4702  assert(scip->set != NULL);
4703  assert(name != NULL);
4704 
4705  return SCIPsetFindPricer(scip->set, name);
4706 }
4707 
4708 /** returns the array of currently available variable pricers; active pricers are in the first slots of the array */
4710  SCIP* scip /**< SCIP data structure */
4711  )
4712 {
4713  assert(scip != NULL);
4714  assert(scip->set != NULL);
4715 
4716  SCIPsetSortPricers(scip->set);
4717 
4718  return scip->set->pricers;
4719 }
4720 
4721 /** returns the number of currently available variable pricers */
4723  SCIP* scip /**< SCIP data structure */
4724  )
4725 {
4726  assert(scip != NULL);
4727  assert(scip->set != NULL);
4728 
4729  return scip->set->npricers;
4730 }
4731 
4732 /** returns the number of currently active variable pricers, that are used in the LP solving loop */
4734  SCIP* scip /**< SCIP data structure */
4735  )
4736 {
4737  assert(scip != NULL);
4738  assert(scip->set != NULL);
4739 
4740  return scip->set->nactivepricers;
4741 }
4742 
4743 /** sets the priority priority of a variable pricer */
4745  SCIP* scip, /**< SCIP data structure */
4746  SCIP_PRICER* pricer, /**< variable pricer */
4747  int priority /**< new priority of the variable pricer */
4748  )
4749 {
4750  assert(scip != NULL);
4751  assert(scip->set != NULL);
4752 
4753  SCIPpricerSetPriority(pricer, scip->set, priority);
4754 
4755  return SCIP_OKAY;
4756 }
4757 
4758 /** activates pricer to be used for the current problem
4759  * This method should be called during the problem creation stage for all pricers that are necessary to solve
4760  * the problem model.
4761  * The pricers are automatically deactivated when the problem is freed.
4762  *
4763  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
4764  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
4765  *
4766  * @pre This method can be called if SCIP is in one of the following stages:
4767  * - \ref SCIP_STAGE_PROBLEM
4768  */
4770  SCIP* scip, /**< SCIP data structure */
4771  SCIP_PRICER* pricer /**< variable pricer */
4772  )
4773 {
4774  SCIP_CALL( checkStage(scip, "SCIPactivatePricer", FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE) );
4775 
4776  SCIP_CALL( SCIPpricerActivate(pricer, scip->set) );
4777 
4778  return SCIP_OKAY;
4779 }
4780 
4781 /** deactivates pricer
4782  *
4783  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
4784  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
4785  *
4786  * @pre This method can be called if SCIP is in one of the following stages:
4787  * - \ref SCIP_STAGE_PROBLEM
4788  * - \ref SCIP_STAGE_EXITSOLVE
4789  */
4791  SCIP* scip, /**< SCIP data structure */
4792  SCIP_PRICER* pricer /**< variable pricer */
4793  )
4794 {
4795  SCIP_CALL( checkStage(scip, "SCIPdeactivatePricer", FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE) );
4796 
4797  SCIP_CALL( SCIPpricerDeactivate(pricer, scip->set) );
4798 
4799  return SCIP_OKAY;
4800 }
4801 
4802 /** creates a constraint handler and includes it in SCIP.
4803  *
4804  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
4805  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
4806  *
4807  * @pre This method can be called if SCIP is in one of the following stages:
4808  * - \ref SCIP_STAGE_INIT
4809  * - \ref SCIP_STAGE_PROBLEM
4810  *
4811  * @note method has all constraint handler callbacks as arguments and is thus changed every time a new
4812  * callback is added
4813  * in future releases; consider using SCIPincludeConshdlrBasic() and setter functions
4814  * if you seek for a method which is less likely to change in future releases
4815  */
4817  SCIP* scip, /**< SCIP data structure */
4818  const char* name, /**< name of constraint handler */
4819  const char* desc, /**< description of constraint handler */
4820  int sepapriority, /**< priority of the constraint handler for separation */
4821  int enfopriority, /**< priority of the constraint handler for constraint enforcing */
4822  int chckpriority, /**< priority of the constraint handler for checking feasibility (and propagation) */
4823  int sepafreq, /**< frequency for separating cuts; zero means to separate only in the root node */
4824  int propfreq, /**< frequency for propagating domains; zero means only preprocessing propagation */
4825  int eagerfreq, /**< frequency for using all instead of only the useful constraints in separation,
4826  * propagation and enforcement, -1 for no eager evaluations, 0 for first only */
4827  int maxprerounds, /**< maximal number of presolving rounds the constraint handler participates in (-1: no limit) */
4828  SCIP_Bool delaysepa, /**< should separation method be delayed, if other separators found cuts? */
4829  SCIP_Bool delayprop, /**< should propagation method be delayed, if other propagators found reductions? */
4830  SCIP_Bool delaypresol, /**< should presolving method be delayed, if other presolvers found reductions? */
4831  SCIP_Bool needscons, /**< should the constraint handler be skipped, if no constraints are available? */
4832  SCIP_PROPTIMING timingmask, /**< positions in the node solving loop where propagators should be executed */
4833  SCIP_DECL_CONSHDLRCOPY((*conshdlrcopy)), /**< copy method of constraint handler or NULL if you don't want to copy your plugin into sub-SCIPs */
4834  SCIP_DECL_CONSFREE ((*consfree)), /**< destructor of constraint handler */
4835  SCIP_DECL_CONSINIT ((*consinit)), /**< initialize constraint handler */
4836  SCIP_DECL_CONSEXIT ((*consexit)), /**< deinitialize constraint handler */
4837  SCIP_DECL_CONSINITPRE ((*consinitpre)), /**< presolving initialization method of constraint handler */
4838  SCIP_DECL_CONSEXITPRE ((*consexitpre)), /**< presolving deinitialization method of constraint handler */
4839  SCIP_DECL_CONSINITSOL ((*consinitsol)), /**< solving process initialization method of constraint handler */
4840  SCIP_DECL_CONSEXITSOL ((*consexitsol)), /**< solving process deinitialization method of constraint handler */
4841  SCIP_DECL_CONSDELETE ((*consdelete)), /**< free specific constraint data */
4842  SCIP_DECL_CONSTRANS ((*constrans)), /**< transform constraint data into data belonging to the transformed problem */
4843  SCIP_DECL_CONSINITLP ((*consinitlp)), /**< initialize LP with relaxations of "initial" constraints */
4844  SCIP_DECL_CONSSEPALP ((*conssepalp)), /**< separate cutting planes for LP solution */
4845  SCIP_DECL_CONSSEPASOL ((*conssepasol)), /**< separate cutting planes for arbitrary primal solution */
4846  SCIP_DECL_CONSENFOLP ((*consenfolp)), /**< enforcing constraints for LP solutions */
4847  SCIP_DECL_CONSENFOPS ((*consenfops)), /**< enforcing constraints for pseudo solutions */
4848  SCIP_DECL_CONSCHECK ((*conscheck)), /**< check feasibility of primal solution */
4849  SCIP_DECL_CONSPROP ((*consprop)), /**< propagate variable domains */
4850  SCIP_DECL_CONSPRESOL ((*conspresol)), /**< presolving method */
4851  SCIP_DECL_CONSRESPROP ((*consresprop)), /**< propagation conflict resolving method */
4852  SCIP_DECL_CONSLOCK ((*conslock)), /**< variable rounding lock method */
4853  SCIP_DECL_CONSACTIVE ((*consactive)), /**< activation notification method */
4854  SCIP_DECL_CONSDEACTIVE((*consdeactive)), /**< deactivation notification method */
4855  SCIP_DECL_CONSENABLE ((*consenable)), /**< enabling notification method */
4856  SCIP_DECL_CONSDISABLE ((*consdisable)), /**< disabling notification method */
4857  SCIP_DECL_CONSDELVARS ((*consdelvars)), /**< variable deletion method */
4858  SCIP_DECL_CONSPRINT ((*consprint)), /**< constraint display method */
4859  SCIP_DECL_CONSCOPY ((*conscopy)), /**< constraint copying method */
4860  SCIP_DECL_CONSPARSE ((*consparse)), /**< constraint parsing method */
4861  SCIP_DECL_CONSGETVARS ((*consgetvars)), /**< constraint get variables method */
4862  SCIP_DECL_CONSGETNVARS((*consgetnvars)), /**< constraint get number of variable method */
4863  SCIP_CONSHDLRDATA* conshdlrdata /**< constraint handler data */
4864  )
4865 {
4866  SCIP_CONSHDLR* conshdlr;
4867 
4868  SCIP_CALL( checkStage(scip, "SCIPincludeConshdlr", TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE) );
4869 
4870  /* check whether constraint handler is already present */
4871  if( SCIPfindConshdlr(scip, name) != NULL )
4872  {
4873  SCIPerrorMessage("constraint handler <%s> already included.\n", name);
4874  return SCIP_INVALIDDATA;
4875  }
4876 
4877  SCIP_CALL( SCIPconshdlrCreate(&conshdlr, scip->set, scip->messagehdlr, scip->mem->setmem,
4878  name, desc, sepapriority, enfopriority, chckpriority, sepafreq, propfreq, eagerfreq, maxprerounds,
4879  delaysepa, delayprop, delaypresol, needscons,
4880  timingmask,
4881  conshdlrcopy,
4882  consfree, consinit, consexit, consinitpre, consexitpre, consinitsol, consexitsol,
4883  consdelete, constrans, consinitlp, conssepalp, conssepasol, consenfolp, consenfops, conscheck, consprop,
4884  conspresol, consresprop, conslock, consactive, consdeactive, consenable, consdisable, consdelvars, consprint,
4885  conscopy, consparse, consgetvars, consgetnvars, conshdlrdata) );
4886  SCIP_CALL( SCIPsetIncludeConshdlr(scip->set, conshdlr) );
4887 
4888  return SCIP_OKAY;
4889 }
4890 
4891 /** creates a constraint handler and includes it in SCIP. All non-fundamental (or optional) callbacks will be set to NULL.
4892  * Optional callbacks can be set via specific setter functions, see SCIPsetConshdlrInit(), SCIPsetConshdlrExit(),
4893  * SCIPsetConshdlrCopy(), SCIPsetConshdlrFree(), SCIPsetConshdlrInitsol(), SCIPsetConshdlrExitsol(),
4894  * SCIPsetConshdlrInitpre(), SCIPsetConshdlrExitpre(), SCIPsetConshdlrPresol(), SCIPsetConshdlrDelete(),
4895  * SCIPsetConshdlrDelvars(), SCIPsetConshdlrInitlp(), SCIPsetConshdlrActive(), SCIPsetConshdlrDeactive(),
4896  * SCIPsetConshdlrEnable(), SCIPsetConshdlrDisable(), SCIPsetConshdlrResprop(), SCIPsetConshdlrTrans(),
4897  * SCIPsetConshdlrPrint(), and SCIPsetConshdlrParse().
4898  *
4899  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
4900  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
4901  *
4902  * @pre This method can be called if SCIP is in one of the following stages:
4903  * - \ref SCIP_STAGE_INIT
4904  * - \ref SCIP_STAGE_PROBLEM
4905  *
4906  * @note if you want to set all callbacks with a single method call, consider using SCIPincludeConshdlr() instead
4907  */
4909  SCIP* scip, /**< SCIP data structure */
4910  SCIP_CONSHDLR** conshdlrptr, /**< reference to a constraint handler pointer, or NULL */
4911  const char* name, /**< name of constraint handler */
4912  const char* desc, /**< description of constraint handler */
4913  int enfopriority, /**< priority of the constraint handler for constraint enforcing */
4914  int chckpriority, /**< priority of the constraint handler for checking feasibility (and propagation) */
4915  int eagerfreq, /**< frequency for using all instead of only the useful constraints in separation,
4916  * propagation and enforcement, -1 for no eager evaluations, 0 for first only */
4917  SCIP_Bool needscons, /**< should the constraint handler be skipped, if no constraints are available? */
4918  SCIP_DECL_CONSENFOLP ((*consenfolp)), /**< enforcing constraints for LP solutions */
4919  SCIP_DECL_CONSENFOPS ((*consenfops)), /**< enforcing constraints for pseudo solutions */
4920  SCIP_DECL_CONSCHECK ((*conscheck)), /**< check feasibility of primal solution */
4921  SCIP_DECL_CONSLOCK ((*conslock)), /**< variable rounding lock method */
4922  SCIP_CONSHDLRDATA* conshdlrdata /**< constraint handler data */
4923  )
4924 {
4925  SCIP_CONSHDLR* conshdlr;
4926 
4927  SCIP_CALL( checkStage(scip, "SCIPincludeConshdlrBasic", TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE) );
4928 
4929  /* check whether constraint handler is already present */
4930  if( SCIPfindConshdlr(scip, name) != NULL )
4931  {
4932  SCIPerrorMessage("constraint handler <%s> already included.\n", name);
4933  return SCIP_INVALIDDATA;
4934  }
4935 
4936  SCIP_CALL( SCIPconshdlrCreate(&conshdlr, scip->set, scip->messagehdlr, scip->mem->setmem,
4937  name, desc, 0, enfopriority, chckpriority, -1, -1, eagerfreq, 0,
4938  FALSE, FALSE, FALSE, needscons,
4940  NULL,
4941  NULL, NULL, NULL, NULL, NULL, NULL, NULL,
4942  NULL, NULL, NULL, NULL, NULL, consenfolp, consenfops, conscheck, NULL,
4943  NULL, NULL, conslock, NULL, NULL, NULL, NULL, NULL, NULL,
4944  NULL, NULL, NULL, NULL, conshdlrdata) );
4945  SCIP_CALL( SCIPsetIncludeConshdlr(scip->set, conshdlr) );
4946 
4947  if( conshdlrptr != NULL )
4948  *conshdlrptr = conshdlr;
4949 
4950  return SCIP_OKAY;
4951 }
4952 
4953 /** sets all separation related callbacks/parameters of the constraint handler
4954  *
4955  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
4956  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
4957  *
4958  * @pre This method can be called if SCIP is in one of the following stages:
4959  * - \ref SCIP_STAGE_INIT
4960  * - \ref SCIP_STAGE_PROBLEM
4961  */
4963  SCIP* scip, /**< SCIP data structure */
4964  SCIP_CONSHDLR* conshdlr, /**< constraint handler */
4965  SCIP_DECL_CONSSEPALP ((*conssepalp)), /**< separate cutting planes for LP solution */
4966  SCIP_DECL_CONSSEPASOL ((*conssepasol)), /**< separate cutting planes for arbitrary primal solution */
4967  int sepafreq, /**< frequency for separating cuts; zero means to separate only in the root node */
4968  int sepapriority, /**< priority of the constraint handler for separation */
4969  SCIP_Bool delaysepa /**< should separation method be delayed, if other separators found cuts? */
4970  )
4971 {
4972  int oldsepapriority;
4973  const char* name;
4974  char paramname[SCIP_MAXSTRLEN];
4975 
4976  assert(scip != NULL);
4977  assert(conshdlr != NULL);
4978 
4979  SCIP_CALL( checkStage(scip, "SCIPsetConshdlrSepa", TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE) );
4980 
4981  oldsepapriority = SCIPconshdlrGetSepaPriority(conshdlr);
4982  SCIPconshdlrSetSepa(conshdlr, conssepalp, conssepasol, sepafreq, sepapriority, delaysepa);
4983 
4984  /* change the position of the constraint handler in the constraint handler array w.r.t. its new sepa priority */
4985  if( oldsepapriority != sepapriority )
4986  SCIPsetReinsertConshdlrSepaPrio(scip->set, conshdlr, oldsepapriority);
4987 
4988  name = SCIPconshdlrGetName(conshdlr);
4989 
4990  (void) SCIPsnprintf(paramname, SCIP_MAXSTRLEN, "constraints/%s/sepafreq", name);
4991  SCIP_CALL( SCIPsetSetDefaultIntParam(scip->set, paramname, sepafreq) );
4992 
4993  (void) SCIPsnprintf(paramname, SCIP_MAXSTRLEN, "constraints/%s/delaysepa", name);
4994  SCIP_CALL( SCIPsetSetDefaultBoolParam(scip->set, paramname, delaysepa) );
4995 
4996  return SCIP_OKAY;
4997 }
4998 
4999 /** sets both the propagation callback and the propagation frequency of the constraint handler
5000  *
5001  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
5002  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
5003  *
5004  * @pre This method can be called if SCIP is in one of the following stages:
5005  * - \ref SCIP_STAGE_INIT
5006  * - \ref SCIP_STAGE_PROBLEM
5007  */
5009  SCIP* scip, /**< SCIP data structure */
5010  SCIP_CONSHDLR* conshdlr, /**< constraint handler */
5011  SCIP_DECL_CONSPROP ((*consprop)), /**< propagate variable domains */
5012  int propfreq, /**< frequency for propagating domains; zero means only preprocessing propagation */
5013  SCIP_Bool delayprop, /**< should propagation method be delayed, if other propagators found reductions? */
5014  SCIP_PROPTIMING timingmask /**< positions in the node solving loop where propagators should be executed */
5015  )
5016 {
5017  const char* name;
5018  char paramname[SCIP_MAXSTRLEN];
5019 
5020  assert(scip != NULL);
5021  assert(conshdlr != NULL);
5022 
5023  SCIP_CALL( checkStage(scip, "SCIPsetConshdlrProp", TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE) );
5024 
5025  SCIPconshdlrSetProp(conshdlr, consprop, propfreq, delayprop, timingmask);
5026 
5027  name = SCIPconshdlrGetName(conshdlr);
5028 
5029  (void) SCIPsnprintf(paramname, SCIP_MAXSTRLEN, "constraints/%s/propfreq", name);
5030  SCIP_CALL( SCIPsetSetDefaultIntParam(scip->set, paramname, propfreq) );
5031 
5032  (void) SCIPsnprintf(paramname, SCIP_MAXSTRLEN, "constraints/%s/timingmask", name);
5033  SCIP_CALL( SCIPsetSetDefaultIntParam(scip->set, paramname, (int) timingmask) );
5034 
5035  (void) SCIPsnprintf(paramname, SCIP_MAXSTRLEN, "constraints/%s/delaysepa", name);
5036  SCIP_CALL( SCIPsetSetDefaultBoolParam(scip->set, paramname, delayprop) );
5037 
5038  return SCIP_OKAY;
5039 }
5040 
5041 /** sets copy method of both the constraint handler and each associated constraint
5042  *
5043  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
5044  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
5045  *
5046  * @pre This method can be called if SCIP is in one of the following stages:
5047  * - \ref SCIP_STAGE_INIT
5048  * - \ref SCIP_STAGE_PROBLEM
5049  */
5051  SCIP* scip, /**< SCIP data structure */
5052  SCIP_CONSHDLR* conshdlr, /**< constraint handler */
5053  SCIP_DECL_CONSHDLRCOPY((*conshdlrcopy)), /**< copy method of constraint handler or NULL if you don't want to copy your plugin into sub-SCIPs */
5054  SCIP_DECL_CONSCOPY ((*conscopy)) /**< constraint copying method */
5055  )
5056 {
5057  SCIP_CALL( checkStage(scip, "SCIPsetConshdlrCopy", TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE) );
5058 
5059  assert(conshdlr != NULL);
5060 
5061  SCIPconshdlrSetCopy(conshdlr, conshdlrcopy, conscopy);
5062 
5063  return SCIP_OKAY;
5064 }
5065 
5066 /** sets destructor method of constraint handler
5067  *
5068  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
5069  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
5070  *
5071  * @pre This method can be called if SCIP is in one of the following stages:
5072  * - \ref SCIP_STAGE_INIT
5073  * - \ref SCIP_STAGE_PROBLEM
5074  */
5076  SCIP* scip, /**< SCIP data structure */
5077  SCIP_CONSHDLR* conshdlr, /**< constraint handler */
5078  SCIP_DECL_CONSFREE ((*consfree)) /**< destructor of constraint handler */
5079  )
5080 {
5081  SCIP_CALL( checkStage(scip, "SCIPsetConshdlrFree", TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE) );
5082 
5083  assert(conshdlr != NULL);
5084 
5085  SCIPconshdlrSetFree(conshdlr, consfree);
5086 
5087  return SCIP_OKAY;
5088 }
5089 
5090 /** sets initialization method of constraint handler
5091  *
5092  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
5093  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
5094  *
5095  * @pre This method can be called if SCIP is in one of the following stages:
5096  * - \ref SCIP_STAGE_INIT
5097  * - \ref SCIP_STAGE_PROBLEM
5098  */
5100  SCIP* scip, /**< SCIP data structure */
5101  SCIP_CONSHDLR* conshdlr, /**< constraint handler */
5102  SCIP_DECL_CONSINIT ((*consinit)) /**< initialize constraint handler */
5103  )
5104 {
5105  SCIP_CALL( checkStage(scip, "SCIPsetConshdlrInit", TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE) );
5106 
5107  assert(conshdlr != NULL);
5108 
5109  SCIPconshdlrSetInit(conshdlr, consinit);
5110 
5111  return SCIP_OKAY;
5112 }
5113 
5114 /** sets deinitialization method of constraint handler
5115  *
5116  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
5117  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
5118  *
5119  * @pre This method can be called if SCIP is in one of the following stages:
5120  * - \ref SCIP_STAGE_INIT
5121  * - \ref SCIP_STAGE_PROBLEM
5122  */
5124  SCIP* scip, /**< SCIP data structure */
5125  SCIP_CONSHDLR* conshdlr, /**< constraint handler */
5126  SCIP_DECL_CONSEXIT ((*consexit)) /**< deinitialize constraint handler */
5127  )
5128 {
5129  SCIP_CALL( checkStage(scip, "SCIPsetConshdlrExit", TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE) );
5130 
5131  assert(conshdlr != NULL);
5132 
5133  SCIPconshdlrSetExit(conshdlr, consexit);
5134 
5135  return SCIP_OKAY;
5136 }
5137 
5138 /** sets solving process initialization method of constraint handler
5139  *
5140  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
5141  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
5142  *
5143  * @pre This method can be called if SCIP is in one of the following stages:
5144  * - \ref SCIP_STAGE_INIT
5145  * - \ref SCIP_STAGE_PROBLEM
5146  */
5148  SCIP* scip, /**< SCIP data structure */
5149  SCIP_CONSHDLR* conshdlr, /**< constraint handler */
5150  SCIP_DECL_CONSINITSOL((*consinitsol)) /**< solving process initialization method of constraint handler */
5151  )
5152 {
5153  SCIP_CALL( checkStage(scip, "SCIPsetConshdlrInitsol", TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE) );
5154 
5155  assert(conshdlr != NULL);
5156 
5157  SCIPconshdlrSetInitsol(conshdlr, consinitsol);
5158 
5159  return SCIP_OKAY;
5160 }
5161 
5162 /** sets solving process deinitialization method of constraint handler
5163  *
5164  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
5165  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
5166  *
5167  * @pre This method can be called if SCIP is in one of the following stages:
5168  * - \ref SCIP_STAGE_INIT
5169  * - \ref SCIP_STAGE_PROBLEM
5170  */
5172  SCIP* scip, /**< SCIP data structure */
5173  SCIP_CONSHDLR* conshdlr, /**< constraint handler */
5174  SCIP_DECL_CONSEXITSOL ((*consexitsol))/**< solving process deinitialization method of constraint handler */
5175  )
5176 {
5177  SCIP_CALL( checkStage(scip, "SCIPsetConshdlrExitsol", TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE) );
5178 
5179  assert(conshdlr != NULL);
5180 
5181  SCIPconshdlrSetExitsol(conshdlr, consexitsol);
5182 
5183  return SCIP_OKAY;
5184 }
5185 
5186 /** sets preprocessing initialization method of constraint handler
5187  *
5188  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
5189  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
5190  *
5191  * @pre This method can be called if SCIP is in one of the following stages:
5192  * - \ref SCIP_STAGE_INIT
5193  * - \ref SCIP_STAGE_PROBLEM
5194  */
5196  SCIP* scip, /**< SCIP data structure */
5197  SCIP_CONSHDLR* conshdlr, /**< constraint handler */
5198  SCIP_DECL_CONSINITPRE((*consinitpre)) /**< preprocessing initialization method of constraint handler */
5199  )
5200 {
5201  SCIP_CALL( checkStage(scip, "SCIPsetConshdlrInitpre", TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE) );
5202 
5203  assert(conshdlr != NULL);
5204 
5205  SCIPconshdlrSetInitpre(conshdlr, consinitpre);
5206 
5207  return SCIP_OKAY;
5208 }
5209 
5210 /** sets preprocessing deinitialization method of constraint handler
5211  *
5212  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
5213  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
5214  *
5215  * @pre This method can be called if SCIP is in one of the following stages:
5216  * - \ref SCIP_STAGE_INIT
5217  * - \ref SCIP_STAGE_PROBLEM
5218  */
5220  SCIP* scip, /**< SCIP data structure */
5221  SCIP_CONSHDLR* conshdlr, /**< constraint handler */
5222  SCIP_DECL_CONSEXITPRE((*consexitpre)) /**< preprocessing deinitialization method of constraint handler */
5223  )
5224 {
5225  SCIP_CALL( checkStage(scip, "SCIPsetConshdlrExitpre", TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE) );
5226 
5227  assert(conshdlr != NULL);
5228 
5229  SCIPconshdlrSetExitpre(conshdlr, consexitpre);
5230 
5231  return SCIP_OKAY;
5232 }
5233 
5234 /** sets presolving method of constraint handler
5235  *
5236  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
5237  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
5238  *
5239  * @pre This method can be called if SCIP is in one of the following stages:
5240  * - \ref SCIP_STAGE_INIT
5241  * - \ref SCIP_STAGE_PROBLEM
5242  */
5244  SCIP* scip, /**< SCIP data structure */
5245  SCIP_CONSHDLR* conshdlr, /**< constraint handler */
5246  SCIP_DECL_CONSPRESOL ((*conspresol)), /**< presolving method of constraint handler */
5247  int maxprerounds, /**< maximal number of presolving rounds the constraint handler participates in (-1: no limit) */
5248  SCIP_Bool delaypresol /**< should presolving method be delayed, if other presolvers found reductions? */
5249  )
5250 {
5251  const char* name;
5252  char paramname[SCIP_MAXSTRLEN];
5253 
5254  assert(scip != NULL);
5255  assert(conshdlr != NULL);
5256 
5257  SCIP_CALL( checkStage(scip, "SCIPsetConshdlrPresol", TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE) );
5258 
5259  SCIPconshdlrSetPresol(conshdlr, conspresol, maxprerounds, delaypresol);
5260 
5261  name = SCIPconshdlrGetName(conshdlr);
5262 
5263  (void) SCIPsnprintf(paramname, SCIP_MAXSTRLEN, "constraints/%s/maxprerounds", name);
5264  SCIP_CALL( SCIPsetSetDefaultIntParam(scip->set, paramname, maxprerounds) );
5265 
5266  (void) SCIPsnprintf(paramname, SCIP_MAXSTRLEN, "constraints/%s/delaypresol", name);
5267  SCIP_CALL( SCIPsetSetDefaultBoolParam(scip->set, paramname, delaypresol) );
5268 
5269  return SCIP_OKAY;
5270 }
5271 
5272 /** sets method of constraint handler to free specific constraint data
5273  *
5274  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
5275  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
5276  *
5277  * @pre This method can be called if SCIP is in one of the following stages:
5278  * - \ref SCIP_STAGE_INIT
5279  * - \ref SCIP_STAGE_PROBLEM
5280  */
5282  SCIP* scip, /**< SCIP data structure */
5283  SCIP_CONSHDLR* conshdlr, /**< constraint handler */
5284  SCIP_DECL_CONSDELETE ((*consdelete)) /**< free specific constraint data */
5285  )
5286 {
5287  assert(scip != NULL);
5288  SCIP_CALL( checkStage(scip, "SCIPsetConshdlrDelete", TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE) );
5289 
5290  SCIPconshdlrSetDelete(conshdlr, consdelete);
5291 
5292  return SCIP_OKAY;
5293 }
5294 
5295 /** sets method of constraint handler to transform constraint data into data belonging to the transformed problem
5296  *
5297  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
5298  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
5299  *
5300  * @pre This method can be called if SCIP is in one of the following stages:
5301  * - \ref SCIP_STAGE_INIT
5302  * - \ref SCIP_STAGE_PROBLEM
5303  */
5305  SCIP* scip, /**< SCIP data structure */
5306  SCIP_CONSHDLR* conshdlr, /**< constraint handler */
5307  SCIP_DECL_CONSTRANS ((*constrans)) /**< transform constraint data into data belonging to the transformed problem */
5308  )
5309 {
5310  assert(scip != NULL);
5311  SCIP_CALL( checkStage(scip, "SCIPsetConshdlrTrans", TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE) );
5312 
5313  SCIPconshdlrSetTrans(conshdlr, constrans);
5314 
5315  return SCIP_OKAY;
5316 }
5317 
5318 /** sets method of constraint handler to initialize LP with relaxations of "initial" constraints
5319  *
5320  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
5321  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
5322  *
5323  * @pre This method can be called if SCIP is in one of the following stages:
5324  * - \ref SCIP_STAGE_INIT
5325  * - \ref SCIP_STAGE_PROBLEM
5326  */
5328  SCIP* scip, /**< SCIP data structure */
5329  SCIP_CONSHDLR* conshdlr, /**< constraint handler */
5330  SCIP_DECL_CONSINITLP ((*consinitlp)) /**< initialize LP with relaxations of "initial" constraints */
5331  )
5332 {
5333  assert(scip != NULL);
5334  SCIP_CALL( checkStage(scip, "SCIPsetConshdlrInitlp", TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE) );
5335 
5336  SCIPconshdlrSetInitlp(conshdlr, consinitlp);
5337 
5338  return SCIP_OKAY;
5339 }
5340 
5341 /** sets propagation conflict resolving method of constraint handler
5342  *
5343  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
5344  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
5345  *
5346  * @pre This method can be called if SCIP is in one of the following stages:
5347  * - \ref SCIP_STAGE_INIT
5348  * - \ref SCIP_STAGE_PROBLEM
5349  */
5351  SCIP* scip, /**< SCIP data structure */
5352  SCIP_CONSHDLR* conshdlr, /**< constraint handler */
5353  SCIP_DECL_CONSRESPROP ((*consresprop)) /**< propagation conflict resolving method */
5354  )
5355 {
5356  assert(scip != NULL);
5357  SCIP_CALL( checkStage(scip, "SCIPsetConshdlrResprop", TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE) );
5358 
5359  SCIPconshdlrSetResprop(conshdlr, consresprop);
5360 
5361  return SCIP_OKAY;
5362 }
5363 
5364 /** sets activation notification method of constraint handler
5365  *
5366  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
5367  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
5368  *
5369  * @pre This method can be called if SCIP is in one of the following stages:
5370  * - \ref SCIP_STAGE_INIT
5371  * - \ref SCIP_STAGE_PROBLEM
5372  */
5374  SCIP* scip, /**< SCIP data structure */
5375  SCIP_CONSHDLR* conshdlr, /**< constraint handler */
5376  SCIP_DECL_CONSACTIVE ((*consactive)) /**< activation notification method */
5377  )
5378 {
5379  assert(scip != NULL);
5380  SCIP_CALL( checkStage(scip, "SCIPsetConshdlrActive", TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE) );
5381 
5382  SCIPconshdlrSetActive(conshdlr, consactive);
5383 
5384  return SCIP_OKAY;
5385 }
5386 
5387 /** sets deactivation notification method of constraint handler
5388  *
5389  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
5390  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
5391  *
5392  * @pre This method can be called if SCIP is in one of the following stages:
5393  * - \ref SCIP_STAGE_INIT
5394  * - \ref SCIP_STAGE_PROBLEM
5395  */
5397  SCIP* scip, /**< SCIP data structure */
5398  SCIP_CONSHDLR* conshdlr, /**< constraint handler */
5399  SCIP_DECL_CONSDEACTIVE((*consdeactive)) /**< deactivation notification method */
5400  )
5401 {
5402  assert(scip != NULL);
5403  SCIP_CALL( checkStage(scip, "SCIPsetConshdlrDeactive", TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE) );
5404 
5405  SCIPconshdlrSetDeactive(conshdlr, consdeactive);
5406 
5407  return SCIP_OKAY;
5408 }
5409 
5410 /** sets enabling notification method of constraint handler
5411  *
5412  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
5413  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
5414  *
5415  * @pre This method can be called if SCIP is in one of the following stages:
5416  * - \ref SCIP_STAGE_INIT
5417  * - \ref SCIP_STAGE_PROBLEM
5418  */
5420  SCIP* scip, /**< SCIP data structure */
5421  SCIP_CONSHDLR* conshdlr, /**< constraint handler */
5422  SCIP_DECL_CONSENABLE ((*consenable)) /**< enabling notification method */
5423  )
5424 {
5425  assert(scip != NULL);
5426  SCIP_CALL( checkStage(scip, "SCIPsetConshdlrEnable", TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE) );
5427 
5428  SCIPconshdlrSetEnable(conshdlr, consenable);
5429 
5430  return SCIP_OKAY;
5431 }
5432 
5433 /** sets disabling notification method of constraint handler
5434  *
5435  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
5436  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
5437  *
5438  * @pre This method can be called if SCIP is in one of the following stages:
5439  * - \ref SCIP_STAGE_INIT
5440  * - \ref SCIP_STAGE_PROBLEM
5441  */
5443  SCIP* scip, /**< SCIP data structure */
5444  SCIP_CONSHDLR* conshdlr, /**< constraint handler */
5445  SCIP_DECL_CONSDISABLE ((*consdisable)) /**< disabling notification method */
5446  )
5447 {
5448  assert(scip != NULL);
5449  SCIP_CALL( checkStage(scip, "SCIPsetConshdlrDisable", TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE) );
5450 
5451  SCIPconshdlrSetDisable(conshdlr, consdisable);
5452 
5453  return SCIP_OKAY;
5454 }
5455 
5456 /** sets variable deletion method of constraint handler
5457  *
5458  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
5459  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
5460  *
5461  * @pre This method can be called if SCIP is in one of the following stages:
5462  * - \ref SCIP_STAGE_INIT
5463  * - \ref SCIP_STAGE_PROBLEM
5464  */
5466  SCIP* scip, /**< SCIP data structure */
5467  SCIP_CONSHDLR* conshdlr, /**< constraint handler */
5468  SCIP_DECL_CONSDELVARS ((*consdelvars)) /**< variable deletion method */
5469  )
5470 {
5471  assert(scip != NULL);
5472  SCIP_CALL( checkStage(scip, "SCIPsetConshdlrDelvars", TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE) );
5473 
5474  SCIPconshdlrSetDelvars(conshdlr, consdelvars);
5475 
5476  return SCIP_OKAY;
5477 }
5478 
5479 /** sets constraint display method of constraint handler
5480  *
5481  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
5482  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
5483  *
5484  * @pre This method can be called if SCIP is in one of the following stages:
5485  * - \ref SCIP_STAGE_INIT
5486  * - \ref SCIP_STAGE_PROBLEM
5487  */
5489  SCIP* scip, /**< SCIP data structure */
5490  SCIP_CONSHDLR* conshdlr, /**< constraint handler */
5491  SCIP_DECL_CONSPRINT ((*consprint)) /**< constraint display method */
5492  )
5493 {
5494  assert(scip != NULL);
5495  SCIP_CALL( checkStage(scip, "SCIPsetConshdlrPrint", TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE) );
5496 
5497  SCIPconshdlrSetPrint(conshdlr, consprint);
5498 
5499  return SCIP_OKAY;
5500 }
5501 
5502 /** sets constraint parsing method of constraint handler
5503  *
5504  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
5505  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
5506  *
5507  * @pre This method can be called if SCIP is in one of the following stages:
5508  * - \ref SCIP_STAGE_INIT
5509  * - \ref SCIP_STAGE_PROBLEM
5510  */
5512  SCIP* scip, /**< SCIP data structure */
5513  SCIP_CONSHDLR* conshdlr, /**< constraint handler */
5514  SCIP_DECL_CONSPARSE ((*consparse)) /**< constraint parsing method */
5515  )
5516 {
5517  assert(scip != NULL);
5518  SCIP_CALL( checkStage(scip, "SCIPsetConshdlrParse", TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE) );
5519 
5520  SCIPconshdlrSetParse(conshdlr, consparse);
5521 
5522  return SCIP_OKAY;
5523 }
5524 
5525 /** sets constraint variable getter method of constraint handler
5526  *
5527  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
5528  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
5529  *
5530  * @pre This method can be called if SCIP is in one of the following stages:
5531  * - \ref SCIP_STAGE_INIT
5532  * - \ref SCIP_STAGE_PROBLEM
5533  */
5535  SCIP* scip, /**< SCIP data structure */
5536  SCIP_CONSHDLR* conshdlr, /**< constraint handler */
5537  SCIP_DECL_CONSGETVARS ((*consgetvars)) /**< constraint variable getter method */
5538  )
5539 {
5540  assert(scip != NULL);
5541  SCIP_CALL( checkStage(scip, "SCIPsetConshdlrGetVars", TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE) );
5542 
5543  SCIPconshdlrSetGetVars(conshdlr, consgetvars);
5544 
5545  return SCIP_OKAY;
5546 }
5547 
5548 /** sets constraint variable number getter method of constraint handler
5549  *
5550  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
5551  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
5552  *
5553  * @pre This method can be called if SCIP is in one of the following stages:
5554  * - \ref SCIP_STAGE_INIT
5555  * - \ref SCIP_STAGE_PROBLEM
5556  */
5558  SCIP* scip, /**< SCIP data structure */
5559  SCIP_CONSHDLR* conshdlr, /**< constraint handler */
5560  SCIP_DECL_CONSGETNVARS((*consgetnvars)) /**< constraint variable number getter method */
5561  )
5562 {
5563  assert(scip != NULL);
5564  SCIP_CALL( checkStage(scip, "SCIPsetConshdlrGetNVars", TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE) );
5565 
5566  SCIPconshdlrSetGetNVars(conshdlr, consgetnvars);
5567 
5568  return SCIP_OKAY;
5569 }
5570 
5571 /** returns the constraint handler of the given name, or NULL if not existing */
5573  SCIP* scip, /**< SCIP data structure */
5574  const char* name /**< name of constraint handler */
5575  )
5576 {
5577  assert(scip != NULL);
5578  assert(scip->set != NULL);
5579  assert(name != NULL);
5580 
5581  return SCIPsetFindConshdlr(scip->set, name);
5582 }
5583 
5584 /** returns the array of currently available constraint handlers */
5586  SCIP* scip /**< SCIP data structure */
5587  )
5588 {
5589  assert(scip != NULL);
5590  assert(scip->set != NULL);
5591 
5592  return scip->set->conshdlrs;
5593 }
5594 
5595 /** returns the number of currently available constraint handlers */
5597  SCIP* scip /**< SCIP data structure */
5598  )
5599 {
5600  assert(scip != NULL);
5601  assert(scip->set != NULL);
5602 
5603  return scip->set->nconshdlrs;
5604 }
5605 
5606 /** creates a conflict handler and includes it in SCIP
5607  *
5608  * @note method has all conflict handler callbacks as arguments and is thus changed every time a new
5609  * callback is added
5610  * in future releases; consider using SCIPincludeConflicthdlrBasic() and setter functions
5611  * if you seek for a method which is less likely to change in future releases
5612  */
5614  SCIP* scip, /**< SCIP data structure */
5615  const char* name, /**< name of conflict handler */
5616  const char* desc, /**< description of conflict handler */
5617  int priority, /**< priority of the conflict handler */
5618  SCIP_DECL_CONFLICTCOPY((*conflictcopy)), /**< copy method of conflict handler or NULL if you don't want to copy your plugin into sub-SCIPs */
5619  SCIP_DECL_CONFLICTFREE((*conflictfree)), /**< destructor of conflict handler */
5620  SCIP_DECL_CONFLICTINIT((*conflictinit)), /**< initialize conflict handler */
5621  SCIP_DECL_CONFLICTEXIT((*conflictexit)), /**< deinitialize conflict handler */
5622  SCIP_DECL_CONFLICTINITSOL((*conflictinitsol)),/**< solving process initialization method of conflict handler */
5623  SCIP_DECL_CONFLICTEXITSOL((*conflictexitsol)),/**< solving process deinitialization method of conflict handler */
5624  SCIP_DECL_CONFLICTEXEC((*conflictexec)), /**< conflict processing method of conflict handler */
5625  SCIP_CONFLICTHDLRDATA* conflicthdlrdata /**< conflict handler data */
5626  )
5627 {
5628  SCIP_CONFLICTHDLR* conflicthdlr;
5629 
5630  SCIP_CALL( checkStage(scip, "SCIPincludeConflicthdlr", TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE) );
5631 
5632  /* check whether conflict handler is already present */
5633  if( SCIPfindConflicthdlr(scip, name) != NULL )
5634  {
5635  SCIPerrorMessage("conflict handler <%s> already included.\n", name);
5636  return SCIP_INVALIDDATA;
5637  }
5638 
5639  SCIP_CALL( SCIPconflicthdlrCreate(&conflicthdlr, scip->set, scip->messagehdlr, scip->mem->setmem, name, desc, priority,
5640  conflictcopy,
5641  conflictfree, conflictinit, conflictexit, conflictinitsol, conflictexitsol, conflictexec,
5642  conflicthdlrdata) );
5643  SCIP_CALL( SCIPsetIncludeConflicthdlr(scip->set, conflicthdlr) );
5644 
5645  return SCIP_OKAY;
5646 }
5647 
5648 /** creates a conflict handler and includes it in SCIP with its most fundamental callbacks. All non-fundamental
5649  * (or optional) callbacks as, e.g., init and exit callbacks, will be set to NULL.
5650  * Optional callbacks can be set via specific setter functions SCIPsetConflicthdlrCopy(), SCIPsetConflicthdlrFree(),
5651  * SCIPsetConflicthdlrInit(), SCIPsetConflicthdlrExit(), SCIPsetConflicthdlrInitsol(),
5652  * and SCIPsetConflicthdlrExitsol()
5653  *
5654  * @note if you want to set all callbacks with a single method call, consider using SCIPincludeConflicthdlr() instead
5655  */
5657  SCIP* scip, /**< SCIP data structure */
5658  SCIP_CONFLICTHDLR** conflicthdlrptr, /**< reference to a conflict handler pointer, or NULL */
5659  const char* name, /**< name of conflict handler */
5660  const char* desc, /**< description of conflict handler */
5661  int priority, /**< priority of the conflict handler */
5662  SCIP_DECL_CONFLICTEXEC((*conflictexec)), /**< conflict processing method of conflict handler */
5663  SCIP_CONFLICTHDLRDATA* conflicthdlrdata /**< conflict handler data */
5664  )
5665 {
5666  SCIP_CONFLICTHDLR* conflicthdlr;
5667 
5668  SCIP_CALL( checkStage(scip, "SCIPincludeConflicthdlrBasic", TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE) );
5669 
5670  /* check whether conflict handler is already present */
5671  if( SCIPfindConflicthdlr(scip, name) != NULL )
5672  {
5673  SCIPerrorMessage("conflict handler <%s> already included.\n", name);
5674  return SCIP_INVALIDDATA;
5675  }
5676 
5677  SCIP_CALL( SCIPconflicthdlrCreate(&conflicthdlr, scip->set, scip->messagehdlr, scip->mem->setmem, name, desc, priority,
5678  NULL, NULL, NULL, NULL, NULL, NULL, conflictexec, conflicthdlrdata) );
5679  SCIP_CALL( SCIPsetIncludeConflicthdlr(scip->set, conflicthdlr) );
5680 
5681  if( conflicthdlrptr != NULL )
5682  *conflicthdlrptr = conflicthdlr;
5683 
5684  return SCIP_OKAY;
5685 }
5686 
5687 /** set copy method of conflict handler */
5689  SCIP* scip, /**< SCIP data structure */
5690  SCIP_CONFLICTHDLR* conflicthdlr, /**< conflict handler */
5691  SCIP_DECL_CONFLICTCOPY((*conflictcopy)) /**< copy method of conflict handler */
5692  )
5693 {
5694  assert(scip != NULL);
5695 
5696  SCIP_CALL( checkStage(scip, "SCIPsetConflicthdlrCopy", TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE) );
5697 
5698  SCIPconflicthdlrSetCopy(conflicthdlr, conflictcopy);
5699 
5700  return SCIP_OKAY;
5701 }
5702 
5703 /** set destructor of conflict handler */
5705  SCIP* scip, /**< SCIP data structure */
5706  SCIP_CONFLICTHDLR* conflicthdlr, /**< conflict handler */
5707  SCIP_DECL_CONFLICTFREE((*conflictfree)) /**< destructor of conflict handler */
5708  )
5709 {
5710  assert(scip != NULL);
5711 
5712  SCIP_CALL( checkStage(scip, "SCIPsetConflicthdlrFree", TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE) );
5713 
5714  SCIPconflicthdlrSetFree(conflicthdlr, conflictfree);
5715 
5716  return SCIP_OKAY;
5717 }
5718 
5719 /** set initialization method of conflict handler */
5721  SCIP* scip, /**< SCIP data structure */
5722  SCIP_CONFLICTHDLR* conflicthdlr, /**< conflict handler */
5723  SCIP_DECL_CONFLICTINIT((*conflictinit)) /**< initialize conflict handler */
5724  )
5725 {
5726  assert(scip != NULL);
5727 
5728  SCIP_CALL( checkStage(scip, "SCIPsetConflicthdlrInit", TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE) );
5729 
5730  SCIPconflicthdlrSetInit(conflicthdlr, conflictinit);
5731 
5732  return SCIP_OKAY;
5733 }
5734 
5735 /** set deinitialization method of conflict handler */
5737  SCIP* scip, /**< SCIP data structure */
5738  SCIP_CONFLICTHDLR* conflicthdlr, /**< conflict handler */
5739  SCIP_DECL_CONFLICTEXIT((*conflictexit)) /**< deinitialize conflict handler */
5740  )
5741 {
5742  assert(scip != NULL);
5743 
5744  SCIP_CALL( checkStage(scip, "SCIPsetConflicthdlrExit", TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE) );
5745 
5746  SCIPconflicthdlrSetExit(conflicthdlr, conflictexit);
5747 
5748  return SCIP_OKAY;
5749 }
5750 
5751 /** set solving process initialization method of conflict handler */
5753  SCIP* scip, /**< SCIP data structure */
5754  SCIP_CONFLICTHDLR* conflicthdlr, /**< conflict handler */
5755  SCIP_DECL_CONFLICTINITSOL((*conflictinitsol))/**< solving process initialization method of conflict handler */
5756  )
5757 {
5758  assert(scip != NULL);
5759 
5760  SCIP_CALL( checkStage(scip, "SCIPsetConflicthdlrInitsol", TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE) );
5761 
5762  SCIPconflicthdlrSetInitsol(conflicthdlr, conflictinitsol);
5763 
5764  return SCIP_OKAY;
5765 }
5766 
5767 /** set solving process deinitialization method of conflict handler */
5769  SCIP* scip, /**< SCIP data structure */
5770  SCIP_CONFLICTHDLR* conflicthdlr, /**< conflict handler */
5771  SCIP_DECL_CONFLICTEXITSOL((*conflictexitsol))/**< solving process deinitialization method of conflict handler */
5772  )
5773 {
5774  assert(scip != NULL);
5775 
5776  SCIP_CALL( checkStage(scip, "SCIPsetConflicthdlrExitsol", TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE) );
5777 
5778  SCIPconflicthdlrSetExitsol(conflicthdlr, conflictexitsol);
5779 
5780  return SCIP_OKAY;
5781 }
5782 
5783 /** returns the conflict handler of the given name, or NULL if not existing */
5785  SCIP* scip, /**< SCIP data structure */
5786  const char* name /**< name of conflict handler */
5787  )
5788 {
5789  assert(scip != NULL);
5790  assert(scip->set != NULL);
5791  assert(name != NULL);
5792 
5793  return SCIPsetFindConflicthdlr(scip->set, name);
5794 }
5795 
5796 /** returns the array of currently available conflict handlers */
5798  SCIP* scip /**< SCIP data structure */
5799  )
5800 {
5801  assert(scip != NULL);
5802  assert(scip->set != NULL);
5803 
5805 
5806  return scip->set->conflicthdlrs;
5807 }
5808 
5809 /** returns the number of currently available conflict handlers */
5811  SCIP* scip /**< SCIP data structure */
5812  )
5813 {
5814  assert(scip != NULL);
5815  assert(scip->set != NULL);
5816 
5817  return scip->set->nconflicthdlrs;
5818 }
5819 
5820 /** sets the priority of a conflict handler */
5822  SCIP* scip, /**< SCIP data structure */
5823  SCIP_CONFLICTHDLR* conflicthdlr, /**< conflict handler */
5824  int priority /**< new priority of the conflict handler */
5825  )
5826 {
5827  assert(scip != NULL);
5828  assert(scip->set != NULL);
5829 
5830  SCIPconflicthdlrSetPriority(conflicthdlr, scip->set, priority);
5831 
5832  return SCIP_OKAY;
5833 }
5834 
5835 /** creates a presolver and includes it in SCIP.
5836  *
5837  * @note method has all presolver callbacks as arguments and is thus changed every time a new
5838  * callback is added
5839  * in future releases; consider using SCIPincludePresolBasic() and setter functions
5840  * if you seek for a method which is less likely to change in future releases
5841  */
5843  SCIP* scip, /**< SCIP data structure */
5844  const char* name, /**< name of presolver */
5845  const char* desc, /**< description of presolver */
5846  int priority, /**< priority of the presolver (>= 0: before, < 0: after constraint handlers) */
5847  int maxrounds, /**< maximal number of presolving rounds the presolver participates in (-1: no limit) */
5848  SCIP_Bool delay, /**< should presolver be delayed, if other presolvers found reductions? */
5849  SCIP_DECL_PRESOLCOPY ((*presolcopy)), /**< copy method of presolver or NULL if you don't want to copy your plugin into sub-SCIPs */
5850  SCIP_DECL_PRESOLFREE ((*presolfree)), /**< destructor of presolver to free user data (called when SCIP is exiting) */
5851  SCIP_DECL_PRESOLINIT ((*presolinit)), /**< initialization method of presolver (called after problem was transformed) */
5852  SCIP_DECL_PRESOLEXIT ((*presolexit)), /**< deinitialization method of presolver (called before transformed problem is freed) */
5853  SCIP_DECL_PRESOLINITPRE((*presolinitpre)),/**< presolving initialization method of presolver (called when presolving is about to begin) */
5854  SCIP_DECL_PRESOLEXITPRE((*presolexitpre)),/**< presolving deinitialization method of presolver (called after presolving has been finished) */
5855  SCIP_DECL_PRESOLEXEC ((*presolexec)), /**< execution method of presolver */
5856  SCIP_PRESOLDATA* presoldata /**< presolver data */
5857  )
5858 {
5859  SCIP_PRESOL* presol;
5860 
5861  SCIP_CALL( checkStage(scip, "SCIPincludePresol", TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE) );
5862 
5863  /* check whether presolver is already present */
5864  if( SCIPfindPresol(scip, name) != NULL )
5865  {
5866  SCIPerrorMessage("presolver <%s> already included.\n", name);
5867  return SCIP_INVALIDDATA;
5868  }
5869 
5870  SCIP_CALL( SCIPpresolCreate(&presol, scip->set, scip->messagehdlr, scip->mem->setmem, name, desc, priority, maxrounds, delay,
5871  presolcopy,
5872  presolfree, presolinit, presolexit, presolinitpre, presolexitpre, presolexec, presoldata) );
5873  SCIP_CALL( SCIPsetIncludePresol(scip->set, presol) );
5874 
5875  return SCIP_OKAY;
5876 }
5877 
5878 /** creates a presolver and includes it in SCIP with its fundamental callback. All non-fundamental (or optional)
5879  * callbacks as, e.g., init and exit callbacks, will be set to NULL. Optional callbacks can be set via specific setter
5880  * functions. These are SCIPsetPresolCopy(), SCIPsetPresolFree(), SCIPsetPresolInit(), SCIPsetPresolExit(),
5881  * SCIPsetPresolInitpre(), and SCIPsetPresolExitPre().
5882  *
5883  * @note if you want to set all callbacks with a single method call, consider using SCIPincludePresol() instead
5884  */
5886  SCIP* scip, /**< SCIP data structure */
5887  SCIP_PRESOL** presolptr, /**< reference to presolver, or NULL */
5888  const char* name, /**< name of presolver */
5889  const char* desc, /**< description of presolver */
5890  int priority, /**< priority of the presolver (>= 0: before, < 0: after constraint handlers) */
5891  int maxrounds, /**< maximal number of presolving rounds the presolver participates in (-1: no limit) */
5892  SCIP_Bool delay, /**< should presolver be delayed, if other presolvers found reductions? */
5893  SCIP_DECL_PRESOLEXEC ((*presolexec)), /**< execution method of presolver */
5894  SCIP_PRESOLDATA* presoldata /**< presolver data */
5895  )
5896 {
5897  SCIP_PRESOL* presol;
5898 
5899  SCIP_CALL( checkStage(scip, "SCIPincludePresolBasic", TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE) );
5900 
5901  /* check whether presolver is already present */
5902  if( SCIPfindPresol(scip, name) != NULL )
5903  {
5904  SCIPerrorMessage("presolver <%s> already included.\n", name);
5905  return SCIP_INVALIDDATA;
5906  }
5907 
5908  SCIP_CALL( SCIPpresolCreate(&presol, scip->set, scip->messagehdlr, scip->mem->setmem, name, desc, priority, maxrounds, delay,
5909  NULL,
5910  NULL, NULL, NULL, NULL, NULL, presolexec, presoldata) );
5911  SCIP_CALL( SCIPsetIncludePresol(scip->set, presol) );
5912 
5913  if( presolptr != NULL )
5914  *presolptr = presol;
5915 
5916  return SCIP_OKAY;
5917 }
5918 
5919 /** sets copy method of presolver */
5921  SCIP* scip, /**< SCIP data structure */
5922  SCIP_PRESOL* presol, /**< presolver */
5923  SCIP_DECL_PRESOLCOPY ((*presolcopy)) /**< copy method of presolver or NULL if you don't want to copy your plugin into sub-SCIPs */
5924  )
5925 {
5926  SCIP_CALL( checkStage(scip, "SCIPsetPresolCopy", TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE) );
5927 
5928  assert(presol != NULL);
5929 
5930  SCIPpresolSetCopy(presol, presolcopy);
5931 
5932  return SCIP_OKAY;
5933 }
5934 
5935 /** sets destructor method of presolver */
5937  SCIP* scip, /**< SCIP data structure */
5938  SCIP_PRESOL* presol, /**< presolver */
5939  SCIP_DECL_PRESOLFREE ((*presolfree)) /**< destructor of presolver */
5940  )
5941 {
5942  SCIP_CALL( checkStage(scip, "SCIPsetPresolFree", TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE) );
5943 
5944  assert(presol != NULL);
5945 
5946  SCIPpresolSetFree(presol, presolfree);
5947 
5948  return SCIP_OKAY;
5949 }
5950 
5951 /** sets initialization method of presolver */
5953  SCIP* scip, /**< SCIP data structure */
5954  SCIP_PRESOL* presol, /**< presolver */
5955  SCIP_DECL_PRESOLINIT ((*presolinit)) /**< initialize presolver */
5956  )
5957 {
5958  SCIP_CALL( checkStage(scip, "SCIPsetPresolInit", TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE) );
5959 
5960  assert(presol != NULL);
5961 
5962  SCIPpresolSetInit(presol, presolinit);
5963 
5964  return SCIP_OKAY;
5965 }
5966 
5967 /** sets deinitialization method of presolver */
5969  SCIP* scip, /**< SCIP data structure */
5970  SCIP_PRESOL* presol, /**< presolver */
5971  SCIP_DECL_PRESOLEXIT ((*presolexit)) /**< deinitialize presolver */
5972  )
5973 {
5974  SCIP_CALL( checkStage(scip, "SCIPsetPresolExit", TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE) );
5975 
5976  assert(presol != NULL);
5977 
5978  SCIPpresolSetExit(presol, presolexit);
5979 
5980  return SCIP_OKAY;
5981 }
5982 
5983 /** sets solving process initialization method of presolver */
5985  SCIP* scip, /**< SCIP data structure */
5986  SCIP_PRESOL* presol, /**< presolver */
5987  SCIP_DECL_PRESOLINITPRE ((*presolinitpre))/**< solving process initialization method of presolver */
5988  )
5989 {
5990  SCIP_CALL( checkStage(scip, "SCIPsetPresolInitpre", TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE) );
5991 
5992  assert(presol != NULL);
5993 
5994  SCIPpresolSetInitpre(presol, presolinitpre);
5995 
5996  return SCIP_OKAY;
5997 }
5998 
5999 /** sets solving process deinitialization method of presolver */
6001  SCIP* scip, /**< SCIP data structure */
6002  SCIP_PRESOL* presol, /**< presolver */
6003  SCIP_DECL_PRESOLEXITPRE ((*presolexitpre))/**< solving process deinitialization method of presolver */
6004  )
6005 {
6006  SCIP_CALL( checkStage(scip, "SCIPsetPresolExitpre", TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE) );
6007 
6008  assert(presol != NULL);
6009 
6010  SCIPpresolSetExitpre(presol, presolexitpre);
6011 
6012  return SCIP_OKAY;
6013 }
6014 
6015 /** returns the presolver of the given name, or NULL if not existing */
6017  SCIP* scip, /**< SCIP data structure */
6018  const char* name /**< name of presolver */
6019  )
6020 {
6021  assert(scip != NULL);
6022  assert(scip->set != NULL);
6023  assert(name != NULL);
6024 
6025  return SCIPsetFindPresol(scip->set, name);
6026 }
6027 
6028 /** returns the array of currently available presolvers */
6030  SCIP* scip /**< SCIP data structure */
6031  )
6032 {
6033  assert(scip != NULL);
6034  assert(scip->set != NULL);
6035 
6036  SCIPsetSortPresols(scip->set);
6037 
6038  return scip->set->presols;
6039 }
6040 
6041 /** returns the number of currently available presolvers */
6043  SCIP* scip /**< SCIP data structure */
6044  )
6045 {
6046  assert(scip != NULL);
6047  assert(scip->set != NULL);
6048 
6049  return scip->set->npresols;
6050 }
6051 
6052 /** sets the priority of a presolver */
6054  SCIP* scip, /**< SCIP data structure */
6055  SCIP_PRESOL* presol, /**< presolver */
6056  int priority /**< new priority of the presolver */
6057  )
6058 {
6059  assert(scip != NULL);
6060  assert(scip->set != NULL);
6061 
6062  SCIPpresolSetPriority(presol, scip->set, priority);
6063 
6064  return SCIP_OKAY;
6065 }
6066 
6067 /** creates a relaxation handler and includes it in SCIP
6068  *
6069  * @note method has all relaxation handler callbacks as arguments and is thus changed every time a new
6070  * callback is added
6071  * in future releases; consider using SCIPincludeRelaxBasic() and setter functions
6072  * if you seek for a method which is less likely to change in future releases
6073  */
6075  SCIP* scip, /**< SCIP data structure */
6076  const char* name, /**< name of relaxation handler */
6077  const char* desc, /**< description of relaxation handler */
6078  int priority, /**< priority of the relaxation handler (negative: after LP, non-negative: before LP) */
6079  int freq, /**< frequency for calling relaxation handler */
6080  SCIP_DECL_RELAXCOPY ((*relaxcopy)), /**< copy method of relaxation handler or NULL if you don't want to copy your plugin into sub-SCIPs */
6081  SCIP_DECL_RELAXFREE ((*relaxfree)), /**< destructor of relaxation handler */
6082  SCIP_DECL_RELAXINIT ((*relaxinit)), /**< initialize relaxation handler */
6083  SCIP_DECL_RELAXEXIT ((*relaxexit)), /**< deinitialize relaxation handler */
6084  SCIP_DECL_RELAXINITSOL((*relaxinitsol)), /**< solving process initialization method of relaxation handler */
6085  SCIP_DECL_RELAXEXITSOL((*relaxexitsol)), /**< solving process deinitialization method of relaxation handler */
6086  SCIP_DECL_RELAXEXEC ((*relaxexec)), /**< execution method of relaxation handler */
6087  SCIP_RELAXDATA* relaxdata /**< relaxation handler data */
6088  )
6089 {
6090  SCIP_RELAX* relax;
6091 
6092  SCIP_CALL( checkStage(scip, "SCIPincludeRelax", TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE) );
6093 
6094  /* check whether relaxation handler is already present */
6095  if( SCIPfindRelax(scip, name) != NULL )
6096  {
6097  SCIPerrorMessage("relaxation handler <%s> already included.\n", name);
6098  return SCIP_INVALIDDATA;
6099  }
6100 
6101  SCIP_CALL( SCIPrelaxCreate(&relax, scip->set, scip->messagehdlr, scip->mem->setmem,
6102  name, desc, priority, freq,
6103  relaxcopy,
6104  relaxfree, relaxinit, relaxexit, relaxinitsol, relaxexitsol, relaxexec, relaxdata) );
6105  SCIP_CALL( SCIPsetIncludeRelax(scip->set, relax) );
6106 
6107  return SCIP_OKAY;
6108 }
6109 
6110 /** creates a relaxation handler and includes it in SCIP. All non fundamental
6111  * (or optional) callbacks as, e.g., init and exit callbacks, will be set to NULL.
6112  * Optional callbacks can be set via specific setter functions, see SCIPsetRelaxInit(), SCIPsetRelaxExit(),
6113  * SCIPsetRelaxCopy(), SCIPsetRelaxFree(), SCIPsetRelaxInitsol(), and SCIPsetRelaxExitsol()
6114  *
6115  * @note if you want to set all callbacks with a single method call, consider using SCIPincludeRelax() instead
6116  */
6118  SCIP* scip, /**< SCIP data structure */
6119  SCIP_RELAX** relaxptr, /**< reference to relaxation pointer, or NULL */
6120  const char* name, /**< name of relaxation handler */
6121  const char* desc, /**< description of relaxation handler */
6122  int priority, /**< priority of the relaxation handler (negative: after LP, non-negative: before LP) */
6123  int freq, /**< frequency for calling relaxation handler */
6124  SCIP_DECL_RELAXEXEC ((*relaxexec)), /**< execution method of relaxation handler */
6125  SCIP_RELAXDATA* relaxdata /**< relaxation handler data */
6126  )
6127 {
6128  SCIP_RELAX* relax;
6129 
6130  SCIP_CALL( checkStage(scip, "SCIPincludeRelaxBasic", TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE) );
6131 
6132  /* check whether relaxation handler is already present */
6133  if( SCIPfindRelax(scip, name) != NULL )
6134  {
6135  SCIPerrorMessage("relaxation handler <%s> already included.\n", name);
6136  return SCIP_INVALIDDATA;
6137  }
6138 
6139  SCIP_CALL( SCIPrelaxCreate(&relax, scip->set, scip->messagehdlr, scip->mem->setmem,
6140  name, desc, priority, freq,
6141  NULL, NULL, NULL, NULL, NULL, NULL, relaxexec, relaxdata) );
6142  SCIP_CALL( SCIPsetIncludeRelax(scip->set, relax) );
6143 
6144  if( relaxptr != NULL )
6145  *relaxptr = relax;
6146 
6147  return SCIP_OKAY;
6148 }
6149 
6150 /** sets copy method of relaxation handler */
6152  SCIP* scip, /**< SCIP data structure */
6153  SCIP_RELAX* relax, /**< relaxation handler */
6154  SCIP_DECL_RELAXCOPY ((*relaxcopy)) /**< copy method of relaxation handler or NULL if you don't want to copy your plugin into sub-SCIPs */
6155  )
6156 {
6157  SCIP_CALL( checkStage(scip, "SCIPsetRelaxCopy", TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE) );
6158 
6159  assert(relax != NULL);
6160 
6161  SCIPrelaxSetCopy(relax, relaxcopy);
6162 
6163  return SCIP_OKAY;
6164 }
6165 
6166 /** sets destructor method of relaxation handler */
6168  SCIP* scip, /**< SCIP data structure */
6169  SCIP_RELAX* relax, /**< relaxation handler */
6170  SCIP_DECL_RELAXFREE ((*relaxfree)) /**< destructor of relaxation handler */
6171  )
6172 {
6173  SCIP_CALL( checkStage(scip, "SCIPsetRelaxFree", TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE) );
6174 
6175  assert(relax != NULL);
6176 
6177  SCIPrelaxSetFree(relax, relaxfree);
6178 
6179  return SCIP_OKAY;
6180 }
6181 
6182 /** sets initialization method of relaxation handler */
6184  SCIP* scip, /**< SCIP data structure */
6185  SCIP_RELAX* relax, /**< relaxation handler */
6186  SCIP_DECL_RELAXINIT ((*relaxinit)) /**< initialize relaxation handler */
6187  )
6188 {
6189  SCIP_CALL( checkStage(scip, "SCIPsetRelaxInit", TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE) );
6190 
6191  assert(relax != NULL);
6192 
6193  SCIPrelaxSetInit(relax, relaxinit);
6194 
6195  return SCIP_OKAY;
6196 }
6197 
6198 /** sets deinitialization method of relaxation handler */
6200  SCIP* scip, /**< SCIP data structure */
6201  SCIP_RELAX* relax, /**< relaxation handler */
6202  SCIP_DECL_RELAXEXIT ((*relaxexit)) /**< deinitialize relaxation handler */
6203  )
6204 {
6205  SCIP_CALL( checkStage(scip, "SCIPsetRelaxExit", TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE) );
6206 
6207  assert(relax != NULL);
6208 
6209  SCIPrelaxSetExit(relax, relaxexit);
6210 
6211  return SCIP_OKAY;
6212 }
6213 
6214 /** sets solving process initialization method of relaxation handler */
6216  SCIP* scip, /**< SCIP data structure */
6217  SCIP_RELAX* relax, /**< relaxation handler */
6218  SCIP_DECL_RELAXINITSOL((*relaxinitsol)) /**< solving process initialization method of relaxation handler */
6219  )
6220 {
6221  SCIP_CALL( checkStage(scip, "SCIPsetRelaxInitsol", TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE) );
6222 
6223  assert(relax != NULL);
6224 
6225  SCIPrelaxSetInitsol(relax, relaxinitsol);
6226 
6227  return SCIP_OKAY;
6228 }
6229 
6230 /** sets solving process deinitialization method of relaxation handler */
6232  SCIP* scip, /**< SCIP data structure */
6233  SCIP_RELAX* relax, /**< relaxation handler */
6234  SCIP_DECL_RELAXEXITSOL((*relaxexitsol)) /**< solving process deinitialization method of relaxation handler */
6235  )
6236 {
6237  SCIP_CALL( checkStage(scip, "SCIPsetRelaxExitsol", TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE) );
6238 
6239  assert(relax != NULL);
6240 
6241  SCIPrelaxSetExitsol(relax, relaxexitsol);
6242 
6243  return SCIP_OKAY;
6244 }
6245 
6246 
6247 /** returns the relaxation handler of the given name, or NULL if not existing */
6249  SCIP* scip, /**< SCIP data structure */
6250  const char* name /**< name of relaxation handler */
6251  )
6252 {
6253  assert(scip != NULL);
6254  assert(scip->set != NULL);
6255  assert(name != NULL);
6256 
6257  return SCIPsetFindRelax(scip->set, name);
6258 }
6259 
6260 /** returns the array of currently available relaxation handlers */
6262  SCIP* scip /**< SCIP data structure */
6263  )
6264 {
6265  assert(scip != NULL);
6266  assert(scip->set != NULL);
6267 
6268  SCIPsetSortRelaxs(scip->set);
6269 
6270  return scip->set->relaxs;
6271 }
6272 
6273 /** returns the number of currently available relaxation handlers */
6275  SCIP* scip /**< SCIP data structure */
6276  )
6277 {
6278  assert(scip != NULL);
6279  assert(scip->set != NULL);
6280 
6281  return scip->set->nrelaxs;
6282 }
6283 
6284 /** sets the priority of a relaxation handler */
6286  SCIP* scip, /**< SCIP data structure */
6287  SCIP_RELAX* relax, /**< relaxation handler */
6288  int priority /**< new priority of the relaxation handler */
6289  )
6290 {
6291  assert(scip != NULL);
6292  assert(scip->set != NULL);
6293 
6294  SCIPrelaxSetPriority(relax, scip->set, priority);
6295 
6296  return SCIP_OKAY;
6297 }
6298 
6299 /** creates a separator and includes it in SCIP.
6300  *
6301  * @note method has all separator callbacks as arguments and is thus changed every time a new
6302  * callback is added
6303  * in future releases; consider using SCIPincludeSepaBasic() and setter functions
6304  * if you seek for a method which is less likely to change in future releases
6305  */
6307  SCIP* scip, /**< SCIP data structure */
6308  const char* name, /**< name of separator */
6309  const char* desc, /**< description of separator */
6310  int priority, /**< priority of separator (>= 0: before, < 0: after constraint handlers) */
6311  int freq, /**< frequency for calling separator */
6312  SCIP_Real maxbounddist, /**< maximal relative distance from current node's dual bound to primal bound compared
6313  * to best node's dual bound for applying separation */
6314  SCIP_Bool usessubscip, /**< does the separator use a secondary SCIP instance? */
6315  SCIP_Bool delay, /**< should separator be delayed, if other separators found cuts? */
6316  SCIP_DECL_SEPACOPY ((*sepacopy)), /**< copy method of separator or NULL if you don't want to copy your plugin into sub-SCIPs */
6317  SCIP_DECL_SEPAFREE ((*sepafree)), /**< destructor of separator */
6318  SCIP_DECL_SEPAINIT ((*sepainit)), /**< initialize separator */
6319  SCIP_DECL_SEPAEXIT ((*sepaexit)), /**< deinitialize separator */
6320  SCIP_DECL_SEPAINITSOL ((*sepainitsol)), /**< solving process initialization method of separator */
6321  SCIP_DECL_SEPAEXITSOL ((*sepaexitsol)), /**< solving process deinitialization method of separator */
6322  SCIP_DECL_SEPAEXECLP ((*sepaexeclp)), /**< LP solution separation method of separator */
6323  SCIP_DECL_SEPAEXECSOL ((*sepaexecsol)), /**< arbitrary primal solution separation method of separator */
6324  SCIP_SEPADATA* sepadata /**< separator data */
6325  )
6326 {
6327  SCIP_SEPA* sepa;
6328 
6329  SCIP_CALL( checkStage(scip, "SCIPincludeSepa", TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE) );
6330 
6331  /* check whether separator is already present */
6332  if( SCIPfindSepa(scip, name) != NULL )
6333  {
6334  SCIPerrorMessage("separator <%s> already included.\n", name);
6335  return SCIP_INVALIDDATA;
6336  }
6337 
6338  SCIP_CALL( SCIPsepaCreate(&sepa, scip->set, scip->messagehdlr, scip->mem->setmem,
6339  name, desc, priority, freq, maxbounddist, usessubscip, delay,
6340  sepacopy,
6341  sepafree, sepainit, sepaexit, sepainitsol, sepaexitsol, sepaexeclp, sepaexecsol, sepadata) );
6342  SCIP_CALL( SCIPsetIncludeSepa(scip->set, sepa) );
6343 
6344  return SCIP_OKAY;
6345 }
6346 
6347 /** creates a separator and includes it in SCIP with its most fundamental callbacks. All non-fundamental
6348  * (or optional) callbacks as, e.g., init and exit callbacks, will be set to NULL.
6349  * Optional callbacks can be set via specific setter functions, see SCIPsetSepaInit(), SCIPsetSepaFree(),
6350  * SCIPsetSepaInitsol(), SCIPsetSepaExitsol(), SCIPsetSepaCopy(), SCIPsetExit().
6351  *
6352  * @note if you want to set all callbacks with a single method call, consider using SCIPincludeSepa() instead
6353  */
6355  SCIP* scip, /**< SCIP data structure */
6356  SCIP_SEPA** sepa, /**< reference to a separator, or NULL */
6357  const char* name, /**< name of separator */
6358  const char* desc, /**< description of separator */
6359  int priority, /**< priority of separator (>= 0: before, < 0: after constraint handlers) */
6360  int freq, /**< frequency for calling separator */
6361  SCIP_Real maxbounddist, /**< maximal relative distance from current node's dual bound to primal bound compared
6362  * to best node's dual bound for applying separation */
6363  SCIP_Bool usessubscip, /**< does the separator use a secondary SCIP instance? */
6364  SCIP_Bool delay, /**< should separator be delayed, if other separators found cuts? */
6365  SCIP_DECL_SEPAEXECLP ((*sepaexeclp)), /**< LP solution separation method of separator */
6366  SCIP_DECL_SEPAEXECSOL ((*sepaexecsol)), /**< arbitrary primal solution separation method of separator */
6367  SCIP_SEPADATA* sepadata /**< separator data */
6368  )
6369 {
6370  SCIP_SEPA* sepaptr;
6371 
6372  SCIP_CALL( checkStage(scip, "SCIPincludeSepaBasic", TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE) );
6373 
6374  /* check whether separator is already present */
6375  if( SCIPfindSepa(scip, name) != NULL )
6376  {
6377  SCIPerrorMessage("separator <%s> already included.\n", name);
6378  return SCIP_INVALIDDATA;
6379  }
6380 
6381  SCIP_CALL( SCIPsepaCreate(&sepaptr, scip->set, scip->messagehdlr, scip->mem->setmem,
6382  name, desc, priority, freq, maxbounddist, usessubscip, delay,
6383  NULL, NULL, NULL, NULL, NULL, NULL, sepaexeclp, sepaexecsol, sepadata) );
6384 
6385  assert(sepaptr != NULL);
6386 
6387  SCIP_CALL( SCIPsetIncludeSepa(scip->set, sepaptr) );
6388 
6389  if( sepa != NULL)
6390  *sepa = sepaptr;
6391 
6392  return SCIP_OKAY;
6393 }
6394 
6395 /** sets copy method of separator */
6397  SCIP* scip, /**< SCIP data structure */
6398  SCIP_SEPA* sepa, /**< separator */
6399  SCIP_DECL_SEPACOPY ((*sepacopy)) /**< copy method of separator or NULL if you don't want to copy your plugin into sub-SCIPs */
6400  )
6401 {
6402  SCIP_CALL( checkStage(scip, "SCIPsetSepaCopy", TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE) );
6403 
6404  assert(sepa != NULL);
6405 
6406  SCIPsepaSetCopy(sepa, sepacopy);
6407 
6408  return SCIP_OKAY;
6409 }
6410 
6411 /** sets destructor method of separator */
6413  SCIP* scip, /**< SCIP data structure */
6414  SCIP_SEPA* sepa, /**< separator */
6415  SCIP_DECL_SEPAFREE ((*sepafree)) /**< destructor of separator */
6416  )
6417 {
6418  SCIP_CALL( checkStage(scip, "SCIPsetSepaFree", TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE) );
6419 
6420  assert(sepa != NULL);
6421 
6422  SCIPsepaSetFree(sepa, sepafree);
6423 
6424  return SCIP_OKAY;
6425 }
6426 
6427 /** sets initialization method of separator */
6429  SCIP* scip, /**< SCIP data structure */
6430  SCIP_SEPA* sepa, /**< separator */
6431  SCIP_DECL_SEPAINIT ((*sepainit)) /**< initialize separator */
6432  )
6433 {
6434  SCIP_CALL( checkStage(scip, "SCIPsetSepaInit", TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE) );
6435 
6436  assert(sepa != NULL);
6437 
6438  SCIPsepaSetInit(sepa, sepainit);
6439 
6440  return SCIP_OKAY;
6441 }
6442 
6443 /** sets deinitialization method of separator */
6445  SCIP* scip, /**< SCIP data structure */
6446  SCIP_SEPA* sepa, /**< separator */
6447  SCIP_DECL_SEPAEXIT ((*sepaexit)) /**< deinitialize separator */
6448  )
6449 {
6450  SCIP_CALL( checkStage(scip, "SCIPsetSepaExit", TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE) );
6451 
6452  assert(sepa != NULL);
6453 
6454  SCIPsepaSetExit(sepa, sepaexit);
6455 
6456  return SCIP_OKAY;
6457 }
6458 
6459 /** sets solving process initialization method of separator */
6461  SCIP* scip, /**< SCIP data structure */
6462  SCIP_SEPA* sepa, /**< separator */
6463  SCIP_DECL_SEPAINITSOL ((*sepainitsol)) /**< solving process initialization method of separator */
6464  )
6465 {
6466  SCIP_CALL( checkStage(scip, "SCIPsetSepaInitsol", TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE) );
6467 
6468  assert(sepa != NULL);
6469 
6470  SCIPsepaSetInitsol(sepa, sepainitsol);
6471 
6472  return SCIP_OKAY;
6473 }
6474 
6475 /** sets solving process deinitialization method of separator */
6477  SCIP* scip, /**< SCIP data structure */
6478  SCIP_SEPA* sepa, /**< separator */
6479  SCIP_DECL_SEPAEXITSOL ((*sepaexitsol)) /**< solving process deinitialization method of separator */
6480  )
6481 {
6482  SCIP_CALL( checkStage(scip, "SCIPsetSepaExitsol", TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE) );
6483 
6484  assert(sepa != NULL);
6485 
6486  SCIPsepaSetExitsol(sepa, sepaexitsol);
6487 
6488  return SCIP_OKAY;
6489 }
6490 
6491 /** returns the separator of the given name, or NULL if not existing */
6493  SCIP* scip, /**< SCIP data structure */
6494  const char* name /**< name of separator */
6495  )
6496 {
6497  assert(scip != NULL);
6498  assert(scip->set != NULL);
6499  assert(name != NULL);
6500 
6501  return SCIPsetFindSepa(scip->set, name);
6502 }
6503 
6504 /** returns the array of currently available separators */
6506  SCIP* scip /**< SCIP data structure */
6507  )
6508 {
6509  assert(scip != NULL);
6510  assert(scip->set != NULL);
6511 
6512  SCIPsetSortSepas(scip->set);
6513 
6514  return scip->set->sepas;
6515 }
6516 
6517 /** returns the number of currently available separators */
6519  SCIP* scip /**< SCIP data structure */
6520  )
6521 {
6522  assert(scip != NULL);
6523  assert(scip->set != NULL);
6524 
6525  return scip->set->nsepas;
6526 }
6527 
6528 /** sets the priority of a separator */
6530  SCIP* scip, /**< SCIP data structure */
6531  SCIP_SEPA* sepa, /**< separator */
6532  int priority /**< new priority of the separator */
6533  )
6534 {
6535  assert(scip != NULL);
6536  assert(scip->set != NULL);
6537 
6538  SCIPsepaSetPriority(sepa, scip->set, priority);
6539 
6540  return SCIP_OKAY;
6541 }
6542 
6543 /** creates a propagator and includes it in SCIP.
6544  *
6545  * @note method has all propagator callbacks as arguments and is thus changed every time a new
6546  * callback is added in future releases; consider using SCIPincludePropBasic() and setter functions
6547  * if you seek for a method which is less likely to change in future releases
6548  */
6550  SCIP* scip, /**< SCIP data structure */
6551  const char* name, /**< name of propagator */
6552  const char* desc, /**< description of propagator */
6553  int priority, /**< priority of the propagator (>= 0: before, < 0: after constraint handlers) */
6554  int freq, /**< frequency for calling propagator */
6555  SCIP_Bool delay, /**< should propagator be delayed, if other propagators found reductions? */
6556  SCIP_PROPTIMING timingmask, /**< positions in the node solving loop where propagators should be executed */
6557  int presolpriority, /**< presolving priority of the propagator (>= 0: before, < 0: after constraint handlers) */
6558  int presolmaxrounds, /**< maximal number of presolving rounds the propagator participates in (-1: no limit) */
6559  SCIP_Bool presoldelay, /**< should presolving be delayed, if other presolvers found reductions? */
6560  SCIP_DECL_PROPCOPY ((*propcopy)), /**< copy method of propagator or NULL if you don't want to copy your plugin into sub-SCIPs */
6561  SCIP_DECL_PROPFREE ((*propfree)), /**< destructor of propagator */
6562  SCIP_DECL_PROPINIT ((*propinit)), /**< initialize propagator */
6563  SCIP_DECL_PROPEXIT ((*propexit)), /**< deinitialize propagator */
6564  SCIP_DECL_PROPINITPRE ((*propinitpre)), /**< presolving initialization method of propagator */
6565  SCIP_DECL_PROPEXITPRE ((*propexitpre)), /**< presolving deinitialization method of propagator */
6566  SCIP_DECL_PROPINITSOL ((*propinitsol)), /**< solving process initialization method of propagator */
6567  SCIP_DECL_PROPEXITSOL ((*propexitsol)), /**< solving process deinitialization method of propagator */
6568  SCIP_DECL_PROPPRESOL ((*proppresol)), /**< presolving method */
6569  SCIP_DECL_PROPEXEC ((*propexec)), /**< execution method of propagator */
6570  SCIP_DECL_PROPRESPROP ((*propresprop)), /**< propagation conflict resolving method */
6571  SCIP_PROPDATA* propdata /**< propagator data */
6572  )
6573 {
6574  SCIP_PROP* prop;
6575 
6576  SCIP_CALL( checkStage(scip, "SCIPincludeProp", TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE) );
6577 
6578  /* check whether propagator is already present */
6579  if( SCIPfindProp(scip, name) != NULL )
6580  {
6581  SCIPerrorMessage("propagator <%s> already included.\n", name);
6582  return SCIP_INVALIDDATA;
6583  }
6584 
6585  SCIP_CALL( SCIPpropCreate(&prop, scip->set, scip->messagehdlr, scip->mem->setmem,
6586  name, desc, priority, freq, delay, timingmask, presolpriority, presolmaxrounds, presoldelay,
6587  propcopy,
6588  propfree, propinit, propexit, propinitpre, propexitpre, propinitsol, propexitsol,
6589  proppresol, propexec, propresprop, propdata) );
6590  SCIP_CALL( SCIPsetIncludeProp(scip->set, prop) );
6591 
6592  return SCIP_OKAY;
6593 }
6594 
6595 /** creates a propagator and includes it in SCIP. All non-fundamental (or optional) callbacks will be set to NULL.
6596  * Optional callbacks can be set via specific setter functions, see SCIPsetPropInit(), SCIPsetPropExit(),
6597  * SCIPsetPropCopy(), SCIPsetPropFree(), SCIPsetPropInitsol(), SCIPsetPropExitsol(),
6598  * SCIPsetPropInitpre(), SCIPsetPropExitpre(), SCIPsetPropPresol(), and SCIPsetPropResprop().
6599  *
6600 * @note if you want to set all callbacks with a single method call, consider using SCIPincludeProp() instead
6601  */
6603  SCIP* scip, /**< SCIP data structure */
6604  SCIP_PROP** propptr, /**< reference to a propagator pointer, or NULL */
6605  const char* name, /**< name of propagator */
6606  const char* desc, /**< description of propagator */
6607  int priority, /**< priority of the propagator (>= 0: before, < 0: after constraint handlers) */
6608  int freq, /**< frequency for calling propagator */
6609  SCIP_Bool delay, /**< should propagator be delayed, if other propagators found reductions? */
6610  SCIP_PROPTIMING timingmask, /**< positions in the node solving loop where propagators should be executed */
6611  SCIP_DECL_PROPEXEC ((*propexec)), /**< execution method of propagator */
6612  SCIP_PROPDATA* propdata /**< propagator data */
6613  )
6614 {
6615  SCIP_PROP* prop;
6616 
6617  SCIP_CALL( checkStage(scip, "SCIPincludePropBasic", TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE) );
6618 
6619  /* check whether propagator is already present */
6620  if( SCIPfindProp(scip, name) != NULL )
6621  {
6622  SCIPerrorMessage("propagator <%s> already included.\n", name);
6623  return SCIP_INVALIDDATA;
6624  }
6625 
6626  SCIP_CALL( SCIPpropCreate(&prop, scip->set, scip->messagehdlr, scip->mem->setmem,
6627  name, desc, priority, freq, delay, timingmask, 0, -1, FALSE,
6628  NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
6629  NULL, propexec, NULL, propdata) );
6630  SCIP_CALL( SCIPsetIncludeProp(scip->set, prop) );
6631 
6632  if( propptr != NULL )
6633  *propptr = prop;
6634 
6635  return SCIP_OKAY;
6636 }
6637 
6638 /** sets copy method of propagator */
6640  SCIP* scip, /**< SCIP data structure */
6641  SCIP_PROP* prop, /**< propagator */
6642  SCIP_DECL_PROPCOPY ((*propcopy)) /**< copy method of propagator or NULL if you don't want to copy your plugin into sub-SCIPs */
6643  )
6644 {
6645  SCIP_CALL( checkStage(scip, "SCIPsetPropCopy", TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE) );
6646 
6647  assert(prop != NULL);
6648 
6649  SCIPpropSetCopy(prop, propcopy);
6650 
6651  return SCIP_OKAY;
6652 }
6653 
6654 /** sets destructor method of propagator */
6656  SCIP* scip, /**< SCIP data structure */
6657  SCIP_PROP* prop, /**< propagator */
6658  SCIP_DECL_PROPFREE ((*propfree)) /**< destructor of propagator */
6659  )
6660 {
6661  SCIP_CALL( checkStage(scip, "SCIPsetPropFree", TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE) );
6662 
6663  assert(prop != NULL);
6664 
6665  SCIPpropSetFree(prop, propfree);
6666 
6667  return SCIP_OKAY;
6668 }
6669 
6670 /** sets initialization method of propagator */
6672  SCIP* scip, /**< SCIP data structure */
6673  SCIP_PROP* prop, /**< propagator */
6674  SCIP_DECL_PROPINIT ((*propinit)) /**< initialize propagator */
6675  )
6676 {
6677  SCIP_CALL( checkStage(scip, "SCIPsetPropInit", TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE) );
6678 
6679  assert(prop != NULL);
6680 
6681  SCIPpropSetInit(prop, propinit);
6682 
6683  return SCIP_OKAY;
6684 }
6685 
6686 /** sets deinitialization method of propagator */
6688  SCIP* scip, /**< SCIP data structure */
6689  SCIP_PROP* prop, /**< propagator */
6690  SCIP_DECL_PROPEXIT ((*propexit)) /**< deinitialize propagator */
6691  )
6692 {
6693  SCIP_CALL( checkStage(scip, "SCIPsetPropExit", TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE) );
6694 
6695  assert(prop != NULL);
6696 
6697  SCIPpropSetExit(prop, propexit);
6698 
6699  return SCIP_OKAY;
6700 }
6701 
6702 /** sets solving process initialization method of propagator */
6704  SCIP* scip, /**< SCIP data structure */
6705  SCIP_PROP* prop, /**< propagator */
6706  SCIP_DECL_PROPINITSOL((*propinitsol)) /**< solving process initialization method of propagator */
6707  )
6708 {
6709  SCIP_CALL( checkStage(scip, "SCIPsetPropInitsol", TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE) );
6710 
6711  assert(prop != NULL);
6712 
6713  SCIPpropSetInitsol(prop, propinitsol);
6714 
6715  return SCIP_OKAY;
6716 }
6717 
6718 /** sets solving process deinitialization method of propagator */
6720  SCIP* scip, /**< SCIP data structure */
6721  SCIP_PROP* prop, /**< propagator */
6722  SCIP_DECL_PROPEXITSOL ((*propexitsol)) /**< solving process deinitialization method of propagator */
6723  )
6724 {
6725  SCIP_CALL( checkStage(scip, "SCIPsetPropExitsol", TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE) );
6726 
6727  assert(prop != NULL);
6728 
6729  SCIPpropSetExitsol(prop, propexitsol);
6730 
6731  return SCIP_OKAY;
6732 }
6733 
6734 /** sets preprocessing initialization method of propagator */
6736  SCIP* scip, /**< SCIP data structure */
6737  SCIP_PROP* prop, /**< propagator */
6738  SCIP_DECL_PROPINITPRE((*propinitpre)) /**< preprocessing initialization method of propagator */
6739  )
6740 {
6741  SCIP_CALL( checkStage(scip, "SCIPsetPropInitpre", TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE) );
6742 
6743  assert(prop != NULL);
6744 
6745  SCIPpropSetInitpre(prop, propinitpre);
6746 
6747  return SCIP_OKAY;
6748 }
6749 
6750 /** sets preprocessing deinitialization method of propagator */
6752  SCIP* scip, /**< SCIP data structure */
6753  SCIP_PROP* prop, /**< propagator */
6754  SCIP_DECL_PROPEXITPRE((*propexitpre)) /**< preprocessing deinitialization method of propagator */
6755  )
6756 {
6757  SCIP_CALL( checkStage(scip, "SCIPsetPropExitpre", TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE) );
6758 
6759  assert(prop != NULL);
6760 
6761  SCIPpropSetExitpre(prop, propexitpre);
6762 
6763  return SCIP_OKAY;
6764 }
6765 
6766 /** sets presolving method of propagator */
6768  SCIP* scip, /**< SCIP data structure */
6769  SCIP_PROP* prop, /**< propagator */
6770  SCIP_DECL_PROPPRESOL((*proppresol)), /**< presolving method of propagator */
6771  int presolpriority, /**< presolving priority of the propagator (>= 0: before, < 0: after constraint handlers) */
6772  int presolmaxrounds, /**< maximal number of presolving rounds the propagator participates in (-1: no limit) */
6773  SCIP_Bool presoldelay /**< should presolving be delayed, if other presolvers found reductions? */
6774  )
6775 {
6776  const char* name;
6777  char paramname[SCIP_MAXSTRLEN];
6778 
6779  assert(scip != NULL);
6780  SCIP_CALL( checkStage(scip, "SCIPsetPropPresol", TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE) );
6781 
6782 
6783  assert(prop != NULL);
6784  SCIPpropSetPresol(prop, proppresol, presolpriority, presolmaxrounds, presoldelay);
6785 
6786  name = SCIPpropGetName(prop);
6787 
6788  (void) SCIPsnprintf(paramname, SCIP_MAXSTRLEN, "propagating/%s/maxprerounds", name);
6789  SCIP_CALL( SCIPsetSetDefaultIntParam(scip->set, paramname, presolmaxrounds) );
6790 
6791 
6792  (void) SCIPsnprintf(paramname, SCIP_MAXSTRLEN, "propagating/%s/presolpriority", name);
6793  SCIP_CALL( SCIPsetSetDefaultIntParam(scip->set, paramname, presolpriority) );
6794 
6795  (void) SCIPsnprintf(paramname, SCIP_MAXSTRLEN, "propagating/%s/presoldelay", name);
6796  SCIP_CALL( SCIPsetSetDefaultBoolParam(scip->set, paramname, presoldelay) );
6797 
6798  return SCIP_OKAY;
6799 }
6800 
6801 /** sets propagation conflict resolving callback of propagator */
6803  SCIP* scip, /**< SCIP data structure */
6804  SCIP_PROP* prop, /**< propagator */
6805  SCIP_DECL_PROPRESPROP ((*propresprop)) /**< propagation conflict resolving callback */
6806  )
6807 {
6808  SCIP_CALL( checkStage(scip, "SCIPsetPropResprop", TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE) );
6809 
6810  assert(prop != NULL);
6811 
6812  SCIPpropSetResprop(prop, propresprop);
6813 
6814  return SCIP_OKAY;
6815 }
6816 
6817 
6818 /** returns the propagator of the given name, or NULL if not existing */
6820  SCIP* scip, /**< SCIP data structure */
6821  const char* name /**< name of propagator */
6822  )
6823 {
6824  assert(scip != NULL);
6825  assert(scip->set != NULL);
6826  assert(name != NULL);
6827 
6828  return SCIPsetFindProp(scip->set, name);
6829 }
6830 
6831 /** returns the array of currently available propagators */
6833  SCIP* scip /**< SCIP data structure */
6834  )
6835 {
6836  assert(scip != NULL);
6837  assert(scip->set != NULL);
6838 
6839  SCIPsetSortProps(scip->set);
6840 
6841  return scip->set->props;
6842 }
6843 
6844 /** returns the number of currently available propagators */
6846  SCIP* scip /**< SCIP data structure */
6847  )
6848 {
6849  assert(scip != NULL);
6850  assert(scip->set != NULL);
6851 
6852  return scip->set->nprops;
6853 }
6854 
6855 /** sets the priority of a propagator */
6857  SCIP* scip, /**< SCIP data structure */
6858  SCIP_PROP* prop, /**< propagator */
6859  int priority /**< new priority of the propagator */
6860  )
6861 {
6862  assert(scip != NULL);
6863  assert(scip->set != NULL);
6864 
6865  SCIPpropSetPriority(prop, scip->set, priority);
6866 
6867  return SCIP_OKAY;
6868 }
6869 
6870 /** sets the presolving priority of a propagator */
6872  SCIP* scip, /**< SCIP data structure */
6873  SCIP_PROP* prop, /**< propagator */
6874  int presolpriority /**< new presol priority of the propagator */
6875  )
6876 {
6877  assert(scip != NULL);
6878  assert(scip->set != NULL);
6879 
6880  SCIPpropSetPresolPriority(prop, scip->set, presolpriority);
6881 
6882  return SCIP_OKAY;
6883 }
6884 
6885 /** creates a primal heuristic and includes it in SCIP.
6886  *
6887  * @note method has all heuristic callbacks as arguments and is thus changed every time a new
6888  * callback is added in future releases; consider using SCIPincludeHeurBasic() and setter functions
6889  * if you seek for a method which is less likely to change in future releases
6890  */
6892  SCIP* scip, /**< SCIP data structure */
6893  const char* name, /**< name of primal heuristic */
6894  const char* desc, /**< description of primal heuristic */
6895  char dispchar, /**< display character of primal heuristic */
6896  int priority, /**< priority of the primal heuristic */
6897  int freq, /**< frequency for calling primal heuristic */
6898  int freqofs, /**< frequency offset for calling primal heuristic */
6899  int maxdepth, /**< maximal depth level to call heuristic at (-1: no limit) */
6900  unsigned int timingmask, /**< positions in the node solving loop where heuristic should be executed;
6901  * see definition of SCIP_HeurTiming for possible values */
6902  SCIP_Bool usessubscip, /**< does the heuristic use a secondary SCIP instance? */
6903  SCIP_DECL_HEURCOPY ((*heurcopy)), /**< copy method of primal heuristic or NULL if you don't want to copy your plugin into sub-SCIPs */
6904  SCIP_DECL_HEURFREE ((*heurfree)), /**< destructor of primal heuristic */
6905  SCIP_DECL_HEURINIT ((*heurinit)), /**< initialize primal heuristic */
6906  SCIP_DECL_HEUREXIT ((*heurexit)), /**< deinitialize primal heuristic */
6907  SCIP_DECL_HEURINITSOL ((*heurinitsol)), /**< solving process initialization method of primal heuristic */
6908  SCIP_DECL_HEUREXITSOL ((*heurexitsol)), /**< solving process deinitialization method of primal heuristic */
6909  SCIP_DECL_HEUREXEC ((*heurexec)), /**< execution method of primal heuristic */
6910  SCIP_HEURDATA* heurdata /**< primal heuristic data */
6911  )
6912 {
6913  SCIP_HEUR* heur;
6914 
6915  SCIP_CALL( checkStage(scip, "SCIPincludeHeur", TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE) );
6916 
6917  /* check whether heuristic is already present */
6918  if( SCIPfindHeur(scip, name) != NULL )
6919  {
6920  SCIPerrorMessage("heuristic <%s> already included.\n", name);
6921  return SCIP_INVALIDDATA;
6922  }
6923 
6924  SCIP_CALL( SCIPheurCreate(&heur, scip->set, scip->messagehdlr, scip->mem->setmem,
6925  name, desc, dispchar, priority, freq, freqofs, maxdepth, timingmask, usessubscip,
6926  heurcopy, heurfree, heurinit, heurexit, heurinitsol, heurexitsol, heurexec, heurdata) );
6927 
6928  SCIP_CALL( SCIPsetIncludeHeur(scip->set, heur) );
6929 
6930  return SCIP_OKAY;
6931 }
6932 
6933 /** creates a primal heuristic and includes it in SCIP with its most fundamental callbacks.
6934  * All non-fundamental (or optional) callbacks
6935  * as, e. g., init and exit callbacks, will be set to NULL.
6936  * Optional callbacks can be set via specific setter functions, see SCIPsetHeurCopy(), SCIPsetHeurFree(),
6937  * SCIPsetHeurInit(), SCIPsetHeurExit(), SCIPsetHeurInitsol(), and SCIPsetHeurExitsol()
6938  *
6939 * @note if you want to set all callbacks with a single method call, consider using SCIPincludeHeur() instead
6940  */
6942  SCIP* scip, /**< SCIP data structure */
6943  SCIP_HEUR** heur, /**< pointer to primal heuristic */
6944  const char* name, /**< name of primal heuristic */
6945  const char* desc, /**< description of primal heuristic */
6946  char dispchar, /**< display character of primal heuristic */
6947  int priority, /**< priority of the primal heuristic */
6948  int freq, /**< frequency for calling primal heuristic */
6949  int freqofs, /**< frequency offset for calling primal heuristic */
6950  int maxdepth, /**< maximal depth level to call heuristic at (-1: no limit) */
6951  unsigned int timingmask, /**< positions in the node solving loop where heuristic should be executed;
6952  * see definition of SCIP_HeurTiming for possible values */
6953  SCIP_Bool usessubscip, /**< does the heuristic use a secondary SCIP instance? */
6954  SCIP_DECL_HEUREXEC ((*heurexec)), /**< execution method of primal heuristic */
6955  SCIP_HEURDATA* heurdata /**< primal heuristic data */
6956  )
6957 {
6958  SCIP_HEUR* heurptr;
6959 
6960  SCIP_CALL( checkStage(scip, "SCIPincludeHeurBasic", TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE) );
6961 
6962  /* check whether heuristic is already present */
6963  if( SCIPfindHeur(scip, name) != NULL )
6964  {
6965  SCIPerrorMessage("heuristic <%s> already included.\n", name);
6966  return SCIP_INVALIDDATA;
6967  }
6968 
6969  SCIP_CALL( SCIPheurCreate(&heurptr, scip->set, scip->messagehdlr, scip->mem->setmem,
6970  name, desc, dispchar, priority, freq, freqofs, maxdepth, timingmask, usessubscip,
6971  NULL, NULL, NULL, NULL, NULL, NULL, heurexec, heurdata) );
6972 
6973  assert(heurptr != NULL);
6974 
6975  SCIP_CALL( SCIPsetIncludeHeur(scip->set, heurptr) );
6976 
6977  if( heur != NULL )
6978  *heur = heurptr;
6979 
6980  return SCIP_OKAY;
6981 }
6982 
6983 /* new callback/method setter methods */
6984 
6985 /** sets copy method of primal heuristic */
6987  SCIP* scip, /**< SCIP data structure */
6988  SCIP_HEUR* heur, /**< primal heuristic */
6989  SCIP_DECL_HEURCOPY ((*heurcopy)) /**< copy method of primal heuristic or NULL if you don't want to copy your plugin into sub-SCIPs */
6990  )
6991 {
6992  SCIP_CALL( checkStage(scip, "SCIPsetHeurCopy", TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE) );
6993 
6994  assert(heur != NULL);
6995 
6996  SCIPheurSetCopy(heur, heurcopy);
6997 
6998  return SCIP_OKAY;
6999 }
7000 
7001 /** sets destructor method of primal heuristic */
7003  SCIP* scip, /**< SCIP data structure */
7004  SCIP_HEUR* heur, /**< primal heuristic */
7005  SCIP_DECL_HEURFREE ((*heurfree)) /**< destructor of primal heuristic */
7006  )
7007 {
7008  SCIP_CALL( checkStage(scip, "SCIPsetHeurFree", TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE) );
7009 
7010  assert(heur != NULL);
7011 
7012  SCIPheurSetFree(heur, heurfree);
7013 
7014  return SCIP_OKAY;
7015 }
7016 
7017 /** sets initialization method of primal heuristic */
7019  SCIP* scip, /**< SCIP data structure */
7020  SCIP_HEUR* heur, /**< primal heuristic */
7021  SCIP_DECL_HEURINIT ((*heurinit)) /**< initialize primal heuristic */
7022  )
7023 {
7024  SCIP_CALL( checkStage(scip, "SCIPsetHeurInit", TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE) );
7025 
7026  assert(heur != NULL);
7027 
7028  SCIPheurSetInit(heur, heurinit);
7029 
7030  return SCIP_OKAY;
7031 }
7032 
7033 /** sets deinitialization method of primal heuristic */
7035  SCIP* scip, /**< SCIP data structure */
7036  SCIP_HEUR* heur, /**< primal heuristic */
7037  SCIP_DECL_HEUREXIT ((*heurexit)) /**< deinitialize primal heuristic */
7038  )
7039 {
7040  SCIP_CALL( checkStage(scip, "SCIPsetHeurExit", TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE) );
7041 
7042  assert(heur != NULL);
7043 
7044  SCIPheurSetExit(heur, heurexit);
7045 
7046  return SCIP_OKAY;
7047 }
7048 
7049 /** sets solving process initialization method of primal heuristic */
7051  SCIP* scip, /**< SCIP data structure */
7052  SCIP_HEUR* heur, /**< primal heuristic */
7053  SCIP_DECL_HEURINITSOL ((*heurinitsol)) /**< solving process initialization method of primal heuristic */
7054  )
7055 {
7056  SCIP_CALL( checkStage(scip, "SCIPsetHeurInitsol", TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE) );
7057 
7058  assert(heur != NULL);
7059 
7060  SCIPheurSetInitsol(heur, heurinitsol);
7061 
7062  return SCIP_OKAY;
7063 }
7064 
7065 /** sets solving process deinitialization method of primal heuristic */
7067  SCIP* scip, /**< SCIP data structure */
7068  SCIP_HEUR* heur, /**< primal heuristic */
7069  SCIP_DECL_HEUREXITSOL ((*heurexitsol)) /**< solving process deinitialization method of primal heuristic */
7070  )
7071 {
7072  SCIP_CALL( checkStage(scip, "SCIPsetHeurExitsol", TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE) );
7073 
7074  assert(heur != NULL);
7075 
7076  SCIPheurSetExitsol(heur, heurexitsol);
7077 
7078  return SCIP_OKAY;
7079 }
7080 
7081 /** returns the primal heuristic of the given name, or NULL if not existing */
7083  SCIP* scip, /**< SCIP data structure */
7084  const char* name /**< name of primal heuristic */
7085  )
7086 {
7087  assert(scip != NULL);
7088  assert(scip->set != NULL);
7089  assert(name != NULL);
7090 
7091  return SCIPsetFindHeur(scip->set, name);
7092 }
7093 
7094 /** returns the array of currently available primal heuristics */
7096  SCIP* scip /**< SCIP data structure */
7097  )
7098 {
7099  assert(scip != NULL);
7100  assert(scip->set != NULL);
7101 
7102  SCIPsetSortHeurs(scip->set);
7103 
7104  return scip->set->heurs;
7105 }
7106 
7107 /** returns the number of currently available primal heuristics */
7109  SCIP* scip /**< SCIP data structure */
7110  )
7111 {
7112  assert(scip != NULL);
7113  assert(scip->set != NULL);
7114 
7115  return scip->set->nheurs;
7116 }
7117 
7118 /** sets the priority of a primal heuristic */
7120  SCIP* scip, /**< SCIP data structure */
7121  SCIP_HEUR* heur, /**< primal heuristic */
7122  int priority /**< new priority of the primal heuristic */
7123  )
7124 {
7125  assert(scip != NULL);
7126  assert(scip->set != NULL);
7127 
7128  SCIPheurSetPriority(heur, scip->set, priority);
7129 
7130  return SCIP_OKAY;
7131 }
7132 
7133 /** creates an event handler and includes it in SCIP
7134  *
7135  * @note method has all event handler callbacks as arguments and is thus changed every time a new
7136  * callback is added in future releases; consider using SCIPincludeEventhdlrBasic() and setter functions
7137  * if you seek for a method which is less likely to change in future releases
7138  */
7140  SCIP* scip, /**< SCIP data structure */
7141  const char* name, /**< name of event handler */
7142  const char* desc, /**< description of event handler */
7143  SCIP_DECL_EVENTCOPY ((*eventcopy)), /**< copy method of event handler or NULL if you don't want to copy your plugin into sub-SCIPs */
7144  SCIP_DECL_EVENTFREE ((*eventfree)), /**< destructor of event handler */
7145  SCIP_DECL_EVENTINIT ((*eventinit)), /**< initialize event handler */
7146  SCIP_DECL_EVENTEXIT ((*eventexit)), /**< deinitialize event handler */
7147  SCIP_DECL_EVENTINITSOL((*eventinitsol)), /**< solving process initialization method of event handler */
7148  SCIP_DECL_EVENTEXITSOL((*eventexitsol)), /**< solving process deinitialization method of event handler */
7149  SCIP_DECL_EVENTDELETE ((*eventdelete)), /**< free specific event data */
7150  SCIP_DECL_EVENTEXEC ((*eventexec)), /**< execute event handler */
7151  SCIP_EVENTHDLRDATA* eventhdlrdata /**< event handler data */
7152  )
7153 {
7154  SCIP_EVENTHDLR* eventhdlr;
7155 
7156  SCIP_CALL( checkStage(scip, "SCIPincludeEventhdlr", TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE) );
7157 
7158  /* check whether event handler is already present */
7159  if( SCIPfindEventhdlr(scip, name) != NULL )
7160  {
7161  SCIPerrorMessage("event handler <%s> already included.\n", name);
7162  return SCIP_INVALIDDATA;
7163  }
7164 
7165  SCIP_CALL( SCIPeventhdlrCreate(&eventhdlr, name, desc,
7166  eventcopy,
7167  eventfree, eventinit, eventexit, eventinitsol, eventexitsol, eventdelete, eventexec,
7168  eventhdlrdata) );
7169  SCIP_CALL( SCIPsetIncludeEventhdlr(scip->set, eventhdlr) );
7170 
7171  return SCIP_OKAY;
7172 }
7173 
7174 /** creates an event handler and includes it in SCIP with all its non-fundamental callbacks set
7175  * to NULL; if needed, non-fundamental callbacks can be set afterwards via setter functions
7176  * SCIPsetEventhdlrCopy(), SCIPsetEventhdlrFree(), SCIPsetEventhdlrInit(), SCIPsetEventhdlrExit(),
7177  * SCIPsetEventhdlrInitsol(), SCIPsetEventhdlrExitsol(), and SCIPsetEventhdlrDelete()
7178  *
7179  * @note if you want to set all callbacks with a single method call, consider using SCIPincludeEventhdlr() instead
7180  */
7182  SCIP* scip, /**< SCIP data structure */
7183  SCIP_EVENTHDLR** eventhdlrptr, /**< reference to an event handler, or NULL */
7184  const char* name, /**< name of event handler */
7185  const char* desc, /**< description of event handler */
7186  SCIP_DECL_EVENTEXEC ((*eventexec)), /**< execute event handler */
7187  SCIP_EVENTHDLRDATA* eventhdlrdata /**< event handler data */
7188  )
7189 {
7190  SCIP_EVENTHDLR* eventhdlr;
7191 
7192  SCIP_CALL( checkStage(scip, "SCIPincludeEventhdlrBasic", TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE) );
7193 
7194  /* check whether event handler is already present */
7195  if( SCIPfindEventhdlr(scip, name) != NULL )
7196  {
7197  SCIPerrorMessage("event handler <%s> already included.\n", name);
7198  return SCIP_INVALIDDATA;
7199  }
7200 
7201  SCIP_CALL( SCIPeventhdlrCreate(&eventhdlr, name, desc,
7202  NULL, NULL, NULL, NULL, NULL, NULL, NULL, eventexec,
7203  eventhdlrdata) );
7204  SCIP_CALL( SCIPsetIncludeEventhdlr(scip->set, eventhdlr) );
7205 
7206  if( eventhdlrptr != NULL )
7207  *eventhdlrptr = eventhdlr;
7208 
7209  return SCIP_OKAY;
7210 }
7211 
7212 /** sets copy callback of the event handler */
7214  SCIP* scip, /**< scip instance */
7215  SCIP_EVENTHDLR* eventhdlr, /**< event handler */
7216  SCIP_DECL_EVENTCOPY ((*eventcopy)) /**< copy callback of the event handler */
7217  )
7218 {
7219  assert(scip != NULL);
7220  SCIP_CALL( checkStage(scip, "SCIPsetEventhdlrCopy", TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE) );
7221 
7222  SCIPeventhdlrSetCopy(eventhdlr, eventcopy);
7223  return SCIP_OKAY;
7224 }
7225 
7226 /** sets deinitialization callback of the event handler */
7228  SCIP* scip, /**< scip instance */
7229  SCIP_EVENTHDLR* eventhdlr, /**< event handler */
7230  SCIP_DECL_EVENTFREE ((*eventfree)) /**< deinitialization callback of the event handler */
7231  )
7232 {
7233  assert(scip != NULL);
7234  SCIP_CALL( checkStage(scip, "SCIPsetEventhdlrFree", TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE) );
7235 
7236  SCIPeventhdlrSetFree(eventhdlr, eventfree);
7237  return SCIP_OKAY;
7238 }
7239 
7240 /** sets initialization callback of the event handler */
7242  SCIP* scip, /**< scip instance */
7243  SCIP_EVENTHDLR* eventhdlr, /**< event handler */
7244  SCIP_DECL_EVENTINIT ((*eventinit)) /**< initialize event handler */
7245  )
7246 {
7247  assert(scip != NULL);
7248  SCIP_CALL( checkStage(scip, "SCIPsetEventhdlrInit", TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE) );
7249 
7250  SCIPeventhdlrSetInit(eventhdlr, eventinit);
7251  return SCIP_OKAY;
7252 }
7253 
7254 /** sets deinitialization callback of the event handler */
7256  SCIP* scip, /**< scip instance */
7257  SCIP_EVENTHDLR* eventhdlr, /**< event handler */
7258  SCIP_DECL_EVENTEXIT ((*eventexit)) /**< deinitialize event handler */
7259  )
7260 {
7261  assert(scip != NULL);
7262  SCIP_CALL( checkStage(scip, "SCIPsetEventhdlrExit", TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE) );
7263 
7264  SCIPeventhdlrSetExit(eventhdlr, eventexit);
7265  return SCIP_OKAY;
7266 }
7267 
7268 /** sets solving process initialization callback of the event handler */
7270  SCIP* scip, /**< scip instance */
7271  SCIP_EVENTHDLR* eventhdlr, /**< event handler */
7272  SCIP_DECL_EVENTINITSOL((*eventinitsol)) /**< solving process initialization callback of event handler */
7273  )
7274 {
7275  assert(scip != NULL);
7276  SCIP_CALL( checkStage(scip, "SCIPsetEventhdlrInitsol", TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE) );
7277 
7278  SCIPeventhdlrSetInitsol(eventhdlr, eventinitsol);
7279  return SCIP_OKAY;
7280 }
7281 
7282 /** sets solving process deinitialization callback of the event handler */
7284  SCIP* scip, /**< scip instance */
7285  SCIP_EVENTHDLR* eventhdlr, /**< event handler */
7286  SCIP_DECL_EVENTEXITSOL((*eventexitsol)) /**< solving process deinitialization callback of event handler */
7287  )
7288 {
7289  assert(scip != NULL);
7290  SCIP_CALL( checkStage(scip, "SCIPsetEventhdlrExitsol", TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE) );
7291 
7292  SCIPeventhdlrSetExitsol(eventhdlr, eventexitsol);
7293  return SCIP_OKAY;
7294 }
7295 
7296 /** sets callback of the event handler to free specific event data */
7298  SCIP* scip, /**< scip instance */
7299  SCIP_EVENTHDLR* eventhdlr, /**< event handler */
7300  SCIP_DECL_EVENTDELETE ((*eventdelete)) /**< free specific event data */
7301  )
7302 {
7303  assert(scip != NULL);
7304  SCIP_CALL( checkStage(scip, "SCIPsetEventhdlrDelete", TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE) );
7305 
7306  SCIPeventhdlrSetDelete(eventhdlr, eventdelete);
7307  return SCIP_OKAY;
7308 }
7309 
7310 /** returns the event handler of the given name, or NULL if not existing */
7312  SCIP* scip, /**< SCIP data structure */
7313  const char* name /**< name of event handler */
7314  )
7315 {
7316  assert(scip != NULL);
7317  assert(scip->set != NULL);
7318  assert(name != NULL);
7319 
7320  return SCIPsetFindEventhdlr(scip->set, name);
7321 }
7322 
7323 /** returns the array of currently available event handlers */
7325  SCIP* scip /**< SCIP data structure */
7326  )
7327 {
7328  assert(scip != NULL);
7329  assert(scip->set != NULL);
7330 
7331  return scip->set->eventhdlrs;
7332 }
7333 
7334 /** returns the number of currently available event handlers */
7336  SCIP* scip /**< SCIP data structure */
7337  )
7338 {
7339  assert(scip != NULL);
7340  assert(scip->set != NULL);
7341 
7342  return scip->set->neventhdlrs;
7343 }
7344 
7345 /** creates a node selector and includes it in SCIP.
7346  *
7347  * @note method has all node selector callbacks as arguments and is thus changed every time a new
7348  * callback is added in future releases; consider using SCIPincludeNodeselBasic() and setter functions
7349  * if you seek for a method which is less likely to change in future releases
7350  */
7352  SCIP* scip, /**< SCIP data structure */
7353  const char* name, /**< name of node selector */
7354  const char* desc, /**< description of node selector */
7355  int stdpriority, /**< priority of the node selector in standard mode */
7356  int memsavepriority, /**< priority of the node selector in memory saving mode */
7357  SCIP_DECL_NODESELCOPY ((*nodeselcopy)), /**< copy method of node selector or NULL if you don't want to copy your plugin into sub-SCIPs */
7358  SCIP_DECL_NODESELFREE ((*nodeselfree)), /**< destructor of node selector */
7359  SCIP_DECL_NODESELINIT ((*nodeselinit)), /**< initialize node selector */
7360  SCIP_DECL_NODESELEXIT ((*nodeselexit)), /**< deinitialize node selector */
7361  SCIP_DECL_NODESELINITSOL((*nodeselinitsol)),/**< solving process initialization method of node selector */
7362  SCIP_DECL_NODESELEXITSOL((*nodeselexitsol)),/**< solving process deinitialization method of node selector */
7363  SCIP_DECL_NODESELSELECT((*nodeselselect)),/**< node selection method */
7364  SCIP_DECL_NODESELCOMP ((*nodeselcomp)), /**< node comparison method */
7365  SCIP_NODESELDATA* nodeseldata /**< node selector data */
7366  )
7367 {
7368  SCIP_NODESEL* nodesel;
7369 
7370  SCIP_CALL( checkStage(scip, "SCIPincludeNodesel", TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE) );
7371 
7372  /* check whether node selector is already present */
7373  if( SCIPfindNodesel(scip, name) != NULL )
7374  {
7375  SCIPerrorMessage("node selector <%s> already included.\n", name);
7376  return SCIP_INVALIDDATA;
7377  }
7378 
7379  SCIP_CALL( SCIPnodeselCreate(&nodesel, scip->set, scip->messagehdlr, scip->mem->setmem, name, desc, stdpriority, memsavepriority,
7380  nodeselcopy,
7381  nodeselfree, nodeselinit, nodeselexit, nodeselinitsol, nodeselexitsol,
7382  nodeselselect, nodeselcomp, nodeseldata) );
7383  SCIP_CALL( SCIPsetIncludeNodesel(scip->set, nodesel) );
7384 
7385  return SCIP_OKAY;
7386 }
7387 
7388 /** Creates a node selector and includes it in SCIP with its most fundamental callbacks. All non-fundamental
7389  * (or optional) callbacks as, e.g., init and exit callbacks, will be set to NULL.
7390  * Optional callbacks can be set via specific setter functions, see SCIPsetNodeselCopy(), SCIPsetNodeselFree(),
7391  * SCIPsetNodeselInit(), SCIPsetNodeselExit(), SCIPsetNodeselInitsol(), and SCIPsetNodeselExitsol()
7392  *
7393  * @note if you want to set all callbacks with a single method call, consider using SCIPincludeNodesel() instead
7394  */
7396  SCIP* scip, /**< SCIP data structure */
7397  SCIP_NODESEL** nodesel, /**< reference to a node selector, or NULL */
7398  const char* name, /**< name of node selector */
7399  const char* desc, /**< description of node selector */
7400  int stdpriority, /**< priority of the node selector in standard mode */
7401  int memsavepriority, /**< priority of the node selector in memory saving mode */
7402  SCIP_DECL_NODESELSELECT((*nodeselselect)),/**< node selection method */
7403  SCIP_DECL_NODESELCOMP ((*nodeselcomp)), /**< node comparison method */
7404  SCIP_NODESELDATA* nodeseldata /**< node selector data */
7405  )
7406 {
7407  SCIP_NODESEL* nodeselptr;
7408 
7409  SCIP_CALL( checkStage(scip, "SCIPincludeNodeselBasic", TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE) );
7410 
7411  /* check whether node selector is already present */
7412  if( SCIPfindNodesel(scip, name) != NULL )
7413  {
7414  SCIPerrorMessage("node selector <%s> already included.\n", name);
7415  return SCIP_INVALIDDATA;
7416  }
7417 
7418  SCIP_CALL( SCIPnodeselCreate(&nodeselptr, scip->set, scip->messagehdlr, scip->mem->setmem, name, desc, stdpriority, memsavepriority,
7419  NULL,
7420  NULL, NULL, NULL, NULL, NULL,
7421  nodeselselect, nodeselcomp, nodeseldata) );
7422  SCIP_CALL( SCIPsetIncludeNodesel(scip->set, nodeselptr) );
7423 
7424  if( nodesel != NULL )
7425  *nodesel = nodeselptr;
7426 
7427  return SCIP_OKAY;
7428 }
7429 
7430 /** sets copy method of node selector */
7432  SCIP* scip, /**< SCIP data structure */
7433  SCIP_NODESEL* nodesel, /**< node selector */
7434  SCIP_DECL_NODESELCOPY ((*nodeselcopy)) /**< copy method of node selector or NULL if you don't want to copy your plugin into sub-SCIPs */
7435  )
7436 {
7437  SCIP_CALL( checkStage(scip, "SCIPsetNodeselCopy", TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE) );
7438 
7439  assert(nodesel != NULL);
7440 
7441  SCIPnodeselSetCopy(nodesel, nodeselcopy);
7442 
7443  return SCIP_OKAY;
7444 }
7445 
7446 /** sets destructor method of node selector */
7448  SCIP* scip, /**< SCIP data structure */
7449  SCIP_NODESEL* nodesel, /**< node selector */
7450  SCIP_DECL_NODESELFREE ((*nodeselfree)) /**< destructor of node selector */
7451  )
7452 {
7453  SCIP_CALL( checkStage(scip, "SCIPsetNodeselFree", TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE) );
7454 
7455  assert(nodesel != NULL);
7456 
7457  SCIPnodeselSetFree(nodesel, nodeselfree);
7458 
7459  return SCIP_OKAY;
7460 }
7461 
7462 /** sets initialization method of node selector */
7464  SCIP* scip, /**< SCIP data structure */
7465  SCIP_NODESEL* nodesel, /**< node selector */
7466  SCIP_DECL_NODESELINIT ((*nodeselinit)) /**< initialize node selector */
7467  )
7468 {
7469  SCIP_CALL( checkStage(scip, "SCIPsetNodeselInit", TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE) );
7470 
7471  assert(nodesel != NULL);
7472 
7473  SCIPnodeselSetInit(nodesel, nodeselinit);
7474 
7475  return SCIP_OKAY;
7476 }
7477 
7478 /** sets deinitialization method of node selector */
7480  SCIP* scip, /**< SCIP data structure */
7481  SCIP_NODESEL* nodesel, /**< node selector */
7482  SCIP_DECL_NODESELEXIT ((*nodeselexit)) /**< deinitialize node selector */
7483  )
7484 {
7485  SCIP_CALL( checkStage(scip, "SCIPsetNodeselExit", TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE) );
7486 
7487  assert(nodesel != NULL);
7488 
7489  SCIPnodeselSetExit(nodesel, nodeselexit);
7490 
7491  return SCIP_OKAY;
7492 }
7493 
7494 /** sets solving process initialization method of node selector */
7496  SCIP* scip, /**< SCIP data structure */
7497  SCIP_NODESEL* nodesel, /**< node selector */
7498  SCIP_DECL_NODESELINITSOL ((*nodeselinitsol))/**< solving process initialization method of node selector */
7499  )
7500 {
7501  SCIP_CALL( checkStage(scip, "SCIPsetNodeselInitsol", TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE) );
7502 
7503  assert(nodesel != NULL);
7504 
7505  SCIPnodeselSetInitsol(nodesel, nodeselinitsol);
7506 
7507  return SCIP_OKAY;
7508 }
7509 
7510 /** sets solving process deinitialization method of node selector */
7512  SCIP* scip, /**< SCIP data structure */
7513  SCIP_NODESEL* nodesel, /**< node selector */
7514  SCIP_DECL_NODESELEXITSOL ((*nodeselexitsol))/**< solving process deinitialization method of node selector */
7515  )
7516 {
7517  SCIP_CALL( checkStage(scip, "SCIPsetNodeselExitsol", TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE) );
7518 
7519  assert(nodesel != NULL);
7520 
7521  SCIPnodeselSetExitsol(nodesel, nodeselexitsol);
7522 
7523  return SCIP_OKAY;
7524 }
7525 
7526 /** returns the node selector of the given name, or NULL if not existing */
7528  SCIP* scip, /**< SCIP data structure */
7529  const char* name /**< name of node selector */
7530  )
7531 {
7532  assert(scip != NULL);
7533  assert(scip->set != NULL);
7534  assert(name != NULL);
7535 
7536  return SCIPsetFindNodesel(scip->set, name);
7537 }
7538 
7539 /** returns the array of currently available node selectors */
7541  SCIP* scip /**< SCIP data structure */
7542  )
7543 {
7544  assert(scip != NULL);
7545  assert(scip->set != NULL);
7546 
7547  return scip->set->nodesels;
7548 }
7549 
7550 /** returns the number of currently available node selectors */
7552  SCIP* scip /**< SCIP data structure */
7553  )
7554 {
7555  assert(scip != NULL);
7556  assert(scip->set != NULL);
7557 
7558  return scip->set->nnodesels;
7559 }
7560 
7561 /** sets the priority of a node selector in standard mode */
7563  SCIP* scip, /**< SCIP data structure */
7564  SCIP_NODESEL* nodesel, /**< node selector */
7565  int priority /**< new standard priority of the node selector */
7566  )
7567 {
7568  assert(scip != NULL);
7569  assert(scip->set != NULL);
7570 
7571  SCIPnodeselSetStdPriority(nodesel, scip->set, priority);
7572 
7573  return SCIP_OKAY;
7574 }
7575 
7576 /** sets the priority of a node selector in memory saving mode */
7578  SCIP* scip, /**< SCIP data structure */
7579  SCIP_NODESEL* nodesel, /**< node selector */
7580  int priority /**< new memory saving priority of the node selector */
7581  )
7582 {
7583  assert(scip != NULL);
7584  assert(scip->set != NULL);
7585 
7586  SCIPnodeselSetMemsavePriority(nodesel, scip->set, priority);
7587 
7588  return SCIP_OKAY;
7589 }
7590 
7591 /** returns the currently used node selector */
7593  SCIP* scip /**< SCIP data structure */
7594  )
7595 {
7596  assert(scip != NULL);
7597  assert(scip->set != NULL);
7598 
7599  return SCIPsetGetNodesel(scip->set, scip->stat);
7600 }
7601 
7602 /** creates a branching rule and includes it in SCIP
7603  *
7604  * @note method has all branching rule callbacks as arguments and is thus changed every time a new
7605  * callback is added in future releases; consider using SCIPincludeBranchruleBasic() and setter functions
7606  * if you seek for a method which is less likely to change in future releases
7607  */
7609  SCIP* scip, /**< SCIP data structure */
7610  const char* name, /**< name of branching rule */
7611  const char* desc, /**< description of branching rule */
7612  int priority, /**< priority of the branching rule */
7613  int maxdepth, /**< maximal depth level, up to which this branching rule should be used (or -1) */
7614  SCIP_Real maxbounddist, /**< maximal relative distance from current node's dual bound to primal bound
7615  * compared to best node's dual bound for applying branching rule
7616  * (0.0: only on current best node, 1.0: on all nodes) */
7617  SCIP_DECL_BRANCHCOPY ((*branchcopy)), /**< copy method of branching rule or NULL if you don't want to copy your plugin into sub-SCIPs */
7618  SCIP_DECL_BRANCHFREE ((*branchfree)), /**< destructor of branching rule */
7619  SCIP_DECL_BRANCHINIT ((*branchinit)), /**< initialize branching rule */
7620  SCIP_DECL_BRANCHEXIT ((*branchexit)), /**< deinitialize branching rule */
7621  SCIP_DECL_BRANCHINITSOL((*branchinitsol)),/**< solving process initialization method of branching rule */
7622  SCIP_DECL_BRANCHEXITSOL((*branchexitsol)),/**< solving process deinitialization method of branching rule */
7623  SCIP_DECL_BRANCHEXECLP((*branchexeclp)), /**< branching execution method for fractional LP solutions */
7624  SCIP_DECL_BRANCHEXECEXT((*branchexecext)),/**< branching execution method for external candidates */
7625  SCIP_DECL_BRANCHEXECPS((*branchexecps)), /**< branching execution method for not completely fixed pseudo solutions */
7626  SCIP_BRANCHRULEDATA* branchruledata /**< branching rule data */
7627  )
7628 {
7629  SCIP_BRANCHRULE* branchrule;
7630 
7631  SCIP_CALL( checkStage(scip, "SCIPincludeBranchrule", TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE) );
7632 
7633  /* check whether branching rule is already present */
7634  if( SCIPfindBranchrule(scip, name) != NULL )
7635  {
7636  SCIPerrorMessage("branching rule <%s> already included.\n", name);
7637  return SCIP_INVALIDDATA;
7638  }
7639 
7640  SCIP_CALL( SCIPbranchruleCreate(&branchrule, scip->set, scip->messagehdlr, scip->mem->setmem,
7641  name, desc, priority, maxdepth,
7642  maxbounddist, branchcopy, branchfree, branchinit, branchexit, branchinitsol, branchexitsol,
7643  branchexeclp, branchexecext, branchexecps, branchruledata) );
7644  SCIP_CALL( SCIPsetIncludeBranchrule(scip->set, branchrule) );
7645 
7646  return SCIP_OKAY;
7647 }
7648 
7649 /** creates a branching rule and includes it in SCIP. All non-fundamental (or optional) callbacks will be set to NULL.
7650  * Optional callbacks can be set via specific setter functions, see SCIPsetBranchruleInit(), SCIPsetBranchruleExit(),
7651  * SCIPsetBranchruleCopy(), SCIPsetBranchruleFree(), SCIPsetBranchruleInitsol(), SCIPsetBranchruleExitsol(),
7652  * SCIPsetBranchruleExecLp(), SCIPsetBranchruleExecExt(), and SCIPsetBranchruleExecPs().
7653  *
7654  * @note if you want to set all callbacks with a single method call, consider using SCIPincludeBranchrule() instead
7655  */
7657  SCIP* scip, /**< SCIP data structure */
7658  SCIP_BRANCHRULE** branchruleptr, /**< pointer to branching rule, or NULL */
7659  const char* name, /**< name of branching rule */
7660  const char* desc, /**< description of branching rule */
7661  int priority, /**< priority of the branching rule */
7662  int maxdepth, /**< maximal depth level, up to which this branching rule should be used (or -1) */
7663  SCIP_Real maxbounddist, /**< maximal relative distance from current node's dual bound to primal bound
7664  * compared to best node's dual bound for applying branching rule
7665  * (0.0: only on current best node, 1.0: on all nodes) */
7666  SCIP_BRANCHRULEDATA* branchruledata /**< branching rule data */
7667  )
7668 {
7669  SCIP_BRANCHRULE* branchrule;
7670 
7671  SCIP_CALL( checkStage(scip, "SCIPincludeBranchruleBasic", TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE) );
7672 
7673  /* check whether branching rule is already present */
7674  if( SCIPfindBranchrule(scip, name) != NULL )
7675  {
7676  SCIPerrorMessage("branching rule <%s> already included.\n", name);
7677  return SCIP_INVALIDDATA;
7678  }
7679 
7680  SCIP_CALL( SCIPbranchruleCreate(&branchrule, scip->set, scip->messagehdlr, scip->mem->setmem, name, desc, priority, maxdepth,
7681  maxbounddist, NULL, NULL, NULL, NULL, NULL, NULL,
7682  NULL, NULL, NULL, branchruledata) );
7683 
7684  SCIP_CALL( SCIPsetIncludeBranchrule(scip->set, branchrule) );
7685 
7686  if( branchruleptr != NULL )
7687  *branchruleptr = branchrule;
7688 
7689  return SCIP_OKAY;
7690 }
7691 
7692 /** sets copy method of branching rule */
7694  SCIP* scip, /**< SCIP data structure */
7695  SCIP_BRANCHRULE* branchrule, /**< branching rule */
7696  SCIP_DECL_BRANCHCOPY ((*branchcopy)) /**< copy method of branching rule or NULL if you don't want to copy your plugin into sub-SCIPs */
7697  )
7698 {
7699  SCIP_CALL( checkStage(scip, "SCIPsetBranchruleCopy", TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE) );
7700 
7701  assert(branchrule != NULL);
7702 
7703  SCIPbranchruleSetCopy(branchrule, branchcopy);
7704 
7705  return SCIP_OKAY;
7706 }
7707 
7708 /** sets destructor method of branching rule */
7710  SCIP* scip, /**< SCIP data structure */
7711  SCIP_BRANCHRULE* branchrule, /**< branching rule */
7712  SCIP_DECL_BRANCHFREE ((*branchfree)) /**< destructor of branching rule */
7713  )
7714 {
7715  SCIP_CALL( checkStage(scip, "SCIPsetBranchruleFree", TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE) );
7716 
7717  assert(branchrule != NULL);
7718 
7719  SCIPbranchruleSetFree(branchrule, branchfree);
7720 
7721  return SCIP_OKAY;
7722 }
7723 
7724 /** sets initialization method of branching rule */
7726  SCIP* scip, /**< SCIP data structure */
7727  SCIP_BRANCHRULE* branchrule, /**< branching rule */
7728  SCIP_DECL_BRANCHINIT ((*branchinit)) /**< initialize branching rule */
7729  )
7730 {
7731  SCIP_CALL( checkStage(scip, "SCIPsetBranchruleInit", TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE) );
7732 
7733  assert(branchrule != NULL);
7734 
7735  SCIPbranchruleSetInit(branchrule, branchinit);
7736 
7737  return SCIP_OKAY;
7738 }
7739 
7740 /** sets deinitialization method of branching rule */
7742  SCIP* scip, /**< SCIP data structure */
7743  SCIP_BRANCHRULE* branchrule, /**< branching rule */
7744  SCIP_DECL_BRANCHEXIT ((*branchexit)) /**< deinitialize branching rule */
7745  )
7746 {
7747  SCIP_CALL( checkStage(scip, "SCIPsetBranchruleExit", TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE) );
7748 
7749  assert(branchrule != NULL);
7750 
7751  SCIPbranchruleSetExit(branchrule, branchexit);
7752 
7753  return SCIP_OKAY;
7754 }
7755 
7756 /** sets solving process initialization method of branching rule */
7758  SCIP* scip, /**< SCIP data structure */
7759  SCIP_BRANCHRULE* branchrule, /**< branching rule */
7760  SCIP_DECL_BRANCHINITSOL((*branchinitsol)) /**< solving process initialization method of branching rule */
7761  )
7762 {
7763  SCIP_CALL( checkStage(scip, "SCIPsetBranchruleInitsol", TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE) );
7764 
7765  assert(branchrule != NULL);
7766 
7767  SCIPbranchruleSetInitsol(branchrule, branchinitsol);
7768 
7769  return SCIP_OKAY;
7770 }
7771 
7772 /** sets solving process deinitialization method of branching rule */
7774  SCIP* scip, /**< SCIP data structure */
7775  SCIP_BRANCHRULE* branchrule, /**< branching rule */
7776  SCIP_DECL_BRANCHEXITSOL((*branchexitsol)) /**< solving process deinitialization method of branching rule */
7777  )
7778 {
7779  SCIP_CALL( checkStage(scip, "SCIPsetBranchruleExitsol", TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE) );
7780 
7781  assert(branchrule != NULL);
7782 
7783  SCIPbranchruleSetExitsol(branchrule, branchexitsol);
7784 
7785  return SCIP_OKAY;
7786 }
7787 
7788 
7789 
7790 /** sets branching execution method for fractional LP solutions */
7792  SCIP* scip, /**< SCIP data structure */
7793  SCIP_BRANCHRULE* branchrule, /**< branching rule */
7794  SCIP_DECL_BRANCHEXECLP((*branchexeclp)) /**< branching execution method for fractional LP solutions */
7795  )
7796 {
7797  SCIP_CALL( checkStage(scip, "SCIPsetBranchruleExecLp", TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE) );
7798 
7799  assert(branchrule != NULL);
7800 
7801  SCIPbranchruleSetExecLp(branchrule, branchexeclp);
7802 
7803  return SCIP_OKAY;
7804 }
7805 
7806 /** sets branching execution method for external candidates */
7808  SCIP* scip, /**< SCIP data structure */
7809  SCIP_BRANCHRULE* branchrule, /**< branching rule */
7810  SCIP_DECL_BRANCHEXECEXT((*branchexecext)) /**< branching execution method for external candidates */
7811  )
7812 {
7813  SCIP_CALL( checkStage(scip, "SCIPsetBranchruleExecExt", TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE) );
7814 
7815  assert(branchrule != NULL);
7816 
7817  SCIPbranchruleSetExecExt(branchrule, branchexecext);
7818 
7819  return SCIP_OKAY;
7820 }
7821 
7822 /** sets branching execution method for not completely fixed pseudo solutions */
7824  SCIP* scip, /**< SCIP data structure */
7825  SCIP_BRANCHRULE* branchrule, /**< branching rule */
7826  SCIP_DECL_BRANCHEXECPS((*branchexecps)) /**< branching execution method for not completely fixed pseudo solutions */
7827  )
7828 {
7829  SCIP_CALL( checkStage(scip, "SCIPsetBranchruleExecPs", TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE) );
7830 
7831  assert(branchrule != NULL);
7832 
7833  SCIPbranchruleSetExecPs(branchrule, branchexecps);
7834 
7835  return SCIP_OKAY;
7836 }
7837 
7838 /** returns the branching rule of the given name, or NULL if not existing */
7840  SCIP* scip, /**< SCIP data structure */
7841  const char* name /**< name of branching rule */
7842  )
7843 {
7844  assert(scip != NULL);
7845  assert(scip->set != NULL);
7846  assert(name != NULL);
7847 
7848  SCIPsetSortBranchrules(scip->set);
7849 
7850  return SCIPsetFindBranchrule(scip->set, name);
7851 }
7852 
7853 /** returns the array of currently available branching rules */
7855  SCIP* scip /**< SCIP data structure */
7856  )
7857 {
7858  assert(scip != NULL);
7859  assert(scip->set != NULL);
7860 
7861  return scip->set->branchrules;
7862 }
7863 
7864 /** returns the number of currently available branching rules */
7866  SCIP* scip /**< SCIP data structure */
7867  )
7868 {
7869  assert(scip != NULL);
7870  assert(scip->set != NULL);
7871 
7872  return scip->set->nbranchrules;
7873 }
7874 
7875 /** sets the priority of a branching rule */
7877  SCIP* scip, /**< SCIP data structure */
7878  SCIP_BRANCHRULE* branchrule, /**< branching rule */
7879  int priority /**< new priority of the branching rule */
7880  )
7881 {
7882  assert(scip != NULL);
7883  assert(scip->set != NULL);
7884 
7885  SCIPbranchruleSetPriority(branchrule, scip->set, priority);
7886 
7887  return SCIP_OKAY;
7888 }
7889 
7890 /** sets maximal depth level, up to which this branching rule should be used (-1 for no limit) */
7892  SCIP* scip, /**< SCIP data structure */
7893  SCIP_BRANCHRULE* branchrule, /**< branching rule */
7894  int maxdepth /**< new maxdepth of the branching rule */
7895  )
7896 {
7897  assert(scip != NULL);
7898  assert(scip->set != NULL);
7899 
7900  SCIPbranchruleSetMaxdepth(branchrule, maxdepth);
7901 
7902  return SCIP_OKAY;
7903 }
7904 
7905 /** sets maximal relative distance from current node's dual bound to primal bound for applying branching rule */
7907  SCIP* scip, /**< SCIP data structure */
7908  SCIP_BRANCHRULE* branchrule, /**< branching rule */
7909  SCIP_Real maxbounddist /**< new maxbounddist of the branching rule */
7910  )
7911 {
7912  assert(scip != NULL);
7913  assert(scip->set != NULL);
7914 
7915  SCIPbranchruleSetMaxbounddist(branchrule, maxbounddist);
7916 
7917  return SCIP_OKAY;
7918 }
7919 
7920 /** creates a display column and includes it in SCIP */
7922  SCIP* scip, /**< SCIP data structure */
7923  const char* name, /**< name of display column */
7924  const char* desc, /**< description of display column */
7925  const char* header, /**< head line of display column */
7926  SCIP_DISPSTATUS dispstatus, /**< display activation status of display column */
7927  SCIP_DECL_DISPCOPY ((*dispcopy)), /**< copy method of display column or NULL if you don't want to copy your plugin into sub-SCIPs */
7928  SCIP_DECL_DISPFREE ((*dispfree)), /**< destructor of display column */
7929  SCIP_DECL_DISPINIT ((*dispinit)), /**< initialize display column */
7930  SCIP_DECL_DISPEXIT ((*dispexit)), /**< deinitialize display column */
7931  SCIP_DECL_DISPINITSOL ((*dispinitsol)), /**< solving process initialization method of display column */
7932  SCIP_DECL_DISPEXITSOL ((*dispexitsol)), /**< solving process deinitialization method of display column */
7933  SCIP_DECL_DISPOUTPUT ((*dispoutput)), /**< output method */
7934  SCIP_DISPDATA* dispdata, /**< display column data */
7935  int width, /**< width of display column (no. of chars used) */
7936  int priority, /**< priority of display column */
7937  int position, /**< relative position of display column */
7938  SCIP_Bool stripline /**< should the column be separated with a line from its right neighbor? */
7939  )
7940 {
7941  SCIP_DISP* disp;
7942 
7943  SCIP_CALL( checkStage(scip, "SCIPincludeDisp", TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE) );
7944 
7945  /* check whether display column is already present */
7946  if( SCIPfindDisp(scip, name) != NULL )
7947  {
7948  SCIPerrorMessage("display column <%s> already included.\n", name);
7949  return SCIP_INVALIDDATA;
7950  }
7951 
7952  SCIP_CALL( SCIPdispCreate(&disp, scip->set, scip->messagehdlr, scip->mem->setmem,
7953  name, desc, header, dispstatus,
7954  dispcopy,
7955  dispfree, dispinit, dispexit, dispinitsol, dispexitsol, dispoutput, dispdata,
7956  width, priority, position, stripline) );
7957  SCIP_CALL( SCIPsetIncludeDisp(scip->set, disp) );
7958 
7959  return SCIP_OKAY;
7960 }
7961 
7962 /** returns the display column of the given name, or NULL if not existing */
7964  SCIP* scip, /**< SCIP data structure */
7965  const char* name /**< name of display column */
7966  )
7967 {
7968  assert(scip != NULL);
7969  assert(scip->set != NULL);
7970  assert(name != NULL);
7971 
7972  return SCIPsetFindDisp(scip->set, name);
7973 }
7974 
7975 /** returns the array of currently available display columns */
7977  SCIP* scip /**< SCIP data structure */
7978  )
7979 {
7980  assert(scip != NULL);
7981  assert(scip->set != NULL);
7982 
7983  return scip->set->disps;
7984 }
7985 
7986 /** returns the number of currently available display columns */
7988  SCIP* scip /**< SCIP data structure */
7989  )
7990 {
7991  assert(scip != NULL);
7992  assert(scip->set != NULL);
7993 
7994  return scip->set->ndisps;
7995 }
7996 
7997 /** automatically selects display columns for being shown w.r.t. the display width parameter */
7999  SCIP* scip /**< SCIP data structure */
8000  )
8001 {
8002  assert(scip != NULL);
8003  assert(scip->set != NULL);
8004 
8006 
8007  return SCIP_OKAY;
8008 }
8009 
8010 /** method to call, when the priority of an NLPI was changed */
8011 static
8012 SCIP_DECL_PARAMCHGD(paramChgdNlpiPriority)
8013 { /*lint --e{715}*/
8014  SCIP_PARAMDATA* paramdata;
8015 
8016  paramdata = SCIPparamGetData(param);
8017  assert(paramdata != NULL);
8018 
8019  /* use SCIPsetSetPriorityNlpi() to mark the nlpis unsorted */
8020  SCIP_CALL( SCIPsetNlpiPriority(scip, (SCIP_NLPI*)paramdata, SCIPparamGetInt(param)) );
8021 
8022  return SCIP_OKAY;
8023 }
8024 
8025 /** includes an NLPI in SCIP */
8027  SCIP* scip, /**< SCIP data structure */
8028  SCIP_NLPI* nlpi /**< NLPI data structure */
8029  )
8030 {
8031  char paramname[SCIP_MAXSTRLEN];
8032  char paramdesc[SCIP_MAXSTRLEN];
8033 
8034  assert(scip != NULL);
8035  assert(nlpi != NULL);
8036 
8037  SCIP_CALL( checkStage(scip, "SCIPincludeNlpi", TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE) );
8038 
8039  /* check whether NLPI is already present */
8040  if( SCIPfindNlpi(scip, SCIPnlpiGetName(nlpi)) != NULL )
8041  {
8042  SCIPerrorMessage("NLPI <%s> already included.\n", SCIPnlpiGetName(nlpi));
8043  return SCIP_INVALIDDATA;
8044  }
8045 
8046  SCIP_CALL( SCIPsetIncludeNlpi(scip->set, nlpi) );
8047 
8048  /* add parameters */
8049  (void) SCIPsnprintf(paramname, SCIP_MAXSTRLEN, "nlpi/%s/priority", SCIPnlpiGetName(nlpi));
8050  (void) SCIPsnprintf(paramdesc, SCIP_MAXSTRLEN, "priority of NLPI <%s>", SCIPnlpiGetName(nlpi));
8051  SCIP_CALL( SCIPaddIntParam(scip, paramname, paramdesc,
8052  NULL, FALSE, SCIPnlpiGetPriority(nlpi), INT_MIN/4, INT_MAX/4,
8053  paramChgdNlpiPriority, (SCIP_PARAMDATA*)nlpi) ); /*lint !e740*/
8054 
8055  /* pass message handler (may be NULL) */
8057 
8058  return SCIP_OKAY;
8059 }
8060 
8061 /** returns the NLPI of the given name, or NULL if not existing */
8063  SCIP* scip, /**< SCIP data structure */
8064  const char* name /**< name of NLPI */
8065  )
8066 {
8067  assert(scip != NULL);
8068  assert(scip->set != NULL);
8069  assert(name != NULL);
8070 
8071  return SCIPsetFindNlpi(scip->set, name);
8072 }
8073 
8074 /** returns the array of currently available NLPIs (sorted by priority) */
8076  SCIP* scip /**< SCIP data structure */
8077  )
8078 {
8079  assert(scip != NULL);
8080  assert(scip->set != NULL);
8081 
8082  SCIPsetSortNlpis(scip->set);
8083 
8084  return scip->set->nlpis;
8085 }
8086 
8087 /** returns the number of currently available NLPIs */
8089  SCIP* scip /**< SCIP data structure */
8090  )
8091 {
8092  assert(scip != NULL);
8093  assert(scip->set != NULL);
8094 
8095  return scip->set->nnlpis;
8096 }
8097 
8098 /** sets the priority of an NLPI */
8100  SCIP* scip, /**< SCIP data structure */
8101  SCIP_NLPI* nlpi, /**< NLPI */
8102  int priority /**< new priority of the NLPI */
8103  )
8104 {
8105  assert(scip != NULL);
8106  assert(scip->set != NULL);
8107 
8108  SCIPsetSetPriorityNlpi(scip->set, nlpi, priority);
8109 
8110  return SCIP_OKAY;
8111 }
8112 
8113 /** includes information about an external code linked into the SCIP library */
8115  SCIP* scip, /**< SCIP data structure */
8116  const char* name, /**< name of external code */
8117  const char* description /**< description of external code, or NULL */
8118  )
8119 {
8120  assert(scip != NULL);
8121  assert(name != NULL);
8122 
8123  SCIP_CALL( checkStage(scip, "SCIPincludeExternalCodeInformation", TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE) );
8124 
8125  SCIP_CALL( SCIPsetIncludeExternalCode(scip->set, name, description) );
8126 
8127  return SCIP_OKAY;
8128 }
8129 
8130 /** returns an array of names of currently included external codes */
8132  SCIP* scip /**< SCIP data structure */
8133  )
8134 {
8135  assert(scip != NULL);
8136  assert(scip->set != NULL);
8137 
8138  return scip->set->extcodenames;
8139 }
8140 
8141 /** returns an array of the descriptions of currently included external codes
8142  *
8143  * @note some descriptions may be NULL
8144  */
8146  SCIP* scip /**< SCIP data structure */
8147  )
8148 {
8149  assert(scip != NULL);
8150  assert(scip->set != NULL);
8151 
8152  return scip->set->extcodedescs;
8153 }
8154 
8155 /** returns the number of currently included information on external codes */
8157  SCIP* scip /**< SCIP data structure */
8158  )
8159 {
8160  assert(scip != NULL);
8161  assert(scip->set != NULL);
8162 
8163  return scip->set->nextcodes;
8164 }
8165 
8166 /** prints information on external codes to a file stream via the message handler system
8167  *
8168  * @note If the message handler is set to a NULL pointer nothing will be printed
8169  */
8171  SCIP* scip, /**< SCIP data structure */
8172  FILE* file /**< output file (or NULL for standard output) */
8173  )
8174 {
8175  int i;
8176 
8177  SCIPmessageFPrintInfo(scip->messagehdlr, file, "External codes: ");
8178  if( scip->set->nextcodes == 0 )
8179  {
8180  SCIPinfoMessage(scip, file, "none\n");
8181  return;
8182  }
8183  SCIPinfoMessage(scip, file, "\n");
8184 
8185  for( i = 0; i < scip->set->nextcodes; ++i )
8186  {
8187  SCIPinfoMessage(scip, file, " %-20s %s\n", scip->set->extcodenames[i], scip->set->extcodedescs[i] != NULL ? scip->set->extcodedescs[i] : "");
8188  }
8189 }
8190 
8191 
8192 /*
8193  * user interactive dialog methods
8194  */
8195 
8196 /** creates and includes dialog
8197  *
8198  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
8199  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
8200  */
8202  SCIP* scip, /**< SCIP data structure */
8203  SCIP_DIALOG** dialog, /**< pointer to store the dialog */
8204  SCIP_DECL_DIALOGCOPY ((*dialogcopy)), /**< copy method of dialog or NULL if you don't want to copy your plugin into sub-SCIPs */
8205  SCIP_DECL_DIALOGEXEC ((*dialogexec)), /**< execution method of dialog */
8206  SCIP_DECL_DIALOGDESC ((*dialogdesc)), /**< description output method of dialog, or NULL */
8207  SCIP_DECL_DIALOGFREE ((*dialogfree)), /**< destructor of dialog to free user data, or NULL */
8208  const char* name, /**< name of dialog: command name appearing in parent's dialog menu */
8209  const char* desc, /**< description of dialog used if description output method is NULL */
8210  SCIP_Bool issubmenu, /**< is the dialog a submenu? */
8211  SCIP_DIALOGDATA* dialogdata /**< user defined dialog data */
8212  )
8213 {
8214  assert(scip != NULL);
8215  assert(dialog != NULL);
8216 
8217  /* check whether display column is already present */
8218  if( dialogcopy != NULL && SCIPexistsDialog(scip, *dialog) )
8219  {
8220  SCIPerrorMessage("dialog <%s> already included.\n", name);
8221  return SCIP_INVALIDDATA;
8222  }
8223 
8224  SCIP_CALL( SCIPdialogCreate(dialog, dialogcopy, dialogexec, dialogdesc, dialogfree, name, desc, issubmenu, dialogdata) );
8225  SCIP_CALL( SCIPsetIncludeDialog(scip->set, *dialog) );
8226 
8227  return SCIP_OKAY;
8228 }
8229 
8230 /** returns if the dialog already exists
8231  *
8232  * @return TRUE is returned if the dialog exits, otherwise FALSE.
8233  */
8235  SCIP* scip, /**< SCIP data structure */
8236  SCIP_DIALOG* dialog /**< dialog */
8237  )
8238 {
8239  assert(scip != NULL);
8240 
8241  return SCIPsetExistsDialog(scip->set, dialog);
8242 }
8243 
8244 /** captures a dialog
8245  *
8246  * @return \ref SCIP_OKAY is returned if everything worked. otherwise a suitable error code is passed. see \ref
8247  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
8248  */
8250  SCIP* scip, /**< SCIP data structure */
8251  SCIP_DIALOG* dialog /**< dialog */
8252  )
8253 {
8254  assert(scip != NULL);
8255 
8256  SCIPdialogCapture(dialog);
8257 
8258  return SCIP_OKAY;
8259 }
8260 
8261 /** releases a dialog
8262  *
8263  * @return \ref SCIP_OKAY is returned if everything worked. otherwise a suitable error code is passed. see \ref
8264  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
8265  */
8267  SCIP* scip, /**< SCIP data structure */
8268  SCIP_DIALOG** dialog /**< pointer to the dialog */
8269  )
8270 {
8271  assert(scip != NULL);
8272 
8273  SCIP_CALL( SCIPdialogRelease(scip, dialog) );
8274 
8275  return SCIP_OKAY;
8276 }
8277 
8278 /** makes given dialog the root dialog of SCIP's interactive user shell; captures dialog and releases former root dialog
8279  *
8280  * @return \ref SCIP_OKAY is returned if everything worked. otherwise a suitable error code is passed. see \ref
8281  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
8282  */
8284  SCIP* scip, /**< SCIP data structure */
8285  SCIP_DIALOG* dialog /**< dialog to be the root */
8286  )
8287 {
8288  assert(scip != NULL);
8289 
8290  SCIP_CALL( SCIPdialoghdlrSetRoot(scip, scip->dialoghdlr, dialog) );
8291 
8292  return SCIP_OKAY;
8293 }
8294 
8295 /** returns the root dialog of SCIP's interactive user shell
8296  *
8297  * @return the root dialog of SCIP's interactive user shell is returned.
8298  */
8300  SCIP* scip /**< SCIP data structure */
8301  )
8302 {
8303  assert(scip != NULL);
8304 
8305  return SCIPdialoghdlrGetRoot(scip->dialoghdlr);
8306 }
8307 
8308 /** adds a sub dialog to the given dialog as menu entry and captures it
8309  *
8310  * @return \ref SCIP_OKAY is returned if everything worked. otherwise a suitable error code is passed. see \ref
8311  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
8312  */
8314  SCIP* scip, /**< SCIP data structure */
8315  SCIP_DIALOG* dialog, /**< dialog to extend, or NULL for root dialog */
8316  SCIP_DIALOG* subdialog /**< subdialog to add as menu entry in dialog */
8317  )
8318 {
8319  assert(scip != NULL);
8320 
8321  if( dialog == NULL )
8322  dialog = SCIPdialoghdlrGetRoot(scip->dialoghdlr);
8323 
8324  SCIP_CALL( SCIPdialogAddEntry(dialog, scip->set, subdialog) );
8325 
8326  return SCIP_OKAY;
8327 }
8328 
8329 /** adds a single line of input which is treated as if the user entered the command line
8330  *
8331  * @return \ref SCIP_OKAY is returned if everything worked. otherwise a suitable error code is passed. see \ref
8332  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
8333  */
8335  SCIP* scip, /**< SCIP data structure */
8336  const char* inputline /**< input line to add */
8337  )
8338 {
8339  assert(scip != NULL);
8340 
8341  SCIP_CALL( SCIPdialoghdlrAddInputLine(scip->dialoghdlr, inputline) );
8342 
8343  return SCIP_OKAY;
8344 }
8345 
8346 /** adds a single line of input to the command history which can be accessed with the cursor keys
8347  *
8348  * @return \ref SCIP_OKAY is returned if everything worked. otherwise a suitable error code is passed. see \ref
8349  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
8350  */
8352  SCIP* scip, /**< SCIP data structure */
8353  const char* inputline /**< input line to add */
8354  )
8355 {
8356  assert(scip != NULL);
8357 
8358  SCIP_CALL( SCIPdialoghdlrAddHistory(scip->dialoghdlr, NULL, inputline, FALSE) );
8359 
8360  return SCIP_OKAY;
8361 }
8362 
8363 /** starts interactive mode of SCIP by executing the root dialog
8364  *
8365  * @return \ref SCIP_OKAY is returned if everything worked. otherwise a suitable error code is passed. see \ref
8366  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
8367  *
8368  * @pre This method can be called if @p scip is in one of the following stages:
8369  * - \ref SCIP_STAGE_INIT
8370  * - \ref SCIP_STAGE_FREE
8371  *
8372  * @post After calling this method \SCIP reaches one of the following stages depending on if and when the
8373  * interactive shell was closed:
8374  * - \ref SCIP_STAGE_PROBLEM if the interactive shell was closed after the problem was created
8375  * - \ref SCIP_STAGE_TRANSFORMED if the interactive shell was closed after the problem was transformed
8376  * - \ref SCIP_STAGE_PRESOLVING if the interactive shell was closed during presolving
8377  * - \ref SCIP_STAGE_PRESOLVED if the interactive shell was closed after presolve
8378  * - \ref SCIP_STAGE_SOLVING if the interactive shell was closed during the tree search
8379  * - \ref SCIP_STAGE_SOLVED if the interactive shell was closed after the problem was solved
8380  * - \ref SCIP_STAGE_FREE if the interactive shell was closed after the problem was freed
8381  *
8382  * See \ref SCIP_Stage "SCIP_STAGE" for a complete list of all possible solving stages.
8383  */
8385  SCIP* scip /**< SCIP data structure */
8386  )
8387 {
8388  SCIP_CALL( checkStage(scip, "SCIPstartInteraction", TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE) );
8389 
8390  /* includes or updates the default dialog menus in SCIP */
8392 
8393  SCIP_CALL( SCIPdialoghdlrExec(scip->dialoghdlr, scip->set) );
8394 
8395  return SCIP_OKAY;
8396 }
8397 
8398 
8399 
8400 
8401 /*
8402  * global problem methods
8403  */
8404 
8405 /** creates empty problem and initializes all solving data structures (the objective sense is set to MINIMIZE)
8406  * If the problem type requires the use of variable pricers, these pricers should be added to the problem with calls
8407  * to SCIPactivatePricer(). These pricers are automatically deactivated, when the problem is freed.
8408  *
8409  * @return \ref SCIP_OKAY is returned if everything worked. otherwise a suitable error code is passed. see \ref
8410  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
8411  *
8412  * @pre This method can be called if @p scip is in one of the following stages:
8413  * - \ref SCIP_STAGE_INIT
8414  * - \ref SCIP_STAGE_PROBLEM
8415  * - \ref SCIP_STAGE_TRANSFORMED
8416  * - \ref SCIP_STAGE_PRESOLVING
8417  * - \ref SCIP_STAGE_PRESOLVED
8418  * - \ref SCIP_STAGE_SOLVING
8419  * - \ref SCIP_STAGE_SOLVED
8420  * - \ref SCIP_STAGE_FREE
8421  *
8422  * @post After calling this method, \SCIP reaches the following stage:
8423  * - \ref SCIP_STAGE_PROBLEM
8424  */
8426  SCIP* scip, /**< SCIP data structure */
8427  const char* name, /**< problem name */
8428  SCIP_DECL_PROBDELORIG ((*probdelorig)), /**< frees user data of original problem */
8429  SCIP_DECL_PROBTRANS ((*probtrans)), /**< creates user data of transformed problem by transforming original user data */
8430  SCIP_DECL_PROBDELTRANS((*probdeltrans)), /**< frees user data of transformed problem */
8431  SCIP_DECL_PROBINITSOL ((*probinitsol)), /**< solving process initialization method of transformed data */
8432  SCIP_DECL_PROBEXITSOL ((*probexitsol)), /**< solving process deinitialization method of transformed data */
8433  SCIP_DECL_PROBCOPY ((*probcopy)), /**< copies user data if you want to copy it to a subscip, or NULL */
8434  SCIP_PROBDATA* probdata /**< user problem data set by the reader */
8435  )
8436 {
8437  SCIP_CALL( checkStage(scip, "SCIPcreateProb", TRUE, TRUE, FALSE, TRUE, FALSE, TRUE, FALSE, TRUE, FALSE, TRUE, TRUE, FALSE, FALSE, TRUE) );
8438 
8439  /* free old problem */
8440  SCIP_CALL( SCIPfreeProb(scip) );
8441  assert(scip->set->stage == SCIP_STAGE_INIT);
8442 
8443  /* switch stage to PROBLEM */
8444  scip->set->stage = SCIP_STAGE_PROBLEM;
8445 
8446  SCIP_CALL( SCIPstatCreate(&scip->stat, scip->mem->probmem, scip->set, scip->messagehdlr) );
8447 
8449 
8450  SCIP_CALL( SCIPprobCreate(&scip->origprob, scip->mem->probmem, scip->set, name,
8451  probdelorig, probtrans, probdeltrans, probinitsol, probexitsol, probcopy, probdata, FALSE) );
8452 
8453  /* create solution pool for original solution candidates */
8455 
8456  return SCIP_OKAY;
8457 }
8458 
8459 /** creates empty problem and initializes all solving data structures (the objective sense is set to MINIMIZE)
8460  * all callback methods will be set to NULL and can be set afterwards, if needed, via SCIPsetProbDelorig(),
8461  * SCIPsetProbTrans(), SCIPsetProbDeltrans(), SCIPsetProbInitsol(), SCIPsetProbExitsol(), and
8462  * SCIPsetProbCopy()
8463  * If the problem type requires the use of variable pricers, these pricers should be added to the problem with calls
8464  * to SCIPactivatePricer(). These pricers are automatically deactivated, when the problem is freed.
8465  *
8466  * @return \ref SCIP_OKAY is returned if everything worked. otherwise a suitable error code is passed. see \ref
8467  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
8468  *
8469  * @pre This method can be called if @p scip is in one of the following stages:
8470  * - \ref SCIP_STAGE_INIT
8471  * - \ref SCIP_STAGE_PROBLEM
8472  * - \ref SCIP_STAGE_TRANSFORMED
8473  * - \ref SCIP_STAGE_PRESOLVING
8474  * - \ref SCIP_STAGE_PRESOLVED
8475  * - \ref SCIP_STAGE_SOLVING
8476  * - \ref SCIP_STAGE_SOLVED
8477  * - \ref SCIP_STAGE_FREE
8478  *
8479  * @post After calling this method, \SCIP reaches the following stage:
8480  * - \ref SCIP_STAGE_PROBLEM
8481  */
8483  SCIP* scip, /**< SCIP data structure */
8484  const char* name /**< problem name */
8485  )
8486 {
8487  SCIP_CALL( checkStage(scip, "SCIPcreateProbBasic", TRUE, TRUE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, TRUE, TRUE, FALSE, FALSE, TRUE) );
8488 
8489  SCIP_CALL( SCIPcreateProb(scip, name, NULL, NULL, NULL, NULL, NULL, NULL, NULL) );
8490 
8491  return SCIP_OKAY;
8492 }
8493 
8494 /** sets callback to free user data of original problem
8495  *
8496  * @return \ref SCIP_OKAY is returned if everything worked. otherwise a suitable error code is passed. see \ref
8497  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
8498  *
8499  * @pre This method can be called if @p scip is in one of the following stages:
8500  * - \ref SCIP_STAGE_PROBLEM
8501  */
8503  SCIP* scip, /**< SCIP data structure */
8504  SCIP_DECL_PROBDELORIG ((*probdelorig)) /**< frees user data of original problem */
8505  )
8506 {
8507  assert(scip != NULL);
8508  SCIP_CALL( checkStage(scip, "SCIPsetProbDelorig", FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE) );
8509 
8510  SCIPprobSetDelorig(scip->origprob, probdelorig);
8511 
8512  return SCIP_OKAY;
8513 }
8514 
8515 /** sets callback to create user data of transformed problem by transforming original user data
8516  *
8517  * @return \ref SCIP_OKAY is returned if everything worked. otherwise a suitable error code is passed. see \ref
8518  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
8519  *
8520  * @pre This method can be called if @p scip is in one of the following stages:
8521  * - \ref SCIP_STAGE_PROBLEM
8522  */
8524  SCIP* scip, /**< SCIP data structure */
8525  SCIP_DECL_PROBTRANS ((*probtrans)) /**< creates user data of transformed problem by transforming original user data */
8526  )
8527 {
8528  assert(scip != NULL);
8529  SCIP_CALL( checkStage(scip, "SCIPsetProbTrans", FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE) );
8530 
8531  SCIPprobSetTrans(scip->origprob, probtrans);
8532 
8533  return SCIP_OKAY;
8534 }
8535 
8536 /** sets callback to free user data of transformed problem
8537  *
8538  * @return \ref SCIP_OKAY is returned if everything worked. otherwise a suitable error code is passed. see \ref
8539  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
8540  *
8541  * @pre This method can be called if @p scip is in one of the following stages:
8542  * - \ref SCIP_STAGE_PROBLEM
8543  */
8545  SCIP* scip, /**< SCIP data structure */
8546  SCIP_DECL_PROBDELTRANS((*probdeltrans)) /**< frees user data of transformed problem */
8547  )
8548 {
8549  assert(scip != NULL);
8550  SCIP_CALL( checkStage(scip, "SCIPsetProbDeltrans", FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE) );
8551 
8552  SCIPprobSetDeltrans(scip->origprob, probdeltrans);
8553 
8554  return SCIP_OKAY;
8555 }
8556 
8557 /** sets solving process initialization callback of transformed data
8558  *
8559  * @return \ref SCIP_OKAY is returned if everything worked. otherwise a suitable error code is passed. see \ref
8560  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
8561  *
8562  * @pre This method can be called if @p scip is in one of the following stages:
8563  * - \ref SCIP_STAGE_PROBLEM
8564  */
8566  SCIP* scip, /**< SCIP data structure */
8567  SCIP_DECL_PROBINITSOL ((*probinitsol)) /**< solving process initialization method of transformed data */
8568  )
8569 {
8570  assert(scip != NULL);
8571 
8572  SCIP_CALL( checkStage(scip, "SCIPsetProbInitsol", FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE) );
8573 
8574  SCIPprobSetInitsol(scip->origprob, probinitsol);
8575 
8576  return SCIP_OKAY;
8577 }
8578 
8579 /** sets solving process deinitialization callback of transformed data
8580  *
8581  * @return \ref SCIP_OKAY is returned if everything worked. otherwise a suitable error code is passed. see \ref
8582  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
8583  *
8584  * @pre This method can be called if @p scip is in one of the following stages:
8585  * - \ref SCIP_STAGE_PROBLEM
8586  */
8588  SCIP* scip, /**< SCIP data structure */
8589  SCIP_DECL_PROBEXITSOL ((*probexitsol)) /**< solving process deinitialization method of transformed data */
8590  )
8591 {
8592  assert(scip != NULL);
8593  SCIP_CALL( checkStage(scip, "SCIPsetProbExitsol", FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE) );
8594 
8595  SCIPprobSetExitsol(scip->origprob, probexitsol);
8596 
8597  return SCIP_OKAY;
8598 }
8599 
8600 /** sets callback to copy user data to a subscip
8601  *
8602  * @return \ref SCIP_OKAY is returned if everything worked. otherwise a suitable error code is passed. see \ref
8603  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
8604  *
8605  * @pre This method can be called if @p scip is in one of the following stages:
8606  * - \ref SCIP_STAGE_PROBLEM
8607  */
8609  SCIP* scip, /**< SCIP data structure */
8610  SCIP_DECL_PROBCOPY ((*probcopy)) /**< copies user data if you want to copy it to a subscip, or NULL */
8611  )
8612 {
8613  assert(scip != NULL);
8614  SCIP_CALL( checkStage(scip, "SCIPsetProbCopy", FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE) );
8615 
8616  SCIPprobSetCopy(scip->origprob, probcopy);
8617 
8618  return SCIP_OKAY;
8619 }
8620 
8621 /** reads problem from file and initializes all solving data structures
8622  *
8623  * @return \ref SCIP_OKAY is returned if everything worked. otherwise a suitable error code is passed. see \ref
8624  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
8625  *
8626  * @pre This method can be called if @p scip is in one of the following stages:
8627  * - \ref SCIP_STAGE_INIT
8628  * - \ref SCIP_STAGE_PROBLEM
8629  * - \ref SCIP_STAGE_TRANSFORMED
8630  * - \ref SCIP_STAGE_INITPRESOLVE
8631  * - \ref SCIP_STAGE_PRESOLVING
8632  * - \ref SCIP_STAGE_EXITPRESOLVE
8633  * - \ref SCIP_STAGE_PRESOLVED
8634  * - \ref SCIP_STAGE_SOLVING
8635  * - \ref SCIP_STAGE_EXITSOLVE
8636  *
8637  * @post After the method was called, \SCIP is in one of the following stages:
8638  * -\ref SCIP_STAGE_INIT if reading failed (usually, when a SCIP_READERROR occurs)
8639  * - ref SCIP_STAGE_PROBLEM if the problem file was successfully read
8640  */
8642  SCIP* scip, /**< SCIP data structure */
8643  const char* filename, /**< problem file name */
8644  const char* extension /**< extension of the desired file reader,
8645  * or NULL if file extension should be used */
8646  )
8647 {
8648  SCIP_RETCODE retcode;
8649  SCIP_RESULT result;
8650  SCIP_Bool usevartable;
8651  SCIP_Bool useconstable;
8652  int i;
8653  char* tmpfilename;
8654  char* fileextension;
8655 
8656  assert(scip != NULL);
8657  assert(filename != NULL);
8658 
8659  SCIP_CALL( checkStage(scip, "SCIPreadProb", TRUE, TRUE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE) );
8660 
8661  SCIP_CALL( SCIPgetBoolParam(scip, "misc/usevartable", &usevartable) );
8662  SCIP_CALL( SCIPgetBoolParam(scip, "misc/useconstable", &useconstable) );
8663 
8664  if( !usevartable || !useconstable )
8665  {
8666  SCIPerrorMessage("Cannot read problem if vartable or constable is disabled. Make sure parameters 'misc/usevartable' and 'misc/useconstable' are set to TRUE.\n");
8667  return SCIP_READERROR;
8668  }
8669 
8670  /* try all readers until one could read the file */
8671  result = SCIP_DIDNOTRUN;
8672 
8673  /* copy filename */
8674  SCIP_CALL( SCIPduplicateBufferArray(scip, &tmpfilename, filename, (int)strlen(filename)+1) );
8675 
8676  fileextension = NULL;
8677  if( extension == NULL )
8678  {
8679  /* get extension from filename */
8680  SCIPsplitFilename(tmpfilename, NULL, NULL, &fileextension, NULL);
8681  }
8682 
8683  for( i = 0; i < scip->set->nreaders && result == SCIP_DIDNOTRUN; ++i )
8684  {
8685  retcode = SCIPreaderRead(scip->set->readers[i], scip->set, filename,
8686  extension != NULL ? extension : fileextension, &result);
8687 
8688  /* check for reader errors */
8689  if( retcode == SCIP_NOFILE || retcode == SCIP_READERROR )
8690  goto TERMINATE;
8691  SCIP_CALL( retcode );
8692  }
8693 
8694  switch( result )
8695  {
8696  case SCIP_DIDNOTRUN:
8697  retcode = SCIP_PLUGINNOTFOUND;
8698  break;
8699  case SCIP_SUCCESS:
8700  if( scip->origprob != NULL )
8701  {
8702  SCIP_Real readingtime;
8703 
8705  "original problem has %d variables (%d bin, %d int, %d impl, %d cont) and %d constraints\n",
8706  scip->origprob->nvars, scip->origprob->nbinvars, scip->origprob->nintvars,
8707  scip->origprob->nimplvars, scip->origprob->ncontvars,
8708  scip->origprob->nconss);
8709 
8710  /* in full verbose mode we will also print the number of constraints per constraint handler */
8711  if( scip->set->disp_verblevel == SCIP_VERBLEVEL_FULL )
8712  {
8713  int* nconss;
8714  int c;
8715  int h;
8716 
8717  SCIP_CALL( SCIPallocClearMemoryArray(scip, &nconss, scip->set->nconshdlrs) );
8718 
8719  /* loop over all constraints and constraint-handlers to count for each type the amount of original
8720  * constraints
8721  */
8722  for( c = scip->origprob->nconss - 1; c >= 0; --c )
8723  {
8724  for( h = scip->set->nconshdlrs - 1; h >= 0; --h )
8725  {
8726  if( scip->origprob->conss[c]->conshdlr == scip->set->conshdlrs[h] )
8727  {
8728  ++(nconss[h]);
8729  break;
8730  }
8731  }
8732  /* constraint handler should be found */
8733  assert(h >= 0);
8734  }
8735 
8736  /* loop over all constraints handlers for printing the number of original constraints */
8737  for( h = 0; h < scip->set->nconshdlrs; ++h )
8738  {
8739  if( nconss[h] > 0 )
8740  {
8742  "%7d constraints of type <%s>\n", nconss[h], SCIPconshdlrGetName(scip->set->conshdlrs[h]));
8743  }
8744  }
8745 
8746  SCIPfreeMemoryArray(scip, &nconss);
8747  }
8748 
8749  /* get reading time */
8750  readingtime = SCIPgetReadingTime(scip);
8751 
8752  /* display timing statistics */
8754  "Reading Time: %.2f\n", readingtime);
8755  }
8756  retcode = SCIP_OKAY;
8757  break;
8758  default:
8759  assert(i < scip->set->nreaders);
8760  SCIPerrorMessage("invalid result code <%d> from reader <%s> reading file <%s>\n",
8761  result, SCIPreaderGetName(scip->set->readers[i]), filename);
8762  retcode = SCIP_READERROR;
8763  } /*lint !e788*/
8764 
8765  TERMINATE:
8766  /* free buffer array */
8767  SCIPfreeBufferArray(scip, &tmpfilename);
8768 
8769  /* check if reading time should belong to solving time */
8770  if( scip->set->time_reading )
8771  {
8772  SCIP_Real readingtime;
8773 
8774  /* get reading time */
8775  readingtime = SCIPgetReadingTime(scip);
8776 
8777  /* add reading time to solving time */
8778  SCIPclockSetTime(scip->stat->solvingtime, readingtime);
8779  }
8780 
8781  return retcode;
8782 }
8783 
8784 /* write original or transformed problem */
8785 static
8787  SCIP* scip, /**< SCIP data structure */
8788  const char* filename, /**< output file (or NULL for standard output) */
8789  const char* extension, /**< extension of the desired file reader,
8790  * or NULL if file extension should be used */
8791  SCIP_Bool transformed, /**< output the transformed problem? */
8792  SCIP_Bool genericnames /**< using generic variable and constraint names? */
8793  )
8794 {
8795  SCIP_RETCODE retcode;
8796  char* tmpfilename;
8797  char* fileextension;
8798  char* compression;
8799  FILE* file;
8800 
8801  assert(scip != NULL );
8802 
8803  fileextension = NULL;
8804  compression = NULL;
8805  file = NULL;
8806  tmpfilename = NULL;
8807  retcode = SCIP_OKAY;
8808 
8809  if( filename != NULL && filename[0] != '\0' )
8810  {
8811  int success;
8812 
8813  file = fopen(filename, "w");
8814  if( file == NULL )
8815  {
8816  SCIPerrorMessage("cannot create file <%s> for writing\n", filename);
8817  SCIPprintSysError(filename);
8818  return SCIP_FILECREATEERROR;
8819  }
8820 
8821  /* get extension from filename,
8822  * if an error occurred, close the file before returning */
8823  if( BMSduplicateMemoryArray(&tmpfilename, filename, strlen(filename)+1) == NULL )
8824  {
8825  (void) fclose(file);
8826  SCIPerrorMessage("Error <%d> in function call\n", SCIP_NOMEMORY);
8827  return SCIP_NOMEMORY;
8828  }
8829 
8830  SCIPsplitFilename(tmpfilename, NULL, NULL, &fileextension, &compression);
8831 
8832  if( compression != NULL )
8833  {
8834  SCIPmessagePrintWarning(scip->messagehdlr, "currently it is not possible to write files with any compression\n");
8835  BMSfreeMemoryArray(&tmpfilename);
8836  (void) fclose(file);
8837  return SCIP_FILECREATEERROR;
8838  }
8839 
8840  if( extension == NULL && fileextension == NULL )
8841  {
8842  SCIPmessagePrintWarning(scip->messagehdlr, "filename <%s> has no file extension, select default <cip> format for writing\n", filename);
8843  }
8844 
8845  if( transformed )
8846  retcode = SCIPprintTransProblem(scip, file, extension != NULL ? extension : fileextension, genericnames);
8847  else
8848  retcode = SCIPprintOrigProblem(scip, file, extension != NULL ? extension : fileextension, genericnames);
8849 
8850  BMSfreeMemoryArray(&tmpfilename);
8851 
8852  success = fclose(file);
8853  if( success != 0 )
8854  {
8855  SCIPerrorMessage("An error occurred while closing file <%s>\n", filename);
8856  return SCIP_FILECREATEERROR;
8857  }
8858  }
8859  else
8860  {
8861  /* print to stdout */
8862  if( transformed )
8863  retcode = SCIPprintTransProblem(scip, NULL, extension, genericnames);
8864  else
8865  retcode = SCIPprintOrigProblem(scip, NULL, extension, genericnames);
8866  }
8867 
8868  /* check for write errors */
8869  if( retcode == SCIP_WRITEERROR || retcode == SCIP_PLUGINNOTFOUND )
8870  return retcode;
8871  else
8872  {
8873  SCIP_CALL( retcode );
8874  }
8875 
8876  return SCIP_OKAY;
8877 }
8878 
8879 /** writes original problem to file
8880  *
8881  * @return \ref SCIP_OKAY is returned if everything worked. otherwise a suitable error code is passed. see \ref
8882  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
8883  *
8884  * @pre This method can be called if @p scip is in one of the following stages:
8885  * - \ref SCIP_STAGE_PROBLEM
8886  * - \ref SCIP_STAGE_TRANSFORMING
8887  * - \ref SCIP_STAGE_TRANSFORMED
8888  * - \ref SCIP_STAGE_INITPRESOLVE
8889  * - \ref SCIP_STAGE_PRESOLVING
8890  * - \ref SCIP_STAGE_EXITPRESOLVE
8891  * - \ref SCIP_STAGE_PRESOLVED
8892  * - \ref SCIP_STAGE_INITSOLVE
8893  * - \ref SCIP_STAGE_SOLVING
8894  * - \ref SCIP_STAGE_SOLVED
8895  * - \ref SCIP_STAGE_EXITSOLVE
8896  * - \ref SCIP_STAGE_FREETRANS
8897  */
8899  SCIP* scip, /**< SCIP data structure */
8900  const char* filename, /**< output file (or NULL for standard output) */
8901  const char* extension, /**< extension of the desired file reader,
8902  * or NULL if file extension should be used */
8903  SCIP_Bool genericnames /**< using generic variable and constraint names? */
8904  )
8905 {
8906  SCIP_RETCODE retcode;
8907 
8908  SCIP_CALL( checkStage(scip, "SCIPwriteOrigProblem", FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE) );
8909 
8910  assert( scip != NULL );
8911  assert( scip->origprob != NULL );
8912 
8913  retcode = writeProblem(scip, filename, extension, FALSE, genericnames);
8914 
8915  /* check for write errors */
8916  if( retcode == SCIP_FILECREATEERROR || retcode == SCIP_WRITEERROR || retcode == SCIP_PLUGINNOTFOUND )
8917  return retcode;
8918  else
8919  {
8920  SCIP_CALL( retcode );
8921  }
8922 
8923  return SCIP_OKAY;
8924 }
8925 
8926 /** writes transformed problem which are valid in the current node to file
8927  *
8928  * @return \ref SCIP_OKAY is returned if everything worked. otherwise a suitable error code is passed. see \ref
8929  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
8930  *
8931  * @pre This method can be called if @p scip is in one of the following stages:
8932  * - \ref SCIP_STAGE_TRANSFORMED
8933  * - \ref SCIP_STAGE_INITPRESOLVE
8934  * - \ref SCIP_STAGE_PRESOLVING
8935  * - \ref SCIP_STAGE_EXITPRESOLVE
8936  * - \ref SCIP_STAGE_PRESOLVED
8937  * - \ref SCIP_STAGE_INITSOLVE
8938  * - \ref SCIP_STAGE_SOLVING
8939  * - \ref SCIP_STAGE_SOLVED
8940  * - \ref SCIP_STAGE_EXITSOLVE
8941  *
8942  * @note If you want the write all constraints (including the once which are redundant for example), you need to set
8943  * the parameter <write/allconss> to TRUE
8944  */
8946  SCIP* scip, /**< SCIP data structure */
8947  const char* filename, /**< output file (or NULL for standard output) */
8948  const char* extension, /**< extension of the desired file reader,
8949  * or NULL if file extension should be used */
8950  SCIP_Bool genericnames /**< using generic variable and constraint names? */
8951  )
8952 {
8953  SCIP_RETCODE retcode;
8954 
8955  SCIP_CALL( checkStage(scip, "SCIPwriteTransProblem", FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE) );
8956 
8957  assert( scip != NULL );
8958  assert( scip->transprob != NULL );
8959 
8960  retcode = writeProblem(scip, filename, extension, TRUE, genericnames);
8961 
8962  /* check for write errors */
8963  if( retcode == SCIP_FILECREATEERROR || retcode == SCIP_WRITEERROR || retcode == SCIP_PLUGINNOTFOUND )
8964  return retcode;
8965  else
8966  {
8967  SCIP_CALL( retcode );
8968  }
8969 
8970  return SCIP_OKAY;
8971 }
8972 
8973 /** frees problem and solution process data
8974  *
8975  * @return \ref SCIP_OKAY is returned if everything worked. otherwise a suitable error code is passed. see \ref
8976  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
8977  *
8978  * @pre This method can be called if @p scip is in one of the following stages:
8979  * - \ref SCIP_STAGE_INIT
8980  * - \ref SCIP_STAGE_PROBLEM
8981  * - \ref SCIP_STAGE_TRANSFORMED
8982  * - \ref SCIP_STAGE_PRESOLVING
8983  * - \ref SCIP_STAGE_PRESOLVED
8984  * - \ref SCIP_STAGE_SOLVING
8985  * - \ref SCIP_STAGE_SOLVED
8986  * - \ref SCIP_STAGE_FREE
8987  *
8988  * @post After this method was called, SCIP is in the following stage:
8989  * - \ref SCIP_STAGE_INIT
8990  */
8992  SCIP* scip /**< SCIP data structure */
8993  )
8994 {
8995  SCIP_CALL( checkStage(scip, "SCIPfreeProb", TRUE, TRUE, FALSE, TRUE, FALSE, TRUE, FALSE, TRUE, FALSE, TRUE, TRUE, FALSE, FALSE, TRUE) );
8996 
8997  SCIP_CALL( SCIPfreeTransform(scip) );
8998  assert(scip->set->stage == SCIP_STAGE_INIT || scip->set->stage == SCIP_STAGE_PROBLEM);
8999 
9000  /* free all debug data */
9001  SCIP_CALL( SCIPdebugFreeDebugData(scip->set) ); /*lint !e506 !e774*/
9002 
9003  if( scip->set->stage == SCIP_STAGE_PROBLEM )
9004  {
9005  int i;
9006 
9007  /* deactivate all pricers */
9008  for( i = scip->set->nactivepricers-1; i >= 0; --i )
9009  {
9010  SCIP_CALL( SCIPpricerDeactivate(scip->set->pricers[i], scip->set) );
9011  }
9012  assert(scip->set->nactivepricers == 0);
9013 
9014  /* free original primal solution candidate pool, original problem and problem statistics data structures */
9015  SCIP_CALL( SCIPprimalFree(&scip->origprimal, scip->mem->probmem) );
9016  SCIP_CALL( SCIPprobFree(&scip->origprob, scip->mem->probmem, scip->set, scip->stat, scip->eventqueue, scip->lp) );
9017  SCIP_CALL( SCIPstatFree(&scip->stat, scip->mem->probmem) );
9018 
9019  /* readers */
9020  for( i = 0; i < scip->set->nreaders; ++i )
9021  {
9023  }
9024 
9025  /* switch stage to INIT */
9026  scip->set->stage = SCIP_STAGE_INIT;
9027  }
9028  assert(scip->set->stage == SCIP_STAGE_INIT);
9029 
9030  return SCIP_OKAY;
9031 }
9032 
9033 
9034 /** permutes parts of the problem data structure
9035  *
9036  * @return \ref SCIP_OKAY is returned if everything worked. otherwise a suitable error code is passed. see \ref
9037  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
9038  *
9039  * @pre This method can be called if @p scip is in one of the following stages:
9040  * - \ref SCIP_STAGE_PROBLEM
9041  * - \ref SCIP_STAGE_TRANSFORMED
9042  */
9044  SCIP* scip, /**< SCIP data structure */
9045  unsigned int randseed, /**< seed value for random generator */
9046  SCIP_Bool permuteconss, /**< should the list of constraints in each constraint handler be permuted? */
9047  SCIP_Bool permutebinvars, /**< should the list of binary variables be permuted? */
9048  SCIP_Bool permuteintvars, /**< should the list of integer variables be permuted? */
9049  SCIP_Bool permuteimplvars, /**< should the list of implicit integer variables be permuted? */
9050  SCIP_Bool permutecontvars /**< should the list of continuous integer variables be permuted? */
9051  )
9052 {
9053  SCIP_VAR** vars;
9054  SCIP_CONSHDLR** conshdlrs;
9055  int nconshdlrs;
9056  int nbinvars;
9057  int nintvars;
9058  int nimplvars;
9059  int nvars;
9060  int j;
9061 
9062  assert(scip != NULL);
9063  SCIP_CALL( checkStage(scip, "SCIPpermuteProb", FALSE, TRUE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE) );
9064 
9065  SCIP_CALL( SCIPgetVarsData(scip, &vars, &nvars, &nbinvars, &nintvars, &nimplvars, NULL) );
9066 
9067  assert(nvars == 0 || vars != NULL);
9068  assert(nvars == nbinvars+nintvars+nimplvars+SCIPgetNContVars(scip));
9069 
9070  conshdlrs = SCIPgetConshdlrs(scip);
9071  nconshdlrs = SCIPgetNConshdlrs(scip);
9072  assert(nconshdlrs == 0 || conshdlrs != NULL);
9073 
9074  /* The constraint handler should not be permuted since they are called w.r.t. to certain properties; besides
9075  * that the "conshdlrs" array should stay in the order as it is since this array is used to copy the plugins for
9076  * sub-SCIPs and contains the dependencies between the constraint handlers; for example the linear constraint
9077  * handler stays in front of all constraint handler which can upgrade a linear constraint (such as logicor,
9078  * setppc, and knapsack).
9079  */
9080 
9081  /* for each constraint handler, permute its constraints */
9082  if( permuteconss )
9083  {
9084  int i;
9085 
9086  /* loop over all constraint handlers */
9087  for( i = 0; i < nconshdlrs; ++i )
9088  {
9089  SCIP_CONS** conss;
9090  int nconss;
9091 
9092  conss = SCIPconshdlrGetConss(conshdlrs[i]);
9093  nconss = SCIPconshdlrGetNConss(conshdlrs[i]);
9094  assert(nconss == 0 || conss != NULL);
9095 
9096  SCIPpermuteArray((void**)conss, 0, nconss, &randseed);
9097 
9098  /* readjust the mapping of constraints to array positions */
9099  for( j = 0; j < nconss; ++j )
9100  conss[j]->consspos = j;
9101  }
9102  }
9103 
9104  /* permute binary variables */
9105  if( permutebinvars )
9106  {
9107  SCIPpermuteArray((void**)vars, 0, nbinvars, &randseed);
9108 
9109  /* readjust the mapping of variables to array positions */
9110  for( j = 0; j < nbinvars; ++j )
9111  vars[j]->probindex = j;
9112  }
9113 
9114  /* permute general integer variables */
9115  if( permuteintvars )
9116  {
9117  SCIPpermuteArray((void**)vars, nbinvars, nbinvars+nintvars, &randseed);
9118 
9119  /* readjust the mapping of variables to array positions */
9120  for( j = nbinvars; j < nbinvars+nintvars; ++j )
9121  vars[j]->probindex = j;
9122  }
9123 
9124  /* permute general integer variables */
9125  if( permuteimplvars )
9126  {
9127  SCIPpermuteArray((void**)vars, nbinvars+nintvars, nbinvars+nintvars+nimplvars, &randseed);
9128 
9129  /* readjust the mapping of variables to array positions */
9130  for( j = nbinvars+nintvars; j < nbinvars+nintvars+nimplvars; ++j )
9131  vars[j]->probindex = j;
9132  }
9133 
9134  /* permute general integer variables */
9135  if( permutecontvars )
9136  {
9137  SCIPpermuteArray((void**)vars, nbinvars+nintvars+nimplvars, nvars, &randseed);
9138 
9139  /* readjust the mapping of variables to array positions */
9140  for( j = nbinvars+nintvars+nimplvars; j < nvars; ++j )
9141  vars[j]->probindex = j;
9142  }
9143 
9144  return SCIP_OKAY;
9145 }
9146 
9147 /** gets user problem data
9148  *
9149  * @return a SCIP_PROBDATA pointer, or NULL if no problem data was allocated
9150  *
9151  * @pre This method can be called if @p scip is in one of the following stages:
9152  * - \ref SCIP_STAGE_PROBLEM
9153  * - \ref SCIP_STAGE_TRANSFORMING
9154  * - \ref SCIP_STAGE_TRANSFORMED
9155  * - \ref SCIP_STAGE_INITPRESOLVE
9156  * - \ref SCIP_STAGE_PRESOLVING
9157  * - \ref SCIP_STAGE_EXITPRESOLVE
9158  * - \ref SCIP_STAGE_PRESOLVED
9159  * - \ref SCIP_STAGE_INITSOLVE
9160  * - \ref SCIP_STAGE_SOLVING
9161  * - \ref SCIP_STAGE_SOLVED
9162  * - \ref SCIP_STAGE_EXITSOLVE
9163  * - \ref SCIP_STAGE_FREETRANS
9164  */
9166  SCIP* scip /**< SCIP data structure */
9167  )
9168 {
9169  SCIP_CALL_ABORT( checkStage(scip, "SCIPgetProbData", FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE) );
9170 
9171  switch( scip->set->stage )
9172  {
9173  case SCIP_STAGE_PROBLEM:
9174  return SCIPprobGetData(scip->origprob);
9175 
9179  case SCIP_STAGE_PRESOLVING:
9181  case SCIP_STAGE_PRESOLVED:
9182  case SCIP_STAGE_INITSOLVE:
9183  case SCIP_STAGE_SOLVING:
9184  case SCIP_STAGE_SOLVED:
9185  case SCIP_STAGE_EXITSOLVE:
9186  case SCIP_STAGE_FREETRANS:
9187  return SCIPprobGetData(scip->transprob);
9188 
9189  default:
9190  SCIPerrorMessage("invalid SCIP stage <%d>\n", scip->set->stage);
9191  SCIPABORT();
9192  return NULL; /*lint !e527*/
9193  } /*lint !e788*/
9194 }
9195 
9196 /** sets user problem data
9197  *
9198  * @return \ref SCIP_OKAY is returned if everything worked. otherwise a suitable error code is passed. see \ref
9199  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
9200  *
9201  * @pre This method can be called if @p scip is in one of the following stages:
9202  * - \ref SCIP_STAGE_PROBLEM
9203  * - \ref SCIP_STAGE_TRANSFORMING
9204  * - \ref SCIP_STAGE_TRANSFORMED
9205  * - \ref SCIP_STAGE_INITPRESOLVE
9206  * - \ref SCIP_STAGE_PRESOLVING
9207  * - \ref SCIP_STAGE_EXITPRESOLVE
9208  * - \ref SCIP_STAGE_PRESOLVED
9209  * - \ref SCIP_STAGE_INITSOLVE
9210  * - \ref SCIP_STAGE_SOLVING
9211  * - \ref SCIP_STAGE_SOLVED
9212  * - \ref SCIP_STAGE_EXITSOLVE
9213  * - \ref SCIP_STAGE_FREETRANS
9214  */
9216  SCIP* scip, /**< SCIP data structure */
9217  SCIP_PROBDATA* probdata /**< user problem data to use */
9218  )
9219 {
9220  SCIP_CALL( checkStage(scip, "SCIPsetProbData", FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE) );
9221 
9222  switch( scip->set->stage )
9223  {
9224  case SCIP_STAGE_PROBLEM:
9225  SCIPprobSetData(scip->origprob, probdata);
9226  return SCIP_OKAY;
9227 
9231  case SCIP_STAGE_PRESOLVING:
9233  case SCIP_STAGE_PRESOLVED:
9234  case SCIP_STAGE_INITSOLVE:
9235  case SCIP_STAGE_SOLVING:
9236  case SCIP_STAGE_SOLVED:
9237  case SCIP_STAGE_EXITSOLVE:
9238  case SCIP_STAGE_FREETRANS:
9239  SCIPprobSetData(scip->transprob, probdata);
9240  return SCIP_OKAY;
9241 
9242  case SCIP_STAGE_INIT:
9243  case SCIP_STAGE_FREE:
9244  default:
9245  SCIPerrorMessage("invalid SCIP stage <%d>\n", scip->set->stage);
9246  return SCIP_INVALIDCALL;
9247  }
9248 }
9249 
9250 /** returns name of the current problem instance
9251  *
9252  * @return name of the current problem instance
9253  *
9254  * @pre This method can be called if @p scip is in one of the following stages:
9255  * - \ref SCIP_STAGE_PROBLEM
9256  * - \ref SCIP_STAGE_TRANSFORMING
9257  * - \ref SCIP_STAGE_TRANSFORMED
9258  * - \ref SCIP_STAGE_INITPRESOLVE
9259  * - \ref SCIP_STAGE_PRESOLVING
9260  * - \ref SCIP_STAGE_EXITPRESOLVE
9261  * - \ref SCIP_STAGE_PRESOLVED
9262  * - \ref SCIP_STAGE_INITSOLVE
9263  * - \ref SCIP_STAGE_SOLVING
9264  * - \ref SCIP_STAGE_SOLVED
9265  * - \ref SCIP_STAGE_EXITSOLVE
9266  * - \ref SCIP_STAGE_FREETRANS
9267  */
9268 const char* SCIPgetProbName(
9269  SCIP* scip /**< SCIP data structure */
9270  )
9271 {
9272  SCIP_CALL_ABORT( checkStage(scip, "SCIPgetProbName", FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE) );
9273 
9274  return SCIPprobGetName(scip->origprob);
9275 }
9276 
9277 /** sets name of the current problem instance
9278  *
9279  * @return \ref SCIP_OKAY is returned if everything worked. otherwise a suitable error code is passed. see \ref
9280  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
9281  *
9282  * @pre This method can be called if @p scip is in one of the following stages:
9283  * - \ref SCIP_STAGE_PROBLEM
9284  * - \ref SCIP_STAGE_TRANSFORMING
9285  * - \ref SCIP_STAGE_TRANSFORMED
9286  * - \ref SCIP_STAGE_INITPRESOLVE
9287  * - \ref SCIP_STAGE_PRESOLVING
9288  * - \ref SCIP_STAGE_EXITPRESOLVE
9289  * - \ref SCIP_STAGE_PRESOLVED
9290  * - \ref SCIP_STAGE_INITSOLVE
9291  * - \ref SCIP_STAGE_SOLVING
9292  * - \ref SCIP_STAGE_SOLVED
9293  * - \ref SCIP_STAGE_EXITSOLVE
9294  * - \ref SCIP_STAGE_FREETRANS
9295  */
9297  SCIP* scip, /**< SCIP data structure */
9298  const char* name /**< name to be set */
9299  )
9300 {
9301  SCIP_CALL( checkStage(scip, "SCIPsetProbName", FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE) );
9302 
9303  return SCIPprobSetName(scip->origprob, name);
9304 }
9305 
9306 /** returns objective sense of original problem
9307  *
9308  * @return objective sense of original problem
9309  *
9310  * @pre This method can be called if @p scip is in one of the following stages:
9311  * - \ref SCIP_STAGE_PROBLEM
9312  * - \ref SCIP_STAGE_TRANSFORMING
9313  * - \ref SCIP_STAGE_TRANSFORMED
9314  * - \ref SCIP_STAGE_INITPRESOLVE
9315  * - \ref SCIP_STAGE_PRESOLVING
9316  * - \ref SCIP_STAGE_EXITPRESOLVE
9317  * - \ref SCIP_STAGE_PRESOLVED
9318  * - \ref SCIP_STAGE_INITSOLVE
9319  * - \ref SCIP_STAGE_SOLVING
9320  * - \ref SCIP_STAGE_SOLVED
9321  * - \ref SCIP_STAGE_EXITSOLVE
9322  * - \ref SCIP_STAGE_FREETRANS
9323  */
9325  SCIP* scip /**< SCIP data structure */
9326  )
9327 {
9328  SCIP_CALL_ABORT( checkStage(scip, "SCIPgetObjsense", FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE) );
9329 
9330  return scip->origprob->objsense;
9331 }
9332 
9333 /** sets objective sense of problem
9334  *
9335  * @return \ref SCIP_OKAY is returned if everything worked. otherwise a suitable error code is passed. see \ref
9336  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
9337  *
9338  * @pre This method can be called if @p scip is in one of the following stages:
9339  * - \ref SCIP_STAGE_PROBLEM
9340  */
9342  SCIP* scip, /**< SCIP data structure */
9343  SCIP_OBJSENSE objsense /**< new objective sense */
9344  )
9345 {
9346  SCIP_CALL( checkStage(scip, "SCIPsetObjsense", FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE) );
9347 
9348  if( objsense != SCIP_OBJSENSE_MAXIMIZE && objsense != SCIP_OBJSENSE_MINIMIZE )
9349  {
9350  SCIPerrorMessage("invalid objective sense\n");
9351  return SCIP_INVALIDDATA;
9352  }
9353 
9354  SCIPprobSetObjsense(scip->origprob, objsense);
9355 
9356  return SCIP_OKAY;
9357 }
9358 
9359 /** adds offset of objective function
9360  *
9361  * @return \ref SCIP_OKAY is returned if everything worked. otherwise a suitable error code is passed. see \ref
9362  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
9363  *
9364  * @pre This method can be called if @p scip is in one of the following stages:
9365  * - \ref SCIP_STAGE_PRESOLVING
9366  */
9368  SCIP* scip, /**< SCIP data structure */
9369  SCIP_Real addval /**< value to add to objective offset */
9370  )
9371 {
9372  SCIP_CALL( checkStage(scip, "SCIPaddObjoffset", FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE) );
9373 
9374  SCIPprobAddObjoffset(scip->transprob, addval);
9375  SCIP_CALL( SCIPprimalUpdateObjoffset(scip->primal, SCIPblkmem(scip), scip->set, scip->stat,
9376  scip->eventqueue, scip->transprob, scip->origprob, scip->tree, scip->lp) );
9377 
9378  return SCIP_OKAY;
9379 }
9380 
9381 /** adds offset of objective function to original problem and to all existing solution in original space
9382  *
9383  * @return \ref SCIP_OKAY is returned if everything worked. otherwise a suitable error code is passed. see \ref
9384  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
9385  *
9386  * @pre This method can be called if @p scip is in one of the following stages:
9387  * - \ref SCIP_STAGE_PROBLEM
9388  */
9390  SCIP* scip, /**< SCIP data structure */
9391  SCIP_Real addval /**< value to add to objective offset */
9392  )
9393 {
9394  SCIP_CALL( checkStage(scip, "SCIPaddOrigObjoffset", FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE) );
9395 
9396  scip->origprob->objoffset += addval;
9397  SCIPprimalAddOrigObjoffset(scip->origprimal, scip->set, addval);
9398 
9399  return SCIP_OKAY;
9400 }
9401 
9402 /** returns the objective offset of the original problem
9403  *
9404  * @return the objective offset of the original problem
9405  *
9406  * @pre This method can be called if @p scip is in one of the following stages:
9407  * - \ref SCIP_STAGE_PROBLEM
9408  * - \ref SCIP_STAGE_TRANSFORMING
9409  * - \ref SCIP_STAGE_TRANSFORMED
9410  * - \ref SCIP_STAGE_INITPRESOLVE
9411  * - \ref SCIP_STAGE_PRESOLVING
9412  * - \ref SCIP_STAGE_EXITPRESOLVE
9413  * - \ref SCIP_STAGE_PRESOLVED
9414  * - \ref SCIP_STAGE_INITSOLVE
9415  * - \ref SCIP_STAGE_SOLVING
9416  * - \ref SCIP_STAGE_SOLVED
9417  */
9419  SCIP* scip /**< SCIP data structure */
9420  )
9421 {
9422  SCIP_CALL_ABORT( checkStage(scip, "SCIPgetOrigObjoffset", FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE) );
9423 
9424  return scip->origprob->objoffset;
9425 }
9426 
9427 /** returns the objective scale of the original problem
9428  *
9429  * @return the objective scale of the original problem
9430  *
9431  * @pre This method can be called if @p scip is in one of the following stages:
9432  * - \ref SCIP_STAGE_PROBLEM
9433  * - \ref SCIP_STAGE_TRANSFORMING
9434  * - \ref SCIP_STAGE_TRANSFORMED
9435  * - \ref SCIP_STAGE_INITPRESOLVE
9436  * - \ref SCIP_STAGE_PRESOLVING
9437  * - \ref SCIP_STAGE_EXITPRESOLVE
9438  * - \ref SCIP_STAGE_PRESOLVED
9439  * - \ref SCIP_STAGE_INITSOLVE
9440  * - \ref SCIP_STAGE_SOLVING
9441  * - \ref SCIP_STAGE_SOLVED
9442  */
9444  SCIP* scip /**< SCIP data structure */
9445  )
9446 {
9447  SCIP_CALL_ABORT( checkStage(scip, "SCIPgetOrigObjscale", FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE) );
9448 
9449  return scip->origprob->objscale;
9450 }
9451 
9452 /** returns the objective offset of the transformed problem
9453  *
9454  * @return the objective offset of the transformed problem
9455  *
9456  * @pre This method can be called if @p scip is in one of the following stages:
9457  * - \ref SCIP_STAGE_TRANSFORMED
9458  * - \ref SCIP_STAGE_INITPRESOLVE
9459  * - \ref SCIP_STAGE_PRESOLVING
9460  * - \ref SCIP_STAGE_EXITPRESOLVE
9461  * - \ref SCIP_STAGE_PRESOLVED
9462  * - \ref SCIP_STAGE_INITSOLVE
9463  * - \ref SCIP_STAGE_SOLVING
9464  * - \ref SCIP_STAGE_SOLVED
9465  */
9467  SCIP* scip /**< SCIP data structure */
9468  )
9469 {
9470  SCIP_CALL_ABORT( checkStage(scip, "SCIPgetTransObjoffset", FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE) );
9471 
9472  return scip->transprob->objoffset;
9473 }
9474 
9475 /** returns the objective scale of the transformed problem
9476  *
9477  * @return the objective scale of the transformed problem
9478  *
9479  * @pre This method can be called if @p scip is in one of the following stages:
9480  * - \ref SCIP_STAGE_TRANSFORMED
9481  * - \ref SCIP_STAGE_INITPRESOLVE
9482  * - \ref SCIP_STAGE_PRESOLVING
9483  * - \ref SCIP_STAGE_EXITPRESOLVE
9484  * - \ref SCIP_STAGE_PRESOLVED
9485  * - \ref SCIP_STAGE_INITSOLVE
9486  * - \ref SCIP_STAGE_SOLVING
9487  * - \ref SCIP_STAGE_SOLVED
9488  */
9490  SCIP* scip /**< SCIP data structure */
9491  )
9492 {
9493  SCIP_CALL_ABORT( checkStage(scip, "SCIPgetTransObjscale", FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE) );
9494 
9495  return scip->transprob->objscale;
9496 }
9497 
9498 /** sets limit on objective function, such that only solutions better than this limit are accepted
9499  *
9500  * @note SCIP will only look for solutions with a strictly better objective value, thus, e.g., prune
9501  * all branch-and-bound nodes with dual bound equal or worse to the objective limit.
9502  * However, SCIP will also collect solutions with objective value worse than the objective limit and
9503  * use them to run improvement heuristics on them.
9504  * @note If SCIP can prove that there exists no solution with a strictly better objective value, the solving status
9505  * will normally be infeasible (the objective limit is interpreted as part of the problem).
9506  * The only exception is that by chance, SCIP found a solution with the same objective value and thus
9507  * proved the optimality of this solution, resulting in solution status optimal.
9508  *
9509  * @return \ref SCIP_OKAY is returned if everything worked. otherwise a suitable error code is passed. see \ref
9510  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
9511  *
9512  * @pre This method can be called if @p scip is in one of the following stages:
9513  * - \ref SCIP_STAGE_PROBLEM
9514  * - \ref SCIP_STAGE_TRANSFORMED
9515  * - \ref SCIP_STAGE_INITPRESOLVE
9516  * - \ref SCIP_STAGE_PRESOLVING
9517  * - \ref SCIP_STAGE_EXITPRESOLVE
9518  * - \ref SCIP_STAGE_PRESOLVED
9519  * - \ref SCIP_STAGE_SOLVING
9520  */
9522  SCIP* scip, /**< SCIP data structure */
9523  SCIP_Real objlimit /**< new primal objective limit */
9524  )
9525 {
9526  SCIP_Real oldobjlimit;
9527 
9528  SCIP_CALL( checkStage(scip, "SCIPsetObjlimit", FALSE, TRUE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) );
9529 
9530  switch( scip->set->stage )
9531  {
9532  case SCIP_STAGE_PROBLEM:
9533  SCIPprobSetObjlim(scip->origprob, objlimit);
9534  break;
9537  case SCIP_STAGE_PRESOLVING:
9539  case SCIP_STAGE_PRESOLVED:
9540  case SCIP_STAGE_SOLVING:
9541  oldobjlimit = SCIPprobGetObjlim(scip->origprob, scip->set);
9542  assert(oldobjlimit == SCIPprobGetObjlim(scip->transprob, scip->set)); /*lint !e777*/
9543  if( SCIPtransformObj(scip, objlimit) > SCIPprobInternObjval(scip->transprob, scip->origprob, scip->set, oldobjlimit) )
9544  {
9545  SCIPerrorMessage("cannot relax objective limit from %.15g to %.15g after problem was transformed\n", oldobjlimit, objlimit);
9546  return SCIP_INVALIDDATA;
9547  }
9548  SCIPprobSetObjlim(scip->origprob, objlimit);
9549  SCIPprobSetObjlim(scip->transprob, objlimit);
9550  SCIP_CALL( SCIPprimalUpdateObjlimit(scip->primal, scip->mem->probmem, scip->set, scip->stat, scip->eventqueue, scip->transprob, scip->origprob,
9551  scip->tree, scip->lp) );
9552  break;
9553 
9554  default:
9555  SCIPerrorMessage("method is not callable in SCIP stage <%d>\n", scip->set->stage);
9556  return SCIP_INVALIDCALL;
9557  } /*lint !e788*/
9558 
9559  return SCIP_OKAY;
9560 }
9561 
9562 /** returns current limit on objective function
9563  *
9564  * @return the current objective limit of the original problem
9565  *
9566  * @pre This method can be called if @p scip is in one of the following stages:
9567  * - \ref SCIP_STAGE_PROBLEM
9568  * - \ref SCIP_STAGE_TRANSFORMING
9569  * - \ref SCIP_STAGE_TRANSFORMED
9570  * - \ref SCIP_STAGE_INITPRESOLVE
9571  * - \ref SCIP_STAGE_PRESOLVING
9572  * - \ref SCIP_STAGE_EXITPRESOLVE
9573  * - \ref SCIP_STAGE_PRESOLVED
9574  * - \ref SCIP_STAGE_INITSOLVE
9575  * - \ref SCIP_STAGE_SOLVING
9576  * - \ref SCIP_STAGE_SOLVED
9577  */
9579  SCIP* scip /**< SCIP data structure */
9580  )
9581 {
9582  SCIP_CALL_ABORT( checkStage(scip, "SCIPgetObjlimit", FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE) );
9583 
9584  return SCIPprobGetObjlim(scip->origprob, scip->set);
9585 }
9586 
9587 /** informs SCIP, that the objective value is always integral in every feasible solution
9588  *
9589  * @return \ref SCIP_OKAY is returned if everything worked. otherwise a suitable error code is passed. see \ref
9590  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
9591  *
9592  * @pre This method can be called if @p scip is in one of the following stages:
9593  * - \ref SCIP_STAGE_PROBLEM
9594  * - \ref SCIP_STAGE_TRANSFORMING
9595  * - \ref SCIP_STAGE_INITPRESOLVE
9596  * - \ref SCIP_STAGE_EXITPRESOLVE
9597  * - \ref SCIP_STAGE_SOLVING
9598  */
9600  SCIP* scip /**< SCIP data structure */
9601  )
9602 {
9603  SCIP_CALL( checkStage(scip, "SCIPsetObjIntegral", FALSE, TRUE, TRUE, FALSE, TRUE, FALSE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) );
9604 
9605  switch( scip->set->stage )
9606  {
9607  case SCIP_STAGE_PROBLEM:
9609  return SCIP_OKAY;
9610 
9612  case SCIP_STAGE_PRESOLVING:
9613  case SCIP_STAGE_PRESOLVED:
9614  case SCIP_STAGE_SOLVING:
9616  return SCIP_OKAY;
9617 
9618  default:
9619  SCIPerrorMessage("method is not callable in SCIP stage <%d>\n", scip->set->stage);
9620  return SCIP_INVALIDCALL;
9621  } /*lint !e788*/
9622 }
9623 
9624 /** returns whether the objective value is known to be integral in every feasible solution
9625  *
9626  * @return TRUE, if objective value is known to be always integral, otherwise FALSE
9627  *
9628  * @pre This method can be called if @p scip is in one of the following stages:
9629  * - \ref SCIP_STAGE_PROBLEM
9630  * - \ref SCIP_STAGE_TRANSFORMING
9631  * - \ref SCIP_STAGE_INITPRESOLVE
9632  * - \ref SCIP_STAGE_PRESOLVING
9633  * - \ref SCIP_STAGE_EXITPRESOLVE
9634  * - \ref SCIP_STAGE_PRESOLVED
9635  * - \ref SCIP_STAGE_SOLVING
9636  */
9638  SCIP* scip /**< SCIP data structure */
9639  )
9640 {
9641  SCIP_CALL_ABORT( checkStage(scip, "SCIPisObjIntegral", FALSE, TRUE, TRUE, FALSE, TRUE, TRUE, TRUE, TRUE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) );
9642 
9643  switch( scip->set->stage )
9644  {
9645  case SCIP_STAGE_PROBLEM:
9646  return SCIPprobIsObjIntegral(scip->origprob);
9647 
9650  case SCIP_STAGE_PRESOLVING:
9652  case SCIP_STAGE_PRESOLVED:
9653  case SCIP_STAGE_SOLVING:
9654  return SCIPprobIsObjIntegral(scip->transprob);
9655 
9656  default:
9657  SCIPerrorMessage("invalid SCIP stage <%d>\n", scip->set->stage);
9658  SCIPABORT();
9659  return FALSE; /*lint !e527*/
9660  } /*lint !e788*/
9661 }
9662 
9663 /** returns the Euclidean norm of the objective function vector (available only for transformed problem)
9664  *
9665  * @return the Euclidean norm of the transformed objective function vector
9666  *
9667  * @pre This method can be called if @p scip is in one of the following stages:
9668  * - \ref SCIP_STAGE_TRANSFORMED
9669  * - \ref SCIP_STAGE_INITPRESOLVE
9670  * - \ref SCIP_STAGE_PRESOLVING
9671  * - \ref SCIP_STAGE_EXITPRESOLVE
9672  * - \ref SCIP_STAGE_PRESOLVED
9673  * - \ref SCIP_STAGE_INITSOLVE
9674  * - \ref SCIP_STAGE_SOLVING
9675  * - \ref SCIP_STAGE_SOLVED
9676  * - \ref SCIP_STAGE_EXITSOLVE
9677  */
9679  SCIP* scip /**< SCIP data structure */
9680  )
9681 {
9682  SCIP_CALL_ABORT( checkStage(scip, "SCIPgetObjNorm", FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE) );
9683 
9684  if( scip->lp->objsqrnormunreliable )
9685  SCIPlpRecalculateObjSqrNorm(scip->set, scip->lp);
9686  assert(!scip->lp->objsqrnormunreliable);
9687 
9688  return SCIPlpGetObjNorm(scip->lp);
9689 }
9690 
9691 /** adds variable to the problem
9692  *
9693  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
9694  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
9695  *
9696  * @pre This method can be called if @p scip is in one of the following stages:
9697  * - \ref SCIP_STAGE_PROBLEM
9698  * - \ref SCIP_STAGE_TRANSFORMING
9699  * - \ref SCIP_STAGE_INITPRESOLVE
9700  * - \ref SCIP_STAGE_PRESOLVING
9701  * - \ref SCIP_STAGE_EXITPRESOLVE
9702  * - \ref SCIP_STAGE_PRESOLVED
9703  * - \ref SCIP_STAGE_SOLVING
9704  */
9706  SCIP* scip, /**< SCIP data structure */
9707  SCIP_VAR* var /**< variable to add */
9708  )
9709 {
9710  SCIP_CALL( checkStage(scip, "SCIPaddVar", FALSE, TRUE, TRUE, FALSE, TRUE, TRUE, TRUE, TRUE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) );
9711 
9712  /* avoid inserting the same variable twice */
9713  if( SCIPvarGetProbindex(var) != -1 )
9714  return SCIP_OKAY;
9715 
9716  /* insert the negation variable x instead of the negated variable x' in x' = offset - x */
9718  {
9719  assert(SCIPvarGetNegationVar(var) != NULL);
9721  return SCIP_OKAY;
9722  }
9723 
9724  switch( scip->set->stage )
9725  {
9726  case SCIP_STAGE_PROBLEM:
9728  {
9729  SCIPerrorMessage("cannot add transformed variables to original problem\n");
9730  return SCIP_INVALIDDATA;
9731  }
9732  SCIP_CALL( SCIPprobAddVar(scip->origprob, scip->mem->probmem, scip->set, scip->lp, scip->branchcand,
9733  scip->eventfilter, scip->eventqueue, var) );
9734  return SCIP_OKAY;
9735 
9738  case SCIP_STAGE_PRESOLVING:
9740  case SCIP_STAGE_PRESOLVED:
9741  case SCIP_STAGE_SOLVING:
9742  /* check variable's status */
9744  {
9745  SCIPerrorMessage("cannot add original variables to transformed problem\n");
9746  return SCIP_INVALIDDATA;
9747  }
9749  {
9750  SCIPerrorMessage("cannot add fixed or aggregated variables to transformed problem\n");
9751  return SCIP_INVALIDDATA;
9752  }
9753  SCIP_CALL( SCIPprobAddVar(scip->transprob, scip->mem->probmem, scip->set, scip->lp,
9754  scip->branchcand, scip->eventfilter, scip->eventqueue, var) );
9755  return SCIP_OKAY;
9756 
9757  default:
9758  SCIPerrorMessage("invalid SCIP stage <%d>\n", scip->set->stage);
9759  return SCIP_INVALIDCALL;
9760  } /*lint !e788*/
9761 }
9762 
9763 /** adds variable to the problem and uses it as pricing candidate to enter the LP
9764  *
9765  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
9766  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
9767  *
9768  * @pre This method can only be called if @p scip is in stage \ref SCIP_STAGE_SOLVING
9769  */
9771  SCIP* scip, /**< SCIP data structure */
9772  SCIP_VAR* var, /**< variable to add */
9773  SCIP_Real score /**< pricing score of variable (the larger, the better the variable) */
9774  )
9775 {
9776  SCIP_CALL( checkStage(scip, "SCIPaddPricedVar", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) );
9777 
9778  /* insert the negation variable x instead of the negated variable x' in x' = offset - x */
9780  {
9781  assert(SCIPvarGetNegationVar(var) != NULL);
9782  SCIP_CALL( SCIPaddPricedVar(scip, SCIPvarGetNegationVar(var), score) );
9783  return SCIP_OKAY;
9784  }
9785 
9786  /* add variable to problem if not yet inserted */
9787  if( SCIPvarGetProbindex(var) == -1 )
9788  {
9789  /* check variable's status */
9791  {
9792  SCIPerrorMessage("cannot add original variables to transformed problem\n");
9793  return SCIP_INVALIDDATA;
9794  }
9796  {
9797  SCIPerrorMessage("cannot add fixed or aggregated variables to transformed problem\n");
9798  return SCIP_INVALIDDATA;
9799  }
9800  SCIP_CALL( SCIPprobAddVar(scip->transprob, scip->mem->probmem, scip->set, scip->lp,
9801  scip->branchcand, scip->eventfilter, scip->eventqueue, var) );
9802  }
9803 
9804  /* add variable to pricing storage */
9805  SCIP_CALL( SCIPpricestoreAddVar(scip->pricestore, scip->mem->probmem, scip->set, scip->eventqueue, scip->lp, var, score,
9806  (SCIPtreeGetCurrentDepth(scip->tree) == 0)) );
9807 
9808  return SCIP_OKAY;
9809 }
9810 
9811 /** removes variable from the problem
9812  *
9813  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
9814  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
9815  *
9816  * @pre This method can be called if @p scip is in one of the following stages:
9817  * - \ref SCIP_STAGE_PROBLEM
9818  * - \ref SCIP_STAGE_TRANSFORMING
9819  * - \ref SCIP_STAGE_TRANSFORMED
9820  * - \ref SCIP_STAGE_PRESOLVING
9821  * - \ref SCIP_STAGE_FREETRANS
9822  */
9824  SCIP* scip, /**< SCIP data structure */
9825  SCIP_VAR* var, /**< variable to delete */
9826  SCIP_Bool* deleted /**< pointer to store whether marking variable to be deleted was successful */
9827  )
9828 {
9829  assert(scip != NULL);
9830  assert(var != NULL);
9831  assert(deleted != NULL);
9832 
9833  SCIP_CALL( checkStage(scip, "SCIPdelVar", FALSE, TRUE, TRUE, TRUE, FALSE, TRUE, FALSE, TRUE, FALSE, TRUE, FALSE, TRUE, TRUE, FALSE) );
9834 
9835  switch( scip->set->stage )
9836  {
9837  case SCIP_STAGE_PROBLEM:
9839  {
9840  SCIPerrorMessage("cannot remove transformed variables from original problem\n");
9841  return SCIP_INVALIDDATA;
9842  }
9843  SCIP_CALL( SCIPprobDelVar(scip->origprob, scip->mem->probmem, scip->set, scip->eventqueue, var, deleted) );
9844 
9845  /* delete the variables from the problems that were marked to be deleted */
9846  SCIP_CALL( SCIPprobPerformVarDeletions(scip->origprob, scip->mem->probmem, scip->set, scip->stat, scip->eventqueue, scip->lp, scip->branchcand) );
9847 
9848  return SCIP_OKAY;
9849 
9852  case SCIP_STAGE_PRESOLVING:
9853  /* check variable's status */
9855  {
9856  SCIPerrorMessage("cannot remove original variables from transformed problem\n");
9857  return SCIP_INVALIDDATA;
9858  }
9860  {
9861  SCIPerrorMessage("cannot remove fixed or aggregated variables from transformed problem\n");
9862  return SCIP_INVALIDDATA;
9863  }
9864 
9865  SCIP_CALL( SCIPprobDelVar(scip->transprob, scip->mem->probmem, scip->set, scip->eventqueue, var, deleted) );
9866 
9867  return SCIP_OKAY;
9868  case SCIP_STAGE_FREETRANS:
9869  /* in FREETRANS stage, we don't need to remove the variable, because the transformed problem is freed anyways */
9870  *deleted = FALSE;
9871 
9872  return SCIP_OKAY;
9873  default:
9874  SCIPerrorMessage("invalid SCIP stage <%d>\n", scip->set->stage);
9875  return SCIP_INVALIDCALL;
9876  } /*lint !e788*/
9877 }
9878 
9879 /** gets variables of the problem along with the numbers of different variable types; data may become invalid after
9880  * calls to SCIPchgVarType(), SCIPfixVar(), SCIPaggregateVars(), and SCIPmultiaggregateVar()
9881  *
9882  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
9883  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
9884  *
9885  * @pre This method can be called if @p scip is in one of the following stages:
9886  * - \ref SCIP_STAGE_PROBLEM
9887  * - \ref SCIP_STAGE_TRANSFORMED
9888  * - \ref SCIP_STAGE_INITPRESOLVE
9889  * - \ref SCIP_STAGE_PRESOLVING
9890  * - \ref SCIP_STAGE_EXITPRESOLVE
9891  * - \ref SCIP_STAGE_PRESOLVED
9892  * - \ref SCIP_STAGE_INITSOLVE
9893  * - \ref SCIP_STAGE_SOLVING
9894  * - \ref SCIP_STAGE_SOLVED
9895  * - \ref SCIP_STAGE_EXITSOLVE
9896  *
9897  * @note Variables in the vars array are ordered: binaries first, then integers, implicit integers and continuous last.
9898  */
9900  SCIP* scip, /**< SCIP data structure */
9901  SCIP_VAR*** vars, /**< pointer to store variables array or NULL if not needed */
9902  int* nvars, /**< pointer to store number of variables or NULL if not needed */
9903  int* nbinvars, /**< pointer to store number of binary variables or NULL if not needed */
9904  int* nintvars, /**< pointer to store number of integer variables or NULL if not needed */
9905  int* nimplvars, /**< pointer to store number of implicit integral vars or NULL if not needed */
9906  int* ncontvars /**< pointer to store number of continuous variables or NULL if not needed */
9907  )
9908 {
9909  SCIP_CALL( checkStage(scip, "SCIPgetVarsData", FALSE, TRUE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE) );
9910 
9911  switch( scip->set->stage )
9912  {
9913  case SCIP_STAGE_PROBLEM:
9914  if( vars != NULL )
9915  *vars = scip->origprob->vars;
9916  if( nvars != NULL )
9917  *nvars = scip->origprob->nvars;
9918  if( nbinvars != NULL )
9919  *nbinvars = scip->origprob->nbinvars;
9920  if( nintvars != NULL )
9921  *nintvars = scip->origprob->nintvars;
9922  if( nimplvars != NULL )
9923  *nimplvars = scip->origprob->nimplvars;
9924  if( ncontvars != NULL )
9925  *ncontvars = scip->origprob->ncontvars;
9926  return SCIP_OKAY;
9927 
9930  case SCIP_STAGE_PRESOLVING:
9932  case SCIP_STAGE_PRESOLVED:
9933  case SCIP_STAGE_INITSOLVE:
9934  case SCIP_STAGE_SOLVING:
9935  case SCIP_STAGE_SOLVED:
9936  case SCIP_STAGE_EXITSOLVE:
9937  if( vars != NULL )
9938  *vars = scip->transprob->vars;
9939  if( nvars != NULL )
9940  *nvars = scip->transprob->nvars;
9941  if( nbinvars != NULL )
9942  *nbinvars = scip->transprob->nbinvars;
9943  if( nintvars != NULL )
9944  *nintvars = scip->transprob->nintvars;
9945  if( nimplvars != NULL )
9946  *nimplvars = scip->transprob->nimplvars;
9947  if( ncontvars != NULL )
9948  *ncontvars = scip->transprob->ncontvars;
9949  return SCIP_OKAY;
9950 
9951  default:
9952  SCIPerrorMessage("invalid SCIP stage <%d>\n", scip->set->stage);
9953  return SCIP_INVALIDCALL;
9954  } /*lint !e788*/
9955 }
9956 
9957 /** gets array with active problem variables
9958  *
9959  * @return array with active problem variables
9960  *
9961  * @pre This method can be called if @p scip is in one of the following stages:
9962  * - \ref SCIP_STAGE_PROBLEM
9963  * - \ref SCIP_STAGE_TRANSFORMED
9964  * - \ref SCIP_STAGE_INITPRESOLVE
9965  * - \ref SCIP_STAGE_PRESOLVING
9966  * - \ref SCIP_STAGE_EXITPRESOLVE
9967  * - \ref SCIP_STAGE_PRESOLVED
9968  * - \ref SCIP_STAGE_INITSOLVE
9969  * - \ref SCIP_STAGE_SOLVING
9970  * - \ref SCIP_STAGE_SOLVED
9971  * - \ref SCIP_STAGE_EXITSOLVE
9972  *
9973  * @note Variables in the array are ordered: binaries first, then integers, implicit integers and continuous last.
9974  *
9975  * @warning If your are using the methods which add or change bound of variables (e.g., SCIPchgVarType(), SCIPfixVar(),
9976  * SCIPaggregateVars(), and SCIPmultiaggregateVar()), it can happen that the internal variable array (which is
9977  * accessed via this method) gets resized and/or resorted. This can invalid the data pointer which is returned
9978  * by this method.
9979  */
9981  SCIP* scip /**< SCIP data structure */
9982  )
9983 {
9984  SCIP_CALL_ABORT( checkStage(scip, "SCIPgetVars", FALSE, TRUE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE) );
9985 
9986  switch( scip->set->stage )
9987  {
9988  case SCIP_STAGE_PROBLEM:
9989  return scip->origprob->vars;
9990 
9993  case SCIP_STAGE_PRESOLVING:
9995  case SCIP_STAGE_PRESOLVED:
9996  case SCIP_STAGE_INITSOLVE:
9997  case SCIP_STAGE_SOLVING:
9998  case SCIP_STAGE_SOLVED:
9999  case SCIP_STAGE_EXITSOLVE:
10000  return scip->transprob->vars;
10001 
10002  default:
10003  SCIPerrorMessage("invalid SCIP stage <%d>\n", scip->set->stage);
10004  SCIPABORT();
10005  return NULL; /*lint !e527*/
10006  } /*lint !e788*/
10007 }
10008 
10009 /** gets number of active problem variables
10010  *
10011  * @return the number of active problem variables
10012  *
10013  * @pre This method can be called if @p scip is in one of the following stages:
10014  * - \ref SCIP_STAGE_PROBLEM
10015  * - \ref SCIP_STAGE_TRANSFORMED
10016  * - \ref SCIP_STAGE_INITPRESOLVE
10017  * - \ref SCIP_STAGE_PRESOLVING
10018  * - \ref SCIP_STAGE_EXITPRESOLVE
10019  * - \ref SCIP_STAGE_PRESOLVED
10020  * - \ref SCIP_STAGE_INITSOLVE
10021  * - \ref SCIP_STAGE_SOLVING
10022  * - \ref SCIP_STAGE_SOLVED
10023  * - \ref SCIP_STAGE_EXITSOLVE
10024  */
10026  SCIP* scip /**< SCIP data structure */
10027  )
10028 {
10029  SCIP_CALL_ABORT( checkStage(scip, "SCIPgetNVars", FALSE, TRUE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE) );
10030 
10031  switch( scip->set->stage )
10032  {
10033  case SCIP_STAGE_PROBLEM:
10034  return scip->origprob->nvars;
10035 
10038  case SCIP_STAGE_PRESOLVING:
10040  case SCIP_STAGE_PRESOLVED:
10041  case SCIP_STAGE_INITSOLVE:
10042  case SCIP_STAGE_SOLVING:
10043  case SCIP_STAGE_SOLVED:
10044  case SCIP_STAGE_EXITSOLVE:
10045  return scip->transprob->nvars;
10046 
10047  default:
10048  SCIPerrorMessage("invalid SCIP stage <%d>\n", scip->set->stage);
10049  SCIPABORT();
10050  return 0; /*lint !e527*/
10051  } /*lint !e788*/
10052 }
10053 
10054 /** gets number of binary active problem variables
10055  *
10056  * @return the number of binary active problem variables
10057  *
10058  * @pre This method can be called if @p scip is in one of the following stages:
10059  * - \ref SCIP_STAGE_PROBLEM
10060  * - \ref SCIP_STAGE_TRANSFORMED
10061  * - \ref SCIP_STAGE_INITPRESOLVE
10062  * - \ref SCIP_STAGE_PRESOLVING
10063  * - \ref SCIP_STAGE_EXITPRESOLVE
10064  * - \ref SCIP_STAGE_PRESOLVED
10065  * - \ref SCIP_STAGE_INITSOLVE
10066  * - \ref SCIP_STAGE_SOLVING
10067  * - \ref SCIP_STAGE_SOLVED
10068  * - \ref SCIP_STAGE_EXITSOLVE
10069  */
10071  SCIP* scip /**< SCIP data structure */
10072  )
10073 {
10074  SCIP_CALL_ABORT( checkStage(scip, "SCIPgetNBinVars", FALSE, TRUE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE) );
10075 
10076  switch( scip->set->stage )
10077  {
10078  case SCIP_STAGE_PROBLEM:
10079  return scip->origprob->nbinvars;
10080 
10083  case SCIP_STAGE_PRESOLVING:
10085  case SCIP_STAGE_PRESOLVED:
10086  case SCIP_STAGE_INITSOLVE:
10087  case SCIP_STAGE_SOLVING:
10088  case SCIP_STAGE_SOLVED:
10089  case SCIP_STAGE_EXITSOLVE:
10090  return scip->transprob->nbinvars;
10091 
10092  default:
10093  SCIPerrorMessage("invalid SCIP stage <%d>\n", scip->set->stage);
10094  SCIPABORT();
10095  return 0; /*lint !e527*/
10096  } /*lint !e788*/
10097 }
10098 
10099 /** gets number of integer active problem variables
10100  *
10101  * @return the number of integer active problem variables
10102  *
10103  * @pre This method can be called if @p scip is in one of the following stages:
10104  * - \ref SCIP_STAGE_PROBLEM
10105  * - \ref SCIP_STAGE_TRANSFORMED
10106  * - \ref SCIP_STAGE_INITPRESOLVE
10107  * - \ref SCIP_STAGE_PRESOLVING
10108  * - \ref SCIP_STAGE_EXITPRESOLVE
10109  * - \ref SCIP_STAGE_PRESOLVED
10110  * - \ref SCIP_STAGE_INITSOLVE
10111  * - \ref SCIP_STAGE_SOLVING
10112  * - \ref SCIP_STAGE_SOLVED
10113  * - \ref SCIP_STAGE_EXITSOLVE
10114  */
10116  SCIP* scip /**< SCIP data structure */
10117  )
10118 {
10119  SCIP_CALL_ABORT( checkStage(scip, "SCIPgetNIntVars", FALSE, TRUE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE) );
10120 
10121  switch( scip->set->stage )
10122  {
10123  case SCIP_STAGE_PROBLEM:
10124  return scip->origprob->nintvars;
10125 
10128  case SCIP_STAGE_PRESOLVING:
10130  case SCIP_STAGE_PRESOLVED:
10131  case SCIP_STAGE_INITSOLVE:
10132  case SCIP_STAGE_SOLVING:
10133  case SCIP_STAGE_SOLVED:
10134  case SCIP_STAGE_EXITSOLVE:
10135  return scip->transprob->nintvars;
10136 
10137  default:
10138  SCIPerrorMessage("invalid SCIP stage <%d>\n", scip->set->stage);
10139  SCIPABORT();
10140  return 0; /*lint !e527*/
10141  } /*lint !e788*/
10142 }
10143 
10144 /** gets number of implicit integer active problem variables
10145  *
10146  * @return the number of implicit integer active problem variables
10147  *
10148  * @pre This method can be called if @p scip is in one of the following stages:
10149  * - \ref SCIP_STAGE_PROBLEM
10150  * - \ref SCIP_STAGE_TRANSFORMED
10151  * - \ref SCIP_STAGE_INITPRESOLVE
10152  * - \ref SCIP_STAGE_PRESOLVING
10153  * - \ref SCIP_STAGE_EXITPRESOLVE
10154  * - \ref SCIP_STAGE_PRESOLVED
10155  * - \ref SCIP_STAGE_INITSOLVE
10156  * - \ref SCIP_STAGE_SOLVING
10157  * - \ref SCIP_STAGE_SOLVED
10158  * - \ref SCIP_STAGE_EXITSOLVE
10159  */
10161  SCIP* scip /**< SCIP data structure */
10162  )
10163 {
10164  SCIP_CALL_ABORT( checkStage(scip, "SCIPgetNImplVars", FALSE, TRUE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE) );
10165 
10166  switch( scip->set->stage )
10167  {
10168  case SCIP_STAGE_PROBLEM:
10169  return scip->origprob->nimplvars;
10170 
10173  case SCIP_STAGE_PRESOLVING:
10175  case SCIP_STAGE_PRESOLVED:
10176  case SCIP_STAGE_INITSOLVE:
10177  case SCIP_STAGE_SOLVING:
10178  case SCIP_STAGE_SOLVED:
10179  case SCIP_STAGE_EXITSOLVE:
10180  return scip->transprob->nimplvars;
10181 
10182  default:
10183  SCIPerrorMessage("invalid SCIP stage <%d>\n", scip->set->stage);
10184  SCIPABORT();
10185  return 0; /*lint !e527*/
10186  } /*lint !e788*/
10187 }
10188 
10189 /** gets number of continuous active problem variables
10190  *
10191  * @return the number of continuous active problem variables
10192  *
10193  * @pre This method can be called if @p scip is in one of the following stages:
10194  * - \ref SCIP_STAGE_PROBLEM
10195  * - \ref SCIP_STAGE_TRANSFORMED
10196  * - \ref SCIP_STAGE_INITPRESOLVE
10197  * - \ref SCIP_STAGE_PRESOLVING
10198  * - \ref SCIP_STAGE_EXITPRESOLVE
10199  * - \ref SCIP_STAGE_PRESOLVED
10200  * - \ref SCIP_STAGE_INITSOLVE
10201  * - \ref SCIP_STAGE_SOLVING
10202  * - \ref SCIP_STAGE_SOLVED
10203  * - \ref SCIP_STAGE_EXITSOLVE
10204  */
10206  SCIP* scip /**< SCIP data structure */
10207  )
10208 {
10209  SCIP_CALL_ABORT( checkStage(scip, "SCIPgetNContVars", FALSE, TRUE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE) );
10210 
10211  switch( scip->set->stage )
10212  {
10213  case SCIP_STAGE_PROBLEM:
10214  return scip->origprob->ncontvars;
10215 
10218  case SCIP_STAGE_PRESOLVING:
10220  case SCIP_STAGE_PRESOLVED:
10221  case SCIP_STAGE_INITSOLVE:
10222  case SCIP_STAGE_SOLVING:
10223  case SCIP_STAGE_SOLVED:
10224  case SCIP_STAGE_EXITSOLVE:
10225  return scip->transprob->ncontvars;
10226 
10227  default:
10228  SCIPerrorMessage("invalid SCIP stage <%d>\n", scip->set->stage);
10229  SCIPABORT();
10230  return 0; /*lint !e527*/
10231  } /*lint !e788*/
10232 }
10233 
10234 
10235 /** gets number of active problem variables with a non-zero objective coefficient
10236  *
10237  * @note In case of the original problem the number of variables is counted. In case of the transformed problem the
10238  * number of variables is just returned since it is stored internally
10239  *
10240  * @return the number of active problem variables with a non-zero objective coefficient
10241  *
10242  * @pre This method can be called if @p scip is in one of the following stages:
10243  * - \ref SCIP_STAGE_PROBLEM
10244  * - \ref SCIP_STAGE_TRANSFORMED
10245  * - \ref SCIP_STAGE_INITPRESOLVE
10246  * - \ref SCIP_STAGE_PRESOLVING
10247  * - \ref SCIP_STAGE_EXITPRESOLVE
10248  * - \ref SCIP_STAGE_PRESOLVED
10249  * - \ref SCIP_STAGE_INITSOLVE
10250  * - \ref SCIP_STAGE_SOLVING
10251  * - \ref SCIP_STAGE_SOLVED
10252  */
10254  SCIP* scip /**< SCIP data structure */
10255  )
10256 {
10257  SCIP_CALL_ABORT( checkStage(scip, "SCIPgetNObjVars", FALSE, TRUE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE) );
10258 
10259  switch( scip->set->stage )
10260  {
10261  case SCIP_STAGE_PROBLEM:
10262  return SCIPprobGetNObjVars(scip->origprob, scip->set);
10263 
10266  case SCIP_STAGE_PRESOLVING:
10268  case SCIP_STAGE_PRESOLVED:
10269  case SCIP_STAGE_INITSOLVE:
10270  case SCIP_STAGE_SOLVING:
10271  case SCIP_STAGE_SOLVED:
10272  return SCIPprobGetNObjVars(scip->transprob, scip->set);
10273 
10274  default:
10275  SCIPerrorMessage("invalid SCIP stage <%d>\n", scip->set->stage);
10276  SCIPABORT();
10277  return 0; /*lint !e527*/
10278  } /*lint !e788*/
10279 }
10280 
10281 
10282 /** gets array with fixed and aggregated problem variables; data may become invalid after
10283  * calls to SCIPfixVar(), SCIPaggregateVars(), and SCIPmultiaggregateVar()
10284  *
10285  * @return an array with fixed and aggregated problem variables; data may become invalid after
10286  * calls to SCIPfixVar(), SCIPaggregateVars(), and SCIPmultiaggregateVar()
10287  *
10288  * @pre This method can be called if @p scip is in one of the following stages:
10289  * - \ref SCIP_STAGE_PROBLEM
10290  * - \ref SCIP_STAGE_TRANSFORMED
10291  * - \ref SCIP_STAGE_INITPRESOLVE
10292  * - \ref SCIP_STAGE_PRESOLVING
10293  * - \ref SCIP_STAGE_EXITPRESOLVE
10294  * - \ref SCIP_STAGE_PRESOLVED
10295  * - \ref SCIP_STAGE_INITSOLVE
10296  * - \ref SCIP_STAGE_SOLVING
10297  * - \ref SCIP_STAGE_SOLVED
10298  */
10300  SCIP* scip /**< SCIP data structure */
10301  )
10302 {
10303  SCIP_CALL_ABORT( checkStage(scip, "SCIPgetFixedVars", FALSE, TRUE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE) );
10304 
10305  switch( scip->set->stage )
10306  {
10307  case SCIP_STAGE_PROBLEM:
10308  return NULL;
10309 
10312  case SCIP_STAGE_PRESOLVING:
10314  case SCIP_STAGE_PRESOLVED:
10315  case SCIP_STAGE_INITSOLVE:
10316  case SCIP_STAGE_SOLVING:
10317  case SCIP_STAGE_SOLVED:
10318  return scip->transprob->fixedvars;
10319 
10320  default:
10321  SCIPerrorMessage("invalid SCIP stage <%d>\n", scip->set->stage);
10322  SCIPABORT();
10323  return NULL; /*lint !e527*/
10324  } /*lint !e788*/
10325 }
10326 
10327 /** gets number of fixed or aggregated problem variables
10328  *
10329  * @return the number of fixed or aggregated problem variables
10330  *
10331  * @pre This method can be called if @p scip is in one of the following stages:
10332  * - \ref SCIP_STAGE_PROBLEM
10333  * - \ref SCIP_STAGE_TRANSFORMED
10334  * - \ref SCIP_STAGE_INITPRESOLVE
10335  * - \ref SCIP_STAGE_PRESOLVING
10336  * - \ref SCIP_STAGE_EXITPRESOLVE
10337  * - \ref SCIP_STAGE_PRESOLVED
10338  * - \ref SCIP_STAGE_INITSOLVE
10339  * - \ref SCIP_STAGE_SOLVING
10340  * - \ref SCIP_STAGE_SOLVED
10341  */
10343  SCIP* scip /**< SCIP data structure */
10344  )
10345 {
10346  SCIP_CALL_ABORT( checkStage(scip, "SCIPgetNFixedVars", FALSE, TRUE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE) );
10347 
10348  switch( scip->set->stage )
10349  {
10350  case SCIP_STAGE_PROBLEM:
10351  return 0;
10352 
10355  case SCIP_STAGE_PRESOLVING:
10357  case SCIP_STAGE_PRESOLVED:
10358  case SCIP_STAGE_INITSOLVE:
10359  case SCIP_STAGE_SOLVING:
10360  case SCIP_STAGE_SOLVED:
10361  return scip->transprob->nfixedvars;
10362 
10363  default:
10364  SCIPerrorMessage("invalid SCIP stage <%d>\n", scip->set->stage);
10365  SCIPABORT();
10366  return 0; /*lint !e527*/
10367  } /*lint !e788*/
10368 }
10369 
10370 /** gets variables of the original problem along with the numbers of different variable types; data may become invalid
10371  * after a call to SCIPchgVarType()
10372  *
10373  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
10374  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
10375  *
10376  * @pre This method can be called if @p scip is in one of the following stages:
10377  * - \ref SCIP_STAGE_PROBLEM
10378  * - \ref SCIP_STAGE_TRANSFORMING
10379  * - \ref SCIP_STAGE_TRANSFORMED
10380  * - \ref SCIP_STAGE_INITPRESOLVE
10381  * - \ref SCIP_STAGE_PRESOLVING
10382  * - \ref SCIP_STAGE_EXITPRESOLVE
10383  * - \ref SCIP_STAGE_PRESOLVED
10384  * - \ref SCIP_STAGE_INITSOLVE
10385  * - \ref SCIP_STAGE_SOLVING
10386  * - \ref SCIP_STAGE_SOLVED
10387  * - \ref SCIP_STAGE_EXITSOLVE
10388  * - \ref SCIP_STAGE_FREETRANS
10389  */
10391  SCIP* scip, /**< SCIP data structure */
10392  SCIP_VAR*** vars, /**< pointer to store variables array or NULL if not needed */
10393  int* nvars, /**< pointer to store number of variables or NULL if not needed */
10394  int* nbinvars, /**< pointer to store number of binary variables or NULL if not needed */
10395  int* nintvars, /**< pointer to store number of integer variables or NULL if not needed */
10396  int* nimplvars, /**< pointer to store number of implicit integral vars or NULL if not needed */
10397  int* ncontvars /**< pointer to store number of continuous variables or NULL if not needed */
10398  )
10399 {
10400  SCIP_CALL( checkStage(scip, "SCIPgetOrigVarsData", FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE) );
10401 
10402  if( vars != NULL )
10403  *vars = scip->origprob->vars;
10404  if( nvars != NULL )
10405  *nvars = scip->origprob->nvars;
10406  if( nbinvars != NULL )
10407  *nbinvars = scip->origprob->nbinvars;
10408  if( nintvars != NULL )
10409  *nintvars = scip->origprob->nintvars;
10410  if( nimplvars != NULL )
10411  *nimplvars = scip->origprob->nimplvars;
10412  if( ncontvars != NULL )
10413  *ncontvars = scip->origprob->ncontvars;
10414 
10415  return SCIP_OKAY;
10416 }
10417 
10418 /** gets array with original problem variables; data may become invalid after
10419  * a call to SCIPchgVarType()
10420  *
10421  * @return an array with original problem variables; data may become invalid after
10422  * a call to SCIPchgVarType()
10423  *
10424  * @pre This method can be called if @p scip is in one of the following stages:
10425  * - \ref SCIP_STAGE_PROBLEM
10426  * - \ref SCIP_STAGE_TRANSFORMING
10427  * - \ref SCIP_STAGE_TRANSFORMED
10428  * - \ref SCIP_STAGE_INITPRESOLVE
10429  * - \ref SCIP_STAGE_PRESOLVING
10430  * - \ref SCIP_STAGE_EXITPRESOLVE
10431  * - \ref SCIP_STAGE_PRESOLVED
10432  * - \ref SCIP_STAGE_INITSOLVE
10433  * - \ref SCIP_STAGE_SOLVING
10434  * - \ref SCIP_STAGE_SOLVED
10435  * - \ref SCIP_STAGE_EXITSOLVE
10436  * - \ref SCIP_STAGE_FREETRANS
10437  */
10439  SCIP* scip /**< SCIP data structure */
10440  )
10441 {
10442  SCIP_CALL_ABORT( checkStage(scip, "SCIPgetOrigVars", FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE) );
10443 
10444  return scip->origprob->vars;
10445 }
10446 
10447 /** gets number of original problem variables
10448  *
10449  * @return the number of original problem variables
10450  *
10451  * @pre This method can be called if @p scip is in one of the following stages:
10452  * - \ref SCIP_STAGE_PROBLEM
10453  * - \ref SCIP_STAGE_TRANSFORMING
10454  * - \ref SCIP_STAGE_TRANSFORMED
10455  * - \ref SCIP_STAGE_INITPRESOLVE
10456  * - \ref SCIP_STAGE_PRESOLVING
10457  * - \ref SCIP_STAGE_EXITPRESOLVE
10458  * - \ref SCIP_STAGE_PRESOLVED
10459  * - \ref SCIP_STAGE_INITSOLVE
10460  * - \ref SCIP_STAGE_SOLVING
10461  * - \ref SCIP_STAGE_SOLVED
10462  * - \ref SCIP_STAGE_EXITSOLVE
10463  * - \ref SCIP_STAGE_FREETRANS
10464  */
10466  SCIP* scip /**< SCIP data structure */
10467  )
10468 {
10469  SCIP_CALL_ABORT( checkStage(scip, "SCIPgetNOrigVars", FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE) );
10470 
10471  return scip->origprob->nvars;
10472 }
10473 
10474 /** gets number of binary variables in the original problem
10475  *
10476  * @return the number of binary variables in the original problem
10477  *
10478  * @pre This method can be called if @p scip is in one of the following stages:
10479  * - \ref SCIP_STAGE_PROBLEM
10480  * - \ref SCIP_STAGE_TRANSFORMING
10481  * - \ref SCIP_STAGE_TRANSFORMED
10482  * - \ref SCIP_STAGE_INITPRESOLVE
10483  * - \ref SCIP_STAGE_PRESOLVING
10484  * - \ref SCIP_STAGE_EXITPRESOLVE
10485  * - \ref SCIP_STAGE_PRESOLVED
10486  * - \ref SCIP_STAGE_INITSOLVE
10487  * - \ref SCIP_STAGE_SOLVING
10488  * - \ref SCIP_STAGE_SOLVED
10489  * - \ref SCIP_STAGE_EXITSOLVE
10490  * - \ref SCIP_STAGE_FREETRANS
10491  */
10493  SCIP* scip /**< SCIP data structure */
10494  )
10495 {
10496  SCIP_CALL_ABORT( checkStage(scip, "SCIPgetNOrigBinVars", FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE) );
10497 
10498  return scip->origprob->nbinvars;
10499 }
10500 
10501 /** gets the number of integer variables in the original problem
10502  *
10503  * @return the number of integer variables in the original problem
10504  *
10505  * @pre This method can be called if @p scip is in one of the following stages:
10506  * - \ref SCIP_STAGE_PROBLEM
10507  * - \ref SCIP_STAGE_TRANSFORMING
10508  * - \ref SCIP_STAGE_TRANSFORMED
10509  * - \ref SCIP_STAGE_INITPRESOLVE
10510  * - \ref SCIP_STAGE_PRESOLVING
10511  * - \ref SCIP_STAGE_EXITPRESOLVE
10512  * - \ref SCIP_STAGE_PRESOLVED
10513  * - \ref SCIP_STAGE_INITSOLVE
10514  * - \ref SCIP_STAGE_SOLVING
10515  * - \ref SCIP_STAGE_SOLVED
10516  * - \ref SCIP_STAGE_EXITSOLVE
10517  * - \ref SCIP_STAGE_FREETRANS
10518  */
10520  SCIP* scip /**< SCIP data structure */
10521  )
10522 {
10523  SCIP_CALL_ABORT( checkStage(scip, "SCIPgetNOrigIntVars", FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE) );
10524 
10525  return scip->origprob->nintvars;
10526 }
10527 
10528 /** gets number of implicit integer variables in the original problem
10529  *
10530  * @return the number of implicit integer variables in the original problem
10531  *
10532  * @pre This method can be called if @p scip is in one of the following stages:
10533  * - \ref SCIP_STAGE_PROBLEM
10534  * - \ref SCIP_STAGE_TRANSFORMING
10535  * - \ref SCIP_STAGE_TRANSFORMED
10536  * - \ref SCIP_STAGE_INITPRESOLVE
10537  * - \ref SCIP_STAGE_PRESOLVING
10538  * - \ref SCIP_STAGE_EXITPRESOLVE
10539  * - \ref SCIP_STAGE_PRESOLVED
10540  * - \ref SCIP_STAGE_INITSOLVE
10541  * - \ref SCIP_STAGE_SOLVING
10542  * - \ref SCIP_STAGE_SOLVED
10543  * - \ref SCIP_STAGE_EXITSOLVE
10544  * - \ref SCIP_STAGE_FREETRANS
10545  */
10547  SCIP* scip /**< SCIP data structure */
10548  )
10549 {
10550  SCIP_CALL_ABORT( checkStage(scip, "SCIPgetNOrigImplVars", FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE) );
10551 
10552  return scip->origprob->nimplvars;
10553 }
10554 
10555 /** gets number of continuous variables in the original problem
10556  *
10557  * @return the number of continuous variables in the original problem
10558  *
10559  * @pre This method can be called if @p scip is in one of the following stages:
10560  * - \ref SCIP_STAGE_PROBLEM
10561  * - \ref SCIP_STAGE_TRANSFORMING
10562  * - \ref SCIP_STAGE_TRANSFORMED
10563  * - \ref SCIP_STAGE_INITPRESOLVE
10564  * - \ref SCIP_STAGE_PRESOLVING
10565  * - \ref SCIP_STAGE_EXITPRESOLVE
10566  * - \ref SCIP_STAGE_PRESOLVED
10567  * - \ref SCIP_STAGE_INITSOLVE
10568  * - \ref SCIP_STAGE_SOLVING
10569  * - \ref SCIP_STAGE_SOLVED
10570  * - \ref SCIP_STAGE_EXITSOLVE
10571  * - \ref SCIP_STAGE_FREETRANS
10572  */
10574  SCIP* scip /**< SCIP data structure */
10575  )
10576 {
10577  SCIP_CALL_ABORT( checkStage(scip, "SCIPgetNOrigContVars", FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE) );
10578 
10579  return scip->origprob->ncontvars;
10580 }
10581 
10582 /** gets number of all problem variables created during creation and solving of problem;
10583  * this includes also variables that were deleted in the meantime
10584  *
10585  * @return the number of all problem variables created during creation and solving of problem;
10586  * this includes also variables that were deleted in the meantime
10587  *
10588  * @pre This method can be called if @p scip is in one of the following stages:
10589  * - \ref SCIP_STAGE_PROBLEM
10590  * - \ref SCIP_STAGE_TRANSFORMING
10591  * - \ref SCIP_STAGE_TRANSFORMED
10592  * - \ref SCIP_STAGE_INITPRESOLVE
10593  * - \ref SCIP_STAGE_PRESOLVING
10594  * - \ref SCIP_STAGE_EXITPRESOLVE
10595  * - \ref SCIP_STAGE_PRESOLVED
10596  * - \ref SCIP_STAGE_INITSOLVE
10597  * - \ref SCIP_STAGE_SOLVING
10598  * - \ref SCIP_STAGE_SOLVED
10599  * - \ref SCIP_STAGE_EXITSOLVE
10600  * - \ref SCIP_STAGE_FREETRANS
10601  */
10603  SCIP* scip /**< SCIP data structure */
10604  )
10605 {
10606  SCIP_CALL_ABORT( checkStage(scip, "SCIPgetNTotalVars", FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE) );
10607 
10608  assert(scip->stat != NULL);
10609 
10610  switch( scip->set->stage )
10611  {
10612  case SCIP_STAGE_PROBLEM:
10616  case SCIP_STAGE_PRESOLVING:
10618  case SCIP_STAGE_PRESOLVED:
10619  case SCIP_STAGE_INITSOLVE:
10620  case SCIP_STAGE_SOLVING:
10621  case SCIP_STAGE_SOLVED:
10622  case SCIP_STAGE_EXITSOLVE:
10623  case SCIP_STAGE_FREETRANS:
10624  return scip->stat->nvaridx;
10625 
10626  default:
10627  SCIPerrorMessage("invalid SCIP stage <%d>\n", scip->set->stage);
10628  SCIPABORT();
10629  return 0; /*lint !e527*/
10630  } /*lint !e788*/
10631 
10632 }
10633 
10634 
10635 /** gets variables of the original or transformed problem along with the numbers of different variable types;
10636  * the returned problem space (original or transformed) corresponds to the given solution;
10637  * data may become invalid after calls to SCIPchgVarType(), SCIPfixVar(), SCIPaggregateVars(), and
10638  * SCIPmultiaggregateVar()
10639  *
10640  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
10641  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
10642  *
10643  * @pre This method can be called if @p scip is in one of the following stages:
10644  * - \ref SCIP_STAGE_PROBLEM
10645  * - \ref SCIP_STAGE_TRANSFORMED
10646  * - \ref SCIP_STAGE_INITPRESOLVE
10647  * - \ref SCIP_STAGE_PRESOLVING
10648  * - \ref SCIP_STAGE_EXITPRESOLVE
10649  * - \ref SCIP_STAGE_PRESOLVED
10650  * - \ref SCIP_STAGE_INITSOLVE
10651  * - \ref SCIP_STAGE_SOLVING
10652  * - \ref SCIP_STAGE_SOLVED
10653  */
10655  SCIP* scip, /**< SCIP data structure */
10656  SCIP_SOL* sol, /**< primal solution that selects the problem space, NULL for current solution */
10657  SCIP_VAR*** vars, /**< pointer to store variables array or NULL if not needed */
10658  int* nvars, /**< pointer to store number of variables or NULL if not needed */
10659  int* nbinvars, /**< pointer to store number of binary variables or NULL if not needed */
10660  int* nintvars, /**< pointer to store number of integer variables or NULL if not needed */
10661  int* nimplvars, /**< pointer to store number of implicit integral vars or NULL if not needed */
10662  int* ncontvars /**< pointer to store number of continuous variables or NULL if not needed */
10663  )
10664 {
10665  SCIP_CALL( checkStage(scip, "SCIPgetSolVarsData", FALSE, TRUE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE) );
10666 
10667  if( scip->set->stage == SCIP_STAGE_PROBLEM || (sol != NULL && SCIPsolIsOriginal(sol)) )
10668  {
10669  if( vars != NULL )
10670  *vars = scip->origprob->vars;
10671  if( nvars != NULL )
10672  *nvars = scip->origprob->nvars;
10673  if( nbinvars != NULL )
10674  *nbinvars = scip->origprob->nbinvars;
10675  if( nintvars != NULL )
10676  *nintvars = scip->origprob->nintvars;
10677  if( nimplvars != NULL )
10678  *nimplvars = scip->origprob->nimplvars;
10679  if( ncontvars != NULL )
10680  *ncontvars = scip->origprob->ncontvars;
10681  }
10682  else
10683  {
10684  if( vars != NULL )
10685  *vars = scip->transprob->vars;
10686  if( nvars != NULL )
10687  *nvars = scip->transprob->nvars;
10688  if( nbinvars != NULL )
10689  *nbinvars = scip->transprob->nbinvars;
10690  if( nintvars != NULL )
10691  *nintvars = scip->transprob->nintvars;
10692  if( nimplvars != NULL )
10693  *nimplvars = scip->transprob->nimplvars;
10694  if( ncontvars != NULL )
10695  *ncontvars = scip->transprob->ncontvars;
10696  }
10697 
10698  return SCIP_OKAY;
10699 }
10700 
10701 /** returns variable of given name in the problem, or NULL if not existing
10702  *
10703  * @return variable of given name in the problem, or NULL if not existing
10704  *
10705  * @pre This method can be called if @p scip is in one of the following stages:
10706  * - \ref SCIP_STAGE_PROBLEM
10707  * - \ref SCIP_STAGE_TRANSFORMING
10708  * - \ref SCIP_STAGE_TRANSFORMED
10709  * - \ref SCIP_STAGE_INITPRESOLVE
10710  * - \ref SCIP_STAGE_PRESOLVING
10711  * - \ref SCIP_STAGE_EXITPRESOLVE
10712  * - \ref SCIP_STAGE_PRESOLVED
10713  * - \ref SCIP_STAGE_INITSOLVE
10714  * - \ref SCIP_STAGE_SOLVING
10715  * - \ref SCIP_STAGE_SOLVED
10716  * - \ref SCIP_STAGE_EXITSOLVE
10717  * - \ref SCIP_STAGE_FREETRANS
10718  */
10720  SCIP* scip, /**< SCIP data structure */
10721  const char* name /**< name of variable to find */
10722  )
10723 {
10724  SCIP_VAR* var;
10725 
10726  assert(name != NULL);
10727 
10728  SCIP_CALL_ABORT( checkStage(scip, "SCIPfindVar", FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE) );
10729 
10730  switch( scip->set->stage )
10731  {
10732  case SCIP_STAGE_PROBLEM:
10733  return SCIPprobFindVar(scip->origprob, name);
10734 
10738  case SCIP_STAGE_PRESOLVING:
10740  case SCIP_STAGE_PRESOLVED:
10741  case SCIP_STAGE_SOLVING:
10742  case SCIP_STAGE_SOLVED:
10743  case SCIP_STAGE_EXITSOLVE:
10744  case SCIP_STAGE_FREETRANS:
10745  var = SCIPprobFindVar(scip->transprob, name);
10746  if( var == NULL )
10747  return SCIPprobFindVar(scip->origprob, name);
10748  else
10749  return var;
10750 
10751  default:
10752  SCIPerrorMessage("invalid SCIP stage <%d>\n", scip->set->stage);
10753  SCIPABORT();
10754  return NULL; /*lint !e527*/
10755  } /*lint !e788*/
10756 }
10757 
10758 /** returns TRUE iff all potential variables exist in the problem, and FALSE, if there may be additional variables,
10759  * that will be added in pricing and improve the objective value
10760  *
10761  * @return TRUE, if all potential variables exist in the problem; FALSE, otherwise
10762  *
10763  * @pre This method can be called if @p scip is in one of the following stages:
10764  * - \ref SCIP_STAGE_TRANSFORMING
10765  * - \ref SCIP_STAGE_TRANSFORMED
10766  * - \ref SCIP_STAGE_INITPRESOLVE
10767  * - \ref SCIP_STAGE_PRESOLVING
10768  * - \ref SCIP_STAGE_EXITPRESOLVE
10769  * - \ref SCIP_STAGE_PRESOLVED
10770  * - \ref SCIP_STAGE_INITSOLVE
10771  * - \ref SCIP_STAGE_SOLVING
10772  * - \ref SCIP_STAGE_SOLVED
10773  * - \ref SCIP_STAGE_EXITSOLVE
10774  * - \ref SCIP_STAGE_FREETRANS
10775  */
10777  SCIP* scip /**< SCIP data structure */
10778  )
10779 {
10780  SCIP_CALL_ABORT( checkStage(scip, "SCIPallVarsInProb", FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE) );
10781 
10782  return (scip->set->nactivepricers == 0);
10783 }
10784 
10785 /** adds constraint to the problem; if constraint is only valid locally, it is added to the local subproblem of the
10786  * current node (and all of its subnodes); otherwise it is added to the global problem;
10787  * if a local constraint is added at the root node, it is automatically upgraded into a global constraint
10788  *
10789  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
10790  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
10791  *
10792  * @pre This method can be called if @p scip is in one of the following stages:
10793  * - \ref SCIP_STAGE_PROBLEM
10794  * - \ref SCIP_STAGE_TRANSFORMED
10795  * - \ref SCIP_STAGE_INITPRESOLVE
10796  * - \ref SCIP_STAGE_PRESOLVING
10797  * - \ref SCIP_STAGE_EXITPRESOLVE
10798  * - \ref SCIP_STAGE_PRESOLVED
10799  * - \ref SCIP_STAGE_INITSOLVE
10800  * - \ref SCIP_STAGE_SOLVING
10801  * - \ref SCIP_STAGE_EXITSOLVE
10802  */
10804  SCIP* scip, /**< SCIP data structure */
10805  SCIP_CONS* cons /**< constraint to add */
10806  )
10807 {
10808  assert(cons != NULL);
10809 
10810  SCIP_CALL( checkStage(scip, "SCIPaddCons", FALSE, TRUE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, TRUE, FALSE, FALSE) );
10811 
10812  switch( scip->set->stage )
10813  {
10814  case SCIP_STAGE_PROBLEM:
10815  SCIP_CALL( SCIPprobAddCons(scip->origprob, scip->set, scip->stat, cons) );
10816  return SCIP_OKAY;
10817 
10819  SCIP_CALL( SCIPprobAddCons(scip->transprob, scip->set, scip->stat, cons) );
10820  return SCIP_OKAY;
10821 
10823  case SCIP_STAGE_PRESOLVING:
10825  case SCIP_STAGE_PRESOLVED:
10826  case SCIP_STAGE_SOLVING:
10827  assert( SCIPtreeGetCurrentDepth(scip->tree) >= 0 || scip->set->stage == SCIP_STAGE_PRESOLVED );
10829  SCIPconsSetLocal(cons, FALSE);
10830  if( SCIPconsIsGlobal(cons) )
10831  {
10832  SCIP_CALL( SCIPprobAddCons(scip->transprob, scip->set, scip->stat, cons) );
10833  }
10834  else
10835  {
10837  SCIP_CALL( SCIPnodeAddCons(SCIPtreeGetCurrentNode(scip->tree), scip->mem->probmem, scip->set, scip->stat,
10838  scip->tree, cons) );
10839  }
10840  return SCIP_OKAY;
10841 
10842  case SCIP_STAGE_EXITSOLVE:
10843  SCIP_CALL( SCIPprobAddCons(scip->transprob, scip->set, scip->stat, cons) );
10844  return SCIP_OKAY;
10845 
10846  default:
10847  SCIPerrorMessage("invalid SCIP stage <%d>\n", scip->set->stage);
10848  return SCIP_INVALIDCALL;
10849  } /*lint !e788*/
10850 }
10851 
10852 /** globally removes constraint from all subproblems; removes constraint from the constraint set change data of the
10853  * node, where it was added, or from the problem, if it was a problem constraint
10854  *
10855  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
10856  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
10857  *
10858  * @pre This method can be called if @p scip is in one of the following stages:
10859  * - \ref SCIP_STAGE_PROBLEM
10860  * - \ref SCIP_STAGE_INITPRESOLVE
10861  * - \ref SCIP_STAGE_PRESOLVING
10862  * - \ref SCIP_STAGE_EXITPRESOLVE
10863  * - \ref SCIP_STAGE_INITSOLVE
10864  * - \ref SCIP_STAGE_SOLVING
10865  */
10867  SCIP* scip, /**< SCIP data structure */
10868  SCIP_CONS* cons /**< constraint to delete */
10869  )
10870 {
10871  assert(cons != NULL);
10872 
10873  SCIP_CALL( checkStage(scip, "SCIPdelCons", FALSE, TRUE, FALSE, FALSE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) );
10874 
10875  switch( scip->set->stage )
10876  {
10877  case SCIP_STAGE_PROBLEM:
10878  assert(cons->addconssetchg == NULL);
10879  SCIP_CALL( SCIPconsDelete(cons, scip->mem->probmem, scip->set, scip->stat, scip->origprob) );
10880  return SCIP_OKAY;
10881 
10882  /* only added constraints can be removed in (de-)initialization process of presolving, otherwise the reduction
10883  * might be wrong
10884  */
10887  assert(SCIPconsIsAdded(cons));
10888  /*lint -fallthrough*/
10889 
10890  case SCIP_STAGE_PRESOLVING:
10891  case SCIP_STAGE_SOLVING:
10892  SCIP_CALL( SCIPconsDelete(cons, scip->mem->probmem, scip->set, scip->stat, scip->transprob) );
10893  return SCIP_OKAY;
10894 
10895  default:
10896  SCIPerrorMessage("invalid SCIP stage <%d>\n", scip->set->stage);
10897  return SCIP_INVALIDCALL;
10898  } /*lint !e788*/
10899 }
10900 
10901 /** returns original constraint of given name in the problem, or NULL if not existing
10902  *
10903  * @return original constraint of given name in the problem, or NULL if not existing
10904  *
10905  * @pre This method can be called if @p scip is in one of the following stages:
10906  * - \ref SCIP_STAGE_PROBLEM
10907  * - \ref SCIP_STAGE_TRANSFORMING
10908  * - \ref SCIP_STAGE_TRANSFORMED
10909  * - \ref SCIP_STAGE_INITPRESOLVE
10910  * - \ref SCIP_STAGE_PRESOLVING
10911  * - \ref SCIP_STAGE_EXITPRESOLVE
10912  * - \ref SCIP_STAGE_PRESOLVED
10913  * - \ref SCIP_STAGE_INITSOLVE
10914  * - \ref SCIP_STAGE_SOLVING
10915  * - \ref SCIP_STAGE_SOLVED
10916  * - \ref SCIP_STAGE_EXITSOLVE
10917  * - \ref SCIP_STAGE_FREETRANS
10918  */
10920  SCIP* scip, /**< SCIP data structure */
10921  const char* name /**< name of constraint to find */
10922  )
10923 {
10924  assert(name != NULL);
10925 
10926  SCIP_CALL_ABORT( checkStage(scip, "SCIPfindOrigCons", FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE) );
10927 
10928  switch( scip->set->stage )
10929  {
10930  case SCIP_STAGE_PROBLEM:
10933  case SCIP_STAGE_PRESOLVING:
10935  case SCIP_STAGE_PRESOLVED:
10936  case SCIP_STAGE_SOLVING:
10937  case SCIP_STAGE_SOLVED:
10938  case SCIP_STAGE_EXITSOLVE:
10939  case SCIP_STAGE_FREETRANS:
10940  return SCIPprobFindCons(scip->origprob, name);
10941 
10942  default:
10943  SCIPerrorMessage("invalid SCIP stage <%d>\n", scip->set->stage);
10944  SCIPABORT();
10945  return NULL; /*lint !e527*/
10946  } /*lint !e788*/
10947 }
10948 
10949 /** returns constraint of given name in the problem, or NULL if not existing
10950  *
10951  * @return constraint of given name in the problem, or NULL if not existing
10952  *
10953  * @pre This method can be called if @p scip is in one of the following stages:
10954  * - \ref SCIP_STAGE_PROBLEM
10955  * - \ref SCIP_STAGE_TRANSFORMING
10956  * - \ref SCIP_STAGE_TRANSFORMED
10957  * - \ref SCIP_STAGE_INITPRESOLVE
10958  * - \ref SCIP_STAGE_PRESOLVING
10959  * - \ref SCIP_STAGE_EXITPRESOLVE
10960  * - \ref SCIP_STAGE_PRESOLVED
10961  * - \ref SCIP_STAGE_INITSOLVE
10962  * - \ref SCIP_STAGE_SOLVING
10963  * - \ref SCIP_STAGE_SOLVED
10964  * - \ref SCIP_STAGE_EXITSOLVE
10965  * - \ref SCIP_STAGE_FREETRANS
10966  */
10968  SCIP* scip, /**< SCIP data structure */
10969  const char* name /**< name of constraint to find */
10970  )
10971 {
10972  SCIP_CONS* cons;
10973 
10974  assert(name != NULL);
10975 
10976  SCIP_CALL_ABORT( checkStage(scip, "SCIPfindCons", FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE) );
10977 
10978  switch( scip->set->stage )
10979  {
10980  case SCIP_STAGE_PROBLEM:
10981  return SCIPprobFindCons(scip->origprob, name);
10982 
10986  case SCIP_STAGE_PRESOLVING:
10988  case SCIP_STAGE_PRESOLVED:
10989  case SCIP_STAGE_SOLVING:
10990  case SCIP_STAGE_SOLVED:
10991  case SCIP_STAGE_EXITSOLVE:
10992  case SCIP_STAGE_FREETRANS:
10993  cons = SCIPprobFindCons(scip->transprob, name);
10994  if( cons == NULL )
10995  return SCIPprobFindCons(scip->origprob, name);
10996  else
10997  return cons;
10998 
10999  default:
11000  SCIPerrorMessage("invalid SCIP stage <%d>\n", scip->set->stage);
11001  SCIPABORT();
11002  return NULL; /*lint !e527*/
11003  } /*lint !e788*/
11004 }
11005 
11006 /** gets number of upgraded constraints
11007  *
11008  * @return number of upgraded constraints
11009  *
11010  * @pre This method can be called if @p scip is in one of the following stages:
11011  * - \ref SCIP_STAGE_PROBLEM
11012  * - \ref SCIP_STAGE_TRANSFORMED
11013  * - \ref SCIP_STAGE_INITPRESOLVE
11014  * - \ref SCIP_STAGE_PRESOLVING
11015  * - \ref SCIP_STAGE_PRESOLVED
11016  * - \ref SCIP_STAGE_EXITPRESOLVE
11017  * - \ref SCIP_STAGE_SOLVING
11018  * - \ref SCIP_STAGE_SOLVED
11019  */
11021  SCIP* scip /**< SCIP data structure */
11022  )
11023 {
11024  SCIP_CALL_ABORT( checkStage(scip, "SCIPgetNUpgrConss", FALSE, TRUE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE) );
11025 
11026  switch( scip->set->stage )
11027  {
11028  case SCIP_STAGE_PROBLEM:
11029  return 0;
11030 
11033  case SCIP_STAGE_PRESOLVING:
11035  case SCIP_STAGE_PRESOLVED:
11036  case SCIP_STAGE_SOLVING:
11037  case SCIP_STAGE_SOLVED:
11038  return scip->stat->npresolupgdconss;
11039 
11040  default:
11041  SCIPerrorMessage("invalid SCIP stage <%d>\n", scip->set->stage);
11042  SCIPABORT();
11043  return 0; /*lint !e527*/
11044  } /*lint !e788*/
11045 }
11046 
11047 /** gets total number of globally valid constraints currently in the problem
11048  *
11049  * @return total number of globally valid constraints currently in the problem
11050  *
11051  * @pre This method can be called if @p scip is in one of the following stages:
11052  * - \ref SCIP_STAGE_PROBLEM
11053  * - \ref SCIP_STAGE_TRANSFORMED
11054  * - \ref SCIP_STAGE_INITPRESOLVE
11055  * - \ref SCIP_STAGE_PRESOLVING
11056  * - \ref SCIP_STAGE_EXITPRESOLVE
11057  * - \ref SCIP_STAGE_PRESOLVED
11058  * - \ref SCIP_STAGE_INITSOLVE
11059  * - \ref SCIP_STAGE_SOLVING
11060  * - \ref SCIP_STAGE_SOLVED
11061  */
11063  SCIP* scip /**< SCIP data structure */
11064  )
11065 {
11066  SCIP_CALL_ABORT( checkStage(scip, "SCIPgetNConss", FALSE, TRUE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE) );
11067 
11068  switch( scip->set->stage )
11069  {
11070  case SCIP_STAGE_PROBLEM:
11071  return scip->origprob->nconss;
11072 
11075  case SCIP_STAGE_PRESOLVING:
11077  case SCIP_STAGE_PRESOLVED:
11078  case SCIP_STAGE_INITSOLVE:
11079  case SCIP_STAGE_SOLVING:
11080  case SCIP_STAGE_SOLVED:
11081  return scip->transprob->nconss;
11082 
11083  default:
11084  SCIPerrorMessage("invalid SCIP stage <%d>\n", scip->set->stage);
11085  SCIPABORT();
11086  return 0; /*lint !e527*/
11087  } /*lint !e788*/
11088 }
11089 
11090 /** gets array of globally valid constraints currently in the problem
11091  *
11092  * @return array of globally valid constraints currently in the problem
11093  *
11094  * @pre This method can be called if @p scip is in one of the following stages:
11095  * - \ref SCIP_STAGE_PROBLEM
11096  * - \ref SCIP_STAGE_TRANSFORMED
11097  * - \ref SCIP_STAGE_INITPRESOLVE
11098  * - \ref SCIP_STAGE_PRESOLVING
11099  * - \ref SCIP_STAGE_EXITPRESOLVE
11100  * - \ref SCIP_STAGE_PRESOLVED
11101  * - \ref SCIP_STAGE_INITSOLVE
11102  * - \ref SCIP_STAGE_SOLVING
11103  * - \ref SCIP_STAGE_SOLVED
11104  *
11105  * @warning If your are using the method SCIPaddCons(), it can happen that the internal constraint array (which is
11106  * accessed via this method) gets resized. This can invalid the pointer which is returned by this method.
11107  */
11109  SCIP* scip /**< SCIP data structure */
11110  )
11111 {
11112  SCIP_CALL_ABORT( checkStage(scip, "SCIPgetConss", FALSE, TRUE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE) );
11113 
11114  switch( scip->set->stage )
11115  {
11116  case SCIP_STAGE_PROBLEM:
11117  return scip->origprob->conss;
11118 
11121  case SCIP_STAGE_PRESOLVING:
11123  case SCIP_STAGE_PRESOLVED:
11124  case SCIP_STAGE_INITSOLVE:
11125  case SCIP_STAGE_SOLVING:
11126  case SCIP_STAGE_SOLVED:
11127  return scip->transprob->conss;
11128 
11129  default:
11130  SCIPerrorMessage("invalid SCIP stage <%d>\n", scip->set->stage);
11131  SCIPABORT();
11132  return NULL; /*lint !e527*/
11133  } /*lint !e788*/
11134 }
11135 
11136 /** gets total number of constraints in the original problem
11137  *
11138  * @return total number of constraints in the original problem
11139  *
11140  * @pre This method can be called if @p scip is in one of the following stages:
11141  * - \ref SCIP_STAGE_PROBLEM
11142  * - \ref SCIP_STAGE_TRANSFORMING
11143  * - \ref SCIP_STAGE_TRANSFORMED
11144  * - \ref SCIP_STAGE_INITPRESOLVE
11145  * - \ref SCIP_STAGE_PRESOLVING
11146  * - \ref SCIP_STAGE_EXITPRESOLVE
11147  * - \ref SCIP_STAGE_PRESOLVED
11148  * - \ref SCIP_STAGE_INITSOLVE
11149  * - \ref SCIP_STAGE_SOLVING
11150  * - \ref SCIP_STAGE_SOLVED
11151  * - \ref SCIP_STAGE_EXITSOLVE
11152  * - \ref SCIP_STAGE_FREETRANS
11153  */
11155  SCIP* scip /**< SCIP data structure */
11156  )
11157 {
11158  SCIP_CALL_ABORT( checkStage(scip, "SCIPgetNOrigConss", FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE) );
11159 
11160  return scip->origprob->nconss;
11161 }
11162 
11163 /** gets array of constraints in the original problem
11164  *
11165  * @return array of constraints in the original problem
11166  *
11167  * @pre This method can be called if @p scip is in one of the following stages:
11168  * - \ref SCIP_STAGE_PROBLEM
11169  * - \ref SCIP_STAGE_TRANSFORMING
11170  * - \ref SCIP_STAGE_TRANSFORMED
11171  * - \ref SCIP_STAGE_INITPRESOLVE
11172  * - \ref SCIP_STAGE_PRESOLVING
11173  * - \ref SCIP_STAGE_EXITPRESOLVE
11174  * - \ref SCIP_STAGE_PRESOLVED
11175  * - \ref SCIP_STAGE_INITSOLVE
11176  * - \ref SCIP_STAGE_SOLVING
11177  * - \ref SCIP_STAGE_SOLVED
11178  * - \ref SCIP_STAGE_EXITSOLVE
11179  * - \ref SCIP_STAGE_FREETRANS
11180  */
11182  SCIP* scip /**< SCIP data structure */
11183  )
11184 {
11185  SCIP_CALL_ABORT( checkStage(scip, "SCIPgetOrigConss", FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE) );
11186 
11187  return scip->origprob->conss;
11188 }
11189 
11190 /** computes the number of check constraint in the current node (loop over all constraint handler and cumulates the
11191  * number of check constraints)
11192  *
11193  * @return returns the number of check constraints
11194  *
11195  * @pre This method can be called if @p scip is in one of the following stages:
11196  * - \ref SCIP_STAGE_TRANSFORMED
11197  * - \ref SCIP_STAGE_INITPRESOLVE
11198  * - \ref SCIP_STAGE_PRESOLVING
11199  * - \ref SCIP_STAGE_EXITPRESOLVE
11200  * - \ref SCIP_STAGE_PRESOLVED
11201  * - \ref SCIP_STAGE_INITSOLVE
11202  * - \ref SCIP_STAGE_SOLVING
11203  */
11205  SCIP* scip /**< SCIP data structure */
11206  )
11207 {
11208  SCIP_CONSHDLR** conshdlrs;
11209  int nconshdlrs;
11210  int ncheckconss;
11211  int c;
11212 
11213  SCIP_CALL_ABORT( checkStage(scip, "SCIPgetNCheckConss", FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE) );
11214 
11215  nconshdlrs = SCIPgetNConshdlrs(scip);
11216  conshdlrs = SCIPgetConshdlrs(scip);
11217  assert(conshdlrs != NULL);
11218 
11219  ncheckconss = 0;
11220 
11221  /* loop over all constraint handler and collect the number of constraints which need to be checked */
11222  for( c = 0; c < nconshdlrs; ++c )
11223  {
11224  assert(conshdlrs[c] != NULL);
11225  ncheckconss += SCIPconshdlrGetNCheckConss(conshdlrs[c]);
11226  }
11227 
11228  return ncheckconss;
11229 
11230 }
11231 
11232 /*
11233  * local subproblem methods
11234  */
11235 
11236 /** adds constraint to the given node (and all of its subnodes), even if it is a global constraint;
11237  * It is sometimes desirable to add the constraint to a more local node (i.e., a node of larger depth) even if
11238  * the constraint is also valid higher in the tree, for example, if one wants to produce a constraint which is
11239  * only active in a small part of the tree although it is valid in a larger part.
11240  * In this case, one should pass the more global node where the constraint is valid as "validnode".
11241  * Note that the same constraint cannot be added twice to the branching tree with different "validnode" parameters.
11242  * If the constraint is valid at the same node as it is inserted (the usual case), one should pass NULL as "validnode".
11243  * If the "validnode" is the root node, it is automatically upgraded into a global constraint, but still only added to
11244  * the given node. If a local constraint is added to the root node, it is added to the global problem instead.
11245  *
11246  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
11247  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
11248  *
11249  * @pre this method can be called in one of the following stages of the SCIP solving process:
11250  * - \ref SCIP_STAGE_INITPRESOLVE
11251  * - \ref SCIP_STAGE_PRESOLVING
11252  * - \ref SCIP_STAGE_EXITPRESOLVE
11253  * - \ref SCIP_STAGE_SOLVING
11254  */
11256  SCIP* scip, /**< SCIP data structure */
11257  SCIP_NODE* node, /**< node to add constraint to */
11258  SCIP_CONS* cons, /**< constraint to add */
11259  SCIP_NODE* validnode /**< node at which the constraint is valid, or NULL */
11260  )
11261 {
11262  assert(cons != NULL);
11263  assert(node != NULL);
11264 
11265  SCIP_CALL( checkStage(scip, "SCIPaddConsNode", FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) );
11266 
11267  if( validnode != NULL )
11268  {
11269  int validdepth;
11270 
11271  validdepth = SCIPnodeGetDepth(validnode);
11272  if( validdepth > SCIPnodeGetDepth(node) )
11273  {
11274  SCIPerrorMessage("cannot add constraint <%s> valid in depth %d to a node of depth %d\n",
11275  SCIPconsGetName(cons), validdepth, SCIPnodeGetDepth(node));
11276  return SCIP_INVALIDDATA;
11277  }
11278  if( cons->validdepth != -1 && cons->validdepth != validdepth )
11279  {
11280  SCIPerrorMessage("constraint <%s> is already marked to be valid in depth %d - cannot mark it to be valid in depth %d\n",
11281  SCIPconsGetName(cons), cons->validdepth, validdepth);
11282  return SCIP_INVALIDDATA;
11283  }
11284  if( validdepth <= SCIPtreeGetEffectiveRootDepth(scip->tree) )
11285  SCIPconsSetLocal(cons, FALSE);
11286  else
11287  cons->validdepth = validdepth;
11288  }
11289 
11291  {
11292  SCIPconsSetLocal(cons, FALSE);
11293  SCIP_CALL( SCIPprobAddCons(scip->transprob, scip->set, scip->stat, cons) );
11294  }
11295  else
11296  {
11297  SCIP_CALL( SCIPnodeAddCons(node, scip->mem->probmem, scip->set, scip->stat, scip->tree, cons) );
11298  }
11299 
11300  return SCIP_OKAY;
11301 }
11302 
11303 /** adds constraint locally to the current node (and all of its subnodes), even if it is a global constraint;
11304  * It is sometimes desirable to add the constraint to a more local node (i.e., a node of larger depth) even if
11305  * the constraint is also valid higher in the tree, for example, if one wants to produce a constraint which is
11306  * only active in a small part of the tree although it is valid in a larger part.
11307  *
11308  * If the constraint is valid at the same node as it is inserted (the usual case), one should pass NULL as "validnode".
11309  * If the "validnode" is the root node, it is automatically upgraded into a global constraint, but still only added to
11310  * the given node. If a local constraint is added to the root node, it is added to the global problem instead.
11311  *
11312  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
11313  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
11314  *
11315  * @pre this method can be called in one of the following stages of the SCIP solving process:
11316  * - \ref SCIP_STAGE_INITPRESOLVE
11317  * - \ref SCIP_STAGE_PRESOLVING
11318  * - \ref SCIP_STAGE_EXITPRESOLVE
11319  * - \ref SCIP_STAGE_SOLVING
11320  *
11321  * @note The same constraint cannot be added twice to the branching tree with different "validnode" parameters. This is
11322  * the case due to internal data structures and performance issues. In such a case you should try to realize your
11323  * issue using the method SCIPdisableCons() and SCIPenableCons() and control these via the event system of SCIP.
11324  */
11326  SCIP* scip, /**< SCIP data structure */
11327  SCIP_CONS* cons, /**< constraint to add */
11328  SCIP_NODE* validnode /**< node at which the constraint is valid, or NULL */
11329  )
11330 {
11331  assert(cons != NULL);
11332 
11333  SCIP_CALL( checkStage(scip, "SCIPaddConsLocal", FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) );
11334 
11335  SCIP_CALL( SCIPaddConsNode(scip, SCIPtreeGetCurrentNode(scip->tree), cons, validnode) );
11336 
11337  return SCIP_OKAY;
11338 }
11339 
11340 /** disables constraint's separation, enforcing, and propagation capabilities at the given node (and all subnodes);
11341  * if the method is called at the root node, the constraint is globally deleted from the problem;
11342  * the constraint deletion is being remembered at the given node, s.t. after leaving the node's subtree, the constraint
11343  * is automatically enabled again, and after entering the node's subtree, it is automatically disabled;
11344  * this may improve performance because redundant checks on this constraint are avoided, but it consumes memory;
11345  * alternatively, use SCIPdisableCons()
11346  *
11347  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
11348  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
11349  *
11350  * @pre this method can be called in one of the following stages of the SCIP solving process:
11351  * - \ref SCIP_STAGE_INITPRESOLVE
11352  * - \ref SCIP_STAGE_PRESOLVING
11353  * - \ref SCIP_STAGE_EXITPRESOLVE
11354  * - \ref SCIP_STAGE_SOLVING
11355  */
11357  SCIP* scip, /**< SCIP data structure */
11358  SCIP_NODE* node, /**< node to disable constraint in */
11359  SCIP_CONS* cons /**< constraint to locally delete */
11360  )
11361 {
11362  assert(cons != NULL);
11363 
11364  SCIP_CALL( checkStage(scip, "SCIPdelConsNode", FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) );
11365 
11366  /* only added constraints can be removed in (de-)initialization process of presolving, otherwise the reduction
11367  * might be wrong
11368  */
11369  if( scip->set->stage == SCIP_STAGE_INITPRESOLVE || scip->set->stage == SCIP_STAGE_EXITPRESOLVE )
11370  assert(SCIPconsIsAdded(cons));
11371 
11373  {
11374  SCIP_CALL( SCIPconsDelete(cons, scip->mem->probmem, scip->set, scip->stat, scip->transprob) );
11375  }
11376  else
11377  {
11378  SCIP_CALL( SCIPnodeDelCons(node, scip->mem->probmem, scip->set, scip->stat, scip->tree, cons) );
11379  }
11380 
11381  return SCIP_OKAY;
11382 }
11383 
11384 /** disables constraint's separation, enforcing, and propagation capabilities at the current node (and all subnodes);
11385  * if the method is called during problem modification or at the root node, the constraint is globally deleted from
11386  * the problem;
11387  * the constraint deletion is being remembered at the current node, s.t. after leaving the current subtree, the
11388  * constraint is automatically enabled again, and after reentering the current node's subtree, it is automatically
11389  * disabled again;
11390  * this may improve performance because redundant checks on this constraint are avoided, but it consumes memory;
11391  * alternatively, use SCIPdisableCons()
11392  *
11393  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
11394  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
11395  *
11396  * @pre this method can be called in one of the following stages of the SCIP solving process:
11397  * - \ref SCIP_STAGE_PROBLEM
11398  * - \ref SCIP_STAGE_INITPRESOLVE
11399  * - \ref SCIP_STAGE_PRESOLVING
11400  * - \ref SCIP_STAGE_EXITPRESOLVE
11401  * - \ref SCIP_STAGE_SOLVING
11402  *
11403  * @note SCIP stage does not get changed
11404  *
11405  */
11407  SCIP* scip, /**< SCIP data structure */
11408  SCIP_CONS* cons /**< constraint to locally delete */
11409  )
11410 {
11411  SCIP_NODE* node;
11412 
11413  assert(cons != NULL);
11414 
11415  SCIP_CALL( checkStage(scip, "SCIPdelConsLocal", FALSE, TRUE, FALSE, FALSE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) );
11416 
11417  switch( scip->set->stage )
11418  {
11419  case SCIP_STAGE_PROBLEM:
11420  assert(cons->addconssetchg == NULL);
11421  SCIP_CALL( SCIPconsDelete(cons, scip->mem->probmem, scip->set, scip->stat, scip->origprob) );
11422  return SCIP_OKAY;
11423 
11424  /* only added constraints can be removed in (de-)initialization process of presolving, otherwise the reduction
11425  * might be wrong
11426  */
11429  assert(SCIPconsIsAdded(cons));
11430  /*lint -fallthrough*/
11431 
11432  case SCIP_STAGE_PRESOLVING:
11433  case SCIP_STAGE_SOLVING:
11434  node = SCIPtreeGetCurrentNode(scip->tree);
11436  {
11437  SCIP_CALL( SCIPconsDelete(cons, scip->mem->probmem, scip->set, scip->stat, scip->transprob) );
11438  }
11439  else
11440  {
11441  SCIP_CALL( SCIPnodeDelCons(node, scip->mem->probmem, scip->set, scip->stat, scip->tree, cons) );
11442  }
11443  return SCIP_OKAY;
11444 
11445  default:
11446  SCIPerrorMessage("invalid SCIP stage <%d>\n", scip->set->stage);
11447  return SCIP_INVALIDCALL;
11448  } /*lint !e788*/
11449 }
11450 
11451 /** gets estimate of best primal solution w.r.t. original problem contained in current subtree
11452  *
11453  * @return estimate of best primal solution w.r.t. original problem contained in current subtree
11454  *
11455  * @pre this method can be called in one of the following stages of the SCIP solving process:
11456  * - \ref SCIP_STAGE_SOLVING
11457  */
11459  SCIP* scip /**< SCIP data structure */
11460  )
11461 {
11462  SCIP_NODE* node;
11463 
11464  SCIP_CALL_ABORT( checkStage(scip, "SCIPgetLocalOrigEstimate", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) );
11465 
11466  node = SCIPtreeGetCurrentNode(scip->tree);
11467  return node != NULL ? SCIPprobExternObjval(scip->transprob, scip->origprob, scip->set, SCIPnodeGetEstimate(node)) : SCIP_INVALID;
11468 }
11469 
11470 /** gets estimate of best primal solution w.r.t. transformed problem contained in current subtree
11471  *
11472  * @return estimate of best primal solution w.r.t. transformed problem contained in current subtree
11473  *
11474  * @pre this method can be called in one of the following stages of the SCIP solving process:
11475  * - \ref SCIP_STAGE_SOLVING
11476  */
11478  SCIP* scip /**< SCIP data structure */
11479  )
11480 {
11481  SCIP_NODE* node;
11482 
11483  SCIP_CALL_ABORT( checkStage(scip, "SCIPgetLocalTransEstimate", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) );
11484 
11485  node = SCIPtreeGetCurrentNode(scip->tree);
11486 
11487  return node != NULL ? SCIPnodeGetEstimate(node) : SCIP_INVALID;
11488 }
11489 
11490 /** gets dual bound of current node
11491  *
11492  * @return dual bound of current node
11493  *
11494  * @pre this method can be called in one of the following stages of the SCIP solving process:
11495  * - \ref SCIP_STAGE_SOLVING
11496  */
11498  SCIP* scip /**< SCIP data structure */
11499  )
11500 {
11501  SCIP_NODE* node;
11502 
11503  SCIP_CALL_ABORT( checkStage(scip, "SCIPgetLocalDualbound", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) );
11504 
11505  node = SCIPtreeGetCurrentNode(scip->tree);
11506  return node != NULL ? SCIPprobExternObjval(scip->transprob, scip->origprob, scip->set, SCIPnodeGetLowerbound(node)) : SCIP_INVALID;
11507 }
11508 
11509 /** gets lower bound of current node in transformed problem
11510  *
11511  * @return lower bound of current node in transformed problem
11512  *
11513  * @pre this method can be called in one of the following stages of the SCIP solving process:
11514  * - \ref SCIP_STAGE_SOLVING
11515  */
11517  SCIP* scip /**< SCIP data structure */
11518  )
11519 {
11520  SCIP_NODE* node;
11521 
11522  SCIP_CALL_ABORT( checkStage(scip, "SCIPgetLocalLowerbound", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) );
11523 
11524  node = SCIPtreeGetCurrentNode(scip->tree);
11525 
11526  return node != NULL ? SCIPnodeGetLowerbound(node) : SCIP_INVALID;
11527 }
11528 
11529 /** gets dual bound of given node
11530  *
11531  * @return dual bound of a given node
11532  *
11533  * @pre this method can be called in one of the following stages of the SCIP solving process:
11534  * - \ref SCIP_STAGE_SOLVING
11535  */
11537  SCIP* scip, /**< SCIP data structure */
11538  SCIP_NODE* node /**< node to get dual bound for */
11539  )
11540 {
11541  SCIP_CALL_ABORT( checkStage(scip, "SCIPgetNodeDualbound", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) );
11542 
11543  return SCIPprobExternObjval(scip->transprob, scip->origprob, scip->set, SCIPnodeGetLowerbound(node));
11544 }
11545 
11546 /** gets lower bound of given node in transformed problem
11547  *
11548  * @return lower bound of given node in transformed problem
11549  *
11550  * @pre this method can be called in one of the following stages of the SCIP solving process:
11551  * - \ref SCIP_STAGE_SOLVING
11552  */
11554  SCIP* scip, /**< SCIP data structure */
11555  SCIP_NODE* node /**< node to get dual bound for */
11556  )
11557 {
11558  SCIP_CALL_ABORT( checkStage(scip, "SCIPgetNodeLowerbound", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) );
11559 
11560  return SCIPnodeGetLowerbound(node);
11561 }
11562 
11563 /** if given value is tighter (larger for minimization, smaller for maximization) than the current node's dual bound (in
11564  * original problem space), sets the current node's dual bound to the new value
11565  *
11566  * @note the given new bound has to be a dual bound, i.e., it has to be valid for the original problem.
11567  *
11568  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
11569  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
11570  *
11571  * @pre this method can be called in one of the following stages of the SCIP solving process:
11572  * - \ref SCIP_STAGE_PROBLEM
11573  * - \ref SCIP_STAGE_PRESOLVING
11574  * - \ref SCIP_STAGE_PRESOLVED
11575  * - \ref SCIP_STAGE_SOLVING
11576  */
11578  SCIP* scip, /**< SCIP data structure */
11579  SCIP_Real newbound /**< new dual bound for the node (if it's tighter than the old one) */
11580  )
11581 {
11582  SCIP_CALL( checkStage(scip, "SCIPupdateLocalDualbound", FALSE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, TRUE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) );
11583 
11584  switch( scip->set->stage )
11585  {
11586  case SCIP_STAGE_PROBLEM:
11587  /* since no root node, for which we could update the dual bound, has been create yet, update the dual bound stored in
11588  * the problem data
11589  */
11590  SCIPprobUpdateDualbound(scip->origprob, newbound);
11591  break;
11592 
11593  case SCIP_STAGE_PRESOLVING:
11594  case SCIP_STAGE_PRESOLVED:
11595  /* since no root node, for which we could update the dual bound, has been create yet, update the dual bound stored in
11596  * the problem data
11597  */
11598  SCIPprobUpdateDualbound(scip->transprob, SCIPprobExternObjval(scip->transprob, scip->origprob, scip->set, newbound));
11599  break;
11600 
11601  case SCIP_STAGE_SOLVING:
11603  break;
11604 
11605  default:
11606  SCIPerrorMessage("invalid SCIP stage <%d>\n", scip->set->stage);
11607  SCIPABORT();
11608  return SCIP_INVALIDCALL; /*lint !e527*/
11609  } /*lint !e788*/
11610 
11611  return SCIP_OKAY;
11612 }
11613 
11614 /** if given value is larger than the current node's lower bound (in transformed problem), sets the current node's
11615  * lower bound to the new value
11616  *
11617  * @note the given new bound has to be a lower bound, i.e., it has to be valid for the transformed problem.
11618  *
11619  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
11620  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
11621  *
11622  * @pre this method can be called in one of the following stages of the SCIP solving process:
11623  * - \ref SCIP_STAGE_PRESOLVING
11624  * - \ref SCIP_STAGE_PRESOLVED
11625  * - \ref SCIP_STAGE_SOLVING
11626  */
11628  SCIP* scip, /**< SCIP data structure */
11629  SCIP_Real newbound /**< new lower bound for the node (if it's larger than the old one) */
11630  )
11631 {
11632  SCIP_CALL( checkStage(scip, "SCIPupdateLocalLowerbound", FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, TRUE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) );
11633 
11634  switch( scip->set->stage )
11635  {
11636  case SCIP_STAGE_PRESOLVING:
11637  case SCIP_STAGE_PRESOLVED:
11638  /* since no root node, for which we could update the lower bound, has been created yet, update the dual bound stored
11639  * in the problem data
11640  */
11641  SCIPprobUpdateDualbound(scip->transprob, SCIPprobExternObjval(scip->transprob, scip->origprob, scip->set, newbound));
11642  break;
11643 
11644  case SCIP_STAGE_SOLVING:
11646  break;
11647 
11648  default:
11649  SCIPerrorMessage("invalid SCIP stage <%d>\n", scip->set->stage);
11650  SCIPABORT();
11651  return SCIP_INVALIDCALL; /*lint !e527*/
11652  } /*lint !e788*/
11653 
11654  return SCIP_OKAY;
11655 }
11656 
11657 /** if given value is tighter (larger for minimization, smaller for maximization) than the node's dual bound,
11658  * sets the node's dual bound to the new value
11659  *
11660  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
11661  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
11662  *
11663  * @pre this method can be called in one of the following stages of the SCIP solving process:
11664  * - \ref SCIP_STAGE_SOLVING
11665  */
11667  SCIP* scip, /**< SCIP data structure */
11668  SCIP_NODE* node, /**< node to update dual bound for */
11669  SCIP_Real newbound /**< new dual bound for the node (if it's tighter than the old one) */
11670  )
11671 {
11672  SCIP_CALL( checkStage(scip, "SCIPupdateNodeDualbound", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) );
11673 
11674  SCIP_CALL( SCIPupdateNodeLowerbound(scip, node, SCIPprobInternObjval(scip->transprob, scip->origprob, scip->set, newbound)) );
11675 
11676  return SCIP_OKAY;
11677 }
11678 
11679 /** if given value is larger than the node's lower bound (in transformed problem), sets the node's lower bound
11680  * to the new value
11681  *
11682  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
11683  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
11684  *
11685  * @pre this method can be called in one of the following stages of the SCIP solving process:
11686  * - \ref SCIP_STAGE_SOLVING
11687  */
11689  SCIP* scip, /**< SCIP data structure */
11690  SCIP_NODE* node, /**< node to update lower bound for */
11691  SCIP_Real newbound /**< new lower bound for the node (if it's larger than the old one) */
11692  )
11693 {
11694  SCIP_CALL( checkStage(scip, "SCIPupdateNodeLowerbound", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) );
11695 
11696  SCIPnodeUpdateLowerbound(node, scip->stat, scip->set, scip->tree, scip->transprob, scip->origprob, newbound);
11697 
11698  /* if lowerbound exceeds the cutoffbound the node will be marked to be cutoff
11699  *
11700  * If the node is an inner node (,not a child node,) we need to cutoff the node manually if we exceed the
11701  * cutoffbound. This is only relevant if a user updates the lower bound; in the main solving process of SCIP the
11702  * lowerbound is only changed before branching and the given node is always a child node. Therefore, we only check
11703  * for a cutoff here in the user function instead of in SCIPnodeUpdateLowerbound().
11704  */
11705  if( SCIPisGE(scip, newbound, scip->primal->cutoffbound) )
11706  SCIPnodeCutoff(node, scip->set, scip->stat, scip->tree);
11707 
11708  return SCIP_OKAY;
11709 }
11710 
11711 /** change the node selection priority of the given child
11712  *
11713  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
11714  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
11715  *
11716  * @pre this method can be called in one of the following stages of the SCIP solving process:
11717  * - \ref SCIP_STAGE_SOLVING
11718  */
11720  SCIP* scip, /**< SCIP data structure */
11721  SCIP_NODE* child, /**< child to update the node selection priority */
11722  SCIP_Real priority /**< node selection priority value */
11723  )
11724 {
11725  SCIP_CALL( checkStage(scip, "SCIPchgChildPrio", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) );
11726 
11727  if( SCIPnodeGetType(child) != SCIP_NODETYPE_CHILD )
11728  return SCIP_INVALIDDATA;
11729 
11730  SCIPchildChgNodeselPrio(scip->tree, child, priority);
11731 
11732  return SCIP_OKAY;
11733 }
11734 
11735 
11736 
11737 /*
11738  * solve methods
11739  */
11740 
11741 /** checks solution for feasibility in original problem without adding it to the solution store */
11742 static
11744  SCIP* scip, /**< SCIP data structure */
11745  SCIP_SOL* sol, /**< primal CIP solution */
11746  SCIP_Bool* feasible, /**< stores whether given solution is feasible */
11747  SCIP_Bool printreason, /**< should the reason for the violation be printed? */
11748  SCIP_Bool completely, /**< should all violation be checked? */
11749  SCIP_Bool checkbounds, /**< should the bounds of the variables be checked? */
11750  SCIP_Bool checkintegrality, /**< has integrality to be checked? */
11751  SCIP_Bool checklprows, /**< have current LP rows (both local and global) to be checked? */
11752  SCIP_Bool checkmodifiable /**< have modifiable constraint to be checked? */
11753  )
11754 {
11755  SCIP_RESULT result;
11756  int v;
11757  int c;
11758  int h;
11759 
11760  assert(scip != NULL);
11761  assert(sol != NULL);
11762  assert(feasible != NULL);
11763 
11764  SCIP_CALL( checkStage(scip, "checkSolOrig", FALSE, TRUE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE) );
11765 
11766  *feasible = TRUE;
11767 
11768  /* check bounds */
11769  if( checkbounds )
11770  {
11771  for( v = 0; v < scip->origprob->nvars && (*feasible || printreason); ++v )
11772  {
11773  SCIP_VAR* var;
11774  SCIP_Real solval;
11775  SCIP_Real lb;
11776  SCIP_Real ub;
11777 
11778  var = scip->origprob->vars[v];
11779  solval = SCIPsolGetVal(sol, scip->set, scip->stat, var);
11780  lb = SCIPvarGetLbOriginal(var);
11781  ub = SCIPvarGetUbOriginal(var);
11782  if( SCIPsetIsFeasLT(scip->set, solval, lb) || SCIPsetIsFeasGT(scip->set, solval, ub) )
11783  {
11784  *feasible = FALSE;
11785 
11786  if( printreason )
11787  {
11788  SCIPmessagePrintInfo(scip->messagehdlr, "solution violates original bounds of variable <%s> [%g,%g] solution value <%g>\n",
11789  SCIPvarGetName(var), lb, ub, solval);
11790  }
11791 
11792  if( !completely )
11793  return SCIP_OKAY;
11794  }
11795  }
11796  }
11797 
11798  /* check original constraints
11799  *
11800  * in general modifiable constraints can not be checked, because the variables to fulfill them might be missing in
11801  * the original problem; however, if the solution comes from a heuristic during presolving modifiable constraints
11802  * have to be checked;
11803  */
11804  for( c = 0; c < scip->origprob->nconss; ++c )
11805  {
11806  if( SCIPconsIsChecked(scip->origprob->conss[c]) && (checkmodifiable || !SCIPconsIsModifiable(scip->origprob->conss[c])) )
11807  {
11808  /* check solution */
11809  SCIP_CALL( SCIPconsCheck(scip->origprob->conss[c], scip->set, sol,
11810  checkintegrality, checklprows, printreason, &result) );
11811 
11812  if( result != SCIP_FEASIBLE )
11813  {
11814  *feasible = FALSE;
11815  if( !completely )
11816  return SCIP_OKAY;
11817  }
11818  }
11819  }
11820 
11821  /* call constraint handlers that don't need constraints */
11822  for( h = 0; h < scip->set->nconshdlrs; ++h )
11823  {
11824  if( !SCIPconshdlrNeedsCons(scip->set->conshdlrs[h]) )
11825  {
11826  SCIP_CALL( SCIPconshdlrCheck(scip->set->conshdlrs[h], scip->mem->probmem, scip->set, scip->stat, sol,
11827  checkintegrality, checklprows, printreason, &result) );
11828  if( result != SCIP_FEASIBLE )
11829  {
11830  *feasible = FALSE;
11831  if( !completely)
11832  return SCIP_OKAY;
11833  }
11834  }
11835  }
11836 
11837  return SCIP_OKAY;
11838 }
11839 
11840 /** calculates number of nonzeros in problem */
11841 static
11843  SCIP* scip, /**< SCIP data structure */
11844  SCIP_Longint* nchecknonzeros, /**< pointer to store number of non-zeros in all check constraints */
11845  SCIP_Longint* nactivenonzeros, /**< pointer to store number of non-zeros in all active constraints */
11846  SCIP_Bool* approxchecknonzeros,/**< pointer to store if the number of non-zeros in all check constraints
11847  * is only a lowerbound
11848  */
11849  SCIP_Bool* approxactivenonzeros/**< pointer to store if the number of non-zeros in all active constraints
11850  * is only a lowerbound
11851  */
11852  )
11853 {
11854  SCIP_CONS** conss;
11855  SCIP_Bool success;
11856  SCIP_Bool ischeck;
11857  int nconss;
11858  int nvars;
11859  int c;
11860  int h;
11861 
11862  *nchecknonzeros = 0LL;
11863  *nactivenonzeros = 0LL;
11864  *approxchecknonzeros = FALSE;
11865  *approxactivenonzeros = FALSE;
11866 
11867  /* computes number of non-zeros over all active constraints */
11868  for( h = scip->set->nconshdlrs - 1; h >= 0; --h )
11869  {
11870  nconss = SCIPconshdlrGetNActiveConss(scip->set->conshdlrs[h]);
11871 
11872  if( nconss > 0 )
11873  {
11874  conss = SCIPconshdlrGetConss(scip->set->conshdlrs[h]);
11875 
11876  /* calculate all active constraints */
11877  for( c = nconss - 1; c >= 0; --c )
11878  {
11879  SCIP_CALL( SCIPconsGetNVars(conss[c], scip->set, &nvars, &success) );
11880  ischeck = SCIPconsIsChecked(conss[c]);
11881 
11882  if( !success )
11883  {
11884  *approxactivenonzeros = TRUE;
11885  if( ischeck )
11886  *approxchecknonzeros = TRUE;
11887  }
11888  else
11889  {
11890  *nactivenonzeros += nvars;
11891  if( ischeck )
11892  *nchecknonzeros += nvars;
11893  }
11894  }
11895  }
11896 
11897  /* add nonzeros on inactive check constraints */
11898  nconss = SCIPconshdlrGetNCheckConss(scip->set->conshdlrs[h]);
11899  if( nconss > 0 )
11900  {
11901  conss = SCIPconshdlrGetCheckConss(scip->set->conshdlrs[h]);
11902 
11903  for( c = nconss - 1; c >= 0; --c )
11904  {
11905  if( !SCIPconsIsActive(conss[c]) )
11906  {
11907  SCIP_CALL( SCIPconsGetNVars(conss[c], scip->set, &nvars, &success) );
11908 
11909  if( !success )
11910  *approxchecknonzeros = TRUE;
11911  else
11912  *nchecknonzeros += nvars;
11913  }
11914  }
11915  }
11916  }
11917 
11918  return SCIP_OKAY;
11919 }
11920 
11921 
11922 /** initializes solving data structures and transforms problem
11923  *
11924  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
11925  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
11926  *
11927  * @pre This method can be called if @p scip is in one of the following stages:
11928  * - \ref SCIP_STAGE_PROBLEM
11929  * - \ref SCIP_STAGE_TRANSFORMED
11930  * - \ref SCIP_STAGE_INITPRESOLVE
11931  * - \ref SCIP_STAGE_PRESOLVING
11932  * - \ref SCIP_STAGE_EXITPRESOLVE
11933  * - \ref SCIP_STAGE_PRESOLVED
11934  * - \ref SCIP_STAGE_INITSOLVE
11935  * - \ref SCIP_STAGE_SOLVING
11936  * - \ref SCIP_STAGE_SOLVED
11937  * - \ref SCIP_STAGE_EXITSOLVE
11938  * - \ref SCIP_STAGE_FREETRANS
11939  * - \ref SCIP_STAGE_FREE
11940  *
11941  * @post When calling this method in the \ref SCIP_STAGE_PROBLEM stage, the \SCIP stage is changed to \ref
11942  * SCIP_STAGE_TRANSFORMED; otherwise, the stage is not changed
11943  *
11944  * See \ref SCIP_Stage "SCIP_STAGE" for a complete list of all possible solving stages.
11945  */
11947  SCIP* scip /**< SCIP data structure */
11948  )
11949 {
11950  SCIP_Longint oldnsolsfound;
11951  int nfeassols;
11952  int ncandsols;
11953  int h;
11954  int s;
11955 
11956  SCIP_CALL( checkStage(scip, "SCIPtransformProb", FALSE, TRUE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE) );
11957 
11958  /* check, if the problem was already transformed */
11959  if( scip->set->stage >= SCIP_STAGE_TRANSFORMED )
11960  return SCIP_OKAY;
11961 
11962  assert(scip->stat->status == SCIP_STATUS_UNKNOWN);
11963 
11964  /* check, if a node selector exists */
11965  if( SCIPsetGetNodesel(scip->set, scip->stat) == NULL )
11966  {
11967  SCIPerrorMessage("no node selector available\n");
11968  return SCIP_PLUGINNOTFOUND;
11969  }
11970 
11971  /* call garbage collector on original problem and parameter settings memory spaces */
11974 
11975  /* remember number of constraints */
11977 
11978  /* switch stage to TRANSFORMING */
11980 
11981  /* mark statistics before solving */
11982  SCIPstatMark(scip->stat);
11983 
11984  /* init solve data structures */
11988  SCIP_CALL( SCIPlpCreate(&scip->lp, scip->set, scip->messagehdlr, scip->stat, SCIPprobGetName(scip->origprob)) );
11990  SCIP_CALL( SCIPprimalCreate(&scip->primal) );
11991  SCIP_CALL( SCIPtreeCreate(&scip->tree, scip->set, SCIPsetGetNodesel(scip->set, scip->stat)) );
11992  SCIP_CALL( SCIPconflictCreate(&scip->conflict, scip->mem->probmem, scip->set) );
11994 
11995  /* copy problem in solve memory */
11996  SCIP_CALL( SCIPprobTransform(scip->origprob, scip->mem->probmem, scip->set, scip->stat, scip->primal, scip->tree, scip->lp,
11997  scip->branchcand, scip->eventfilter, scip->eventqueue, &scip->transprob) );
11998 
11999  /* switch stage to TRANSFORMED */
12000  scip->set->stage = SCIP_STAGE_TRANSFORMED;
12001 
12002  /* check, whether objective value is always integral by inspecting the problem, if it is the case adjust the
12003  * cutoff bound if primal solution is already known
12004  */
12005  SCIP_CALL( SCIPprobCheckObjIntegral(scip->transprob, scip->origprob, scip->mem->probmem, scip->set, scip->stat, scip->primal,
12006  scip->tree, scip->lp, scip->eventqueue) );
12007 
12008  /* if possible, scale objective function such that it becomes integral with gcd 1 */
12009  SCIP_CALL( SCIPprobScaleObj(scip->transprob, scip->origprob, scip->mem->probmem, scip->set, scip->stat, scip->primal,
12010  scip->tree, scip->lp, scip->eventqueue) );
12011 
12012  /* check solution of solution candidate storage */
12013  nfeassols = 0;
12014  ncandsols = scip->origprimal->nsols;
12015  oldnsolsfound = scip->primal->nsolsfound;
12016 
12017  for( s = scip->origprimal->nsols - 1; s >= 0; --s )
12018  {
12019  SCIP_Bool feasible;
12020  SCIP_SOL* sol ;
12021 
12022  sol = scip->origprimal->sols[s];
12023 
12024  /* SCIPprimalTrySol() can only be called on transformed solutions; therefore check solutions in original problem
12025  * including modifiable constraints
12026  */
12027  SCIP_CALL( checkSolOrig(scip, sol, &feasible,
12029  FALSE, TRUE, TRUE, TRUE, TRUE) );
12030 
12031  if( feasible )
12032  {
12033  SCIP_Real abssolobj;
12034 
12035  SCIPsolRecomputeObj(sol, scip->set, scip->stat, scip->origprob);
12036 
12037  abssolobj = REALABS(SCIPsolGetObj(sol, scip->set, scip->transprob, scip->origprob));
12038 
12039  /* we do not want to add solutions with objective value +infinity */
12040  if( !SCIPisInfinity(scip, abssolobj) )
12041  {
12042  SCIP_SOL* bestsol = SCIPgetBestSol(scip);
12043  SCIP_Bool stored;
12044 
12045  /* add primal solution to solution storage by copying it */
12046  SCIP_CALL( SCIPprimalAddSol(scip->primal, scip->mem->probmem, scip->set, scip->messagehdlr, scip->stat, scip->origprob, scip->transprob,
12047  scip->tree, scip->lp, scip->eventqueue, scip->eventfilter, sol, &stored) );
12048 
12049  if( stored )
12050  {
12051  nfeassols++;
12052 
12053  if( bestsol != SCIPgetBestSol(scip) )
12054  SCIPstoreSolutionGap(scip);
12055  }
12056  }
12057  }
12058 
12059  SCIP_CALL( SCIPsolFree(&sol, scip->mem->probmem, scip->origprimal) );
12060  scip->origprimal->nsols--;
12061  }
12062 
12063  assert(scip->origprimal->nsols == 0);
12064 
12065  scip->stat->nexternalsolsfound += scip->primal->nsolsfound - oldnsolsfound;
12066 
12067  if( nfeassols > 0 )
12068  {
12070  "%d feasible solution%s given by solution candidate storage, new primal bound %.6e\n\n",
12071  nfeassols, (nfeassols > 1 ? "s" : ""), SCIPgetSolOrigObj(scip, SCIPgetBestSol(scip)));
12072  }
12073  else if( ncandsols > 0 )
12074  {
12076  "all solutions given by solution candidate storage are infeasible\n\n");
12077  }
12078 
12079 
12080  /* update upper bound and cutoff bound due to objective limit in primal data */
12081  SCIP_CALL( SCIPprimalUpdateObjlimit(scip->primal, scip->mem->probmem, scip->set, scip->stat, scip->eventqueue,
12082  scip->transprob, scip->origprob, scip->tree, scip->lp) );
12083 
12084  /* print transformed problem statistics */
12086  "transformed problem has %d variables (%d bin, %d int, %d impl, %d cont) and %d constraints\n",
12087  scip->transprob->nvars, scip->transprob->nbinvars, scip->transprob->nintvars, scip->transprob->nimplvars,
12088  scip->transprob->ncontvars, scip->transprob->nconss);
12089 
12090  for( h = 0; h < scip->set->nconshdlrs; ++h )
12091  {
12092  int nactiveconss;
12093 
12094  nactiveconss = SCIPconshdlrGetNActiveConss(scip->set->conshdlrs[h]);
12095  if( nactiveconss > 0 )
12096  {
12098  "%7d constraints of type <%s>\n", nactiveconss, SCIPconshdlrGetName(scip->set->conshdlrs[h]));
12099  }
12100  }
12102 
12103  if( scip->set->disp_verblevel == SCIP_VERBLEVEL_FULL )
12104  {
12105  SCIP_Real maxnonzeros = ((SCIP_Real)SCIPgetNConss(scip)) * SCIPgetNVars(scip);
12106  SCIP_Longint nchecknonzeros;
12107  SCIP_Longint nactivenonzeros;
12108  SCIP_Bool approxchecknonzeros;
12109  SCIP_Bool approxactivenonzeros;
12110 
12111  /* determine number of non-zeros */
12112  SCIP_CALL( calcNonZeros(scip, &nchecknonzeros, &nactivenonzeros, &approxchecknonzeros, &approxactivenonzeros) );
12113 
12115  "original problem has %s%"SCIP_LONGINT_FORMAT" active (%g%%) nonzeros and %s%"SCIP_LONGINT_FORMAT" (%g%%) check nonzeros\n",
12116  approxactivenonzeros ? "more than " : "", nactivenonzeros, nactivenonzeros/maxnonzeros * 100,
12117  approxchecknonzeros ? "more than " : "", nchecknonzeros, nchecknonzeros/maxnonzeros * 100);
12119  }
12120 
12121  /* call initialization methods of plugins */
12122  SCIP_CALL( SCIPsetInitPlugins(scip->set, scip->mem->probmem, scip->stat) );
12123 
12124  /* in case the permutation seed is different to -1, permute the transformed problem */
12125  if( scip->set->misc_permutationseed > -1 )
12126  {
12127  SCIP_Bool permuteconss;
12128  SCIP_Bool permutevars;
12129 
12130  permuteconss = scip->set->misc_permuteconss;
12131  permutevars = scip->set->misc_permutevars;
12132 
12134  "permute problem using random seed %d\n", scip->set->misc_permutationseed);
12135 
12136  SCIP_CALL( SCIPpermuteProb(scip, (unsigned int)scip->set->misc_permutationseed, permuteconss, permutevars, permutevars, permutevars, permutevars) );
12137  }
12138 
12139  if( scip->set->misc_estimexternmem )
12140  {
12141  if ( ! SCIPisInfinity(scip, scip->set->limit_memory) )
12142  {
12143  SCIP_Longint memused = SCIPgetMemUsed(scip);
12144 
12145  /* if the memory limit is set, we take 1% as the minimum external memory storage */
12146  scip->set->mem_externestim = MAX(memused, (SCIP_Longint) (0.01 * scip->set->limit_memory * 1048576.0));
12147  }
12148  else
12149  scip->set->mem_externestim = SCIPgetMemUsed(scip);
12150  SCIPdebugMessage("external memory usage estimated to %"SCIP_LONGINT_FORMAT" byte\n", scip->set->mem_externestim);
12151  }
12152 
12154 
12155  return SCIP_OKAY;
12156 }
12157 
12158 /** initializes presolving */
12159 static
12161  SCIP* scip /**< SCIP data structure */
12162  )
12163 {
12164  assert(scip != NULL);
12165  assert(scip->mem != NULL);
12166  assert(scip->set != NULL);
12167  assert(scip->stat != NULL);
12168  assert(scip->transprob != NULL);
12169  assert(scip->set->stage == SCIP_STAGE_TRANSFORMED);
12170 
12171  /* retransform all existing solutions to original problem space, because the transformed problem space may
12172  * get modified in presolving and the solutions may become invalid for the transformed problem
12173  */
12174  SCIP_CALL( SCIPprimalRetransformSolutions(scip->primal, scip->set, scip->stat, scip->origprob, scip->transprob) );
12175 
12176  /* reset statistics for presolving and current branch and bound run */
12178 
12179  /* increase number of branch and bound runs */
12180  scip->stat->nruns++;
12181 
12182  /* remember problem size of previous run */
12183  scip->stat->prevrunnvars = scip->transprob->nvars;
12184 
12185  /* switch stage to INITPRESOLVE */
12187 
12188  /* create temporary presolving root node */
12189  SCIP_CALL( SCIPtreeCreatePresolvingRoot(scip->tree, scip->mem->probmem, scip->set, scip->messagehdlr, scip->stat,
12190  scip->transprob, scip->origprob, scip->primal, scip->lp, scip->branchcand, scip->conflict, scip->eventfilter,
12191  scip->eventqueue) );
12192 
12193  /* inform plugins that the presolving is abound to begin */
12194  SCIP_CALL( SCIPsetInitprePlugins(scip->set, scip->mem->probmem, scip->stat) );
12195  assert(SCIPbufferGetNUsed(scip->set->buffer) == 0);
12196 
12197  /* delete the variables from the problems that were marked to be deleted */
12198  SCIP_CALL( SCIPprobPerformVarDeletions(scip->transprob, scip->mem->probmem, scip->set, scip->stat, scip->eventqueue, scip->lp, scip->branchcand) );
12199 
12200  /* switch stage to PRESOLVING */
12201  scip->set->stage = SCIP_STAGE_PRESOLVING;
12202 
12203  return SCIP_OKAY;
12204 }
12205 
12206 /** deinitializes presolving */
12207 static
12209  SCIP* scip, /**< SCIP data structure */
12210  SCIP_Bool solved, /**< is problem already solved? */
12211  SCIP_Bool* infeasible /**< pointer to store if the clique clean up detects an infeasibility */
12212  )
12213 {
12214  SCIP_VAR** vars;
12215  int nvars;
12216  int v;
12217 #ifndef NDEBUG
12218  int nusedbuffers;
12219 #endif
12220 
12221  assert(scip != NULL);
12222  assert(scip->mem != NULL);
12223  assert(scip->set != NULL);
12224  assert(scip->stat != NULL);
12225  assert(scip->transprob != NULL);
12226  assert(scip->set->stage == SCIP_STAGE_PRESOLVING);
12227  assert(infeasible != NULL);
12228 
12229  /* switch stage to EXITPRESOLVE */
12231 
12232  if( !solved )
12233  {
12234  /* flatten all variables */
12235  vars = SCIPgetFixedVars(scip);
12236  nvars = SCIPgetNFixedVars(scip);
12237  assert(nvars == 0 || vars != NULL);
12238 
12239  for( v = nvars - 1; v >= 0; --v )
12240  {
12241  SCIP_VAR* var;
12242 #ifndef NDEBUG
12243  SCIP_VAR** multvars;
12244  int i;
12245 #endif
12246  var = vars[v]; /*lint !e613*/
12247  assert(var != NULL);
12248 
12250  {
12251  /* flattens aggregation graph of multi-aggregated variable in order to avoid exponential recursion later-on */
12252  SCIP_CALL( SCIPvarFlattenAggregationGraph(var, scip->mem->probmem, scip->set) );
12253 
12254 #ifndef NDEBUG
12255  multvars = SCIPvarGetMultaggrVars(var);
12256  for( i = SCIPvarGetMultaggrNVars(var) - 1; i >= 0; --i)
12257  assert(SCIPvarGetStatus(multvars[i]) != SCIP_VARSTATUS_MULTAGGR);
12258 #endif
12259  }
12260  }
12261  }
12262 
12263  /* exitPresolve() might be called during the reading process of a file reader;
12264  * hence the number of used buffers does not need to be zero, however, it should not
12265  * change by calling SCIPsetExitprePlugins() or SCIPprobExitPresolve()
12266  */
12267 #ifndef NDEBUG
12268  nusedbuffers = SCIPbufferGetNUsed(scip->set->buffer);
12269 #endif
12270 
12271  /* inform plugins that the presolving is finished, and perform final modifications */
12272  SCIP_CALL( SCIPsetExitprePlugins(scip->set, scip->mem->probmem, scip->stat) );
12273  assert(SCIPbufferGetNUsed(scip->set->buffer) == nusedbuffers);
12274 
12275  /* remove empty and single variable cliques from the clique table, and convert all two variable cliques
12276  * into implications
12277  * delete the variables from the problems that were marked to be deleted
12278  */
12279  if( !solved )
12280  {
12281  SCIP_CALL( SCIPprobPerformVarDeletions(scip->transprob, scip->mem->probmem, scip->set, scip->stat, scip->eventqueue, scip->lp, scip->branchcand) );
12282 
12283  SCIP_CALL( SCIPcliquetableCleanup(scip->cliquetable, scip->mem->probmem, scip->set, scip->stat, scip->transprob,
12284  scip->origprob, scip->tree, scip->lp, scip->branchcand, scip->eventqueue, infeasible) );
12285 
12286  if( *infeasible )
12287  {
12289  "clique table cleanup detected infeasibility\n");
12290  }
12291  }
12292 
12293  /* exit presolving */
12294  SCIP_CALL( SCIPprobExitPresolve(scip->transprob, scip->set) );
12295  assert(SCIPbufferGetNUsed(scip->set->buffer) == nusedbuffers);
12296 
12297  if( !solved )
12298  {
12299  /* check, whether objective value is always integral by inspecting the problem, if it is the case adjust the
12300  * cutoff bound if primal solution is already known
12301  */
12302  SCIP_CALL( SCIPprobCheckObjIntegral(scip->transprob, scip->origprob, scip->mem->probmem, scip->set, scip->stat, scip->primal,
12303  scip->tree, scip->lp, scip->eventqueue) );
12304 
12305  /* if possible, scale objective function such that it becomes integral with gcd 1 */
12306  SCIP_CALL( SCIPprobScaleObj(scip->transprob, scip->origprob, scip->mem->probmem, scip->set, scip->stat, scip->primal,
12307  scip->tree, scip->lp, scip->eventqueue) );
12308 
12309  scip->stat->lastlowerbound = SCIPprobInternObjval(scip->transprob, scip->origprob, scip->set, scip->transprob->dualbound);
12310 
12311  /* we need to update the primal dual integral here to update the last{upper/dual}bound values after a restart */
12312  if( scip->set->misc_calcintegral )
12313  {
12315  }
12316  }
12317 
12318  /* free temporary presolving root node */
12319  SCIP_CALL( SCIPtreeFreePresolvingRoot(scip->tree, scip->mem->probmem, scip->set, scip->messagehdlr, scip->stat,
12320  scip->transprob, scip->origprob, scip->primal, scip->lp, scip->branchcand, scip->conflict, scip->eventfilter,
12321  scip->eventqueue) );
12322 
12323  /* switch stage to PRESOLVED */
12324  scip->set->stage = SCIP_STAGE_PRESOLVED;
12325 
12326  return SCIP_OKAY;
12327 }
12328 
12329 /** applies one round of presolving */
12330 static
12332  SCIP* scip, /**< SCIP data structure */
12333  SCIP_Bool onlydelayed, /**< should only delayed presolvers be called? */
12334  SCIP_Bool* delayed, /**< pointer to store whether a presolver was delayed */
12335  SCIP_Bool* unbounded, /**< pointer to store whether presolving detected unboundedness */
12336  SCIP_Bool* infeasible /**< pointer to store whether presolving detected infeasibility */
12337  )
12338 {
12339  SCIP_RESULT result;
12340  SCIP_EVENT event;
12341  SCIP_Bool aborted;
12342  int i;
12343  int j;
12344  int priopresol;
12345  int prioprop;
12346  SCIP_Bool lastranpresol;
12347 
12348  assert(scip != NULL);
12349  assert(scip->set != NULL);
12350  assert(delayed != NULL);
12351  assert(unbounded != NULL);
12352  assert(infeasible != NULL);
12353 
12354  *delayed = FALSE;
12355  *unbounded = FALSE;
12356  *infeasible = FALSE;
12357  aborted = FALSE;
12358  lastranpresol = FALSE;
12359 
12360  SCIPdebugMessage("starting presolving round %d, onlydelayed = %u\n", scip->stat->npresolrounds, onlydelayed);
12361 
12362  /* call included presolvers with nonnegative priority */
12363  for( i = 0, j = 0; !(*unbounded) && !(*infeasible) && !aborted && (i < scip->set->npresols || j < scip->set->nprops); )
12364  {
12365  if( i < scip->set->npresols )
12366  priopresol = SCIPpresolGetPriority(scip->set->presols[i]);
12367  else
12368  priopresol = -1;
12369 
12370  if( j < scip->set->nprops )
12371  prioprop = SCIPpropGetPresolPriority(scip->set->props[j]);
12372  else
12373  prioprop = -1;
12374 
12375  /* choose presolving */
12376  if( prioprop >= priopresol )
12377  {
12378  /* only presolving methods which have non-negative priority will be called before constraint handlers */
12379  if( prioprop < 0 )
12380  break;
12381 
12382  if( onlydelayed && !SCIPpropWasPresolDelayed(scip->set->props[j]) )
12383  {
12384  ++j;
12385  continue;
12386  }
12387 
12388  SCIPdebugMessage("executing presolving of propagator <%s>\n", SCIPpropGetName(scip->set->props[j]));
12389  SCIP_CALL( SCIPpropPresol(scip->set->props[j], scip->set, onlydelayed, scip->stat->npresolrounds,
12391  &scip->stat->npresolchgbds, &scip->stat->npresoladdholes, &scip->stat->npresoldelconss,
12392  &scip->stat->npresoladdconss, &scip->stat->npresolupgdconss, &scip->stat->npresolchgcoefs,
12393  &scip->stat->npresolchgsides, &result) );
12394  assert(SCIPbufferGetNUsed(scip->set->buffer) == 0);
12395 
12396  lastranpresol = FALSE;
12397  ++j;
12398  }
12399  else
12400  {
12401  /* only presolving methods which have non-negative priority will be called before constraint handlers */
12402  if( priopresol < 0 )
12403  break;
12404 
12405  if( onlydelayed && !SCIPpresolWasDelayed(scip->set->presols[i]) )
12406  {
12407  ++i;
12408  continue;
12409  }
12410 
12411  SCIPdebugMessage("executing presolver <%s>\n", SCIPpresolGetName(scip->set->presols[i]));
12412  SCIP_CALL( SCIPpresolExec(scip->set->presols[i], scip->set, onlydelayed, scip->stat->npresolrounds,
12414  &scip->stat->npresolchgbds, &scip->stat->npresoladdholes, &scip->stat->npresoldelconss,
12415  &scip->stat->npresoladdconss, &scip->stat->npresolupgdconss, &scip->stat->npresolchgcoefs,
12416  &scip->stat->npresolchgsides, &result) );
12417  assert(SCIPbufferGetNUsed(scip->set->buffer) == 0);
12418 
12419  lastranpresol = TRUE;
12420  ++i;
12421  }
12422 
12423  if( result == SCIP_CUTOFF )
12424  {
12425  *infeasible = TRUE;
12426 
12427  if( lastranpresol )
12429  "presolver <%s> detected infeasibility\n", SCIPpresolGetName(scip->set->presols[i-1]));
12430  else
12432  "propagator <%s> detected infeasibility\n", SCIPpropGetName(scip->set->props[j-1]));
12433  }
12434  else if( result == SCIP_UNBOUNDED )
12435  {
12436  *unbounded = TRUE;
12437 
12438  if( lastranpresol )
12440  "presolver <%s> detected unboundedness (or infeasibility)\n", SCIPpresolGetName(scip->set->presols[i-1]));
12441  else
12443  "propagator <%s> detected unboundedness (or infeasibility)\n", SCIPpropGetName(scip->set->props[j-1]));
12444  }
12445  *delayed = *delayed || (result == SCIP_DELAYED);
12446 
12447  /* delete the variables from the problems that were marked to be deleted */
12448  SCIP_CALL( SCIPprobPerformVarDeletions(scip->transprob, scip->mem->probmem, scip->set, scip->stat, scip->eventqueue, scip->lp,
12449  scip->branchcand) );
12450 
12451  SCIPdebugMessage("presolving callback return with result <%d>\n", result);
12452 
12453  /* if we work off the delayed presolvers, we stop immediately if a reduction was found */
12454  if( onlydelayed && (result == SCIP_SUCCESS || (result == SCIP_DELAYED && !SCIPisPresolveFinished(scip))) )
12455  {
12456  *delayed = TRUE;
12457  aborted = TRUE;
12458  }
12459  }
12460 
12461  /* call presolve methods of constraint handlers */
12462  for( i = 0; i < scip->set->nconshdlrs && !(*unbounded) && !(*infeasible) && !aborted; ++i )
12463  {
12464  if( onlydelayed && !SCIPconshdlrWasPresolvingDelayed(scip->set->conshdlrs[i]) )
12465  continue;
12466 
12467  SCIPdebugMessage("executing presolve method of constraint handler <%s>\n",
12468  SCIPconshdlrGetName(scip->set->conshdlrs[i]));
12469  SCIP_CALL( SCIPconshdlrPresolve(scip->set->conshdlrs[i], scip->mem->probmem, scip->set, scip->stat,
12470  onlydelayed, scip->stat->npresolrounds,
12472  &scip->stat->npresolchgbds, &scip->stat->npresoladdholes, &scip->stat->npresoldelconss,
12473  &scip->stat->npresoladdconss, &scip->stat->npresolupgdconss, &scip->stat->npresolchgcoefs,
12474  &scip->stat->npresolchgsides, &result) );
12475  assert(SCIPbufferGetNUsed(scip->set->buffer) == 0);
12476  if( result == SCIP_CUTOFF )
12477  {
12478  *infeasible = TRUE;
12480  "constraint handler <%s> detected infeasibility\n", SCIPconshdlrGetName(scip->set->conshdlrs[i]));
12481  }
12482  else if( result == SCIP_UNBOUNDED )
12483  {
12484  *unbounded = TRUE;
12486  "constraint handler <%s> detected unboundedness (or infeasibility)\n",
12487  SCIPconshdlrGetName(scip->set->conshdlrs[i]));
12488  }
12489  *delayed = *delayed || (result == SCIP_DELAYED);
12490 
12491  /* delete the variables from the problems that were marked to be deleted */
12492  SCIP_CALL( SCIPprobPerformVarDeletions(scip->transprob, scip->mem->probmem, scip->set, scip->stat, scip->eventqueue, scip->lp,
12493  scip->branchcand) );
12494 
12495  SCIPdebugMessage("presolving callback return with result <%d>\n", result);
12496 
12497  /* if we work off the delayed presolvers, we stop immediately if a reduction was found */
12498  if( onlydelayed && (result == SCIP_SUCCESS || (result == SCIP_DELAYED && !SCIPisPresolveFinished(scip))) )
12499  {
12500  *delayed = TRUE;
12501  aborted = TRUE;
12502  }
12503  }
12504 
12505  /* call included presolvers with negative priority */
12506  for( i = 0, j = 0; !(*unbounded) && !(*infeasible) && !aborted && (i < scip->set->npresols || j < scip->set->nprops); )
12507  {
12508  if( i < scip->set->npresols )
12509  priopresol = SCIPpresolGetPriority(scip->set->presols[i]);
12510  else
12511  priopresol = -INT_MAX;
12512 
12513  if( j < scip->set->nprops )
12514  prioprop = SCIPpropGetPresolPriority(scip->set->props[j]);
12515  else
12516  prioprop = -INT_MAX;
12517 
12518  /* choose presolving */
12519  if( prioprop >= priopresol )
12520  {
12521  /* only presolving methods which have negative priority will be called after constraint handlers */
12522  if( prioprop >= 0 || (onlydelayed && !SCIPpropWasPresolDelayed(scip->set->props[j])) )
12523  {
12524  ++j;
12525  continue;
12526  }
12527 
12528  SCIPdebugMessage("executing presolving of propagator <%s>\n", SCIPpropGetName(scip->set->props[j]));
12529  SCIP_CALL( SCIPpropPresol(scip->set->props[j], scip->set, onlydelayed, scip->stat->npresolrounds,
12531  &scip->stat->npresolchgbds, &scip->stat->npresoladdholes, &scip->stat->npresoldelconss,
12532  &scip->stat->npresoladdconss, &scip->stat->npresolupgdconss, &scip->stat->npresolchgcoefs,
12533  &scip->stat->npresolchgsides, &result) );
12534  assert(SCIPbufferGetNUsed(scip->set->buffer) == 0);
12535 
12536  lastranpresol = FALSE;
12537  ++j;
12538  }
12539  else
12540  {
12541  /* only presolving methods which have negative priority will be called after constraint handlers */
12542  if( priopresol >= 0 || (onlydelayed && !SCIPpresolWasDelayed(scip->set->presols[i])) )
12543  {
12544  ++i;
12545  continue;
12546  }
12547 
12548  SCIPdebugMessage("executing presolver <%s>\n", SCIPpresolGetName(scip->set->presols[i]));
12549  SCIP_CALL( SCIPpresolExec(scip->set->presols[i], scip->set, onlydelayed, scip->stat->npresolrounds,
12551  &scip->stat->npresolchgbds, &scip->stat->npresoladdholes, &scip->stat->npresoldelconss,
12552  &scip->stat->npresoladdconss, &scip->stat->npresolupgdconss, &scip->stat->npresolchgcoefs,
12553  &scip->stat->npresolchgsides, &result) );
12554  assert(SCIPbufferGetNUsed(scip->set->buffer) == 0);
12555 
12556  lastranpresol = TRUE;
12557  ++i;
12558  }
12559 
12560  if( result == SCIP_CUTOFF )
12561  {
12562  *infeasible = TRUE;
12563 
12564  if( lastranpresol )
12566  "presolver <%s> detected infeasibility\n", SCIPpresolGetName(scip->set->presols[i-1]));
12567  else
12569  "propagator <%s> detected infeasibility\n", SCIPpropGetName(scip->set->props[j-1]));
12570  }
12571  else if( result == SCIP_UNBOUNDED )
12572  {
12573  *unbounded = TRUE;
12574 
12575  if( lastranpresol )
12577  "presolver <%s> detected unboundedness (or infeasibility)\n", SCIPpresolGetName(scip->set->presols[i-1]));
12578  else
12580  "propagator <%s> detected unboundedness (or infeasibility)\n", SCIPpropGetName(scip->set->props[j-1]));
12581  }
12582  *delayed = *delayed || (result == SCIP_DELAYED);
12583 
12584  /* delete the variables from the problems that were marked to be deleted */
12585  SCIP_CALL( SCIPprobPerformVarDeletions(scip->transprob, scip->mem->probmem, scip->set, scip->stat, scip->eventqueue, scip->lp,
12586  scip->branchcand) );
12587 
12588  SCIPdebugMessage("presolving callback return with result <%d>\n", result);
12589 
12590  /* if we work off the delayed presolvers, we stop immediately if a reduction was found */
12591  if( onlydelayed && (result == SCIP_SUCCESS || (result == SCIP_DELAYED && !SCIPisPresolveFinished(scip))) )
12592  {
12593  *delayed = TRUE;
12594  aborted = TRUE;
12595  }
12596  }
12597 
12598  /* remove empty and single variable cliques from the clique table, and convert all two variable cliques
12599  * into implications
12600  */
12601  if( !(*unbounded) && !(*infeasible) )
12602  {
12603  SCIP_Bool infeas;
12604 
12605  SCIP_CALL( SCIPcliquetableCleanup(scip->cliquetable, scip->mem->probmem, scip->set, scip->stat, scip->transprob,
12606  scip->origprob, scip->tree, scip->lp, scip->branchcand, scip->eventqueue, &infeas) );
12607  if( infeas )
12608  {
12609  *infeasible = TRUE;
12611  "clique table cleanup detected infeasibility\n");
12612  }
12613  else if( scip->set->nheurs > 0 )
12614  {
12615  /* call primal heuristics that are applicable during presolving */
12616  SCIP_Bool foundsol;
12617 
12618  SCIPdebugMessage("calling primal heuristics during presolving\n");
12619 
12620  /* call primal heuristics */
12621  SCIP_CALL( SCIPprimalHeuristics(scip->set, scip->stat, scip->transprob, scip->primal, NULL, NULL, NULL,
12622  SCIP_HEURTIMING_DURINGPRESOLLOOP, FALSE, &foundsol) );
12623 
12624  /* output a message, if a solution was found */
12625  if( foundsol )
12626  {
12627  SCIP_SOL* sol;
12628 
12629  assert(SCIPgetNSols(scip) > 0);
12630  sol = SCIPgetBestSol(scip);
12631  assert(sol != NULL);
12632  assert(SCIPgetSolOrigObj(scip,sol) != SCIP_INVALID); /*lint !e777*/
12633 
12635  "feasible solution found by %s heuristic after %.1f seconds, objective value %.6e\n",
12637  }
12638  }
12639  }
12640 
12641  /* issue PRESOLVEROUND event */
12643  SCIP_CALL( SCIPeventProcess(&event, scip->set, NULL, NULL, NULL, scip->eventfilter) );
12644 
12645  return SCIP_OKAY;
12646 }
12647 
12648 
12649 /** loops through the included presolvers and constraint's presolve methods, until changes are too few */
12650 static
12652  SCIP* scip, /**< SCIP data structure */
12653  SCIP_Bool* unbounded, /**< pointer to store whether presolving detected unboundedness */
12654  SCIP_Bool* infeasible /**< pointer to store whether presolving detected infeasibility */
12655  )
12656 {
12657  SCIP_Bool delayed;
12658  SCIP_Bool finished;
12659  SCIP_Bool stopped;
12660 
12661  assert(scip != NULL);
12662  assert(scip->mem != NULL);
12663  assert(scip->primal != NULL);
12664  assert(scip->set != NULL);
12665  assert(scip->stat != NULL);
12666  assert(scip->transprob != NULL);
12667  assert(scip->set->stage == SCIP_STAGE_TRANSFORMED || scip->set->stage == SCIP_STAGE_PRESOLVING);
12668  assert(unbounded != NULL);
12669  assert(infeasible != NULL);
12670 
12671  /* switch status to unknown */
12672  scip->stat->status = SCIP_STATUS_UNKNOWN;
12673 
12674  /* update upper bound and cutoff bound due to objective limit in primal data */
12675  SCIP_CALL( SCIPprimalUpdateObjlimit(scip->primal, scip->mem->probmem, scip->set, scip->stat, scip->eventqueue,
12676  scip->transprob, scip->origprob, scip->tree, scip->lp) );
12677 
12678  /* start presolving timer */
12679  SCIPclockStart(scip->stat->presolvingtime, scip->set);
12680 
12681  /* initialize presolving */
12682  if( scip->set->stage == SCIP_STAGE_TRANSFORMED )
12683  {
12684  SCIP_CALL( initPresolve(scip) );
12685  }
12686  assert(scip->set->stage == SCIP_STAGE_PRESOLVING);
12687 
12688  /* call primal heuristics that are applicable before presolving */
12689  if( scip->set->nheurs > 0 )
12690  {
12691  SCIP_Bool foundsol;
12692 
12693  SCIPdebugMessage("calling primal heuristics before presolving\n");
12694 
12695  /* call primal heuristics */
12696  SCIP_CALL( SCIPprimalHeuristics(scip->set, scip->stat, scip->transprob, scip->primal, NULL, NULL, NULL,
12697  SCIP_HEURTIMING_BEFOREPRESOL, FALSE, &foundsol) );
12698 
12699  /* output a message, if a solution was found */
12700  if( foundsol )
12701  {
12702  SCIP_SOL* sol;
12703 
12704  assert(SCIPgetNSols(scip) > 0);
12705  sol = SCIPgetBestSol(scip);
12706  assert(sol != NULL);
12707  assert(SCIPgetSolOrigObj(scip,sol) != SCIP_INVALID); /*lint !e777*/
12708 
12710  "feasible solution found by %s heuristic after %.1f seconds, objective value %.6e\n",
12712  }
12713  }
12714 
12716 
12717  *infeasible = FALSE;
12718  *unbounded = SCIPgetNSols(scip) > 0 && SCIPisInfinity(scip, -SCIPgetSolOrigObj(scip, SCIPgetBestSol(scip)));
12719 
12720  finished = (scip->set->presol_maxrounds != -1 && scip->stat->npresolrounds >= scip->set->presol_maxrounds) || (*unbounded);
12721  stopped = SCIPsolveIsStopped(scip->set, scip->stat, TRUE);
12722 
12723  /* perform presolving rounds */
12724  while( !finished && !stopped )
12725  {
12726  /* store current number of reductions */
12728  scip->stat->lastnpresolaggrvars = scip->stat->npresolaggrvars;
12730  scip->stat->lastnpresolchgbds = scip->stat->npresolchgbds;
12731  scip->stat->lastnpresoladdholes = scip->stat->npresoladdholes;
12732  scip->stat->lastnpresoldelconss = scip->stat->npresoldelconss;
12733  scip->stat->lastnpresoladdconss = scip->stat->npresoladdconss;
12735  scip->stat->lastnpresolchgcoefs = scip->stat->npresolchgcoefs;
12736  scip->stat->lastnpresolchgsides = scip->stat->npresolchgsides;
12737 
12738  /* set presolving flag */
12739  scip->stat->performpresol = TRUE;
12740 
12741  /* sort propagators */
12742  SCIPsetSortPropsPresol(scip->set);
12743 
12744  /* sort presolvers by priority */
12745  SCIPsetSortPresols(scip->set);
12746 
12747  /* perform the presolving round by calling the presolvers and constraint handlers */
12748  assert(!(*unbounded));
12749  assert(!(*infeasible));
12750  SCIP_CALL( presolveRound(scip, FALSE, &delayed, unbounded, infeasible) );
12751 
12752  /* check, if we should abort presolving due to not enough changes in the last round */
12753  finished = SCIPisPresolveFinished(scip);
12754 
12755  SCIPdebugMessage("presolving round %d return with delayed = %u, unbounded = %u, infeasible = %u, finished = %u\n", scip->stat->npresolrounds, delayed, *unbounded, *infeasible, finished);
12756 
12757  /* check whether problem is infeasible or unbounded */
12758  finished = finished || *unbounded || *infeasible;
12759 
12760  /* if the presolving will be terminated, call the delayed presolvers */
12761  while( delayed && finished && !(*unbounded) && !(*infeasible) )
12762  {
12763  /* call the delayed presolvers and constraint handlers */
12764  SCIP_CALL( presolveRound(scip, TRUE, &delayed, unbounded, infeasible) );
12765 
12766  /* check again, if we should abort presolving due to not enough changes in the last round */
12767  finished = SCIPisPresolveFinished(scip);
12768 
12769  SCIPdebugMessage("presolving round %d (onlydelayed) return with delayed = %u, unbounded = %u, infeasible = %u, finished = %u\n", scip->stat->npresolrounds, delayed, *unbounded, *infeasible, finished);
12770 
12771  /* check whether problem is infeasible or unbounded */
12772  finished = finished || *unbounded || *infeasible;
12773  }
12774 
12775  /* increase round number */
12776  scip->stat->npresolrounds++;
12777 
12778  if( !finished )
12779  {
12780  /* print presolving statistics */
12782  "(round %d) %d del vars, %d del conss, %d add conss, %d chg bounds, %d chg sides, %d chg coeffs, %d upgd conss, %d impls, %d clqs\n",
12783  scip->stat->npresolrounds, scip->stat->npresolfixedvars + scip->stat->npresolaggrvars,
12784  scip->stat->npresoldelconss, scip->stat->npresoladdconss,
12785  scip->stat->npresolchgbds, scip->stat->npresolchgsides,
12786  scip->stat->npresolchgcoefs, scip->stat->npresolupgdconss,
12788  }
12789 
12790  /* abort if time limit was reached or user interrupted */
12791  stopped = SCIPsolveIsStopped(scip->set, scip->stat, TRUE);
12792  }
12793 
12794  if( *infeasible || *unbounded )
12795  {
12796  /* first change status of scip, so that all plugins in their exitpre callbacks can ask SCIP for the correct status */
12797  if( *infeasible )
12798  {
12799  /* switch status to OPTIMAL */
12800  if( scip->primal->nsols > 0
12801  && SCIPsetIsLT(scip->set, SCIPsolGetObj(scip->primal->sols[0], scip->set, scip->transprob, scip->origprob),
12802  SCIPprobInternObjval(scip->transprob, scip->origprob, scip->set, SCIPprobGetObjlim(scip->transprob, scip->set))) )
12803  scip->stat->status = SCIP_STATUS_OPTIMAL;
12804  else /* switch status to INFEASIBLE */
12806  }
12807  else if( scip->primal->nsols >= 1 ) /* switch status to UNBOUNDED */
12809  else /* switch status to INFORUNBD */
12811  }
12812 
12813  /* deinitialize presolving */
12814  if( finished && (!stopped || *unbounded || *infeasible) )
12815  {
12816  SCIP_CALL( exitPresolve(scip, *unbounded || *infeasible, infeasible) );
12817  assert(scip->set->stage == SCIP_STAGE_PRESOLVED);
12818 
12819  /* resorted variables if we are not already done */
12820  if( !(*infeasible) && !(*unbounded) )
12821  {
12822  /* (Re)Sort the variables, which appear in the four categories (binary, integer, implicit, continuous) after
12823  * presolve with respect to their original index (within their categories). Adjust the problem index afterwards
12824  * which is supposed to reflect the position in the variable array. This additional (re)sorting is supposed to
12825  * get more robust against the order presolving fixed variables. (We also reobtain a possible block structure
12826  * induced by the user model)
12827  */
12829  }
12830 
12831  if( scip->set->disp_verblevel == SCIP_VERBLEVEL_FULL )
12832  {
12833  SCIP_Real maxnonzeros = ((SCIP_Real)SCIPgetNConss(scip)) * SCIPgetNVars(scip);
12834  SCIP_Longint nchecknonzeros;
12835  SCIP_Longint nactivenonzeros;
12836  SCIP_Bool approxchecknonzeros;
12837  SCIP_Bool approxactivenonzeros;
12838 
12839  /* determine number of non-zeros */
12840  SCIP_CALL( calcNonZeros(scip, &nchecknonzeros, &nactivenonzeros, &approxchecknonzeros, &approxactivenonzeros) );
12841 
12844  "presolved problem has %s%"SCIP_LONGINT_FORMAT" active (%g%%) nonzeros and %s%"SCIP_LONGINT_FORMAT" (%g%%) check nonzeros\n",
12845  approxactivenonzeros ? "more than " : "", nactivenonzeros, nactivenonzeros/maxnonzeros * 100,
12846  approxchecknonzeros ? "more than " : "", nchecknonzeros, nchecknonzeros/maxnonzeros * 100);
12848  }
12849  }
12850  assert(SCIPbufferGetNUsed(scip->set->buffer) == 0);
12851 
12852  /* stop presolving time */
12853  SCIPclockStop(scip->stat->presolvingtime, scip->set);
12854 
12855  /* print presolving statistics */
12857  "presolving (%d rounds):\n", scip->stat->npresolrounds);
12859  " %d deleted vars, %d deleted constraints, %d added constraints, %d tightened bounds, %d added holes, %d changed sides, %d changed coefficients\n",
12863  " %d implications, %d cliques\n", scip->stat->nimplications, SCIPcliquetableGetNCliques(scip->cliquetable));
12864 
12865  /* remember number of constraints */
12867 
12868  return SCIP_OKAY;
12869 }
12870 
12871 /** tries to transform original solutions to the transformed problem space */
12872 static
12874  SCIP* scip /**< SCIP data structure */
12875  )
12876 {
12877  SCIP_SOL** sols;
12878  SCIP_SOL* sol;
12879  SCIP_Real* solvals;
12880  SCIP_Bool* solvalset;
12881  SCIP_Bool added;
12882  SCIP_Longint oldnsolsfound;
12883  int nsols;
12884  int ntransvars;
12885  int naddedsols;
12886  int s;
12887 
12888  nsols = SCIPgetNSols(scip);
12889  oldnsolsfound = scip->primal->nsolsfound;
12890 
12891  /* no solution to transform */
12892  if( nsols == 0 )
12893  return SCIP_OKAY;
12894 
12895  SCIPdebugMessage("try to transfer %d original solutions into the transformed problem space\n", nsols);
12896 
12897  ntransvars = scip->transprob->nvars;
12898  naddedsols = 0;
12899 
12900  /* It might happen, that the added transferred solution does not equal the corresponding original one, which might
12901  * result in the array of solutions being changed. Thus we temporarily copy the array and traverse it in reverse
12902  * order to ensure that the regarded solution in the copied array was not already freed when new solutions were added
12903  * and the worst solutions were freed.
12904  */
12905  SCIP_CALL( SCIPduplicateBufferArray(scip, &sols, SCIPgetSols(scip), nsols) );
12906  SCIP_CALL( SCIPallocBufferArray(scip, &solvals, ntransvars) );
12907  SCIP_CALL( SCIPallocBufferArray(scip, &solvalset, ntransvars) );
12908 
12909  for( s = nsols - 1; s >= 0; --s )
12910  {
12911  sol = sols[s];
12912 
12913  /* it might happen that a transferred original solution has a better objective than its original counterpart
12914  * (e.g., because multi-aggregated variables get another value, but the solution is still feasible);
12915  * in this case, it might happen that the solution is not an original one and we just skip this solution
12916  */
12917  if( !SCIPsolIsOriginal(sol) )
12918  continue;
12919 
12920  SCIP_CALL( SCIPprimalTransformSol(scip->primal, sol, scip->mem->probmem, scip->set, scip->messagehdlr, scip->stat,
12921  scip->origprob, scip->transprob, scip->tree, scip->lp, scip->eventqueue, scip->eventfilter, solvals,
12922  solvalset, ntransvars, &added) );
12923 
12924  if( added )
12925  ++naddedsols;
12926  }
12927 
12928  if( naddedsols > 0 )
12929  {
12931  "transformed %d/%d original solutions to the transformed problem space\n",
12932  naddedsols, nsols);
12933 
12934  scip->stat->nexternalsolsfound += scip->primal->nsolsfound - oldnsolsfound;
12935  }
12936 
12937  SCIPfreeBufferArray(scip, &solvals);
12938  SCIPfreeBufferArray(scip, &solvalset);
12939  SCIPfreeBufferArray(scip, &sols);
12940 
12941  return SCIP_OKAY;
12942 }
12943 
12944 /** initializes solution process data structures */
12945 static
12947  SCIP* scip, /**< SCIP data structure */
12948  SCIP_Bool solved /**< is problem already solved? */
12949  )
12950 {
12951  assert(scip != NULL);
12952  assert(scip->mem != NULL);
12953  assert(scip->set != NULL);
12954  assert(scip->stat != NULL);
12955  assert(scip->nlp == NULL);
12956  assert(scip->set->stage == SCIP_STAGE_PRESOLVED);
12957 
12958  /**@todo check whether other methodscan be skipped if problem has been solved */
12959  /* if problem has been solved, several time consuming tasks must not be performed */
12960  if( !solved )
12961  {
12962  /* reset statistics for current branch and bound run */
12965 
12966  /* LP is empty anyway; mark empty LP to be solved and update validsollp counter */
12967  SCIP_CALL( SCIPlpReset(scip->lp, scip->mem->probmem, scip->set, scip->stat, scip->eventqueue, scip->eventfilter) );
12968 
12969  /* update upper bound and cutoff bound due to objective limit in primal data */
12970  SCIP_CALL( SCIPprimalUpdateObjlimit(scip->primal, scip->mem->probmem, scip->set, scip->stat, scip->eventqueue,
12971  scip->transprob, scip->origprob, scip->tree, scip->lp) );
12972  }
12973 
12974  /* switch stage to INITSOLVE */
12975  scip->set->stage = SCIP_STAGE_INITSOLVE;
12976 
12977  /* initialize NLP if there are nonlinearities */
12978  if( scip->set->nlpenabled && !scip->set->nlp_disable )
12979  {
12980  SCIPdebugMessage("constructing empty NLP\n");
12981 
12982  SCIP_CALL( SCIPnlpCreate(&scip->nlp, scip->mem->probmem, scip->set, scip->stat, SCIPprobGetName(scip->transprob), scip->transprob->nvars) );
12983  assert(scip->nlp != NULL);
12984 
12985  SCIP_CALL( SCIPnlpAddVars(scip->nlp, scip->mem->probmem, scip->set, scip->transprob->nvars, scip->transprob->vars) );
12986  }
12987 
12988  /* create VBC output file */
12989  SCIP_CALL( SCIPvbcInit(scip->stat->vbc, scip->mem->probmem, scip->set, scip->messagehdlr) );
12990 
12991  /* initialize solution process data structures */
12994  SCIP_CALL( SCIPcutpoolCreate(&scip->cutpool, scip->mem->probmem, scip->set, scip->set->sepa_cutagelimit, TRUE) );
12995  SCIP_CALL( SCIPcutpoolCreate(&scip->delayedcutpool, scip->mem->probmem, scip->set, scip->set->sepa_cutagelimit, FALSE) );
12996  SCIP_CALL( SCIPtreeCreateRoot(scip->tree, scip->mem->probmem, scip->set, scip->stat, scip->eventqueue, scip->lp) );
12997 
12998  /* update dual bound of the root node if a valid dual bound is at hand */
12999  if( scip->transprob->dualbound < SCIP_INVALID )
13000  {
13001  SCIP_Real internobjval = SCIPprobInternObjval(scip->transprob, scip->origprob, scip->set, scip->transprob->dualbound);
13002 
13003  scip->stat->lastlowerbound = internobjval;
13004 
13005  SCIPnodeUpdateLowerbound(SCIPtreeGetRootNode(scip->tree), scip->stat, scip->set, scip->tree, scip->transprob,
13006  scip->origprob, internobjval);
13007  }
13008 
13009  /* try to transform original solutions to the transformed problem space */
13010  if( scip->set->misc_transorigsols )
13011  {
13012  SCIP_CALL( transformSols(scip) );
13013  }
13014 
13015  /* inform the transformed problem that the branch and bound process starts now */
13016  SCIP_CALL( SCIPprobInitSolve(scip->transprob, scip->set) );
13017 
13018  /* inform plugins that the branch and bound process starts now */
13019  SCIP_CALL( SCIPsetInitsolPlugins(scip->set, scip->mem->probmem, scip->stat) );
13020 
13021  /* remember number of constraints */
13023 
13024  /* if all variables are known, calculate a trivial primal bound by setting all variables to their worst bound */
13025  if( scip->set->nactivepricers == 0 )
13026  {
13027  SCIP_VAR* var;
13028  SCIP_Real obj;
13029  SCIP_Real objbound;
13030  SCIP_Real bd;
13031  int v;
13032 
13033  objbound = 0.0;
13034  for( v = 0; v < scip->transprob->nvars && !SCIPsetIsInfinity(scip->set, objbound); ++v )
13035  {
13036  var = scip->transprob->vars[v];
13037  obj = SCIPvarGetObj(var);
13038  if( !SCIPsetIsZero(scip->set, obj) )
13039  {
13040  bd = SCIPvarGetWorstBoundGlobal(var);
13041  if( SCIPsetIsInfinity(scip->set, REALABS(bd)) )
13042  objbound = SCIPsetInfinity(scip->set);
13043  else
13044  objbound += obj * bd;
13045  }
13046  }
13047 
13048  /* adjust primal bound, such that solution with worst bound may be found */
13049  objbound += SCIPsetCutoffbounddelta(scip->set);
13050 
13051  /* update cutoff bound */
13052  if( !SCIPsetIsInfinity(scip->set, objbound) && SCIPsetIsLT(scip->set, objbound, scip->primal->cutoffbound) )
13053  {
13054  /* adjust cutoff bound */
13055  SCIP_CALL( SCIPprimalSetCutoffbound(scip->primal, scip->mem->probmem, scip->set, scip->stat, scip->eventqueue,
13056  scip->transprob, scip->origprob, scip->tree, scip->lp, objbound, FALSE) );
13057  }
13058  }
13059 
13060  /* switch stage to SOLVING */
13061  scip->set->stage = SCIP_STAGE_SOLVING;
13062 
13063  return SCIP_OKAY;
13064 }
13065 
13066 /** frees solution process data structures */
13067 static
13069  SCIP* scip, /**< SCIP data structure */
13070  SCIP_Bool restart /**< was this free solve call triggered by a restart? */
13071  )
13072 {
13073  assert(scip != NULL);
13074  assert(scip->mem != NULL);
13075  assert(scip->set != NULL);
13076  assert(scip->stat != NULL);
13077  assert(scip->set->stage == SCIP_STAGE_SOLVING || scip->set->stage == SCIP_STAGE_SOLVED);
13078 
13079  /* mark that we are currently restarting */
13080  if( restart )
13081  {
13082  scip->stat->inrestart = TRUE;
13083 
13084  /* copy the current dual bound into the problem data structure such that it can be used initialize the new search
13085  * tree
13086  */
13088  }
13089 
13090  /* remove focus from the current focus node */
13091  if( SCIPtreeGetFocusNode(scip->tree) != NULL )
13092  {
13093  SCIP_NODE* node = NULL;
13094  SCIP_Bool cutoff;
13095 
13096  SCIP_CALL( SCIPnodeFocus(&node, scip->mem->probmem, scip->set, scip->messagehdlr, scip->stat, scip->transprob,
13097  scip->origprob, scip->primal, scip->tree, scip->lp, scip->branchcand, scip->conflict, scip->eventfilter,
13098  scip->eventqueue, &cutoff, TRUE) );
13099  assert(!cutoff);
13100  }
13101 
13102  /* switch stage to EXITSOLVE */
13103  scip->set->stage = SCIP_STAGE_EXITSOLVE;
13104 
13105  /* inform plugins that the branch and bound process is finished */
13106  SCIP_CALL( SCIPsetExitsolPlugins(scip->set, scip->mem->probmem, scip->stat, restart) );
13107 
13108  /* free the NLP, if there is one, and reset the flags indicating nonlinearity */
13109  if( scip->nlp != NULL )
13110  {
13111  SCIP_CALL( SCIPnlpFree(&scip->nlp, scip->mem->probmem, scip->set, scip->eventqueue, scip->lp) );
13112  }
13113  scip->set->nlpenabled = FALSE;
13114 
13115  /* clear the LP, and flush the changes to clear the LP of the solver */
13116  SCIP_CALL( SCIPlpReset(scip->lp, scip->mem->probmem, scip->set, scip->stat, scip->eventqueue, scip->eventfilter) );
13118 
13119  /* clear all row references in internal data structures */
13120  SCIP_CALL( SCIPcutpoolClear(scip->cutpool, scip->mem->probmem, scip->set, scip->lp) );
13121  SCIP_CALL( SCIPcutpoolClear(scip->delayedcutpool, scip->mem->probmem, scip->set, scip->lp) );
13122 
13123  /* we have to clear the tree prior to the problem deinitialization, because the rows stored in the forks and
13124  * subroots have to be released
13125  */
13126  SCIP_CALL( SCIPtreeClear(scip->tree, scip->mem->probmem, scip->set, scip->stat, scip->eventqueue, scip->lp) );
13127 
13128  /* deinitialize transformed problem */
13129  SCIP_CALL( SCIPprobExitSolve(scip->transprob, scip->mem->probmem, scip->set, scip->eventqueue, scip->lp, restart) );
13130 
13131  /* free solution process data structures */
13132  SCIP_CALL( SCIPcutpoolFree(&scip->cutpool, scip->mem->probmem, scip->set, scip->lp) );
13133  SCIP_CALL( SCIPcutpoolFree(&scip->delayedcutpool, scip->mem->probmem, scip->set, scip->lp) );
13136 
13137  /* close VBC output file */
13138  SCIPvbcExit(scip->stat->vbc, scip->set, scip->messagehdlr);
13139 
13140  /* reset statistics for current branch and bound run */
13142 
13143  /* switch stage to TRANSFORMED */
13144  scip->set->stage = SCIP_STAGE_TRANSFORMED;
13145 
13146  /* restart finished */
13147  assert( ! restart || scip->stat->inrestart );
13148  scip->stat->inrestart = FALSE;
13149 
13150  return SCIP_OKAY;
13151 }
13152 
13153 /** free transformed problem */
13154 static
13156  SCIP* scip /**< SCIP data structure */
13157  )
13158 {
13159  assert(scip != NULL);
13160  assert(scip->mem != NULL);
13161  assert(scip->stat != NULL);
13162  assert(scip->set->stage == SCIP_STAGE_TRANSFORMED || scip->set->stage == SCIP_STAGE_PRESOLVING);
13163 
13164  /* free all debug data */
13165  SCIP_CALL( SCIPdebugFreeDebugData(scip->set) ); /*lint !e506 !e774*/
13166 
13167  /* call exit methods of plugins */
13168  SCIP_CALL( SCIPsetExitPlugins(scip->set, scip->mem->probmem, scip->stat) );
13169 
13170  /* copy best primal solutions to original solution candidate list */
13171  if( scip->set->limit_maxorigsol > 0 )
13172  {
13173  SCIP_Bool stored;
13174  SCIP_Bool hasinfval;
13175  int maxsols;
13176  int nsols;
13177  int s;
13178 
13179  assert(scip->origprimal->nsols == 0);
13180 
13181  nsols = scip->primal->nsols;
13182  maxsols = scip->set->limit_maxorigsol;
13183  stored = TRUE;
13184  s = 0;
13185 
13186  /* iterate over all solutions as long as the original solution candidate store size limit is not reached */
13187  while( s < nsols && scip->origprimal->nsols < maxsols )
13188  {
13189  SCIP_SOL* sol;
13190 
13191  sol = scip->primal->sols[s];
13192  assert(sol != NULL);
13193 
13194  if( !SCIPsolIsOriginal(sol) )
13195  {
13196  /* retransform solution into the original problem space */
13197  SCIP_CALL( SCIPsolRetransform(sol, scip->set, scip->stat, scip->origprob, scip->transprob, &hasinfval) );
13198  }
13199  else
13200  hasinfval = FALSE;
13201 
13202  /* removing infinite fixings is turned off by the corresponding parameter */
13203  if( !scip->set->misc_finitesolstore )
13204  hasinfval = FALSE;
13205 
13206  if( !hasinfval )
13207  {
13208  /* add solution to original candidate solution storage */
13209  SCIP_CALL( SCIPprimalAddOrigSol(scip->origprimal, scip->mem->probmem, scip->set, scip->stat, scip->origprob, sol, &stored) );
13210  }
13211  else
13212  {
13213  SCIP_SOL* newsol;
13214  SCIP_Bool success;
13215 
13216  SCIP_CALL( SCIPcreateFiniteSolCopy(scip, &newsol, sol, &success) );
13217 
13218  /* infinite fixing could be removed */
13219  if( newsol != NULL )
13220  {
13221  /* add solution to original candidate solution storage; we must not use SCIPprimalAddOrigSolFree()
13222  * because we want to create a copy of the solution in the origprimal solution store, but newsol was
13223  * created in the (transformed) primal
13224  */
13225  SCIP_CALL( SCIPprimalAddOrigSol(scip->origprimal, scip->mem->probmem, scip->set, scip->stat, scip->origprob, newsol, &stored) );
13226 
13227  /* free solution in (transformed) primal where it was created */
13228  SCIP_CALL( SCIPsolFree(&newsol, scip->mem->probmem, scip->primal) );
13229  }
13230  }
13231  ++s;
13232  }
13233 
13234  if( scip->origprimal->nsols > 1 )
13235  {
13237  "stored the %d best primal solutions in the original solution cadidate list\n", scip->origprimal->nsols);
13238  }
13239  else if( scip->origprimal->nsols == 1 )
13240  {
13242  "stored the best primal solution in the original solution cadidate list\n");
13243  }
13244  }
13245 
13246  /* switch stage to FREETRANS */
13247  scip->set->stage = SCIP_STAGE_FREETRANS;
13248 
13249  /* free transformed problem data structures */
13250  SCIP_CALL( SCIPprobFree(&scip->transprob, scip->mem->probmem, scip->set, scip->stat, scip->eventqueue, scip->lp) );
13252  SCIP_CALL( SCIPconflictFree(&scip->conflict, scip->mem->probmem) );
13253  SCIP_CALL( SCIPtreeFree(&scip->tree, scip->mem->probmem, scip->set, scip->stat, scip->eventqueue, scip->lp) );
13254  SCIP_CALL( SCIPprimalFree(&scip->primal, scip->mem->probmem) );
13256  SCIP_CALL( SCIPlpFree(&scip->lp, scip->mem->probmem, scip->set, scip->eventqueue, scip->eventfilter) );
13258  SCIP_CALL( SCIPeventfilterFree(&scip->eventfilter, scip->mem->probmem, scip->set) );
13260 
13261  if( scip->set->misc_resetstat )
13262  {
13263  /* reset statistics to the point before the problem was transformed */
13264  SCIPstatReset(scip->stat, scip->set);
13265  }
13266  else
13267  {
13268  /* even if statistics are not completely reset, a partial reset of the primal-dual intgeral is necessary */
13270  }
13271 
13272  /* switch stage to PROBLEM */
13273  scip->set->stage = SCIP_STAGE_PROBLEM;
13274 
13275  /* reset original variable's local and global bounds to their original values */
13276  SCIP_CALL( SCIPprobResetBounds(scip->origprob, scip->mem->probmem, scip->set, scip->stat) );
13277 
13278  return SCIP_OKAY;
13279 }
13280 
13281 /** displays most relevant statistics after problem was solved */
13282 static
13284  SCIP* scip /**< SCIP data structure */
13285  )
13286 {
13287  assert(scip != NULL);
13288 
13289  /* display most relevant statistics */
13290  if( scip->set->disp_verblevel >= SCIP_VERBLEVEL_NORMAL )
13291  {
13292  SCIP_Bool objlimitreached = FALSE;
13293 
13294  if( scip->primal->nlimsolsfound == 0 && !SCIPisInfinity(scip, getPrimalbound(scip)) )
13295  objlimitreached = TRUE;
13296 
13297  SCIPmessagePrintInfo(scip->messagehdlr, "\n");
13298  SCIPmessagePrintInfo(scip->messagehdlr, "SCIP Status : ");
13299  SCIP_CALL( SCIPprintStage(scip, NULL) );
13300  SCIPmessagePrintInfo(scip->messagehdlr, "\n");
13301  SCIPmessagePrintInfo(scip->messagehdlr, "Solving Time (sec) : %.2f\n", SCIPclockGetTime(scip->stat->solvingtime));
13302  if( scip->stat->nruns > 1 )
13303  SCIPmessagePrintInfo(scip->messagehdlr, "Solving Nodes : %"SCIP_LONGINT_FORMAT" (total of %"SCIP_LONGINT_FORMAT" nodes in %d runs)\n",
13304  scip->stat->nnodes, scip->stat->ntotalnodes, scip->stat->nruns);
13305  else
13306  SCIPmessagePrintInfo(scip->messagehdlr, "Solving Nodes : %"SCIP_LONGINT_FORMAT"\n", scip->stat->nnodes);
13307  if( scip->set->stage >= SCIP_STAGE_TRANSFORMED && scip->set->stage <= SCIP_STAGE_EXITSOLVE )
13308  {
13309  if( objlimitreached )
13310  {
13311  SCIPmessagePrintInfo(scip->messagehdlr, "Primal Bound : %+.14e (%"SCIP_LONGINT_FORMAT" solutions)\n",
13312  SCIPinfinity(scip), scip->primal->nsolsfound);
13313  }
13314  else
13315  {
13316  char limsolstring[SCIP_MAXSTRLEN];
13317  if( scip->primal->nsolsfound != scip->primal->nlimsolsfound )
13318  (void) SCIPsnprintf(limsolstring, SCIP_MAXSTRLEN, ", %"SCIP_LONGINT_FORMAT" respecting the objective limit", scip->primal->nlimsolsfound);
13319  else
13320  (void) SCIPsnprintf(limsolstring, SCIP_MAXSTRLEN,"");
13321 
13322  SCIPmessagePrintInfo(scip->messagehdlr, "Primal Bound : %+.14e (%"SCIP_LONGINT_FORMAT" solutions%s)\n",
13323  getPrimalbound(scip), scip->primal->nsolsfound, limsolstring);
13324  }
13325  }
13326  if( scip->set->stage >= SCIP_STAGE_SOLVING && scip->set->stage <= SCIP_STAGE_SOLVED )
13327  {
13328  if( objlimitreached )
13329  {
13330  SCIPmessagePrintInfo(scip->messagehdlr, "Dual Bound : %+.14e\n", SCIPinfinity(scip));
13331  }
13332  else
13333  {
13334  SCIPmessagePrintInfo(scip->messagehdlr, "Dual Bound : %+.14e\n", getDualbound(scip));
13335  }
13336  SCIPmessagePrintInfo(scip->messagehdlr, "Gap : ");
13337  if( SCIPsetIsInfinity(scip->set, SCIPgetGap(scip)) )
13338  SCIPmessagePrintInfo(scip->messagehdlr, "infinite\n");
13339  else
13340  SCIPmessagePrintInfo(scip->messagehdlr, "%.2f %%\n", 100.0*SCIPgetGap(scip));
13341  }
13342 
13343  /* check solution for feasibility in original problem */
13344  if( scip->set->stage >= SCIP_STAGE_TRANSFORMED )
13345  {
13346  SCIP_SOL* sol;
13347 
13348  sol = SCIPgetBestSol(scip);
13349  if( sol != NULL )
13350  {
13351  SCIP_Bool feasible;
13352  SCIP_CALL( SCIPcheckSolOrig(scip, sol, &feasible, TRUE, FALSE) );
13353 
13354  if( !feasible )
13355  {
13356  SCIPmessagePrintInfo(scip->messagehdlr, "best solution is not feasible in original problem\n");
13357  }
13358  }
13359  }
13360  }
13361 
13362  return SCIP_OKAY;
13363 }
13364 
13365 /** transforms and presolves problem
13366  *
13367  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
13368  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
13369  *
13370  * @pre This method can be called if @p scip is in one of the following stages:
13371  * - \ref SCIP_STAGE_PROBLEM
13372  * - \ref SCIP_STAGE_TRANSFORMED
13373  * - \ref SCIP_STAGE_PRESOLVING
13374  * - \ref SCIP_STAGE_PRESOLVED
13375  *
13376  * @post After calling this method \SCIP reaches one of the following stages:
13377  * - \ref SCIP_STAGE_PRESOLVING if the presolving process was interrupted
13378  * - \ref SCIP_STAGE_PRESOLVED if the presolving process was finished and did not solve the problem
13379  * - \ref SCIP_STAGE_SOLVED if the problem was solved during presolving
13380  *
13381  * See \ref SCIP_Stage "SCIP_STAGE" for a complete list of all possible solving stages.
13382  */
13384  SCIP* scip /**< SCIP data structure */
13385  )
13386 {
13387  SCIP_Bool unbounded;
13388  SCIP_Bool infeasible;
13389 
13390  SCIP_CALL( checkStage(scip, "SCIPpresolve", FALSE, TRUE, FALSE, TRUE, FALSE, TRUE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE) );
13391 
13392  /* start solving timer */
13393  SCIPclockStart(scip->stat->solvingtime, scip->set);
13394 
13395  /* capture the CTRL-C interrupt */
13396  if( scip->set->misc_catchctrlc )
13398 
13399  /* reset the user interrupt flag */
13400  scip->stat->userinterrupt = FALSE;
13401 
13402  switch( scip->set->stage )
13403  {
13404  case SCIP_STAGE_PROBLEM:
13405  /* initialize solving data structures and transform problem */
13406  SCIP_CALL( SCIPtransformProb(scip) );
13407  assert(scip->set->stage == SCIP_STAGE_TRANSFORMED);
13408 
13409  /*lint -fallthrough*/
13410 
13412  case SCIP_STAGE_PRESOLVING:
13413  /* presolve problem */
13414  SCIP_CALL( presolve(scip, &unbounded, &infeasible) );
13415  assert(scip->set->stage == SCIP_STAGE_PRESOLVED || scip->set->stage == SCIP_STAGE_PRESOLVING);
13416 
13417  if( infeasible || unbounded )
13418  {
13419  assert(scip->set->stage == SCIP_STAGE_PRESOLVED);
13420 
13421  /* initialize solving process data structures to be able to switch to SOLVED stage */
13422  SCIP_CALL( initSolve(scip, TRUE) );
13423 
13424  /* switch stage to SOLVED */
13425  scip->set->stage = SCIP_STAGE_SOLVED;
13426 
13427  /* print solution message */
13428  switch( scip->stat->status )/*lint --e{788}*/
13429  {
13430  case SCIP_STATUS_OPTIMAL:
13431  /* remove the root node from the tree, s.t. the lower bound is set to +infinity ???????????? (see initSolve())*/
13432  SCIP_CALL( SCIPtreeClear(scip->tree, scip->mem->probmem, scip->set, scip->stat, scip->eventqueue, scip->lp) );
13433  break;
13434 
13437  "presolving detected infeasibility\n");
13438  break;
13439 
13440  case SCIP_STATUS_UNBOUNDED:
13442  "presolving detected unboundedness\n");
13443  break;
13444 
13445  case SCIP_STATUS_INFORUNBD:
13447  "presolving detected unboundedness (or infeasibility)\n");
13448  break;
13449 
13450  default:
13451  /* note that this is in an internal SCIP error since the status is corrupted */
13452  SCIPerrorMessage("invalid SCIP status <%d>\n", scip->stat->status);
13453  SCIPABORT();
13454  return SCIP_ERROR; /*lint !e527*/
13455  }
13456  }
13457  else if( scip->set->stage == SCIP_STAGE_PRESOLVED )
13458  {
13459  int h;
13460 
13461  /* print presolved problem statistics */
13463  "presolved problem has %d variables (%d bin, %d int, %d impl, %d cont) and %d constraints\n",
13464  scip->transprob->nvars, scip->transprob->nbinvars, scip->transprob->nintvars, scip->transprob->nimplvars,
13465  scip->transprob->ncontvars, scip->transprob->nconss);
13466 
13467  for( h = 0; h < scip->set->nconshdlrs; ++h )
13468  {
13469  int nactiveconss;
13470 
13471  nactiveconss = SCIPconshdlrGetNActiveConss(scip->set->conshdlrs[h]);
13472  if( nactiveconss > 0 )
13473  {
13475  "%7d constraints of type <%s>\n", nactiveconss, SCIPconshdlrGetName(scip->set->conshdlrs[h]));
13476  }
13477  }
13478 
13479  if( SCIPprobIsObjIntegral(scip->transprob) )
13480  {
13482  "transformed objective value is always integral (scale: %.15g)\n", scip->transprob->objscale);
13483  }
13484  }
13485  else
13486  {
13487  assert(scip->set->stage == SCIP_STAGE_PRESOLVING);
13488  SCIPmessagePrintVerbInfo(scip->messagehdlr, scip->set->disp_verblevel, SCIP_VERBLEVEL_HIGH, "presolving was interrupted.\n");
13489  }
13490 
13491  /* display timing statistics */
13493  "Presolving Time: %.2f\n", SCIPclockGetTime(scip->stat->presolvingtime));
13494  break;
13495 
13496  case SCIP_STAGE_PRESOLVED:
13497  case SCIP_STAGE_SOLVED:
13498  break;
13499 
13500  default:
13501  SCIPerrorMessage("invalid SCIP stage <%d>\n", scip->set->stage);
13502  return SCIP_INVALIDCALL;
13503  } /*lint !e788*/
13504 
13505  /* release the CTRL-C interrupt */
13506  if( scip->set->misc_catchctrlc )
13508 
13509  /* stop solving timer */
13510  SCIPclockStop(scip->stat->solvingtime, scip->set);
13511 
13512  if( scip->set->stage == SCIP_STAGE_SOLVED )
13513  {
13514  /* display most relevant statistics */
13516  }
13517 
13518  return SCIP_OKAY;
13519 }
13520 
13521 /** transforms, presolves, and solves problem
13522  *
13523  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
13524  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
13525  *
13526  * @pre This method can be called if @p scip is in one of the following stages:
13527  * - \ref SCIP_STAGE_PROBLEM
13528  * - \ref SCIP_STAGE_TRANSFORMED
13529  * - \ref SCIP_STAGE_PRESOLVING
13530  * - \ref SCIP_STAGE_PRESOLVED
13531  * - \ref SCIP_STAGE_SOLVING
13532  * - \ref SCIP_STAGE_SOLVED
13533  *
13534  * @post After calling this method \SCIP reaches one of the following stages depending on if and when the solution
13535  * process was interrupted:
13536  * - \ref SCIP_STAGE_PRESOLVING if the solution process was interrupted during presolving
13537  * - \ref SCIP_STAGE_SOLVING if the solution process was interrupted during the tree search
13538  * - \ref SCIP_STAGE_SOLVED if the solving process was not interrupted
13539  *
13540  * See \ref SCIP_Stage "SCIP_STAGE" for a complete list of all possible solving stages.
13541  */
13543  SCIP* scip /**< SCIP data structure */
13544  )
13545 {
13546  SCIP_Bool statsprinted = FALSE;
13547  SCIP_Bool restart;
13548 
13549  SCIP_CALL( checkStage(scip, "SCIPsolve", FALSE, TRUE, FALSE, TRUE, FALSE, TRUE, FALSE, TRUE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE) );
13550 
13551  /* if the stage is already SCIP_STAGE_SOLVED do nothing */
13552  if( scip->set->stage == SCIP_STAGE_SOLVED )
13553  return SCIP_OKAY;
13554 
13555  /* check, if a node selector exists */
13556  if( SCIPsetGetNodesel(scip->set, scip->stat) == NULL )
13557  {
13558  SCIPerrorMessage("no node selector available\n");
13559  return SCIP_PLUGINNOTFOUND;
13560  }
13561 
13562  /* initialize presolving flag (may be modified in SCIPpresolve()) */
13563  scip->stat->performpresol = FALSE;
13564 
13565  /* start solving timer */
13566  SCIPclockStart(scip->stat->solvingtime, scip->set);
13567 
13568  /* capture the CTRL-C interrupt */
13569  if( scip->set->misc_catchctrlc )
13571 
13572  /* reset the user interrupt flag */
13573  scip->stat->userinterrupt = FALSE;
13574 
13575  /* automatic restarting loop */
13576  restart = scip->stat->userrestart;
13577  do
13578  {
13579  if( restart )
13580  {
13581  /* free the solving process data in order to restart */
13582  assert(scip->set->stage == SCIP_STAGE_SOLVING);
13583  if( scip->stat->userrestart )
13585  "(run %d, node %lld) performing user restart\n",
13586  scip->stat->nruns, scip->stat->nnodes, scip->stat->nrootintfixingsrun);
13587  else
13589  "(run %d, node %lld) restarting after %d global fixings of integer variables\n",
13590  scip->stat->nruns, scip->stat->nnodes, scip->stat->nrootintfixingsrun);
13591  /* an extra blank line should be printed separately since the buffer message handler only handles up to one line
13592  * correctly */
13594  SCIP_CALL( freeSolve(scip, TRUE) );
13595  assert(scip->set->stage == SCIP_STAGE_TRANSFORMED);
13596  }
13597  restart = FALSE;
13598  scip->stat->userrestart = FALSE;
13599 
13600  switch( scip->set->stage )
13601  {
13602  case SCIP_STAGE_PROBLEM:
13604  case SCIP_STAGE_PRESOLVING:
13605  /* initialize solving data structures, transform and problem */
13606  SCIP_CALL( SCIPpresolve(scip) );
13607 
13608  /* remember that we already printed the relevant statistics */
13609  if( scip->set->stage == SCIP_STAGE_SOLVED )
13610  statsprinted = TRUE;
13611 
13612  if( scip->set->stage == SCIP_STAGE_SOLVED || scip->set->stage == SCIP_STAGE_PRESOLVING )
13613  break;
13614  assert(scip->set->stage == SCIP_STAGE_PRESOLVED);
13615 
13616  /*lint -fallthrough*/
13617 
13618  case SCIP_STAGE_PRESOLVED:
13619  /* initialize solving process data structures */
13620  SCIP_CALL( initSolve(scip, FALSE) );
13621  assert(scip->set->stage == SCIP_STAGE_SOLVING);
13623 
13624  /*lint -fallthrough*/
13625 
13626  case SCIP_STAGE_SOLVING:
13627  /* reset display */
13628  SCIPstatResetDisplay(scip->stat);
13629 
13630  /* continue solution process */
13631  SCIP_CALL( SCIPsolveCIP(scip->mem->probmem, scip->set, scip->messagehdlr, scip->stat, scip->mem, scip->origprob, scip->transprob,
13632  scip->primal, scip->tree, scip->lp, scip->relaxation, scip->pricestore, scip->sepastore,
13633  scip->cutpool, scip->delayedcutpool, scip->branchcand, scip->conflict, scip->eventfilter, scip->eventqueue, &restart) );
13634 
13635  /* detect, whether problem is solved */
13636  if( SCIPtreeGetNNodes(scip->tree) == 0 && SCIPtreeGetCurrentNode(scip->tree) == NULL )
13637  {
13638  assert(scip->stat->status == SCIP_STATUS_OPTIMAL
13639  || scip->stat->status == SCIP_STATUS_INFEASIBLE
13640  || scip->stat->status == SCIP_STATUS_UNBOUNDED
13641  || scip->stat->status == SCIP_STATUS_INFORUNBD);
13642  assert(!restart);
13643 
13644  /* tree is empty, and no current node exists -> problem is solved */
13645  scip->set->stage = SCIP_STAGE_SOLVED;
13646  }
13647  break;
13648 
13649  case SCIP_STAGE_SOLVED:
13650  assert(scip->stat->status == SCIP_STATUS_OPTIMAL
13651  || scip->stat->status == SCIP_STATUS_INFEASIBLE
13652  || scip->stat->status == SCIP_STATUS_UNBOUNDED
13653  || scip->stat->status == SCIP_STATUS_INFORUNBD);
13654  break;
13655 
13656  default:
13657  SCIPerrorMessage("invalid SCIP stage <%d>\n", scip->set->stage);
13658  return SCIP_INVALIDCALL;
13659  } /*lint !e788*/
13660  }
13661  while( restart && !SCIPsolveIsStopped(scip->set, scip->stat, TRUE)
13662  && (scip->set->limit_restarts == -1 || scip->stat->nruns <= scip->set->limit_restarts ) );
13663 
13664  /* release the CTRL-C interrupt */
13665  if( scip->set->misc_catchctrlc )
13667 
13668  /* stop solving timer */
13669  SCIPclockStop(scip->stat->solvingtime, scip->set);
13670 
13671  if( !statsprinted )
13672  {
13673  /* display most relevant statistics */
13675  }
13676 
13677  return SCIP_OKAY;
13678 }
13679 
13680 /** frees branch and bound tree and all solution process data; statistics, presolving data and transformed problem is
13681  * preserved
13682  *
13683  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
13684  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
13685  *
13686  * @pre This method can be called if @p scip is in one of the following stages:
13687  * - \ref SCIP_STAGE_INIT
13688  * - \ref SCIP_STAGE_PROBLEM
13689  * - \ref SCIP_STAGE_TRANSFORMED
13690  * - \ref SCIP_STAGE_PRESOLVING
13691  * - \ref SCIP_STAGE_PRESOLVED
13692  * - \ref SCIP_STAGE_SOLVING
13693  * - \ref SCIP_STAGE_SOLVED
13694  *
13695  * @post If this method is called in \SCIP stage \ref SCIP_STAGE_INIT or \ref SCIP_STAGE_PROBLEM, the stage of
13696  * \SCIP is not changed; otherwise, the \SCIP stage is changed to \ref SCIP_STAGE_TRANSFORMED
13697  *
13698  * See \ref SCIP_Stage "SCIP_STAGE" for a complete list of all possible solving stages.
13699  */
13701  SCIP* scip, /**< SCIP data structure */
13702  SCIP_Bool restart /**< should certain data be preserved for improved restarting? */
13703  )
13704 {
13705  SCIP_CALL( checkStage(scip, "SCIPfreeSolve", TRUE, TRUE, FALSE, TRUE, FALSE, TRUE, FALSE, TRUE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE) );
13706 
13707  switch( scip->set->stage )
13708  {
13709  case SCIP_STAGE_INIT:
13710  case SCIP_STAGE_PROBLEM:
13712  return SCIP_OKAY;
13713 
13714  case SCIP_STAGE_PRESOLVING:
13715  {
13716  SCIP_Bool infeasible;
13717 
13718  assert(scip->stat->status != SCIP_STATUS_INFEASIBLE);
13719  assert(scip->stat->status != SCIP_STATUS_INFORUNBD);
13720  assert(scip->stat->status != SCIP_STATUS_UNBOUNDED);
13721  assert(scip->stat->status != SCIP_STATUS_OPTIMAL);
13722 
13723  /* exit presolving */
13724  SCIP_CALL( exitPresolve(scip, FALSE, &infeasible) );
13725  assert(scip->set->stage == SCIP_STAGE_PRESOLVED);
13726  }
13727 
13728  /*lint -fallthrough*/
13729  case SCIP_STAGE_PRESOLVED:
13730  /* switch stage to TRANSFORMED */
13731  scip->set->stage = SCIP_STAGE_TRANSFORMED;
13732  return SCIP_OKAY;
13733 
13734  case SCIP_STAGE_SOLVING:
13735  case SCIP_STAGE_SOLVED:
13736  /* free solution process data structures */
13737  SCIP_CALL( freeSolve(scip, restart) );
13738  assert(scip->set->stage == SCIP_STAGE_TRANSFORMED);
13739  return SCIP_OKAY;
13740 
13741  default:
13742  SCIPerrorMessage("invalid SCIP stage <%d>\n", scip->set->stage);
13743  return SCIP_INVALIDCALL;
13744  } /*lint !e788*/
13745 }
13746 
13747 /** frees all solution process data including presolving and transformed problem, only original problem is kept
13748  *
13749  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
13750  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
13751  *
13752  * @pre This method can be called if @p scip is in one of the following stages:
13753  * - \ref SCIP_STAGE_INIT
13754  * - \ref SCIP_STAGE_PROBLEM
13755  * - \ref SCIP_STAGE_TRANSFORMED
13756  * - \ref SCIP_STAGE_PRESOLVING
13757  * - \ref SCIP_STAGE_PRESOLVED
13758  * - \ref SCIP_STAGE_SOLVING
13759  * - \ref SCIP_STAGE_SOLVED
13760  *
13761  * @post After calling this method \SCIP reaches one of the following stages:
13762  * - \ref SCIP_STAGE_INIT if the method was called from \SCIP stage \ref SCIP_STAGE_INIT
13763  * - \ref SCIP_STAGE_PROBLEM if the method was called from any other of the allowed stages
13764  *
13765  * See \ref SCIP_Stage "SCIP_STAGE" for a complete list of all possible solving stages.
13766  */
13768  SCIP* scip /**< SCIP data structure */
13769  )
13770 {
13771  SCIP_CALL( checkStage(scip, "SCIPfreeTransform", TRUE, TRUE, FALSE, TRUE, FALSE, TRUE, FALSE, TRUE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE) );
13772 
13773  switch( scip->set->stage )
13774  {
13775  case SCIP_STAGE_INIT:
13776  case SCIP_STAGE_PROBLEM:
13777  return SCIP_OKAY;
13778 
13779  case SCIP_STAGE_PRESOLVING:
13780  {
13781  SCIP_Bool infeasible;
13782 
13783  assert(scip->stat->status != SCIP_STATUS_INFEASIBLE);
13784  assert(scip->stat->status != SCIP_STATUS_INFORUNBD);
13785  assert(scip->stat->status != SCIP_STATUS_UNBOUNDED);
13786  assert(scip->stat->status != SCIP_STATUS_OPTIMAL);
13787 
13788  /* exit presolving */
13789  SCIP_CALL( exitPresolve(scip, FALSE, &infeasible) );
13790  assert(scip->set->stage == SCIP_STAGE_PRESOLVED);
13791  }
13792 
13793  /*lint -fallthrough*/
13794  case SCIP_STAGE_PRESOLVED:
13795  case SCIP_STAGE_SOLVING:
13796  case SCIP_STAGE_SOLVED:
13797  /* free solution process data */
13798  SCIP_CALL( SCIPfreeSolve(scip, FALSE) );
13799  assert(scip->set->stage == SCIP_STAGE_TRANSFORMED);
13800 
13801  /*lint -fallthrough*/
13802 
13804  /* free transformed problem data structures */
13805  SCIP_CALL( freeTransform(scip) );
13806  assert(scip->set->stage == SCIP_STAGE_PROBLEM);
13807  return SCIP_OKAY;
13808 
13809  default:
13810  SCIPerrorMessage("invalid SCIP stage <%d>\n", scip->set->stage);
13811  return SCIP_INVALIDCALL;
13812  } /*lint !e788*/
13813 }
13814 
13815 /** informs \SCIP that the solving process should be interrupted as soon as possible (e.g., after the current node has
13816  * been solved)
13817  *
13818  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
13819  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
13820  *
13821  * @pre This method can be called if @p scip is in one of the following stages:
13822  * - \ref SCIP_STAGE_PROBLEM
13823  * - \ref SCIP_STAGE_TRANSFORMING
13824  * - \ref SCIP_STAGE_TRANSFORMED
13825  * - \ref SCIP_STAGE_INITPRESOLVE
13826  * - \ref SCIP_STAGE_PRESOLVING
13827  * - \ref SCIP_STAGE_EXITPRESOLVE
13828  * - \ref SCIP_STAGE_PRESOLVED
13829  * - \ref SCIP_STAGE_SOLVING
13830  * - \ref SCIP_STAGE_SOLVED
13831  * - \ref SCIP_STAGE_EXITSOLVE
13832  * - \ref SCIP_STAGE_FREETRANS
13833  *
13834  * @note the \SCIP stage does not get changed
13835  */
13837  SCIP* scip /**< SCIP data structure */
13838  )
13839 {
13840  SCIP_CALL( checkStage(scip, "SCIPinterruptSolve", FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, TRUE, TRUE, TRUE, TRUE, FALSE) );
13841 
13842  /* set the userinterrupt flag */
13843  scip->stat->userinterrupt = TRUE;
13844 
13845  return SCIP_OKAY;
13846 }
13847 
13848 /** informs SCIP that the solving process should be restarted as soon as possible (e.g., after the current node has
13849  * been solved)
13850  *
13851  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
13852  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
13853  *
13854  * @pre This method can be called if @p scip is in one of the following stages:
13855  * - \ref SCIP_STAGE_INITPRESOLVE
13856  * - \ref SCIP_STAGE_PRESOLVING
13857  * - \ref SCIP_STAGE_EXITPRESOLVE
13858  * - \ref SCIP_STAGE_SOLVING
13859  *
13860  * @note the \SCIP stage does not get changed
13861  */
13863  SCIP* scip /**< SCIP data structure */
13864  )
13865 {
13866  SCIP_CALL( checkStage(scip, "SCIPrestartSolve", FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) );
13867 
13868  /* set the userrestart flag */
13869  scip->stat->userrestart = TRUE;
13870 
13871  return SCIP_OKAY;
13872 }
13873 
13874 /** returns whether we are in the restarting phase
13875  *
13876  * @return TRUE, if we are in the restarting phase; FALSE, otherwise
13877  *
13878  * @pre This method can be called if @p scip is in one of the following stages:
13879  * - \ref SCIP_STAGE_INITPRESOLVE
13880  * - \ref SCIP_STAGE_PRESOLVING
13881  * - \ref SCIP_STAGE_EXITPRESOLVE
13882  * - \ref SCIP_STAGE_PRESOLVED
13883  * - \ref SCIP_STAGE_INITSOLVE
13884  * - \ref SCIP_STAGE_SOLVING
13885  * - \ref SCIP_STAGE_SOLVED
13886  * - \ref SCIP_STAGE_EXITSOLVE
13887  * - \ref SCIP_STAGE_FREETRANS
13888  */
13890  SCIP* scip /**< SCIP data structure */
13891  )
13892 {
13893  SCIP_CALL_ABORT( checkStage(scip, "SCIPisInRestart", FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE) );
13894 
13895  /* return the restart status */
13896  return scip->stat->inrestart;
13897 }
13898 
13899 
13900 /*
13901  * variable methods
13902  */
13903 
13904 /** creates and captures problem variable; if variable is of integral type, fractional bounds are automatically rounded;
13905  * an integer variable with bounds zero and one is automatically converted into a binary variable;
13906  *
13907  * @warning When doing column generation and the original problem is a maximization problem, notice that SCIP will
13908  * transform the problem into a minimization problem by multiplying the objective function by -1. Thus, the
13909  * original objective function value of variables created during the solving process has to be multiplied by
13910  * -1, too.
13911  *
13912  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
13913  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
13914  *
13915  * @pre This method can be called if @p scip is in one of the following stages:
13916  * - \ref SCIP_STAGE_PROBLEM
13917  * - \ref SCIP_STAGE_TRANSFORMING
13918  * - \ref SCIP_STAGE_INITPRESOLVE
13919  * - \ref SCIP_STAGE_PRESOLVING
13920  * - \ref SCIP_STAGE_EXITPRESOLVE
13921  * - \ref SCIP_STAGE_PRESOLVED
13922  * - \ref SCIP_STAGE_SOLVING
13923  *
13924  * @note the variable gets captured, hence at one point you have to release it using the method SCIPreleaseVar()
13925  */
13927  SCIP* scip, /**< SCIP data structure */
13928  SCIP_VAR** var, /**< pointer to variable object */
13929  const char* name, /**< name of variable, or NULL for automatic name creation */
13930  SCIP_Real lb, /**< lower bound of variable */
13931  SCIP_Real ub, /**< upper bound of variable */
13932  SCIP_Real obj, /**< objective function value */
13933  SCIP_VARTYPE vartype, /**< type of variable */
13934  SCIP_Bool initial, /**< should var's column be present in the initial root LP? */
13935  SCIP_Bool removable, /**< is var's column removable from the LP (due to aging or cleanup)? */
13936  SCIP_DECL_VARDELORIG ((*vardelorig)), /**< frees user data of original variable, or NULL */
13937  SCIP_DECL_VARTRANS ((*vartrans)), /**< creates transformed user data by transforming original user data, or NULL */
13938  SCIP_DECL_VARDELTRANS ((*vardeltrans)), /**< frees user data of transformed variable, or NULL */
13939  SCIP_DECL_VARCOPY ((*varcopy)), /**< copies variable data if wanted to subscip, or NULL */
13940  SCIP_VARDATA* vardata /**< user data for this specific variable */
13941  )
13942 {
13943  assert(var != NULL);
13944  assert(lb <= ub);
13945 
13946  SCIP_CALL( checkStage(scip, "SCIPcreateVar", FALSE, TRUE, TRUE, FALSE, TRUE, TRUE, TRUE, TRUE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) );
13947 
13948  switch( scip->set->stage )
13949  {
13950  case SCIP_STAGE_PROBLEM:
13951  SCIP_CALL( SCIPvarCreateOriginal(var, scip->mem->probmem, scip->set, scip->stat,
13952  name, lb, ub, obj, vartype, initial, removable, vardelorig, vartrans, vardeltrans, varcopy, vardata) );
13953  break;
13954 
13957  case SCIP_STAGE_PRESOLVING:
13959  case SCIP_STAGE_PRESOLVED:
13960  case SCIP_STAGE_SOLVING:
13961  SCIP_CALL( SCIPvarCreateTransformed(var, scip->mem->probmem, scip->set, scip->stat,
13962  name, lb, ub, obj, vartype, initial, removable, vardelorig, vartrans, vardeltrans, varcopy, vardata) );
13963  break;
13964 
13965  default:
13966  SCIPerrorMessage("invalid SCIP stage <%d>\n", scip->set->stage);
13967  return SCIP_INVALIDCALL;
13968  } /*lint !e788*/
13969 
13970  return SCIP_OKAY;
13971 }
13972 
13973 /** creates and captures problem variable with optional callbacks and variable data set to NULL, which can be set
13974  * afterwards using SCIPvarSetDelorigData(), SCIPvarSetTransData(),
13975  * SCIPvarSetDeltransData(), SCIPvarSetCopy(), and SCIPvarSetData(); sets variable flags initial=TRUE
13976  * and removable = FALSE, which can be adjusted by using SCIPvarSetInitial() and SCIPvarSetRemovable(), resp.;
13977  * if variable is of integral type, fractional bounds are automatically rounded;
13978  * an integer variable with bounds zero and one is automatically converted into a binary variable;
13979  *
13980  * @warning When doing column generation and the original problem is a maximization problem, notice that SCIP will
13981  * transform the problem into a minimization problem by multiplying the objective function by -1. Thus, the
13982  * original objective function value of variables created during the solving process has to be multiplied by
13983  * -1, too.
13984  *
13985  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
13986  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
13987  *
13988  * @pre This method can be called if @p scip is in one of the following stages:
13989  * - \ref SCIP_STAGE_PROBLEM
13990  * - \ref SCIP_STAGE_TRANSFORMING
13991  * - \ref SCIP_STAGE_INITPRESOLVE
13992  * - \ref SCIP_STAGE_PRESOLVING
13993  * - \ref SCIP_STAGE_EXITPRESOLVE
13994  * - \ref SCIP_STAGE_PRESOLVED
13995  * - \ref SCIP_STAGE_SOLVING
13996  *
13997  * @note the variable gets captured, hence at one point you have to release it using the method SCIPreleaseVar()
13998  */
14000  SCIP* scip, /**< SCIP data structure */
14001  SCIP_VAR** var, /**< pointer to variable object */
14002  const char* name, /**< name of variable, or NULL for automatic name creation */
14003  SCIP_Real lb, /**< lower bound of variable */
14004  SCIP_Real ub, /**< upper bound of variable */
14005  SCIP_Real obj, /**< objective function value */
14006  SCIP_VARTYPE vartype /**< type of variable */
14007  )
14008 {
14009  SCIP_CALL( checkStage(scip, "SCIPcreateVarBasic", FALSE, TRUE, TRUE, FALSE, TRUE, TRUE, TRUE, TRUE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) );
14010 
14011  SCIP_CALL( SCIPcreateVar(scip, var, name, lb, ub, obj, vartype, TRUE, FALSE, NULL, NULL, NULL, NULL, NULL) );
14012 
14013  return SCIP_OKAY;
14014 }
14015 
14016 /** outputs the variable name to the file stream
14017  *
14018  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
14019  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
14020  *
14021  * @pre This method can be called if @p scip is in one of the following stages:
14022  * - \ref SCIP_STAGE_PROBLEM
14023  * - \ref SCIP_STAGE_TRANSFORMING
14024  * - \ref SCIP_STAGE_TRANSFORMED
14025  * - \ref SCIP_STAGE_INITPRESOLVE
14026  * - \ref SCIP_STAGE_PRESOLVING
14027  * - \ref SCIP_STAGE_EXITPRESOLVE
14028  * - \ref SCIP_STAGE_PRESOLVED
14029  * - \ref SCIP_STAGE_INITSOLVE
14030  * - \ref SCIP_STAGE_SOLVING
14031  * - \ref SCIP_STAGE_SOLVED
14032  * - \ref SCIP_STAGE_EXITSOLVE
14033  * - \ref SCIP_STAGE_FREETRANS
14034  */
14036  SCIP* scip, /**< SCIP data structure */
14037  FILE* file, /**< output file, or NULL for stdout */
14038  SCIP_VAR* var, /**< variable to output */
14039  SCIP_Bool type /**< should the variable type be also posted */
14040  )
14041 {
14042  assert(scip != NULL);
14043  assert(var != NULL);
14044 
14045  SCIP_CALL( checkStage(scip, "SCIPwriteVarName", FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE) );
14046 
14047  /* print variable name */
14048  if( SCIPvarIsNegated(var) )
14049  {
14050  SCIP_VAR* negatedvar;
14051 
14052  SCIP_CALL( SCIPgetNegatedVar(scip, var, &negatedvar) );
14053  SCIPinfoMessage(scip, file, "<~%s>", SCIPvarGetName(negatedvar));
14054  }
14055  else
14056  {
14057  SCIPinfoMessage(scip, file, "<%s>", SCIPvarGetName(var));
14058  }
14059 
14060  if( type )
14061  {
14062  /* print variable type */
14063  SCIPinfoMessage(scip, file, "[%c]",
14067  }
14068 
14069  return SCIP_OKAY;
14070 }
14071 
14072 /** print the given list of variables to output stream separated by the given delimiter character;
14073  *
14074  * i. e. the variables x1, x2, ..., xn with given delimiter ',' are written as: <x1>, <x2>, ..., <xn>;
14075  *
14076  * the method SCIPparseVarsList() can parse such a string
14077  *
14078  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
14079  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
14080  *
14081  * @pre This method can be called if @p scip is in one of the following stages:
14082  * - \ref SCIP_STAGE_PROBLEM
14083  * - \ref SCIP_STAGE_TRANSFORMING
14084  * - \ref SCIP_STAGE_TRANSFORMED
14085  * - \ref SCIP_STAGE_INITPRESOLVE
14086  * - \ref SCIP_STAGE_PRESOLVING
14087  * - \ref SCIP_STAGE_EXITPRESOLVE
14088  * - \ref SCIP_STAGE_PRESOLVED
14089  * - \ref SCIP_STAGE_INITSOLVE
14090  * - \ref SCIP_STAGE_SOLVING
14091  * - \ref SCIP_STAGE_SOLVED
14092  * - \ref SCIP_STAGE_EXITSOLVE
14093  * - \ref SCIP_STAGE_FREETRANS
14094  *
14095  * @note The printing process is done via the message handler system.
14096  */
14098  SCIP* scip, /**< SCIP data structure */
14099  FILE* file, /**< output file, or NULL for stdout */
14100  SCIP_VAR** vars, /**< variable array to output */
14101  int nvars, /**< number of variables */
14102  SCIP_Bool type, /**< should the variable type be also posted */
14103  char delimiter /**< character which is used for delimitation */
14104  )
14105 {
14106  int v;
14107 
14108  SCIP_CALL( checkStage(scip, "SCIPwriteVarsList", FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE) );
14109 
14110  for( v = 0; v < nvars; ++v )
14111  {
14112  if( v > 0 )
14113  {
14114  SCIPinfoMessage(scip, file, "%c", delimiter);
14115  }
14116 
14117  /* print variable name */
14118  SCIP_CALL( SCIPwriteVarName(scip, file, vars[v], type) );
14119  }
14120 
14121  return SCIP_OKAY;
14122 }
14123 
14124 /** print the given variables and coefficients as linear sum in the following form
14125  * c1 <x1> + c2 <x2> ... + cn <xn>
14126  *
14127  * This string can be parsed by the method SCIPparseVarsLinearsum().
14128  *
14129  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
14130  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
14131  *
14132  * @pre This method can be called if @p scip is in one of the following stages:
14133  * - \ref SCIP_STAGE_PROBLEM
14134  * - \ref SCIP_STAGE_TRANSFORMING
14135  * - \ref SCIP_STAGE_TRANSFORMED
14136  * - \ref SCIP_STAGE_INITPRESOLVE
14137  * - \ref SCIP_STAGE_PRESOLVING
14138  * - \ref SCIP_STAGE_EXITPRESOLVE
14139  * - \ref SCIP_STAGE_PRESOLVED
14140  * - \ref SCIP_STAGE_INITSOLVE
14141  * - \ref SCIP_STAGE_SOLVING
14142  * - \ref SCIP_STAGE_SOLVED
14143  * - \ref SCIP_STAGE_EXITSOLVE
14144  * - \ref SCIP_STAGE_FREETRANS
14145  *
14146  * @note The printing process is done via the message handler system.
14147  */
14149  SCIP* scip, /**< SCIP data structure */
14150  FILE* file, /**< output file, or NULL for stdout */
14151  SCIP_VAR** vars, /**< variable array to output */
14152  SCIP_Real* vals, /**< array of coefficients or NULL if all coefficients are 1.0 */
14153  int nvars, /**< number of variables */
14154  SCIP_Bool type /**< should the variable type be also posted */
14155  )
14156 {
14157  int v;
14158 
14159  SCIP_CALL( checkStage(scip, "SCIPwriteVarsLinearsum", FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE) );
14160 
14161  for( v = 0; v < nvars; ++v )
14162  {
14163  if( vals != NULL )
14164  {
14165  if( vals[v] == 1.0 )
14166  {
14167  if( v > 0 )
14168  SCIPinfoMessage(scip, file, " +");
14169  }
14170  else if( vals[v] == -1.0 )
14171  SCIPinfoMessage(scip, file, " -");
14172  else
14173  SCIPinfoMessage(scip, file, " %+.15g", vals[v]);
14174  }
14175  else if( nvars > 0 )
14176  SCIPinfoMessage(scip, file, " +");
14177 
14178  /* print variable name */
14179  SCIP_CALL( SCIPwriteVarName(scip, file, vars[v], type) );
14180  }
14181 
14182  return SCIP_OKAY;
14183 }
14184 
14185 /** print the given monomials as polynomial in the following form
14186  * c1 <x11>^e11 <x12>^e12 ... <x1n>^e1n + c2 <x21>^e21 <x22>^e22 ... + ... + cn <xn1>^en1 ...
14187  *
14188  * This string can be parsed by the method SCIPparseVarsPolynomial().
14189  *
14190  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
14191  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
14192  *
14193  * @pre This method can be called if @p scip is in one of the following stages:
14194  * - \ref SCIP_STAGE_PROBLEM
14195  * - \ref SCIP_STAGE_TRANSFORMING
14196  * - \ref SCIP_STAGE_TRANSFORMED
14197  * - \ref SCIP_STAGE_INITPRESOLVE
14198  * - \ref SCIP_STAGE_PRESOLVING
14199  * - \ref SCIP_STAGE_EXITPRESOLVE
14200  * - \ref SCIP_STAGE_PRESOLVED
14201  * - \ref SCIP_STAGE_INITSOLVE
14202  * - \ref SCIP_STAGE_SOLVING
14203  * - \ref SCIP_STAGE_SOLVED
14204  * - \ref SCIP_STAGE_EXITSOLVE
14205  * - \ref SCIP_STAGE_FREETRANS
14206  *
14207  * @note The printing process is done via the message handler system.
14208  */
14210  SCIP* scip, /**< SCIP data structure */
14211  FILE* file, /**< output file, or NULL for stdout */
14212  SCIP_VAR*** monomialvars, /**< arrays with variables for each monomial */
14213  SCIP_Real** monomialexps, /**< arrays with variable exponents, or NULL if always 1.0 */
14214  SCIP_Real* monomialcoefs, /**< array with monomial coefficients */
14215  int* monomialnvars, /**< array with number of variables for each monomial */
14216  int nmonomials, /**< number of monomials */
14217  SCIP_Bool type /**< should the variable type be also posted */
14218  )
14219 {
14220  int i;
14221  int v;
14222 
14223  assert(scip != NULL);
14224  assert(monomialvars != NULL || nmonomials == 0);
14225  assert(monomialcoefs != NULL || nmonomials == 0);
14226  assert(monomialnvars != NULL || nmonomials == 0);
14227 
14228  SCIP_CALL( checkStage(scip, "SCIPwriteVarsPolynomial", FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE) );
14229 
14230  if( nmonomials == 0 )
14231  {
14232  SCIPinfoMessage(scip, file, " 0 ");
14233  return SCIP_OKAY;
14234  }
14235 
14236  for( i = 0; i < nmonomials; ++i )
14237  {
14238  if( monomialcoefs[i] == 1.0 ) /*lint !e613*/
14239  {
14240  if( i > 0 )
14241  SCIPinfoMessage(scip, file, " +");
14242  }
14243  else if( monomialcoefs[i] == -1.0 ) /*lint !e613*/
14244  SCIPinfoMessage(scip, file, " -");
14245  else
14246  SCIPinfoMessage(scip, file, " %+.15g", monomialcoefs[i]); /*lint !e613*/
14247 
14248  assert(monomialvars[i] != NULL || monomialnvars[i] == 0); /*lint !e613*/
14249 
14250  for( v = 0; v < monomialnvars[i]; ++v ) /*lint !e613*/
14251  {
14252  SCIP_CALL( SCIPwriteVarName(scip, file, monomialvars[i][v], type) ); /*lint !e613*/
14253  if( monomialexps != NULL && monomialexps[i] != NULL && monomialexps[i][v] != 1.0 )
14254  {
14255  SCIPinfoMessage(scip, file, "^%.15g", monomialexps[i][v]);
14256  }
14257  }
14258  }
14259 
14260  return SCIP_OKAY;
14261 }
14262 
14263 /** parses variable information (in cip format) out of a string; if the parsing process was successful a variable is
14264  * created and captured; if variable is of integral type, fractional bounds are automatically rounded; an integer
14265  * variable with bounds zero and one is automatically converted into a binary variable
14266  *
14267  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
14268  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
14269  *
14270  * @pre This method can be called if @p scip is in one of the following stages:
14271  * - \ref SCIP_STAGE_PROBLEM
14272  * - \ref SCIP_STAGE_TRANSFORMING
14273  * - \ref SCIP_STAGE_INITPRESOLVE
14274  * - \ref SCIP_STAGE_PRESOLVING
14275  * - \ref SCIP_STAGE_EXITPRESOLVE
14276  * - \ref SCIP_STAGE_PRESOLVED
14277  * - \ref SCIP_STAGE_SOLVING
14278  */
14280  SCIP* scip, /**< SCIP data structure */
14281  SCIP_VAR** var, /**< pointer to store the problem variable */
14282  const char* str, /**< string to parse */
14283  SCIP_Bool initial, /**< should var's column be present in the initial root LP? */
14284  SCIP_Bool removable, /**< is var's column removable from the LP (due to aging or cleanup)? */
14285  SCIP_DECL_VARCOPY ((*varcopy)), /**< copies variable data if wanted to subscip, or NULL */
14286  SCIP_DECL_VARDELORIG ((*vardelorig)), /**< frees user data of original variable */
14287  SCIP_DECL_VARTRANS ((*vartrans)), /**< creates transformed user data by transforming original user data */
14288  SCIP_DECL_VARDELTRANS ((*vardeltrans)), /**< frees user data of transformed variable */
14289  SCIP_VARDATA* vardata, /**< user data for this specific variable */
14290  char** endptr, /**< pointer to store the final string position if successfully */
14291  SCIP_Bool* success /**< pointer store if the paring process was successful */
14292  )
14293 {
14294  assert(var != NULL);
14295 
14296  SCIP_CALL( checkStage(scip, "SCIPparseVar", FALSE, TRUE, TRUE, FALSE, TRUE, TRUE, TRUE, TRUE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) );
14297 
14298  switch( scip->set->stage )
14299  {
14300  case SCIP_STAGE_PROBLEM:
14301  SCIP_CALL( SCIPvarParseOriginal(var, scip->mem->probmem, scip->set, scip->messagehdlr, scip->stat,
14302  str, initial, removable, varcopy, vardelorig, vartrans, vardeltrans, vardata, endptr, success) );
14303  break;
14304 
14307  case SCIP_STAGE_PRESOLVING:
14309  case SCIP_STAGE_PRESOLVED:
14310  case SCIP_STAGE_SOLVING:
14311  SCIP_CALL( SCIPvarParseTransformed(var, scip->mem->probmem, scip->set, scip->messagehdlr, scip->stat,
14312  str, initial, removable, varcopy, vardelorig, vartrans, vardeltrans, vardata, endptr, success) );
14313  break;
14314 
14315  default:
14316  SCIPerrorMessage("invalid SCIP stage <%d>\n", scip->set->stage);
14317  return SCIP_INVALIDCALL;
14318  } /*lint !e788*/
14319 
14320  return SCIP_OKAY;
14321 }
14322 
14323 /** parses the given string for a variable name and stores the variable in the corresponding pointer if such a variable
14324  * exits and returns the position where the parsing stopped
14325  *
14326  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
14327  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
14328  *
14329  * @pre This method can be called if @p scip is in one of the following stages:
14330  * - \ref SCIP_STAGE_PROBLEM
14331  * - \ref SCIP_STAGE_TRANSFORMING
14332  * - \ref SCIP_STAGE_INITPRESOLVE
14333  * - \ref SCIP_STAGE_PRESOLVING
14334  * - \ref SCIP_STAGE_EXITPRESOLVE
14335  * - \ref SCIP_STAGE_PRESOLVED
14336  * - \ref SCIP_STAGE_SOLVING
14337  */
14339  SCIP* scip, /**< SCIP data structure */
14340  const char* str, /**< string to parse */
14341  SCIP_VAR** var, /**< pointer to store the problem variable, or NULL if it does not exit */
14342  char** endptr /**< pointer to store the final string position if successfully */
14343  )
14344 {
14345  char varname[SCIP_MAXSTRLEN];
14346 
14347  assert(str != NULL);
14348  assert(var != NULL);
14349  assert(endptr != NULL);
14350 
14351  SCIP_CALL( checkStage(scip, "SCIPparseVarName", FALSE, TRUE, TRUE, FALSE, TRUE, TRUE, TRUE, TRUE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) );
14352 
14353  SCIPstrCopySection(str, '<', '>', varname, SCIP_MAXSTRLEN, endptr);
14354  assert(*endptr != NULL);
14355 
14356  if( *varname == '\0' )
14357  {
14358  SCIPerrorMessage("invalid variable name string given: could not find '<'\n");
14359  return SCIP_INVALIDDATA;
14360  }
14361 
14362  /* check if we have a negated variable */
14363  if( *varname == '~' )
14364  {
14365  SCIPdebugMessage("parsed negated variable name <%s>\n", &varname[1]);
14366 
14367  /* search for the variable and ignore '~' */
14368  (*var) = SCIPfindVar(scip, &varname[1]);
14369 
14370  if( *var != NULL )
14371  {
14372  SCIP_CALL( SCIPgetNegatedVar(scip, *var, var) );
14373  }
14374  }
14375  else
14376  {
14377  SCIPdebugMessage("parsed variable name <%s>\n", varname);
14378 
14379  /* search for the variable */
14380  (*var) = SCIPfindVar(scip, varname);
14381  }
14382 
14383  str = *endptr;
14384 
14385  /* skip additional variable type marker */
14386  if( *str == '[' && (str[1] == SCIP_VARTYPE_BINARY_CHAR || str[1] == SCIP_VARTYPE_INTEGER_CHAR ||
14387  str[1] == SCIP_VARTYPE_IMPLINT_CHAR || str[1] == SCIP_VARTYPE_CONTINUOUS_CHAR ) && str[2] == ']' )
14388  (*endptr) += 3;
14389 
14390  return SCIP_OKAY;
14391 }
14392 
14393 /** parse the given string as variable list (here ',' is the delimiter)) (<x1>, <x2>, ..., <xn>) (see
14394  * SCIPwriteVarsList() ); if it was successful, the pointer success is set to TRUE
14395  *
14396  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
14397  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
14398  *
14399  * @pre This method can be called if @p scip is in one of the following stages:
14400  * - \ref SCIP_STAGE_PROBLEM
14401  * - \ref SCIP_STAGE_TRANSFORMING
14402  * - \ref SCIP_STAGE_INITPRESOLVE
14403  * - \ref SCIP_STAGE_PRESOLVING
14404  * - \ref SCIP_STAGE_EXITPRESOLVE
14405  * - \ref SCIP_STAGE_PRESOLVED
14406  * - \ref SCIP_STAGE_SOLVING
14407  *
14408  * @note the pointer success in only set to FALSE in the case that a variable with a parsed variable name does not exist
14409  *
14410  * @note If the number of (parsed) variables is greater than the available slots in the variable array, nothing happens
14411  * except that the required size is stored in the corresponding integer; the reason for this approach is that we
14412  * cannot reallocate memory, since we do not know how the memory has been allocated (e.g., by a C++ 'new' or SCIP
14413  * memory functions).
14414  */
14416  SCIP* scip, /**< SCIP data structure */
14417  const char* str, /**< string to parse */
14418  SCIP_VAR** vars, /**< array to store the parsed variable */
14419  int* nvars, /**< pointer to store number of parsed variables */
14420  int varssize, /**< size of the variable array */
14421  int* requiredsize, /**< pointer to store the required array size for the active variables */
14422  char** endptr, /**< pointer to store the final string position if successfully */
14423  char delimiter, /**< character which is used for delimitation */
14424  SCIP_Bool* success /**< pointer to store the whether the parsing was successfully or not */
14425  )
14426 {
14427  SCIP_VAR** tmpvars;
14428  SCIP_VAR* var;
14429  int ntmpvars;
14430  int v;
14431 
14432  SCIP_CALL( checkStage(scip, "SCIPparseVarsList", FALSE, TRUE, TRUE, FALSE, TRUE, TRUE, TRUE, TRUE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) );
14433 
14434  /* allocate buffer memory for temporary storing the parsed variables */
14435  SCIP_CALL( SCIPallocBufferArray(scip, &tmpvars, varssize) );
14436 
14437  ntmpvars = 0;
14438  (*success) = TRUE;
14439 
14440  do
14441  {
14442  *endptr = (char*)str;
14443 
14444  /* parse variable name */
14445  SCIP_CALL( SCIPparseVarName(scip, str, &var, endptr) );
14446 
14447  if( var == NULL )
14448  {
14449  SCIPdebugMessage("variable with name <%s> does not exist\n", SCIPvarGetName(var));
14450  (*success) = FALSE;
14451  break;
14452  }
14453 
14454  /* store the variable in the tmp array */
14455  if( ntmpvars < varssize )
14456  tmpvars[ntmpvars] = var;
14457 
14458  ntmpvars++;
14459 
14460  str = *endptr;
14461 
14462  while( isspace((unsigned char)*str) )
14463  str++;
14464  }
14465  while( *str == delimiter );
14466 
14467  *endptr = (char*)str;
14468 
14469  /* if all variable name searches were successfully and the variable array has enough slots copy the collected
14470  * variables
14471  */
14472  if( (*success) && ntmpvars <= varssize )
14473  {
14474  for( v = 0; v < ntmpvars; ++v )
14475  vars[v] = tmpvars[v];
14476 
14477  (*nvars) = ntmpvars;
14478  }
14479  else
14480  (*nvars) = 0;
14481 
14482  (*requiredsize) = ntmpvars;
14483 
14484  /* free buffer arrays */
14485  SCIPfreeBufferArray(scip, &tmpvars);
14486 
14487  return SCIP_OKAY;
14488 }
14489 
14490 /** parse the given string as linear sum of variables and coefficients (c1 <x1> + c2 <x2> + ... + cn <xn>)
14491  * (see SCIPwriteVarsLinearsum() ); if it was successful, the pointer success is set to TRUE
14492  *
14493  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
14494  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
14495  *
14496  * @pre This method can be called if @p scip is in one of the following stages:
14497  * - \ref SCIP_STAGE_PROBLEM
14498  * - \ref SCIP_STAGE_TRANSFORMING
14499  * - \ref SCIP_STAGE_INITPRESOLVE
14500  * - \ref SCIP_STAGE_PRESOLVING
14501  * - \ref SCIP_STAGE_EXITPRESOLVE
14502  * - \ref SCIP_STAGE_PRESOLVED
14503  * - \ref SCIP_STAGE_SOLVING
14504  *
14505  * @note the pointer success in only set to FALSE in the case that a variable with a parsed variable name does not exist
14506  *
14507  * @note If the number of (parsed) variables is greater than the available slots in the variable array, nothing happens
14508  * except that the required size is stored in the corresponding integer; the reason for this approach is that we
14509  * cannot reallocate memory, since we do not know how the memory has been allocated (e.g., by a C++ 'new' or SCIP
14510  * memory functions).
14511  */
14513  SCIP* scip, /**< SCIP data structure */
14514  const char* str, /**< string to parse */
14515  SCIP_VAR** vars, /**< array to store the parsed variables */
14516  SCIP_Real* vals, /**< array to store the parsed coefficients */
14517  int* nvars, /**< pointer to store number of parsed variables */
14518  int varssize, /**< size of the variable array */
14519  int* requiredsize, /**< pointer to store the required array size for the active variables */
14520  char** endptr, /**< pointer to store the final string position if successfully */
14521  SCIP_Bool* success /**< pointer to store the whether the parsing was successfully or not */
14522  )
14523 {
14524  SCIP_VAR*** monomialvars;
14525  SCIP_Real** monomialexps;
14526  SCIP_Real* monomialcoefs;
14527  int* monomialnvars;
14528  int nmonomials;
14529 
14530  SCIP_CALL( checkStage(scip, "SCIPparseVarsLinearsum", FALSE, TRUE, TRUE, FALSE, TRUE, TRUE, TRUE, TRUE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) );
14531 
14532  assert(scip != NULL);
14533  assert(str != NULL);
14534  assert(vars != NULL || varssize == 0);
14535  assert(vals != NULL || varssize == 0);
14536  assert(nvars != NULL);
14537  assert(requiredsize != NULL);
14538  assert(endptr != NULL);
14539  assert(success != NULL);
14540 
14541  *requiredsize = 0;
14542 
14543  SCIP_CALL( SCIPparseVarsPolynomial(scip, str, &monomialvars, &monomialexps, &monomialcoefs, &monomialnvars, &nmonomials, endptr, success) );
14544 
14545  if( !*success )
14546  {
14547  assert(nmonomials == 0); /* SCIPparseVarsPolynomial should have freed all buffers, so no need to call free here */
14548  return SCIP_OKAY;
14549  }
14550 
14551  /* check if linear sum is just "0" */
14552  if( nmonomials == 1 && monomialnvars[0] == 0 && monomialcoefs[0] == 0.0 )
14553  {
14554  *nvars = 0;
14555  *requiredsize = 0;
14556 
14557  SCIPfreeParseVarsPolynomialData(scip, &monomialvars, &monomialexps, &monomialcoefs, &monomialnvars, nmonomials);
14558 
14559  return SCIP_OKAY;
14560  }
14561 
14562  *nvars = nmonomials;
14563  *requiredsize = nmonomials;
14564 
14565  /* if we have enough slots in the variables array, copy variables over */
14566  if( varssize >= nmonomials )
14567  {
14568  int v;
14569 
14570  for( v = 0; v < nmonomials; ++v )
14571  {
14572  if( monomialnvars[v] == 0 )
14573  {
14574  SCIPerrorMessage("constant in linear sum\n");
14575  *success = FALSE;
14576  break;
14577  }
14578  if( monomialnvars[v] > 1 || monomialexps[v][0] != 1.0 )
14579  {
14580  SCIPerrorMessage("nonlinear monomial in linear sum\n");
14581  *success = FALSE;
14582  break;
14583  }
14584  assert(monomialnvars[v] == 1);
14585  assert(monomialvars[v][0] != NULL);
14586  assert(monomialexps[v][0] == 1.0);
14587 
14588  vars[v] = monomialvars[v][0]; /*lint !e613*/
14589  vals[v] = monomialcoefs[v]; /*lint !e613*/
14590  }
14591  }
14592 
14593  SCIPfreeParseVarsPolynomialData(scip, &monomialvars, &monomialexps, &monomialcoefs, &monomialnvars, nmonomials);
14594 
14595  return SCIP_OKAY;
14596 }
14597 
14598 /** parse the given string as polynomial of variables and coefficients
14599  * (c1 <x11>^e11 <x12>^e12 ... <x1n>^e1n + c2 <x21>^e21 <x22>^e22 ... + ... + cn <xn1>^en1 ...)
14600  * (see SCIPwriteVarsPolynomial()); if it was successful, the pointer success is set to TRUE
14601  *
14602  * The user has to call SCIPfreeParseVarsPolynomialData(scip, monomialvars, monomialexps,
14603  * monomialcoefs, monomialnvars, *nmonomials) short after SCIPparseVarsPolynomial to free all the
14604  * allocated memory again. Do not keep the arrays created by SCIPparseVarsPolynomial around, since
14605  * they use buffer memory that is intended for short term use only.
14606  *
14607  * Parsing is stopped at the end of string (indicated by the \\0-character) or when no more monomials
14608  * are recognized.
14609  *
14610  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
14611  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
14612  *
14613  * @pre This method can be called if @p scip is in one of the following stages:
14614  * - \ref SCIP_STAGE_PROBLEM
14615  * - \ref SCIP_STAGE_TRANSFORMING
14616  * - \ref SCIP_STAGE_INITPRESOLVE
14617  * - \ref SCIP_STAGE_PRESOLVING
14618  * - \ref SCIP_STAGE_EXITPRESOLVE
14619  * - \ref SCIP_STAGE_PRESOLVED
14620  * - \ref SCIP_STAGE_SOLVING
14621  */
14623  SCIP* scip, /**< SCIP data structure */
14624  const char* str, /**< string to parse */
14625  SCIP_VAR**** monomialvars, /**< pointer to store arrays with variables for each monomial */
14626  SCIP_Real*** monomialexps, /**< pointer to store arrays with variable exponents */
14627  SCIP_Real** monomialcoefs, /**< pointer to store array with monomial coefficients */
14628  int** monomialnvars, /**< pointer to store array with number of variables for each monomial */
14629  int* nmonomials, /**< pointer to store number of parsed monomials */
14630  char** endptr, /**< pointer to store the final string position if successfully */
14631  SCIP_Bool* success /**< pointer to store the whether the parsing was successfully or not */
14632  )
14633 {
14634  typedef enum
14635  {
14636  SCIPPARSEPOLYNOMIAL_STATE_BEGIN, /* we are at the beginning of a monomial */
14637  SCIPPARSEPOLYNOMIAL_STATE_INTERMED, /* we are in between the factors of a monomial */
14638  SCIPPARSEPOLYNOMIAL_STATE_COEF, /* we parse the coefficient of a monomial */
14639  SCIPPARSEPOLYNOMIAL_STATE_VARS, /* we parse monomial variables */
14640  SCIPPARSEPOLYNOMIAL_STATE_EXPONENT, /* we parse the exponent of a variable */
14641  SCIPPARSEPOLYNOMIAL_STATE_END, /* we are at the end the polynomial */
14642  SCIPPARSEPOLYNOMIAL_STATE_ERROR /* a parsing error occured */
14643  } SCIPPARSEPOLYNOMIAL_STATES;
14644 
14645  SCIPPARSEPOLYNOMIAL_STATES state;
14646  int monomialssize;
14647 
14648  /* data of currently parsed monomial */
14649  int varssize;
14650  int nvars;
14651  SCIP_VAR** vars;
14652  SCIP_Real* exponents;
14653  SCIP_Real coef;
14654 
14655  assert(scip != NULL);
14656  assert(str != NULL);
14657  assert(monomialvars != NULL);
14658  assert(monomialexps != NULL);
14659  assert(monomialnvars != NULL);
14660  assert(monomialcoefs != NULL);
14661  assert(nmonomials != NULL);
14662  assert(endptr != NULL);
14663  assert(success != NULL);
14664 
14665  SCIP_CALL( checkStage(scip, "SCIPparseVarsPolynomial", FALSE, TRUE, TRUE, FALSE, TRUE, TRUE, TRUE, TRUE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) );
14666 
14667  *success = FALSE;
14668  *nmonomials = 0;
14669  monomialssize = 0;
14670  *monomialvars = NULL;
14671  *monomialexps = NULL;
14672  *monomialcoefs = NULL;
14673  *monomialnvars = NULL;
14674 
14675  /* initialize state machine */
14676  state = SCIPPARSEPOLYNOMIAL_STATE_BEGIN;
14677  varssize = 0;
14678  nvars = 0;
14679  vars = NULL;
14680  exponents = NULL;
14681  coef = SCIP_INVALID;
14682 
14683  SCIPdebugMessage("parsing polynomial from '%s'\n", str);
14684 
14685  while( *str && state != SCIPPARSEPOLYNOMIAL_STATE_END && state != SCIPPARSEPOLYNOMIAL_STATE_ERROR )
14686  {
14687  /* skip white space */
14688  while( isspace((unsigned char)*str) )
14689  str++;
14690 
14691  assert(state != SCIPPARSEPOLYNOMIAL_STATE_END);
14692 
14693  switch( state )
14694  {
14695  case SCIPPARSEPOLYNOMIAL_STATE_BEGIN:
14696  {
14697  if( coef != SCIP_INVALID ) /*lint !e777*/
14698  {
14699  SCIPdebugMessage("push monomial with coefficient <%g> and <%d> vars\n", coef, nvars);
14700  /* push previous monomial */
14701  if( monomialssize <= *nmonomials )
14702  {
14703  monomialssize = SCIPcalcMemGrowSize(scip, *nmonomials+1);
14704 
14705  SCIP_CALL( SCIPreallocBufferArray(scip, monomialvars, monomialssize) );
14706  SCIP_CALL( SCIPreallocBufferArray(scip, monomialexps, monomialssize) );
14707  SCIP_CALL( SCIPreallocBufferArray(scip, monomialnvars, monomialssize) );
14708  SCIP_CALL( SCIPreallocBufferArray(scip, monomialcoefs, monomialssize) );
14709  }
14710 
14711  if( nvars > 0 )
14712  {
14713  SCIP_CALL( SCIPduplicateBufferArray(scip, &(*monomialvars)[*nmonomials], vars, nvars) ); /*lint !e866*/
14714  SCIP_CALL( SCIPduplicateBufferArray(scip, &(*monomialexps)[*nmonomials], exponents, nvars) ); /*lint !e866*/
14715  }
14716  else
14717  {
14718  (*monomialvars)[*nmonomials] = NULL;
14719  (*monomialexps)[*nmonomials] = NULL;
14720  }
14721  (*monomialcoefs)[*nmonomials] = coef;
14722  (*monomialnvars)[*nmonomials] = nvars;
14723  ++*nmonomials;
14724 
14725  nvars = 0;
14726  coef = SCIP_INVALID;
14727  }
14728 
14729  if( *str == '<' )
14730  {
14731  /* there seem to come a variable at the beginning of a monomial
14732  * so assume the coefficient is 1.0
14733  */
14734  state = SCIPPARSEPOLYNOMIAL_STATE_VARS;
14735  coef = 1.0;
14736  break;
14737  }
14738  if( *str == '-' || *str == '+' || isdigit(*str) )
14739  {
14740  state = SCIPPARSEPOLYNOMIAL_STATE_COEF;
14741  break;
14742  }
14743 
14744  state = SCIPPARSEPOLYNOMIAL_STATE_END;
14745 
14746  break;
14747  }
14748 
14749  case SCIPPARSEPOLYNOMIAL_STATE_INTERMED:
14750  {
14751  if( *str == '<' )
14752  {
14753  /* there seem to come another variable */
14754  state = SCIPPARSEPOLYNOMIAL_STATE_VARS;
14755  break;
14756  }
14757 
14758  if( *str == '-' || *str == '+' || isdigit(*str) )
14759  {
14760  /* there seem to come a coefficient, which means the next monomial */
14761  state = SCIPPARSEPOLYNOMIAL_STATE_BEGIN;
14762  break;
14763  }
14764 
14765  /* since we cannot detect the symbols we stop parsing the polynomial */
14766  state = SCIPPARSEPOLYNOMIAL_STATE_END;
14767  break;
14768  }
14769 
14770  case SCIPPARSEPOLYNOMIAL_STATE_COEF:
14771  {
14772  if( *str == '+' && !isdigit(str[1]) )
14773  {
14774  /* only a plus sign, without number */
14775  coef = 1.0;
14776  ++str;
14777  }
14778  else if( *str == '-' && !isdigit(str[1]) )
14779  {
14780  /* only a minus sign, without number */
14781  coef = -1.0;
14782  ++str;
14783  }
14784  else if( SCIPstrToRealValue(str, &coef, endptr) )
14785  {
14786  str = *endptr;
14787  }
14788  else
14789  {
14790  SCIPerrorMessage("could not parse number in the beginning of '%s'\n", str);
14791  state = SCIPPARSEPOLYNOMIAL_STATE_ERROR;
14792  break;
14793  }
14794 
14795  /* after the coefficient we go into the intermediate state, i.e., expecting next variables */
14796  state = SCIPPARSEPOLYNOMIAL_STATE_INTERMED;
14797 
14798  break;
14799  }
14800 
14801  case SCIPPARSEPOLYNOMIAL_STATE_VARS:
14802  {
14803  SCIP_VAR* var;
14804 
14805  assert(*str == '<');
14806 
14807  /* parse variable name */
14808  SCIP_CALL( SCIPparseVarName(scip, str, &var, endptr) );
14809 
14810  /* check if variable name was parsed */
14811  if( *endptr == str )
14812  {
14813  state = SCIPPARSEPOLYNOMIAL_STATE_END;
14814  break;
14815  }
14816 
14817  if( var == NULL )
14818  {
14819  SCIPerrorMessage("did not find variable in the beginning of %s\n", str);
14820  state = SCIPPARSEPOLYNOMIAL_STATE_ERROR;
14821  break;
14822  }
14823 
14824  /* add variable to vars array */
14825  if( nvars + 1 > varssize )
14826  {
14827  varssize = SCIPcalcMemGrowSize(scip, nvars+1);
14828  SCIP_CALL( SCIPreallocBufferArray(scip, &vars, varssize) );
14829  SCIP_CALL( SCIPreallocBufferArray(scip, &exponents, varssize) );
14830  }
14831  assert(vars != NULL);
14832  assert(exponents != NULL);
14833 
14834  vars[nvars] = var;
14835  exponents[nvars] = 1.0;
14836  ++nvars;
14837 
14838  str = *endptr;
14839 
14840  if( *str == '^' )
14841  state = SCIPPARSEPOLYNOMIAL_STATE_EXPONENT;
14842  else
14843  state = SCIPPARSEPOLYNOMIAL_STATE_INTERMED;
14844 
14845  break;
14846  }
14847 
14848  case SCIPPARSEPOLYNOMIAL_STATE_EXPONENT:
14849  {
14850  assert(*str == '^');
14851  assert(nvars > 0); /* we should be in a monomial that has already a variable */
14852  assert(exponents != NULL);
14853  ++str;
14854 
14855  if( !SCIPstrToRealValue(str, &exponents[nvars-1], endptr) )
14856  {
14857  SCIPerrorMessage("could not parse number in the beginning of '%s'\n", str);
14858  state = SCIPPARSEPOLYNOMIAL_STATE_ERROR;
14859  break;
14860  }
14861  str = *endptr;
14862 
14863  /* after the exponent we go into the intermediate state, i.e., expecting next variables */
14864  state = SCIPPARSEPOLYNOMIAL_STATE_INTERMED;
14865  break;
14866  }
14867 
14868  case SCIPPARSEPOLYNOMIAL_STATE_END:
14869  case SCIPPARSEPOLYNOMIAL_STATE_ERROR:
14870  default:
14871  SCIPerrorMessage("unexpected state\n");
14872  return SCIP_READERROR;
14873  }
14874  }
14875 
14876  /* set end pointer */
14877  *endptr = (char*)str;
14878 
14879  /* check state at end of string */
14880  switch( state )
14881  {
14882  case SCIPPARSEPOLYNOMIAL_STATE_BEGIN:
14883  case SCIPPARSEPOLYNOMIAL_STATE_END:
14884  case SCIPPARSEPOLYNOMIAL_STATE_INTERMED:
14885  {
14886  if( coef != SCIP_INVALID ) /*lint !e777*/
14887  {
14888  /* push last monomial */
14889  SCIPdebugMessage("push monomial with coefficient <%g> and <%d> vars\n", coef, nvars);
14890  if( monomialssize <= *nmonomials )
14891  {
14892  monomialssize = *nmonomials+1;
14893  SCIP_CALL( SCIPreallocBufferArray(scip, monomialvars, monomialssize) );
14894  SCIP_CALL( SCIPreallocBufferArray(scip, monomialexps, monomialssize) );
14895  SCIP_CALL( SCIPreallocBufferArray(scip, monomialnvars, monomialssize) );
14896  SCIP_CALL( SCIPreallocBufferArray(scip, monomialcoefs, monomialssize) );
14897  }
14898 
14899  if( nvars > 0 )
14900  {
14901  /* shrink vars and exponents array to needed size and take over ownership */
14902  SCIP_CALL( SCIPreallocBufferArray(scip, &vars, nvars) );
14903  SCIP_CALL( SCIPreallocBufferArray(scip, &exponents, nvars) );
14904  (*monomialvars)[*nmonomials] = vars;
14905  (*monomialexps)[*nmonomials] = exponents;
14906  vars = NULL;
14907  exponents = NULL;
14908  }
14909  else
14910  {
14911  (*monomialvars)[*nmonomials] = NULL;
14912  (*monomialexps)[*nmonomials] = NULL;
14913  }
14914  (*monomialcoefs)[*nmonomials] = coef;
14915  (*monomialnvars)[*nmonomials] = nvars;
14916  ++*nmonomials;
14917  }
14918 
14919  *success = TRUE;
14920  break;
14921  }
14922 
14923  case SCIPPARSEPOLYNOMIAL_STATE_COEF:
14924  case SCIPPARSEPOLYNOMIAL_STATE_VARS:
14925  case SCIPPARSEPOLYNOMIAL_STATE_EXPONENT:
14926  {
14927  SCIPerrorMessage("unexpected parsing state at end of polynomial string\n");
14928  }
14929  /*lint -fallthrough*/
14930  case SCIPPARSEPOLYNOMIAL_STATE_ERROR:
14931  assert(!*success);
14932  break;
14933  }
14934 
14935  /* free memory to store current monomial, if still existing */
14936  SCIPfreeBufferArrayNull(scip, &vars);
14937  SCIPfreeBufferArrayNull(scip, &exponents);
14938 
14939  if( *success && *nmonomials > 0 )
14940  {
14941  /* shrink arrays to required size, so we do not need to keep monomialssize around */
14942  assert(*nmonomials <= monomialssize);
14943  SCIP_CALL( SCIPreallocBufferArray(scip, monomialvars, *nmonomials) );
14944  SCIP_CALL( SCIPreallocBufferArray(scip, monomialexps, *nmonomials) );
14945  SCIP_CALL( SCIPreallocBufferArray(scip, monomialnvars, *nmonomials) );
14946  SCIP_CALL( SCIPreallocBufferArray(scip, monomialcoefs, *nmonomials) );
14947 
14948  /* SCIPwriteVarsPolynomial(scip, NULL, *monomialvars, *monomialexps, *monomialcoefs, *monomialnvars, *nmonomials, FALSE); */
14949  }
14950  else
14951  {
14952  /* in case of error, cleanup all data here */
14953  SCIPfreeParseVarsPolynomialData(scip, monomialvars, monomialexps, monomialcoefs, monomialnvars, *nmonomials);
14954  *nmonomials = 0;
14955  }
14956 
14957  return SCIP_OKAY;
14958 }
14959 
14960 /** frees memory allocated when parsing a polynomial from a string
14961  *
14962  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
14963  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
14964  *
14965  * @pre This method can be called if @p scip is in one of the following stages:
14966  * - \ref SCIP_STAGE_PROBLEM
14967  * - \ref SCIP_STAGE_TRANSFORMING
14968  * - \ref SCIP_STAGE_INITPRESOLVE
14969  * - \ref SCIP_STAGE_PRESOLVING
14970  * - \ref SCIP_STAGE_EXITPRESOLVE
14971  * - \ref SCIP_STAGE_PRESOLVED
14972  * - \ref SCIP_STAGE_SOLVING
14973  */
14975  SCIP* scip, /**< SCIP data structure */
14976  SCIP_VAR**** monomialvars, /**< pointer to store arrays with variables for each monomial */
14977  SCIP_Real*** monomialexps, /**< pointer to store arrays with variable exponents */
14978  SCIP_Real** monomialcoefs, /**< pointer to store array with monomial coefficients */
14979  int** monomialnvars, /**< pointer to store array with number of variables for each monomial */
14980  int nmonomials /**< pointer to store number of parsed monomials */
14981  )
14982 {
14983  int i;
14984 
14985  assert(scip != NULL);
14986  assert(monomialvars != NULL);
14987  assert(monomialexps != NULL);
14988  assert(monomialcoefs != NULL);
14989  assert(monomialnvars != NULL);
14990  assert((*monomialvars != NULL) == (nmonomials > 0));
14991  assert((*monomialexps != NULL) == (nmonomials > 0));
14992  assert((*monomialcoefs != NULL) == (nmonomials > 0));
14993  assert((*monomialnvars != NULL) == (nmonomials > 0));
14994 
14995  SCIP_CALL_ABORT( checkStage(scip, "SCIPfreeParseVarsPolynomialData", FALSE, TRUE, TRUE, FALSE, TRUE, TRUE, TRUE, TRUE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) );
14996 
14997  if( nmonomials == 0 )
14998  return;
14999 
15000  for( i = nmonomials - 1; i >= 0; --i )
15001  {
15002  SCIPfreeBufferArrayNull(scip, &(*monomialvars)[i]);
15003  SCIPfreeBufferArrayNull(scip, &(*monomialexps)[i]);
15004  }
15005 
15006  SCIPfreeBufferArray(scip, monomialvars);
15007  SCIPfreeBufferArray(scip, monomialexps);
15008  SCIPfreeBufferArray(scip, monomialcoefs);
15009  SCIPfreeBufferArray(scip, monomialnvars);
15010 }
15011 
15012 /** increases usage counter of variable
15013  *
15014  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
15015  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
15016  *
15017  * @pre This method can be called if @p scip is in one of the following stages:
15018  * - \ref SCIP_STAGE_PROBLEM
15019  * - \ref SCIP_STAGE_TRANSFORMING
15020  * - \ref SCIP_STAGE_TRANSFORMED
15021  * - \ref SCIP_STAGE_INITPRESOLVE
15022  * - \ref SCIP_STAGE_PRESOLVING
15023  * - \ref SCIP_STAGE_EXITPRESOLVE
15024  * - \ref SCIP_STAGE_PRESOLVED
15025  * - \ref SCIP_STAGE_INITSOLVE
15026  * - \ref SCIP_STAGE_SOLVING
15027  * - \ref SCIP_STAGE_SOLVED
15028  * - \ref SCIP_STAGE_EXITSOLVE
15029  */
15031  SCIP* scip, /**< SCIP data structure */
15032  SCIP_VAR* var /**< variable to capture */
15033  )
15034 {
15035  SCIP_CALL( checkStage(scip, "SCIPcaptureVar", FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE) );
15036 
15037  SCIPvarCapture(var);
15038 
15039  return SCIP_OKAY;
15040 }
15041 
15042 /** decreases usage counter of variable, if the usage pointer reaches zero the variable gets freed
15043  *
15044  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
15045  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
15046  *
15047  * @pre This method can be called if @p scip is in one of the following stages:
15048  * - \ref SCIP_STAGE_PROBLEM
15049  * - \ref SCIP_STAGE_TRANSFORMING
15050  * - \ref SCIP_STAGE_TRANSFORMED
15051  * - \ref SCIP_STAGE_INITPRESOLVE
15052  * - \ref SCIP_STAGE_PRESOLVING
15053  * - \ref SCIP_STAGE_EXITPRESOLVE
15054  * - \ref SCIP_STAGE_PRESOLVED
15055  * - \ref SCIP_STAGE_INITSOLVE
15056  * - \ref SCIP_STAGE_SOLVING
15057  * - \ref SCIP_STAGE_SOLVED
15058  * - \ref SCIP_STAGE_EXITSOLVE
15059  * - \ref SCIP_STAGE_FREETRANS
15060  *
15061  * @note the pointer of the variable will be NULLed
15062  */
15064  SCIP* scip, /**< SCIP data structure */
15065  SCIP_VAR** var /**< pointer to variable */
15066  )
15067 {
15068  assert(var != NULL);
15069  assert(*var != NULL);
15070 
15071  SCIP_CALL( checkStage(scip, "SCIPreleaseVar", FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE) );
15072 
15073  switch( scip->set->stage )
15074  {
15075  case SCIP_STAGE_PROBLEM:
15076  SCIP_CALL( SCIPvarRelease(var, scip->mem->probmem, scip->set, scip->eventqueue, scip->lp) );
15077  return SCIP_OKAY;
15078 
15082  case SCIP_STAGE_PRESOLVING:
15084  case SCIP_STAGE_PRESOLVED:
15085  case SCIP_STAGE_INITSOLVE:
15086  case SCIP_STAGE_SOLVING:
15087  case SCIP_STAGE_SOLVED:
15088  case SCIP_STAGE_EXITSOLVE:
15089  case SCIP_STAGE_FREETRANS:
15090  if( !SCIPvarIsTransformed(*var) && (*var)->nuses == 1 )
15091  {
15092  SCIPerrorMessage("cannot release last use of original variable while the transformed problem exists\n");
15093  return SCIP_INVALIDCALL;
15094  }
15095  SCIP_CALL( SCIPvarRelease(var, scip->mem->probmem, scip->set, scip->eventqueue, scip->lp) );
15096  return SCIP_OKAY;
15097 
15098  default:
15099  SCIPerrorMessage("invalid SCIP stage <%d>\n", scip->set->stage);
15100  return SCIP_INVALIDCALL;
15101  } /*lint !e788*/
15102 }
15103 
15104 /** changes the name of a variable
15105  *
15106  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
15107  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
15108  *
15109  * @pre This method can only be called if @p scip is in stage \ref SCIP_STAGE_PROBLEM
15110  *
15111  * @note to get the current name of a variable, use SCIPvarGetName() from pub_var.h
15112  */
15114  SCIP* scip, /**< SCIP data structure */
15115  SCIP_VAR* var, /**< variable */
15116  const char* name /**< new name of constraint */
15117  )
15118 {
15119  SCIP_CALL( checkStage(scip, "SCIPchgVarName", FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE) );
15120 
15121  if( SCIPgetStage(scip) != SCIP_STAGE_PROBLEM )
15122  {
15123  SCIPerrorMessage("variable names can only be changed in problem creation stage\n");
15124  SCIPABORT();
15125  return SCIP_INVALIDCALL; /*lint !e527*/
15126  }
15127 
15128  /* remove variable's name from the namespace if the variable was already added */
15129  if( SCIPvarGetProbindex(var) != -1 )
15130  {
15131  SCIP_CALL( SCIPprobRemoveVarName(scip->origprob, var) );
15132  }
15133 
15134  /* change variable name */
15135  SCIP_CALL( SCIPvarChgName(var, SCIPblkmem(scip), name) );
15136 
15137  /* add variable's name to the namespace if the variable was already added */
15138  if( SCIPvarGetProbindex(var) != -1 )
15139  {
15140  SCIP_CALL( SCIPprobAddVarName(scip->origprob, var) );
15141  }
15142 
15143  return SCIP_OKAY;
15144 }
15145 
15146 /** gets and captures transformed variable of a given variable; if the variable is not yet transformed,
15147  * a new transformed variable for this variable is created
15148  *
15149  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
15150  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
15151  *
15152  * @pre This method can be called if @p scip is in one of the following stages:
15153  * - \ref SCIP_STAGE_TRANSFORMING
15154  * - \ref SCIP_STAGE_TRANSFORMED
15155  * - \ref SCIP_STAGE_INITPRESOLVE
15156  * - \ref SCIP_STAGE_PRESOLVING
15157  * - \ref SCIP_STAGE_EXITPRESOLVE
15158  * - \ref SCIP_STAGE_PRESOLVED
15159  * - \ref SCIP_STAGE_INITSOLVE
15160  * - \ref SCIP_STAGE_SOLVING
15161  */
15163  SCIP* scip, /**< SCIP data structure */
15164  SCIP_VAR* var, /**< variable to get/create transformed variable for */
15165  SCIP_VAR** transvar /**< pointer to store the transformed variable */
15166  )
15167 {
15168  assert(transvar != NULL);
15169 
15170  SCIP_CALL( checkStage(scip, "SCIPtransformVar", FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE) );
15171 
15172  if( SCIPvarIsTransformed(var) )
15173  {
15174  *transvar = var;
15175  SCIPvarCapture(*transvar);
15176  }
15177  else
15178  {
15179  SCIP_CALL( SCIPvarTransform(var, scip->mem->probmem, scip->set, scip->stat, scip->origprob->objsense, transvar) );
15180  }
15181 
15182  return SCIP_OKAY;
15183 }
15184 
15185 /** gets and captures transformed variables for an array of variables;
15186  * if a variable of the array is not yet transformed, a new transformed variable for this variable is created;
15187  * it is possible to call this method with vars == transvars
15188  *
15189  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
15190  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
15191  *
15192  * @pre This method can be called if @p scip is in one of the following stages:
15193  * - \ref SCIP_STAGE_TRANSFORMING
15194  * - \ref SCIP_STAGE_TRANSFORMED
15195  * - \ref SCIP_STAGE_INITPRESOLVE
15196  * - \ref SCIP_STAGE_PRESOLVING
15197  * - \ref SCIP_STAGE_EXITPRESOLVE
15198  * - \ref SCIP_STAGE_PRESOLVED
15199  * - \ref SCIP_STAGE_INITSOLVE
15200  * - \ref SCIP_STAGE_SOLVING
15201  */
15203  SCIP* scip, /**< SCIP data structure */
15204  int nvars, /**< number of variables to get/create transformed variables for */
15205  SCIP_VAR** vars, /**< array with variables to get/create transformed variables for */
15206  SCIP_VAR** transvars /**< array to store the transformed variables */
15207  )
15208 {
15209  int v;
15210 
15211  assert(nvars == 0 || vars != NULL);
15212  assert(nvars == 0 || transvars != NULL);
15213 
15214  SCIP_CALL( checkStage(scip, "SCIPtransformVars", FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE) );
15215 
15216  for( v = 0; v < nvars; ++v )
15217  {
15218  if( SCIPvarIsTransformed(vars[v]) )
15219  {
15220  transvars[v] = vars[v];
15221  SCIPvarCapture(transvars[v]);
15222  }
15223  else
15224  {
15225  SCIP_CALL( SCIPvarTransform(vars[v], scip->mem->probmem, scip->set, scip->stat, scip->origprob->objsense,
15226  &transvars[v]) );
15227  }
15228  }
15229 
15230  return SCIP_OKAY;
15231 }
15232 
15233 /** gets corresponding transformed variable of a given variable;
15234  * returns NULL as transvar, if transformed variable is not yet existing
15235  *
15236  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
15237  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
15238  *
15239  * @pre This method can be called if @p scip is in one of the following stages:
15240  * - \ref SCIP_STAGE_TRANSFORMING
15241  * - \ref SCIP_STAGE_TRANSFORMED
15242  * - \ref SCIP_STAGE_INITPRESOLVE
15243  * - \ref SCIP_STAGE_PRESOLVING
15244  * - \ref SCIP_STAGE_EXITPRESOLVE
15245  * - \ref SCIP_STAGE_PRESOLVED
15246  * - \ref SCIP_STAGE_INITSOLVE
15247  * - \ref SCIP_STAGE_SOLVING
15248  * - \ref SCIP_STAGE_SOLVED
15249  * - \ref SCIP_STAGE_EXITSOLVE
15250  * - \ref SCIP_STAGE_FREETRANS
15251  */
15253  SCIP* scip, /**< SCIP data structure */
15254  SCIP_VAR* var, /**< variable to get transformed variable for */
15255  SCIP_VAR** transvar /**< pointer to store the transformed variable */
15256  )
15257 {
15258  assert(transvar != NULL);
15259 
15260  SCIP_CALL( checkStage(scip, "SCIPgetTransformedVar", FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE) );
15261 
15262  if( SCIPvarIsTransformed(var) )
15263  *transvar = var;
15264  else
15265  {
15266  SCIP_CALL( SCIPvarGetTransformed(var, scip->mem->probmem, scip->set, scip->stat, transvar) );
15267  }
15268 
15269  return SCIP_OKAY;
15270 }
15271 
15272 /** gets corresponding transformed variables for an array of variables;
15273  * stores NULL in a transvars slot, if the transformed variable is not yet existing;
15274  * it is possible to call this method with vars == transvars, but remember that variables that are not
15275  * yet transformed will be replaced with NULL
15276  *
15277  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
15278  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
15279  *
15280  * @pre This method can be called if @p scip is in one of the following stages:
15281  * - \ref SCIP_STAGE_TRANSFORMING
15282  * - \ref SCIP_STAGE_TRANSFORMED
15283  * - \ref SCIP_STAGE_INITPRESOLVE
15284  * - \ref SCIP_STAGE_PRESOLVING
15285  * - \ref SCIP_STAGE_EXITPRESOLVE
15286  * - \ref SCIP_STAGE_PRESOLVED
15287  * - \ref SCIP_STAGE_INITSOLVE
15288  * - \ref SCIP_STAGE_SOLVING
15289  * - \ref SCIP_STAGE_SOLVED
15290  * - \ref SCIP_STAGE_EXITSOLVE
15291  * - \ref SCIP_STAGE_FREETRANS
15292  */
15294  SCIP* scip, /**< SCIP data structure */
15295  int nvars, /**< number of variables to get transformed variables for */
15296  SCIP_VAR** vars, /**< array with variables to get transformed variables for */
15297  SCIP_VAR** transvars /**< array to store the transformed variables */
15298  )
15299 {
15300  int v;
15301 
15302  assert(nvars == 0 || vars != NULL);
15303  assert(nvars == 0 || transvars != NULL);
15304 
15305  SCIP_CALL( checkStage(scip, "SCIPgetTransformedVars", FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE) );
15306 
15307  for( v = 0; v < nvars; ++v )
15308  {
15309  if( SCIPvarIsTransformed(vars[v]) )
15310  transvars[v] = vars[v];
15311  else
15312  {
15313  SCIP_CALL( SCIPvarGetTransformed(vars[v], scip->mem->probmem, scip->set, scip->stat, &transvars[v]) );
15314  }
15315  }
15316 
15317  return SCIP_OKAY;
15318 }
15319 
15320 /** gets negated variable x' = lb + ub - x of variable x; negated variable is created, if not yet existing
15321  *
15322  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
15323  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
15324  *
15325  * @pre This method can be called if @p scip is in one of the following stages:
15326  * - \ref SCIP_STAGE_PROBLEM
15327  * - \ref SCIP_STAGE_TRANSFORMING
15328  * - \ref SCIP_STAGE_TRANSFORMED
15329  * - \ref SCIP_STAGE_INITPRESOLVE
15330  * - \ref SCIP_STAGE_PRESOLVING
15331  * - \ref SCIP_STAGE_EXITPRESOLVE
15332  * - \ref SCIP_STAGE_PRESOLVED
15333  * - \ref SCIP_STAGE_INITSOLVE
15334  * - \ref SCIP_STAGE_SOLVING
15335  * - \ref SCIP_STAGE_SOLVED
15336  * - \ref SCIP_STAGE_EXITSOLVE
15337  * - \ref SCIP_STAGE_FREETRANS
15338  */
15340  SCIP* scip, /**< SCIP data structure */
15341  SCIP_VAR* var, /**< variable to get negated variable for */
15342  SCIP_VAR** negvar /**< pointer to store the negated variable */
15343  )
15344 {
15345  SCIP_CALL( checkStage(scip, "SCIPgetNegatedVar", FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE) );
15346 
15347  SCIP_CALL( SCIPvarNegate(var, scip->mem->probmem, scip->set, scip->stat, negvar) );
15348 
15349  return SCIP_OKAY;
15350 }
15351 
15352 /** gets negated variables x' = lb + ub - x of variables x; negated variables are created, if not yet existing
15353  *
15354  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
15355  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
15356  *
15357  * @pre This method can be called if @p scip is in one of the following stages:
15358  * - \ref SCIP_STAGE_PROBLEM
15359  * - \ref SCIP_STAGE_TRANSFORMING
15360  * - \ref SCIP_STAGE_TRANSFORMED
15361  * - \ref SCIP_STAGE_INITPRESOLVE
15362  * - \ref SCIP_STAGE_PRESOLVING
15363  * - \ref SCIP_STAGE_EXITPRESOLVE
15364  * - \ref SCIP_STAGE_PRESOLVED
15365  * - \ref SCIP_STAGE_INITSOLVE
15366  * - \ref SCIP_STAGE_SOLVING
15367  * - \ref SCIP_STAGE_SOLVED
15368  * - \ref SCIP_STAGE_EXITSOLVE
15369  * - \ref SCIP_STAGE_FREETRANS
15370  */
15372  SCIP* scip, /**< SCIP data structure */
15373  int nvars, /**< number of variables to get negated variables for */
15374  SCIP_VAR** vars, /**< array of variables to get negated variables for */
15375  SCIP_VAR** negvars /**< array to store the negated variables */
15376  )
15377 {
15378  int v;
15379 
15380  SCIP_CALL( checkStage(scip, "SCIPgetNegatedVars", FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE) );
15381 
15382  for( v = 0; v < nvars; ++v )
15383  {
15384  SCIP_CALL( SCIPvarNegate(vars[v], scip->mem->probmem, scip->set, scip->stat, &(negvars[v])) );
15385  }
15386 
15387  return SCIP_OKAY;
15388 }
15389 
15390 /** gets a binary variable that is equal to the given binary variable, and that is either active, fixed, or
15391  * multi-aggregated, or the negated variable of an active, fixed, or multi-aggregated variable
15392  *
15393  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
15394  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
15395  *
15396  * @pre This method can be called if @p scip is in one of the following stages:
15397  * - \ref SCIP_STAGE_PROBLEM
15398  * - \ref SCIP_STAGE_TRANSFORMED
15399  * - \ref SCIP_STAGE_INITPRESOLVE
15400  * - \ref SCIP_STAGE_PRESOLVING
15401  * - \ref SCIP_STAGE_EXITPRESOLVE
15402  * - \ref SCIP_STAGE_PRESOLVED
15403  * - \ref SCIP_STAGE_INITSOLVE
15404  * - \ref SCIP_STAGE_SOLVING
15405  * - \ref SCIP_STAGE_SOLVED
15406  * - \ref SCIP_STAGE_EXITSOLVE
15407  */
15409  SCIP* scip, /**< SCIP data structure */
15410  SCIP_VAR* var, /**< binary variable to get binary representative for */
15411  SCIP_VAR** repvar, /**< pointer to store the binary representative */
15412  SCIP_Bool* negated /**< pointer to store whether the negation of an active variable was returned */
15413  )
15414 {
15415  assert(scip != NULL);
15416  assert(var != NULL);
15417  assert(repvar != NULL);
15418  assert(negated != NULL);
15419 
15420  SCIP_CALL( checkStage(scip, "SCIPgetBinvarRepresentative", FALSE, TRUE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE) );
15421 
15422  /* get the active representative of the given variable */
15423  *repvar = var;
15424  *negated = FALSE;
15425  SCIP_CALL( SCIPvarGetProbvarBinary(repvar, negated) );
15426 
15427  /* negate the representative, if it corresponds to the negation of the given variable */
15428  if( *negated )
15429  {
15430  SCIP_CALL( SCIPgetNegatedVar(scip, *repvar, repvar) );
15431  }
15432 
15433  return SCIP_OKAY;
15434 }
15435 
15436 /** gets binary variables that are equal to the given binary variables, and which are either active, fixed, or
15437  * multi-aggregated, or the negated variables of active, fixed, or multi-aggregated variables
15438  *
15439  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
15440  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
15441  *
15442  * @pre This method can be called if @p scip is in one of the following stages:
15443  * - \ref SCIP_STAGE_PROBLEM
15444  * - \ref SCIP_STAGE_TRANSFORMED
15445  * - \ref SCIP_STAGE_INITPRESOLVE
15446  * - \ref SCIP_STAGE_PRESOLVING
15447  * - \ref SCIP_STAGE_EXITPRESOLVE
15448  * - \ref SCIP_STAGE_PRESOLVED
15449  * - \ref SCIP_STAGE_INITSOLVE
15450  * - \ref SCIP_STAGE_SOLVING
15451  * - \ref SCIP_STAGE_SOLVED
15452  * - \ref SCIP_STAGE_EXITSOLVE
15453  */
15455  SCIP* scip, /**< SCIP data structure */
15456  int nvars, /**< number of binary variables to get representatives for */
15457  SCIP_VAR** vars, /**< binary variables to get binary representatives for */
15458  SCIP_VAR** repvars, /**< array to store the binary representatives */
15459  SCIP_Bool* negated /**< array to store whether the negation of an active variable was returned */
15460  )
15461 {
15462  int v;
15463 
15464  assert(scip != NULL);
15465  assert(vars != NULL || nvars == 0);
15466  assert(repvars != NULL || nvars == 0);
15467  assert(negated != NULL || nvars == 0);
15468 
15469  SCIP_CALL( checkStage(scip, "SCIPgetBinvarRepresentatives", FALSE, TRUE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE) );
15470 
15471  if( nvars == 0 )
15472  return SCIP_OKAY;
15473 
15474  /* get the active representative of the given variable */
15475  BMScopyMemoryArray(repvars, vars, nvars);
15476  BMSclearMemoryArray(negated, nvars);
15477  SCIP_CALL( SCIPvarsGetProbvarBinary(&repvars, &negated, nvars) );
15478 
15479  /* negate the representatives, if they correspond to the negation of the given variables */
15480  for( v = nvars - 1; v >= 0; --v )
15481  if( negated[v] )
15482  {
15483  SCIP_CALL( SCIPgetNegatedVar(scip, repvars[v], &(repvars[v])) );
15484  }
15485 
15486  return SCIP_OKAY;
15487 }
15488 
15489 /** flattens aggregation graph of multi-aggregated variable in order to avoid exponential recursion later on
15490  *
15491  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
15492  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
15493  *
15494  * @pre This method can be called if @p scip is in one of the following stages:
15495  * - \ref SCIP_STAGE_INITPRESOLVE
15496  * - \ref SCIP_STAGE_PRESOLVING
15497  * - \ref SCIP_STAGE_EXITPRESOLVE
15498  * - \ref SCIP_STAGE_PRESOLVED
15499  * - \ref SCIP_STAGE_INITSOLVE
15500  * - \ref SCIP_STAGE_SOLVING
15501  * - \ref SCIP_STAGE_SOLVED
15502  */
15504  SCIP* scip, /**< SCIP data structure */
15505  SCIP_VAR* var /**< problem variable */
15506  )
15507 {
15508  assert( scip != NULL );
15509  assert( var != NULL );
15510  SCIP_CALL( checkStage(scip, "SCIPflattenVarAggregationGraph", FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE) );
15511 
15512  SCIP_CALL( SCIPvarFlattenAggregationGraph(var, scip->mem->probmem, scip->set) );
15513  return SCIP_OKAY;
15514 }
15515 
15516 /** Transforms a given linear sum of variables, that is a_1*x_1 + ... + a_n*x_n + c into a corresponding linear sum of
15517  * active variables, that is b_1*y_1 + ... + b_m*y_m + d.
15518  *
15519  * If the number of needed active variables is greater than the available slots in the variable array, nothing happens
15520  * except that the required size is stored in the corresponding variable (requiredsize). Otherwise, the active variable
15521  * representation is stored in the variable array, scalar array and constant.
15522  *
15523  * The reason for this approach is that we cannot reallocate memory, since we do not know how the memory has been
15524  * allocated (e.g., by a C++ 'new' or SCIP functions).
15525  *
15526  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
15527  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
15528  *
15529  * @pre This method can be called if @p scip is in one of the following stages:
15530  * - \ref SCIP_STAGE_TRANSFORMED
15531  * - \ref SCIP_STAGE_INITPRESOLVE
15532  * - \ref SCIP_STAGE_PRESOLVING
15533  * - \ref SCIP_STAGE_EXITPRESOLVE
15534  * - \ref SCIP_STAGE_PRESOLVED
15535  * - \ref SCIP_STAGE_INITSOLVE
15536  * - \ref SCIP_STAGE_SOLVING
15537  * - \ref SCIP_STAGE_SOLVED
15538  * - \ref SCIP_STAGE_EXITSOLVE
15539  * - \ref SCIP_STAGE_FREETRANS
15540  *
15541  * @note The resulting linear sum is stored into the given variable array, scalar array, and constant. That means the
15542  * given entries are overwritten.
15543  *
15544  * @note That method can be used to convert a single variables into variable space of active variables. Therefore call
15545  * the method with the linear sum 1.0*x + 0.0.
15546  */
15548  SCIP* scip, /**< SCIP data structure */
15549  SCIP_VAR** vars, /**< variable array x_1, ..., x_n in the linear sum which will be
15550  * overwritten by the variable array y_1, ..., y_m in the linear sum
15551  * w.r.t. active variables */
15552  SCIP_Real* scalars, /**< scalars a_1, ..., a_n in linear sum which will be overwritten to the
15553  * scalars b_1, ..., b_m in the linear sum of the active variables */
15554  int* nvars, /**< pointer to number of variables in the linear sum which will be
15555  * overwritten by the number of variables in the linear sum corresponding
15556  * to the active variables */
15557  int varssize, /**< available slots in vars and scalars array which is needed to check if
15558  * the array are large enough for the linear sum w.r.t. active
15559  * variables */
15560  SCIP_Real* constant, /**< pointer to constant c in linear sum a_1*x_1 + ... + a_n*x_n + c which
15561  * will chnage to constant d in the linear sum b_1*y_1 + ... + b_m*y_m +
15562  * d w.r.t. the active variables */
15563  int* requiredsize, /**< pointer to store the required array size for the linear sum w.r.t. the
15564  * active variables */
15565  SCIP_Bool mergemultiples /**< should multiple occurrences of a var be replaced by a single coeff? */
15566  )
15567 {
15568  assert( scip != NULL );
15569  assert( nvars != NULL );
15570  assert( vars != NULL || *nvars == 0 );
15571  assert( scalars != NULL || *nvars == 0 );
15572  assert( constant != NULL );
15573  assert( requiredsize != NULL );
15574  assert( *nvars <= varssize );
15575 
15576  SCIP_CALL( checkStage(scip, "SCIPgetProbvarLinearSum", FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE) );
15577  SCIP_CALL( SCIPvarGetActiveRepresentatives(scip->set, vars, scalars, nvars, varssize, constant, requiredsize, mergemultiples) );
15578 
15579  return SCIP_OKAY;
15580 }
15581 
15582 /** transforms given variable, scalar and constant to the corresponding active, fixed, or
15583  * multi-aggregated variable, scalar and constant; if the variable resolves to a fixed variable,
15584  * "scalar" will be 0.0 and the value of the sum will be stored in "constant"; a multi-aggregation
15585  * with only one active variable (this can happen due to fixings after the multi-aggregation),
15586  * is treated like an aggregation; if the multi-aggregation constant is infinite, "scalar" will be 0.0
15587  *
15588  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
15589  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
15590  *
15591  * @pre This method can be called if @p scip is in one of the following stages:
15592  * - \ref SCIP_STAGE_TRANSFORMED
15593  * - \ref SCIP_STAGE_INITPRESOLVE
15594  * - \ref SCIP_STAGE_PRESOLVING
15595  * - \ref SCIP_STAGE_EXITPRESOLVE
15596  * - \ref SCIP_STAGE_PRESOLVED
15597  * - \ref SCIP_STAGE_INITSOLVE
15598  * - \ref SCIP_STAGE_SOLVING
15599  * - \ref SCIP_STAGE_SOLVED
15600  * - \ref SCIP_STAGE_EXITSOLVE
15601  * - \ref SCIP_STAGE_FREETRANS
15602  */
15604  SCIP* scip, /**< SCIP data structure */
15605  SCIP_VAR** var, /**< pointer to problem variable x in sum a*x + c */
15606  SCIP_Real* scalar, /**< pointer to scalar a in sum a*x + c */
15607  SCIP_Real* constant /**< pointer to constant c in sum a*x + c */
15608  )
15609 {
15610  assert(scip != NULL);
15611  assert(var != NULL);
15612  assert(scalar != NULL);
15613  assert(constant != NULL);
15614 
15615  SCIP_CALL( checkStage(scip, "SCIPgetProbvarSum", FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE) );
15616  SCIP_CALL( SCIPvarGetProbvarSum(var, scip->set, scalar, constant) );
15617 
15618  return SCIP_OKAY;
15619 }
15620 
15621 /** return for given variables all their active counterparts; all active variables will be pairwise different
15622  * @note It does not hold that the first output variable is the active variable for the first input variable.
15623  *
15624  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
15625  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
15626  *
15627  * @pre This method can be called if @p scip is in one of the following stages:
15628  * - \ref SCIP_STAGE_TRANSFORMED
15629  * - \ref SCIP_STAGE_INITPRESOLVE
15630  * - \ref SCIP_STAGE_PRESOLVING
15631  * - \ref SCIP_STAGE_EXITPRESOLVE
15632  * - \ref SCIP_STAGE_PRESOLVED
15633  * - \ref SCIP_STAGE_INITSOLVE
15634  * - \ref SCIP_STAGE_SOLVING
15635  * - \ref SCIP_STAGE_SOLVED
15636  * - \ref SCIP_STAGE_EXITSOLVE
15637  * - \ref SCIP_STAGE_FREETRANS
15638  */
15640  SCIP* scip, /**< SCIP data structure */
15641  SCIP_VAR** vars, /**< variable array with given variables and as output all active
15642  * variables, if enough slots exist
15643  */
15644  int* nvars, /**< number of given variables, and as output number of active variables,
15645  * if enough slots exist
15646  */
15647  int varssize, /**< available slots in vars array */
15648  int* requiredsize /**< pointer to store the required array size for the active variables */
15649  )
15650 {
15651  assert(scip != NULL);
15652  assert(nvars != NULL);
15653  assert(vars != NULL || *nvars == 0);
15654  assert(varssize >= *nvars);
15655  assert(requiredsize != NULL);
15656 
15657  SCIP_CALL( checkStage(scip, "SCIPgetActiveVars", FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE) );
15658  SCIP_CALL( SCIPvarsGetActiveVars(scip->set, vars, nvars, varssize, requiredsize) );
15659 
15660  return SCIP_OKAY;
15661 }
15662 
15663 /** returns the reduced costs of the variable in the current node's LP relaxation;
15664  * the current node has to have a feasible LP.
15665  *
15666  * returns SCIP_INVALID if the variable is active but not in the current LP;
15667  * returns 0 if the variable has been aggregated out or fixed in presolving.
15668  *
15669  * @pre This method can only be called if @p scip is in stage \ref SCIP_STAGE_SOLVING
15670  */
15672  SCIP* scip, /**< SCIP data structure */
15673  SCIP_VAR* var /**< variable to get reduced costs, should be a column in current node LP */
15674  )
15675 {
15676  assert(scip != NULL);
15677  assert(var != NULL);
15678 
15679  switch( SCIPvarGetStatus(var) )
15680  {
15682  if( var->data.original.transvar == NULL )
15683  return SCIP_INVALID;
15684  return SCIPgetVarRedcost(scip,var->data.original.transvar);
15685 
15686  case SCIP_VARSTATUS_COLUMN:
15687  return SCIPgetColRedcost(scip, SCIPvarGetCol(var));
15688 
15689  case SCIP_VARSTATUS_LOOSE:
15690  return SCIP_INVALID;
15691 
15692  case SCIP_VARSTATUS_FIXED:
15696  return 0.0;
15697 
15698  default:
15699  SCIPerrorMessage("unknown variable status\n");
15700  SCIPABORT();
15701  return 0.0; /*lint !e527*/
15702  }
15703 }
15704 
15705 /** returns the implied reduced costs of the variable in the current node's LP relaxation;
15706  * the current node has to have a feasible LP.
15707  *
15708  * returns SCIP_INVALID if the variable is active but not in the current LP;
15709  * returns 0 if the variable has been aggregated out or fixed in presolving.
15710  *
15711  * @pre This method can only be called if @p scip is in stage \ref SCIP_STAGE_SOLVING
15712  */
15714  SCIP* scip, /**< SCIP data structure */
15715  SCIP_VAR* var, /**< variable to get reduced costs, should be a column in current node LP */
15716  SCIP_Bool varfixing /**< FALSE if for x == 0, TRUE for x == 1 */
15717  )
15718 {
15719  switch( SCIPvarGetStatus(var) )
15720  {
15722  if( var->data.original.transvar == NULL )
15723  return SCIP_INVALID;
15724  return SCIPgetVarImplRedcost(scip, var->data.original.transvar, varfixing);
15725 
15726  case SCIP_VARSTATUS_COLUMN:
15727  return SCIPvarGetImplRedcost(var, scip->set, varfixing, scip->stat, scip->lp);
15728 
15729  case SCIP_VARSTATUS_LOOSE:
15730  return SCIP_INVALID;
15731 
15732  case SCIP_VARSTATUS_FIXED:
15736  return 0.0;
15737 
15738  default:
15739  SCIPerrorMessage("unknown variable status\n");
15740  SCIPABORT();
15741  return 0.0; /*lint !e527*/
15742  }
15743 }
15744 
15745 
15746 /** returns the Farkas coefficient of the variable in the current node's LP relaxation;
15747  * the current node has to have an infeasible LP.
15748  *
15749  * returns SCIP_INVALID if the variable is active but not in the current LP;
15750  * returns 0 if the variable has been aggregated out or fixed in presolving.
15751  *
15752  * @pre This method can only be called if @p scip is in stage \ref SCIP_STAGE_SOLVING
15753  */
15755  SCIP* scip, /**< SCIP data structure */
15756  SCIP_VAR* var /**< variable to get reduced costs, should be a column in current node LP */
15757  )
15758 {
15759  assert(scip != NULL);
15760  assert(var != NULL);
15761 
15762  switch( SCIPvarGetStatus(var) )
15763  {
15765  if( var->data.original.transvar == NULL )
15766  return SCIP_INVALID;
15767  return SCIPgetVarFarkasCoef(scip,var->data.original.transvar);
15768 
15769  case SCIP_VARSTATUS_COLUMN:
15770  return SCIPgetColFarkasCoef(scip,SCIPvarGetCol(var));
15771 
15772  case SCIP_VARSTATUS_LOOSE:
15773  return SCIP_INVALID;
15774 
15775  case SCIP_VARSTATUS_FIXED:
15779  return 0.0;
15780 
15781  default:
15782  SCIPerrorMessage("unknown variable status\n");
15783  SCIPABORT();
15784  return 0.0; /*lint !e527*/
15785  }
15786 }
15787 
15788 /** gets solution value for variable in current node
15789  *
15790  * @return solution value for variable in current node
15791  *
15792  * @pre This method can be called if @p scip is in one of the following stages:
15793  * - \ref SCIP_STAGE_PRESOLVED
15794  * - \ref SCIP_STAGE_SOLVING
15795  */
15797  SCIP* scip, /**< SCIP data structure */
15798  SCIP_VAR* var /**< variable to get solution value for */
15799  )
15800 {
15801  SCIP_CALL_ABORT( checkStage(scip, "SCIPgetVarSol", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) );
15802 
15803  return SCIPvarGetSol(var, SCIPtreeHasCurrentNodeLP(scip->tree));
15804 }
15805 
15806 /** gets solution values of multiple variables in current node
15807  *
15808  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
15809  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
15810  *
15811  * @pre This method can be called if @p scip is in one of the following stages:
15812  * - \ref SCIP_STAGE_PRESOLVED
15813  * - \ref SCIP_STAGE_SOLVING
15814  */
15816  SCIP* scip, /**< SCIP data structure */
15817  int nvars, /**< number of variables to get solution value for */
15818  SCIP_VAR** vars, /**< array with variables to get value for */
15819  SCIP_Real* vals /**< array to store solution values of variables */
15820  )
15821 {
15822  int v;
15823 
15824  assert(nvars == 0 || vars != NULL);
15825  assert(nvars == 0 || vals != NULL);
15826 
15827  SCIP_CALL( checkStage(scip, "SCIPgetVarSols", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) );
15828 
15829  if( SCIPtreeHasCurrentNodeLP(scip->tree) )
15830  {
15831  for( v = 0; v < nvars; ++v )
15832  vals[v] = SCIPvarGetLPSol(vars[v]);
15833  }
15834  else
15835  {
15836  for( v = 0; v < nvars; ++v )
15837  vals[v] = SCIPvarGetPseudoSol(vars[v]);
15838  }
15839 
15840  return SCIP_OKAY;
15841 }
15842 
15843 /** sets the solution value of all variables in the global relaxation solution to zero
15844  *
15845  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
15846  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
15847  *
15848  * @pre This method can be called if @p scip is in one of the following stages:
15849  * - \ref SCIP_STAGE_PRESOLVED
15850  * - \ref SCIP_STAGE_SOLVING
15851  */
15853  SCIP* scip /**< SCIP data structure */
15854  )
15855 {
15856  SCIP_VAR** vars;
15857  int nvars;
15858  int v;
15859 
15860  assert(scip != NULL);
15861 
15862  SCIP_CALL( checkStage(scip, "SCIPclearRelaxSolVals", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) );
15863 
15864  /* the relaxation solution is already cleared */
15865  if( SCIPrelaxationIsSolZero(scip->relaxation) )
15866  return SCIP_OKAY;
15867 
15868  SCIP_CALL( SCIPgetVarsData(scip, &vars, &nvars, NULL, NULL, NULL, NULL) );
15869 
15870  for( v = 0; v < nvars; v++ )
15871  {
15872  SCIP_CALL( SCIPvarSetRelaxSol(vars[v], scip->set, scip->relaxation, 0.0, FALSE) );
15873  }
15874 
15875  SCIPrelaxationSetSolObj(scip->relaxation, 0.0);
15877 
15878  return SCIP_OKAY;
15879 }
15880 
15881 /** sets the value of the given variable in the global relaxation solution;
15882  * this solution can be filled by the relaxation handlers and can be used by heuristics and for separation;
15883  * You can use SCIPclearRelaxSolVals() to set all values to zero, initially;
15884  * after setting all solution values, you have to call SCIPmarkRelaxSolValid()
15885  * to inform SCIP that the stored solution is valid
15886  *
15887  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
15888  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
15889  *
15890  * @pre This method can be called if @p scip is in one of the following stages:
15891  * - \ref SCIP_STAGE_PRESOLVED
15892  * - \ref SCIP_STAGE_SOLVING
15893  */
15895  SCIP* scip, /**< SCIP data structure */
15896  SCIP_VAR* var, /**< variable to set value for */
15897  SCIP_Real val /**< solution value of variable */
15898  )
15899 {
15900  assert(scip != NULL);
15901 
15902  SCIP_CALL( checkStage(scip, "SCIPsetRelaxSolVal", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) );
15903 
15904  SCIP_CALL( SCIPvarSetRelaxSol(var, scip->set, scip->relaxation, val, TRUE) );
15905 
15906  if( val != 0.0 )
15909 
15910  return SCIP_OKAY;
15911 }
15912 
15913 /** sets the values of the given variables in the global relaxation solution;
15914  * this solution can be filled by the relaxation handlers and can be used by heuristics and for separation;
15915  * the solution is automatically cleared, s.t. all other variables get value 0.0
15916  *
15917  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
15918  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
15919  *
15920  * @pre This method can be called if @p scip is in one of the following stages:
15921  * - \ref SCIP_STAGE_PRESOLVED
15922  * - \ref SCIP_STAGE_SOLVING
15923  */
15925  SCIP* scip, /**< SCIP data structure */
15926  int nvars, /**< number of variables to set relaxation solution value for */
15927  SCIP_VAR** vars, /**< array with variables to set value for */
15928  SCIP_Real* vals /**< array with solution values of variables */
15929  )
15930 {
15931  int v;
15932 
15933  assert(scip != NULL);
15934  assert(nvars == 0 || vars != NULL);
15935  assert(nvars == 0 || vals != NULL);
15936 
15937  SCIP_CALL( checkStage(scip, "SCIPsetRelaxSolVals", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) );
15938 
15940 
15941  for( v = 0; v < nvars; v++ )
15942  {
15943  SCIP_CALL( SCIPvarSetRelaxSol(vars[v], scip->set, scip->relaxation, vals[v], TRUE) );
15944  }
15945 
15948 
15949  return SCIP_OKAY;
15950 }
15951 
15952 /** sets the values of the variables in the global relaxation solution to the values
15953  * in the given primal solution; the relaxation solution can be filled by the relaxation hanlders
15954  * and might be used by heuristics and for separation
15955  *
15956  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
15957  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
15958  *
15959  * @pre This method can be called if @p scip is in one of the following stages:
15960  * - \ref SCIP_STAGE_PRESOLVED
15961  * - \ref SCIP_STAGE_SOLVING
15962  */
15964  SCIP* scip, /**< SCIP data structure */
15965  SCIP_SOL* sol /**< primal relaxation solution */
15966  )
15967 {
15968  SCIP_VAR** vars;
15969  SCIP_Real* vals;
15970  int nvars;
15971  int v;
15972 
15973  assert(scip != NULL);
15974 
15975  SCIP_CALL( checkStage(scip, "SCIPsetRelaxSolValsSol", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) );
15976 
15977  SCIP_CALL( SCIPgetVarsData(scip, &vars, &nvars, NULL, NULL, NULL, NULL) );
15978 
15979  /* alloc buffer array for solution values of the variables and get the values */
15980  SCIP_CALL( SCIPallocBufferArray(scip, &vals, nvars) );
15981  SCIP_CALL( SCIPgetSolVals(scip, sol, nvars, vars, vals) );
15982 
15984 
15985  for( v = 0; v < nvars; v++ )
15986  {
15987  SCIP_CALL( SCIPvarSetRelaxSol(vars[v], scip->set, scip->relaxation, vals[v], FALSE) );
15988  }
15989 
15990  SCIPrelaxationSetSolObj(scip->relaxation, SCIPsolGetObj(sol, scip->set, scip->transprob, scip->origprob));
15991 
15994 
15995  SCIPfreeBufferArray(scip, &vals);
15996 
15997  return SCIP_OKAY;
15998 }
15999 
16000 /** returns whether the relaxation solution is valid
16001  *
16002  * @return TRUE, if the relaxation solution is valid; FALSE, otherwise
16003  *
16004  * @pre This method can be called if @p scip is in one of the following stages:
16005  * - \ref SCIP_STAGE_PRESOLVED
16006  * - \ref SCIP_STAGE_SOLVING
16007  */
16009  SCIP* scip /**< SCIP data structure */
16010  )
16011 {
16012  assert(scip != NULL);
16013 
16014  SCIP_CALL_ABORT( checkStage(scip, "SCIPisRelaxSolValid", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) );
16015 
16016  return SCIPrelaxationIsSolValid(scip->relaxation);
16017 }
16018 
16019 /** informs SCIP, that the relaxation solution is valid
16020  *
16021  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
16022  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
16023  *
16024  * @pre This method can be called if @p scip is in one of the following stages:
16025  * - \ref SCIP_STAGE_PRESOLVED
16026  * - \ref SCIP_STAGE_SOLVING
16027  */
16029  SCIP* scip /**< SCIP data structure */
16030  )
16031 {
16032  assert(scip != NULL);
16033 
16034  SCIP_CALL( checkStage(scip, "SCIPmarkRelaxSolValid", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) );
16035 
16037 
16038  return SCIP_OKAY;
16039 }
16040 
16041 /** informs SCIP, that the relaxation solution is invalid
16042  *
16043  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
16044  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
16045  *
16046  * @pre This method can be called if @p scip is in one of the following stages:
16047  * - \ref SCIP_STAGE_PRESOLVED
16048  * - \ref SCIP_STAGE_SOLVING
16049  */
16051  SCIP* scip /**< SCIP data structure */
16052  )
16053 {
16054  assert(scip != NULL);
16055 
16056  SCIP_CALL( checkStage(scip, "SCIPmarkRelaxSolInvalid", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) );
16057 
16059 
16060  return SCIP_OKAY;
16061 }
16062 
16063 /** gets the relaxation solution value of the given variable
16064  *
16065  * @return the relaxation solution value of the given variable
16066  *
16067  * @pre This method can be called if @p scip is in one of the following stages:
16068  * - \ref SCIP_STAGE_PRESOLVED
16069  * - \ref SCIP_STAGE_SOLVING
16070  */
16072  SCIP* scip, /**< SCIP data structure */
16073  SCIP_VAR* var /**< variable to get value for */
16074  )
16075 {
16076  assert(scip != NULL);
16077  assert(var != NULL);
16078 
16079  SCIP_CALL_ABORT( checkStage(scip, "SCIPgetRelaxSolVal", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) );
16080 
16081  if( !SCIPrelaxationIsSolValid(scip->relaxation) )
16082  {
16083  SCIPerrorMessage("Relaxation Solution is not valid!\n");
16084  SCIPABORT();
16085  return SCIP_INVALID; /*lint !e527*/
16086  }
16087 
16088  return SCIPvarGetRelaxSol(var, scip->set);
16089 }
16090 
16091 /** gets the relaxation solution objective value
16092  *
16093  * @return the objective value of the relaxation solution
16094  *
16095  * @pre This method can be called if @p scip is in one of the following stages:
16096  * - \ref SCIP_STAGE_PRESOLVED
16097  * - \ref SCIP_STAGE_SOLVING
16098  */
16100  SCIP* scip /**< SCIP data structure */
16101  )
16102 {
16103  assert(scip != NULL);
16104 
16105  SCIP_CALL_ABORT( checkStage(scip, "SCIPgetRelaxSolObj", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) );
16106 
16107  if( !SCIPrelaxationIsSolValid(scip->relaxation) )
16108  {
16109  SCIPerrorMessage("Relaxation Solution is not valid!\n");
16110  SCIPABORT();
16111  return SCIP_INVALID; /*lint !e527*/
16112  }
16113 
16114  return SCIPrelaxationGetSolObj(scip->relaxation);
16115 }
16116 
16117 /** start strong branching - call before any strong branching
16118  *
16119  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
16120  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
16121  *
16122  * @pre This method can be called if @p scip is in one of the following stages:
16123  * - \ref SCIP_STAGE_PRESOLVED
16124  * - \ref SCIP_STAGE_SOLVING
16125  *
16126  * @note if propagation is enabled, strong branching is not done directly on the LP, but probing nodes are created
16127  * which allow to perform propagation but also creates some overhead
16128  */
16130  SCIP* scip, /**< SCIP data structure */
16131  SCIP_Bool enablepropagation /**< should propagation be done before solving the strong branching LP? */
16132  )
16133 {
16134  assert( scip != NULL );
16135  SCIP_CALL( checkStage(scip, "SCIPstartStrongbranch", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) );
16136 
16137  assert(!SCIPinProbing(scip));
16138 
16139  SCIPdebugMessage("starting strong branching mode%s: lpcount=%lld\n", enablepropagation ? " with propagation" : "", scip->stat->lpcount - scip->stat->nsbdivinglps);
16140 
16141  /* start probing mode to allow propagation before solving the strong branching LPs; if no propagation should be done,
16142  * start the strong branching mode in the LP interface
16143  */
16144  if( enablepropagation )
16145  {
16146  if( SCIPtreeProbing(scip->tree) )
16147  {
16148  SCIPerrorMessage("cannot start strong branching with propagation while in probing mode\n");
16149  return SCIP_INVALIDCALL;
16150  }
16151 
16152  if( scip->lp != NULL && SCIPlpDiving(scip->lp) )
16153  {
16154  SCIPerrorMessage("cannot start strong branching with propagation while in diving mode\n");
16155  return SCIP_INVALIDCALL;
16156  }
16157 
16158  /* other then in SCIPstartProbing(), we do not disable collecting variable statistics during strong branching;
16159  * we cannot disable it, because the pseudo costs would not be updated, otherwise,
16160  * and reliability branching would end up doing strong branching all the time
16161  */
16162  SCIP_CALL( SCIPtreeStartProbing(scip->tree, scip->mem->probmem, scip->set, scip->lp, TRUE) );
16163 
16164  /* inform the LP that the current probing mode is used for strong branching */
16166 
16167  }
16168  else
16169  {
16171  }
16172 
16173  return SCIP_OKAY;
16174 }
16175 
16176 /** end strong branching - call after any strong branching
16177  *
16178  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
16179  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
16180  *
16181  * @pre This method can be called if @p scip is in one of the following stages:
16182  * - \ref SCIP_STAGE_PRESOLVED
16183  * - \ref SCIP_STAGE_SOLVING
16184  */
16186  SCIP* scip /**< SCIP data structure */
16187  )
16188 {
16189  assert( scip != NULL );
16190 
16191  SCIP_CALL( checkStage(scip, "SCIPendStrongbranch", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) );
16192 
16193  /* depending on whether the strong branching mode was started with propagation enabled or not, we end the strong
16194  * branching probing mode or the LP strong branching mode
16195  */
16196  if( SCIPtreeProbing(scip->tree) )
16197  {
16198  SCIP_NODE* node;
16199  SCIP_DOMCHG* domchg;
16200  SCIP_VAR** boundchgvars;
16201  SCIP_Real* bounds;
16202  SCIP_BOUNDTYPE* boundtypes;
16203  int nboundchgs;
16204  int nbnds;
16205  int i;
16206 
16207  /* collect all bound changes deducted during probing, which were applied at the probing root and apply them to the
16208  * focusnode
16209  */
16210  node = SCIPgetCurrentNode(scip);
16211  assert(SCIPnodeGetType(node) == SCIP_NODETYPE_PROBINGNODE);
16212  assert(SCIPgetProbingDepth(scip) == 0);
16213 
16214  domchg = SCIPnodeGetDomchg(node);
16215  nboundchgs = SCIPdomchgGetNBoundchgs(domchg);
16216 
16217  SCIP_CALL( SCIPallocBufferArray(scip, &boundchgvars, nboundchgs) );
16218  SCIP_CALL( SCIPallocBufferArray(scip, &bounds, nboundchgs) );
16219  SCIP_CALL( SCIPallocBufferArray(scip, &boundtypes, nboundchgs) );
16220 
16221  for( i = 0, nbnds = 0; i < nboundchgs; ++i )
16222  {
16223  SCIP_BOUNDCHG* boundchg;
16224 
16225  boundchg = SCIPdomchgGetBoundchg(domchg, i);
16226 
16227  /* ignore redundant bound changes */
16228  if( SCIPboundchgIsRedundant(boundchg) )
16229  continue;
16230 
16231  boundchgvars[nbnds] = SCIPboundchgGetVar(boundchg);
16232  bounds[nbnds] = SCIPboundchgGetNewbound(boundchg);
16233  boundtypes[nbnds] = SCIPboundchgGetBoundtype(boundchg);
16234  ++nbnds;
16235  }
16236 
16237  SCIPdebugMessage("ending strong branching with probing: %d bound changes collected\n", nbnds);
16238 
16239  /* inform the LP that the probing mode is not used for strong branching anymore */
16241 
16242  SCIP_CALL( SCIPendProbing(scip) );
16243 
16244  /* apply the collected bound changes */
16245  for( i = 0; i < nbnds; ++i )
16246  {
16247  if( boundtypes[i] == SCIP_BOUNDTYPE_LOWER )
16248  {
16249  SCIPdebugMessage("apply probing lower bound change <%s> >= %.9g\n", SCIPvarGetName(boundchgvars[i]), bounds[i]);
16250  SCIP_CALL( SCIPchgVarLb(scip, boundchgvars[i], bounds[i]) );
16251  }
16252  else
16253  {
16254  SCIPdebugMessage("apply probing upper bound change <%s> <= %.9g\n", SCIPvarGetName(boundchgvars[i]), bounds[i]);
16255  SCIP_CALL( SCIPchgVarUb(scip, boundchgvars[i], bounds[i]) );
16256  }
16257  }
16258 
16259  SCIPfreeBufferArray(scip, &boundchgvars);
16260  SCIPfreeBufferArray(scip, &bounds);
16261  SCIPfreeBufferArray(scip, &boundtypes);
16262  }
16263  else
16264  {
16265  SCIPdebugMessage("ending strong branching\n");
16266 
16268  }
16269 
16270  return SCIP_OKAY;
16271 }
16272 
16273 /** analyze the strong branching for the given variable; that includes conflict analysis for infeasible branches and
16274  * storing of root reduced cost information
16275  */
16276 static
16278  SCIP* scip, /**< SCIP data structure */
16279  SCIP_VAR* var, /**< variable to analyze */
16280  SCIP_Bool* downinf, /**< pointer to store whether the downwards branch is infeasible, or NULL */
16281  SCIP_Bool* upinf, /**< pointer to store whether the upwards branch is infeasible, or NULL */
16282  SCIP_Bool* downconflict, /**< pointer to store whether a conflict constraint was created for an
16283  * infeasible downwards branch, or NULL */
16284  SCIP_Bool* upconflict /**< pointer to store whether a conflict constraint was created for an
16285  * infeasible upwards branch, or NULL */
16286  )
16287 {
16288  SCIP_COL* col;
16289  SCIP_Bool downcutoff;
16290  SCIP_Bool upcutoff;
16291 
16292  col = SCIPvarGetCol(var);
16293  assert(col != NULL);
16294 
16295  downcutoff = col->sbdownvalid && SCIPsetIsGE(scip->set, col->sbdown, scip->lp->cutoffbound);
16296  upcutoff = col->sbupvalid && SCIPsetIsGE(scip->set, col->sbup, scip->lp->cutoffbound);
16297 
16298  if( downinf != NULL )
16299  *downinf = downcutoff;
16300  if( upinf != NULL )
16301  *upinf = upcutoff;
16302 
16303  /* analyze infeasible strong branching sub problems:
16304  * because the strong branching's bound change is necessary for infeasibility, it cannot be undone;
16305  * therefore, infeasible strong branchings on non-binary variables will not produce a valid conflict constraint
16306  */
16307  if( scip->set->conf_enable && scip->set->conf_usesb && scip->set->nconflicthdlrs > 0
16308  && SCIPvarIsBinary(var) && SCIPtreeGetCurrentDepth(scip->tree) > 0 )
16309  {
16310  if( (downcutoff && SCIPsetFeasCeil(scip->set, col->primsol-1.0) >= col->lb - 0.5)
16311  || (upcutoff && SCIPsetFeasFloor(scip->set, col->primsol+1.0) <= col->ub + 0.5) )
16312  {
16313  assert(downconflict != NULL);
16314  assert(upconflict != NULL);
16315  SCIP_CALL( SCIPconflictAnalyzeStrongbranch(scip->conflict, scip->mem->probmem, scip->set, scip->stat,
16316  scip->transprob, scip->origprob, scip->tree, scip->lp, scip->branchcand, scip->eventqueue, col, downconflict, upconflict) );
16317  }
16318  }
16319 
16320  /* the strong branching results can be used to strengthen the root reduced cost information which is used for example
16321  * to propagate against the cutoff bound
16322  *
16323  * @note Ignore the results if the LP solution of the down (up) branch LP is smaller which should not happened by
16324  * theory but can arise due to numerical issues.
16325  */
16326  if( SCIPtreeGetCurrentDepth(scip->tree) == 0 && SCIPvarIsBinary(var) )
16327  {
16328  SCIP_Real lpobjval;
16329 
16330  assert(SCIPgetLPSolstat(scip) == SCIP_LPSOLSTAT_OPTIMAL);
16331 
16332  lpobjval = SCIPlpGetObjval(scip->lp, scip->set, scip->transprob);
16333 
16334  if( col->sbdownvalid && SCIPsetFeasCeil(scip->set, col->primsol-1.0) >= col->lb - 0.5 && lpobjval < col->sbdown )
16335  SCIPvarUpdateBestRootSol(var, scip->set, SCIPvarGetUbGlobal(var), -(col->sbdown - lpobjval), lpobjval);
16336  if( col->sbupvalid && SCIPsetFeasFloor(scip->set, col->primsol+1.0) <= col->ub + 0.5 && lpobjval < col->sbup )
16337  SCIPvarUpdateBestRootSol(var, scip->set, SCIPvarGetLbGlobal(var), col->sbup - lpobjval, lpobjval);
16338  }
16339 
16340  return SCIP_OKAY;
16341 }
16342 
16343 /** gets strong branching information on column variable with fractional value
16344  *
16345  * Before calling this method, the strong branching mode must have been activated by calling SCIPstartStrongbranch();
16346  * after strong branching was done for all candidate variables, the strong branching mode must be ended by
16347  * SCIPendStrongbranch(). Since this method does not apply domain propagation before strongbranching,
16348  * propagation should not be enabled in the SCIPstartStrongbranch() call.
16349  *
16350  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
16351  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
16352  *
16353  * @pre This method can be called if @p scip is in one of the following stages:
16354  * - \ref SCIP_STAGE_PRESOLVED
16355  * - \ref SCIP_STAGE_SOLVING
16356  */
16358  SCIP* scip, /**< SCIP data structure */
16359  SCIP_VAR* var, /**< variable to get strong branching values for */
16360  int itlim, /**< iteration limit for strong branchings */
16361  SCIP_Real* down, /**< stores dual bound after branching column down */
16362  SCIP_Real* up, /**< stores dual bound after branching column up */
16363  SCIP_Bool* downvalid, /**< stores whether the returned down value is a valid dual bound, or NULL;
16364  * otherwise, it can only be used as an estimate value */
16365  SCIP_Bool* upvalid, /**< stores whether the returned up value is a valid dual bound, or NULL;
16366  * otherwise, it can only be used as an estimate value */
16367  SCIP_Bool* downinf, /**< pointer to store whether the downwards branch is infeasible, or NULL */
16368  SCIP_Bool* upinf, /**< pointer to store whether the upwards branch is infeasible, or NULL */
16369  SCIP_Bool* downconflict, /**< pointer to store whether a conflict constraint was created for an
16370  * infeasible downwards branch, or NULL */
16371  SCIP_Bool* upconflict, /**< pointer to store whether a conflict constraint was created for an
16372  * infeasible upwards branch, or NULL */
16373  SCIP_Bool* lperror /**< pointer to store whether an unresolved LP error occurred or the
16374  * solving process should be stopped (e.g., due to a time limit) */
16375  )
16376 {
16377  SCIP_COL* col;
16378 
16379  assert(scip != NULL);
16380  assert(var != NULL);
16381  assert(lperror != NULL);
16382  assert(!SCIPtreeProbing(scip->tree)); /* we should not be in strong branching with propagation mode */
16383 
16384  SCIP_CALL( checkStage(scip, "SCIPgetVarStrongbranchFrac", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) );
16385 
16386  if( downvalid != NULL )
16387  *downvalid = FALSE;
16388  if( upvalid != NULL )
16389  *upvalid = FALSE;
16390  if( downinf != NULL )
16391  *downinf = FALSE;
16392  if( upinf != NULL )
16393  *upinf = FALSE;
16394  if( downconflict != NULL )
16395  *downconflict = FALSE;
16396  if( upconflict != NULL )
16397  *upconflict = FALSE;
16398 
16400  {
16401  SCIPerrorMessage("cannot get strong branching information on non-COLUMN variable <%s>\n", SCIPvarGetName(var));
16402  return SCIP_INVALIDDATA;
16403  }
16404 
16405  col = SCIPvarGetCol(var);
16406  assert(col != NULL);
16407 
16408  if( !SCIPcolIsInLP(col) )
16409  {
16410  SCIPerrorMessage("cannot get strong branching information on variable <%s> not in current LP\n", SCIPvarGetName(var));
16411  return SCIP_INVALIDDATA;
16412  }
16413 
16414  /* check if the solving process should be aborted */
16415  if( SCIPsolveIsStopped(scip->set, scip->stat, FALSE) )
16416  {
16417  /* mark this as if the LP failed */
16418  *lperror = TRUE;
16419  return SCIP_OKAY;
16420  }
16421 
16422  /* call strong branching for column with fractional value */
16423  SCIP_CALL( SCIPcolGetStrongbranch(col, FALSE, scip->set, scip->stat, scip->transprob, scip->lp, itlim,
16424  down, up, downvalid, upvalid, lperror) );
16425 
16426  /* check, if the branchings are infeasible; in exact solving mode, we cannot trust the strong branching enough to
16427  * declare the sub nodes infeasible
16428  */
16429  if( !(*lperror) && SCIPprobAllColsInLP(scip->transprob, scip->set, scip->lp) && !scip->set->misc_exactsolve )
16430  {
16431  SCIP_CALL( analyzeStrongbranch(scip, var, downinf, upinf, downconflict, upconflict) );
16432  }
16433 
16434  return SCIP_OKAY;
16435 }
16436 
16437 /** create, solve, and evaluate a single strong branching child (for strong branching with propagation) */
16438 static
16440  SCIP* scip, /**< SCIP data structure */
16441  SCIP_VAR* var, /**< variable to get strong branching values for */
16442  SCIP_Bool down, /**< do we regard the down child? */
16443  SCIP_Bool firstchild, /**< is this the first of the two strong branching children? */
16444  SCIP_Bool propagate, /**< should domain propagation be performed? */
16445  SCIP_Real newbound, /**< new bound to apply at the strong branching child */
16446  int itlim, /**< iteration limit for strong branchings */
16447  int maxproprounds, /**< maximum number of propagation rounds (-1: no limit, -2: parameter
16448  * settings) */
16449  SCIP_Real* value, /**< stores dual bound for strong branching child */
16450  SCIP_Bool* valid, /**< stores whether the returned value is a valid dual bound, or NULL;
16451  * otherwise, it can only be used as an estimate value */
16452  SCIP_Bool* conflict, /**< pointer to store whether a conflict constraint was created for an
16453  * infeasible strong branching child, or NULL */
16454  SCIP_Bool* lperror, /**< pointer to store whether an unresolved LP error occurred or the
16455  * solving process should be stopped (e.g., due to a time limit) */
16456  SCIP_VAR** vars, /**< active problem variables */
16457  int nvars, /**< number of active problem variables */
16458  SCIP_Real* newlbs, /**< array to store valid lower bounds for all active variables, or NULL */
16459  SCIP_Real* newubs, /**< array to store valid upper bounds for all active variables, or NULL */
16460  SCIP_Bool* foundsol, /**< pointer to store whether a primal solution was found during strong branching */
16461  SCIP_Bool* cutoff /**< pointer to store whether the strong branching child is infeasible */
16462  )
16463 {
16464  SCIP_Longint ndomreds;
16465 
16466  assert(value != NULL);
16467  assert(foundsol != NULL);
16468  assert(cutoff != NULL);
16469  assert(valid != NULL ? !(*valid) : TRUE);
16470 
16471  *foundsol = FALSE;
16472 
16473  /* check whether the strong branching child is already infeasible due to the bound change */
16474  if( down )
16475  {
16476  /* the down branch is infeasible due to the branching bound change; since this means that solval is not within the
16477  * bounds, this should only happen if previous strong branching calls on other variables detected bound changes which
16478  * are valid for and were already applied at the probing root
16479  */
16480  if( newbound < SCIPvarGetLbLocal(var) - 0.5 )
16481  {
16482  *value = SCIPinfinity(scip);
16483 
16484  if( valid != NULL )
16485  *valid = TRUE;
16486 
16487  /* bound changes are applied in SCIPendStrongbranch(), which can be seen as a conflict constraint */
16488  if( conflict != NULL )
16489  *conflict = TRUE;
16490 
16491  *cutoff = TRUE;
16492 
16493  return SCIP_OKAY;
16494  }
16495  }
16496  else
16497  {
16498  /* the up branch is infeasible due to the branching bound change; since this means that solval is not within the
16499  * bounds, this should only happen if previous strong branching calls on other variables detected bound changes which
16500  * are valid for and were already applied at the probing root
16501  */
16502  if( newbound > SCIPvarGetUbLocal(var) + 0.5 )
16503  {
16504  *value = SCIPinfinity(scip);
16505 
16506  if( valid != NULL )
16507  *valid = TRUE;
16508 
16509  /* bound changes are applied in SCIPendStrongbranch(), which can be seen as a conflict constraint */
16510  if( conflict != NULL )
16511  *conflict = TRUE;
16512 
16513  *cutoff = TRUE;
16514 
16515  return SCIP_OKAY;
16516  }
16517  }
16518 
16519  /* create a new probing node for the strong branching child and apply the new bound for the variable */
16520  SCIP_CALL( SCIPnewProbingNode(scip) );
16521 
16522  if( down )
16523  {
16524  assert(SCIPisGE(scip, newbound, SCIPvarGetLbLocal(var)));
16525  if( SCIPisLT(scip, newbound, SCIPvarGetUbLocal(var)) )
16526  {
16527  SCIP_CALL( SCIPchgVarUbProbing(scip, var, newbound) );
16528  }
16529  }
16530  else
16531  {
16532  assert(SCIPisLE(scip, newbound, SCIPvarGetUbLocal(var)));
16533  if( SCIPisGT(scip, newbound, SCIPvarGetLbLocal(var)) )
16534  {
16535  SCIP_CALL( SCIPchgVarLbProbing(scip, var, newbound) );
16536  }
16537  }
16538 
16539  /* propagate domains at the probing node */
16540  if( propagate )
16541  {
16542  /* start time measuring */
16543  SCIPclockStart(scip->stat->strongpropclock, scip->set);
16544 
16545  ndomreds = 0;
16546  SCIP_CALL( SCIPpropagateProbing(scip, maxproprounds, cutoff, &ndomreds) );
16547 
16548  /* store number of domain reductions in strong branching */
16549  if( down )
16550  scip->stat->nsbdowndomchgs += ndomreds;
16551  else
16552  scip->stat->nsbupdomchgs += ndomreds;
16553 
16554  /* stop time measuring */
16555  SCIPclockStop(scip->stat->strongpropclock, scip->set);
16556 
16557  if( *cutoff )
16558  {
16559  *value = SCIPinfinity(scip);
16560 
16561  if( valid != NULL )
16562  *valid = TRUE;
16563 
16564  SCIPdebugMessage("%s branch of var <%s> detected infeasible during propagation\n",
16565  down ? "down" : "up", SCIPvarGetName(var));
16566  }
16567  }
16568 
16569  /* if propagation did not already detect infeasibility, solve the probing LP */
16570  if( !(*cutoff) )
16571  {
16572  SCIP_CALL( SCIPsolveProbingLP(scip, itlim, lperror, cutoff) );
16573  assert(SCIPisLPRelax(scip));
16574 
16575  if( *cutoff )
16576  {
16577  assert(!(*lperror));
16578 
16579  *value = SCIPinfinity(scip);
16580 
16581  if( valid != NULL )
16582  *valid = TRUE;
16583 
16584  SCIPdebugMessage("%s branch of var <%s> detected infeasible in LP solving: status=%d\n",
16585  down ? "down" : "up", SCIPvarGetName(var), SCIPgetLPSolstat(scip));
16586  }
16587  else if( !(*lperror) )
16588  {
16589  switch( SCIPgetLPSolstat(scip) )
16590  {
16592  {
16593  *value = SCIPgetLPObjval(scip);
16594  assert(SCIPisLT(scip, *value, SCIPgetCutoffbound(scip)));
16595 
16596  SCIPdebugMessage("probing LP solved to optimality, objective value: %16.9g\n", *value);
16597 
16598  if( valid != NULL )
16599  *valid = TRUE;
16600 
16601  /* check the strong branching LP solution for feasibility */
16602  if( scip->set->branch_checksbsol )
16603  {
16604  SCIP_SOL* sol;
16605  SCIP_Bool rounded = TRUE;
16606 
16607  /* start clock for strong branching solutions */
16608  SCIPclockStart(scip->stat->sbsoltime, scip->set);
16609 
16610  SCIP_CALL( SCIPcreateLPSol(scip, &sol, NULL) );
16611 
16612  /* try to round the strong branching solution */
16613  if( scip->set->branch_roundsbsol )
16614  {
16615  SCIP_CALL( SCIProundSol(scip, sol, &rounded) );
16616  }
16617 
16618  /* check the solution for feasibility if rounding worked well (or was not tried) */
16619  if( rounded )
16620  {
16621  SCIP_CALL( SCIPtrySolFree(scip, &sol, FALSE, FALSE, TRUE, FALSE, foundsol) );
16622  }
16623  else
16624  {
16625  SCIP_CALL( SCIPfreeSol(scip, &sol) );
16626  }
16627 
16628  if( *foundsol )
16629  {
16630  SCIPdebugMessage("found new solution in strong branching\n");
16631 
16632  scip->stat->nsbsolsfound++;
16633 
16634  if( SCIPisGE(scip, *value, SCIPgetCutoffbound(scip)) )
16635  *cutoff = TRUE;
16636  }
16637 
16638  /* stop clock for strong branching solutions */
16639  SCIPclockStop(scip->stat->sbsoltime, scip->set);
16640  }
16641 
16642  break;
16643  }
16646  {
16647  /* use LP value as estimate */
16648  SCIP_LPI* lpi;
16649  SCIP_Real objval;
16650  SCIP_Real looseobjval;
16651 
16652  SCIPdebugMessage("probing LP hit %s limit\n", SCIPgetLPSolstat(scip) == SCIP_LPSOLSTAT_ITERLIMIT ? "iteration" : "time");
16653 
16654  /* we access the LPI directly, because when a time limit was hit, we cannot access objective value and dual
16655  * feasibility using the SCIPlp... methods; we should try to avoid direct calls to the LPI, but this is rather
16656  * uncritical here, because we are immediately after the SCIPsolveProbingLP() call, because we access the LPI
16657  * read-only, and we check SCIPlpiWasSolved() first
16658  */
16659  SCIP_CALL( SCIPgetLPI(scip, &lpi) );
16660 
16661  if( SCIPlpiWasSolved(lpi) )
16662  {
16663  SCIP_CALL( SCIPlpiGetObjval(lpi, &objval) );
16664  looseobjval = SCIPlpGetLooseObjval(scip->lp, scip->set, scip->transprob);
16665 
16666  /* the infinity value in the LPI should not be smaller than SCIP's infinity value */
16667  assert(!SCIPlpiIsInfinity(lpi, objval) || SCIPisInfinity(scip, objval));
16668 
16669  /* we use SCIP's infinity value here because a value larger than this is counted as infeasible by SCIP */
16670  if( SCIPisInfinity(scip, objval) )
16671  *value = SCIPinfinity(scip);
16672  else if( SCIPisInfinity(scip, -looseobjval) )
16673  *value = -SCIPinfinity(scip);
16674  else
16675  *value = objval + looseobjval;
16676 
16677  if( SCIPlpiIsDualFeasible(lpi) )
16678  {
16679  if( valid != NULL )
16680  *valid = TRUE;
16681 
16682  if( SCIPisGE(scip, *value, SCIPgetCutoffbound(scip)) )
16683  *cutoff = TRUE;
16684  }
16685  }
16686  break;
16687  }
16688  case SCIP_LPSOLSTAT_ERROR:
16690  *lperror = TRUE;
16691  break;
16692  case SCIP_LPSOLSTAT_NOTSOLVED: /* should only be the case for *cutoff = TRUE or *lperror = TRUE */
16693  case SCIP_LPSOLSTAT_OBJLIMIT: /* in this case, *cutoff should be TRUE and we should not get here */
16694  case SCIP_LPSOLSTAT_INFEASIBLE: /* in this case, *cutoff should be TRUE and we should not get here */
16695  default:
16696  SCIPerrorMessage("invalid LP solution status <%d>\n", SCIPgetLPSolstat(scip));
16697  return SCIP_INVALIDDATA;
16698  } /*lint !e788*/
16699  }
16700 
16701  /* If columns are missing in the LP, the cutoff flag may be wrong. Therefore, we need to set it and the valid pointer
16702  * to false here.
16703  */
16704  if( (*cutoff) && !SCIPallColsInLP(scip) )
16705  {
16706  *cutoff = FALSE;
16707 
16708  if( valid != NULL )
16709  *valid = FALSE;
16710  }
16711 
16712 #ifndef NDEBUG
16713  if( *lperror )
16714  {
16715  SCIPdebugMessage("error during strong branching probing LP solving: status=%d\n", SCIPgetLPSolstat(scip));
16716  }
16717 #endif
16718  }
16719 
16720 
16721  /* if the subproblem was feasible, we store the local bounds of the variables after propagation and (possibly)
16722  * conflict analysis
16723  * @todo do this after propagation? should be able to get valid bounds more often, but they might be weaker
16724  */
16725  if( !(*cutoff) && newlbs != NULL)
16726  {
16727  int v;
16728 
16729  assert(newubs != NULL);
16730 
16731  /* initialize the newlbs and newubs to the current local bounds */
16732  if( firstchild )
16733  {
16734  for( v = 0; v < nvars; ++v )
16735  {
16736  newlbs[v] = SCIPvarGetLbLocal(vars[v]);
16737  newubs[v] = SCIPvarGetUbLocal(vars[v]);
16738  }
16739  }
16740  /* update newlbs and newubs: take the weaker of the already stored bounds and the current local bounds */
16741  else
16742  {
16743  for( v = 0; v < nvars; ++v )
16744  {
16745  SCIP_Real lb = SCIPvarGetLbLocal(vars[v]);
16746  SCIP_Real ub = SCIPvarGetUbLocal(vars[v]);
16747 
16748  newlbs[v] = MIN(newlbs[v], lb);
16749  newubs[v] = MAX(newubs[v], ub);
16750  }
16751  }
16752  }
16753 
16754  /* revert all changes at the probing node */
16755  SCIP_CALL( SCIPbacktrackProbing(scip, 0) );
16756 
16757  return SCIP_OKAY;
16758 }
16759 
16760 /** gets strong branching information with previous domain propagation on column variable
16761  *
16762  * Before calling this method, the strong branching mode must have been activated by calling SCIPstartStrongbranch();
16763  * after strong branching was done for all candidate variables, the strong branching mode must be ended by
16764  * SCIPendStrongbranch(). Since this method applies domain propagation before strongbranching, propagation has to be be
16765  * enabled in the SCIPstartStrongbranch() call.
16766  *
16767  * Before solving the strong branching LP, domain propagation can be performed. The number of propagation rounds
16768  * can be specified by the parameter @p maxproprounds.
16769  *
16770  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
16771  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
16772  *
16773  * @pre This method can be called if @p scip is in one of the following stages:
16774  * - \ref SCIP_STAGE_PRESOLVED
16775  * - \ref SCIP_STAGE_SOLVING
16776  *
16777  * @warning When using this method, LP banching candidates and solution values must be copied beforehand, because
16778  * they are updated w.r.t. the strong branching LP solution.
16779  */
16781  SCIP* scip, /**< SCIP data structure */
16782  SCIP_VAR* var, /**< variable to get strong branching values for */
16783  SCIP_Real solval, /**< value of the variable in the current LP solution */
16784  SCIP_Real lpobjval, /**< LP objective value of the current LP solution */
16785  int itlim, /**< iteration limit for strong branchings */
16786  int maxproprounds, /**< maximum number of propagation rounds (-1: no limit, -2: parameter
16787  * settings) */
16788  SCIP_Real* down, /**< stores dual bound after branching column down */
16789  SCIP_Real* up, /**< stores dual bound after branching column up */
16790  SCIP_Bool* downvalid, /**< stores whether the returned down value is a valid dual bound, or NULL;
16791  * otherwise, it can only be used as an estimate value */
16792  SCIP_Bool* upvalid, /**< stores whether the returned up value is a valid dual bound, or NULL;
16793  * otherwise, it can only be used as an estimate value */
16794  SCIP_Bool* downinf, /**< pointer to store whether the downwards branch is infeasible, or NULL */
16795  SCIP_Bool* upinf, /**< pointer to store whether the upwards branch is infeasible, or NULL */
16796  SCIP_Bool* downconflict, /**< pointer to store whether a conflict constraint was created for an
16797  * infeasible downwards branch, or NULL */
16798  SCIP_Bool* upconflict, /**< pointer to store whether a conflict constraint was created for an
16799  * infeasible upwards branch, or NULL */
16800  SCIP_Bool* lperror, /**< pointer to store whether an unresolved LP error occurred or the
16801  * solving process should be stopped (e.g., due to a time limit) */
16802  SCIP_Real* newlbs, /**< array to store valid lower bounds for all active variables, or NULL */
16803  SCIP_Real* newubs /**< array to store valid upper bounds for all active variables, or NULL */
16804  )
16805 {
16806  SCIP_COL* col;
16807  SCIP_VAR** vars;
16808  SCIP_Longint oldniters;
16809  SCIP_Real newub;
16810  SCIP_Real newlb;
16811  SCIP_Bool propagate;
16812  SCIP_Bool cutoff;
16813  SCIP_Bool downchild;
16814  SCIP_Bool firstchild;
16815  SCIP_Bool foundsol;
16816  SCIP_Bool downvalidlocal;
16817  SCIP_Bool upvalidlocal;
16818  int oldnconflicts;
16819  int nvars;
16820 
16821  assert(scip != NULL);
16822  assert(var != NULL);
16823  assert(SCIPvarIsIntegral(var));
16824  assert(down != NULL);
16825  assert(up != NULL);
16826  assert(lperror != NULL);
16827  assert((newlbs != NULL) == (newubs != NULL));
16828  assert(SCIPinProbing(scip));
16829 
16830  SCIP_CALL( checkStage(scip, "SCIPgetVarStrongbranchWithPropagation", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) );
16831 
16832  /* check whether propagation should be performed */
16833  propagate = (maxproprounds != 0);
16834 
16835  /* if maxproprounds is -2, change it to 0, which for the following calls means using the parameter settings */
16836  if( maxproprounds == -2 )
16837  maxproprounds = 0;
16838 
16839  *down = lpobjval;
16840  *up = lpobjval;
16841  if( downvalid != NULL )
16842  *downvalid = FALSE;
16843  if( upvalid != NULL )
16844  *upvalid = FALSE;
16845  if( downinf != NULL )
16846  *downinf = FALSE;
16847  if( upinf != NULL )
16848  *upinf = FALSE;
16849  if( downconflict != NULL )
16850  *downconflict = FALSE;
16851  if( upconflict != NULL )
16852  *upconflict = FALSE;
16853  *lperror = FALSE;
16854 
16855  vars = SCIPgetVars(scip);
16856  nvars = SCIPgetNVars(scip);
16857 
16858  /* check if the solving process should be aborted */
16859  if( SCIPsolveIsStopped(scip->set, scip->stat, FALSE) )
16860  {
16861  /* mark this as if the LP failed */
16862  *lperror = TRUE;
16863  return SCIP_OKAY;
16864  }
16865 
16867  {
16868  SCIPerrorMessage("cannot get strong branching information on non-COLUMN variable <%s>\n", SCIPvarGetName(var));
16869  return SCIP_INVALIDDATA;
16870  }
16871 
16872  col = SCIPvarGetCol(var);
16873  assert(col != NULL);
16874 
16875  if( !SCIPcolIsInLP(col) )
16876  {
16877  SCIPerrorMessage("cannot get strong branching information on variable <%s> not in current LP\n", SCIPvarGetName(var));
16878  return SCIP_INVALIDDATA;
16879  }
16880 
16881  newlb = SCIPfeasFloor(scip, solval + 1.0);
16882  newub = SCIPfeasCeil(scip, solval - 1.0);
16883 
16884  SCIPdebugMessage("strong branching on var <%s>: solval=%g, lb=%g, ub=%g\n", SCIPvarGetName(var), solval,
16886 
16887  /* the up branch is infeasible due to the branching bound change; since this means that solval is not within the
16888  * bounds, this should only happen if previous strong branching calls on other variables detected bound changes which
16889  * are valid for and were already applied at the probing root
16890  */
16891  if( newlb > SCIPvarGetUbLocal(var) + 0.5 )
16892  {
16893  *up = SCIPinfinity(scip);
16894 
16895  if( upinf != NULL )
16896  *upinf = TRUE;
16897 
16898  if( upvalid != NULL )
16899  *upvalid = TRUE;
16900 
16901  /* bound changes are applied in SCIPendStrongbranch(), which can be seen as a conflict constraint */
16902  if( upconflict != NULL )
16903  *upconflict = TRUE;
16904 
16905  SCIPcolSetStrongbranchData(col, scip->set, scip->stat, scip->lp, lpobjval, solval,
16906  *down, *up, FALSE, TRUE, 0LL, INT_MAX);
16907 
16908  /* we do not regard the down branch; its valid pointer stays set to FALSE */
16909  return SCIP_OKAY;
16910  }
16911 
16912  /* the down branch is infeasible due to the branching bound change; since this means that solval is not within the
16913  * bounds, this should only happen if previous strong branching calls on other variables detected bound changes which
16914  * are valid for and were already applied at the probing root
16915  */
16916  if( newub < SCIPvarGetLbLocal(var) - 0.5 )
16917  {
16918  *down = SCIPinfinity(scip);
16919 
16920  if( downinf != NULL )
16921  *downinf = TRUE;
16922 
16923  if( downvalid != NULL )
16924  *downvalid = TRUE;
16925 
16926  /* bound changes are applied in SCIPendStrongbranch(), which can be seen as a conflict constraint */
16927  if( downconflict != NULL )
16928  *downconflict = TRUE;
16929 
16930  SCIPcolSetStrongbranchData(col, scip->set, scip->stat, scip->lp, lpobjval, solval,
16931  *down, *up, TRUE, FALSE, 0LL, INT_MAX);
16932 
16933  /* we do not regard the up branch; its valid pointer stays set to FALSE */
16934  return SCIP_OKAY;
16935  }
16936 
16937  /* We now do strong branching by creating the two potential child nodes as probing nodes and solving them one after
16938  * the other. We will stop when the first child is detected infeasible, saving the effort we would need for the
16939  * second child. Since empirically, the up child tends to be infeasible more often, we do strongbranching first on
16940  * the up branch.
16941  */
16942  oldniters = scip->stat->nsbdivinglpiterations;
16943  firstchild = TRUE;
16944  cutoff = FALSE;
16945 
16946  /* @todo: decide the branch to look at first based on the cutoffs in previous calls? */
16947  if( scip->set->branch_firstsbchild == 'u' )
16948  downchild = FALSE;
16949  else if( scip->set->branch_firstsbchild == 'a' )
16950  downchild = SCIPvarGetNLocksDown(var) > SCIPvarGetNLocksUp(var);
16951  else
16952  {
16953  assert(scip->set->branch_firstsbchild == 'd');
16954  downchild = TRUE;
16955  }
16956 
16957  downvalidlocal = FALSE;
16958  upvalidlocal = FALSE;
16959 
16960  do
16961  {
16962  oldnconflicts = SCIPconflictGetNConflicts(scip->conflict);
16963 
16964  if( downchild )
16965  {
16966  SCIP_CALL( performStrongbranchWithPropagation(scip, var, downchild, firstchild, propagate, newub, itlim, maxproprounds,
16967  down, &downvalidlocal, downconflict, lperror, vars, nvars, newlbs, newubs, &foundsol, &cutoff) );
16968 
16969  /* check whether a new solutions rendered the previous child infeasible */
16970  if( foundsol && !firstchild )
16971  {
16972  if( SCIPisGE(scip, *up, SCIPgetCutoffbound(scip)) )
16973  {
16974  if( upinf != NULL )
16975  *upinf = TRUE;
16976  }
16977  }
16978 
16979  /* check for infeasibility */
16980  if( cutoff )
16981  {
16982  if( downinf != NULL )
16983  *downinf = TRUE;
16984 
16985  if( downconflict != NULL &&
16986  (SCIPvarGetLbLocal(var) > newub + 0.5 || SCIPconflictGetNConflicts(scip->conflict) > oldnconflicts) )
16987  {
16988  *downconflict = TRUE;
16989  }
16990 
16991  if( !scip->set->branch_forceall )
16992  {
16993  /* if this is the first call, we do not regard the up branch, its valid pointer is initially set to FALSE */
16994  break;
16995  }
16996  }
16997  }
16998  else
16999  {
17000  SCIP_CALL( performStrongbranchWithPropagation(scip, var, downchild, firstchild, propagate, newlb, itlim, maxproprounds,
17001  up, &upvalidlocal, upconflict, lperror, vars, nvars, newlbs, newubs, &foundsol, &cutoff) );
17002 
17003  /* check whether a new solutions rendered the previous child infeasible */
17004  if( foundsol && !firstchild )
17005  {
17006  if( SCIPisGE(scip, *down, SCIPgetCutoffbound(scip)) )
17007  {
17008  if( downinf != NULL )
17009  *downinf = TRUE;
17010  }
17011  }
17012 
17013  /* check for infeasibility */
17014  if( cutoff )
17015  {
17016  if( upinf != NULL )
17017  *upinf = TRUE;
17018 
17019  assert(upinf == NULL || (*upinf) == TRUE);
17020 
17021  if( upconflict != NULL &&
17022  (SCIPvarGetUbLocal(var) < newlb - 0.5 || SCIPconflictGetNConflicts(scip->conflict) > oldnconflicts) )
17023  {
17024  *upconflict = TRUE;
17025  }
17026 
17027  if( !scip->set->branch_forceall )
17028  {
17029  /* if this is the first call, we do not regard the down branch, its valid pointer is initially set to FALSE */
17030  break;
17031  }
17032  }
17033  }
17034 
17035  downchild = !downchild;
17036  firstchild = !firstchild;
17037  }
17038  while( !firstchild );
17039 
17040 
17041  /* set strong branching information in column */
17042  if( *lperror )
17043  {
17044  SCIPcolInvalidateStrongbranchData(col, scip->set, scip->stat, scip->lp);
17045  }
17046  else
17047  {
17048  SCIPcolSetStrongbranchData(col, scip->set, scip->stat, scip->lp, lpobjval, solval,
17049  *down, *up, downvalidlocal, upvalidlocal, scip->stat->nsbdivinglpiterations - oldniters, itlim);
17050  }
17051 
17052  if( downvalid != NULL )
17053  *downvalid = downvalidlocal;
17054  if( upvalid != NULL )
17055  *upvalid = upvalidlocal;
17056 
17057  return SCIP_OKAY;
17058 }
17059 
17060 /** gets strong branching information on column variable x with integral LP solution value (val); that is, the down branch
17061  * is (val -1.0) and the up brach ins (val +1.0)
17062  *
17063  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
17064  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
17065  *
17066  * @pre This method can be called if @p scip is in one of the following stages:
17067  * - \ref SCIP_STAGE_PRESOLVED
17068  * - \ref SCIP_STAGE_SOLVING
17069  *
17070  * @note If the integral LP solution value is the lower or upper bound of the variable, the corresponding branch will be
17071  * marked as infeasible. That is, the valid pointer and the infeasible pointer are set to TRUE.
17072  */
17074  SCIP* scip, /**< SCIP data structure */
17075  SCIP_VAR* var, /**< variable to get strong branching values for */
17076  int itlim, /**< iteration limit for strong branchings */
17077  SCIP_Real* down, /**< stores dual bound after branching column down */
17078  SCIP_Real* up, /**< stores dual bound after branching column up */
17079  SCIP_Bool* downvalid, /**< stores whether the returned down value is a valid dual bound, or NULL;
17080  * otherwise, it can only be used as an estimate value */
17081  SCIP_Bool* upvalid, /**< stores whether the returned up value is a valid dual bound, or NULL;
17082  * otherwise, it can only be used as an estimate value */
17083  SCIP_Bool* downinf, /**< pointer to store whether the downwards branch is infeasible, or NULL */
17084  SCIP_Bool* upinf, /**< pointer to store whether the upwards branch is infeasible, or NULL */
17085  SCIP_Bool* downconflict, /**< pointer to store whether a conflict constraint was created for an
17086  * infeasible downwards branch, or NULL */
17087  SCIP_Bool* upconflict, /**< pointer to store whether a conflict constraint was created for an
17088  * infeasible upwards branch, or NULL */
17089  SCIP_Bool* lperror /**< pointer to store whether an unresolved LP error occurred or the
17090  * solving process should be stopped (e.g., due to a time limit) */
17091  )
17092 {
17093  SCIP_COL* col;
17094 
17095  assert(lperror != NULL);
17096 
17097  SCIP_CALL( checkStage(scip, "SCIPgetVarStrongbranchInt", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) );
17098 
17099  if( downvalid != NULL )
17100  *downvalid = FALSE;
17101  if( upvalid != NULL )
17102  *upvalid = FALSE;
17103  if( downinf != NULL )
17104  *downinf = FALSE;
17105  if( upinf != NULL )
17106  *upinf = FALSE;
17107  if( downconflict != NULL )
17108  *downconflict = FALSE;
17109  if( upconflict != NULL )
17110  *upconflict = FALSE;
17111 
17113  {
17114  SCIPerrorMessage("cannot get strong branching information on non-COLUMN variable <%s>\n", SCIPvarGetName(var));
17115  return SCIP_INVALIDDATA;
17116  }
17117 
17118  col = SCIPvarGetCol(var);
17119  assert(col != NULL);
17120 
17121  if( !SCIPcolIsInLP(col) )
17122  {
17123  SCIPerrorMessage("cannot get strong branching information on variable <%s> not in current LP\n", SCIPvarGetName(var));
17124  return SCIP_INVALIDDATA;
17125  }
17126 
17127  /* check if the solving process should be aborted */
17128  if( SCIPsolveIsStopped(scip->set, scip->stat, FALSE) )
17129  {
17130  /* mark this as if the LP failed */
17131  *lperror = TRUE;
17132  return SCIP_OKAY;
17133  }
17134 
17135  /* call strong branching for column */
17136  SCIP_CALL( SCIPcolGetStrongbranch(col, TRUE, scip->set, scip->stat, scip->transprob, scip->lp, itlim,
17137  down, up, downvalid, upvalid, lperror) );
17138 
17139  /* check, if the branchings are infeasible; in exact solving mode, we cannot trust the strong branching enough to
17140  * declare the sub nodes infeasible
17141  */
17142  if( !(*lperror) && SCIPprobAllColsInLP(scip->transprob, scip->set, scip->lp) && !scip->set->misc_exactsolve )
17143  {
17144  SCIP_CALL( analyzeStrongbranch(scip, var, downinf, upinf, downconflict, upconflict) );
17145  }
17146 
17147  return SCIP_OKAY;
17148 }
17149 
17150 /** gets strong branching information on column variables with fractional values
17151  *
17152  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
17153  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
17154  *
17155  * @pre This method can be called if @p scip is in one of the following stages:
17156  * - \ref SCIP_STAGE_PRESOLVED
17157  * - \ref SCIP_STAGE_SOLVING
17158  */
17160  SCIP* scip, /**< SCIP data structure */
17161  SCIP_VAR** vars, /**< variables to get strong branching values for */
17162  int nvars, /**< number of variables */
17163  int itlim, /**< iteration limit for strong branchings */
17164  SCIP_Real* down, /**< stores dual bounds after branching variables down */
17165  SCIP_Real* up, /**< stores dual bounds after branching variables up */
17166  SCIP_Bool* downvalid, /**< stores whether the returned down values are valid dual bounds, or NULL;
17167  * otherwise, they can only be used as an estimate value */
17168  SCIP_Bool* upvalid, /**< stores whether the returned up values are valid dual bounds, or NULL;
17169  * otherwise, they can only be used as an estimate value */
17170  SCIP_Bool* downinf, /**< array to store whether the downward branches are infeasible, or NULL */
17171  SCIP_Bool* upinf, /**< array to store whether the upward branches are infeasible, or NULL */
17172  SCIP_Bool* downconflict, /**< array to store whether conflict constraints were created for
17173  * infeasible downward branches, or NULL */
17174  SCIP_Bool* upconflict, /**< array to store whether conflict constraints were created for
17175  * infeasible upward branches, or NULL */
17176  SCIP_Bool* lperror /**< pointer to store whether an unresolved LP error occurred or the
17177  * solving process should be stopped (e.g., due to a time limit) */
17178  )
17179 {
17180  SCIP_COL** cols;
17181  int j;
17182 
17183  assert(lperror != NULL);
17184 
17185  SCIP_CALL( checkStage(scip, "SCIPgetVarsStrongbranchesFrac", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) );
17186 
17187  assert( vars != NULL );
17188 
17189  /* set up data */
17190  cols = NULL;
17191  SCIP_CALL( SCIPallocBufferArray(scip, &cols, nvars) );
17192  assert(cols != NULL);
17193  for( j = 0; j < nvars; ++j )
17194  {
17195  SCIP_VAR* var;
17196  SCIP_COL* col;
17197 
17198  if( downvalid != NULL )
17199  downvalid[j] = FALSE;
17200  if( upvalid != NULL )
17201  upvalid[j] = FALSE;
17202  if( downinf != NULL )
17203  downinf[j] = FALSE;
17204  if( upinf != NULL )
17205  upinf[j] = FALSE;
17206  if( downconflict != NULL )
17207  downconflict[j] = FALSE;
17208  if( upconflict != NULL )
17209  upconflict[j] = FALSE;
17210 
17211  var = vars[j];
17212  assert( var != NULL );
17214  {
17215  SCIPerrorMessage("cannot get strong branching information on non-COLUMN variable <%s>\n", SCIPvarGetName(var));
17216  SCIPfreeBufferArray(scip, &cols);
17217  return SCIP_INVALIDDATA;
17218  }
17219 
17220  col = SCIPvarGetCol(var);
17221  assert(col != NULL);
17222  cols[j] = col;
17223 
17224  if( !SCIPcolIsInLP(col) )
17225  {
17226  SCIPerrorMessage("cannot get strong branching information on variable <%s> not in current LP\n", SCIPvarGetName(var));
17227  SCIPfreeBufferArray(scip, &cols);
17228  return SCIP_INVALIDDATA;
17229  }
17230  }
17231 
17232  /* check if the solving process should be aborted */
17233  if( SCIPsolveIsStopped(scip->set, scip->stat, FALSE) )
17234  {
17235  /* mark this as if the LP failed */
17236  *lperror = TRUE;
17237  }
17238  else
17239  {
17240  /* call strong branching for columns with fractional value */
17241  SCIP_CALL( SCIPcolGetStrongbranches(cols, nvars, FALSE, scip->set, scip->stat, scip->transprob, scip->lp, itlim,
17242  down, up, downvalid, upvalid, lperror) );
17243 
17244  /* check, if the branchings are infeasible; in exact solving mode, we cannot trust the strong branching enough to
17245  * declare the sub nodes infeasible
17246  */
17247  if( !(*lperror) && SCIPprobAllColsInLP(scip->transprob, scip->set, scip->lp) && !scip->set->misc_exactsolve )
17248  {
17249  for( j = 0; j < nvars; ++j )
17250  {
17251  SCIP_CALL( analyzeStrongbranch(scip, vars[j], (downinf != NULL) ? (&(downinf[j])) : NULL,
17252  (upinf != NULL) ? (&(upinf[j])) : NULL, (downconflict != NULL) ? (&(downconflict[j])) : NULL,
17253  (upconflict != NULL) ? (&(upconflict[j])) : NULL) );
17254  }
17255  }
17256  }
17257  SCIPfreeBufferArray(scip, &cols);
17258 
17259  return SCIP_OKAY;
17260 }
17261 
17262 /** gets strong branching information on column variables with integral values
17263  *
17264  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
17265  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
17266  *
17267  * @pre This method can be called if @p scip is in one of the following stages:
17268  * - \ref SCIP_STAGE_PRESOLVED
17269  * - \ref SCIP_STAGE_SOLVING
17270  */
17272  SCIP* scip, /**< SCIP data structure */
17273  SCIP_VAR** vars, /**< variables to get strong branching values for */
17274  int nvars, /**< number of variables */
17275  int itlim, /**< iteration limit for strong branchings */
17276  SCIP_Real* down, /**< stores dual bounds after branching variables down */
17277  SCIP_Real* up, /**< stores dual bounds after branching variables up */
17278  SCIP_Bool* downvalid, /**< stores whether the returned down values are valid dual bounds, or NULL;
17279  * otherwise, they can only be used as an estimate value */
17280  SCIP_Bool* upvalid, /**< stores whether the returned up values are valid dual bounds, or NULL;
17281  * otherwise, they can only be used as an estimate value */
17282  SCIP_Bool* downinf, /**< array to store whether the downward branches are infeasible, or NULL */
17283  SCIP_Bool* upinf, /**< array to store whether the upward branches are infeasible, or NULL */
17284  SCIP_Bool* downconflict, /**< array to store whether conflict constraints were created for
17285  * infeasible downward branches, or NULL */
17286  SCIP_Bool* upconflict, /**< array to store whether conflict constraints were created for
17287  * infeasible upward branches, or NULL */
17288  SCIP_Bool* lperror /**< pointer to store whether an unresolved LP error occurred or the
17289  * solving process should be stopped (e.g., due to a time limit) */
17290  )
17291 {
17292  SCIP_COL** cols;
17293  int j;
17294 
17295  assert(lperror != NULL);
17296 
17297  SCIP_CALL( checkStage(scip, "SCIPgetVarsStrongbranchesInt", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) );
17298 
17299  assert( vars != NULL );
17300 
17301  /* set up data */
17302  cols = NULL;
17303  SCIP_CALL( SCIPallocBufferArray(scip, &cols, nvars) );
17304  assert(cols != NULL);
17305  for( j = 0; j < nvars; ++j )
17306  {
17307  SCIP_VAR* var;
17308  SCIP_COL* col;
17309 
17310  if( downvalid != NULL )
17311  downvalid[j] = FALSE;
17312  if( upvalid != NULL )
17313  upvalid[j] = FALSE;
17314  if( downinf != NULL )
17315  downinf[j] = FALSE;
17316  if( upinf != NULL )
17317  upinf[j] = FALSE;
17318  if( downconflict != NULL )
17319  downconflict[j] = FALSE;
17320  if( upconflict != NULL )
17321  upconflict[j] = FALSE;
17322 
17323  var = vars[j];
17324  assert( var != NULL );
17326  {
17327  SCIPerrorMessage("cannot get strong branching information on non-COLUMN variable <%s>\n", SCIPvarGetName(var));
17328  SCIPfreeBufferArray(scip, &cols);
17329  return SCIP_INVALIDDATA;
17330  }
17331 
17332  col = SCIPvarGetCol(var);
17333  assert(col != NULL);
17334  cols[j] = col;
17335 
17336  if( !SCIPcolIsInLP(col) )
17337  {
17338  SCIPerrorMessage("cannot get strong branching information on variable <%s> not in current LP\n", SCIPvarGetName(var));
17339  SCIPfreeBufferArray(scip, &cols);
17340  return SCIP_INVALIDDATA;
17341  }
17342  }
17343 
17344  /* check if the solving process should be aborted */
17345  if( SCIPsolveIsStopped(scip->set, scip->stat, FALSE) )
17346  {
17347  /* mark this as if the LP failed */
17348  *lperror = TRUE;
17349  }
17350  else
17351  {
17352  /* call strong branching for columns */
17353  SCIP_CALL( SCIPcolGetStrongbranches(cols, nvars, TRUE, scip->set, scip->stat, scip->transprob, scip->lp, itlim,
17354  down, up, downvalid, upvalid, lperror) );
17355 
17356  /* check, if the branchings are infeasible; in exact solving mode, we cannot trust the strong branching enough to
17357  * declare the sub nodes infeasible
17358  */
17359  if( !(*lperror) && SCIPprobAllColsInLP(scip->transprob, scip->set, scip->lp) && !scip->set->misc_exactsolve )
17360  {
17361  for( j = 0; j < nvars; ++j )
17362  {
17363  SCIP_CALL( analyzeStrongbranch(scip, vars[j], (downinf != NULL) ? (&(downinf[j])) : NULL,
17364  (upinf != NULL) ? (&(upinf[j])) : NULL, (downconflict != NULL) ? (&(downconflict[j])) : NULL,
17365  (upconflict != NULL) ? (&(upconflict[j])) : NULL) );
17366 
17367  }
17368  }
17369  }
17370  SCIPfreeBufferArray(scip, &cols);
17371 
17372  return SCIP_OKAY;
17373 }
17374 
17375 /** gets strong branching information on COLUMN variable of the last SCIPgetVarStrongbranch() call;
17376  * returns values of SCIP_INVALID, if strong branching was not yet called on the given variable;
17377  * keep in mind, that the returned old values may have nothing to do with the current LP solution
17378  *
17379  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
17380  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
17381  *
17382  * @pre This method can be called if @p scip is in one of the following stages:
17383  * - \ref SCIP_STAGE_SOLVING
17384  * - \ref SCIP_STAGE_SOLVED
17385  */
17387  SCIP* scip, /**< SCIP data structure */
17388  SCIP_VAR* var, /**< variable to get last strong branching values for */
17389  SCIP_Real* down, /**< stores dual bound after branching column down */
17390  SCIP_Real* up, /**< stores dual bound after branching column up */
17391  SCIP_Bool* downvalid, /**< stores whether the returned down value is a valid dual bound, or NULL;
17392  * otherwise, it can only be used as an estimate value */
17393  SCIP_Bool* upvalid, /**< stores whether the returned up value is a valid dual bound, or NULL;
17394  * otherwise, it can only be used as an estimate value */
17395  SCIP_Real* solval, /**< stores LP solution value of variable at the last strong branching call, or NULL */
17396  SCIP_Real* lpobjval /**< stores LP objective value at last strong branching call, or NULL */
17397  )
17398 {
17399  SCIP_CALL( checkStage(scip, "SCIPgetVarStrongbranchLast", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE) );
17400 
17402  {
17403  SCIPerrorMessage("cannot get strong branching information on non-COLUMN variable\n");
17404  return SCIP_INVALIDDATA;
17405  }
17406 
17407  SCIPcolGetStrongbranchLast(SCIPvarGetCol(var), down, up, downvalid, upvalid, solval, lpobjval);
17408 
17409  return SCIP_OKAY;
17410 }
17411 
17412 /** gets node number of the last node in current branch and bound run, where strong branching was used on the
17413  * given variable, or -1 if strong branching was never applied to the variable in current run
17414  *
17415  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
17416  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
17417  *
17418  * @pre This method can be called if @p scip is in one of the following stages:
17419  * - \ref SCIP_STAGE_TRANSFORMING
17420  * - \ref SCIP_STAGE_TRANSFORMED
17421  * - \ref SCIP_STAGE_INITPRESOLVE
17422  * - \ref SCIP_STAGE_PRESOLVING
17423  * - \ref SCIP_STAGE_EXITPRESOLVE
17424  * - \ref SCIP_STAGE_PRESOLVED
17425  * - \ref SCIP_STAGE_INITSOLVE
17426  * - \ref SCIP_STAGE_SOLVING
17427  * - \ref SCIP_STAGE_SOLVED
17428  * - \ref SCIP_STAGE_EXITSOLVE
17429  */
17431  SCIP* scip, /**< SCIP data structure */
17432  SCIP_VAR* var /**< variable to get last strong branching node for */
17433  )
17434 {
17435  SCIP_CALL_ABORT( checkStage(scip, "SCIPgetVarStrongbranchNode", FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE) );
17436 
17438  return -1;
17439 
17441 }
17442 
17443 /** if strong branching was already applied on the variable at the current node, returns the number of LPs solved after
17444  * the LP where the strong branching on this variable was applied;
17445  * if strong branching was not yet applied on the variable at the current node, returns INT_MAX
17446  *
17447  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
17448  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
17449  *
17450  * @pre This method can be called if @p scip is in one of the following stages:
17451  * - \ref SCIP_STAGE_TRANSFORMING
17452  * - \ref SCIP_STAGE_TRANSFORMED
17453  * - \ref SCIP_STAGE_INITPRESOLVE
17454  * - \ref SCIP_STAGE_PRESOLVING
17455  * - \ref SCIP_STAGE_EXITPRESOLVE
17456  * - \ref SCIP_STAGE_PRESOLVED
17457  * - \ref SCIP_STAGE_INITSOLVE
17458  * - \ref SCIP_STAGE_SOLVING
17459  * - \ref SCIP_STAGE_SOLVED
17460  * - \ref SCIP_STAGE_EXITSOLVE
17461  */
17463  SCIP* scip, /**< SCIP data structure */
17464  SCIP_VAR* var /**< variable to get strong branching LP age for */
17465  )
17466 {
17467  SCIP_CALL_ABORT( checkStage(scip, "SCIPgetVarStrongbranchLPAge", FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE) );
17468 
17470  return SCIP_LONGINT_MAX;
17471 
17472  return SCIPcolGetStrongbranchLPAge(SCIPvarGetCol(var), scip->stat);
17473 }
17474 
17475 /** gets number of times, strong branching was applied in current run on the given variable
17476  *
17477  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
17478  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
17479  *
17480  * @pre This method can be called if @p scip is in one of the following stages:
17481  * - \ref SCIP_STAGE_TRANSFORMING
17482  * - \ref SCIP_STAGE_TRANSFORMED
17483  * - \ref SCIP_STAGE_INITPRESOLVE
17484  * - \ref SCIP_STAGE_PRESOLVING
17485  * - \ref SCIP_STAGE_EXITPRESOLVE
17486  * - \ref SCIP_STAGE_PRESOLVED
17487  * - \ref SCIP_STAGE_INITSOLVE
17488  * - \ref SCIP_STAGE_SOLVING
17489  * - \ref SCIP_STAGE_SOLVED
17490  * - \ref SCIP_STAGE_EXITSOLVE
17491  */
17493  SCIP* scip, /**< SCIP data structure */
17494  SCIP_VAR* var /**< variable to get last strong branching node for */
17495  )
17496 {
17497  SCIP_CALL_ABORT( checkStage(scip, "SCIPgetVarNStrongbranchs", FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE) );
17498 
17500  return 0;
17501 
17503 }
17504 
17505 /** adds given values to lock numbers of variable for rounding
17506  *
17507  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
17508  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
17509  *
17510  * @pre This method can be called if @p scip is in one of the following stages:
17511  * - \ref SCIP_STAGE_PROBLEM
17512  * - \ref SCIP_STAGE_TRANSFORMING
17513  * - \ref SCIP_STAGE_TRANSFORMED
17514  * - \ref SCIP_STAGE_INITPRESOLVE
17515  * - \ref SCIP_STAGE_PRESOLVING
17516  * - \ref SCIP_STAGE_EXITPRESOLVE
17517  * - \ref SCIP_STAGE_PRESOLVED
17518  * - \ref SCIP_STAGE_INITSOLVE
17519  * - \ref SCIP_STAGE_SOLVING
17520  * - \ref SCIP_STAGE_EXITSOLVE
17521  * - \ref SCIP_STAGE_FREETRANS
17522  */
17524  SCIP* scip, /**< SCIP data structure */
17525  SCIP_VAR* var, /**< problem variable */
17526  int nlocksdown, /**< modification in number of rounding down locks */
17527  int nlocksup /**< modification in number of rounding up locks */
17528  )
17529 {
17530  SCIP_CALL( checkStage(scip, "SCIPaddVarLocks", FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, TRUE, TRUE, FALSE) );
17531 
17532  switch( scip->set->stage )
17533  {
17534  case SCIP_STAGE_PROBLEM:
17535  assert(!SCIPvarIsTransformed(var));
17536  /*lint -fallthrough*/
17540  case SCIP_STAGE_PRESOLVING:
17542  case SCIP_STAGE_PRESOLVED:
17543  case SCIP_STAGE_INITSOLVE:
17544  case SCIP_STAGE_SOLVING:
17545  case SCIP_STAGE_EXITSOLVE:
17546  case SCIP_STAGE_FREETRANS:
17547  SCIP_CALL( SCIPvarAddLocks(var, scip->mem->probmem, scip->set, scip->eventqueue, nlocksdown, nlocksup) );
17548  return SCIP_OKAY;
17549 
17550  default:
17551  SCIPerrorMessage("invalid SCIP stage <%d>\n", scip->set->stage);
17552  return SCIP_INVALIDCALL;
17553  } /*lint !e788*/
17554 }
17555 
17556 /** locks rounding of variable with respect to the lock status of the constraint and its negation;
17557  * this method should be called whenever the lock status of a variable in a constraint changes, for example if
17558  * the coefficient of the variable changed its sign or if the left or right hand sides of the constraint were
17559  * added or removed
17560  *
17561  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
17562  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
17563  *
17564  * @pre This method can be called if @p scip is in one of the following stages:
17565  * - \ref SCIP_STAGE_PROBLEM
17566  * - \ref SCIP_STAGE_TRANSFORMING
17567  * - \ref SCIP_STAGE_INITPRESOLVE
17568  * - \ref SCIP_STAGE_PRESOLVING
17569  * - \ref SCIP_STAGE_EXITPRESOLVE
17570  * - \ref SCIP_STAGE_INITSOLVE
17571  * - \ref SCIP_STAGE_SOLVING
17572  * - \ref SCIP_STAGE_EXITSOLVE
17573  * - \ref SCIP_STAGE_FREETRANS
17574  */
17576  SCIP* scip, /**< SCIP data structure */
17577  SCIP_VAR* var, /**< problem variable */
17578  SCIP_CONS* cons, /**< constraint */
17579  SCIP_Bool lockdown, /**< should the rounding be locked in downwards direction? */
17580  SCIP_Bool lockup /**< should the rounding be locked in upwards direction? */
17581  )
17582 {
17583  int nlocksdown;
17584  int nlocksup;
17585 
17586  SCIP_CALL( checkStage(scip, "SCIPlockVarCons", FALSE, TRUE, TRUE, FALSE, TRUE, TRUE, TRUE, FALSE, TRUE, TRUE, FALSE, TRUE, TRUE, FALSE) );
17587 
17588  nlocksdown = 0;
17589  nlocksup = 0;
17590  if( SCIPconsIsLockedPos(cons) )
17591  {
17592  if( lockdown )
17593  nlocksdown++;
17594  if( lockup )
17595  nlocksup++;
17596  }
17597  if( SCIPconsIsLockedNeg(cons) )
17598  {
17599  if( lockdown )
17600  nlocksup++;
17601  if( lockup )
17602  nlocksdown++;
17603  }
17604 
17605  switch( scip->set->stage )
17606  {
17607  case SCIP_STAGE_PROBLEM:
17608  assert(!SCIPvarIsTransformed(var));
17609  /*lint -fallthrough*/
17612  case SCIP_STAGE_PRESOLVING:
17614  case SCIP_STAGE_INITSOLVE:
17615  case SCIP_STAGE_SOLVING:
17616  case SCIP_STAGE_EXITSOLVE:
17617  case SCIP_STAGE_FREETRANS:
17618  SCIP_CALL( SCIPvarAddLocks(var, scip->mem->probmem, scip->set, scip->eventqueue, nlocksdown, nlocksup) );
17619  return SCIP_OKAY;
17620 
17621  default:
17622  SCIPerrorMessage("invalid SCIP stage <%d>\n", scip->set->stage);
17623  return SCIP_INVALIDCALL;
17624  } /*lint !e788*/
17625 }
17626 
17627 /** unlocks rounding of variable with respect to the lock status of the constraint and its negation;
17628  * this method should be called whenever the lock status of a variable in a constraint changes, for example if
17629  * the coefficient of the variable changed its sign or if the left or right hand sides of the constraint were
17630  * added or removed
17631  *
17632  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
17633  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
17634  *
17635  * @pre This method can be called if @p scip is in one of the following stages:
17636  * - \ref SCIP_STAGE_PROBLEM
17637  * - \ref SCIP_STAGE_TRANSFORMING
17638  * - \ref SCIP_STAGE_INITPRESOLVE
17639  * - \ref SCIP_STAGE_PRESOLVING
17640  * - \ref SCIP_STAGE_EXITPRESOLVE
17641  * - \ref SCIP_STAGE_INITSOLVE
17642  * - \ref SCIP_STAGE_SOLVING
17643  * - \ref SCIP_STAGE_EXITSOLVE
17644  * - \ref SCIP_STAGE_FREETRANS
17645  */
17647  SCIP* scip, /**< SCIP data structure */
17648  SCIP_VAR* var, /**< problem variable */
17649  SCIP_CONS* cons, /**< constraint */
17650  SCIP_Bool lockdown, /**< should the rounding be unlocked in downwards direction? */
17651  SCIP_Bool lockup /**< should the rounding be unlocked in upwards direction? */
17652  )
17653 {
17654  int nlocksdown;
17655  int nlocksup;
17656 
17657  SCIP_CALL( checkStage(scip, "SCIPunlockVarCons", FALSE, TRUE, TRUE, FALSE, TRUE, TRUE, TRUE, FALSE, TRUE, TRUE, FALSE, TRUE, TRUE, FALSE) );
17658 
17659  nlocksdown = 0;
17660  nlocksup = 0;
17661  if( SCIPconsIsLockedPos(cons) )
17662  {
17663  if( lockdown )
17664  nlocksdown++;
17665  if( lockup )
17666  nlocksup++;
17667  }
17668  if( SCIPconsIsLockedNeg(cons) )
17669  {
17670  if( lockdown )
17671  nlocksup++;
17672  if( lockup )
17673  nlocksdown++;
17674  }
17675 
17676  switch( scip->set->stage )
17677  {
17678  case SCIP_STAGE_PROBLEM:
17679  assert(!SCIPvarIsTransformed(var));
17680  /*lint -fallthrough*/
17683  case SCIP_STAGE_PRESOLVING:
17685  case SCIP_STAGE_INITSOLVE:
17686  case SCIP_STAGE_SOLVING:
17687  case SCIP_STAGE_EXITSOLVE:
17688  case SCIP_STAGE_FREETRANS:
17689  SCIP_CALL( SCIPvarAddLocks(var, scip->mem->probmem, scip->set, scip->eventqueue, -nlocksdown, -nlocksup) );
17690  return SCIP_OKAY;
17691 
17692  default:
17693  SCIPerrorMessage("invalid SCIP stage <%d>\n", scip->set->stage);
17694  return SCIP_INVALIDCALL;
17695  } /*lint !e788*/
17696 }
17697 
17698 /** changes variable's objective value
17699  *
17700  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
17701  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
17702  *
17703  * @pre This method can be called if @p scip is in one of the following stages:
17704  * - \ref SCIP_STAGE_PROBLEM
17705  * - \ref SCIP_STAGE_TRANSFORMING
17706  * - \ref SCIP_STAGE_PRESOLVING
17707  */
17709  SCIP* scip, /**< SCIP data structure */
17710  SCIP_VAR* var, /**< variable to change the objective value for */
17711  SCIP_Real newobj /**< new objective value */
17712  )
17713 {
17714  SCIP_CALL( checkStage(scip, "SCIPchgVarObj", FALSE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE) );
17715 
17716  switch( scip->set->stage )
17717  {
17718  case SCIP_STAGE_PROBLEM:
17719  assert(!SCIPvarIsTransformed(var));
17720  SCIP_CALL( SCIPvarChgObj(var, scip->mem->probmem, scip->set, scip->origprob, scip->primal, scip->lp, scip->eventqueue, newobj) );
17721  return SCIP_OKAY;
17722 
17724  case SCIP_STAGE_PRESOLVING:
17725  SCIP_CALL( SCIPvarChgObj(var, scip->mem->probmem, scip->set, scip->transprob, scip->primal, scip->lp, scip->eventqueue, newobj) );
17726  return SCIP_OKAY;
17727 
17728  default:
17729  SCIPerrorMessage("invalid SCIP stage <%d>\n", scip->set->stage);
17730  return SCIP_INVALIDCALL;
17731  } /*lint !e788*/
17732 }
17733 
17734 /** adds value to variable's objective value
17735  *
17736  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
17737  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
17738  *
17739  * @pre This method can be called if @p scip is in one of the following stages:
17740  * - \ref SCIP_STAGE_PROBLEM
17741  * - \ref SCIP_STAGE_TRANSFORMING
17742  * - \ref SCIP_STAGE_PRESOLVING
17743  */
17745  SCIP* scip, /**< SCIP data structure */
17746  SCIP_VAR* var, /**< variable to change the objective value for */
17747  SCIP_Real addobj /**< additional objective value */
17748  )
17749 {
17750  SCIP_CALL( checkStage(scip, "SCIPaddVarObj", FALSE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE) );
17751 
17752  switch( scip->set->stage )
17753  {
17754  case SCIP_STAGE_PROBLEM:
17755  assert(!SCIPvarIsTransformed(var));
17756  SCIP_CALL( SCIPvarAddObj(var, scip->mem->probmem, scip->set, scip->stat, scip->transprob, scip->origprob, scip->primal,
17757  scip->tree, scip->lp, scip->eventqueue, addobj) );
17758  return SCIP_OKAY;
17759 
17761  case SCIP_STAGE_PRESOLVING:
17763  SCIP_CALL( SCIPvarAddObj(var, scip->mem->probmem, scip->set, scip->stat, scip->transprob, scip->origprob, scip->primal,
17764  scip->tree, scip->lp, scip->eventqueue, addobj) );
17765  return SCIP_OKAY;
17766 
17767  default:
17768  SCIPerrorMessage("invalid SCIP stage <%d>\n", scip->set->stage);
17769  return SCIP_INVALIDCALL;
17770  } /*lint !e788*/
17771 }
17772 
17773 /** returns the adjusted (i.e. rounded, if the given variable is of integral type) lower bound value;
17774  * does not change the bounds of the variable
17775  *
17776  * @return adjusted lower bound for the given variable; the bound of the variable is not changed
17777  *
17778  * @pre This method can be called if @p scip is in one of the following stages:
17779  * - \ref SCIP_STAGE_PROBLEM
17780  * - \ref SCIP_STAGE_TRANSFORMING
17781  * - \ref SCIP_STAGE_TRANSFORMED
17782  * - \ref SCIP_STAGE_INITPRESOLVE
17783  * - \ref SCIP_STAGE_PRESOLVING
17784  * - \ref SCIP_STAGE_EXITPRESOLVE
17785  * - \ref SCIP_STAGE_PRESOLVED
17786  * - \ref SCIP_STAGE_INITSOLVE
17787  * - \ref SCIP_STAGE_SOLVING
17788  * - \ref SCIP_STAGE_SOLVED
17789  * - \ref SCIP_STAGE_EXITSOLVE
17790  * - \ref SCIP_STAGE_FREETRANS
17791  */
17793  SCIP* scip, /**< SCIP data structure */
17794  SCIP_VAR* var, /**< variable to adjust the bound for */
17795  SCIP_Real lb /**< lower bound value to adjust */
17796  )
17797 {
17798  SCIP_CALL_ABORT( checkStage(scip, "SCIPadjustedVarLb", FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE) );
17799 
17800  SCIPvarAdjustLb(var, scip->set, &lb);
17801 
17802  return lb;
17803 }
17804 
17805 /** returns the adjusted (i.e. rounded, if the given variable is of integral type) upper bound value;
17806  * does not change the bounds of the variable
17807  *
17808  * @return adjusted upper bound for the given variable; the bound of the variable is not changed
17809  *
17810  * @pre This method can be called if @p scip is in one of the following stages:
17811  * - \ref SCIP_STAGE_PROBLEM
17812  * - \ref SCIP_STAGE_TRANSFORMING
17813  * - \ref SCIP_STAGE_TRANSFORMED
17814  * - \ref SCIP_STAGE_INITPRESOLVE
17815  * - \ref SCIP_STAGE_PRESOLVING
17816  * - \ref SCIP_STAGE_EXITPRESOLVE
17817  * - \ref SCIP_STAGE_PRESOLVED
17818  * - \ref SCIP_STAGE_INITSOLVE
17819  * - \ref SCIP_STAGE_SOLVING
17820  * - \ref SCIP_STAGE_SOLVED
17821  * - \ref SCIP_STAGE_EXITSOLVE
17822  * - \ref SCIP_STAGE_FREETRANS
17823  */
17825  SCIP* scip, /**< SCIP data structure */
17826  SCIP_VAR* var, /**< variable to adjust the bound for */
17827  SCIP_Real ub /**< upper bound value to adjust */
17828  )
17829 {
17830  SCIP_CALL_ABORT( checkStage(scip, "SCIPadjustedVarUb", FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE) );
17831 
17832  SCIPvarAdjustUb(var, scip->set, &ub);
17833 
17834  return ub;
17835 }
17836 
17837 /** depending on SCIP's stage, changes lower bound of variable in the problem, in preprocessing, or in current node;
17838  * if possible, adjusts bound to integral value; doesn't store any inference information in the bound change, such
17839  * that in conflict analysis, this change is treated like a branching decision
17840  *
17841  * @warning If SCIP is in presolving stage, it can happen that the internal variable array (which can be accessed via
17842  * SCIPgetVars()) gets resorted.
17843  *
17844  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
17845  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
17846  *
17847  * @pre This method can be called if @p scip is in one of the following stages:
17848  * - \ref SCIP_STAGE_PROBLEM
17849  * - \ref SCIP_STAGE_TRANSFORMING
17850  * - \ref SCIP_STAGE_PRESOLVING
17851  * - \ref SCIP_STAGE_SOLVING
17852  *
17853  * @note During presolving, an integer variable whose bound changes to {0,1} is upgraded to a binary variable.
17854  */
17856  SCIP* scip, /**< SCIP data structure */
17857  SCIP_VAR* var, /**< variable to change the bound for */
17858  SCIP_Real newbound /**< new value for bound */
17859  )
17860 {
17861  SCIP_CALL( checkStage(scip, "SCIPchgVarLb", FALSE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) );
17862 
17863  SCIPvarAdjustLb(var, scip->set, &newbound);
17864 
17865  switch( scip->set->stage )
17866  {
17867  case SCIP_STAGE_PROBLEM:
17868  assert(!SCIPvarIsTransformed(var));
17869  SCIP_CALL( SCIPvarChgLbGlobal(var, scip->mem->probmem, scip->set, scip->stat, scip->lp,
17870  scip->branchcand, scip->eventqueue, newbound) );
17871  SCIP_CALL( SCIPvarChgLbLocal(var, scip->mem->probmem, scip->set, scip->stat, scip->lp,
17872  scip->branchcand, scip->eventqueue, newbound) );
17873  SCIP_CALL( SCIPvarChgLbOriginal(var, scip->set, newbound) );
17874  break;
17875 
17877  case SCIP_STAGE_PRESOLVED:
17878  SCIP_CALL( SCIPvarChgLbGlobal(var, scip->mem->probmem, scip->set, scip->stat, scip->lp,
17879  scip->branchcand, scip->eventqueue, newbound) );
17880  break;
17881 
17882  case SCIP_STAGE_PRESOLVING:
17883  if( !SCIPinProbing(scip) )
17884  {
17885  assert(SCIPtreeGetCurrentDepth(scip->tree) == 0);
17886  assert(scip->tree->root == SCIPtreeGetCurrentNode(scip->tree));
17887 
17888  SCIP_CALL( SCIPnodeAddBoundchg(scip->tree->root, scip->mem->probmem, scip->set, scip->stat, scip->transprob,
17889  scip->origprob, scip->tree, scip->lp, scip->branchcand, scip->eventqueue, var, newbound,
17891 
17893  {
17894  SCIP_Bool infeasible;
17895 
17896  SCIP_CALL( SCIPchgVarType(scip, var, SCIP_VARTYPE_BINARY, &infeasible) );
17897  assert(!infeasible);
17898  }
17899  break;
17900  }
17901  /*lint -fallthrough*/
17902  case SCIP_STAGE_SOLVING:
17904  scip->transprob, scip->origprob, scip->tree, scip->lp, scip->branchcand, scip->eventqueue, var, newbound,
17906  break;
17907 
17908  default:
17909  SCIPerrorMessage("invalid SCIP stage <%d>\n", scip->set->stage);
17910  return SCIP_INVALIDCALL;
17911  } /*lint !e788*/
17912 
17913  return SCIP_OKAY;
17914 }
17915 
17916 /** depending on SCIP's stage, changes upper bound of variable in the problem, in preprocessing, or in current node;
17917  * if possible, adjusts bound to integral value; doesn't store any inference information in the bound change, such
17918  * that in conflict analysis, this change is treated like a branching decision
17919  *
17920  * @warning If SCIP is in presolving stage, it can happen that the internal variable array (which can be accessed via
17921  * SCIPgetVars()) gets resorted.
17922  *
17923  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
17924  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
17925  *
17926  * @pre This method can be called if @p scip is in one of the following stages:
17927  * - \ref SCIP_STAGE_PROBLEM
17928  * - \ref SCIP_STAGE_TRANSFORMING
17929  * - \ref SCIP_STAGE_PRESOLVING
17930  * - \ref SCIP_STAGE_SOLVING
17931  *
17932  * @note During presolving, an integer variable whose bound changes to {0,1} is upgraded to a binary variable.
17933  */
17935  SCIP* scip, /**< SCIP data structure */
17936  SCIP_VAR* var, /**< variable to change the bound for */
17937  SCIP_Real newbound /**< new value for bound */
17938  )
17939 {
17940  SCIP_CALL( checkStage(scip, "SCIPchgVarUb", FALSE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) );
17941 
17942  SCIPvarAdjustUb(var, scip->set, &newbound);
17943 
17944  switch( scip->set->stage )
17945  {
17946  case SCIP_STAGE_PROBLEM:
17947  assert(!SCIPvarIsTransformed(var));
17948  SCIP_CALL( SCIPvarChgUbGlobal(var, scip->mem->probmem, scip->set, scip->stat, scip->lp,
17949  scip->branchcand, scip->eventqueue, newbound) );
17950  SCIP_CALL( SCIPvarChgUbLocal(var, scip->mem->probmem, scip->set, scip->stat, scip->lp,
17951  scip->branchcand, scip->eventqueue, newbound) );
17952  SCIP_CALL( SCIPvarChgUbOriginal(var, scip->set, newbound) );
17953  break;
17954 
17956  case SCIP_STAGE_PRESOLVED:
17957  SCIP_CALL( SCIPvarChgUbGlobal(var, scip->mem->probmem, scip->set, scip->stat, scip->lp,
17958  scip->branchcand, scip->eventqueue, newbound) );
17959  break;
17960 
17961  case SCIP_STAGE_PRESOLVING:
17962  if( !SCIPinProbing(scip) )
17963  {
17964  assert(SCIPtreeGetCurrentDepth(scip->tree) == 0);
17965  assert(scip->tree->root == SCIPtreeGetCurrentNode(scip->tree));
17966 
17967  SCIP_CALL( SCIPnodeAddBoundchg(scip->tree->root, scip->mem->probmem, scip->set, scip->stat, scip->transprob,
17968  scip->origprob, scip->tree, scip->lp, scip->branchcand, scip->eventqueue, var, newbound,
17970 
17972  {
17973  SCIP_Bool infeasible;
17974 
17975  SCIP_CALL( SCIPchgVarType(scip, var, SCIP_VARTYPE_BINARY, &infeasible) );
17976  assert(!infeasible);
17977  }
17978  break;
17979  }
17980  /*lint -fallthrough*/
17981  case SCIP_STAGE_SOLVING:
17983  scip->transprob, scip->origprob, scip->tree, scip->lp, scip->branchcand, scip->eventqueue, var, newbound,
17985  break;
17986 
17987  default:
17988  SCIPerrorMessage("invalid SCIP stage <%d>\n", scip->set->stage);
17989  return SCIP_INVALIDCALL;
17990  } /*lint !e788*/
17991 
17992  return SCIP_OKAY;
17993 }
17994 
17995 /** changes lower bound of variable in the given node; if possible, adjust bound to integral value; doesn't store any
17996  * inference information in the bound change, such that in conflict analysis, this change is treated like a branching
17997  * decision
17998  *
17999  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
18000  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
18001  *
18002  * @pre This method can only be called if @p scip is in stage \ref SCIP_STAGE_SOLVING
18003  */
18005  SCIP* scip, /**< SCIP data structure */
18006  SCIP_NODE* node, /**< node to change bound at, or NULL for current node */
18007  SCIP_VAR* var, /**< variable to change the bound for */
18008  SCIP_Real newbound /**< new value for bound */
18009  )
18010 {
18011  SCIP_CALL( checkStage(scip, "SCIPchgVarLbNode", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) );
18012 
18013  if( node == NULL )
18014  {
18015  SCIP_CALL( SCIPchgVarLb(scip, var, newbound) );
18016  }
18017  else
18018  {
18019  SCIPvarAdjustLb(var, scip->set, &newbound);
18020  SCIP_CALL( SCIPnodeAddBoundchg(node, scip->mem->probmem, scip->set, scip->stat, scip->transprob, scip->origprob,
18021  scip->tree, scip->lp, scip->branchcand, scip->eventqueue, var, newbound, SCIP_BOUNDTYPE_LOWER, FALSE) );
18022  }
18023 
18024  return SCIP_OKAY;
18025 }
18026 
18027 /** changes upper bound of variable in the given node; if possible, adjust bound to integral value; doesn't store any
18028  * inference information in the bound change, such that in conflict analysis, this change is treated like a branching
18029  * decision
18030  *
18031  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
18032  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
18033  *
18034  * @pre This method can only be called if @p scip is in stage \ref SCIP_STAGE_SOLVING
18035  */
18037  SCIP* scip, /**< SCIP data structure */
18038  SCIP_NODE* node, /**< node to change bound at, or NULL for current node */
18039  SCIP_VAR* var, /**< variable to change the bound for */
18040  SCIP_Real newbound /**< new value for bound */
18041  )
18042 {
18043  SCIP_CALL( checkStage(scip, "SCIPchgVarUbNode", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) );
18044 
18045  if( node == NULL )
18046  {
18047  SCIP_CALL( SCIPchgVarUb(scip, var, newbound) );
18048  }
18049  else
18050  {
18051  SCIPvarAdjustUb(var, scip->set, &newbound);
18052  SCIP_CALL( SCIPnodeAddBoundchg(node, scip->mem->probmem, scip->set, scip->stat, scip->transprob, scip->origprob,
18053  scip->tree, scip->lp, scip->branchcand, scip->eventqueue, var, newbound, SCIP_BOUNDTYPE_UPPER, FALSE) );
18054  }
18055 
18056  return SCIP_OKAY;
18057 }
18058 
18059 /** changes global lower bound of variable; if possible, adjust bound to integral value; also tightens the local bound,
18060  * if the global bound is better than the local bound
18061  *
18062  * @warning If SCIP is in presolving stage, it can happen that the internal variable array (which can be accessed via
18063  * SCIPgetVars()) gets resorted.
18064  *
18065  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
18066  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
18067  *
18068  * @pre This method can be called if @p scip is in one of the following stages:
18069  * - \ref SCIP_STAGE_PROBLEM
18070  * - \ref SCIP_STAGE_TRANSFORMING
18071  * - \ref SCIP_STAGE_PRESOLVING
18072  * - \ref SCIP_STAGE_SOLVING
18073  *
18074  * @note During presolving, an integer variable whose bound changes to {0,1} is upgraded to a binary variable.
18075  */
18077  SCIP* scip, /**< SCIP data structure */
18078  SCIP_VAR* var, /**< variable to change the bound for */
18079  SCIP_Real newbound /**< new value for bound */
18080  )
18081 {
18082  SCIP_CALL( checkStage(scip, "SCIPchgVarLbGlobal", FALSE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) );
18083 
18084  SCIPvarAdjustLb(var, scip->set, &newbound);
18085 
18086  switch( scip->set->stage )
18087  {
18088  case SCIP_STAGE_PROBLEM:
18089  assert(!SCIPvarIsTransformed(var));
18090  SCIP_CALL( SCIPvarChgLbGlobal(var, scip->mem->probmem, scip->set, scip->stat, scip->lp,
18091  scip->branchcand, scip->eventqueue, newbound) );
18092  SCIP_CALL( SCIPvarChgLbLocal(var, scip->mem->probmem, scip->set, scip->stat, scip->lp,
18093  scip->branchcand, scip->eventqueue, newbound) );
18094  SCIP_CALL( SCIPvarChgLbOriginal(var, scip->set, newbound) );
18095  break;
18096 
18098  SCIP_CALL( SCIPvarChgLbGlobal(var, scip->mem->probmem, scip->set, scip->stat, scip->lp,
18099  scip->branchcand, scip->eventqueue, newbound) );
18100  break;
18101 
18102  case SCIP_STAGE_PRESOLVING:
18103  if( !SCIPinProbing(scip) )
18104  {
18105  assert(SCIPtreeGetCurrentDepth(scip->tree) == 0);
18106  assert(scip->tree->root == SCIPtreeGetCurrentNode(scip->tree));
18107 
18108  SCIP_CALL( SCIPnodeAddBoundchg(scip->tree->root, scip->mem->probmem, scip->set, scip->stat, scip->transprob,
18109  scip->origprob, scip->tree, scip->lp, scip->branchcand, scip->eventqueue, var, newbound,
18111 
18113  {
18114  SCIP_Bool infeasible;
18115 
18116  SCIP_CALL( SCIPchgVarType(scip, var, SCIP_VARTYPE_BINARY, &infeasible) );
18117  assert(!infeasible);
18118  }
18119  break;
18120  }
18121  /*lint -fallthrough*/
18122  case SCIP_STAGE_SOLVING:
18123  SCIP_CALL( SCIPnodeAddBoundchg(scip->tree->root, scip->mem->probmem, scip->set, scip->stat, scip->transprob,
18124  scip->origprob, scip->tree, scip->lp, scip->branchcand, scip->eventqueue, var, newbound,
18126  break;
18127 
18128  default:
18129  SCIPerrorMessage("invalid SCIP stage <%d>\n", scip->set->stage);
18130  return SCIP_INVALIDCALL;
18131  } /*lint !e788*/
18132 
18133  return SCIP_OKAY;
18134 }
18135 
18136 /** changes global upper bound of variable; if possible, adjust bound to integral value; also tightens the local bound,
18137  * if the global bound is better than the local bound
18138  *
18139  * @warning If SCIP is in presolving stage, it can happen that the internal variable array (which can be accessed via
18140  * SCIPgetVars()) gets resorted.
18141  *
18142  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
18143  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
18144  *
18145  * @pre This method can be called if @p scip is in one of the following stages:
18146  * - \ref SCIP_STAGE_PROBLEM
18147  * - \ref SCIP_STAGE_TRANSFORMING
18148  * - \ref SCIP_STAGE_PRESOLVING
18149  * - \ref SCIP_STAGE_SOLVING
18150  *
18151  * @note During presolving, an integer variable whose bound changes to {0,1} is upgraded to a binary variable.
18152  */
18154  SCIP* scip, /**< SCIP data structure */
18155  SCIP_VAR* var, /**< variable to change the bound for */
18156  SCIP_Real newbound /**< new value for bound */
18157  )
18158 {
18159  SCIP_CALL( checkStage(scip, "SCIPchgVarUbGlobal", FALSE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) );
18160 
18161  SCIPvarAdjustUb(var, scip->set, &newbound);
18162 
18163  switch( scip->set->stage )
18164  {
18165  case SCIP_STAGE_PROBLEM:
18166  assert(!SCIPvarIsTransformed(var));
18167  SCIP_CALL( SCIPvarChgUbGlobal(var, scip->mem->probmem, scip->set, scip->stat, scip->lp,
18168  scip->branchcand, scip->eventqueue, newbound) );
18169  SCIP_CALL( SCIPvarChgUbLocal(var, scip->mem->probmem, scip->set, scip->stat, scip->lp,
18170  scip->branchcand, scip->eventqueue, newbound) );
18171  SCIP_CALL( SCIPvarChgUbOriginal(var, scip->set, newbound) );
18172  break;
18173 
18175  SCIP_CALL( SCIPvarChgUbGlobal(var, scip->mem->probmem, scip->set, scip->stat, scip->lp,
18176  scip->branchcand, scip->eventqueue, newbound) );
18177  break;
18178 
18179  case SCIP_STAGE_PRESOLVING:
18180  if( !SCIPinProbing(scip) )
18181  {
18182  assert(SCIPtreeGetCurrentDepth(scip->tree) == 0);
18183  assert(scip->tree->root == SCIPtreeGetCurrentNode(scip->tree));
18184 
18185  SCIP_CALL( SCIPnodeAddBoundchg(scip->tree->root, scip->mem->probmem, scip->set, scip->stat, scip->transprob,
18186  scip->origprob, scip->tree, scip->lp, scip->branchcand, scip->eventqueue, var, newbound,
18188 
18190  {
18191  SCIP_Bool infeasible;
18192 
18193  SCIP_CALL( SCIPchgVarType(scip, var, SCIP_VARTYPE_BINARY, &infeasible) );
18194  assert(!infeasible);
18195  }
18196  break;
18197  }
18198  /*lint -fallthrough*/
18199  case SCIP_STAGE_SOLVING:
18200  SCIP_CALL( SCIPnodeAddBoundchg(scip->tree->root, scip->mem->probmem, scip->set, scip->stat, scip->transprob,
18201  scip->origprob, scip->tree, scip->lp, scip->branchcand, scip->eventqueue, var, newbound,
18203  break;
18204 
18205  default:
18206  SCIPerrorMessage("invalid SCIP stage <%d>\n", scip->set->stage);
18207  return SCIP_INVALIDCALL;
18208  } /*lint !e788*/
18209 
18210  return SCIP_OKAY;
18211 }
18212 
18213 /** changes lazy lower bound of the variable, this is only possible if the variable is not in the LP yet
18214  *
18215  * lazy bounds are bounds, that are enforced by constraints and the objective function; hence, these bounds do not need
18216  * to be put into the LP explicitly.
18217  *
18218  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
18219  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
18220  *
18221  * @pre This method can be called if @p scip is in one of the following stages:
18222  * - \ref SCIP_STAGE_PROBLEM
18223  * - \ref SCIP_STAGE_TRANSFORMING
18224  * - \ref SCIP_STAGE_TRANSFORMED
18225  * - \ref SCIP_STAGE_PRESOLVING
18226  * - \ref SCIP_STAGE_SOLVING
18227  *
18228  * @note lazy bounds are useful for branch-and-price since the corresponding variable bounds are not part of the LP
18229  */
18231  SCIP* scip, /**< SCIP data structure */
18232  SCIP_VAR* var, /**< problem variable */
18233  SCIP_Real lazylb /**< the lazy lower bound to be set */
18234  )
18235 {
18236  assert(scip != NULL);
18237  assert(var != NULL);
18238 
18239  SCIP_CALL( checkStage(scip, "SCIPchgVarLbLazy", FALSE, TRUE, TRUE, TRUE, FALSE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) );
18240 
18241  SCIP_CALL( SCIPvarChgLbLazy(var, scip->set, lazylb) );
18242 
18243  return SCIP_OKAY;
18244 }
18245 
18246 /** changes lazy upper bound of the variable, this is only possible if the variable is not in the LP yet
18247  *
18248  * lazy bounds are bounds, that are enforced by constraints and the objective function; hence, these bounds do not need
18249  * to be put into the LP explicitly.
18250  *
18251  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
18252  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
18253  *
18254  * @pre This method can be called if @p scip is in one of the following stages:
18255  * - \ref SCIP_STAGE_PROBLEM
18256  * - \ref SCIP_STAGE_TRANSFORMING
18257  * - \ref SCIP_STAGE_TRANSFORMED
18258  * - \ref SCIP_STAGE_PRESOLVING
18259  * - \ref SCIP_STAGE_SOLVING
18260  *
18261  * @note lazy bounds are useful for branch-and-price since the corresponding variable bounds are not part of the LP
18262  */
18264  SCIP* scip, /**< SCIP data structure */
18265  SCIP_VAR* var, /**< problem variable */
18266  SCIP_Real lazyub /**< the lazy lower bound to be set */
18267  )
18268 {
18269  assert(scip != NULL);
18270  assert(var != NULL);
18271 
18272  SCIP_CALL( checkStage(scip, "SCIPchgVarUbLazy", FALSE, TRUE, TRUE, TRUE, FALSE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) );
18273 
18274  SCIP_CALL( SCIPvarChgUbLazy(var, scip->set, lazyub) );
18275 
18276  return SCIP_OKAY;
18277 }
18278 
18279 /** changes lower bound of variable in preprocessing or in the current node, if the new bound is tighter
18280  * (w.r.t. bound strengthening epsilon) than the current bound; if possible, adjusts bound to integral value;
18281  * doesn't store any inference information in the bound change, such that in conflict analysis, this change
18282  * is treated like a branching decision
18283  *
18284  * @warning If SCIP is in presolving stage, it can happen that the internal variable array (which can be accessed via
18285  * SCIPgetVars()) gets resorted.
18286  *
18287  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
18288  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
18289  *
18290  * @pre This method can be called if @p scip is in one of the following stages:
18291  * - \ref SCIP_STAGE_PROBLEM
18292  * - \ref SCIP_STAGE_PRESOLVING
18293  * - \ref SCIP_STAGE_SOLVING
18294  *
18295  * @note During presolving, an integer variable whose bound changes to {0,1} is upgraded to a binary variable.
18296  */
18298  SCIP* scip, /**< SCIP data structure */
18299  SCIP_VAR* var, /**< variable to change the bound for */
18300  SCIP_Real newbound, /**< new value for bound */
18301  SCIP_Bool force, /**< force tightening even if below bound strengthening tolerance */
18302  SCIP_Bool* infeasible, /**< pointer to store whether the new domain is empty */
18303  SCIP_Bool* tightened /**< pointer to store whether the bound was tightened, or NULL */
18304  )
18305 {
18306  SCIP_Real lb;
18307  SCIP_Real ub;
18308 
18309  assert(infeasible != NULL);
18310  /** @todo if needed provide pending local/global bound changes that will be flushed after leaving diving mode (as in struct_tree.h) */
18311  assert(!SCIPinDive(scip));
18312 
18313  SCIP_CALL( checkStage(scip, "SCIPtightenVarLb", FALSE, TRUE, FALSE, TRUE, FALSE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) );
18314 
18315  *infeasible = FALSE;
18316  if( tightened != NULL )
18317  *tightened = FALSE;
18318 
18319  SCIPvarAdjustLb(var, scip->set, &newbound);
18320 
18321  /* get current bounds */
18322  lb = SCIPcomputeVarLbLocal(scip, var);
18323  ub = SCIPcomputeVarUbLocal(scip, var);
18324  assert(SCIPsetIsLE(scip->set, lb, ub));
18325 
18326  if( SCIPsetIsFeasGT(scip->set, newbound, ub) )
18327  {
18328  *infeasible = TRUE;
18329  return SCIP_OKAY;
18330  }
18331  newbound = MIN(newbound, ub);
18332 
18333  if( (force && SCIPsetIsLE(scip->set, newbound, lb)) || (!force && !SCIPsetIsLbBetter(scip->set, newbound, lb, ub)) )
18334  return SCIP_OKAY;
18335 
18336  switch( scip->set->stage )
18337  {
18338  case SCIP_STAGE_PROBLEM:
18339  assert(!SCIPvarIsTransformed(var));
18340  SCIP_CALL( SCIPvarChgLbGlobal(var, scip->mem->probmem, scip->set, scip->stat, scip->lp,
18341  scip->branchcand, scip->eventqueue, newbound) );
18342  SCIP_CALL( SCIPvarChgLbLocal(var, scip->mem->probmem, scip->set, scip->stat, scip->lp,
18343  scip->branchcand, scip->eventqueue, newbound) );
18344  SCIP_CALL( SCIPvarChgLbOriginal(var, scip->set, newbound) );
18345  break;
18347  SCIP_CALL( SCIPvarChgLbGlobal(var, scip->mem->probmem, scip->set, scip->stat, scip->lp,
18348  scip->branchcand, scip->eventqueue, newbound) );
18349  break;
18350  case SCIP_STAGE_PRESOLVING:
18351  if( !SCIPinProbing(scip) )
18352  {
18353  assert(SCIPtreeGetCurrentDepth(scip->tree) == 0);
18354  assert(scip->tree->root == SCIPtreeGetCurrentNode(scip->tree));
18355 
18356  SCIP_CALL( SCIPnodeAddBoundchg(scip->tree->root, scip->mem->probmem, scip->set, scip->stat, scip->transprob,
18357  scip->origprob, scip->tree, scip->lp, scip->branchcand, scip->eventqueue, var, newbound,
18359 
18361  {
18362  SCIP_CALL( SCIPchgVarType(scip, var, SCIP_VARTYPE_BINARY, infeasible) );
18363  assert(!(*infeasible));
18364  }
18365  break;
18366  }
18367  /*lint -fallthrough*/
18368  case SCIP_STAGE_SOLVING:
18370  scip->transprob, scip->origprob, scip->tree, scip->lp, scip->branchcand, scip->eventqueue, var, newbound,
18372  break;
18373 
18374  default:
18375  SCIPerrorMessage("invalid SCIP stage <%d>\n", scip->set->stage);
18376  return SCIP_INVALIDCALL;
18377  } /*lint !e788*/
18378 
18379  if( tightened != NULL )
18380  *tightened = TRUE;
18381 
18382  return SCIP_OKAY;
18383 }
18384 
18385 /** changes upper bound of variable in preprocessing or in the current node, if the new bound is tighter
18386  * (w.r.t. bound strengthening epsilon) than the current bound; if possible, adjusts bound to integral value;
18387  * doesn't store any inference information in the bound change, such that in conflict analysis, this change
18388  * is treated like a branching decision
18389  *
18390  * @warning If SCIP is in presolving stage, it can happen that the internal variable array (which can be accessed via
18391  * SCIPgetVars()) gets resorted.
18392  *
18393  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
18394  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
18395  *
18396  * @pre This method can be called if @p scip is in one of the following stages:
18397  * - \ref SCIP_STAGE_PROBLEM
18398  * - \ref SCIP_STAGE_PRESOLVING
18399  * - \ref SCIP_STAGE_SOLVING
18400  *
18401  * @note During presolving, an integer variable whose bound changes to {0,1} is upgraded to a binary variable.
18402  */
18404  SCIP* scip, /**< SCIP data structure */
18405  SCIP_VAR* var, /**< variable to change the bound for */
18406  SCIP_Real newbound, /**< new value for bound */
18407  SCIP_Bool force, /**< force tightening even if below bound strengthening tolerance */
18408  SCIP_Bool* infeasible, /**< pointer to store whether the new domain is empty */
18409  SCIP_Bool* tightened /**< pointer to store whether the bound was tightened, or NULL */
18410  )
18411 {
18412  SCIP_Real lb;
18413  SCIP_Real ub;
18414 
18415  assert(infeasible != NULL);
18416  /** @todo if needed provide pending local/global bound changes that will be flushed after leaving diving mode (as in struct_tree.h) */
18417  assert(!SCIPinDive(scip));
18418 
18419  SCIP_CALL( checkStage(scip, "SCIPtightenVarUb", FALSE, TRUE, FALSE, TRUE, FALSE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) );
18420 
18421  *infeasible = FALSE;
18422  if( tightened != NULL )
18423  *tightened = FALSE;
18424 
18425  SCIPvarAdjustUb(var, scip->set, &newbound);
18426 
18427  /* get current bounds */
18428  lb = SCIPcomputeVarLbLocal(scip, var);
18429  ub = SCIPcomputeVarUbLocal(scip, var);
18430  assert(SCIPsetIsLE(scip->set, lb, ub));
18431 
18432  if( SCIPsetIsFeasLT(scip->set, newbound, lb) )
18433  {
18434  *infeasible = TRUE;
18435  return SCIP_OKAY;
18436  }
18437  newbound = MAX(newbound, lb);
18438 
18439  if( (force && SCIPsetIsGE(scip->set, newbound, ub)) || (!force && !SCIPsetIsUbBetter(scip->set, newbound, lb, ub)) )
18440  return SCIP_OKAY;
18441 
18442  switch( scip->set->stage )
18443  {
18444  case SCIP_STAGE_PROBLEM:
18445  assert(!SCIPvarIsTransformed(var));
18446  SCIP_CALL( SCIPvarChgUbGlobal(var, scip->mem->probmem, scip->set, scip->stat, scip->lp,
18447  scip->branchcand, scip->eventqueue, newbound) );
18448  SCIP_CALL( SCIPvarChgUbLocal(var, scip->mem->probmem, scip->set, scip->stat, scip->lp,
18449  scip->branchcand, scip->eventqueue, newbound) );
18450  SCIP_CALL( SCIPvarChgUbOriginal(var, scip->set, newbound) );
18451  break;
18453  SCIP_CALL( SCIPvarChgUbGlobal(var, scip->mem->probmem, scip->set, scip->stat, scip->lp,
18454  scip->branchcand, scip->eventqueue, newbound) );
18455  break;
18456  case SCIP_STAGE_PRESOLVING:
18457  if( !SCIPinProbing(scip) )
18458  {
18459  assert(SCIPtreeGetCurrentDepth(scip->tree) == 0);
18460  assert(scip->tree->root == SCIPtreeGetCurrentNode(scip->tree));
18461 
18462  SCIP_CALL( SCIPnodeAddBoundchg(scip->tree->root, scip->mem->probmem, scip->set, scip->stat, scip->transprob,
18463  scip->origprob, scip->tree, scip->lp, scip->branchcand, scip->eventqueue, var, newbound,
18465 
18467  {
18468  SCIP_CALL( SCIPchgVarType(scip, var, SCIP_VARTYPE_BINARY, infeasible) );
18469  assert(!(*infeasible));
18470  }
18471  break;
18472  }
18473  /*lint -fallthrough*/
18474  case SCIP_STAGE_SOLVING:
18476  scip->transprob, scip->origprob, scip->tree, scip->lp, scip->branchcand, scip->eventqueue, var, newbound,
18478  break;
18479 
18480  default:
18481  SCIPerrorMessage("invalid SCIP stage <%d>\n", scip->set->stage);
18482  return SCIP_INVALIDCALL;
18483  } /*lint !e788*/
18484 
18485  if( tightened != NULL )
18486  *tightened = TRUE;
18487 
18488  return SCIP_OKAY;
18489 }
18490 
18491 /** changes lower bound of variable in preprocessing or in the current node, if the new bound is tighter
18492  * (w.r.t. bound strengthening epsilon) than the current bound; if possible, adjusts bound to integral value;
18493  * the given inference constraint is stored, such that the conflict analysis is able to find out the reason
18494  * for the deduction of the bound change
18495  *
18496  * @warning If SCIP is in presolving stage, it can happen that the internal variable array (which can be accessed via
18497  * SCIPgetVars()) gets resorted.
18498  *
18499  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
18500  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
18501  *
18502  * @pre This method can be called if @p scip is in one of the following stages:
18503  * - \ref SCIP_STAGE_PROBLEM
18504  * - \ref SCIP_STAGE_PRESOLVING
18505  * - \ref SCIP_STAGE_SOLVING
18506  *
18507  * @note During presolving, an integer variable whose bound changes to {0,1} is upgraded to a binary variable.
18508  */
18510  SCIP* scip, /**< SCIP data structure */
18511  SCIP_VAR* var, /**< variable to change the bound for */
18512  SCIP_Real newbound, /**< new value for bound */
18513  SCIP_CONS* infercons, /**< constraint that deduced the bound change */
18514  int inferinfo, /**< user information for inference to help resolving the conflict */
18515  SCIP_Bool force, /**< force tightening even if below bound strengthening tolerance */
18516  SCIP_Bool* infeasible, /**< pointer to store whether the bound change is infeasible */
18517  SCIP_Bool* tightened /**< pointer to store whether the bound was tightened, or NULL */
18518  )
18519 {
18520  SCIP_Real lb;
18521  SCIP_Real ub;
18522 
18523  assert(infeasible != NULL);
18524 
18525  SCIP_CALL( checkStage(scip, "SCIPinferVarLbCons", FALSE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) );
18526 
18527  *infeasible = FALSE;
18528  if( tightened != NULL )
18529  *tightened = FALSE;
18530 
18531  SCIPvarAdjustLb(var, scip->set, &newbound);
18532 
18533  /* get current bounds */
18534  lb = SCIPvarGetLbLocal(var);
18535  ub = SCIPvarGetUbLocal(var);
18536  assert(SCIPsetIsLE(scip->set, lb, ub));
18537 
18538  if( SCIPsetIsFeasGT(scip->set, newbound, ub) )
18539  {
18540  *infeasible = TRUE;
18541  return SCIP_OKAY;
18542  }
18543  newbound = MIN(newbound, ub);
18544 
18545  if( (force && SCIPsetIsLE(scip->set, newbound, lb)) || (!force && !SCIPsetIsLbBetter(scip->set, newbound, lb, ub)) )
18546  return SCIP_OKAY;
18547 
18548  switch( scip->set->stage )
18549  {
18550  case SCIP_STAGE_PROBLEM:
18551  assert(!SCIPvarIsTransformed(var));
18552  SCIP_CALL( SCIPvarChgLbGlobal(var, scip->mem->probmem, scip->set, scip->stat, scip->lp,
18553  scip->branchcand, scip->eventqueue, newbound) );
18554  SCIP_CALL( SCIPvarChgLbLocal(var, scip->mem->probmem, scip->set, scip->stat, scip->lp,
18555  scip->branchcand, scip->eventqueue, newbound) );
18556  SCIP_CALL( SCIPvarChgLbOriginal(var, scip->set, newbound) );
18557  break;
18558 
18559  case SCIP_STAGE_PRESOLVING:
18560  if( !SCIPinProbing(scip) )
18561  {
18562  assert(SCIPtreeGetCurrentDepth(scip->tree) == 0);
18563  assert(scip->tree->root == SCIPtreeGetCurrentNode(scip->tree));
18564 
18565  SCIP_CALL( SCIPnodeAddBoundchg(scip->tree->root, scip->mem->probmem, scip->set, scip->stat, scip->transprob,
18566  scip->origprob, scip->tree, scip->lp, scip->branchcand, scip->eventqueue, var, newbound,
18568 
18570  {
18571  SCIP_CALL( SCIPchgVarType(scip, var, SCIP_VARTYPE_BINARY, infeasible) );
18572  assert(!(*infeasible));
18573  }
18574  break;
18575  }
18576  /*lint -fallthrough*/
18577  case SCIP_STAGE_SOLVING:
18579  scip->transprob, scip->origprob, scip->tree, scip->lp, scip->branchcand, scip->eventqueue, var, newbound,
18580  SCIP_BOUNDTYPE_LOWER, infercons, NULL, inferinfo, FALSE) );
18581  break;
18582 
18583  default:
18584  SCIPerrorMessage("invalid SCIP stage <%d>\n", scip->set->stage);
18585  return SCIP_INVALIDCALL;
18586  } /*lint !e788*/
18587 
18588  if( tightened != NULL )
18589  *tightened = TRUE;
18590 
18591  return SCIP_OKAY;
18592 }
18593 
18594 /** changes upper bound of variable in preprocessing or in the current node, if the new bound is tighter
18595  * (w.r.t. bound strengthening epsilon) than the current bound; if possible, adjusts bound to integral value;
18596  * the given inference constraint is stored, such that the conflict analysis is able to find out the reason
18597  * for the deduction of the bound change
18598  *
18599  * @warning If SCIP is in presolving stage, it can happen that the internal variable array (which can be accessed via
18600  * SCIPgetVars()) gets resorted.
18601  *
18602  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
18603  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
18604  *
18605  * @pre This method can be called if @p scip is in one of the following stages:
18606  * - \ref SCIP_STAGE_PROBLEM
18607  * - \ref SCIP_STAGE_PRESOLVING
18608  * - \ref SCIP_STAGE_SOLVING
18609  *
18610  * @note During presolving, an integer variable whose bound changes to {0,1} is upgraded to a binary variable.
18611  */
18613  SCIP* scip, /**< SCIP data structure */
18614  SCIP_VAR* var, /**< variable to change the bound for */
18615  SCIP_Real newbound, /**< new value for bound */
18616  SCIP_CONS* infercons, /**< constraint that deduced the bound change */
18617  int inferinfo, /**< user information for inference to help resolving the conflict */
18618  SCIP_Bool force, /**< force tightening even if below bound strengthening tolerance */
18619  SCIP_Bool* infeasible, /**< pointer to store whether the bound change is infeasible */
18620  SCIP_Bool* tightened /**< pointer to store whether the bound was tightened, or NULL */
18621  )
18622 {
18623  SCIP_Real lb;
18624  SCIP_Real ub;
18625 
18626  assert(infeasible != NULL);
18627 
18628  SCIP_CALL( checkStage(scip, "SCIPinferVarUbCons", FALSE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) );
18629 
18630  *infeasible = FALSE;
18631  if( tightened != NULL )
18632  *tightened = FALSE;
18633 
18634  SCIPvarAdjustUb(var, scip->set, &newbound);
18635 
18636  /* get current bounds */
18637  lb = SCIPvarGetLbLocal(var);
18638  ub = SCIPvarGetUbLocal(var);
18639  assert(SCIPsetIsLE(scip->set, lb, ub));
18640 
18641  if( SCIPsetIsFeasLT(scip->set, newbound, lb) )
18642  {
18643  *infeasible = TRUE;
18644  return SCIP_OKAY;
18645  }
18646  newbound = MAX(newbound, lb);
18647 
18648  if( (force && SCIPsetIsGE(scip->set, newbound, ub)) || (!force && !SCIPsetIsUbBetter(scip->set, newbound, lb, ub)) )
18649  return SCIP_OKAY;
18650 
18651  switch( scip->set->stage )
18652  {
18653  case SCIP_STAGE_PROBLEM:
18654  assert(!SCIPvarIsTransformed(var));
18655  SCIP_CALL( SCIPvarChgUbGlobal(var, scip->mem->probmem, scip->set, scip->stat, scip->lp,
18656  scip->branchcand, scip->eventqueue, newbound) );
18657  SCIP_CALL( SCIPvarChgUbLocal(var, scip->mem->probmem, scip->set, scip->stat, scip->lp,
18658  scip->branchcand, scip->eventqueue, newbound) );
18659  SCIP_CALL( SCIPvarChgUbOriginal(var, scip->set, newbound) );
18660  break;
18661 
18662  case SCIP_STAGE_PRESOLVING:
18663  if( !SCIPinProbing(scip) )
18664  {
18665  assert(SCIPtreeGetCurrentDepth(scip->tree) == 0);
18666  assert(scip->tree->root == SCIPtreeGetCurrentNode(scip->tree));
18667 
18668  SCIP_CALL( SCIPnodeAddBoundchg(scip->tree->root, scip->mem->probmem, scip->set, scip->stat, scip->transprob,
18669  scip->origprob, scip->tree, scip->lp, scip->branchcand, scip->eventqueue, var, newbound,
18671 
18673  {
18674  SCIP_CALL( SCIPchgVarType(scip, var, SCIP_VARTYPE_BINARY, infeasible) );
18675  assert(!(*infeasible));
18676  }
18677  break;
18678  }
18679  /*lint -fallthrough*/
18680  case SCIP_STAGE_SOLVING:
18682  scip->transprob, scip->origprob, scip->tree, scip->lp, scip->branchcand, scip->eventqueue, var, newbound,
18683  SCIP_BOUNDTYPE_UPPER, infercons, NULL, inferinfo, FALSE) );
18684  break;
18685 
18686  default:
18687  SCIPerrorMessage("invalid SCIP stage <%d>\n", scip->set->stage);
18688  return SCIP_INVALIDCALL;
18689  } /*lint !e788*/
18690 
18691  if( tightened != NULL )
18692  *tightened = TRUE;
18693 
18694  return SCIP_OKAY;
18695 }
18696 
18697 /** depending on SCIP's stage, fixes binary variable in the problem, in preprocessing, or in current node;
18698  * the given inference constraint is stored, such that the conflict analysis is able to find out the reason for the
18699  * deduction of the fixing
18700  *
18701  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
18702  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
18703  *
18704  * @pre This method can be called if @p scip is in one of the following stages:
18705  * - \ref SCIP_STAGE_PROBLEM
18706  * - \ref SCIP_STAGE_PRESOLVING
18707  * - \ref SCIP_STAGE_SOLVING
18708  */
18710  SCIP* scip, /**< SCIP data structure */
18711  SCIP_VAR* var, /**< binary variable to fix */
18712  SCIP_Bool fixedval, /**< value to fix binary variable to */
18713  SCIP_CONS* infercons, /**< constraint that deduced the fixing */
18714  int inferinfo, /**< user information for inference to help resolving the conflict */
18715  SCIP_Bool* infeasible, /**< pointer to store whether the fixing is infeasible */
18716  SCIP_Bool* tightened /**< pointer to store whether the fixing tightened the local bounds, or NULL */
18717  )
18718 {
18719  SCIP_Real lb;
18720  SCIP_Real ub;
18721 
18722  assert(SCIPvarIsBinary(var));
18723  assert(fixedval == TRUE || fixedval == FALSE);
18724  assert(infeasible != NULL);
18725 
18726  SCIP_CALL( checkStage(scip, "SCIPinferBinvarCons", FALSE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) );
18727 
18728  *infeasible = FALSE;
18729  if( tightened != NULL )
18730  *tightened = FALSE;
18731 
18732  /* get current bounds */
18733  lb = SCIPvarGetLbLocal(var);
18734  ub = SCIPvarGetUbLocal(var);
18735  assert(SCIPsetIsEQ(scip->set, lb, 0.0) || SCIPsetIsEQ(scip->set, lb, 1.0));
18736  assert(SCIPsetIsEQ(scip->set, ub, 0.0) || SCIPsetIsEQ(scip->set, ub, 1.0));
18737  assert(SCIPsetIsLE(scip->set, lb, ub));
18738 
18739  /* check, if variable is already fixed */
18740  if( (lb > 0.5) || (ub < 0.5) )
18741  {
18742  *infeasible = (fixedval == (lb < 0.5));
18743 
18744  return SCIP_OKAY;
18745  }
18746 
18747  /* apply the fixing */
18748  switch( scip->set->stage )
18749  {
18750  case SCIP_STAGE_PROBLEM:
18751  assert(!SCIPvarIsTransformed(var));
18752  if( fixedval == TRUE )
18753  {
18754  SCIP_CALL( SCIPchgVarLb(scip, var, 1.0) );
18755  }
18756  else
18757  {
18758  SCIP_CALL( SCIPchgVarUb(scip, var, 0.0) );
18759  }
18760  break;
18761 
18762  case SCIP_STAGE_PRESOLVING:
18763  if( SCIPtreeGetCurrentDepth(scip->tree) == 0 )
18764  {
18765  SCIP_Bool fixed;
18766 
18767  SCIP_CALL( SCIPvarFix(var, scip->mem->probmem, scip->set, scip->stat, scip->transprob, scip->origprob, scip->primal, scip->tree,
18768  scip->lp, scip->branchcand, scip->eventqueue, (SCIP_Real)fixedval, infeasible, &fixed) );
18769  break;
18770  }
18771  /*lint -fallthrough*/
18772  case SCIP_STAGE_SOLVING:
18773  if( fixedval == TRUE )
18774  {
18776  scip->transprob, scip->origprob, scip->tree, scip->lp, scip->branchcand, scip->eventqueue, var, 1.0, SCIP_BOUNDTYPE_LOWER,
18777  infercons, NULL, inferinfo, FALSE) );
18778  }
18779  else
18780  {
18782  scip->transprob, scip->origprob, scip->tree, scip->lp, scip->branchcand, scip->eventqueue, var, 0.0, SCIP_BOUNDTYPE_UPPER,
18783  infercons, NULL, inferinfo, FALSE) );
18784  }
18785  break;
18786 
18787  default:
18788  SCIPerrorMessage("invalid SCIP stage <%d>\n", scip->set->stage);
18789  return SCIP_INVALIDCALL;
18790  } /*lint !e788*/
18791 
18792  if( tightened != NULL )
18793  *tightened = TRUE;
18794 
18795  return SCIP_OKAY;
18796 }
18797 
18798 /** changes lower bound of variable in preprocessing or in the current node, if the new bound is tighter
18799  * (w.r.t. bound strengthening epsilon) than the current bound; if possible, adjusts bound to integral value;
18800  * the given inference propagator is stored, such that the conflict analysis is able to find out the reason
18801  * for the deduction of the bound change
18802  *
18803  * @warning If SCIP is in presolving stage, it can happen that the internal variable array (which can be accessed via
18804  * SCIPgetVars()) gets resorted.
18805  *
18806  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
18807  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
18808  *
18809  * @pre This method can be called if @p scip is in one of the following stages:
18810  * - \ref SCIP_STAGE_PROBLEM
18811  * - \ref SCIP_STAGE_PRESOLVING
18812  * - \ref SCIP_STAGE_SOLVING
18813  *
18814  * @note During presolving, an integer variable whose bound changes to {0,1} is upgraded to a binary variable.
18815  */
18817  SCIP* scip, /**< SCIP data structure */
18818  SCIP_VAR* var, /**< variable to change the bound for */
18819  SCIP_Real newbound, /**< new value for bound */
18820  SCIP_PROP* inferprop, /**< propagator that deduced the bound change */
18821  int inferinfo, /**< user information for inference to help resolving the conflict */
18822  SCIP_Bool force, /**< force tightening even if below bound strengthening tolerance */
18823  SCIP_Bool* infeasible, /**< pointer to store whether the bound change is infeasible */
18824  SCIP_Bool* tightened /**< pointer to store whether the bound was tightened, or NULL */
18825  )
18826 {
18827  SCIP_Real lb;
18828  SCIP_Real ub;
18829 
18830  assert(infeasible != NULL);
18831 
18832  SCIP_CALL( checkStage(scip, "SCIPinferVarLbProp", FALSE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) );
18833 
18834  *infeasible = FALSE;
18835  if( tightened != NULL )
18836  *tightened = FALSE;
18837 
18838  SCIPvarAdjustLb(var, scip->set, &newbound);
18839 
18840  /* get current bounds */
18841  lb = SCIPvarGetLbLocal(var);
18842  ub = SCIPvarGetUbLocal(var);
18843  assert(SCIPsetIsLE(scip->set, lb, ub));
18844 
18845  if( SCIPsetIsFeasGT(scip->set, newbound, ub) )
18846  {
18847  *infeasible = TRUE;
18848  return SCIP_OKAY;
18849  }
18850  newbound = MIN(newbound, ub);
18851 
18852  if( !force && !SCIPsetIsLbBetter(scip->set, newbound, lb, ub) )
18853  return SCIP_OKAY;
18854 
18855  switch( scip->set->stage )
18856  {
18857  case SCIP_STAGE_PROBLEM:
18858  assert(!SCIPvarIsTransformed(var));
18859  SCIP_CALL( SCIPvarChgLbGlobal(var, scip->mem->probmem, scip->set, scip->stat, scip->lp,
18860  scip->branchcand, scip->eventqueue, newbound) );
18861  SCIP_CALL( SCIPvarChgLbLocal(var, scip->mem->probmem, scip->set, scip->stat, scip->lp,
18862  scip->branchcand, scip->eventqueue, newbound) );
18863  SCIP_CALL( SCIPvarChgLbOriginal(var, scip->set, newbound) );
18864  break;
18865 
18866  case SCIP_STAGE_PRESOLVING:
18867  if( !SCIPinProbing(scip) )
18868  {
18869  assert(SCIPtreeGetCurrentDepth(scip->tree) == 0);
18870  assert(scip->tree->root == SCIPtreeGetCurrentNode(scip->tree));
18871 
18872  SCIP_CALL( SCIPnodeAddBoundchg(scip->tree->root, scip->mem->probmem, scip->set, scip->stat, scip->transprob,
18873  scip->origprob, scip->tree, scip->lp, scip->branchcand, scip->eventqueue, var, newbound,
18875 
18877  {
18878  SCIP_CALL( SCIPchgVarType(scip, var, SCIP_VARTYPE_BINARY, infeasible) );
18879  assert(!(*infeasible));
18880  }
18881  break;
18882  }
18883  /*lint -fallthrough*/
18884  case SCIP_STAGE_SOLVING:
18886  scip->transprob, scip->origprob, scip->tree, scip->lp, scip->branchcand, scip->eventqueue, var, newbound,
18887  SCIP_BOUNDTYPE_LOWER, NULL, inferprop, inferinfo, FALSE) );
18888  break;
18889 
18890  default:
18891  SCIPerrorMessage("invalid SCIP stage <%d>\n", scip->set->stage);
18892  return SCIP_INVALIDCALL;
18893  } /*lint !e788*/
18894 
18895  if( tightened != NULL )
18896  *tightened = TRUE;
18897 
18898  return SCIP_OKAY;
18899 }
18900 
18901 /** changes upper bound of variable in preprocessing or in the current node, if the new bound is tighter
18902  * (w.r.t. bound strengthening epsilon) than the current bound; if possible, adjusts bound to integral value;
18903  * the given inference propagator is stored, such that the conflict analysis is able to find out the reason
18904  * for the deduction of the bound change
18905  *
18906  * @warning If SCIP is in presolving stage, it can happen that the internal variable array (which can be accessed via
18907  * SCIPgetVars()) gets resorted.
18908  *
18909  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
18910  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
18911  *
18912  * @pre This method can be called if @p scip is in one of the following stages:
18913  * - \ref SCIP_STAGE_PROBLEM
18914  * - \ref SCIP_STAGE_PRESOLVING
18915  * - \ref SCIP_STAGE_SOLVING
18916  *
18917  * @note During presolving, an integer variable whose bound changes to {0,1} is upgraded to a binary variable.
18918  */
18920  SCIP* scip, /**< SCIP data structure */
18921  SCIP_VAR* var, /**< variable to change the bound for */
18922  SCIP_Real newbound, /**< new value for bound */
18923  SCIP_PROP* inferprop, /**< propagator that deduced the bound change */
18924  int inferinfo, /**< user information for inference to help resolving the conflict */
18925  SCIP_Bool force, /**< force tightening even if below bound strengthening tolerance */
18926  SCIP_Bool* infeasible, /**< pointer to store whether the bound change is infeasible */
18927  SCIP_Bool* tightened /**< pointer to store whether the bound was tightened, or NULL */
18928  )
18929 {
18930  SCIP_Real lb;
18931  SCIP_Real ub;
18932 
18933  assert(infeasible != NULL);
18934 
18935  SCIP_CALL( checkStage(scip, "SCIPinferVarUbProp", FALSE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) );
18936 
18937  *infeasible = FALSE;
18938  if( tightened != NULL )
18939  *tightened = FALSE;
18940 
18941  SCIPvarAdjustUb(var, scip->set, &newbound);
18942 
18943  /* get current bounds */
18944  lb = SCIPvarGetLbLocal(var);
18945  ub = SCIPvarGetUbLocal(var);
18946  assert(SCIPsetIsLE(scip->set, lb, ub));
18947 
18948  if( SCIPsetIsFeasLT(scip->set, newbound, lb) )
18949  {
18950  *infeasible = TRUE;
18951  return SCIP_OKAY;
18952  }
18953  newbound = MAX(newbound, lb);
18954 
18955  if( !force && !SCIPsetIsUbBetter(scip->set, newbound, lb, ub) )
18956  return SCIP_OKAY;
18957 
18958  switch( scip->set->stage )
18959  {
18960  case SCIP_STAGE_PROBLEM:
18961  assert(!SCIPvarIsTransformed(var));
18962  SCIP_CALL( SCIPvarChgUbGlobal(var, scip->mem->probmem, scip->set, scip->stat, scip->lp,
18963  scip->branchcand, scip->eventqueue, newbound) );
18964  SCIP_CALL( SCIPvarChgUbLocal(var, scip->mem->probmem, scip->set, scip->stat, scip->lp,
18965  scip->branchcand, scip->eventqueue, newbound) );
18966  SCIP_CALL( SCIPvarChgUbOriginal(var, scip->set, newbound) );
18967  break;
18968 
18969  case SCIP_STAGE_PRESOLVING:
18970  if( !SCIPinProbing(scip) )
18971  {
18972  assert(SCIPtreeGetCurrentDepth(scip->tree) == 0);
18973  assert(scip->tree->root == SCIPtreeGetCurrentNode(scip->tree));
18974 
18975  SCIP_CALL( SCIPnodeAddBoundchg(scip->tree->root, scip->mem->probmem, scip->set, scip->stat, scip->transprob,
18976  scip->origprob, scip->tree, scip->lp, scip->branchcand, scip->eventqueue, var, newbound,
18978 
18980  {
18981  SCIP_CALL( SCIPchgVarType(scip, var, SCIP_VARTYPE_BINARY, infeasible) );
18982  assert(!(*infeasible));
18983  }
18984  break;
18985  }
18986  /*lint -fallthrough*/
18987  case SCIP_STAGE_SOLVING:
18989  scip->transprob, scip->origprob, scip->tree, scip->lp, scip->branchcand, scip->eventqueue, var, newbound,
18990  SCIP_BOUNDTYPE_UPPER, NULL, inferprop, inferinfo, FALSE) );
18991  break;
18992 
18993  default:
18994  SCIPerrorMessage("invalid SCIP stage <%d>\n", scip->set->stage);
18995  return SCIP_INVALIDCALL;
18996  } /*lint !e788*/
18997 
18998  if( tightened != NULL )
18999  *tightened = TRUE;
19000 
19001  return SCIP_OKAY;
19002 }
19003 
19004 /** depending on SCIP's stage, fixes binary variable in the problem, in preprocessing, or in current node;
19005  * the given inference propagator is stored, such that the conflict analysis is able to find out the reason for the
19006  * deduction of the fixing
19007  *
19008  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
19009  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
19010  *
19011  * @pre This method can be called if @p scip is in one of the following stages:
19012  * - \ref SCIP_STAGE_PROBLEM
19013  * - \ref SCIP_STAGE_PRESOLVING
19014  * - \ref SCIP_STAGE_PRESOLVED
19015  * - \ref SCIP_STAGE_SOLVING
19016  */
19018  SCIP* scip, /**< SCIP data structure */
19019  SCIP_VAR* var, /**< binary variable to fix */
19020  SCIP_Bool fixedval, /**< value to fix binary variable to */
19021  SCIP_PROP* inferprop, /**< propagator that deduced the fixing */
19022  int inferinfo, /**< user information for inference to help resolving the conflict */
19023  SCIP_Bool* infeasible, /**< pointer to store whether the fixing is infeasible */
19024  SCIP_Bool* tightened /**< pointer to store whether the fixing tightened the local bounds, or NULL */
19025  )
19026 {
19027  SCIP_Real lb;
19028  SCIP_Real ub;
19029 
19030  assert(SCIPvarIsBinary(var));
19031  assert(fixedval == TRUE || fixedval == FALSE);
19032  assert(infeasible != NULL);
19033 
19034  SCIP_CALL( checkStage(scip, "SCIPinferBinvarProp", FALSE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, TRUE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) );
19035 
19036  *infeasible = FALSE;
19037  if( tightened != NULL )
19038  *tightened = FALSE;
19039 
19040  /* get current bounds */
19041  lb = SCIPvarGetLbLocal(var);
19042  ub = SCIPvarGetUbLocal(var);
19043  assert(SCIPsetIsEQ(scip->set, lb, 0.0) || SCIPsetIsEQ(scip->set, lb, 1.0));
19044  assert(SCIPsetIsEQ(scip->set, ub, 0.0) || SCIPsetIsEQ(scip->set, ub, 1.0));
19045  assert(SCIPsetIsLE(scip->set, lb, ub));
19046 
19047  /* check, if variable is already fixed */
19048  if( (lb > 0.5) || (ub < 0.5) )
19049  {
19050  *infeasible = (fixedval == (lb < 0.5));
19051 
19052  return SCIP_OKAY;
19053  }
19054 
19055  /* apply the fixing */
19056  switch( scip->set->stage )
19057  {
19058  case SCIP_STAGE_PROBLEM:
19059  assert(!SCIPvarIsTransformed(var));
19060  if( fixedval == TRUE )
19061  {
19062  SCIP_CALL( SCIPchgVarLb(scip, var, 1.0) );
19063  }
19064  else
19065  {
19066  SCIP_CALL( SCIPchgVarUb(scip, var, 0.0) );
19067  }
19068  break;
19069 
19070  case SCIP_STAGE_PRESOLVING:
19071  if( SCIPtreeGetCurrentDepth(scip->tree) == 0 )
19072  {
19073  SCIP_Bool fixed;
19074 
19075  SCIP_CALL( SCIPvarFix(var, scip->mem->probmem, scip->set, scip->stat, scip->transprob, scip->origprob, scip->primal, scip->tree,
19076  scip->lp, scip->branchcand, scip->eventqueue, (SCIP_Real)fixedval, infeasible, &fixed) );
19077  break;
19078  }
19079  /*lint -fallthrough*/
19080  case SCIP_STAGE_SOLVING:
19081  if( fixedval == TRUE )
19082  {
19084  scip->transprob, scip->origprob, scip->tree, scip->lp, scip->branchcand, scip->eventqueue, var, 1.0,
19085  SCIP_BOUNDTYPE_LOWER, NULL, inferprop, inferinfo, FALSE) );
19086  }
19087  else
19088  {
19090  scip->transprob, scip->origprob, scip->tree, scip->lp, scip->branchcand, scip->eventqueue, var, 0.0,
19091  SCIP_BOUNDTYPE_UPPER, NULL, inferprop, inferinfo, FALSE) );
19092  }
19093  break;
19094 
19095  default:
19096  SCIPerrorMessage("invalid SCIP stage <%d>\n", scip->set->stage);
19097  return SCIP_INVALIDCALL;
19098  } /*lint !e788*/
19099 
19100  if( tightened != NULL )
19101  *tightened = TRUE;
19102 
19103  return SCIP_OKAY;
19104 }
19105 
19106 /** changes global lower bound of variable in preprocessing or in the current node, if the new bound is tighter
19107  * (w.r.t. bound strengthening epsilon) than the current global bound; if possible, adjusts bound to integral value;
19108  * also tightens the local bound, if the global bound is better than the local bound
19109  *
19110  * @warning If SCIP is in presolving stage, it can happen that the internal variable array (which can be accessed via
19111  * SCIPgetVars()) gets resorted.
19112  *
19113  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
19114  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
19115  *
19116  * @pre This method can be called if @p scip is in one of the following stages:
19117  * - \ref SCIP_STAGE_PROBLEM
19118  * - \ref SCIP_STAGE_TRANSFORMING
19119  * - \ref SCIP_STAGE_PRESOLVING
19120  * - \ref SCIP_STAGE_SOLVING
19121  *
19122  * @note During presolving, an integer variable whose bound changes to {0,1} is upgraded to a binary variable.
19123  */
19125  SCIP* scip, /**< SCIP data structure */
19126  SCIP_VAR* var, /**< variable to change the bound for */
19127  SCIP_Real newbound, /**< new value for bound */
19128  SCIP_Bool force, /**< force tightening even if below bound strengthening tolerance */
19129  SCIP_Bool* infeasible, /**< pointer to store whether the new domain is empty */
19130  SCIP_Bool* tightened /**< pointer to store whether the bound was tightened, or NULL */
19131  )
19132 {
19133  SCIP_Real lb;
19134  SCIP_Real ub;
19135 
19136  assert(infeasible != NULL);
19137 
19138  SCIP_CALL( checkStage(scip, "SCIPtightenVarLbGlobal", FALSE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) );
19139 
19140  *infeasible = FALSE;
19141  if( tightened != NULL )
19142  *tightened = FALSE;
19143 
19144  SCIPvarAdjustLb(var, scip->set, &newbound);
19145 
19146  /* get current bounds */
19147  lb = SCIPvarGetLbGlobal(var);
19148  ub = SCIPvarGetUbGlobal(var);
19149  assert(scip->set->stage == SCIP_STAGE_PROBLEM || SCIPsetIsLE(scip->set, lb, ub));
19150 
19151  if( SCIPsetIsFeasGT(scip->set, newbound, ub) )
19152  {
19153  *infeasible = TRUE;
19154  return SCIP_OKAY;
19155  }
19156  newbound = MIN(newbound, ub);
19157 
19158  /* bound changes of less than epsilon are ignored by SCIPvarChgLb or raise an assert in SCIPnodeAddBoundinfer,
19159  * so don't apply them even if force is set
19160  */
19161  if( SCIPsetIsEQ(scip->set, lb, newbound) || (!force && !SCIPsetIsLbBetter(scip->set, newbound, lb, ub)) )
19162  return SCIP_OKAY;
19163 
19164  switch( scip->set->stage )
19165  {
19166  case SCIP_STAGE_PROBLEM:
19167  assert(!SCIPvarIsTransformed(var));
19168  SCIP_CALL( SCIPvarChgLbGlobal(var, scip->mem->probmem, scip->set, scip->stat, scip->lp,
19169  scip->branchcand, scip->eventqueue, newbound) );
19170  SCIP_CALL( SCIPvarChgLbLocal(var, scip->mem->probmem, scip->set, scip->stat, scip->lp,
19171  scip->branchcand, scip->eventqueue, newbound) );
19172  SCIP_CALL( SCIPvarChgLbOriginal(var, scip->set, newbound) );
19173  break;
19174 
19176  SCIP_CALL( SCIPvarChgLbGlobal(var, scip->mem->probmem, scip->set, scip->stat, scip->lp,
19177  scip->branchcand, scip->eventqueue, newbound) );
19178  break;
19179 
19180  case SCIP_STAGE_PRESOLVING:
19181  if( !SCIPinProbing(scip) )
19182  {
19183  assert(SCIPtreeGetCurrentDepth(scip->tree) == 0);
19184  assert(scip->tree->root == SCIPtreeGetCurrentNode(scip->tree));
19185 
19186  SCIP_CALL( SCIPnodeAddBoundchg(scip->tree->root, scip->mem->probmem, scip->set, scip->stat, scip->transprob,
19187  scip->origprob, scip->tree, scip->lp, scip->branchcand, scip->eventqueue, var, newbound,
19189 
19191  {
19192  SCIP_CALL( SCIPchgVarType(scip, var, SCIP_VARTYPE_BINARY, infeasible) );
19193  assert(!(*infeasible));
19194  }
19195  break;
19196  }
19197  /*lint -fallthrough*/
19198  case SCIP_STAGE_SOLVING:
19199  SCIP_CALL( SCIPnodeAddBoundchg(scip->tree->root, scip->mem->probmem, scip->set, scip->stat, scip->transprob,
19200  scip->origprob, scip->tree, scip->lp, scip->branchcand, scip->eventqueue, var, newbound,
19202  break;
19203 
19204  default:
19205  SCIPerrorMessage("invalid SCIP stage <%d>\n", scip->set->stage);
19206  return SCIP_INVALIDCALL;
19207  } /*lint !e788*/
19208 
19209  /* coverity: unreachable code */
19210  if( tightened != NULL )
19211  *tightened = TRUE;
19212 
19213  return SCIP_OKAY;
19214 }
19215 
19216 /** changes global upper bound of variable in preprocessing or in the current node, if the new bound is tighter
19217  * (w.r.t. bound strengthening epsilon) than the current global bound; if possible, adjusts bound to integral value;
19218  * also tightens the local bound, if the global bound is better than the local bound
19219  *
19220  * @warning If SCIP is in presolving stage, it can happen that the internal variable array (which can be accessed via
19221  * SCIPgetVars()) gets resorted.
19222  *
19223  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
19224  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
19225  *
19226  * @pre This method can be called if @p scip is in one of the following stages:
19227  * - \ref SCIP_STAGE_PROBLEM
19228  * - \ref SCIP_STAGE_TRANSFORMING
19229  * - \ref SCIP_STAGE_PRESOLVING
19230  * - \ref SCIP_STAGE_SOLVING
19231  *
19232  * @note During presolving, an integer variable whose bound changes to {0,1} is upgraded to a binary variable.
19233  */
19235  SCIP* scip, /**< SCIP data structure */
19236  SCIP_VAR* var, /**< variable to change the bound for */
19237  SCIP_Real newbound, /**< new value for bound */
19238  SCIP_Bool force, /**< force tightening even if below bound strengthening tolerance */
19239  SCIP_Bool* infeasible, /**< pointer to store whether the new domain is empty */
19240  SCIP_Bool* tightened /**< pointer to store whether the bound was tightened, or NULL */
19241  )
19242 {
19243  SCIP_Real lb;
19244  SCIP_Real ub;
19245 
19246  assert(infeasible != NULL);
19247 
19248  SCIP_CALL( checkStage(scip, "SCIPtightenVarUbGlobal", FALSE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) );
19249 
19250  *infeasible = FALSE;
19251  if( tightened != NULL )
19252  *tightened = FALSE;
19253 
19254  SCIPvarAdjustUb(var, scip->set, &newbound);
19255 
19256  /* get current bounds */
19257  lb = SCIPvarGetLbGlobal(var);
19258  ub = SCIPvarGetUbGlobal(var);
19259  assert(scip->set->stage == SCIP_STAGE_PROBLEM || SCIPsetIsLE(scip->set, lb, ub));
19260 
19261  if( SCIPsetIsFeasLT(scip->set, newbound, lb) )
19262  {
19263  *infeasible = TRUE;
19264  return SCIP_OKAY;
19265  }
19266  newbound = MAX(newbound, lb);
19267 
19268  /* bound changes of less than epsilon are ignored by SCIPvarChgUb or raise an assert in SCIPnodeAddBoundinfer,
19269  * so don't apply them even if force is set
19270  */
19271  if( SCIPsetIsEQ(scip->set, ub, newbound) || (!force && !SCIPsetIsUbBetter(scip->set, newbound, lb, ub)) )
19272  return SCIP_OKAY;
19273 
19274  switch( scip->set->stage )
19275  {
19276  case SCIP_STAGE_PROBLEM:
19277  assert(!SCIPvarIsTransformed(var));
19278  SCIP_CALL( SCIPvarChgUbGlobal(var, scip->mem->probmem, scip->set, scip->stat, scip->lp,
19279  scip->branchcand, scip->eventqueue, newbound) );
19280  SCIP_CALL( SCIPvarChgUbLocal(var, scip->mem->probmem, scip->set, scip->stat, scip->lp,
19281  scip->branchcand, scip->eventqueue, newbound) );
19282  SCIP_CALL( SCIPvarChgUbOriginal(var, scip->set, newbound) );
19283  break;
19284 
19286  SCIP_CALL( SCIPvarChgUbGlobal(var, scip->mem->probmem, scip->set, scip->stat, scip->lp,
19287  scip->branchcand, scip->eventqueue, newbound) );
19288  break;
19289 
19290  case SCIP_STAGE_PRESOLVING:
19291  if( !SCIPinProbing(scip) )
19292  {
19293  assert(SCIPtreeGetCurrentDepth(scip->tree) == 0);
19294  assert(scip->tree->root == SCIPtreeGetCurrentNode(scip->tree));
19295 
19296  SCIP_CALL( SCIPnodeAddBoundchg(scip->tree->root, scip->mem->probmem, scip->set, scip->stat, scip->transprob,
19297  scip->origprob, scip->tree, scip->lp, scip->branchcand, scip->eventqueue, var, newbound,
19299 
19301  {
19302  SCIP_CALL( SCIPchgVarType(scip, var, SCIP_VARTYPE_BINARY, infeasible) );
19303  assert(!(*infeasible));
19304  }
19305  break;
19306  }
19307  /*lint -fallthrough*/
19308  case SCIP_STAGE_SOLVING:
19309  SCIP_CALL( SCIPnodeAddBoundchg(scip->tree->root, scip->mem->probmem, scip->set, scip->stat, scip->transprob,
19310  scip->origprob, scip->tree, scip->lp, scip->branchcand, scip->eventqueue, var, newbound,
19312  break;
19313 
19314  default:
19315  SCIPerrorMessage("invalid SCIP stage <%d>\n", scip->set->stage);
19316  return SCIP_INVALIDCALL;
19317  } /*lint !e788*/
19318 
19319  /* coverity: unreachable code */
19320  if( tightened != NULL )
19321  *tightened = TRUE;
19322 
19323  return SCIP_OKAY;
19324 }
19325 
19326 /* some simple variable functions implemented as defines */
19327 #undef SCIPcomputeVarLbGlobal
19328 #undef SCIPcomputeVarUbGlobal
19329 #undef SCIPcomputeVarLbLocal
19330 #undef SCIPcomputeVarUbLocal
19331 
19332 /** for a multi-aggregated variable, returns the global lower bound computed by adding the global bounds from all aggregation variables
19333  * this global bound may be tighter than the one given by SCIPvarGetLbGlobal, since the latter is not updated if bounds of aggregation variables are changing
19334  * calling this function for a non-multi-aggregated variable results in a call to SCIPvarGetLbGlobal
19335  *
19336  * @return the global lower bound computed by adding the global bounds from all aggregation variables
19337  */
19339  SCIP* scip, /**< SCIP data structure */
19340  SCIP_VAR* var /**< variable to compute the bound for */
19341  )
19342 {
19343  assert(scip != NULL);
19344  assert(var != NULL);
19345 
19347  return SCIPvarGetMultaggrLbGlobal(var, scip->set);
19348  else
19349  return SCIPvarGetLbGlobal(var);
19350 }
19351 
19352 /** for a multi-aggregated variable, returns the global upper bound computed by adding the global bounds from all aggregation variables
19353  * this global bound may be tighter than the one given by SCIPvarGetUbGlobal, since the latter is not updated if bounds of aggregation variables are changing
19354  * calling this function for a non-multi-aggregated variable results in a call to SCIPvarGetUbGlobal
19355  *
19356  * @return the global upper bound computed by adding the global bounds from all aggregation variables
19357  */
19359  SCIP* scip, /**< SCIP data structure */
19360  SCIP_VAR* var /**< variable to compute the bound for */
19361  )
19362 {
19363  assert(scip != NULL);
19364  assert(var != NULL);
19365 
19367  return SCIPvarGetMultaggrUbGlobal(var, scip->set);
19368  else
19369  return SCIPvarGetUbGlobal(var);
19370 }
19371 
19372 /** for a multi-aggregated variable, returns the local lower bound computed by adding the local bounds from all aggregation variables
19373  * this local bound may be tighter than the one given by SCIPvarGetLbLocal, since the latter is not updated if bounds of aggregation variables are changing
19374  * calling this function for a non-multi-aggregated variable results in a call to SCIPvarGetLbLocal
19375  *
19376  * @return the local lower bound computed by adding the global bounds from all aggregation variables
19377  */
19379  SCIP* scip, /**< SCIP data structure */
19380  SCIP_VAR* var /**< variable to compute the bound for */
19381  )
19382 {
19383  assert(scip != NULL);
19384  assert(var != NULL);
19385 
19387  return SCIPvarGetMultaggrLbLocal(var, scip->set);
19388  else
19389  return SCIPvarGetLbLocal(var);
19390 }
19391 
19392 /** for a multi-aggregated variable, returns the local upper bound computed by adding the local bounds from all aggregation variables
19393  * this local bound may be tighter than the one given by SCIPvarGetUbLocal, since the latter is not updated if bounds of aggregation variables are changing
19394  * calling this function for a non-multi-aggregated variable results in a call to SCIPvarGetUbLocal
19395  *
19396  * @return the local upper bound computed by adding the global bounds from all aggregation variables
19397  */
19399  SCIP* scip, /**< SCIP data structure */
19400  SCIP_VAR* var /**< variable to compute the bound for */
19401  )
19402 {
19403  assert(scip != NULL);
19404  assert(var != NULL);
19405 
19407  return SCIPvarGetMultaggrUbLocal(var, scip->set);
19408  else
19409  return SCIPvarGetUbLocal(var);
19410 }
19411 
19412 /** returns solution value and index of variable lower bound that is closest to the variable's value in the given primal
19413  * solution or current LP solution if no primal solution is given; returns an index of -1 if no variable lower bound is
19414  * available
19415  *
19416  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
19417  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
19418  *
19419  * @pre This method can only be called if @p scip is in stage \ref SCIP_STAGE_SOLVING
19420  */
19422  SCIP* scip, /**< SCIP data structure */
19423  SCIP_VAR* var, /**< active problem variable */
19424  SCIP_SOL* sol, /**< primal solution, or NULL for LP solution */
19425  SCIP_Real* closestvlb, /**< pointer to store the value of the closest variable lower bound */
19426  int* closestvlbidx /**< pointer to store the index of the closest variable lower bound */
19427  )
19428 {
19429  SCIP_CALL( checkStage(scip, "SCIPgetVarClosestVlb", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) );
19430 
19431  SCIPvarGetClosestVlb(var, sol, scip->set, scip->stat, closestvlb, closestvlbidx);
19432 
19433  return SCIP_OKAY;
19434 }
19435 
19436 /** returns solution value and index of variable upper bound that is closest to the variable's value in the given primal solution;
19437  * or current LP solution if no primal solution is given; returns an index of -1 if no variable upper bound is available
19438  *
19439  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
19440  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
19441  *
19442  * @pre This method can only be called if @p scip is in stage \ref SCIP_STAGE_SOLVING
19443  */
19445  SCIP* scip, /**< SCIP data structure */
19446  SCIP_VAR* var, /**< active problem variable */
19447  SCIP_SOL* sol, /**< primal solution, or NULL for LP solution */
19448  SCIP_Real* closestvub, /**< pointer to store the value of the closest variable lower bound */
19449  int* closestvubidx /**< pointer to store the index of the closest variable lower bound */
19450  )
19451 {
19452  SCIP_CALL( checkStage(scip, "SCIPgetVarClosestVub", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) );
19453 
19454  SCIPvarGetClosestVub(var, sol, scip->set, scip->stat, closestvub, closestvubidx);
19455 
19456  return SCIP_OKAY;
19457 }
19458 
19459 /** informs variable x about a globally valid variable lower bound x >= b*z + d with integer variable z;
19460  * if z is binary, the corresponding valid implication for z is also added;
19461  * if z is non-continuous and 1/b not too small, the corresponding valid upper/lower bound
19462  * z <= (x-d)/b or z >= (x-d)/b (depending on the sign of of b) is added, too;
19463  * improves the global bounds of the variable and the vlb variable if possible
19464  *
19465  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
19466  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
19467  *
19468  * @pre This method can be called if @p scip is in one of the following stages:
19469  * - \ref SCIP_STAGE_PRESOLVING
19470  * - \ref SCIP_STAGE_PRESOLVED
19471  * - \ref SCIP_STAGE_SOLVING
19472  */
19474  SCIP* scip, /**< SCIP data structure */
19475  SCIP_VAR* var, /**< problem variable */
19476  SCIP_VAR* vlbvar, /**< variable z in x >= b*z + d */
19477  SCIP_Real vlbcoef, /**< coefficient b in x >= b*z + d */
19478  SCIP_Real vlbconstant, /**< constant d in x >= b*z + d */
19479  SCIP_Bool* infeasible, /**< pointer to store whether an infeasibility was detected */
19480  int* nbdchgs /**< pointer to store the number of performed bound changes, or NULL */
19481  )
19482 {
19483  int nlocalbdchgs;
19484 
19485  SCIP_CALL( checkStage(scip, "SCIPaddVarVlb", FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, TRUE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) );
19486 
19487  SCIP_CALL( SCIPvarAddVlb(var, scip->mem->probmem, scip->set, scip->stat, scip->transprob, scip->origprob, scip->tree,
19488  scip->lp, scip->cliquetable, scip->branchcand, scip->eventqueue, vlbvar, vlbcoef, vlbconstant, TRUE, infeasible,
19489  &nlocalbdchgs) );
19490 
19491  *nbdchgs = nlocalbdchgs;
19492 
19493  /* if x is not continuous we add a variable bound for z; do not add it if cofficient would be too small or we already
19494  * detected infeasibility
19495  */
19496  if( !(*infeasible) && SCIPvarGetType(var) != SCIP_VARTYPE_CONTINUOUS && !SCIPisZero(scip, 1.0/vlbcoef) )
19497  {
19498  if( vlbcoef > 0.0 )
19499  {
19500  /* if b > 0, we have a variable upper bound: x >= b*z + d => z <= (x-d)/b */
19501  SCIP_CALL( SCIPvarAddVub(vlbvar, scip->mem->probmem, scip->set, scip->stat, scip->transprob, scip->origprob,
19502  scip->tree, scip->lp, scip->cliquetable, scip->branchcand, scip->eventqueue, var, 1.0/vlbcoef,
19503  -vlbconstant/vlbcoef, TRUE, infeasible, &nlocalbdchgs) );
19504  }
19505  else
19506  {
19507  /* if b < 0, we have a variable lower bound: x >= b*z + d => z >= (x-d)/b */
19508  SCIP_CALL( SCIPvarAddVlb(vlbvar, scip->mem->probmem, scip->set, scip->stat, scip->transprob, scip->origprob,
19509  scip->tree, scip->lp, scip->cliquetable, scip->branchcand, scip->eventqueue, var, 1.0/vlbcoef,
19510  -vlbconstant/vlbcoef, TRUE, infeasible, &nlocalbdchgs) );
19511  }
19512  *nbdchgs += nlocalbdchgs;
19513  }
19514 
19515  return SCIP_OKAY;
19516 }
19517 
19518 /** informs variable x about a globally valid variable upper bound x <= b*z + d with integer variable z;
19519  * if z is binary, the corresponding valid implication for z is also added;
19520  * if z is non-continuous and 1/b not too small, the corresponding valid lower/upper bound
19521  * z >= (x-d)/b or z <= (x-d)/b (depending on the sign of of b) is added, too;
19522  * improves the global bounds of the variable and the vlb variable if possible
19523  *
19524  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
19525  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
19526  *
19527  * @pre This method can be called if @p scip is in one of the following stages:
19528  * - \ref SCIP_STAGE_PRESOLVING
19529  * - \ref SCIP_STAGE_PRESOLVED
19530  * - \ref SCIP_STAGE_SOLVING
19531  */
19533  SCIP* scip, /**< SCIP data structure */
19534  SCIP_VAR* var, /**< problem variable */
19535  SCIP_VAR* vubvar, /**< variable z in x <= b*z + d */
19536  SCIP_Real vubcoef, /**< coefficient b in x <= b*z + d */
19537  SCIP_Real vubconstant, /**< constant d in x <= b*z + d */
19538  SCIP_Bool* infeasible, /**< pointer to store whether an infeasibility was detected */
19539  int* nbdchgs /**< pointer to store the number of performed bound changes, or NULL */
19540  )
19541 {
19542  int nlocalbdchgs;
19543 
19544  SCIP_CALL( checkStage(scip, "SCIPaddVarVub", FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, TRUE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) );
19545 
19546  SCIP_CALL( SCIPvarAddVub(var, scip->mem->probmem, scip->set, scip->stat, scip->transprob, scip->origprob, scip->tree,
19547  scip->lp, scip->cliquetable, scip->branchcand, scip->eventqueue, vubvar, vubcoef, vubconstant, TRUE, infeasible,
19548  &nlocalbdchgs) );
19549 
19550  *nbdchgs = nlocalbdchgs;
19551 
19552  /* if x is not continuous we add a variable bound for z; do not add it if cofficient would be too small or we already
19553  * detected infeasibility
19554  */
19555  if( !(*infeasible) && SCIPvarGetType(var) != SCIP_VARTYPE_CONTINUOUS && !SCIPisZero(scip, 1.0/vubcoef) )
19556  {
19557  if( vubcoef > 0.0 )
19558  {
19559  /* if b < 0, we have a variable lower bound: x >= b*z + d => z >= (x-d)/b */
19560  SCIP_CALL( SCIPvarAddVlb(vubvar, scip->mem->probmem, scip->set, scip->stat, scip->transprob, scip->origprob,
19561  scip->tree, scip->lp, scip->cliquetable, scip->branchcand, scip->eventqueue, var, 1.0/vubcoef,
19562  -vubconstant/vubcoef, TRUE, infeasible, &nlocalbdchgs) );
19563  }
19564  else
19565  {
19566  /* if b > 0, we have a variable upper bound: x >= b*z + d => z <= (x-d)/b */
19567  SCIP_CALL( SCIPvarAddVub(vubvar, scip->mem->probmem, scip->set, scip->stat, scip->transprob, scip->origprob,
19568  scip->tree, scip->lp, scip->cliquetable, scip->branchcand, scip->eventqueue, var, 1.0/vubcoef,
19569  -vubconstant/vubcoef, TRUE, infeasible, &nlocalbdchgs) );
19570  }
19571  *nbdchgs += nlocalbdchgs;
19572  }
19573 
19574  return SCIP_OKAY;
19575 }
19576 
19577 /** informs binary variable x about a globally valid implication: x == 0 or x == 1 ==> y <= b or y >= b;
19578  * also adds the corresponding implication or variable bound to the implied variable;
19579  * if the implication is conflicting, the variable is fixed to the opposite value;
19580  * if the variable is already fixed to the given value, the implication is performed immediately;
19581  * if the implication is redundant with respect to the variables' global bounds, it is ignored
19582  *
19583  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
19584  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
19585  *
19586  * @pre This method can be called if @p scip is in one of the following stages:
19587  * - \ref SCIP_STAGE_TRANSFORMED
19588  * - \ref SCIP_STAGE_PRESOLVING
19589  * - \ref SCIP_STAGE_PRESOLVED
19590  * - \ref SCIP_STAGE_SOLVING
19591  */
19593  SCIP* scip, /**< SCIP data structure */
19594  SCIP_VAR* var, /**< problem variable */
19595  SCIP_Bool varfixing, /**< FALSE if y should be added in implications for x == 0, TRUE for x == 1 */
19596  SCIP_VAR* implvar, /**< variable y in implication y <= b or y >= b */
19597  SCIP_BOUNDTYPE impltype, /**< type of implication y <= b (SCIP_BOUNDTYPE_UPPER)
19598  * or y >= b (SCIP_BOUNDTYPE_LOWER) */
19599  SCIP_Real implbound, /**< bound b in implication y <= b or y >= b */
19600  SCIP_Bool* infeasible, /**< pointer to store whether an infeasibility was detected */
19601  int* nbdchgs /**< pointer to store the number of performed bound changes, or NULL */
19602  )
19603 {
19604  SCIP_CALL( checkStage(scip, "SCIPaddVarImplication", FALSE, FALSE, FALSE, TRUE, FALSE, TRUE, FALSE, TRUE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) );
19605 
19606  if( !SCIPvarIsBinary(var) )
19607  {
19608  SCIPerrorMessage("can't add implication for nonbinary variable\n");
19609  return SCIP_INVALIDDATA;
19610  }
19611 
19612  /* the implication graph can only handle 'real' binary (SCIP_VARTYPE_BINARY) variables, therefore we transform the
19613  * implication in variable bounds, (lowerbound of y will be abbreviated by lby, upperbound equivlaent) the follwing
19614  * four cases are:
19615  *
19616  * 1. (x >= 1 => y >= b) => y >= (b - lby) * x + lby
19617  * 2. (x >= 1 => y <= b) => y <= (b - uby) * x + uby
19618  * 3. (x <= 0 => y >= b) => y >= (lby - b) * x + b
19619  * 4. (x <= 0 => y <= b) => y <= (uby - b) * x + b
19620  */
19621  if( SCIPvarGetType(var) != SCIP_VARTYPE_BINARY )
19622  {
19623  SCIP_Real lby;
19624  SCIP_Real uby;
19625 
19626  lby = SCIPvarGetLbGlobal(implvar);
19627  uby = SCIPvarGetUbGlobal(implvar);
19628 
19629  if( varfixing == TRUE )
19630  {
19631  if( impltype == SCIP_BOUNDTYPE_LOWER )
19632  {
19633  SCIP_CALL( SCIPvarAddVlb(implvar, scip->mem->probmem, scip->set, scip->stat, scip->transprob, scip->origprob,
19634  scip->tree, scip->lp, scip->cliquetable, scip->branchcand, scip->eventqueue, var, implbound - lby, lby,
19635  TRUE, infeasible, nbdchgs) );
19636  }
19637  else
19638  {
19639  SCIP_CALL( SCIPvarAddVub(implvar, scip->mem->probmem, scip->set, scip->stat, scip->transprob, scip->origprob,
19640  scip->tree, scip->lp, scip->cliquetable, scip->branchcand, scip->eventqueue, var, implbound - uby, uby,
19641  TRUE, infeasible, nbdchgs) );
19642  }
19643  }
19644  else
19645  {
19646  if( impltype == SCIP_BOUNDTYPE_LOWER )
19647  {
19648  SCIP_CALL( SCIPvarAddVlb(implvar, scip->mem->probmem, scip->set, scip->stat, scip->transprob, scip->origprob,
19649  scip->tree, scip->lp, scip->cliquetable, scip->branchcand, scip->eventqueue, var, lby - implbound,
19650  implbound, TRUE, infeasible, nbdchgs) );
19651  }
19652  else
19653  {
19654  SCIP_CALL( SCIPvarAddVub(implvar, scip->mem->probmem, scip->set, scip->stat, scip->transprob, scip->origprob,
19655  scip->tree, scip->lp, scip->cliquetable, scip->branchcand, scip->eventqueue, var, uby - implbound,
19656  implbound, TRUE, infeasible, nbdchgs) );
19657  }
19658  }
19659  }
19660  else
19661  {
19662  SCIP_CALL( SCIPvarAddImplic(var, scip->mem->probmem, scip->set, scip->stat, scip->transprob, scip->origprob,
19663  scip->tree, scip->lp, scip->cliquetable, scip->branchcand, scip->eventqueue, varfixing, implvar, impltype,
19664  implbound, TRUE, infeasible, nbdchgs) );
19665  }
19666 
19667  return SCIP_OKAY;
19668 }
19669 
19670 /** adds a clique information to SCIP, stating that at most one of the given binary variables can be set to 1;
19671  * if a variable appears twice in the same clique, the corresponding implications are performed
19672  *
19673  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
19674  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
19675  *
19676  * @pre This method can be called if @p scip is in one of the following stages:
19677  * - \ref SCIP_STAGE_TRANSFORMED
19678  * - \ref SCIP_STAGE_PRESOLVING
19679  * - \ref SCIP_STAGE_PRESOLVED
19680  * - \ref SCIP_STAGE_SOLVING
19681  */
19683  SCIP* scip, /**< SCIP data structure */
19684  SCIP_VAR** vars, /**< binary variables in the clique from which at most one can be set to 1 */
19685  SCIP_Bool* values, /**< values of the variables in the clique; NULL to use TRUE for all vars */
19686  int nvars, /**< number of variables in the clique */
19687  SCIP_Bool* infeasible, /**< pointer to store whether an infeasibility was detected */
19688  int* nbdchgs /**< pointer to store the number of performed bound changes, or NULL */
19689  )
19690 {
19691  SCIP_CALL( checkStage(scip, "SCIPaddClique", FALSE, FALSE, FALSE, TRUE, FALSE, TRUE, FALSE, TRUE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) );
19692 
19693  *infeasible = FALSE;
19694  if( nbdchgs != NULL )
19695  *nbdchgs = 0;
19696 
19697  if( nvars == 2 )
19698  {
19699  SCIP_Bool val0;
19700  SCIP_Bool val1;
19701 
19702  assert(vars != NULL);
19703  if( values == NULL )
19704  {
19705  val0 = TRUE;
19706  val1 = TRUE;
19707  }
19708  else
19709  {
19710  val0 = values[0];
19711  val1 = values[1];
19712  }
19713 
19714  /* add the implications instead of the clique */
19715  if( SCIPvarGetType(vars[0]) == SCIP_VARTYPE_BINARY )
19716  {
19717  /* this function call adds the implication form vars[0] to vars[1] as well as the implication from vars[1] to
19718  * vars[0] if vars[1] in of binary type
19719  */
19720  SCIP_CALL( SCIPvarAddImplic(vars[0], scip->mem->probmem, scip->set, scip->stat, scip->transprob, scip->origprob,
19721  scip->tree, scip->lp, scip->cliquetable, scip->branchcand, scip->eventqueue, val0, vars[1],
19722  val1 ? SCIP_BOUNDTYPE_UPPER : SCIP_BOUNDTYPE_LOWER, val1 ? 0.0 : 1.0, TRUE, infeasible, nbdchgs) );
19723  }
19724  else if( SCIPvarGetType(vars[1]) == SCIP_VARTYPE_BINARY )
19725  {
19726  /* this function call adds the implication form vars[1] to vars[0] */
19727  SCIP_CALL( SCIPvarAddImplic(vars[1], scip->mem->probmem, scip->set, scip->stat, scip->transprob, scip->origprob,
19728  scip->tree, scip->lp, scip->cliquetable, scip->branchcand, scip->eventqueue, val1, vars[0],
19729  val0 ? SCIP_BOUNDTYPE_UPPER : SCIP_BOUNDTYPE_LOWER, val0 ? 0.0 : 1.0, TRUE, infeasible, nbdchgs) );
19730  }
19731  /* in case one both variables are not of binary type we have to add the implication as variable bounds */
19732  else
19733  {
19734  /* both variables are not of binary type but are implicit binary; in that case we can only add this
19735  * implication as variable bounds
19736  */
19737  assert(SCIPvarGetType(vars[0]) != SCIP_VARTYPE_BINARY && SCIPvarIsBinary(vars[0]));
19738  assert(SCIPvarGetType(vars[1]) != SCIP_VARTYPE_BINARY && SCIPvarIsBinary(vars[1]));
19739 
19740  /* add variable upper or rather variable lower bound on vars[0] */
19741  if( val0 )
19742  {
19743  SCIP_CALL( SCIPvarAddVub(vars[0], scip->mem->probmem, scip->set, scip->stat, scip->transprob, scip->origprob,
19744  scip->tree, scip->lp, scip->cliquetable, scip->branchcand, scip->eventqueue, vars[1],
19745  val1 ? -1.0 : 1.0, val1 ? 1.0 : 0.0, TRUE, infeasible, nbdchgs) );
19746  }
19747  else
19748  {
19749  SCIP_CALL( SCIPvarAddVlb(vars[0], scip->mem->probmem, scip->set, scip->stat, scip->transprob, scip->origprob,
19750  scip->tree, scip->lp, scip->cliquetable, scip->branchcand, scip->eventqueue, vars[1],
19751  val1 ? 1.0 : -1.0, val1 ? 0.0 : 1.0, TRUE, infeasible, nbdchgs) );
19752  }
19753 
19754  /* add variable upper or rather variable lower bound on vars[1] */
19755  if( val1 )
19756  {
19757  SCIP_CALL( SCIPvarAddVub(vars[1], scip->mem->probmem, scip->set, scip->stat, scip->transprob, scip->origprob,
19758  scip->tree, scip->lp, scip->cliquetable, scip->branchcand, scip->eventqueue, vars[0],
19759  val0 ? -1.0 : 1.0, val0 ? 1.0 : 0.0, TRUE, infeasible, nbdchgs) );
19760  }
19761  else
19762  {
19763  SCIP_CALL( SCIPvarAddVlb(vars[1], scip->mem->probmem, scip->set, scip->stat, scip->transprob, scip->origprob,
19764  scip->tree, scip->lp, scip->cliquetable, scip->branchcand, scip->eventqueue, vars[0],
19765  val0 ? 1.0 : -1.0, val0 ? 0.0 : 1.0, TRUE, infeasible, nbdchgs) );
19766  }
19767  }
19768  }
19769  else if( nvars >= 3 )
19770  {
19771  /* add the clique to the clique table */
19772  SCIP_CALL( SCIPcliquetableAdd(scip->cliquetable, scip->mem->probmem, scip->set, scip->stat, scip->transprob,
19773  scip->origprob, scip->tree, scip->lp, scip->branchcand, scip->eventqueue, vars, values, nvars, infeasible,
19774  nbdchgs) );
19775  }
19776 
19777  return SCIP_OKAY;
19778 }
19779 
19780 /* calculate clique partition for a maximal amount of comparisons on variables due to expensive algorithm
19781  * @todo: check for a good value, maybe it's better to check parts of variables
19782  */
19783 #define MAXNCLIQUEVARSCOMP 1000000
19784 
19785 /** calculates a partition of the given set of binary variables into cliques;
19786  * afterwards the output array contains one value for each variable, such that two variables got the same value iff they
19787  * were assigned to the same clique;
19788  * the first variable is always assigned to clique 0, and a variable can only be assigned to clique i if at least one of
19789  * the preceding variables was assigned to clique i-1;
19790  * for each clique at most 1 variables can be set to TRUE in a feasible solution;
19791  *
19792  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
19793  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
19794  *
19795  * @pre This method can be called if @p scip is in one of the following stages:
19796  * - \ref SCIP_STAGE_INITPRESOLVE
19797  * - \ref SCIP_STAGE_PRESOLVING
19798  * - \ref SCIP_STAGE_EXITPRESOLVE
19799  * - \ref SCIP_STAGE_PRESOLVED
19800  * - \ref SCIP_STAGE_SOLVING
19801  */
19803  SCIP*const scip, /**< SCIP data structure */
19804  SCIP_VAR**const vars, /**< binary variables in the clique from which at most one can be set to 1 */
19805  int const nvars, /**< number of variables in the clique */
19806  int*const cliquepartition, /**< array of length nvars to store the clique partition */
19807  int*const ncliques /**< pointer to store the number of cliques actually contained in the partition */
19808  )
19809 {
19810  SCIP_VAR** tmpvars;
19811  SCIP_VAR** cliquevars;
19812  SCIP_Bool* cliquevalues;
19813  SCIP_Bool* tmpvalues;
19814  int ncliquevars;
19815  int i;
19816  int maxncliquevarscomp;
19817 
19818  assert(scip != NULL);
19819  assert(nvars == 0 || vars != NULL);
19820  assert(nvars == 0 || cliquepartition != NULL);
19821  assert(ncliques != NULL);
19822 
19823  SCIP_CALL( checkStage(scip, "SCIPcalcCliquePartition", FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) );
19824 
19825  if( nvars == 0 )
19826  {
19827  *ncliques = 0;
19828  return SCIP_OKAY;
19829  }
19830 
19831  /* early abort when no clique and implications are existing */
19832  if( SCIPgetNCliques(scip) == 0 && SCIPgetNImplications(scip) == 0 )
19833  {
19834  for( i = nvars - 1; i >= 0; --i )
19835  cliquepartition[i] = i;
19836 
19837  *ncliques = nvars;
19838 
19839  return SCIP_OKAY;
19840  }
19841 
19842  /* allocate temporary memory for storing the variables of the current clique */
19843  SCIP_CALL( SCIPsetAllocBufferArray(scip->set, &cliquevars, nvars) );
19844  SCIP_CALL( SCIPsetAllocBufferArray(scip->set, &cliquevalues, nvars) );
19845  SCIP_CALL( SCIPsetAllocBufferArray(scip->set, &tmpvalues, nvars) );
19846  SCIP_CALL( SCIPsetDuplicateBufferArray(scip->set, &tmpvars, vars, nvars) );
19847  ncliquevars = 0;
19848 
19849  /* initialize the cliquepartition array with -1 */
19850  /* initialize the tmpvalues array */
19851  for( i = nvars - 1; i >= 0; --i )
19852  {
19853  tmpvalues[i] = TRUE;
19854  cliquepartition[i] = -1;
19855  }
19856 
19857  /* get corresponding active problem variables */
19858  SCIP_CALL( SCIPvarsGetProbvarBinary(&tmpvars, &tmpvalues, nvars) );
19859 
19860  maxncliquevarscomp = MIN(nvars*nvars, MAXNCLIQUEVARSCOMP);
19861 
19862  /* calculate the clique partition */
19863  *ncliques = 0;
19864  for( i = 0; i < nvars; ++i )
19865  {
19866  if( cliquepartition[i] == -1 )
19867  {
19868  int j;
19869 
19870  /* variable starts a new clique */
19871  cliquepartition[i] = *ncliques;
19872  cliquevars[0] = tmpvars[i];
19873  cliquevalues[0] = tmpvalues[i];
19874  ncliquevars = 1;
19875 
19876  /* if variable is not active (multi-aggregated or fixed), it cannot be in any clique */
19877  if( SCIPvarIsActive(tmpvars[i]) && SCIPvarGetNCliques(tmpvars[i], tmpvalues[i]) + SCIPvarGetNBinImpls(tmpvars[i], tmpvalues[i]) > 0 )
19878  {
19879  /* greedily fill up the clique */
19880  for( j = i+1; j < nvars; ++j )
19881  {
19882  /* if variable is not active (multi-aggregated or fixed), it cannot be in any clique */
19883  if( cliquepartition[j] == -1 && SCIPvarIsActive(tmpvars[j]) )
19884  {
19885  int k;
19886 
19887  /* check if every variable in the current clique can be extended by tmpvars[j] */
19888  for( k = ncliquevars - 1; k >= 0; --k )
19889  {
19890  if( !SCIPvarsHaveCommonClique(tmpvars[j], tmpvalues[j], cliquevars[k], cliquevalues[k], TRUE) )
19891  break;
19892  }
19893 
19894  if( k == -1 )
19895  {
19896  /* put the variable into the same clique */
19897  cliquepartition[j] = cliquepartition[i];
19898  cliquevars[ncliquevars] = tmpvars[j];
19899  cliquevalues[ncliquevars] = tmpvalues[j];
19900  ++ncliquevars;
19901  }
19902  }
19903  }
19904  }
19905 
19906  /* this clique is finished */
19907  ++(*ncliques);
19908  }
19909  assert(cliquepartition[i] >= 0 && cliquepartition[i] < i+1);
19910 
19911  /* break if we reached the maximal number of comparisons */
19912  if( i * nvars > maxncliquevarscomp )
19913  break;
19914  }
19915  /* if we had to much variables fill up the cliquepartition and put each variable in a separate clique */
19916  for( ; i < nvars; ++i )
19917  {
19918  if( cliquepartition[i] == -1 )
19919  {
19920  cliquepartition[i] = *ncliques;
19921  ++(*ncliques);
19922  }
19923  }
19924 
19925  /* free temporary memory */
19926  SCIPsetFreeBufferArray(scip->set, &tmpvars);
19927  SCIPsetFreeBufferArray(scip->set, &tmpvalues);
19928  SCIPsetFreeBufferArray(scip->set, &cliquevalues);
19929  SCIPsetFreeBufferArray(scip->set, &cliquevars);
19930 
19931  return SCIP_OKAY;
19932 }
19933 
19934 /** calculates a partition of the given set of binary variables into negated cliques;
19935  * afterwards the output array contains one value for each variable, such that two variables got the same value iff they
19936  * were assigned to the same negated clique;
19937  * the first variable is always assigned to clique 0 and a variable can only be assigned to clique i if at least one of
19938  * the preceding variables was assigned to clique i-1;
19939  * for each clique with n_c variables at least n_c-1 variables can be set to TRUE in a feasible solution;
19940  *
19941  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
19942  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
19943  *
19944  * @pre This method can be called if @p scip is in one of the following stages:
19945  * - \ref SCIP_STAGE_INITPRESOLVE
19946  * - \ref SCIP_STAGE_PRESOLVING
19947  * - \ref SCIP_STAGE_EXITPRESOLVE
19948  * - \ref SCIP_STAGE_PRESOLVED
19949  * - \ref SCIP_STAGE_SOLVING
19950  */
19952  SCIP*const scip, /**< SCIP data structure */
19953  SCIP_VAR**const vars, /**< binary variables in the clique from which at most one can be set to 1 */
19954  int const nvars, /**< number of variables in the clique */
19955  int*const cliquepartition, /**< array of length nvars to store the clique partition */
19956  int*const ncliques /**< pointer to store the number of cliques actually contained in the partition */
19957  )
19958 {
19959  SCIP_VAR** negvars;
19960  int v;
19961 
19962  assert(scip != NULL);
19963  assert(cliquepartition != NULL || nvars == 0);
19964  assert(ncliques != NULL);
19965 
19966  if( nvars == 0 )
19967  {
19968  *ncliques = 0;
19969  return SCIP_OKAY;
19970  }
19971  assert(vars != NULL);
19972 
19973  /* allocate temporary memory */
19974  SCIP_CALL( SCIPsetAllocBufferArray(scip->set, &negvars, nvars) );
19975 
19976  /* get all negated variables */
19977  for( v = nvars - 1; v >= 0; --v )
19978  {
19979  SCIP_CALL( SCIPgetNegatedVar(scip, vars[v], &(negvars[v])) );
19980  }
19981 
19982  /* calculate cliques on negated variables, which are "negated" cliques on normal variables array */
19983  SCIP_CALL( SCIPcalcCliquePartition( scip, negvars, nvars, cliquepartition, ncliques) );
19984 
19985  /* free temporary memory */
19986  SCIPsetFreeBufferArray(scip->set, &negvars);
19987 
19988  return SCIP_OKAY;
19989 }
19990 
19991 /** gets the number of cliques in the clique table
19992  *
19993  * @return number of cliques in the clique table
19994  *
19995  * @pre This method can be called if @p scip is in one of the following stages:
19996  * - \ref SCIP_STAGE_TRANSFORMED
19997  * - \ref SCIP_STAGE_INITPRESOLVE
19998  * - \ref SCIP_STAGE_PRESOLVING
19999  * - \ref SCIP_STAGE_EXITPRESOLVE
20000  * - \ref SCIP_STAGE_PRESOLVED
20001  * - \ref SCIP_STAGE_INITSOLVE
20002  * - \ref SCIP_STAGE_SOLVING
20003  * - \ref SCIP_STAGE_SOLVED
20004  * - \ref SCIP_STAGE_EXITSOLVE
20005  */
20007  SCIP* scip /**< SCIP data structure */
20008  )
20009 {
20010  SCIP_CALL_ABORT( checkStage(scip, "SCIPgetNCliques", FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE) );
20011 
20013 }
20014 
20015 /** gets the array of cliques in the clique table
20016  *
20017  * @return array of cliques in the clique table
20018  *
20019  * @pre This method can be called if @p scip is in one of the following stages:
20020  * - \ref SCIP_STAGE_TRANSFORMED
20021  * - \ref SCIP_STAGE_INITPRESOLVE
20022  * - \ref SCIP_STAGE_PRESOLVING
20023  * - \ref SCIP_STAGE_EXITPRESOLVE
20024  * - \ref SCIP_STAGE_PRESOLVED
20025  * - \ref SCIP_STAGE_INITSOLVE
20026  * - \ref SCIP_STAGE_SOLVING
20027  * - \ref SCIP_STAGE_SOLVED
20028  * - \ref SCIP_STAGE_EXITSOLVE
20029  */
20031  SCIP* scip /**< SCIP data structure */
20032  )
20033 {
20034  SCIP_CALL_ABORT( checkStage(scip, "SCIPgetCliques", FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE) );
20035 
20036  return SCIPcliquetableGetCliques(scip->cliquetable);
20037 }
20038 
20039 /** returns whether there is a clique that contains both given variable/value pairs;
20040  * the variables must be active binary variables;
20041  * if regardimplics is FALSE, only the cliques in the clique table are looked at;
20042  * if regardimplics is TRUE, both the cliques and the implications of the implication graph are regarded
20043  *
20044  * @return TRUE, if there is a clique that contains both variable/clique pairs; FALSE, otherwise
20045  *
20046  * @pre This method can be called if @p scip is in one of the following stages:
20047  * - \ref SCIP_STAGE_TRANSFORMED
20048  * - \ref SCIP_STAGE_INITPRESOLVE
20049  * - \ref SCIP_STAGE_PRESOLVING
20050  * - \ref SCIP_STAGE_EXITPRESOLVE
20051  * - \ref SCIP_STAGE_PRESOLVED
20052  * - \ref SCIP_STAGE_INITSOLVE
20053  * - \ref SCIP_STAGE_SOLVING
20054  * - \ref SCIP_STAGE_SOLVED
20055  * - \ref SCIP_STAGE_EXITSOLVE
20056  *
20057  * @note a variable with it's negated variable are NOT! in a clique
20058  * @note a variable with itself are in a clique
20059  */
20061  SCIP* scip, /**< SCIP data structure */
20062  SCIP_VAR* var1, /**< first variable */
20063  SCIP_Bool value1, /**< value of first variable */
20064  SCIP_VAR* var2, /**< second variable */
20065  SCIP_Bool value2, /**< value of second variable */
20066  SCIP_Bool regardimplics /**< should the implication graph also be searched for a clique? */
20067  )
20068 {
20069  assert(scip != NULL);
20070  assert(var1 != NULL);
20071  assert(var2 != NULL);
20072  assert(SCIPvarIsActive(var1));
20073  assert(SCIPvarIsActive(var2));
20074  assert(SCIPvarIsBinary(var1));
20075  assert(SCIPvarIsBinary(var2));
20076 
20077  SCIP_CALL_ABORT( checkStage(scip, "SCIPhaveVarsCommonClique", FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE) );
20078 
20079  /* if both variables together have more cliques then actual cliques exist, then they have a common clique (in debug
20080  * mode we check this for correctness), otherwise we need to call the pairwise comparison method for these variables
20081  */
20082 #ifndef NDEBUG
20083  assert((SCIPvarGetNCliques(var1, value1) + SCIPvarGetNCliques(var2, value2) > SCIPcliquetableGetNCliques(scip->cliquetable)) ? SCIPvarsHaveCommonClique(var1, value1, var2, value2, FALSE) : TRUE);
20084 #endif
20085 
20086  return (SCIPvarGetNCliques(var1, value1) + SCIPvarGetNCliques(var2, value2) > SCIPcliquetableGetNCliques(scip->cliquetable)
20087  || SCIPvarsHaveCommonClique(var1, value1, var2, value2, regardimplics));
20088 }
20089 
20090 
20091 /** writes the clique graph to a gml file
20092  *
20093  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
20094  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
20095  *
20096  * @pre This method can be called if @p scip is in one of the following stages:
20097  * - \ref SCIP_STAGE_TRANSFORMED
20098  * - \ref SCIP_STAGE_INITPRESOLVE
20099  * - \ref SCIP_STAGE_PRESOLVING
20100  * - \ref SCIP_STAGE_EXITPRESOLVE
20101  * - \ref SCIP_STAGE_PRESOLVED
20102  * - \ref SCIP_STAGE_INITSOLVE
20103  * - \ref SCIP_STAGE_SOLVING
20104  * - \ref SCIP_STAGE_SOLVED
20105  * - \ref SCIP_STAGE_EXITSOLVE
20106  *
20107  * @note there can be duplicated arcs in the output file
20108  *
20109  * If @p writenodeweights is true, only nodes corresponding to variables that have a fractional value and only edges
20110  * between such nodes are written.
20111  */
20113  SCIP* scip, /**< SCIP data structure */
20114  const char* fname, /**< name of file */
20115  SCIP_Bool writeimplications, /**< should we write the binary implications? */
20116  SCIP_Bool writenodeweights /**< should we write weights of nodes? */
20117  )
20118 {
20119  FILE* gmlfile;
20120  SCIP_HASHMAP* nodehashmap;
20121  SCIP_CLIQUE** cliques;
20122  SCIP_VAR** clqvars;
20123  SCIP_VAR** allvars;
20124  SCIP_VAR* var;
20125  SCIP_Bool* clqvalues;
20126  SCIP_BOUNDTYPE* impltypes;
20127  char nodename[SCIP_MAXSTRLEN];
20128  int nallvars;
20129  int nbinvars;
20130  int nintvars;
20131  int nimplvars;
20132  int nbinimpls;
20133  int ncliques;
20134  int start;
20135  int end;
20136  int a;
20137  int c;
20138  int v1;
20139  int v2;
20140  int id1;
20141  int id2;
20142 
20143  assert(scip != NULL);
20144  assert(fname != NULL);
20145 
20146  SCIP_CALL_ABORT( checkStage(scip, "SCIPwriteCliqueGraph", FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE) );
20147 
20148  /* get all active variables */
20149  SCIP_CALL( SCIPgetVarsData(scip, &allvars, &nallvars, &nbinvars, &nintvars, &nimplvars, NULL) );
20150 
20151  /* no possible variables for cliques exist */
20152  if( nbinvars + nimplvars == 0 )
20153  return SCIP_OKAY;
20154 
20155  ncliques = SCIPgetNCliques(scip);
20156 
20157  /* no cliques and do not wont to check for binary implications */
20158  if( ncliques == 0 && !writeimplications )
20159  return SCIP_OKAY;
20160 
20161  /* open gml file */
20162  gmlfile = fopen(fname, "w");
20163 
20164  if( gmlfile == NULL )
20165  {
20166  SCIPerrorMessage("cannot open graph file <%s>\n", fname);
20167  SCIPABORT();
20168  return SCIP_INVALIDDATA; /*lint !e527*/
20169  }
20170 
20171  /* create the hash map */
20172  SCIP_CALL( SCIPhashmapCreate(&nodehashmap, SCIPblkmem(scip), SCIPcalcHashtableSize(HASHTABLESIZE_FACTOR * 2 * (nbinvars+nimplvars))) );
20173 
20174  /* write starting of gml file */
20175  SCIPgmlWriteOpening(gmlfile, TRUE);
20176 
20177  cliques = SCIPgetCliques(scip);
20178 
20179  /* write nodes and arcs for all cliques */
20180  for( c = ncliques - 1; c >= 0; --c )
20181  {
20182  clqvalues = SCIPcliqueGetValues(cliques[c]);
20183  clqvars = SCIPcliqueGetVars(cliques[c]);
20184 
20185  for( v1 = SCIPcliqueGetNVars(cliques[c]) - 1; v1 >= 0; --v1 )
20186  {
20187  id1 = clqvalues[v1] ? SCIPvarGetProbindex(clqvars[v1]) : (nallvars + SCIPvarGetProbindex(clqvars[v1]));
20188 
20189  /* if corresponding node was not added yet, add it */
20190  if( !SCIPhashmapExists(nodehashmap, (void*)(size_t)id1) )
20191  {
20192  assert(id1 >= 0);
20193  SCIP_CALL( SCIPhashmapInsert(nodehashmap, (void*)(size_t)id1, (void*)(size_t) 1) );
20194 
20195  (void) SCIPsnprintf(nodename, SCIP_MAXSTRLEN, "%s%s", (id1 >= nallvars ? "~" : ""), SCIPvarGetName(clqvars[v1]));
20196 
20197  /* write new gml node for new variable */
20198  if ( writenodeweights )
20199  {
20200  if ( ! SCIPisFeasIntegral(scip, SCIPgetSolVal(scip, NULL, clqvars[v1])) )
20201  SCIPgmlWriteNodeWeight(gmlfile, (unsigned int)id1, nodename, NULL, NULL, NULL, SCIPgetSolVal(scip, NULL, clqvars[v1]));
20202  }
20203  else
20204  {
20205  SCIPgmlWriteNode(gmlfile, (unsigned int)id1, nodename, NULL, NULL, NULL);
20206  }
20207  }
20208 
20209  for( v2 = SCIPcliqueGetNVars(cliques[c]) - 1; v2 >= 0; --v2 )
20210  {
20211  if( v1 == v2 )
20212  continue;
20213 
20214  id2 = clqvalues[v2] ? SCIPvarGetProbindex(clqvars[v2]) : (nallvars + SCIPvarGetProbindex(clqvars[v2]));
20215 
20216  /* if corresponding node was not added yet, add it */
20217  if( !SCIPhashmapExists(nodehashmap, (void*)(size_t)id2) )
20218  {
20219  assert(id2 >= 0);
20220  SCIP_CALL( SCIPhashmapInsert(nodehashmap, (void*)(size_t)id2, (void*)(size_t) 1) );
20221 
20222  (void) SCIPsnprintf(nodename, SCIP_MAXSTRLEN, "%s%s", (id2 >= nallvars ? "~" : ""), SCIPvarGetName(clqvars[v2]));
20223 
20224  /* write new gml node for new variable */
20225  if ( writenodeweights )
20226  {
20227  if ( ! SCIPisFeasIntegral(scip, SCIPgetSolVal(scip, NULL, clqvars[v2])) )
20228  SCIPgmlWriteNodeWeight(gmlfile, (unsigned int)id2, nodename, NULL, NULL, NULL, SCIPgetSolVal(scip, NULL, clqvars[v2]));
20229  }
20230  else
20231  {
20232  SCIPgmlWriteNode(gmlfile, (unsigned int)id2, nodename, NULL, NULL, NULL);
20233  }
20234  }
20235 
20236  /* write gml arc between resultant and operand */
20237  if ( ! writenodeweights || ! SCIPisFeasIntegral(scip, SCIPgetSolVal(scip, NULL, clqvars[v2])) )
20238  SCIPgmlWriteArc(gmlfile, (unsigned int)id1, (unsigned int)id2, NULL, NULL);
20239  }
20240  }
20241  }
20242 
20243  if( writeimplications )
20244  {
20245  int d;
20246 
20247  /* write binary implications, new nodes and all arcs */
20248  for( a = 0; a < 2; ++a )
20249  {
20250  start = (a == 0 ? 0 : nbinvars + nintvars);
20251  end = (a == 0 ? nbinvars : nbinvars + nintvars + nimplvars);
20252 
20253  /* write arcs for implication on pure binary variables */
20254  for( v1 = start; v1 < end; ++v1 )
20255  {
20256  var = allvars[v1];
20257  assert((v1 < nbinvars) ? SCIPvarGetType(var) == SCIP_VARTYPE_BINARY : SCIPvarGetType(var) == SCIP_VARTYPE_IMPLINT);
20258 
20259  for( d = 1; d >= 0; --d )
20260  {
20261  impltypes = SCIPvarGetImplTypes(var, (SCIP_Bool)d);
20262  clqvars = SCIPvarGetImplVars(var, (SCIP_Bool)d);
20263  id1 = (d == 1) ? SCIPvarGetProbindex(var) : (nallvars + SCIPvarGetProbindex(var));
20264 
20265  nbinimpls = SCIPvarGetNBinImpls(var, (SCIP_Bool)d);
20266  if( nbinimpls == 0 )
20267  continue;
20268 
20269  /* if corresponding node was not added yet, add it */
20270  if( !SCIPhashmapExists(nodehashmap, (void*)(size_t)id1) )
20271  {
20272  assert(id1 >= 0);
20273  SCIP_CALL( SCIPhashmapInsert(nodehashmap, (void*)(size_t)id1, (void*)(size_t) 1) );
20274 
20275  (void) SCIPsnprintf(nodename, SCIP_MAXSTRLEN, "%s%s", (id1 >= nallvars ? "~" : ""), SCIPvarGetName(var));
20276 
20277  /* write new gml node for new variable */
20278  if ( writenodeweights )
20279  {
20280  if ( ! SCIPisFeasIntegral(scip, SCIPgetSolVal(scip, NULL, var)) )
20281  SCIPgmlWriteNodeWeight(gmlfile, (unsigned int)id1, nodename, NULL, NULL, NULL, SCIPgetSolVal(scip, NULL, var));
20282  }
20283  else
20284  {
20285  SCIPgmlWriteNode(gmlfile, (unsigned int)id1, nodename, NULL, NULL, NULL);
20286  }
20287  }
20288 
20289  /* write arcs for all cliques */
20290  for( v2 = nbinimpls - 1; v2 >= 0; --v2 )
20291  {
20292  id2 = (impltypes[v2] == SCIP_BOUNDTYPE_LOWER) ? SCIPvarGetProbindex(clqvars[v2]) : (nallvars + SCIPvarGetProbindex(clqvars[v2]));
20293 
20294  /* if corresponding node was not added yet, add it */
20295  if( !SCIPhashmapExists(nodehashmap, (void*)(size_t)id2) )
20296  {
20297  assert(id2 >= 0);
20298  SCIP_CALL( SCIPhashmapInsert(nodehashmap, (void*)(size_t)id2, (void*)(size_t) 1) );
20299 
20300  (void) SCIPsnprintf(nodename, SCIP_MAXSTRLEN, "%s%s", (id2 >= nallvars ? "~" : ""), SCIPvarGetName(clqvars[v2]));
20301 
20302  /* write new gml node for new variable */
20303  if ( writenodeweights )
20304  {
20305  if ( ! SCIPisFeasIntegral(scip, SCIPgetSolVal(scip, NULL, clqvars[v2])) )
20306  SCIPgmlWriteNodeWeight(gmlfile, (unsigned int)id2, nodename, NULL, NULL, NULL, SCIPgetSolVal(scip, NULL, clqvars[v2]));
20307  }
20308  else
20309  {
20310  SCIPgmlWriteNode(gmlfile, (unsigned int)id2, nodename, NULL, NULL, NULL);
20311  }
20312  }
20313 
20314  /* write gml arc between resultant and operand */
20315  if ( ! writenodeweights || ( ! SCIPisFeasIntegral(scip, SCIPgetSolVal(scip, NULL, var)) && ! SCIPisFeasIntegral(scip, SCIPgetSolVal(scip, NULL, clqvars[v2])) ) )
20316  SCIPgmlWriteArc(gmlfile, (unsigned int)id1, (unsigned int)id2, NULL, NULL);
20317  }
20318  }
20319  }
20320  }
20321  }
20322 
20323  /* free the hash map */
20324  SCIPhashmapFree(&nodehashmap);
20325 
20326  SCIPgmlWriteClosing(gmlfile);
20327  fclose(gmlfile);
20328 
20329  return SCIP_OKAY;
20330 }
20331 
20332 /** sets the branch factor of the variable; this value can be used in the branching methods to scale the score
20333  * values of the variables; higher factor leads to a higher probability that this variable is chosen for branching
20334  *
20335  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
20336  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
20337  *
20338  * @pre This method can be called if @p scip is in one of the following stages:
20339  * - \ref SCIP_STAGE_PROBLEM
20340  * - \ref SCIP_STAGE_TRANSFORMING
20341  * - \ref SCIP_STAGE_TRANSFORMED
20342  * - \ref SCIP_STAGE_INITPRESOLVE
20343  * - \ref SCIP_STAGE_PRESOLVING
20344  * - \ref SCIP_STAGE_EXITPRESOLVE
20345  * - \ref SCIP_STAGE_PRESOLVED
20346  * - \ref SCIP_STAGE_SOLVING
20347  */
20349  SCIP* scip, /**< SCIP data structure */
20350  SCIP_VAR* var, /**< problem variable */
20351  SCIP_Real branchfactor /**< factor to weigh variable's branching score with */
20352  )
20353 {
20354  SCIP_CALL( checkStage(scip, "SCIPchgVarBranchFactor", FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) );
20355 
20356  SCIP_CALL( SCIPvarChgBranchFactor(var, scip->set, branchfactor) );
20357 
20358  return SCIP_OKAY;
20359 }
20360 
20361 /** scales the branch factor of the variable with the given value
20362  *
20363  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
20364  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
20365  *
20366  * @pre This method can be called if @p scip is in one of the following stages:
20367  * - \ref SCIP_STAGE_PROBLEM
20368  * - \ref SCIP_STAGE_TRANSFORMING
20369  * - \ref SCIP_STAGE_TRANSFORMED
20370  * - \ref SCIP_STAGE_INITPRESOLVE
20371  * - \ref SCIP_STAGE_PRESOLVING
20372  * - \ref SCIP_STAGE_EXITPRESOLVE
20373  * - \ref SCIP_STAGE_PRESOLVED
20374  * - \ref SCIP_STAGE_SOLVING
20375  */
20377  SCIP* scip, /**< SCIP data structure */
20378  SCIP_VAR* var, /**< problem variable */
20379  SCIP_Real scale /**< factor to scale variable's branching factor with */
20380  )
20381 {
20382  SCIP_CALL( checkStage(scip, "SCIPscaleVarBranchFactor", FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) );
20383 
20384  SCIP_CALL( SCIPvarChgBranchFactor(var, scip->set, scale * SCIPvarGetBranchFactor(var)) );
20385 
20386  return SCIP_OKAY;
20387 }
20388 
20389 /** adds the given value to the branch factor of the variable
20390  *
20391  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
20392  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
20393  *
20394  * @pre This method can be called if @p scip is in one of the following stages:
20395  * - \ref SCIP_STAGE_PROBLEM
20396  * - \ref SCIP_STAGE_TRANSFORMING
20397  * - \ref SCIP_STAGE_TRANSFORMED
20398  * - \ref SCIP_STAGE_INITPRESOLVE
20399  * - \ref SCIP_STAGE_PRESOLVING
20400  * - \ref SCIP_STAGE_EXITPRESOLVE
20401  * - \ref SCIP_STAGE_PRESOLVED
20402  * - \ref SCIP_STAGE_SOLVING
20403  */
20405  SCIP* scip, /**< SCIP data structure */
20406  SCIP_VAR* var, /**< problem variable */
20407  SCIP_Real addfactor /**< value to add to the branch factor of the variable */
20408  )
20409 {
20410  SCIP_CALL( checkStage(scip, "SCIPaddVarBranchFactor", FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) );
20411 
20412  SCIP_CALL( SCIPvarChgBranchFactor(var, scip->set, addfactor + SCIPvarGetBranchFactor(var)) );
20413 
20414  return SCIP_OKAY;
20415 }
20416 
20417 /** sets the branch priority of the variable; variables with higher branch priority are always preferred to variables
20418  * with lower priority in selection of branching variable
20419  *
20420  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
20421  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
20422  *
20423  * @pre This method can be called if @p scip is in one of the following stages:
20424  * - \ref SCIP_STAGE_PROBLEM
20425  * - \ref SCIP_STAGE_TRANSFORMING
20426  * - \ref SCIP_STAGE_TRANSFORMED
20427  * - \ref SCIP_STAGE_INITPRESOLVE
20428  * - \ref SCIP_STAGE_PRESOLVING
20429  * - \ref SCIP_STAGE_EXITPRESOLVE
20430  * - \ref SCIP_STAGE_PRESOLVED
20431  * - \ref SCIP_STAGE_SOLVING
20432  *
20433  * @note the default branching priority is 0
20434  */
20436  SCIP* scip, /**< SCIP data structure */
20437  SCIP_VAR* var, /**< problem variable */
20438  int branchpriority /**< branch priority of the variable */
20439  )
20440 {
20441  SCIP_CALL( checkStage(scip, "SCIPchgVarBranchPriority", FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) );
20442 
20443  if( SCIPisTransformed(scip) )
20444  {
20445  assert(scip->branchcand != NULL);
20446 
20447  /* inform the pseudo branch candidates that the branch priority changes and change the branch priority */
20448  SCIP_CALL( SCIPbranchcandUpdateVarBranchPriority(scip->branchcand, scip->set, var, branchpriority) );
20449  }
20450  else
20451  {
20452  /* change the branching priority of the variable */
20453  SCIP_CALL( SCIPvarChgBranchPriority(var, branchpriority) );
20454  }
20455 
20456  return SCIP_OKAY;
20457 }
20458 
20459 /** changes the branch priority of the variable to the given value, if it is larger than the current priority
20460  *
20461  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
20462  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
20463  *
20464  * @pre This method can be called if @p scip is in one of the following stages:
20465  * - \ref SCIP_STAGE_PROBLEM
20466  * - \ref SCIP_STAGE_TRANSFORMING
20467  * - \ref SCIP_STAGE_TRANSFORMED
20468  * - \ref SCIP_STAGE_INITPRESOLVE
20469  * - \ref SCIP_STAGE_PRESOLVING
20470  * - \ref SCIP_STAGE_EXITPRESOLVE
20471  * - \ref SCIP_STAGE_PRESOLVED
20472  * - \ref SCIP_STAGE_SOLVING
20473  */
20475  SCIP* scip, /**< SCIP data structure */
20476  SCIP_VAR* var, /**< problem variable */
20477  int branchpriority /**< new branch priority of the variable, if it is larger than current priority */
20478  )
20479 {
20480  SCIP_CALL( checkStage(scip, "SCIPupdateVarBranchPriority", FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) );
20481 
20482  if( branchpriority > SCIPvarGetBranchPriority(var) )
20483  {
20484  SCIP_CALL( SCIPvarChgBranchPriority(var, branchpriority) );
20485  }
20486 
20487  return SCIP_OKAY;
20488 }
20489 
20490 /** adds the given value to the branch priority of the variable
20491  *
20492  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
20493  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
20494  *
20495  * @pre This method can be called if @p scip is in one of the following stages:
20496  * - \ref SCIP_STAGE_PROBLEM
20497  * - \ref SCIP_STAGE_TRANSFORMING
20498  * - \ref SCIP_STAGE_TRANSFORMED
20499  * - \ref SCIP_STAGE_INITPRESOLVE
20500  * - \ref SCIP_STAGE_PRESOLVING
20501  * - \ref SCIP_STAGE_EXITPRESOLVE
20502  * - \ref SCIP_STAGE_PRESOLVED
20503  * - \ref SCIP_STAGE_SOLVING
20504  */
20506  SCIP* scip, /**< SCIP data structure */
20507  SCIP_VAR* var, /**< problem variable */
20508  int addpriority /**< value to add to the branch priority of the variable */
20509  )
20510 {
20511  SCIP_CALL( checkStage(scip, "SCIPaddVarBranchPriority", FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) );
20512 
20513  SCIP_CALL( SCIPvarChgBranchPriority(var, addpriority + SCIPvarGetBranchPriority(var)) );
20514 
20515  return SCIP_OKAY;
20516 }
20517 
20518 /** sets the branch direction of the variable (-1: prefer downwards branch, 0: automatic selection, +1: prefer upwards
20519  * branch)
20520  *
20521  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
20522  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
20523  *
20524  * @pre This method can be called if @p scip is in one of the following stages:
20525  * - \ref SCIP_STAGE_PROBLEM
20526  * - \ref SCIP_STAGE_TRANSFORMING
20527  * - \ref SCIP_STAGE_TRANSFORMED
20528  * - \ref SCIP_STAGE_INITPRESOLVE
20529  * - \ref SCIP_STAGE_PRESOLVING
20530  * - \ref SCIP_STAGE_EXITPRESOLVE
20531  * - \ref SCIP_STAGE_PRESOLVED
20532  * - \ref SCIP_STAGE_SOLVING
20533  */
20535  SCIP* scip, /**< SCIP data structure */
20536  SCIP_VAR* var, /**< problem variable */
20537  SCIP_BRANCHDIR branchdirection /**< preferred branch direction of the variable (downwards, upwards, auto) */
20538  )
20539 {
20540  SCIP_CALL( checkStage(scip, "SCIPchgVarBranchDirection", FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) );
20541 
20542  SCIP_CALL( SCIPvarChgBranchDirection(var, branchdirection) );
20543 
20544  return SCIP_OKAY;
20545 }
20546 
20547 /** tightens the variable bounds due a new variable type */
20548 static
20550  SCIP* scip, /**< SCIP data structure */
20551  SCIP_VAR* var, /**< variable to change the bound for */
20552  SCIP_VARTYPE vartype, /**< new type of variable */
20553  SCIP_Bool* infeasible /**< pointer to store whether an infeasibility was detected (, due to
20554  * integrality condition of the new variable type) */
20555  )
20556 {
20557  assert(scip != NULL);
20559  assert(scip->set->stage == SCIP_STAGE_PROBLEM || SCIPvarIsTransformed(var));
20560 
20561  *infeasible = FALSE;
20562 
20563  /* adjusts bounds if the variable type changed form continuous to non-continuous (integral) */
20565  {
20566  SCIP_Bool tightened;
20567 
20568  /* we adjust variable bounds to integers first, since otherwise a later bound tightening with a fractional old
20569  * bound may give an assert because SCIP expects non-continuous variables to have non-fractional bounds
20570  *
20571  * we adjust bounds with a fractionality within [eps,feastol] only if the resulting bound change is a bound
20572  * tightening, because relaxing bounds may not be allowed
20573  */
20574  if( !SCIPisFeasIntegral(scip, SCIPvarGetLbGlobal(var)) ||
20576  )
20577  {
20578  SCIP_CALL( SCIPtightenVarLbGlobal(scip, var, SCIPfeasCeil(scip, SCIPvarGetLbGlobal(var)), TRUE, infeasible, &tightened) );
20579  if( *infeasible )
20580  return SCIP_OKAY;
20581 
20582  /* the only reason for not applying a forced boundchange is when the new bound is reduced because the variables upper bound is below the new bound
20583  * in a concrete case, lb == ub == 100.99999001; even though within feastol of 101, the lower bound cannot be tighented to 101 due to the upper bound
20584  */
20585  assert(tightened || SCIPisFeasLE(scip, SCIPvarGetUbGlobal(var), SCIPfeasCeil(scip, SCIPvarGetLbGlobal(var))));
20586  }
20587  if( !SCIPisFeasIntegral(scip, SCIPvarGetUbGlobal(var)) ||
20589  )
20590  {
20591  SCIP_CALL( SCIPtightenVarUbGlobal(scip, var, SCIPfeasFloor(scip, SCIPvarGetUbGlobal(var)), TRUE, infeasible, &tightened) );
20592  if( *infeasible )
20593  return SCIP_OKAY;
20594 
20595  assert(tightened || SCIPisFeasGE(scip, SCIPvarGetLbGlobal(var), SCIPfeasFloor(scip, SCIPvarGetUbGlobal(var))));
20596  }
20597  }
20598 
20599  return SCIP_OKAY;
20600 }
20601 
20602 /** changes type of variable in the problem;
20603  *
20604  * @warning This type change might change the variable array returned from SCIPgetVars() and SCIPgetVarsData();
20605  *
20606  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
20607  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
20608  *
20609  * @pre This method can be called if @p scip is in one of the following stages:
20610  * - \ref SCIP_STAGE_PROBLEM
20611  * - \ref SCIP_STAGE_TRANSFORMING
20612  * - \ref SCIP_STAGE_PRESOLVING
20613  *
20614  * @note If SCIP is already beyond the SCIP_STAGE_PROBLEM and a original variable is passed, the variable type of the
20615  * corresponding transformed variable is changed; the type of the original variable does not change
20616  *
20617  * @note If the type changes from a continuous variable to a non-continuous variable the bounds of the variable get
20618  * adjusted w.r.t. to integrality information
20619  */
20621  SCIP* scip, /**< SCIP data structure */
20622  SCIP_VAR* var, /**< variable to change the bound for */
20623  SCIP_VARTYPE vartype, /**< new type of variable */
20624  SCIP_Bool* infeasible /**< pointer to store whether an infeasibility was detected (, due to
20625  * integrality condition of the new variable type) */
20626  )
20627 {
20628  assert(var != NULL);
20629 
20630  SCIP_CALL( checkStage(scip, "SCIPchgVarType", FALSE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE) );
20631 
20632  /* change variable type */
20633  switch( scip->set->stage )
20634  {
20635  case SCIP_STAGE_PROBLEM:
20636  assert(!SCIPvarIsTransformed(var));
20637 
20638  /* first adjust the variable due to new integrality information */
20639  SCIP_CALL( tightenBounds(scip, var, vartype, infeasible) );
20640 
20641  /* second change variable type */
20642  if( SCIPvarGetProbindex(var) >= 0 )
20643  {
20644  SCIP_CALL( SCIPprobChgVarType(scip->origprob, scip->mem->probmem, scip->set, scip->branchcand, var, vartype) );
20645  }
20646  else
20647  {
20648  SCIP_CALL( SCIPvarChgType(var, vartype) );
20649  }
20650  break;
20651 
20652  case SCIP_STAGE_PRESOLVING:
20653  if( !SCIPvarIsTransformed(var) )
20654  {
20655  SCIP_VAR* transvar;
20656 
20657  SCIP_CALL( SCIPgetTransformedVar(scip, var, &transvar) );
20658  assert(transvar != NULL);
20659 
20660  /* recall method with transformed variable */
20661  SCIP_CALL( SCIPchgVarType(scip, transvar, vartype, infeasible) );
20662  return SCIP_OKAY;
20663  }
20664 
20665  /* first adjust the variable due to new integrality information */
20666  SCIP_CALL( tightenBounds(scip, var, vartype, infeasible) );
20667 
20668  /* second change variable type */
20669  if( SCIPvarGetProbindex(var) >= 0 )
20670  {
20671  SCIP_CALL( SCIPprobChgVarType(scip->transprob, scip->mem->probmem, scip->set, scip->branchcand, var, vartype) );
20672  }
20673  else
20674  {
20675  SCIP_CALL( SCIPvarChgType(var, vartype) );
20676  }
20677  break;
20678 
20679  default:
20680  SCIPerrorMessage("invalid SCIP stage <%d>\n", scip->set->stage);
20681  return SCIP_INVALIDCALL;
20682  } /*lint !e788*/
20683 
20684  return SCIP_OKAY;
20685 }
20686 
20687 /** in problem creation and solving stage, both bounds of the variable are set to the given value;
20688  * in presolving stage, the variable is converted into a fixed variable, and bounds are changed respectively;
20689  * conversion into a fixed variable changes the vars array returned from SCIPgetVars() and SCIPgetVarsData(),
20690  * and also renders arrays returned from the SCIPvarGetImpl...() methods invalid
20691  *
20692  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
20693  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
20694  *
20695  * @pre This method can be called if @p scip is in one of the following stages:
20696  * - \ref SCIP_STAGE_PROBLEM
20697  * - \ref SCIP_STAGE_PRESOLVING
20698  * - \ref SCIP_STAGE_PRESOLVED
20699  * - \ref SCIP_STAGE_SOLVING
20700  */
20702  SCIP* scip, /**< SCIP data structure */
20703  SCIP_VAR* var, /**< variable to fix */
20704  SCIP_Real fixedval, /**< value to fix variable to */
20705  SCIP_Bool* infeasible, /**< pointer to store whether the fixing is infeasible */
20706  SCIP_Bool* fixed /**< pointer to store whether the fixing was performed (variable was unfixed) */
20707  )
20708 {
20709  assert(var != NULL);
20710  assert(infeasible != NULL);
20711  assert(fixed != NULL);
20712 
20713  SCIP_CALL( checkStage(scip, "SCIPfixVar", FALSE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, TRUE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) );
20714 
20715  *infeasible = FALSE;
20716  *fixed = FALSE;
20717 
20718  /* in the problem creation stage, modify the bounds as requested, independently from the current bounds */
20719  if( scip->set->stage != SCIP_STAGE_PROBLEM )
20720  {
20721  if( (SCIPvarGetType(var) != SCIP_VARTYPE_CONTINUOUS && !SCIPsetIsFeasIntegral(scip->set, fixedval))
20722  || SCIPsetIsFeasLT(scip->set, fixedval, SCIPvarGetLbLocal(var))
20723  || SCIPsetIsFeasGT(scip->set, fixedval, SCIPvarGetUbLocal(var)) )
20724  {
20725  *infeasible = TRUE;
20726  return SCIP_OKAY;
20727  }
20728  else if( SCIPvarGetStatus(var) == SCIP_VARSTATUS_FIXED )
20729  {
20730  *infeasible = !SCIPsetIsFeasEQ(scip->set, fixedval, SCIPvarGetLbLocal(var));
20731  return SCIP_OKAY;
20732  }
20733  }
20734  else
20735  assert(SCIPvarGetStatus(var) == SCIP_VARSTATUS_ORIGINAL);
20736 
20737  switch( scip->set->stage )
20738  {
20739  case SCIP_STAGE_PROBLEM:
20740  /* in the problem creation stage, modify the bounds as requested, independently from the current bounds;
20741  * we have to make sure, that the order of the bound changes does not intermediately produce an invalid
20742  * interval lb > ub
20743  */
20744  if( fixedval <= SCIPvarGetLbLocal(var) )
20745  {
20746  SCIP_CALL( SCIPchgVarLb(scip, var, fixedval) );
20747  SCIP_CALL( SCIPchgVarUb(scip, var, fixedval) );
20748  *fixed = TRUE;
20749  }
20750  else
20751  {
20752  SCIP_CALL( SCIPchgVarUb(scip, var, fixedval) );
20753  SCIP_CALL( SCIPchgVarLb(scip, var, fixedval) );
20754  *fixed = TRUE;
20755  }
20756  return SCIP_OKAY;
20757 
20758  case SCIP_STAGE_PRESOLVING:
20759  if( SCIPtreeGetCurrentDepth(scip->tree) == 0 )
20760  {
20761  SCIP_CALL( SCIPvarFix(var, scip->mem->probmem, scip->set, scip->stat, scip->transprob, scip->origprob, scip->primal, scip->tree,
20762  scip->lp, scip->branchcand, scip->eventqueue, fixedval, infeasible, fixed) );
20763  return SCIP_OKAY;
20764  }
20765  /*lint -fallthrough*/
20766  case SCIP_STAGE_PRESOLVED:
20767  case SCIP_STAGE_SOLVING:
20768  if( SCIPsetIsFeasGT(scip->set, fixedval, SCIPvarGetLbLocal(var)) )
20769  {
20770  SCIP_CALL( SCIPchgVarLb(scip, var, fixedval) );
20771  *fixed = TRUE;
20772  }
20773  if( SCIPsetIsFeasLT(scip->set, fixedval, SCIPvarGetUbLocal(var)) )
20774  {
20775  SCIP_CALL( SCIPchgVarUb(scip, var, fixedval) );
20776  *fixed = TRUE;
20777  }
20778  return SCIP_OKAY;
20779 
20780  default:
20781  SCIPerrorMessage("invalid SCIP stage <%d>\n", scip->set->stage);
20782  return SCIP_INVALIDCALL;
20783  } /*lint !e788*/
20784 }
20785 
20786 /** From a given equality a*x + b*y == c, aggregates one of the variables and removes it from the set of
20787  * active problem variables. This changes the vars array returned from SCIPgetVars() and SCIPgetVarsData(),
20788  * and also renders the arrays returned from the SCIPvarGetImpl...() methods for the two variables invalid.
20789  * In the first step, the equality is transformed into an equality with active problem variables
20790  * a'*x' + b'*y' == c'. If x' == y', this leads to the detection of redundancy if a' == -b' and c' == 0,
20791  * of infeasibility, if a' == -b' and c' != 0, or to a variable fixing x' == c'/(a'+b') (and possible
20792  * infeasibility) otherwise.
20793  * In the second step, the variable to be aggregated is chosen among x' and y', prefering a less strict variable
20794  * type as aggregation variable (i.e. continuous variables are preferred over implicit integers, implicit integers
20795  * over integers, and integers over binaries). If none of the variables is continuous, it is tried to find an integer
20796  * aggregation (i.e. integral coefficients a'' and b'', such that a''*x' + b''*y' == c''). This can lead to
20797  * the detection of infeasibility (e.g. if c'' is fractional), or to a rejection of the aggregation (denoted by
20798  * aggregated == FALSE), if the resulting integer coefficients are too large and thus numerically instable.
20799  *
20800  * The output flags have the following meaning:
20801  * - infeasible: the problem is infeasible
20802  * - redundant: the equality can be deleted from the constraint set
20803  * - aggregated: the aggregation was successfully performed (the variables were not aggregated before)
20804  *
20805  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
20806  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
20807  *
20808  * @pre This method can only be called if @p scip is in stage \ref SCIP_STAGE_PRESOLVING
20809  */
20811  SCIP* scip, /**< SCIP data structure */
20812  SCIP_VAR* varx, /**< variable x in equality a*x + b*y == c */
20813  SCIP_VAR* vary, /**< variable y in equality a*x + b*y == c */
20814  SCIP_Real scalarx, /**< multiplier a in equality a*x + b*y == c */
20815  SCIP_Real scalary, /**< multiplier b in equality a*x + b*y == c */
20816  SCIP_Real rhs, /**< right hand side c in equality a*x + b*y == c */
20817  SCIP_Bool* infeasible, /**< pointer to store whether the aggregation is infeasible */
20818  SCIP_Bool* redundant, /**< pointer to store whether the equality is (now) redundant */
20819  SCIP_Bool* aggregated /**< pointer to store whether the aggregation was successful */
20820  )
20821 {
20822  SCIP_Real constantx;
20823  SCIP_Real constanty;
20824 
20825  assert(infeasible != NULL);
20826  assert(redundant != NULL);
20827  assert(aggregated != NULL);
20828 
20829  SCIP_CALL( checkStage(scip, "SCIPaggregateVars", FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE) );
20830 
20831  *infeasible = FALSE;
20832  *redundant = FALSE;
20833  *aggregated = FALSE;
20834 
20835  if( SCIPtreeProbing(scip->tree) )
20836  {
20837  SCIPerrorMessage("cannot aggregate variables during probing\n");
20838  return SCIP_INVALIDCALL;
20839  }
20840  assert(SCIPtreeGetCurrentDepth(scip->tree) == 0);
20841 
20842  /* do not perform aggregation if it is globally deactivated */
20843  if( scip->set->presol_donotaggr )
20844  return SCIP_OKAY;
20845 
20846  /* get the corresponding equality in active problem variable space:
20847  * transform both expressions "a*x + 0" and "b*y + 0" into problem variable space
20848  */
20849  constantx = 0.0;
20850  constanty = 0.0;
20851  SCIP_CALL( SCIPvarGetProbvarSum(&varx, scip->set, &scalarx, &constantx) );
20852  SCIP_CALL( SCIPvarGetProbvarSum(&vary, scip->set, &scalary, &constanty) );
20853 
20854  /* we cannot aggregate multi-aggregated variables */
20856  return SCIP_OKAY;
20857 
20858  /* move the constant to the right hand side to acquire the form "a'*x' + b'*y' == c'" */
20859  rhs -= (constantx + constanty);
20860 
20861  /* if a scalar is zero, treat the variable as fixed-to-zero variable */
20862  if( SCIPsetIsZero(scip->set, scalarx) )
20863  varx = NULL;
20864  if( SCIPsetIsZero(scip->set, scalary) )
20865  vary = NULL;
20866 
20867  /* capture the special cases that less than two variables are left, due to resolutions to a fixed variable or
20868  * to the same active variable
20869  */
20870  if( varx == NULL && vary == NULL )
20871  {
20872  /* both variables were resolved to fixed variables */
20873  *infeasible = !SCIPsetIsZero(scip->set, rhs);
20874  *redundant = TRUE;
20875  }
20876  else if( varx == NULL )
20877  {
20878  assert(SCIPsetIsZero(scip->set, scalarx));
20879  assert(!SCIPsetIsZero(scip->set, scalary));
20880 
20881  /* variable x was resolved to fixed variable: variable y can be fixed to c'/b' */
20882  SCIP_CALL( SCIPvarFix(vary, scip->mem->probmem, scip->set, scip->stat, scip->transprob, scip->origprob, scip->primal, scip->tree,
20883  scip->lp, scip->branchcand, scip->eventqueue, rhs/scalary, infeasible, aggregated) );
20884  *redundant = TRUE;
20885  }
20886  else if( vary == NULL )
20887  {
20888  assert(SCIPsetIsZero(scip->set, scalary));
20889  assert(!SCIPsetIsZero(scip->set, scalarx));
20890 
20891  /* variable y was resolved to fixed variable: variable x can be fixed to c'/a' */
20892  SCIP_CALL( SCIPvarFix(varx, scip->mem->probmem, scip->set, scip->stat, scip->transprob, scip->origprob, scip->primal, scip->tree,
20893  scip->lp, scip->branchcand, scip->eventqueue, rhs/scalarx, infeasible, aggregated) );
20894  *redundant = TRUE;
20895  }
20896  else if( varx == vary )
20897  {
20898  /* both variables were resolved to the same active problem variable: this variable can be fixed */
20899  scalarx += scalary;
20900  if( SCIPsetIsZero(scip->set, scalarx) )
20901  {
20902  /* left hand side of equality is zero: equality is potentially infeasible */
20903  *infeasible = !SCIPsetIsZero(scip->set, rhs);
20904  }
20905  else
20906  {
20907  /* sum of scalars is not zero: fix variable x' == y' to c'/(a'+b') */
20908  SCIP_CALL( SCIPvarFix(varx, scip->mem->probmem, scip->set, scip->stat, scip->transprob, scip->origprob, scip->primal,
20909  scip->tree, scip->lp, scip->branchcand, scip->eventqueue, rhs/scalarx, infeasible, aggregated) );
20910  }
20911  *redundant = TRUE;
20912  }
20913  else
20914  {
20915  /* both variables are different active problem variables, and both scalars are non-zero: try to aggregate them */
20916  SCIP_CALL( SCIPvarTryAggregateVars(scip->set, scip->mem->probmem, scip->stat, scip->transprob, scip->origprob, scip->primal,
20917  scip->tree, scip->lp, scip->cliquetable, scip->branchcand, scip->eventfilter, scip->eventqueue,
20918  varx, vary, scalarx, scalary, rhs, infeasible, aggregated) );
20919  *redundant = *aggregated;
20920  }
20921 
20922  return SCIP_OKAY;
20923 }
20924 
20925 /** converts variable into multi-aggregated variable; this changes the variable array returned from
20926  * SCIPgetVars() and SCIPgetVarsData();
20927  *
20928  * @warning The integrality condition is not checked anymore on the multi-aggregated variable. You must not
20929  * multi-aggregate an integer variable without being sure, that integrality on the aggregation variables
20930  * implies integrality on the aggregated variable.
20931  *
20932  * The output flags have the following meaning:
20933  * - infeasible: the problem is infeasible
20934  * - aggregated: the aggregation was successfully performed (the variables were not aggregated before)
20935  *
20936  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
20937  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
20938  *
20939  * @pre This method can only be called if @p scip is in stage \ref SCIP_STAGE_PRESOLVING
20940  */
20942  SCIP* scip, /**< SCIP data structure */
20943  SCIP_VAR* var, /**< variable x to aggregate */
20944  int naggvars, /**< number n of variables in aggregation x = a_1*y_1 + ... + a_n*y_n + c */
20945  SCIP_VAR** aggvars, /**< variables y_i in aggregation x = a_1*y_1 + ... + a_n*y_n + c */
20946  SCIP_Real* scalars, /**< multipliers a_i in aggregation x = a_1*y_1 + ... + a_n*y_n + c */
20947  SCIP_Real constant, /**< constant shift c in aggregation x = a_1*y_1 + ... + a_n*y_n + c */
20948  SCIP_Bool* infeasible, /**< pointer to store whether the aggregation is infeasible */
20949  SCIP_Bool* aggregated /**< pointer to store whether the aggregation was successful */
20950  )
20951 {
20952  SCIP_CALL( checkStage(scip, "SCIPmultiaggregateVar", FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE) );
20953 
20954  if( SCIPtreeProbing(scip->tree) )
20955  {
20956  SCIPerrorMessage("cannot multi-aggregate variables during probing\n");
20957  return SCIP_INVALIDCALL;
20958  }
20959  assert(SCIPtreeGetCurrentDepth(scip->tree) == 0);
20960 
20961  SCIP_CALL( SCIPvarMultiaggregate(var, scip->mem->probmem, scip->set, scip->stat, scip->transprob, scip->origprob, scip->primal,
20962  scip->tree, scip->lp, scip->cliquetable, scip->branchcand, scip->eventfilter, scip->eventqueue,
20963  naggvars, aggvars, scalars, constant, infeasible, aggregated) );
20964 
20965  return SCIP_OKAY;
20966 }
20967 
20968 /** returns whether aggregation of variables is not allowed */
20970  SCIP* scip /**< SCIP data structure */
20971  )
20972 {
20973  assert(scip != NULL);
20974 
20975  return scip->set->presol_donotaggr;
20976 }
20977 
20978 /** returns whether multi-aggregation is disabled */
20980  SCIP* scip /**< SCIP data structure */
20981  )
20982 {
20983  assert(scip != NULL);
20984 
20985  return scip->set->presol_donotmultaggr;
20986 }
20987 
20988 /** returns whether variable is not allowed to be multi-aggregated */
20990  SCIP* scip, /**< SCIP data structure */
20991  SCIP_VAR* var /**< variable x to aggregate */
20992  )
20993 {
20994  assert(scip != NULL);
20995  assert(var != NULL);
20996 
20997  return scip->set->presol_donotmultaggr || SCIPvarDoNotMultaggr(var);
20998 }
20999 
21000 /** marks the variable that it must not be multi-aggregated
21001  *
21002  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
21003  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
21004  *
21005  * @pre This method can be called if @p scip is in one of the following stages:
21006  * - \ref SCIP_STAGE_INIT
21007  * - \ref SCIP_STAGE_PROBLEM
21008  * - \ref SCIP_STAGE_TRANSFORMING
21009  * - \ref SCIP_STAGE_TRANSFORMED
21010  * - \ref SCIP_STAGE_INITPRESOLVE
21011  * - \ref SCIP_STAGE_PRESOLVING
21012  * - \ref SCIP_STAGE_EXITPRESOLVE
21013  *
21014  * @note There exists no "unmark" method since it has to be ensured that if a plugin requires that a variable is not
21015  * multi-aggregated that this is will be the case.
21016  */
21018  SCIP* scip, /**< SCIP data structure */
21019  SCIP_VAR* var /**< variable to delete */
21020  )
21021 {
21022  assert(scip != NULL);
21023  assert(var != NULL);
21024 
21025  SCIP_CALL( checkStage(scip, "SCIPmarkDoNotMultaggrVar", TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, TRUE) );
21026 
21028 
21029  return SCIP_OKAY;
21030 }
21031 
21032 /** enables the collection of statistics for a variable
21033  *
21034  * @pre This method can be called if @p scip is in one of the following stages:
21035  * - \ref SCIP_STAGE_PROBLEM
21036  * - \ref SCIP_STAGE_INITPRESOLVE
21037  * - \ref SCIP_STAGE_PRESOLVING
21038  * - \ref SCIP_STAGE_EXITPRESOLVE
21039  * - \ref SCIP_STAGE_SOLVING
21040  * - \ref SCIP_STAGE_SOLVED
21041  */
21043  SCIP* scip /**< SCIP data structure */
21044  )
21045 {
21046  SCIP_CALL_ABORT( checkStage(scip, "SCIPenableVarHistory", FALSE, TRUE, FALSE, FALSE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE) );
21047 
21049 }
21050 
21051 /** disables the collection of any statistic for a variable
21052  *
21053  * @pre This method can be called if @p scip is in one of the following stages:
21054  * - \ref SCIP_STAGE_PROBLEM
21055  * - \ref SCIP_STAGE_INITPRESOLVE
21056  * - \ref SCIP_STAGE_PRESOLVING
21057  * - \ref SCIP_STAGE_EXITPRESOLVE
21058  * - \ref SCIP_STAGE_SOLVING
21059  * - \ref SCIP_STAGE_SOLVED
21060  */
21062  SCIP* scip /**< SCIP data structure */
21063  )
21064 {
21065  SCIP_CALL_ABORT( checkStage(scip, "SCIPdisableVarHistory", FALSE, TRUE, FALSE, FALSE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE) );
21066 
21068 }
21069 
21070 /** updates the pseudo costs of the given variable and the global pseudo costs after a change of "solvaldelta" in the
21071  * variable's solution value and resulting change of "objdelta" in the in the LP's objective value;
21072  * the update is ignored, if the objective value difference is infinite
21073  *
21074  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
21075  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
21076  *
21077  * @pre This method can be called if @p scip is in one of the following stages:
21078  * - \ref SCIP_STAGE_SOLVING
21079  * - \ref SCIP_STAGE_SOLVED
21080  */
21082  SCIP* scip, /**< SCIP data structure */
21083  SCIP_VAR* var, /**< problem variable */
21084  SCIP_Real solvaldelta, /**< difference of variable's new LP value - old LP value */
21085  SCIP_Real objdelta, /**< difference of new LP's objective value - old LP's objective value */
21086  SCIP_Real weight /**< weight in (0,1] of this update in pseudo cost sum */
21087  )
21088 {
21089  SCIP_CALL( checkStage(scip, "SCIPupdateVarPseudocost", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE) );
21090 
21091  if( !SCIPsetIsInfinity(scip->set, 2*objdelta) ) /* differences infinity - eps should also be treated as infinity */
21092  {
21093  SCIP_CALL( SCIPvarUpdatePseudocost(var, scip->set, scip->stat, solvaldelta, objdelta, weight) );
21094  }
21095 
21096  return SCIP_OKAY;
21097 }
21098 
21099 /** gets the variable's pseudo cost value for the given change of the variable's LP value
21100  *
21101  * @return the variable's pseudo cost value for the given change of the variable's LP value
21102  *
21103  * @pre This method can be called if @p scip is in one of the following stages:
21104  * - \ref SCIP_STAGE_INITPRESOLVE
21105  * - \ref SCIP_STAGE_PRESOLVING
21106  * - \ref SCIP_STAGE_EXITPRESOLVE
21107  * - \ref SCIP_STAGE_PRESOLVED
21108  * - \ref SCIP_STAGE_INITSOLVE
21109  * - \ref SCIP_STAGE_SOLVING
21110  * - \ref SCIP_STAGE_SOLVED
21111  */
21113  SCIP* scip, /**< SCIP data structure */
21114  SCIP_VAR* var, /**< problem variable */
21115  SCIP_Real solvaldelta /**< difference of variable's new LP value - old LP value */
21116  )
21117 {
21118  SCIP_CALL_ABORT( checkStage(scip, "SCIPgetVarPseudocostVal", FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE) );
21119 
21120  return SCIPvarGetPseudocost(var, scip->stat, solvaldelta);
21121 }
21122 
21123 /** gets the variable's pseudo cost value for the given change of the variable's LP value,
21124  * only using the pseudo cost information of the current run
21125  *
21126  * @return the variable's pseudo cost value for the given change of the variable's LP value,
21127  * only using the pseudo cost information of the current run
21128  *
21129  * @pre This method can be called if @p scip is in one of the following stages:
21130  * - \ref SCIP_STAGE_INITPRESOLVE
21131  * - \ref SCIP_STAGE_PRESOLVING
21132  * - \ref SCIP_STAGE_EXITPRESOLVE
21133  * - \ref SCIP_STAGE_PRESOLVED
21134  * - \ref SCIP_STAGE_INITSOLVE
21135  * - \ref SCIP_STAGE_SOLVING
21136  * - \ref SCIP_STAGE_SOLVED
21137  */
21139  SCIP* scip, /**< SCIP data structure */
21140  SCIP_VAR* var, /**< problem variable */
21141  SCIP_Real solvaldelta /**< difference of variable's new LP value - old LP value */
21142  )
21143 {
21144  SCIP_CALL_ABORT( checkStage(scip, "SCIPgetVarPseudocostValCurrentRun", FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE) );
21145 
21146  return SCIPvarGetPseudocostCurrentRun(var, scip->stat, solvaldelta);
21147 }
21148 
21149 /** gets the variable's pseudo cost value for the given direction
21150  *
21151  * @return the variable's pseudo cost value for the given direction
21152  *
21153  * @pre This method can be called if @p scip is in one of the following stages:
21154  * - \ref SCIP_STAGE_INITPRESOLVE
21155  * - \ref SCIP_STAGE_PRESOLVING
21156  * - \ref SCIP_STAGE_EXITPRESOLVE
21157  * - \ref SCIP_STAGE_PRESOLVED
21158  * - \ref SCIP_STAGE_INITSOLVE
21159  * - \ref SCIP_STAGE_SOLVING
21160  * - \ref SCIP_STAGE_SOLVED
21161  */
21163  SCIP* scip, /**< SCIP data structure */
21164  SCIP_VAR* var, /**< problem variable */
21165  SCIP_BRANCHDIR dir /**< branching direction (downwards, or upwards) */
21166  )
21167 {
21168  SCIP_CALL_ABORT( checkStage(scip, "SCIPgetVarPseudocost", FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE) );
21169  assert(dir == SCIP_BRANCHDIR_DOWNWARDS || dir == SCIP_BRANCHDIR_UPWARDS);
21170 
21171  return SCIPvarGetPseudocost(var, scip->stat, dir == SCIP_BRANCHDIR_DOWNWARDS ? -1.0 : 1.0);
21172 }
21173 
21174 /** gets the variable's pseudo cost value for the given direction,
21175  * only using the pseudo cost information of the current run
21176  *
21177  * @return the variable's pseudo cost value for the given direction,
21178  * only using the pseudo cost information of the current run
21179  *
21180  * @pre This method can be called if @p scip is in one of the following stages:
21181  * - \ref SCIP_STAGE_INITPRESOLVE
21182  * - \ref SCIP_STAGE_PRESOLVING
21183  * - \ref SCIP_STAGE_EXITPRESOLVE
21184  * - \ref SCIP_STAGE_PRESOLVED
21185  * - \ref SCIP_STAGE_INITSOLVE
21186  * - \ref SCIP_STAGE_SOLVING
21187  * - \ref SCIP_STAGE_SOLVED
21188  */
21190  SCIP* scip, /**< SCIP data structure */
21191  SCIP_VAR* var, /**< problem variable */
21192  SCIP_BRANCHDIR dir /**< branching direction (downwards, or upwards) */
21193  )
21194 {
21195  SCIP_CALL_ABORT( checkStage(scip, "SCIPgetVarPseudocostCurrentRun", FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE) );
21196  assert(dir == SCIP_BRANCHDIR_DOWNWARDS || dir == SCIP_BRANCHDIR_UPWARDS);
21197 
21198  return SCIPvarGetPseudocostCurrentRun(var, scip->stat, dir == SCIP_BRANCHDIR_DOWNWARDS ? -1.0 : 1.0);
21199 }
21200 
21201 /** gets the variable's (possible fractional) number of pseudo cost updates for the given direction
21202  *
21203  * @return the variable's (possible fractional) number of pseudo cost updates for the given direction
21204  *
21205  * @pre This method can be called if @p scip is in one of the following stages:
21206  * - \ref SCIP_STAGE_INITPRESOLVE
21207  * - \ref SCIP_STAGE_PRESOLVING
21208  * - \ref SCIP_STAGE_EXITPRESOLVE
21209  * - \ref SCIP_STAGE_PRESOLVED
21210  * - \ref SCIP_STAGE_INITSOLVE
21211  * - \ref SCIP_STAGE_SOLVING
21212  * - \ref SCIP_STAGE_SOLVED
21213  */
21215  SCIP* scip, /**< SCIP data structure */
21216  SCIP_VAR* var, /**< problem variable */
21217  SCIP_BRANCHDIR dir /**< branching direction (downwards, or upwards) */
21218  )
21219 {
21220  SCIP_CALL_ABORT( checkStage(scip, "SCIPgetVarPseudocostCount", FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE) );
21221  assert(dir == SCIP_BRANCHDIR_DOWNWARDS || dir == SCIP_BRANCHDIR_UPWARDS);
21222 
21223  return SCIPvarGetPseudocostCount(var, dir);
21224 }
21225 
21226 /** gets the variable's (possible fractional) number of pseudo cost updates for the given direction,
21227  * only using the pseudo cost information of the current run
21228  *
21229  * @return the variable's (possible fractional) number of pseudo cost updates for the given direction,
21230  * only using the pseudo cost information of the current run
21231  *
21232  * @pre This method can be called if @p scip is in one of the following stages:
21233  * - \ref SCIP_STAGE_INITPRESOLVE
21234  * - \ref SCIP_STAGE_PRESOLVING
21235  * - \ref SCIP_STAGE_EXITPRESOLVE
21236  * - \ref SCIP_STAGE_PRESOLVED
21237  * - \ref SCIP_STAGE_INITSOLVE
21238  * - \ref SCIP_STAGE_SOLVING
21239  * - \ref SCIP_STAGE_SOLVED
21240  */
21242  SCIP* scip, /**< SCIP data structure */
21243  SCIP_VAR* var, /**< problem variable */
21244  SCIP_BRANCHDIR dir /**< branching direction (downwards, or upwards) */
21245  )
21246 {
21247  SCIP_CALL_ABORT( checkStage(scip, "SCIPgetVarPseudocostCountCurrentRun", FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE) );
21248  assert(dir == SCIP_BRANCHDIR_DOWNWARDS || dir == SCIP_BRANCHDIR_UPWARDS);
21249 
21250  return SCIPvarGetPseudocostCountCurrentRun(var, dir);
21251 }
21252 
21253 /** gets the variable's pseudo cost score value for the given LP solution value
21254  *
21255  * @return the variable's pseudo cost score value for the given LP solution value
21256  *
21257  * @pre This method can be called if @p scip is in one of the following stages:
21258  * - \ref SCIP_STAGE_INITPRESOLVE
21259  * - \ref SCIP_STAGE_PRESOLVING
21260  * - \ref SCIP_STAGE_EXITPRESOLVE
21261  * - \ref SCIP_STAGE_PRESOLVED
21262  * - \ref SCIP_STAGE_INITSOLVE
21263  * - \ref SCIP_STAGE_SOLVING
21264  * - \ref SCIP_STAGE_SOLVED
21265  */
21267  SCIP* scip, /**< SCIP data structure */
21268  SCIP_VAR* var, /**< problem variable */
21269  SCIP_Real solval /**< variable's LP solution value */
21270  )
21271 {
21272  SCIP_Real downsol;
21273  SCIP_Real upsol;
21274  SCIP_Real pscostdown;
21275  SCIP_Real pscostup;
21276 
21277  SCIP_CALL_ABORT( checkStage(scip, "SCIPgetVarPseudocostScore", FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE) );
21278 
21279  downsol = SCIPsetFeasCeil(scip->set, solval-1.0);
21280  upsol = SCIPsetFeasFloor(scip->set, solval+1.0);
21281  pscostdown = SCIPvarGetPseudocost(var, scip->stat, downsol-solval);
21282  pscostup = SCIPvarGetPseudocost(var, scip->stat, upsol-solval);
21283 
21284  return SCIPbranchGetScore(scip->set, var, pscostdown, pscostup);
21285 }
21286 
21287 /** gets the variable's pseudo cost score value for the given LP solution value,
21288  * only using the pseudo cost information of the current run
21289  *
21290  * @return the variable's pseudo cost score value for the given LP solution value,
21291  * only using the pseudo cost information of the current run
21292  *
21293  * @pre This method can be called if @p scip is in one of the following stages:
21294  * - \ref SCIP_STAGE_INITPRESOLVE
21295  * - \ref SCIP_STAGE_PRESOLVING
21296  * - \ref SCIP_STAGE_EXITPRESOLVE
21297  * - \ref SCIP_STAGE_PRESOLVED
21298  * - \ref SCIP_STAGE_INITSOLVE
21299  * - \ref SCIP_STAGE_SOLVING
21300  * - \ref SCIP_STAGE_SOLVED
21301  */
21303  SCIP* scip, /**< SCIP data structure */
21304  SCIP_VAR* var, /**< problem variable */
21305  SCIP_Real solval /**< variable's LP solution value */
21306  )
21307 {
21308  SCIP_Real downsol;
21309  SCIP_Real upsol;
21310  SCIP_Real pscostdown;
21311  SCIP_Real pscostup;
21312 
21313  SCIP_CALL_ABORT( checkStage(scip, "SCIPgetVarPseudocostScoreCurrentRun", FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE) );
21314 
21315  downsol = SCIPsetFeasCeil(scip->set, solval-1.0);
21316  upsol = SCIPsetFeasFloor(scip->set, solval+1.0);
21317  pscostdown = SCIPvarGetPseudocostCurrentRun(var, scip->stat, downsol-solval);
21318  pscostup = SCIPvarGetPseudocostCurrentRun(var, scip->stat, upsol-solval);
21319 
21320  return SCIPbranchGetScore(scip->set, var, pscostdown, pscostup);
21321 }
21322 
21323 /** returns the variable's VSIDS value
21324  *
21325  * @return the variable's VSIDS value
21326  *
21327  * @pre This method can be called if @p scip is in one of the following stages:
21328  * - \ref SCIP_STAGE_INITPRESOLVE
21329  * - \ref SCIP_STAGE_PRESOLVING
21330  * - \ref SCIP_STAGE_EXITPRESOLVE
21331  * - \ref SCIP_STAGE_PRESOLVED
21332  * - \ref SCIP_STAGE_INITSOLVE
21333  * - \ref SCIP_STAGE_SOLVING
21334  * - \ref SCIP_STAGE_SOLVED
21335  */
21337  SCIP* scip, /**< SCIP data structure */
21338  SCIP_VAR* var, /**< problem variable */
21339  SCIP_BRANCHDIR dir /**< branching direction (downwards, or upwards) */
21340  )
21341 {
21342  SCIP_CALL_ABORT( checkStage(scip, "SCIPgetVarVSIDS", FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE) );
21343 
21344  return SCIPvarGetVSIDS(var, scip->stat, dir);
21345 }
21346 
21347 /** returns the variable's VSIDS value only using conflicts of the current run
21348  *
21349  * @return the variable's VSIDS value only using conflicts of the current run
21350  *
21351  * @pre This method can be called if @p scip is in one of the following stages:
21352  * - \ref SCIP_STAGE_INITPRESOLVE
21353  * - \ref SCIP_STAGE_PRESOLVING
21354  * - \ref SCIP_STAGE_EXITPRESOLVE
21355  * - \ref SCIP_STAGE_PRESOLVED
21356  * - \ref SCIP_STAGE_INITSOLVE
21357  * - \ref SCIP_STAGE_SOLVING
21358  * - \ref SCIP_STAGE_SOLVED
21359  */
21361  SCIP* scip, /**< SCIP data structure */
21362  SCIP_VAR* var, /**< problem variable */
21363  SCIP_BRANCHDIR dir /**< branching direction (downwards, or upwards) */
21364  )
21365 {
21366  SCIP_CALL_ABORT( checkStage(scip, "SCIPgetVarVSIDSCurrentRun", FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE) );
21367 
21368  return SCIPvarGetVSIDSCurrentRun(var, scip->stat, dir);
21369 }
21370 
21371 /** returns the variable's conflict score value
21372  *
21373  * @return the variable's conflict score value
21374  *
21375  * @pre This method can be called if @p scip is in one of the following stages:
21376  * - \ref SCIP_STAGE_INITPRESOLVE
21377  * - \ref SCIP_STAGE_PRESOLVING
21378  * - \ref SCIP_STAGE_EXITPRESOLVE
21379  * - \ref SCIP_STAGE_PRESOLVED
21380  * - \ref SCIP_STAGE_INITSOLVE
21381  * - \ref SCIP_STAGE_SOLVING
21382  * - \ref SCIP_STAGE_SOLVED
21383  */
21385  SCIP* scip, /**< SCIP data structure */
21386  SCIP_VAR* var /**< problem variable */
21387  )
21388 {
21389  SCIP_Real downscore;
21390  SCIP_Real upscore;
21391 
21392  SCIP_CALL_ABORT( checkStage(scip, "SCIPgetVarConflictScore", FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE) );
21393 
21394  downscore = SCIPvarGetVSIDS(var, scip->stat, SCIP_BRANCHDIR_DOWNWARDS);
21395  upscore = SCIPvarGetVSIDS(var, scip->stat, SCIP_BRANCHDIR_UPWARDS);
21396 
21397  return SCIPbranchGetScore(scip->set, var, downscore, upscore);
21398 }
21399 
21400 /** returns the variable's conflict score value only using conflicts of the current run
21401  *
21402  * @return the variable's conflict score value only using conflicts of the current run
21403  *
21404  * @pre This method can be called if @p scip is in one of the following stages:
21405  * - \ref SCIP_STAGE_INITPRESOLVE
21406  * - \ref SCIP_STAGE_PRESOLVING
21407  * - \ref SCIP_STAGE_EXITPRESOLVE
21408  * - \ref SCIP_STAGE_PRESOLVED
21409  * - \ref SCIP_STAGE_INITSOLVE
21410  * - \ref SCIP_STAGE_SOLVING
21411  * - \ref SCIP_STAGE_SOLVED
21412  */
21414  SCIP* scip, /**< SCIP data structure */
21415  SCIP_VAR* var /**< problem variable */
21416  )
21417 {
21418  SCIP_Real downscore;
21419  SCIP_Real upscore;
21420 
21421  SCIP_CALL_ABORT( checkStage(scip, "SCIPgetVarConflictScoreCurrentRun", FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE) );
21422 
21423  downscore = SCIPvarGetVSIDSCurrentRun(var, scip->stat, SCIP_BRANCHDIR_DOWNWARDS);
21424  upscore = SCIPvarGetVSIDSCurrentRun(var, scip->stat, SCIP_BRANCHDIR_UPWARDS);
21425 
21426  return SCIPbranchGetScore(scip->set, var, downscore, upscore);
21427 }
21428 
21429 /** returns the variable's conflict length score
21430  *
21431  * @return the variable's conflict length score
21432  *
21433  * @pre This method can be called if @p scip is in one of the following stages:
21434  * - \ref SCIP_STAGE_INITPRESOLVE
21435  * - \ref SCIP_STAGE_PRESOLVING
21436  * - \ref SCIP_STAGE_EXITPRESOLVE
21437  * - \ref SCIP_STAGE_PRESOLVED
21438  * - \ref SCIP_STAGE_INITSOLVE
21439  * - \ref SCIP_STAGE_SOLVING
21440  * - \ref SCIP_STAGE_SOLVED
21441  */
21443  SCIP* scip, /**< SCIP data structure */
21444  SCIP_VAR* var /**< problem variable */
21445  )
21446 {
21447  SCIP_Real downscore;
21448  SCIP_Real upscore;
21449 
21450  SCIP_CALL_ABORT( checkStage(scip, "SCIPgetVarConflictlengthScore", FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE) );
21451 
21454 
21455  return SCIPbranchGetScore(scip->set, var, downscore, upscore);
21456 }
21457 
21458 /** returns the variable's conflict length score only using conflicts of the current run
21459  *
21460  * @return the variable's conflict length score only using conflicts of the current run
21461  *
21462  * @pre This method can be called if @p scip is in one of the following stages:
21463  * - \ref SCIP_STAGE_INITPRESOLVE
21464  * - \ref SCIP_STAGE_PRESOLVING
21465  * - \ref SCIP_STAGE_EXITPRESOLVE
21466  * - \ref SCIP_STAGE_PRESOLVED
21467  * - \ref SCIP_STAGE_INITSOLVE
21468  * - \ref SCIP_STAGE_SOLVING
21469  * - \ref SCIP_STAGE_SOLVED
21470  */
21472  SCIP* scip, /**< SCIP data structure */
21473  SCIP_VAR* var /**< problem variable */
21474  )
21475 {
21476  SCIP_Real downscore;
21477  SCIP_Real upscore;
21478 
21479  SCIP_CALL_ABORT( checkStage(scip, "SCIPgetVarConflictlengthScoreCurrentRun", FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE) );
21480 
21483 
21484  return SCIPbranchGetScore(scip->set, var, downscore, upscore);
21485 }
21486 
21487 /** returns the variable's average conflict length
21488  *
21489  * @return the variable's average conflict length
21490  *
21491  * @pre This method can be called if @p scip is in one of the following stages:
21492  * - \ref SCIP_STAGE_INITPRESOLVE
21493  * - \ref SCIP_STAGE_PRESOLVING
21494  * - \ref SCIP_STAGE_EXITPRESOLVE
21495  * - \ref SCIP_STAGE_PRESOLVED
21496  * - \ref SCIP_STAGE_INITSOLVE
21497  * - \ref SCIP_STAGE_SOLVING
21498  * - \ref SCIP_STAGE_SOLVED
21499  */
21501  SCIP* scip, /**< SCIP data structure */
21502  SCIP_VAR* var, /**< problem variable */
21503  SCIP_BRANCHDIR dir /**< branching direction (downwards, or upwards) */
21504  )
21505 {
21506  SCIP_CALL_ABORT( checkStage(scip, "SCIPgetVarAvgConflictlength", FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE) );
21507 
21508  return SCIPvarGetAvgConflictlength(var, dir);
21509 }
21510 
21511 /** returns the variable's average conflict length only using conflicts of the current run
21512  *
21513  * @return the variable's average conflict length only using conflicts of the current run
21514  *
21515  * @pre This method can be called if @p scip is in one of the following stages:
21516  * - \ref SCIP_STAGE_INITPRESOLVE
21517  * - \ref SCIP_STAGE_PRESOLVING
21518  * - \ref SCIP_STAGE_EXITPRESOLVE
21519  * - \ref SCIP_STAGE_PRESOLVED
21520  * - \ref SCIP_STAGE_INITSOLVE
21521  * - \ref SCIP_STAGE_SOLVING
21522  * - \ref SCIP_STAGE_SOLVED
21523  */
21525  SCIP* scip, /**< SCIP data structure */
21526  SCIP_VAR* var, /**< problem variable */
21527  SCIP_BRANCHDIR dir /**< branching direction (downwards, or upwards) */
21528  )
21529 {
21530  SCIP_CALL_ABORT( checkStage(scip, "SCIPgetVarAvgConflictlengthCurrentRun", FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE) );
21531 
21532  return SCIPvarGetAvgConflictlengthCurrentRun(var, dir);
21533 }
21534 
21535 /** returns the average number of inferences found after branching on the variable in given direction;
21536  * if branching on the variable in the given direction was yet evaluated, the average number of inferences
21537  * over all variables for branching in the given direction is returned
21538  *
21539  * @return the average number of inferences found after branching on the variable in given direction
21540  *
21541  * @pre This method can be called if @p scip is in one of the following stages:
21542  * - \ref SCIP_STAGE_INITPRESOLVE
21543  * - \ref SCIP_STAGE_PRESOLVING
21544  * - \ref SCIP_STAGE_EXITPRESOLVE
21545  * - \ref SCIP_STAGE_PRESOLVED
21546  * - \ref SCIP_STAGE_INITSOLVE
21547  * - \ref SCIP_STAGE_SOLVING
21548  * - \ref SCIP_STAGE_SOLVED
21549  */
21551  SCIP* scip, /**< SCIP data structure */
21552  SCIP_VAR* var, /**< problem variable */
21553  SCIP_BRANCHDIR dir /**< branching direction (downwards, or upwards) */
21554  )
21555 {
21556  SCIP_CALL_ABORT( checkStage(scip, "SCIPgetVarAvgInferences", FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE) );
21557 
21558  return SCIPvarGetAvgInferences(var, scip->stat, dir);
21559 }
21560 
21561 /** returns the average number of inferences found after branching on the variable in given direction in the current run;
21562  * if branching on the variable in the given direction was yet evaluated, the average number of inferences
21563  * over all variables for branching in the given direction is returned
21564  *
21565  * @return the average number of inferences found after branching on the variable in given direction in the current run
21566  *
21567  * @pre This method can be called if @p scip is in one of the following stages:
21568  * - \ref SCIP_STAGE_INITPRESOLVE
21569  * - \ref SCIP_STAGE_PRESOLVING
21570  * - \ref SCIP_STAGE_EXITPRESOLVE
21571  * - \ref SCIP_STAGE_PRESOLVED
21572  * - \ref SCIP_STAGE_INITSOLVE
21573  * - \ref SCIP_STAGE_SOLVING
21574  * - \ref SCIP_STAGE_SOLVED
21575  */
21577  SCIP* scip, /**< SCIP data structure */
21578  SCIP_VAR* var, /**< problem variable */
21579  SCIP_BRANCHDIR dir /**< branching direction (downwards, or upwards) */
21580  )
21581 {
21582  SCIP_CALL_ABORT( checkStage(scip, "SCIPgetVarAvgInferencesCurrentRun", FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE) );
21583 
21584  return SCIPvarGetAvgInferencesCurrentRun(var, scip->stat, dir);
21585 }
21586 
21587 /** returns the variable's average inference score value
21588  *
21589  * @return the variable's average inference score value
21590  *
21591  * @pre This method can be called if @p scip is in one of the following stages:
21592  * - \ref SCIP_STAGE_INITPRESOLVE
21593  * - \ref SCIP_STAGE_PRESOLVING
21594  * - \ref SCIP_STAGE_EXITPRESOLVE
21595  * - \ref SCIP_STAGE_PRESOLVED
21596  * - \ref SCIP_STAGE_INITSOLVE
21597  * - \ref SCIP_STAGE_SOLVING
21598  * - \ref SCIP_STAGE_SOLVED
21599  */
21601  SCIP* scip, /**< SCIP data structure */
21602  SCIP_VAR* var /**< problem variable */
21603  )
21604 {
21605  SCIP_Real inferdown;
21606  SCIP_Real inferup;
21607 
21608  SCIP_CALL_ABORT( checkStage(scip, "SCIPgetVarAvgInferenceScore", FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE) );
21609 
21610  inferdown = SCIPvarGetAvgInferences(var, scip->stat, SCIP_BRANCHDIR_DOWNWARDS);
21611  inferup = SCIPvarGetAvgInferences(var, scip->stat, SCIP_BRANCHDIR_UPWARDS);
21612 
21613  return SCIPbranchGetScore(scip->set, var, inferdown, inferup);
21614 }
21615 
21616 /** returns the variable's average inference score value only using inferences of the current run
21617  *
21618  * @return the variable's average inference score value only using inferences of the current run
21619  *
21620  * @pre This method can be called if @p scip is in one of the following stages:
21621  * - \ref SCIP_STAGE_INITPRESOLVE
21622  * - \ref SCIP_STAGE_PRESOLVING
21623  * - \ref SCIP_STAGE_EXITPRESOLVE
21624  * - \ref SCIP_STAGE_PRESOLVED
21625  * - \ref SCIP_STAGE_INITSOLVE
21626  * - \ref SCIP_STAGE_SOLVING
21627  * - \ref SCIP_STAGE_SOLVED
21628  */
21630  SCIP* scip, /**< SCIP data structure */
21631  SCIP_VAR* var /**< problem variable */
21632  )
21633 {
21634  SCIP_Real inferdown;
21635  SCIP_Real inferup;
21636 
21637  SCIP_CALL_ABORT( checkStage(scip, "SCIPgetVarAvgInferenceScoreCurrentRun", FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE) );
21638 
21641 
21642  return SCIPbranchGetScore(scip->set, var, inferdown, inferup);
21643 }
21644 
21645 /** initializes the upwards and downwards pseudocosts, conflict scores, conflict lengths, inference scores, cutoff scores
21646  * of a variable to the given values
21647  *
21648  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
21649  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
21650  *
21651  * @pre This method can be called if @p scip is in one of the following stages:
21652  * - \ref SCIP_STAGE_TRANSFORMED
21653  * - \ref SCIP_STAGE_INITPRESOLVE
21654  * - \ref SCIP_STAGE_PRESOLVING
21655  * - \ref SCIP_STAGE_EXITPRESOLVE
21656  * - \ref SCIP_STAGE_PRESOLVED
21657  * - \ref SCIP_STAGE_INITSOLVE
21658  * - \ref SCIP_STAGE_SOLVING
21659  */
21661  SCIP* scip, /**< SCIP data structure */
21662  SCIP_VAR* var, /**< variable which should be initialized */
21663  SCIP_Real downpscost, /**< value to which pseudocosts for downwards branching should be initialized */
21664  SCIP_Real uppscost, /**< value to which pseudocosts for upwards branching should be initialized */
21665  SCIP_Real downvsids, /**< value to which VSIDS score for downwards branching should be initialized */
21666  SCIP_Real upvsids, /**< value to which VSIDS score for upwards branching should be initialized */
21667  SCIP_Real downconflen, /**< value to which conflict length score for downwards branching should be initialized */
21668  SCIP_Real upconflen, /**< value to which conflict length score for upwards branching should be initialized */
21669  SCIP_Real downinfer, /**< value to which inference counter for downwards branching should be initialized */
21670  SCIP_Real upinfer, /**< value to which inference counter for upwards branching should be initialized */
21671  SCIP_Real downcutoff, /**< value to which cutoff counter for downwards branching should be initialized */
21672  SCIP_Real upcutoff /**< value to which cutoff counter for upwards branching should be initialized */
21673  )
21674 {
21675  SCIP_CALL( checkStage(scip, "SCIPinitVarBranchStats", FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE) );
21676 
21677  assert(downpscost >= 0.0 && uppscost >= 0.0);
21678  assert(downvsids >= 0.0 && upvsids >= 0.0);
21679  assert(downconflen >= 0.0 && upconflen >= 0.0);
21680  assert(downinfer >= 0.0 && upinfer >= 0.0);
21681  assert(downcutoff >= 0.0 && upcutoff >= 0.0);
21682 
21683  if( !SCIPisFeasZero(scip, downpscost) || !SCIPisFeasZero(scip, downvsids)
21684  || !SCIPisFeasZero(scip, downinfer) || !SCIPisFeasZero(scip, downcutoff) )
21685  {
21687  SCIP_CALL( SCIPvarUpdatePseudocost(var, scip->set, scip->stat, -1.0, downpscost, 1.0) );
21689  SCIP_CALL( SCIPvarIncVSIDS(var, NULL, scip->set, scip->stat, SCIP_BRANCHDIR_DOWNWARDS, SCIP_UNKNOWN, downvsids) );
21691  }
21692 
21693  if( !SCIPisFeasZero(scip, downconflen) )
21694  {
21696  }
21697 
21698  if( !SCIPisFeasZero(scip, uppscost) || !SCIPisFeasZero(scip, upvsids)
21699  || !SCIPisFeasZero(scip, upinfer) || !SCIPisFeasZero(scip, upcutoff) )
21700  {
21702  SCIP_CALL( SCIPvarUpdatePseudocost(var, scip->set, scip->stat, 1.0, uppscost, 1.0) );
21704  SCIP_CALL( SCIPvarIncVSIDS(var, NULL, scip->set, scip->stat, SCIP_BRANCHDIR_UPWARDS, SCIP_UNKNOWN, upvsids) );
21706  }
21707 
21708  if( !SCIPisFeasZero(scip, upconflen) )
21709  {
21711  }
21712 
21713  return SCIP_OKAY;
21714 }
21715 
21716 /** returns the average number of cutoffs found after branching on the variable in given direction;
21717  * if branching on the variable in the given direction was yet evaluated, the average number of cutoffs
21718  * over all variables for branching in the given direction is returned
21719  *
21720  * @return the average number of cutoffs found after branching on the variable in given direction
21721  *
21722  * @pre This method can be called if @p scip is in one of the following stages:
21723  * - \ref SCIP_STAGE_INITPRESOLVE
21724  * - \ref SCIP_STAGE_PRESOLVING
21725  * - \ref SCIP_STAGE_EXITPRESOLVE
21726  * - \ref SCIP_STAGE_PRESOLVED
21727  * - \ref SCIP_STAGE_INITSOLVE
21728  * - \ref SCIP_STAGE_SOLVING
21729  * - \ref SCIP_STAGE_SOLVED
21730  */
21732  SCIP* scip, /**< SCIP data structure */
21733  SCIP_VAR* var, /**< problem variable */
21734  SCIP_BRANCHDIR dir /**< branching direction (downwards, or upwards) */
21735  )
21736 {
21737  SCIP_CALL_ABORT( checkStage(scip, "SCIPgetVarAvgCutoffs", FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE) );
21738 
21739  return SCIPvarGetAvgCutoffs(var, scip->stat, dir);
21740 }
21741 
21742 /** returns the average number of cutoffs found after branching on the variable in given direction in the current run;
21743  * if branching on the variable in the given direction was yet evaluated, the average number of cutoffs
21744  * over all variables for branching in the given direction is returned
21745  *
21746  * @return the average number of cutoffs found after branching on the variable in given direction in the current run
21747  *
21748  * @pre This method can be called if @p scip is in one of the following stages:
21749  * - \ref SCIP_STAGE_INITPRESOLVE
21750  * - \ref SCIP_STAGE_PRESOLVING
21751  * - \ref SCIP_STAGE_EXITPRESOLVE
21752  * - \ref SCIP_STAGE_PRESOLVED
21753  * - \ref SCIP_STAGE_INITSOLVE
21754  * - \ref SCIP_STAGE_SOLVING
21755  * - \ref SCIP_STAGE_SOLVED
21756  */
21758  SCIP* scip, /**< SCIP data structure */
21759  SCIP_VAR* var, /**< problem variable */
21760  SCIP_BRANCHDIR dir /**< branching direction (downwards, or upwards) */
21761  )
21762 {
21763  SCIP_CALL_ABORT( checkStage(scip, "SCIPgetVarAvgCutoffsCurrentRun", FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE) );
21764 
21765  return SCIPvarGetAvgCutoffsCurrentRun(var, scip->stat, dir);
21766 }
21767 
21768 /** returns the variable's average cutoff score value
21769  *
21770  * @return the variable's average cutoff score value
21771  *
21772  * @pre This method can be called if @p scip is in one of the following stages:
21773  * - \ref SCIP_STAGE_INITPRESOLVE
21774  * - \ref SCIP_STAGE_PRESOLVING
21775  * - \ref SCIP_STAGE_EXITPRESOLVE
21776  * - \ref SCIP_STAGE_PRESOLVED
21777  * - \ref SCIP_STAGE_INITSOLVE
21778  * - \ref SCIP_STAGE_SOLVING
21779  * - \ref SCIP_STAGE_SOLVED
21780  */
21782  SCIP* scip, /**< SCIP data structure */
21783  SCIP_VAR* var /**< problem variable */
21784  )
21785 {
21786  SCIP_Real cutoffdown;
21787  SCIP_Real cutoffup;
21788 
21789  SCIP_CALL_ABORT( checkStage(scip, "SCIPgetVarAvgCutoffScore", FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE) );
21790 
21791  cutoffdown = SCIPvarGetAvgCutoffs(var, scip->stat, SCIP_BRANCHDIR_DOWNWARDS);
21792  cutoffup = SCIPvarGetAvgCutoffs(var, scip->stat, SCIP_BRANCHDIR_UPWARDS);
21793 
21794  return SCIPbranchGetScore(scip->set, var, cutoffdown, cutoffup);
21795 }
21796 
21797 /** returns the variable's average cutoff score value, only using cutoffs of the current run
21798  *
21799  * @return the variable's average cutoff score value, only using cutoffs of the current run
21800  *
21801  * @pre This method can be called if @p scip is in one of the following stages:
21802  * - \ref SCIP_STAGE_INITPRESOLVE
21803  * - \ref SCIP_STAGE_PRESOLVING
21804  * - \ref SCIP_STAGE_EXITPRESOLVE
21805  * - \ref SCIP_STAGE_PRESOLVED
21806  * - \ref SCIP_STAGE_INITSOLVE
21807  * - \ref SCIP_STAGE_SOLVING
21808  * - \ref SCIP_STAGE_SOLVED
21809  */
21811  SCIP* scip, /**< SCIP data structure */
21812  SCIP_VAR* var /**< problem variable */
21813  )
21814 {
21815  SCIP_Real cutoffdown;
21816  SCIP_Real cutoffup;
21817 
21818  SCIP_CALL_ABORT( checkStage(scip, "SCIPgetVarAvgCutoffScoreCurrentRun", FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE) );
21819 
21822 
21823  return SCIPbranchGetScore(scip->set, var, cutoffdown, cutoffup);
21824 }
21825 
21826 /** returns the variable's average inference/cutoff score value, weighting the cutoffs of the variable with the given
21827  * factor
21828  *
21829  * @return the variable's average inference/cutoff score value
21830  *
21831  * @pre This method can be called if @p scip is in one of the following stages:
21832  * - \ref SCIP_STAGE_INITPRESOLVE
21833  * - \ref SCIP_STAGE_PRESOLVING
21834  * - \ref SCIP_STAGE_EXITPRESOLVE
21835  * - \ref SCIP_STAGE_PRESOLVED
21836  * - \ref SCIP_STAGE_INITSOLVE
21837  * - \ref SCIP_STAGE_SOLVING
21838  * - \ref SCIP_STAGE_SOLVED
21839  */
21841  SCIP* scip, /**< SCIP data structure */
21842  SCIP_VAR* var, /**< problem variable */
21843  SCIP_Real cutoffweight /**< factor to weigh average number of cutoffs in branching score */
21844  )
21845 {
21846  SCIP_Real avginferdown;
21847  SCIP_Real avginferup;
21848  SCIP_Real avginfer;
21849  SCIP_Real inferdown;
21850  SCIP_Real inferup;
21851  SCIP_Real cutoffdown;
21852  SCIP_Real cutoffup;
21853 
21854  SCIP_CALL_ABORT( checkStage(scip, "SCIPgetVarAvgInferenceCutoffScore", FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE) );
21855 
21858  avginfer = (avginferdown + avginferup)/2.0;
21859  inferdown = SCIPvarGetAvgInferences(var, scip->stat, SCIP_BRANCHDIR_DOWNWARDS);
21860  inferup = SCIPvarGetAvgInferences(var, scip->stat, SCIP_BRANCHDIR_UPWARDS);
21861  cutoffdown = SCIPvarGetAvgCutoffs(var, scip->stat, SCIP_BRANCHDIR_DOWNWARDS);
21862  cutoffup = SCIPvarGetAvgCutoffs(var, scip->stat, SCIP_BRANCHDIR_UPWARDS);
21863 
21864  return SCIPbranchGetScore(scip->set, var,
21865  inferdown + cutoffweight * avginfer * cutoffdown, inferup + cutoffweight * avginfer * cutoffup);
21866 }
21867 
21868 /** returns the variable's average inference/cutoff score value, weighting the cutoffs of the variable with the given
21869  * factor, only using inferences and cutoffs of the current run
21870  *
21871  * @return the variable's average inference/cutoff score value, only using inferences and cutoffs of the current run
21872  *
21873  * @pre This method can be called if @p scip is in one of the following stages:
21874  * - \ref SCIP_STAGE_INITPRESOLVE
21875  * - \ref SCIP_STAGE_PRESOLVING
21876  * - \ref SCIP_STAGE_EXITPRESOLVE
21877  * - \ref SCIP_STAGE_PRESOLVED
21878  * - \ref SCIP_STAGE_INITSOLVE
21879  * - \ref SCIP_STAGE_SOLVING
21880  * - \ref SCIP_STAGE_SOLVED
21881  */
21883  SCIP* scip, /**< SCIP data structure */
21884  SCIP_VAR* var, /**< problem variable */
21885  SCIP_Real cutoffweight /**< factor to weigh average number of cutoffs in branching score */
21886  )
21887 {
21888  SCIP_Real avginferdown;
21889  SCIP_Real avginferup;
21890  SCIP_Real avginfer;
21891  SCIP_Real inferdown;
21892  SCIP_Real inferup;
21893  SCIP_Real cutoffdown;
21894  SCIP_Real cutoffup;
21895 
21896  SCIP_CALL_ABORT( checkStage(scip, "SCIPgetVarAvgInferenceCutoffScoreCurrentRun", FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE) );
21897 
21900  avginfer = (avginferdown + avginferup)/2.0;
21905 
21906  return SCIPbranchGetScore(scip->set, var,
21907  inferdown + cutoffweight * avginfer * cutoffdown, inferup + cutoffweight * avginfer * cutoffup);
21908 }
21909 
21910 /** outputs variable information to file stream via the message system
21911  *
21912  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
21913  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
21914  *
21915  * @pre This method can be called if @p scip is in one of the following stages:
21916  * - \ref SCIP_STAGE_PROBLEM
21917  * - \ref SCIP_STAGE_TRANSFORMING
21918  * - \ref SCIP_STAGE_TRANSFORMED
21919  * - \ref SCIP_STAGE_INITPRESOLVE
21920  * - \ref SCIP_STAGE_PRESOLVING
21921  * - \ref SCIP_STAGE_EXITPRESOLVE
21922  * - \ref SCIP_STAGE_PRESOLVED
21923  * - \ref SCIP_STAGE_INITSOLVE
21924  * - \ref SCIP_STAGE_SOLVING
21925  * - \ref SCIP_STAGE_SOLVED
21926  * - \ref SCIP_STAGE_EXITSOLVE
21927  * - \ref SCIP_STAGE_FREETRANS
21928  *
21929  * @note If the message handler is set to a NULL pointer nothing will be printed
21930  */
21932  SCIP* scip, /**< SCIP data structure */
21933  SCIP_VAR* var, /**< problem variable */
21934  FILE* file /**< output file (or NULL for standard output) */
21935  )
21936 {
21937  SCIP_CALL( checkStage(scip, "SCIPprintVar", FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE) );
21938 
21939  SCIP_CALL( SCIPvarPrint(var, scip->set, scip->messagehdlr, file) );
21940 
21941  return SCIP_OKAY;
21942 }
21943 
21944 /*
21945  * conflict analysis methods
21946  */
21947 
21948 /** return TRUE if conflict analysis is applicable; In case the function return FALSE there is no need to initialize the
21949  * conflict analysis since it will not be applied
21950  *
21951  * @return return TRUE if conflict analysis is applicable; In case the function return FALSE there is no need to initialize the
21952  * conflict analysis since it will not be applied
21953  *
21954  * @pre This method can be called if SCIP is in one of the following stages:
21955  * - \ref SCIP_STAGE_INITPRESOLVE
21956  * - \ref SCIP_STAGE_PRESOLVING
21957  * - \ref SCIP_STAGE_EXITPRESOLVE
21958  * - \ref SCIP_STAGE_SOLVING
21959  *
21960  * @note SCIP stage does not get changed
21961  */
21963  SCIP* scip /**< SCIP data structure */
21964  )
21965 {
21966  SCIP_CALL_ABORT( checkStage(scip, "SCIPisConflictAnalysisApplicable", FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) );
21967 
21968  return (SCIPgetDepth(scip) > 0 && SCIPconflictApplicable(scip->set));
21969 }
21970 
21971 /** initializes the conflict analysis by clearing the conflict candidate queue; this method must be called before you
21972  * enter the conflict variables by calling SCIPaddConflictLb(), SCIPaddConflictUb(), SCIPaddConflictBd(),
21973  * SCIPaddConflictRelaxedLb(), SCIPaddConflictRelaxedUb(), SCIPaddConflictRelaxedBd(), or SCIPaddConflictBinvar();
21974  *
21975  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
21976  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
21977  *
21978  * @pre This method can be called if SCIP is in one of the following stages:
21979  * - \ref SCIP_STAGE_PRESOLVING
21980  * - \ref SCIP_STAGE_SOLVING
21981  *
21982  * @note SCIP stage does not get changed
21983  */
21985  SCIP* scip /**< SCIP data structure */
21986  )
21987 {
21988  SCIP_CALL( checkStage(scip, "SCIPinitConflictAnalysis", FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) );
21989 
21990  SCIP_CALL( SCIPconflictInit(scip->conflict, scip->set, scip->stat, scip->transprob) );
21991 
21992  return SCIP_OKAY;
21993 }
21994 
21995 /** adds lower bound of variable at the time of the given bound change index to the conflict analysis' candidate storage;
21996  * this method should be called in one of the following two cases:
21997  * 1. Before calling the SCIPanalyzeConflict() method, SCIPaddConflictLb() should be called for each lower bound
21998  * that led to the conflict (e.g. the infeasibility of globally or locally valid constraint).
21999  * 2. In the propagation conflict resolving method of a constraint handler, SCIPaddConflictLb() should be called
22000  * for each lower bound, whose current assignment led to the deduction of the given conflict bound.
22001  *
22002  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
22003  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
22004  *
22005  * @pre This method can be called if SCIP is in one of the following stages:
22006  * - \ref SCIP_STAGE_PRESOLVING
22007  * - \ref SCIP_STAGE_SOLVING
22008  *
22009  * @note SCIP stage does not get changed
22010  */
22012  SCIP* scip, /**< SCIP data structure */
22013  SCIP_VAR* var, /**< variable whose lower bound should be added to conflict candidate queue */
22014  SCIP_BDCHGIDX* bdchgidx /**< bound change index representing time on path to current node, when the
22015  * conflicting bound was valid, NULL for current local bound */
22016  )
22017 {
22018  SCIP_CALL( checkStage(scip, "SCIPaddConflictLb", FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) );
22019 
22020  SCIP_CALL( SCIPconflictAddBound(scip->conflict, scip->mem->probmem, scip->set, scip->stat, var, SCIP_BOUNDTYPE_LOWER, bdchgidx) );
22021 
22022  return SCIP_OKAY;
22023 }
22024 
22025 /** adds lower bound of variable at the time of the given bound change index to the conflict analysis' candidate storage
22026  * with the additional information of a relaxed lower bound; this relaxed lower bound is the one which would be enough
22027  * to explain a certain bound change;
22028  * this method should be called in one of the following two cases:
22029  * 1. Before calling the SCIPanalyzeConflict() method, SCIPaddConflictRelaxedLb() should be called for each (relaxed) lower bound
22030  * that led to the conflict (e.g. the infeasibility of globally or locally valid constraint).
22031  * 2. In the propagation conflict resolving method of a constraint handler, SCIPaddConflictRelexedLb() should be called
22032  * for each (relaxed) lower bound, whose current assignment led to the deduction of the given conflict bound.
22033  *
22034  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
22035  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
22036  *
22037  * @pre This method can be called if SCIP is in one of the following stages:
22038  * - \ref SCIP_STAGE_PRESOLVING
22039  * - \ref SCIP_STAGE_SOLVING
22040  *
22041  * @note SCIP stage does not get changed
22042  */
22044  SCIP* scip, /**< SCIP data structure */
22045  SCIP_VAR* var, /**< variable whose lower bound should be added to conflict candidate queue */
22046  SCIP_BDCHGIDX* bdchgidx, /**< bound change index representing time on path to current node, when the
22047  * conflicting bound was valid, NULL for current local bound */
22048  SCIP_Real relaxedlb /**< the relaxed lower bound */
22049  )
22050 {
22051  SCIP_CALL( checkStage(scip, "SCIPaddConflictRelaxedLb", FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) );
22052 
22053  SCIP_CALL( SCIPconflictAddRelaxedBound(scip->conflict, scip->mem->probmem, scip->set, scip->stat, var, SCIP_BOUNDTYPE_LOWER, bdchgidx, relaxedlb) );
22054 
22055  return SCIP_OKAY;
22056 }
22057 
22058 /** adds upper bound of variable at the time of the given bound change index to the conflict analysis' candidate storage;
22059  * this method should be called in one of the following two cases:
22060  * 1. Before calling the SCIPanalyzeConflict() method, SCIPaddConflictUb() should be called for each upper bound that
22061  * led to the conflict (e.g. the infeasibility of globally or locally valid constraint).
22062  * 2. In the propagation conflict resolving method of a constraint handler, SCIPaddConflictUb() should be called for
22063  * each upper bound, whose current assignment led to the deduction of the given conflict bound.
22064  *
22065  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
22066  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
22067  *
22068  * @pre This method can be called if SCIP is in one of the following stages:
22069  * - \ref SCIP_STAGE_PRESOLVING
22070  * - \ref SCIP_STAGE_SOLVING
22071  *
22072  * @note SCIP stage does not get changed
22073  */
22075  SCIP* scip, /**< SCIP data structure */
22076  SCIP_VAR* var, /**< variable whose upper bound should be added to conflict candidate queue */
22077  SCIP_BDCHGIDX* bdchgidx /**< bound change index representing time on path to current node, when the
22078  * conflicting bound was valid, NULL for current local bound */
22079  )
22080 {
22081  SCIP_CALL( checkStage(scip, "SCIPaddConflictUb", FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) );
22082 
22083  SCIP_CALL( SCIPconflictAddBound(scip->conflict, scip->mem->probmem, scip->set, scip->stat, var, SCIP_BOUNDTYPE_UPPER, bdchgidx) );
22084 
22085  return SCIP_OKAY;
22086 }
22087 
22088 /** adds upper bound of variable at the time of the given bound change index to the conflict analysis' candidate storage
22089  * with the additional information of a relaxed upper bound; this relaxed upper bound is the one which would be enough
22090  * to explain a certain bound change;
22091  * this method should be called in one of the following two cases:
22092  * 1. Before calling the SCIPanalyzeConflict() method, SCIPaddConflictRelaxedUb() should be called for each (relaxed) upper
22093  * bound that led to the conflict (e.g. the infeasibility of globally or locally valid constraint).
22094  * 2. In the propagation conflict resolving method of a constraint handler, SCIPaddConflictRelaxedUb() should be
22095  * called for each (relaxed) upper bound, whose current assignment led to the deduction of the given conflict
22096  * bound.
22097  *
22098  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
22099  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
22100  *
22101  * @pre This method can be called if SCIP is in one of the following stages:
22102  * - \ref SCIP_STAGE_PRESOLVING
22103  * - \ref SCIP_STAGE_SOLVING
22104  *
22105  * @note SCIP stage does not get changed
22106  */
22108  SCIP* scip, /**< SCIP data structure */
22109  SCIP_VAR* var, /**< variable whose upper bound should be added to conflict candidate queue */
22110  SCIP_BDCHGIDX* bdchgidx, /**< bound change index representing time on path to current node, when the
22111  * conflicting bound was valid, NULL for current local bound */
22112  SCIP_Real relaxedub /**< the relaxed upper bound */
22113  )
22114 {
22115  SCIP_CALL( checkStage(scip, "SCIPaddConflictRelaxedUb", FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) );
22116 
22117  SCIP_CALL( SCIPconflictAddRelaxedBound(scip->conflict, scip->mem->probmem, scip->set, scip->stat, var, SCIP_BOUNDTYPE_UPPER, bdchgidx, relaxedub) );
22118 
22119  return SCIP_OKAY;
22120 }
22121 
22122 /** adds lower or upper bound of variable at the time of the given bound change index to the conflict analysis' candidate
22123  * storage; this method should be called in one of the following two cases:
22124  * 1. Before calling the SCIPanalyzeConflict() method, SCIPaddConflictBd() should be called for each bound
22125  * that led to the conflict (e.g. the infeasibility of globally or locally valid constraint).
22126  * 2. In the propagation conflict resolving method of a constraint handler, SCIPaddConflictBd() should be called
22127  * for each bound, whose current assignment led to the deduction of the given conflict bound.
22128  *
22129  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
22130  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
22131  *
22132  * @pre This method can be called if SCIP is in one of the following stages:
22133  * - \ref SCIP_STAGE_PRESOLVING
22134  * - \ref SCIP_STAGE_SOLVING
22135  *
22136  * @note SCIP stage does not get changed
22137  */
22139  SCIP* scip, /**< SCIP data structure */
22140  SCIP_VAR* var, /**< variable whose upper bound should be added to conflict candidate queue */
22141  SCIP_BOUNDTYPE boundtype, /**< the type of the conflicting bound (lower or upper bound) */
22142  SCIP_BDCHGIDX* bdchgidx /**< bound change index representing time on path to current node, when the
22143  * conflicting bound was valid, NULL for current local bound */
22144  )
22145 {
22146  SCIP_CALL( checkStage(scip, "SCIPaddConflictBd", FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) );
22147 
22148  SCIP_CALL( SCIPconflictAddBound(scip->conflict, scip->mem->probmem, scip->set, scip->stat, var, boundtype, bdchgidx) );
22149 
22150  return SCIP_OKAY;
22151 }
22152 
22153 /** adds lower or upper bound of variable at the time of the given bound change index to the conflict analysis'
22154  * candidate storage; with the additional information of a relaxed upper bound; this relaxed upper bound is the one
22155  * which would be enough to explain a certain bound change;
22156  * this method should be called in one of the following two cases:
22157  * 1. Before calling the SCIPanalyzeConflict() method, SCIPaddConflictRelaxedBd() should be called for each (relaxed)
22158  * bound that led to the conflict (e.g. the infeasibility of globally or locally valid constraint).
22159  * 2. In the propagation conflict resolving method of a constraint handler, SCIPaddConflictRelaxedBd() should be
22160  * called for each (relaxed) bound, whose current assignment led to the deduction of the given conflict bound.
22161  *
22162  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
22163  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
22164  *
22165  * @pre This method can be called if SCIP is in one of the following stages:
22166  * - \ref SCIP_STAGE_PRESOLVING
22167  * - \ref SCIP_STAGE_SOLVING
22168  *
22169  * @note SCIP stage does not get changed
22170  */
22172  SCIP* scip, /**< SCIP data structure */
22173  SCIP_VAR* var, /**< variable whose upper bound should be added to conflict candidate queue */
22174  SCIP_BOUNDTYPE boundtype, /**< the type of the conflicting bound (lower or upper bound) */
22175  SCIP_BDCHGIDX* bdchgidx, /**< bound change index representing time on path to current node, when the
22176  * conflicting bound was valid, NULL for current local bound */
22177  SCIP_Real relaxedbd /**< the relaxed bound */
22178  )
22179 {
22180  SCIP_CALL( checkStage(scip, "SCIPaddConflictRelaxedBd", FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) );
22181 
22182  SCIP_CALL( SCIPconflictAddRelaxedBound(scip->conflict, scip->mem->probmem, scip->set, scip->stat, var, boundtype, bdchgidx, relaxedbd) );
22183 
22184  return SCIP_OKAY;
22185 }
22186 
22187 /** adds changed bound of fixed binary variable to the conflict analysis' candidate storage;
22188  * this method should be called in one of the following two cases:
22189  * 1. Before calling the SCIPanalyzeConflict() method, SCIPaddConflictBinvar() should be called for each fixed binary
22190  * variable that led to the conflict (e.g. the infeasibility of globally or locally valid constraint).
22191  * 2. In the propagation conflict resolving method of a constraint handler, SCIPaddConflictBinvar() should be called
22192  * for each binary variable, whose current fixing led to the deduction of the given conflict bound.
22193  *
22194  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
22195  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
22196  *
22197  * @pre This method can be called if SCIP is in one of the following stages:
22198  * - \ref SCIP_STAGE_PRESOLVING
22199  * - \ref SCIP_STAGE_SOLVING
22200  *
22201  * @note SCIP stage does not get changed
22202  */
22204  SCIP* scip, /**< SCIP data structure */
22205  SCIP_VAR* var /**< binary variable whose changed bound should be added to conflict queue */
22206  )
22207 {
22208  SCIP_CALL( checkStage(scip, "SCIPaddConflictBinvar", FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) );
22209 
22210  assert(SCIPvarIsBinary(var));
22211  if( SCIPvarGetLbLocal(var) > 0.5 )
22212  {
22213  SCIP_CALL( SCIPconflictAddBound(scip->conflict, scip->mem->probmem, scip->set, scip->stat, var, SCIP_BOUNDTYPE_LOWER, NULL) );
22214  }
22215  else if( SCIPvarGetUbLocal(var) < 0.5 )
22216  {
22217  SCIP_CALL( SCIPconflictAddBound(scip->conflict, scip->mem->probmem, scip->set, scip->stat, var, SCIP_BOUNDTYPE_UPPER, NULL) );
22218  }
22219 
22220  return SCIP_OKAY;
22221 }
22222 
22223 /** checks if the given variable is already part of the current conflict set or queued for resolving with the same or
22224  * even stronger bound
22225  *
22226  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
22227  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
22228  *
22229  * @pre This method can be called if SCIP is in one of the following stages:
22230  * - \ref SCIP_STAGE_PRESOLVING
22231  * - \ref SCIP_STAGE_SOLVING
22232  *
22233  * @note SCIP stage does not get changed
22234  */
22236  SCIP* scip, /**< SCIP data structure */
22237  SCIP_VAR* var, /**< variable whose upper bound should be added to conflict candidate queue */
22238  SCIP_BOUNDTYPE boundtype, /**< the type of the conflicting bound (lower or upper bound) */
22239  SCIP_BDCHGIDX* bdchgidx, /**< bound change index representing time on path to current node, when the
22240  * conflicting bound was valid, NULL for current local bound */
22241  SCIP_Bool* used /**< pointer to store if the variable is already used */
22242  )
22243 {
22244  SCIP_CALL_ABORT( checkStage(scip, "SCIPisConflictVarUsed", FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) );
22245 
22246  return SCIPconflictIsVarUsed(scip->conflict, var, scip->set, boundtype, bdchgidx, used);
22247 }
22248 
22249 /** returns the conflict lower bound if the variable is present in the current conflict set; otherwise the global lower
22250  * bound
22251  *
22252  * @return returns the conflict lower bound if the variable is present in the current conflict set; otherwise the global lower
22253  * bound
22254  *
22255  * @pre This method can be called if SCIP is in one of the following stages:
22256  * - \ref SCIP_STAGE_PRESOLVING
22257  * - \ref SCIP_STAGE_SOLVING
22258  *
22259  * @note SCIP stage does not get changed
22260  */
22262  SCIP* scip, /**< SCIP data structure */
22263  SCIP_VAR* var /**< problem variable */
22264  )
22265 {
22266  SCIP_CALL_ABORT( checkStage(scip, "SCIPgetConflictVarLb", FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) );
22267 
22268  return SCIPconflictGetVarLb(scip->conflict, var);
22269 }
22270 
22271 /** returns the conflict upper bound if the variable is present in the current conflict set; otherwise minus global
22272  * upper bound
22273  *
22274  * @return returns the conflict upper bound if the variable is present in the current conflict set; otherwise minus global
22275  * upper bound
22276  *
22277  * @pre This method can be called if SCIP is in one of the following stages:
22278  * - \ref SCIP_STAGE_PRESOLVING
22279  * - \ref SCIP_STAGE_SOLVING
22280  *
22281  * @note SCIP stage does not get changed
22282  */
22284  SCIP* scip, /**< SCIP data structure */
22285  SCIP_VAR* var /**< problem variable */
22286  )
22287 {
22288  SCIP_CALL_ABORT( checkStage(scip, "SCIPgetConflictVarUb", FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) );
22289 
22290  return SCIPconflictGetVarUb(scip->conflict, var);
22291 }
22292 
22293 /** analyzes conflict bounds that were added after a call to SCIPinitConflictAnalysis() with calls to
22294  * SCIPaddConflictLb(), SCIPaddConflictUb(), SCIPaddConflictBd(), SCIPaddConflictRelaxedLb(),
22295  * SCIPaddConflictRelaxedUb(), SCIPaddConflictRelaxedBd(), or SCIPaddConflictBinvar(); on success, calls the conflict
22296  * handlers to create a conflict constraint out of the resulting conflict set; the given valid depth must be a depth
22297  * level, at which the conflict set defined by calls to SCIPaddConflictLb(), SCIPaddConflictUb(), SCIPaddConflictBd(),
22298  * SCIPaddConflictRelaxedLb(), SCIPaddConflictRelaxedUb(), SCIPaddConflictRelaxedBd(), and SCIPaddConflictBinvar() is
22299  * valid for the whole subtree; if the conflict was found by a violated constraint, use SCIPanalyzeConflictCons()
22300  * instead of SCIPanalyzeConflict() to make sure, that the correct valid depth is used
22301  *
22302  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
22303  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
22304  *
22305  * @pre This method can be called if SCIP is in one of the following stages:
22306  * - \ref SCIP_STAGE_PRESOLVING
22307  * - \ref SCIP_STAGE_SOLVING
22308  *
22309  * @note SCIP stage does not get changed
22310  */
22312  SCIP* scip, /**< SCIP data structure */
22313  int validdepth, /**< minimal depth level at which the initial conflict set is valid */
22314  SCIP_Bool* success /**< pointer to store whether a conflict constraint was created, or NULL */
22315  )
22316 {
22317  SCIP_CALL( checkStage(scip, "SCIPanalyzeConflict", FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) );
22318 
22319  SCIP_CALL( SCIPconflictAnalyze(scip->conflict, scip->mem->probmem, scip->set, scip->stat,
22320  scip->transprob, scip->tree, validdepth, success) );
22321 
22322  return SCIP_OKAY;
22323 }
22324 
22325 /** analyzes conflict bounds that were added with calls to SCIPaddConflictLb(), SCIPaddConflictUb(),
22326  * SCIPaddConflictBd(), SCIPaddConflictRelaxedLb(), SCIPaddConflictRelaxedUb(), SCIPaddConflictRelaxedBd(), or
22327  * SCIPaddConflictBinvar(); on success, calls the conflict handlers to create a conflict constraint out of the
22328  * resulting conflict set; the given constraint must be the constraint that detected the conflict, i.e. the constraint
22329  * that is infeasible in the local bounds of the initial conflict set (defined by calls to SCIPaddConflictLb(),
22330  * SCIPaddConflictUb(), SCIPaddConflictBd(), SCIPaddConflictRelaxedLb(), SCIPaddConflictRelaxedUb(),
22331  * SCIPaddConflictRelaxedBd(), and SCIPaddConflictBinvar())
22332  *
22333  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
22334  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
22335  *
22336  * @pre This method can be called if SCIP is in one of the following stages:
22337  * - \ref SCIP_STAGE_PRESOLVING
22338  * - \ref SCIP_STAGE_SOLVING
22339  *
22340  * @note SCIP stage does not get changed
22341  */
22343  SCIP* scip, /**< SCIP data structure */
22344  SCIP_CONS* cons, /**< constraint that detected the conflict */
22345  SCIP_Bool* success /**< pointer to store whether a conflict constraint was created, or NULL */
22346  )
22347 {
22348  SCIP_CALL( checkStage(scip, "SCIPanalyzeConflictCons", FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) );
22349 
22350  if( SCIPconsIsGlobal(cons) )
22351  {
22352  SCIP_CALL( SCIPconflictAnalyze(scip->conflict, scip->mem->probmem, scip->set, scip->stat,
22353  scip->transprob, scip->tree, 0, success) );
22354  }
22355  else if( SCIPconsIsActive(cons) )
22356  {
22357  SCIP_CALL( SCIPconflictAnalyze(scip->conflict, scip->mem->probmem, scip->set, scip->stat,
22358  scip->transprob, scip->tree, SCIPconsGetValidDepth(cons), success) );
22359  }
22360 
22361  return SCIP_OKAY;
22362 }
22363 
22364 
22365 
22366 
22367 /*
22368  * constraint methods
22369  */
22370 
22371 /** creates and captures a constraint of the given constraint handler
22372  *
22373  * @warning If a constraint is marked to be checked for feasibility but not to be enforced, a LP or pseudo solution may
22374  * be declared feasible even if it violates this particular constraint. This constellation should only be
22375  * used, if no LP or pseudo solution can violate the constraint -- e.g. if a local constraint is redundant due
22376  * to the variable's local bounds.
22377  *
22378  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
22379  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
22380  *
22381  * @pre This method can be called if @p scip is in one of the following stages:
22382  * - \ref SCIP_STAGE_PROBLEM
22383  * - \ref SCIP_STAGE_TRANSFORMING
22384  * - \ref SCIP_STAGE_INITPRESOLVE
22385  * - \ref SCIP_STAGE_PRESOLVING
22386  * - \ref SCIP_STAGE_EXITPRESOLVE
22387  * - \ref SCIP_STAGE_PRESOLVED
22388  * - \ref SCIP_STAGE_INITSOLVE
22389  * - \ref SCIP_STAGE_SOLVING
22390  * - \ref SCIP_STAGE_EXITSOLVE
22391  *
22392  * @note the constraint gets captured, hence at one point you have to release it using the method SCIPreleaseCons()
22393  */
22395  SCIP* scip, /**< SCIP data structure */
22396  SCIP_CONS** cons, /**< pointer to constraint */
22397  const char* name, /**< name of constraint */
22398  SCIP_CONSHDLR* conshdlr, /**< constraint handler for this constraint */
22399  SCIP_CONSDATA* consdata, /**< data for this specific constraint */
22400  SCIP_Bool initial, /**< should the LP relaxation of constraint be in the initial LP?
22401  * Usually set to TRUE. Set to FALSE for 'lazy constraints'. */
22402  SCIP_Bool separate, /**< should the constraint be separated during LP processing?
22403  * Usually set to TRUE. */
22404  SCIP_Bool enforce, /**< should the constraint be enforced during node processing?
22405  * TRUE for model constraints, FALSE for additional, redundant constraints. */
22406  SCIP_Bool check, /**< should the constraint be checked for feasibility?
22407  * TRUE for model constraints, FALSE for additional, redundant constraints. */
22408  SCIP_Bool propagate, /**< should the constraint be propagated during node processing?
22409  * Usually set to TRUE. */
22410  SCIP_Bool local, /**< is constraint only valid locally?
22411  * Usually set to FALSE. Has to be set to TRUE, e.g., for branching constraints. */
22412  SCIP_Bool modifiable, /**< is constraint modifiable (subject to column generation)?
22413  * Usually set to FALSE. In column generation applications, set to TRUE if pricing
22414  * adds coefficients to this constraint. */
22415  SCIP_Bool dynamic, /**< is constraint subject to aging?
22416  * Usually set to FALSE. Set to TRUE for own cuts which
22417  * are separated as constraints. */
22418  SCIP_Bool removable, /**< should the relaxation be removed from the LP due to aging or cleanup?
22419  * Usually set to FALSE. Set to TRUE for 'lazy constraints' and 'user cuts'. */
22420  SCIP_Bool stickingatnode /**< should the constraint always be kept at the node where it was added, even
22421  * if it may be moved to a more global node?
22422  * Usually set to FALSE. Set to TRUE to for constraints that represent node data. */
22423  )
22424 {
22425  assert(cons != NULL);
22426  assert(name != NULL);
22427  assert(conshdlr != NULL);
22428 
22429  SCIP_CALL( checkStage(scip, "SCIPcreateCons", FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, TRUE, FALSE, FALSE) );
22430 
22431  switch( scip->set->stage )
22432  {
22433  case SCIP_STAGE_PROBLEM:
22434  SCIP_CALL( SCIPconsCreate(cons, scip->mem->probmem, scip->set, name, conshdlr, consdata,
22435  initial, separate, enforce, check, propagate, local, modifiable, dynamic, removable, stickingatnode, TRUE, TRUE) );
22436  return SCIP_OKAY;
22437 
22441  case SCIP_STAGE_PRESOLVING:
22443  case SCIP_STAGE_PRESOLVED:
22444  case SCIP_STAGE_INITSOLVE:
22445  case SCIP_STAGE_SOLVING:
22446  case SCIP_STAGE_EXITSOLVE:
22447  SCIP_CALL( SCIPconsCreate(cons, scip->mem->probmem, scip->set, name, conshdlr, consdata,
22448  initial, separate, enforce, check, propagate, local, modifiable, dynamic, removable, stickingatnode, FALSE, TRUE) );
22449  return SCIP_OKAY;
22450 
22451  default:
22452  SCIPerrorMessage("invalid SCIP stage <%d>\n", scip->set->stage);
22453  return SCIP_INVALIDCALL;
22454  } /*lint !e788*/
22455 }
22456 
22457 /** parses constraint information (in cip format) out of a string; if the parsing process was successful a constraint is
22458  * creates and captures;
22459  *
22460  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
22461  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
22462  *
22463  * @pre This method can be called if @p scip is in one of the following stages:
22464  * - \ref SCIP_STAGE_PROBLEM
22465  * - \ref SCIP_STAGE_TRANSFORMING
22466  * - \ref SCIP_STAGE_INITPRESOLVE
22467  * - \ref SCIP_STAGE_PRESOLVING
22468  * - \ref SCIP_STAGE_EXITPRESOLVE
22469  * - \ref SCIP_STAGE_PRESOLVED
22470  * - \ref SCIP_STAGE_SOLVING
22471  * - \ref SCIP_STAGE_EXITSOLVE
22472  *
22473  * @warning If a constraint is marked to be checked for feasibility but not to be enforced, a LP or pseudo solution may
22474  * be declared feasible even if it violates this particular constraint. This constellation should only be
22475  * used, if no LP or pseudo solution can violate the constraint -- e.g. if a local constraint is redundant due
22476  * to the variable's local bounds.
22477  */
22479  SCIP* scip, /**< SCIP data structure */
22480  SCIP_CONS** cons, /**< pointer to store constraint */
22481  const char* str, /**< string to parse for constraint */
22482  SCIP_Bool initial, /**< should the LP relaxation of constraint be in the initial LP?
22483  * Usually set to TRUE. Set to FALSE for 'lazy constraints'. */
22484  SCIP_Bool separate, /**< should the constraint be separated during LP processing?
22485  * Usually set to TRUE. */
22486  SCIP_Bool enforce, /**< should the constraint be enforced during node processing?
22487  * TRUE for model constraints, FALSE for additional, redundant constraints. */
22488  SCIP_Bool check, /**< should the constraint be checked for feasibility?
22489  * TRUE for model constraints, FALSE for additional, redundant constraints. */
22490  SCIP_Bool propagate, /**< should the constraint be propagated during node processing?
22491  * Usually set to TRUE. */
22492  SCIP_Bool local, /**< is constraint only valid locally?
22493  * Usually set to FALSE. Has to be set to TRUE, e.g., for branching constraints. */
22494  SCIP_Bool modifiable, /**< is constraint modifiable (subject to column generation)?
22495  * Usually set to FALSE. In column generation applications, set to TRUE if pricing
22496  * adds coefficients to this constraint. */
22497  SCIP_Bool dynamic, /**< is constraint subject to aging?
22498  * Usually set to FALSE. Set to TRUE for own cuts which
22499  * are separated as constraints. */
22500  SCIP_Bool removable, /**< should the relaxation be removed from the LP due to aging or cleanup?
22501  * Usually set to FALSE. Set to TRUE for 'lazy constraints' and 'user cuts'. */
22502  SCIP_Bool stickingatnode, /**< should the constraint always be kept at the node where it was added, even
22503  * if it may be moved to a more global node?
22504  * Usually set to FALSE. Set to TRUE to for constraints that represent node data. */
22505  SCIP_Bool* success /**< pointer to store if the paring process was successful */
22506  )
22507 {
22508  assert(cons != NULL);
22509 
22510  SCIP_CALL( checkStage(scip, "SCIPparseCons", FALSE, TRUE, TRUE, FALSE, TRUE, TRUE, TRUE, TRUE, FALSE, TRUE, FALSE, TRUE, FALSE, FALSE) );
22511 
22512  SCIP_CALL( SCIPconsParse(cons, scip->set, scip->messagehdlr, str,
22513  initial, separate, enforce, check, propagate, local, modifiable, dynamic, removable, stickingatnode, success) );
22514 
22515 
22516  return SCIP_OKAY;
22517 }
22518 
22519 /** increases usage counter of constraint
22520  *
22521  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
22522  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
22523  *
22524  * @pre This method can be called if @p scip is in one of the following stages:
22525  * - \ref SCIP_STAGE_PROBLEM
22526  * - \ref SCIP_STAGE_TRANSFORMING
22527  * - \ref SCIP_STAGE_TRANSFORMED
22528  * - \ref SCIP_STAGE_INITPRESOLVE
22529  * - \ref SCIP_STAGE_PRESOLVING
22530  * - \ref SCIP_STAGE_EXITPRESOLVE
22531  * - \ref SCIP_STAGE_PRESOLVED
22532  * - \ref SCIP_STAGE_INITSOLVE
22533  * - \ref SCIP_STAGE_SOLVING
22534  * - \ref SCIP_STAGE_SOLVED
22535  */
22537  SCIP* scip, /**< SCIP data structure */
22538  SCIP_CONS* cons /**< constraint to capture */
22539  )
22540 {
22541  SCIP_CALL( checkStage(scip, "SCIPcaptureCons", FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE) );
22542 
22543  SCIPconsCapture(cons);
22544 
22545  return SCIP_OKAY;
22546 }
22547 
22548 /** decreases usage counter of constraint, if the usage pointer reaches zero the constraint gets freed
22549  *
22550  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
22551  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
22552  *
22553  * @pre This method can be called if @p scip is in one of the following stages:
22554  * - \ref SCIP_STAGE_PROBLEM
22555  * - \ref SCIP_STAGE_TRANSFORMING
22556  * - \ref SCIP_STAGE_TRANSFORMED
22557  * - \ref SCIP_STAGE_INITPRESOLVE
22558  * - \ref SCIP_STAGE_PRESOLVING
22559  * - \ref SCIP_STAGE_EXITPRESOLVE
22560  * - \ref SCIP_STAGE_PRESOLVED
22561  * - \ref SCIP_STAGE_INITSOLVE
22562  * - \ref SCIP_STAGE_SOLVING
22563  * - \ref SCIP_STAGE_SOLVED
22564  * - \ref SCIP_STAGE_EXITSOLVE
22565  * - \ref SCIP_STAGE_FREETRANS
22566  *
22567  * @note the pointer of the constraint will be NULLed
22568  */
22570  SCIP* scip, /**< SCIP data structure */
22571  SCIP_CONS** cons /**< pointer to constraint */
22572  )
22573 {
22574  assert(cons != NULL);
22575  assert(*cons != NULL);
22576 
22577  SCIP_CALL( checkStage(scip, "SCIPreleaseCons", FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE) );
22578 
22579  switch( scip->set->stage )
22580  {
22581  case SCIP_STAGE_PROBLEM:
22582  SCIP_CALL( SCIPconsRelease(cons, scip->mem->probmem, scip->set) );
22583  return SCIP_OKAY;
22584 
22588  case SCIP_STAGE_PRESOLVING:
22590  case SCIP_STAGE_PRESOLVED:
22591  case SCIP_STAGE_INITSOLVE:
22592  case SCIP_STAGE_SOLVING:
22593  case SCIP_STAGE_SOLVED:
22594  case SCIP_STAGE_EXITSOLVE:
22595  case SCIP_STAGE_FREETRANS:
22596  if( SCIPconsIsOriginal(*cons) && (*cons)->nuses == 1 )
22597  {
22598  SCIPerrorMessage("cannot release last use of original constraint while the transformed problem exists\n");
22599  return SCIP_INVALIDCALL;
22600  }
22601  SCIP_CALL( SCIPconsRelease(cons, scip->mem->probmem, scip->set) );
22602  return SCIP_OKAY;
22603 
22604  default:
22605  SCIPerrorMessage("invalid SCIP stage <%d>\n", scip->set->stage);
22606  return SCIP_INVALIDCALL;
22607  } /*lint !e788*/
22608 }
22609 
22610 /** change constraint name
22611  *
22612  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
22613  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
22614  *
22615  * @pre This method can be called if @p scip is in one of the following stages:
22616  * - \ref SCIP_STAGE_PROBLEM
22617  *
22618  * @note to get the current name of a constraint, use SCIPconsGetName() from pub_cons.h
22619  */
22621  SCIP* scip, /**< SCIP data structure */
22622  SCIP_CONS* cons, /**< constraint */
22623  const char* name /**< new name of constraint */
22624  )
22625 {
22626  SCIP_CALL( checkStage(scip, "SCIPchgConsName", FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE , FALSE, FALSE, FALSE) );
22627 
22628  if( SCIPgetStage(scip) != SCIP_STAGE_PROBLEM )
22629  {
22630  SCIPerrorMessage("constraint names can only be changed in problem creation stage\n");
22631  SCIPABORT();
22632  return SCIP_INVALIDCALL; /*lint !e527*/
22633  }
22634 
22635  /* remove constraint's name from the namespace if the constraint was already added */
22636  if( SCIPconsIsAdded(cons) )
22637  {
22638  SCIP_CALL( SCIPprobRemoveConsName(scip->origprob, cons) );
22639  }
22640 
22641  /* change constraint name */
22642  SCIP_CALL( SCIPconsChgName(cons, SCIPblkmem(scip), name) );
22643 
22644  /* add constraint's name to the namespace if the constraint was already added */
22645  if( SCIPconsIsAdded(cons) )
22646  {
22647  SCIP_CALL( SCIPprobAddConsName(scip->origprob, cons) );
22648  }
22649 
22650  return SCIP_OKAY;
22651 }
22652 
22653 /** sets the initial flag of the given constraint
22654  *
22655  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
22656  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
22657  *
22658  * @pre This method can be called if @p scip is in one of the following stages:
22659  * - \ref SCIP_STAGE_PROBLEM
22660  * - \ref SCIP_STAGE_TRANSFORMING
22661  * - \ref SCIP_STAGE_PRESOLVING
22662  * - \ref SCIP_STAGE_PRESOLVED
22663  * - \ref SCIP_STAGE_SOLVING
22664  */
22666  SCIP* scip, /**< SCIP data structure */
22667  SCIP_CONS* cons, /**< constraint */
22668  SCIP_Bool initial /**< new value */
22669  )
22670 {
22671  SCIP_CALL( checkStage(scip, "SCIPsetConsInitial", FALSE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, TRUE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) );
22672 
22673  SCIP_CALL( SCIPconsSetInitial(cons, scip->set, scip->stat, initial) );
22674 
22675  return SCIP_OKAY;
22676 }
22677 
22678 /** sets the separate flag of the given constraint
22679  *
22680  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
22681  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
22682  *
22683  * @pre This method can be called if @p scip is in one of the following stages:
22684  * - \ref SCIP_STAGE_PROBLEM
22685  * - \ref SCIP_STAGE_TRANSFORMING
22686  * - \ref SCIP_STAGE_PRESOLVING
22687  * - \ref SCIP_STAGE_PRESOLVED
22688  * - \ref SCIP_STAGE_SOLVING
22689  */
22691  SCIP* scip, /**< SCIP data structure */
22692  SCIP_CONS* cons, /**< constraint */
22693  SCIP_Bool separate /**< new value */
22694  )
22695 {
22696  SCIP_CALL( checkStage(scip, "SCIPsetConsSeparated", FALSE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, TRUE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) );
22697 
22698  SCIP_CALL( SCIPconsSetSeparated(cons, scip->set, separate) );
22699 
22700  return SCIP_OKAY;
22701 }
22702 
22703 /** sets the enforce flag of the given constraint
22704  *
22705  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
22706  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
22707  *
22708  * @pre This method can be called if @p scip is in one of the following stages:
22709  * - \ref SCIP_STAGE_PROBLEM
22710  * - \ref SCIP_STAGE_TRANSFORMING
22711  * - \ref SCIP_STAGE_PRESOLVING
22712  * - \ref SCIP_STAGE_PRESOLVED
22713  * - \ref SCIP_STAGE_SOLVING
22714  */
22716  SCIP* scip, /**< SCIP data structure */
22717  SCIP_CONS* cons, /**< constraint */
22718  SCIP_Bool enforce /**< new value */
22719  )
22720 {
22721  SCIP_CALL( checkStage(scip, "SCIPsetConsEnforced", FALSE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, TRUE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) );
22722 
22723  SCIP_CALL( SCIPconsSetEnforced(cons, scip->set, enforce) );
22724 
22725  return SCIP_OKAY;
22726 }
22727 
22728 /** sets the check flag of the given constraint
22729  *
22730  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
22731  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
22732  *
22733  * @pre This method can be called if @p scip is in one of the following stages:
22734  * - \ref SCIP_STAGE_PROBLEM
22735  * - \ref SCIP_STAGE_TRANSFORMING
22736  * - \ref SCIP_STAGE_PRESOLVING
22737  * - \ref SCIP_STAGE_PRESOLVED
22738  * - \ref SCIP_STAGE_SOLVING
22739  */
22741  SCIP* scip, /**< SCIP data structure */
22742  SCIP_CONS* cons, /**< constraint */
22743  SCIP_Bool check /**< new value */
22744  )
22745 {
22746  SCIP_CALL( checkStage(scip, "SCIPsetConsChecked", FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) );
22747 
22748  SCIP_CALL( SCIPconsSetChecked(cons, scip->set, check) );
22749 
22750  return SCIP_OKAY;
22751 }
22752 
22753 /** sets the propagate flag of the given constraint
22754  *
22755  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
22756  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
22757  *
22758  * @pre This method can be called if @p scip is in one of the following stages:
22759  * - \ref SCIP_STAGE_PROBLEM
22760  * - \ref SCIP_STAGE_TRANSFORMING
22761  * - \ref SCIP_STAGE_PRESOLVING
22762  * - \ref SCIP_STAGE_PRESOLVED
22763  * - \ref SCIP_STAGE_SOLVING
22764  */
22766  SCIP* scip, /**< SCIP data structure */
22767  SCIP_CONS* cons, /**< constraint */
22768  SCIP_Bool propagate /**< new value */
22769  )
22770 {
22771  SCIP_CALL( checkStage(scip, "SCIPsetConsPropagated", FALSE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, TRUE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) );
22772 
22773  SCIP_CALL( SCIPconsSetPropagated(cons, scip->set, propagate) );
22774 
22775  return SCIP_OKAY;
22776 }
22777 
22778 /** sets the local flag of the given constraint
22779  *
22780  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
22781  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
22782  *
22783  * @pre This method can be called if @p scip is in one of the following stages:
22784  * - \ref SCIP_STAGE_PROBLEM
22785  * - \ref SCIP_STAGE_TRANSFORMING
22786  * - \ref SCIP_STAGE_INITPRESOLVE
22787  * - \ref SCIP_STAGE_PRESOLVING
22788  * - \ref SCIP_STAGE_PRESOLVED
22789  * - \ref SCIP_STAGE_INITSOLVE
22790  * - \ref SCIP_STAGE_SOLVING
22791  */
22793  SCIP* scip, /**< SCIP data structure */
22794  SCIP_CONS* cons, /**< constraint */
22795  SCIP_Bool local /**< new value */
22796  )
22797 {
22798  SCIP_CALL( checkStage(scip, "SCIPsetConsLocal", FALSE, TRUE, TRUE, FALSE, TRUE, TRUE, FALSE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE) );
22799 
22800  SCIPconsSetLocal(cons, local);
22801 
22802  return SCIP_OKAY;
22803 }
22804 
22805 /** sets the modifiable flag of the given constraint
22806  *
22807  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
22808  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
22809  *
22810  * @pre This method can be called if @p scip is in one of the following stages:
22811  * - \ref SCIP_STAGE_PROBLEM
22812  * - \ref SCIP_STAGE_TRANSFORMING
22813  * - \ref SCIP_STAGE_PRESOLVING
22814  * - \ref SCIP_STAGE_PRESOLVED
22815  * - \ref SCIP_STAGE_SOLVING
22816  * - \ref SCIP_STAGE_EXITSOLVE
22817  */
22819  SCIP* scip, /**< SCIP data structure */
22820  SCIP_CONS* cons, /**< constraint */
22821  SCIP_Bool modifiable /**< new value */
22822  )
22823 {
22824  SCIP_CALL( checkStage(scip, "SCIPsetConsModifiable", FALSE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, TRUE, FALSE, TRUE, FALSE, TRUE, FALSE, FALSE) );
22825 
22826  SCIPconsSetModifiable(cons, modifiable);
22827 
22828  return SCIP_OKAY;
22829 }
22830 
22831 /** sets the dynamic flag of the given constraint
22832  *
22833  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
22834  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
22835  *
22836  * @pre This method can be called if @p scip is in one of the following stages:
22837  * - \ref SCIP_STAGE_PROBLEM
22838  * - \ref SCIP_STAGE_TRANSFORMING
22839  * - \ref SCIP_STAGE_PRESOLVING
22840  * - \ref SCIP_STAGE_PRESOLVED
22841  * - \ref SCIP_STAGE_SOLVING
22842  */
22844  SCIP* scip, /**< SCIP data structure */
22845  SCIP_CONS* cons, /**< constraint */
22846  SCIP_Bool dynamic /**< new value */
22847  )
22848 {
22849  SCIP_CALL( checkStage(scip, "SCIPsetConsDynamic", FALSE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, TRUE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) );
22850 
22851  SCIPconsSetDynamic(cons, dynamic);
22852 
22853  return SCIP_OKAY;
22854 }
22855 
22856 /** sets the removable flag of the given constraint
22857  *
22858  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
22859  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
22860  *
22861  * @pre This method can be called if @p scip is in one of the following stages:
22862  * - \ref SCIP_STAGE_PROBLEM
22863  * - \ref SCIP_STAGE_TRANSFORMING
22864  * - \ref SCIP_STAGE_PRESOLVING
22865  * - \ref SCIP_STAGE_PRESOLVED
22866  * - \ref SCIP_STAGE_SOLVING
22867  */
22869  SCIP* scip, /**< SCIP data structure */
22870  SCIP_CONS* cons, /**< constraint */
22871  SCIP_Bool removable /**< new value */
22872  )
22873 {
22874  SCIP_CALL( checkStage(scip, "SCIPsetConsRemovable", FALSE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, TRUE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) );
22875 
22876  SCIPconsSetRemovable(cons, removable);
22877 
22878  return SCIP_OKAY;
22879 }
22880 
22881 /** sets the stickingatnode flag of the given constraint
22882  *
22883  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
22884  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
22885  *
22886  * @pre This method can be called if @p scip is in one of the following stages:
22887  * - \ref SCIP_STAGE_PROBLEM
22888  * - \ref SCIP_STAGE_TRANSFORMING
22889  * - \ref SCIP_STAGE_PRESOLVING
22890  * - \ref SCIP_STAGE_PRESOLVED
22891  * - \ref SCIP_STAGE_SOLVING
22892  */
22894  SCIP* scip, /**< SCIP data structure */
22895  SCIP_CONS* cons, /**< constraint */
22896  SCIP_Bool stickingatnode /**< new value */
22897  )
22898 {
22899  SCIP_CALL( checkStage(scip, "SCIPsetConsStickingAtNode", FALSE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, TRUE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) );
22900 
22901  SCIPconsSetStickingAtNode(cons, stickingatnode);
22902 
22903  return SCIP_OKAY;
22904 }
22905 
22906 /** updates the flags of the first constraint according to the ones of the second constraint
22907  *
22908  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
22909  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
22910  *
22911  * @pre This method can be called if @p scip is in one of the following stages:
22912  * - \ref SCIP_STAGE_PROBLEM
22913  * - \ref SCIP_STAGE_TRANSFORMING
22914  * - \ref SCIP_STAGE_PRESOLVING
22915  * - \ref SCIP_STAGE_PRESOLVED
22916  * - \ref SCIP_STAGE_SOLVING
22917  */
22919  SCIP* scip, /**< SCIP data structure */
22920  SCIP_CONS* cons0, /**< constraint that should stay */
22921  SCIP_CONS* cons1 /**< constraint that should be deleted */
22922  )
22923 {
22924  SCIP_CALL( checkStage(scip, "SCIPupdateConsFlags", FALSE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, TRUE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) );
22925 
22926  if( SCIPconsIsInitial(cons1) )
22927  {
22928  SCIP_CALL( SCIPsetConsInitial(scip, cons0, TRUE) );
22929  }
22930  if( SCIPconsIsSeparated(cons1) )
22931  {
22932  SCIP_CALL( SCIPsetConsSeparated(scip, cons0, TRUE) );
22933  }
22934  if( SCIPconsIsEnforced(cons1) )
22935  {
22936  SCIP_CALL( SCIPsetConsEnforced(scip, cons0, TRUE) );
22937  }
22938  if( SCIPconsIsChecked(cons1) )
22939  {
22940  SCIP_CALL( SCIPsetConsChecked(scip, cons0, TRUE) );
22941  }
22942  if( SCIPconsIsPropagated(cons1) )
22943  {
22944  SCIP_CALL( SCIPsetConsPropagated(scip, cons0, TRUE) );
22945  }
22946  if( !SCIPconsIsDynamic(cons1) )
22947  {
22948  SCIP_CALL( SCIPsetConsDynamic(scip, cons0, FALSE) );
22949  }
22950  if( !SCIPconsIsRemovable(cons1) )
22951  {
22952  SCIP_CALL( SCIPsetConsRemovable(scip, cons0, FALSE) );
22953  }
22954  if( SCIPconsIsStickingAtNode(cons1) )
22955  {
22956  SCIP_CALL( SCIPsetConsStickingAtNode(scip, cons0, TRUE) );
22957  }
22958 
22959  return SCIP_OKAY;
22960 }
22961 
22962 /** gets and captures transformed constraint of a given constraint; if the constraint is not yet transformed,
22963  * a new transformed constraint for this constraint is created
22964  *
22965  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
22966  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
22967  *
22968  * @pre This method can be called if @p scip is in one of the following stages:
22969  * - \ref SCIP_STAGE_TRANSFORMING
22970  * - \ref SCIP_STAGE_TRANSFORMED
22971  * - \ref SCIP_STAGE_INITPRESOLVE
22972  * - \ref SCIP_STAGE_PRESOLVING
22973  * - \ref SCIP_STAGE_EXITPRESOLVE
22974  * - \ref SCIP_STAGE_PRESOLVED
22975  * - \ref SCIP_STAGE_INITSOLVE
22976  * - \ref SCIP_STAGE_SOLVING
22977  */
22979  SCIP* scip, /**< SCIP data structure */
22980  SCIP_CONS* cons, /**< constraint to get/create transformed constraint for */
22981  SCIP_CONS** transcons /**< pointer to store the transformed constraint */
22982  )
22983 {
22984  assert(transcons != NULL);
22985 
22986  SCIP_CALL( checkStage(scip, "SCIPtransformCons", FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE) );
22987 
22988  if( SCIPconsIsTransformed(cons) )
22989  {
22990  *transcons = cons;
22991  SCIPconsCapture(*transcons);
22992  }
22993  else
22994  {
22995  SCIP_CALL( SCIPconsTransform(cons, scip->mem->probmem, scip->set, transcons) );
22996  }
22997 
22998  return SCIP_OKAY;
22999 }
23000 
23001 /** gets and captures transformed constraints for an array of constraints;
23002  * if a constraint in the array is not yet transformed, a new transformed constraint for this constraint is created;
23003  * it is possible to call this method with conss == transconss
23004  *
23005  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
23006  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
23007  *
23008  * @pre This method can be called if @p scip is in one of the following stages:
23009  * - \ref SCIP_STAGE_TRANSFORMING
23010  * - \ref SCIP_STAGE_TRANSFORMED
23011  * - \ref SCIP_STAGE_INITPRESOLVE
23012  * - \ref SCIP_STAGE_PRESOLVING
23013  * - \ref SCIP_STAGE_EXITPRESOLVE
23014  * - \ref SCIP_STAGE_PRESOLVED
23015  * - \ref SCIP_STAGE_INITSOLVE
23016  * - \ref SCIP_STAGE_SOLVING
23017  */
23019  SCIP* scip, /**< SCIP data structure */
23020  int nconss, /**< number of constraints to get/create transformed constraints for */
23021  SCIP_CONS** conss, /**< array with constraints to get/create transformed constraints for */
23022  SCIP_CONS** transconss /**< array to store the transformed constraints */
23023  )
23024 {
23025  int c;
23026 
23027  assert(nconss == 0 || conss != NULL);
23028  assert(nconss == 0 || transconss != NULL);
23029 
23030  SCIP_CALL( checkStage(scip, "SCIPtransformConss", FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE) );
23031 
23032  for( c = 0; c < nconss; ++c )
23033  {
23034  if( SCIPconsIsTransformed(conss[c]) )
23035  {
23036  transconss[c] = conss[c];
23037  SCIPconsCapture(transconss[c]);
23038  }
23039  else
23040  {
23041  SCIP_CALL( SCIPconsTransform(conss[c], scip->mem->probmem, scip->set, &transconss[c]) );
23042  }
23043  }
23044 
23045  return SCIP_OKAY;
23046 }
23047 
23048 /** gets corresponding transformed constraint of a given constraint;
23049  * returns NULL as transcons, if transformed constraint is not yet existing
23050  *
23051  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
23052  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
23053  *
23054  * @pre This method can be called if @p scip is in one of the following stages:
23055  * - \ref SCIP_STAGE_TRANSFORMING
23056  * - \ref SCIP_STAGE_TRANSFORMED
23057  * - \ref SCIP_STAGE_INITPRESOLVE
23058  * - \ref SCIP_STAGE_PRESOLVING
23059  * - \ref SCIP_STAGE_EXITPRESOLVE
23060  * - \ref SCIP_STAGE_PRESOLVED
23061  * - \ref SCIP_STAGE_INITSOLVE
23062  * - \ref SCIP_STAGE_SOLVING
23063  * - \ref SCIP_STAGE_SOLVED
23064  * - \ref SCIP_STAGE_EXITSOLVE
23065  * - \ref SCIP_STAGE_FREETRANS
23066  */
23068  SCIP* scip, /**< SCIP data structure */
23069  SCIP_CONS* cons, /**< constraint to get the transformed constraint for */
23070  SCIP_CONS** transcons /**< pointer to store the transformed constraint */
23071  )
23072 {
23073  assert(transcons != NULL);
23074 
23075  SCIP_CALL( checkStage(scip, "SCIPgetTransformedCons", FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE) );
23076 
23077  if( SCIPconsIsTransformed(cons) )
23078  *transcons = cons;
23079  else
23080  *transcons = SCIPconsGetTransformed(cons);
23081 
23082  return SCIP_OKAY;
23083 }
23084 
23085 /** gets corresponding transformed constraints for an array of constraints;
23086  * stores NULL in a transconss slot, if the transformed constraint is not yet existing;
23087  * it is possible to call this method with conss == transconss, but remember that constraints that are not
23088  * yet transformed will be replaced with NULL
23089  *
23090  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
23091  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
23092  *
23093  * @pre This method can be called if @p scip is in one of the following stages:
23094  * - \ref SCIP_STAGE_TRANSFORMING
23095  * - \ref SCIP_STAGE_TRANSFORMED
23096  * - \ref SCIP_STAGE_INITPRESOLVE
23097  * - \ref SCIP_STAGE_PRESOLVING
23098  * - \ref SCIP_STAGE_EXITPRESOLVE
23099  * - \ref SCIP_STAGE_PRESOLVED
23100  * - \ref SCIP_STAGE_INITSOLVE
23101  * - \ref SCIP_STAGE_SOLVING
23102  * - \ref SCIP_STAGE_SOLVED
23103  * - \ref SCIP_STAGE_EXITSOLVE
23104  * - \ref SCIP_STAGE_FREETRANS
23105  */
23107  SCIP* scip, /**< SCIP data structure */
23108  int nconss, /**< number of constraints to get the transformed constraints for */
23109  SCIP_CONS** conss, /**< constraints to get the transformed constraints for */
23110  SCIP_CONS** transconss /**< array to store the transformed constraints */
23111  )
23112 {
23113  int c;
23114 
23115  assert(nconss == 0 || conss != NULL);
23116  assert(nconss == 0 || transconss != NULL);
23117 
23118  SCIP_CALL( checkStage(scip, "SCIPgetTransformedConss", FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE) );
23119 
23120  for( c = 0; c < nconss; ++c )
23121  {
23122  if( SCIPconsIsTransformed(conss[c]) )
23123  transconss[c] = conss[c];
23124  else
23125  transconss[c] = SCIPconsGetTransformed(conss[c]);
23126  }
23127 
23128  return SCIP_OKAY;
23129 }
23130 
23131 /** adds given value to age of constraint, but age can never become negative;
23132  * should be called
23133  * - in constraint separation, if no cut was found for this constraint,
23134  * - in constraint enforcing, if constraint was feasible, and
23135  * - in constraint propagation, if no domain reduction was deduced;
23136  *
23137  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
23138  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
23139  *
23140  * @pre This method can be called if @p scip is in one of the following stages:
23141  * - \ref SCIP_STAGE_TRANSFORMED
23142  * - \ref SCIP_STAGE_PRESOLVING
23143  * - \ref SCIP_STAGE_PRESOLVED
23144  * - \ref SCIP_STAGE_SOLVING
23145  * - \ref SCIP_STAGE_SOLVED
23146  */
23148  SCIP* scip, /**< SCIP data structure */
23149  SCIP_CONS* cons, /**< constraint */
23150  SCIP_Real deltaage /**< value to add to the constraint's age */
23151  )
23152 {
23153  SCIP_CALL( checkStage(scip, "SCIPaddConsAge", FALSE, FALSE, FALSE, TRUE, FALSE, TRUE, FALSE, TRUE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE) );
23154 
23155  SCIP_CALL( SCIPconsAddAge(cons, scip->mem->probmem, scip->set, scip->stat, scip->transprob, deltaage) );
23156 
23157  return SCIP_OKAY;
23158 }
23159 
23160 /** increases age of constraint by 1.0;
23161  * should be called
23162  * - in constraint separation, if no cut was found for this constraint,
23163  * - in constraint enforcing, if constraint was feasible, and
23164  * - in constraint propagation, if no domain reduction was deduced;
23165  *
23166  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
23167  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
23168  *
23169  * @pre This method can be called if @p scip is in one of the following stages:
23170  * - \ref SCIP_STAGE_TRANSFORMED
23171  * - \ref SCIP_STAGE_PRESOLVING
23172  * - \ref SCIP_STAGE_PRESOLVED
23173  * - \ref SCIP_STAGE_SOLVING
23174  * - \ref SCIP_STAGE_SOLVED
23175  */
23177  SCIP* scip, /**< SCIP data structure */
23178  SCIP_CONS* cons /**< constraint */
23179  )
23180 {
23181  SCIP_CALL( checkStage(scip, "SCIPincConsAge", FALSE, FALSE, FALSE, TRUE, FALSE, TRUE, FALSE, TRUE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE) );
23182 
23183  SCIP_CALL( SCIPconsIncAge(cons, scip->mem->probmem, scip->set, scip->stat, scip->transprob) );
23184 
23185  return SCIP_OKAY;
23186 }
23187 
23188 /** resets age of constraint to zero;
23189  * should be called
23190  * - in constraint separation, if a cut was found for this constraint,
23191  * - in constraint enforcing, if the constraint was violated, and
23192  * - in constraint propagation, if a domain reduction was deduced;
23193  *
23194  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
23195  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
23196  *
23197  * @pre This method can be called if @p scip is in one of the following stages:
23198  * - \ref SCIP_STAGE_TRANSFORMED
23199  * - \ref SCIP_STAGE_PRESOLVING
23200  * - \ref SCIP_STAGE_PRESOLVED
23201  * - \ref SCIP_STAGE_SOLVING
23202  * - \ref SCIP_STAGE_SOLVED
23203  */
23205  SCIP* scip, /**< SCIP data structure */
23206  SCIP_CONS* cons /**< constraint */
23207  )
23208 {
23209  SCIP_CALL( checkStage(scip, "SCIPresetConsAge", FALSE, FALSE, FALSE, TRUE, FALSE, TRUE, FALSE, TRUE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE) );
23210 
23211  SCIP_CALL( SCIPconsResetAge(cons, scip->set) );
23212 
23213  return SCIP_OKAY;
23214 }
23215 
23216 /** enables constraint's separation, propagation, and enforcing capabilities
23217  *
23218  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
23219  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
23220  *
23221  * @pre This method can be called if @p scip is in one of the following stages:
23222  * - \ref SCIP_STAGE_TRANSFORMED
23223  * - \ref SCIP_STAGE_PRESOLVING
23224  * - \ref SCIP_STAGE_PRESOLVED
23225  * - \ref SCIP_STAGE_INITSOLVE
23226  * - \ref SCIP_STAGE_SOLVING
23227  * - \ref SCIP_STAGE_SOLVED
23228  */
23230  SCIP* scip, /**< SCIP data structure */
23231  SCIP_CONS* cons /**< constraint */
23232  )
23233 {
23234  SCIP_CALL( checkStage(scip, "SCIPenableCons", FALSE, FALSE, FALSE, TRUE, FALSE, TRUE, FALSE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE) );
23235 
23236  SCIP_CALL( SCIPconsEnable(cons, scip->set, scip->stat) );
23237 
23238  return SCIP_OKAY;
23239 }
23240 
23241 /** disables constraint's separation, propagation, and enforcing capabilities, s.t. the constraint is not propagated,
23242  * separated, and enforced anymore until it is enabled again with a call to SCIPenableCons();
23243  * in contrast to SCIPdelConsLocal() and SCIPdelConsNode(), the disabling is not associated to a node in the tree and
23244  * does not consume memory; therefore, the constraint is neither automatically enabled on leaving the node nor
23245  * automatically disabled again on entering the node again;
23246  * note that the constraints enforcing capabilities are necessary for the solution's feasibility, if the constraint
23247  * is a model constraint; that means, you must be sure that the constraint cannot be violated in the current subtree,
23248  * and you have to enable it again manually by calling SCIPenableCons(), if this subtree is left (e.g. by using
23249  * an appropriate event handler that watches the corresponding variables' domain changes)
23250  *
23251  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
23252  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
23253  *
23254  * @pre This method can be called if @p scip is in one of the following stages:
23255  * - \ref SCIP_STAGE_TRANSFORMED
23256  * - \ref SCIP_STAGE_INITPRESOLVE
23257  * - \ref SCIP_STAGE_PRESOLVING
23258  * - \ref SCIP_STAGE_PRESOLVED
23259  * - \ref SCIP_STAGE_INITSOLVE
23260  * - \ref SCIP_STAGE_SOLVING
23261  * - \ref SCIP_STAGE_SOLVED
23262  */
23264  SCIP* scip, /**< SCIP data structure */
23265  SCIP_CONS* cons /**< constraint */
23266  )
23267 {
23268  SCIP_CALL( checkStage(scip, "SCIPdisableCons", FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, FALSE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE) );
23269 
23270  SCIP_CALL( SCIPconsDisable(cons, scip->set, scip->stat) );
23271 
23272  return SCIP_OKAY;
23273 }
23274 
23275 /** enables constraint's separation capabilities
23276  *
23277  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
23278  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
23279  *
23280  * @pre This method can be called if @p scip is in one of the following stages:
23281  * - \ref SCIP_STAGE_TRANSFORMED
23282  * - \ref SCIP_STAGE_PRESOLVING
23283  * - \ref SCIP_STAGE_PRESOLVED
23284  * - \ref SCIP_STAGE_INITSOLVE
23285  * - \ref SCIP_STAGE_SOLVING
23286  * - \ref SCIP_STAGE_SOLVED
23287  */
23289  SCIP* scip, /**< SCIP data structure */
23290  SCIP_CONS* cons /**< constraint */
23291  )
23292 {
23293  SCIP_CALL( checkStage(scip, "SCIPenableConsSeparation", FALSE, FALSE, FALSE, TRUE, FALSE, TRUE, FALSE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE) );
23294 
23295  SCIP_CALL( SCIPconsEnableSeparation(cons, scip->set) );
23296 
23297  return SCIP_OKAY;
23298 }
23299 
23300 /** disables constraint's separation capabilities s.t. the constraint is not separated anymore until the separation
23301  * is enabled again with a call to SCIPenableConsSeparation(); in contrast to SCIPdelConsLocal() and SCIPdelConsNode(),
23302  * the disabling is not associated to a node in the tree and does not consume memory; therefore, the constraint
23303  * is neither automatically enabled on leaving the node nor automatically disabled again on entering the node again
23304  *
23305  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
23306  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
23307  *
23308  * @pre This method can be called if @p scip is in one of the following stages:
23309  * - \ref SCIP_STAGE_TRANSFORMED
23310  * - \ref SCIP_STAGE_PRESOLVING
23311  * - \ref SCIP_STAGE_PRESOLVED
23312  * - \ref SCIP_STAGE_INITSOLVE
23313  * - \ref SCIP_STAGE_SOLVING
23314  * - \ref SCIP_STAGE_SOLVED
23315  */
23317  SCIP* scip, /**< SCIP data structure */
23318  SCIP_CONS* cons /**< constraint */
23319  )
23320 {
23321  SCIP_CALL( checkStage(scip, "SCIPdisableConsSeparation", FALSE, FALSE, FALSE, TRUE, FALSE, TRUE, FALSE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE) );
23322 
23323  SCIP_CALL( SCIPconsDisableSeparation(cons, scip->set) );
23324 
23325  return SCIP_OKAY;
23326 }
23327 
23328 /** enables constraint's propagation capabilities
23329  *
23330  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
23331  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
23332  *
23333  * @pre This method can be called if @p scip is in one of the following stages:
23334  * - \ref SCIP_STAGE_TRANSFORMED
23335  * - \ref SCIP_STAGE_INITPRESOLVE
23336  * - \ref SCIP_STAGE_PRESOLVING
23337  * - \ref SCIP_STAGE_EXITPRESOLVE
23338  * - \ref SCIP_STAGE_PRESOLVED
23339  * - \ref SCIP_STAGE_INITSOLVE
23340  * - \ref SCIP_STAGE_SOLVING
23341  * - \ref SCIP_STAGE_SOLVED
23342  */
23344  SCIP* scip, /**< SCIP data structure */
23345  SCIP_CONS* cons /**< constraint */
23346  )
23347 {
23348  SCIP_CALL( checkStage(scip, "SCIPenableConsPropagation", FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE) );
23349 
23350  SCIP_CALL( SCIPconsEnablePropagation(cons, scip->set) );
23351 
23352  return SCIP_OKAY;
23353 }
23354 
23355 /** disables constraint's propagation capabilities s.t. the constraint is not propagated anymore until the propagation
23356  * is enabled again with a call to SCIPenableConsPropagation(); in contrast to SCIPdelConsLocal() and SCIPdelConsNode(),
23357  * the disabling is not associated to a node in the tree and does not consume memory; therefore, the constraint
23358  * is neither automatically enabled on leaving the node nor automatically disabled again on entering the node again
23359  *
23360  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
23361  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
23362  *
23363  * @pre This method can be called if @p scip is in one of the following stages:
23364  * - \ref SCIP_STAGE_TRANSFORMED
23365  * - \ref SCIP_STAGE_INITPRESOLVE
23366  * - \ref SCIP_STAGE_PRESOLVING
23367  * - \ref SCIP_STAGE_EXITPRESOLVE
23368  * - \ref SCIP_STAGE_PRESOLVED
23369  * - \ref SCIP_STAGE_INITSOLVE
23370  * - \ref SCIP_STAGE_SOLVING
23371  * - \ref SCIP_STAGE_SOLVED
23372  */
23374  SCIP* scip, /**< SCIP data structure */
23375  SCIP_CONS* cons /**< constraint */
23376  )
23377 {
23378  SCIP_CALL( checkStage(scip, "SCIPdisableConsPropagation", FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE) );
23379 
23380  SCIP_CALL( SCIPconsDisablePropagation(cons, scip->set) );
23381 
23382  return SCIP_OKAY;
23383 }
23384 
23385 /** marks constraint to be propagated
23386  *
23387  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
23388  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
23389  *
23390  * @pre This method can be called if @p scip is in one of the following stages:
23391  * - \ref SCIP_STAGE_TRANSFORMED
23392  * - \ref SCIP_STAGE_PRESOLVING
23393  * - \ref SCIP_STAGE_EXITPRESOLVE
23394  * - \ref SCIP_STAGE_PRESOLVED
23395  * - \ref SCIP_STAGE_INITSOLVE
23396  * - \ref SCIP_STAGE_SOLVING
23397  * - \ref SCIP_STAGE_SOLVED
23398  *
23399  * @note if a constraint is marked to be propagated, the age of the constraint will be ignored for propagation
23400  */
23402  SCIP* scip, /**< SCIP data structure */
23403  SCIP_CONS* cons /**< constraint */
23404  )
23405 {
23406  SCIP_CALL( checkStage(scip, "SCIPmarkConsPropagate", FALSE, FALSE, FALSE, TRUE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE) );
23407 
23408  SCIP_CALL( SCIPconsMarkPropagate(cons, scip->set) );
23409 
23410  return SCIP_OKAY;
23411 }
23412 
23413 /** unmarks the constraint to be propagated
23414  *
23415  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
23416  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
23417  *
23418  * @pre This method can be called if @p scip is in one of the following stages:
23419  * - \ref SCIP_STAGE_TRANSFORMED
23420  * - \ref SCIP_STAGE_PRESOLVING
23421  * - \ref SCIP_STAGE_EXITPRESOLVE
23422  * - \ref SCIP_STAGE_PRESOLVED
23423  * - \ref SCIP_STAGE_INITSOLVE
23424  * - \ref SCIP_STAGE_SOLVING
23425  * - \ref SCIP_STAGE_SOLVED
23426  */
23428  SCIP* scip, /**< SCIP data structure */
23429  SCIP_CONS* cons /**< constraint */
23430  )
23431 {
23432  SCIP_CALL( checkStage(scip, "SCIPunmarkConsPropagate", FALSE, FALSE, FALSE, TRUE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE) );
23433 
23434  SCIP_CALL( SCIPconsUnmarkPropagate(cons, scip->set) );
23435 
23436  return SCIP_OKAY;
23437 }
23438 
23439 /** adds given values to lock status of the constraint and updates the rounding locks of the involved variables
23440  *
23441  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
23442  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
23443  *
23444  * @pre This method can be called if @p scip is in one of the following stages:
23445  * - \ref SCIP_STAGE_PROBLEM
23446  * - \ref SCIP_STAGE_TRANSFORMING
23447  * - \ref SCIP_STAGE_INITPRESOLVE
23448  * - \ref SCIP_STAGE_PRESOLVING
23449  * - \ref SCIP_STAGE_EXITPRESOLVE
23450  * - \ref SCIP_STAGE_INITSOLVE
23451  * - \ref SCIP_STAGE_SOLVING
23452  * - \ref SCIP_STAGE_EXITSOLVE
23453  * - \ref SCIP_STAGE_FREETRANS
23454  */
23456  SCIP* scip, /**< SCIP data structure */
23457  SCIP_CONS* cons, /**< constraint */
23458  int nlockspos, /**< increase in number of rounding locks for constraint */
23459  int nlocksneg /**< increase in number of rounding locks for constraint's negation */
23460  )
23461 {
23462  SCIP_CALL( checkStage(scip, "SCIPaddConsLocks", FALSE, TRUE, TRUE, FALSE, TRUE, TRUE, TRUE, FALSE, TRUE, TRUE, FALSE, TRUE, TRUE, FALSE) );
23463 
23464  SCIP_CALL( SCIPconsAddLocks(cons, scip->set, nlockspos, nlocksneg) );
23465 
23466  return SCIP_OKAY;
23467 }
23468 
23469 /** checks single constraint for feasibility of the given solution
23470  *
23471  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
23472  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
23473  *
23474  * @pre This method can be called if @p scip is in one of the following stages:
23475  * - \ref SCIP_STAGE_PROBLEM
23476  * - \ref SCIP_STAGE_TRANSFORMED
23477  * - \ref SCIP_STAGE_INITPRESOLVE
23478  * - \ref SCIP_STAGE_PRESOLVING
23479  * - \ref SCIP_STAGE_EXITPRESOLVE
23480  * - \ref SCIP_STAGE_PRESOLVED
23481  * - \ref SCIP_STAGE_INITSOLVE
23482  * - \ref SCIP_STAGE_SOLVING
23483  * - \ref SCIP_STAGE_SOLVED
23484  */
23486  SCIP* scip, /**< SCIP data structure */
23487  SCIP_CONS* cons, /**< constraint to check */
23488  SCIP_SOL* sol, /**< primal CIP solution */
23489  SCIP_Bool checkintegrality, /**< has integrality to be checked? */
23490  SCIP_Bool checklprows, /**< have current LP rows (both local and global) to be checked? */
23491  SCIP_Bool printreason, /**< should the reason for the violation be printed? */
23492  SCIP_RESULT* result /**< pointer to store the result of the callback method */
23493  )
23494 {
23495  SCIP_CALL( checkStage(scip, "SCIPcheckCons", FALSE, TRUE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE) );
23496 
23497  SCIP_CALL( SCIPconsCheck(cons, scip->set, sol, checkintegrality, checklprows, printreason, result) );
23498 
23499  return SCIP_OKAY;
23500 }
23501 
23502 /** enforces single constraint for a given pseudo solution
23503  *
23504  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
23505  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
23506  *
23507  * @pre This method can be called if @p scip is in one of the following stages:
23508  * - \ref SCIP_STAGE_SOLVING
23509  *
23510  * @note This is an advanced method and should be used with caution. It may only be called for constraints that were not
23511  * added to SCIP beforehand.
23512  */
23514  SCIP* scip, /**< SCIP data structure */
23515  SCIP_CONS* cons, /**< constraint to enforce */
23516  SCIP_Bool solinfeasible, /**< was the solution already declared infeasible by a constraint handler? */
23517  SCIP_Bool objinfeasible, /**< is the solution infeasible anyway due to violating lower objective bound? */
23518  SCIP_RESULT* result /**< pointer to store the result of the callback method */
23519  )
23520 {
23521  assert(scip != NULL);
23522  assert(cons != NULL);
23523  assert(!SCIPconsIsAdded(cons));
23524  assert(result != NULL);
23525 
23526  SCIP_CALL( checkStage(scip, "SCIPenfopsCons", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) );
23527 
23528  SCIP_CALL( SCIPconsEnfops(cons, scip->set, solinfeasible, objinfeasible, result) );
23529 
23530  return SCIP_OKAY;
23531 }
23532 
23533 /** enforces single constraint for a given LP solution
23534  *
23535  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
23536  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
23537  *
23538  * @pre This method can be called if @p scip is in one of the following stages:
23539  * - \ref SCIP_STAGE_SOLVING
23540  *
23541  * @note This is an advanced method and should be used with caution. It may only be called for constraints that were not
23542  * added to SCIP beforehand.
23543  */
23545  SCIP* scip, /**< SCIP data structure */
23546  SCIP_CONS* cons, /**< constraint to enforce */
23547  SCIP_Bool solinfeasible, /**< was the solution already declared infeasible by a constraint handler? */
23548  SCIP_RESULT* result /**< pointer to store the result of the callback method */
23549  )
23550 {
23551  assert(scip != NULL);
23552  assert(cons != NULL);
23553  assert(!SCIPconsIsAdded(cons));
23554  assert(result != NULL);
23555 
23556  SCIP_CALL( checkStage(scip, "SCIPenfolpCons", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) );
23557 
23558  SCIP_CALL( SCIPconsEnfolp(cons, scip->set, solinfeasible, result) );
23559 
23560  return SCIP_OKAY;
23561 }
23562 
23563 /** calls LP initialization method for single constraint
23564  *
23565  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
23566  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
23567  *
23568  * @pre This method can be called if @p scip is in one of the following stages:
23569  * - \ref SCIP_STAGE_SOLVING
23570  *
23571  * @note This is an advanced method and should be used with caution. It may only be called for constraints that were not
23572  * added to SCIP beforehand.
23573  */
23575  SCIP* scip, /**< SCIP data structure */
23576  SCIP_CONS* cons /**< constraint to initialize */
23577  )
23578 {
23579  assert(scip != NULL);
23580  assert(cons != NULL);
23581  assert(!SCIPconsIsAdded(cons));
23582 
23583  SCIP_CALL( checkStage(scip, "SCIPinitlpCons", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) );
23584 
23585  SCIP_CALL( SCIPconsInitlp(cons, scip->set) );
23586 
23587  return SCIP_OKAY;
23588 }
23589 
23590 /** calls separation method of single constraint for LP solution
23591  *
23592  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
23593  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
23594  *
23595  * @pre This method can be called if @p scip is in one of the following stages:
23596  * - \ref SCIP_STAGE_SOLVING
23597  *
23598  * @note This is an advanced method and should be used with caution.
23599  */
23601  SCIP* scip, /**< SCIP data structure */
23602  SCIP_CONS* cons, /**< constraint to separate */
23603  SCIP_RESULT* result /**< pointer to store the result of the separation call */
23604  )
23605 {
23606  assert(scip != NULL);
23607  assert(cons != NULL);
23608  assert(result != NULL);
23609 
23610  SCIP_CALL( checkStage(scip, "SCIPsepalpCons", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) );
23611 
23612  SCIP_CALL( SCIPconsSepalp(cons, scip->set, result) );
23613 
23614  return SCIP_OKAY;
23615 }
23616 
23617 /** calls separation method of single constraint for given primal solution
23618  *
23619  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
23620  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
23621  *
23622  * @pre This method can be called if @p scip is in one of the following stages:
23623  * - \ref SCIP_STAGE_SOLVING
23624  *
23625  * @note This is an advanced method and should be used with caution.
23626  */
23628  SCIP* scip, /**< SCIP data structure */
23629  SCIP_CONS* cons, /**< constraint to separate */
23630  SCIP_SOL* sol, /**< primal solution that should be separated*/
23631  SCIP_RESULT* result /**< pointer to store the result of the separation call */
23632  )
23633 {
23634  assert(scip != NULL);
23635  assert(cons != NULL);
23636  assert(sol != NULL);
23637  assert(result != NULL);
23638 
23639  SCIP_CALL( checkStage(scip, "SCIPsepasolCons", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) );
23640 
23641  SCIP_CALL( SCIPconsSepasol(cons, scip->set, sol, result) );
23642 
23643  return SCIP_OKAY;
23644 }
23645 
23646 /** calls domain propagation method of single constraint
23647  *
23648  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
23649  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
23650  *
23651  * @pre This method can be called if @p scip is in one of the following stages:
23652  * - \ref SCIP_STAGE_PRESOLVING
23653  * - \ref SCIP_STAGE_SOLVING
23654  *
23655  * @note This is an advanced method and should be used with caution.
23656  */
23658  SCIP* scip, /**< SCIP data structure */
23659  SCIP_CONS* cons, /**< constraint to propagate */
23660  SCIP_PROPTIMING proptiming, /**< current point in the node solving loop */
23661  SCIP_RESULT* result /**< pointer to store the result of the callback method */
23662  )
23663 {
23664  assert(scip != NULL);
23665  assert(cons != NULL);
23666  assert(result != NULL);
23667 
23668  SCIP_CALL( checkStage(scip, "SCIPpropCons", FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) );
23669 
23670  SCIP_CALL( SCIPconsProp(cons, scip->set, proptiming, result) );
23671 
23672  return SCIP_OKAY;
23673 }
23674 
23675 /** resolves propagation conflict of single constraint
23676  *
23677  *
23678  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
23679  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
23680  *
23681  * @pre This method can be called if @p scip is in one of the following stages:
23682  * - \ref SCIP_STAGE_PRESOLVING
23683  * - \ref SCIP_STAGE_SOLVING
23684  *
23685  * @note This is an advanced method and should be used with caution. It may only be called for constraints that were not
23686  * added to SCIP beforehand.
23687  */
23689  SCIP* scip, /**< SCIP data structure */
23690  SCIP_CONS* cons, /**< constraint to resolve conflict for */
23691  SCIP_VAR* infervar, /**< the conflict variable whose bound change has to be resolved */
23692  int inferinfo, /**< the user information passed to the corresponding SCIPinferVarLbCons() or SCIPinferVarUbCons() call */
23693  SCIP_BOUNDTYPE boundtype, /**< the type of the changed bound (lower or upper bound) */
23694  SCIP_BDCHGIDX* bdchgidx, /**< the index of the bound change, representing the point of time where the change took place */
23695  SCIP_Real relaxedbd, /**< the relaxed bound which is sufficient to be explained */
23696  SCIP_RESULT* result /**< pointer to store the result of the callback method */
23697  )
23698 {
23699  assert(scip != NULL);
23700  assert(cons != NULL);
23701  assert(!SCIPconsIsAdded(cons));
23702  assert(infervar != NULL);
23703  assert(bdchgidx != NULL);
23704  assert(result != NULL);
23705 
23706  SCIP_CALL( checkStage(scip, "SCIPrespropCons", FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) );
23707 
23708  SCIP_CALL( SCIPconsResprop(cons, scip->set, infervar, inferinfo, boundtype, bdchgidx, relaxedbd, result) );
23709 
23710  return SCIP_OKAY;
23711 }
23712 
23713 /** presolves of single constraint
23714  *
23715  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
23716  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
23717  *
23718  * @pre This method can be called if @p scip is in one of the following stages:
23719  * - \ref SCIP_STAGE_PRESOLVING
23720  *
23721  * @note This is an advanced method and should be used with caution.
23722  */
23724  SCIP* scip, /**< SCIP data structure */
23725  SCIP_CONS* cons, /**< constraint to presolve */
23726  int nrounds, /**< number of presolving rounds already done */
23727  int nnewfixedvars, /**< number of variables fixed since the last call to the presolving method */
23728  int nnewaggrvars, /**< number of variables aggregated since the last call to the presolving method */
23729  int nnewchgvartypes, /**< number of variable type changes since the last call to the presolving method */
23730  int nnewchgbds, /**< number of variable bounds tightened since the last call to the presolving method */
23731  int nnewholes, /**< number of domain holes added since the last call to the presolving method */
23732  int nnewdelconss, /**< number of deleted constraints since the last call to the presolving method */
23733  int nnewaddconss, /**< number of added constraints since the last call to the presolving method */
23734  int nnewupgdconss, /**< number of upgraded constraints since the last call to the presolving method */
23735  int nnewchgcoefs, /**< number of changed coefficients since the last call to the presolving method */
23736  int nnewchgsides, /**< number of changed left or right hand sides since the last call to the presolving method */
23737  int* nfixedvars, /**< pointer to count total number of variables fixed of all presolvers */
23738  int* naggrvars, /**< pointer to count total number of variables aggregated of all presolvers */
23739  int* nchgvartypes, /**< pointer to count total number of variable type changes of all presolvers */
23740  int* nchgbds, /**< pointer to count total number of variable bounds tightened of all presolvers */
23741  int* naddholes, /**< pointer to count total number of domain holes added of all presolvers */
23742  int* ndelconss, /**< pointer to count total number of deleted constraints of all presolvers */
23743  int* naddconss, /**< pointer to count total number of added constraints of all presolvers */
23744  int* nupgdconss, /**< pointer to count total number of upgraded constraints of all presolvers */
23745  int* nchgcoefs, /**< pointer to count total number of changed coefficients of all presolvers */
23746  int* nchgsides, /**< pointer to count total number of changed left/right hand sides of all presolvers */
23747  SCIP_RESULT* result /**< pointer to store the result of the callback method */
23748  )
23749 {
23750  assert(scip != NULL);
23751  assert(cons != NULL);
23752  assert(nfixedvars != NULL);
23753  assert(naggrvars != NULL);
23754  assert(nchgvartypes != NULL);
23755  assert(nchgbds != NULL);
23756  assert(naddholes != NULL);
23757  assert(ndelconss != NULL);
23758  assert(naddconss != NULL);
23759  assert(nupgdconss != NULL);
23760  assert(nchgcoefs != NULL);
23761  assert(nchgsides != NULL);
23762  assert(result != NULL);
23763 
23764  SCIP_CALL( checkStage(scip, "SCIPpresolCons", FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE) );
23765 
23766  SCIP_CALL( SCIPconsPresol(cons, scip->set, nrounds, nnewfixedvars, nnewaggrvars, nnewchgvartypes, nnewchgbds,nnewholes,
23767  nnewdelconss, nnewaddconss, nnewupgdconss, nnewchgcoefs, nnewchgsides, nfixedvars, naggrvars, nchgvartypes,
23768  nchgbds, naddholes, ndelconss, naddconss, nupgdconss, nchgcoefs, nchgsides , result) );
23769 
23770  return SCIP_OKAY;
23771 }
23772 
23773 /** calls constraint activation notification method of single constraint
23774  *
23775  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
23776  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
23777  *
23778  * @pre This method can be called if @p scip is in one of the following stages:
23779  * - \ref SCIP_STAGE_TRANSFORMING
23780  *
23781  * @note This is an advanced method and should be used with caution. It may only be called for constraints that were not
23782  * added to SCIP beforehand.
23783  */
23785  SCIP* scip, /**< SCIP data structure */
23786  SCIP_CONS* cons /**< constraint to notify */
23787  )
23788 {
23789  assert(scip != NULL);
23790  assert(cons != NULL);
23791  assert(!SCIPconsIsAdded(cons));
23792 
23793  SCIP_CALL( checkStage(scip, "SCIPactiveCons", FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE) );
23794 
23795  SCIP_CALL( SCIPconsActive(cons, scip->set) );
23796 
23797  return SCIP_OKAY;
23798 }
23799 
23800 /** calls constraint deactivation notification method of single constraint
23801  *
23802  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
23803  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
23804  *
23805  * @pre This method can be called if @p scip is in one of the following stages:
23806  * - \ref SCIP_STAGE_PRESOLVING
23807  * - \ref SCIP_STAGE_SOLVING
23808  *
23809  * @note This is an advanced method and should be used with caution. It may only be called for constraints that were not
23810  * added to SCIP beforehand.
23811  */
23813  SCIP* scip, /**< SCIP data structure */
23814  SCIP_CONS* cons /**< constraint to notify */
23815  )
23816 {
23817  assert(scip != NULL);
23818  assert(cons != NULL);
23819  assert(!SCIPconsIsAdded(cons));
23820 
23821  SCIP_CALL( checkStage(scip, "SCIPdeactiveCons", FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) );
23822 
23823  SCIP_CALL( SCIPconsDeactive(cons, scip->set) );
23824 
23825  return SCIP_OKAY;
23826 }
23827 
23828 /** outputs constraint information to file stream via the message handler system
23829  *
23830  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
23831  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
23832  *
23833  * @pre This method can be called if @p scip is in one of the following stages:
23834  * - \ref SCIP_STAGE_PROBLEM
23835  * - \ref SCIP_STAGE_TRANSFORMING
23836  * - \ref SCIP_STAGE_TRANSFORMED
23837  * - \ref SCIP_STAGE_INITPRESOLVE
23838  * - \ref SCIP_STAGE_PRESOLVING
23839  * - \ref SCIP_STAGE_EXITPRESOLVE
23840  * - \ref SCIP_STAGE_PRESOLVED
23841  * - \ref SCIP_STAGE_INITSOLVE
23842  * - \ref SCIP_STAGE_SOLVING
23843  * - \ref SCIP_STAGE_SOLVED
23844  * - \ref SCIP_STAGE_EXITSOLVE
23845  * - \ref SCIP_STAGE_FREETRANS
23846  *
23847  * @note If the message handler is set to a NULL pointer nothing will be printed.
23848  * @note The file stream will not be flushed directly, this can be achieved by calling SCIPinfoMessage() printing a
23849  * newline character.
23850  */
23852  SCIP* scip, /**< SCIP data structure */
23853  SCIP_CONS* cons, /**< constraint */
23854  FILE* file /**< output file (or NULL for standard output) */
23855  )
23856 {
23857  SCIP_CALL( checkStage(scip, "SCIPprintCons", FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE) );
23858 
23859  SCIP_CALL( SCIPconsPrint(cons, scip->set, scip->messagehdlr, file) );
23860 
23861  return SCIP_OKAY;
23862 }
23863 
23864 /** method to collect the variables of a constraint
23865  *
23866  * If the number of variables is greater than the available slots in the variable array, nothing happens except that
23867  * the success point is set to FALSE. With the method SCIPgetConsNVars() it is possible to get the number of variables
23868  * a constraint has in its scope.
23869  *
23870  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
23871  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
23872  *
23873  * @pre This method can be called if @p scip is in one of the following stages:
23874  * - \ref SCIP_STAGE_PROBLEM
23875  * - \ref SCIP_STAGE_TRANSFORMING
23876  * - \ref SCIP_STAGE_TRANSFORMED
23877  * - \ref SCIP_STAGE_INITPRESOLVE
23878  * - \ref SCIP_STAGE_PRESOLVING
23879  * - \ref SCIP_STAGE_EXITPRESOLVE
23880  * - \ref SCIP_STAGE_PRESOLVED
23881  * - \ref SCIP_STAGE_INITSOLVE
23882  * - \ref SCIP_STAGE_SOLVING
23883  * - \ref SCIP_STAGE_SOLVED
23884  * - \ref SCIP_STAGE_EXITSOLVE
23885  * - \ref SCIP_STAGE_FREETRANS
23886  *
23887  * @note The success pointer indicates if all variables were copied into the vars arrray.
23888  *
23889  * @note It might be that a constraint handler does not support this functionality, in that case the success pointer is
23890  * set to FALSE.
23891  */
23893  SCIP* scip, /**< SCIP data structure */
23894  SCIP_CONS* cons, /**< constraint for which the variables are wanted */
23895  SCIP_VAR** vars, /**< array to store the involved variable of the constraint */
23896  int varssize, /**< available slots in vars array which is needed to check if the array is large enough */
23897  SCIP_Bool* success /**< pointer to store whether the variables are successfully copied */
23898  )
23899 {
23900  SCIP_CALL( checkStage(scip, "SCIPgetConsVars", FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE) );
23901 
23902  assert(scip != NULL);
23903  assert(cons != NULL);
23904  assert(vars != NULL);
23905  assert(success != NULL);
23906 
23907  SCIP_CALL( SCIPconsGetVars(cons, scip->set, vars, varssize, success) );
23908 
23909  return SCIP_OKAY;
23910 }
23911 
23912 /** method to collect the number of variables of a constraint
23913  *
23914  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
23915  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
23916  *
23917  * @pre This method can be called if @p scip is in one of the following stages:
23918  * - \ref SCIP_STAGE_PROBLEM
23919  * - \ref SCIP_STAGE_TRANSFORMING
23920  * - \ref SCIP_STAGE_TRANSFORMED
23921  * - \ref SCIP_STAGE_INITPRESOLVE
23922  * - \ref SCIP_STAGE_PRESOLVING
23923  * - \ref SCIP_STAGE_EXITPRESOLVE
23924  * - \ref SCIP_STAGE_PRESOLVED
23925  * - \ref SCIP_STAGE_INITSOLVE
23926  * - \ref SCIP_STAGE_SOLVING
23927  * - \ref SCIP_STAGE_SOLVED
23928  * - \ref SCIP_STAGE_EXITSOLVE
23929  * - \ref SCIP_STAGE_FREETRANS
23930  *
23931  * @note The success pointer indicates if the contraint handler was able to return the number of variables
23932  *
23933  * @note It might be that a constraint handler does not support this functionality, in that case the success pointer is
23934  * set to FALSE
23935  */
23937  SCIP* scip, /**< SCIP data structure */
23938  SCIP_CONS* cons, /**< constraint for which the number of variables is wanted */
23939  int* nvars, /**< pointer to store the number of variables */
23940  SCIP_Bool* success /**< pointer to store whether the constraint successfully returned the number of variables */
23941  )
23942 {
23943  SCIP_CALL( checkStage(scip, "SCIPgetConsNVars", FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE) );
23944 
23945  assert(scip != NULL);
23946  assert(cons != NULL);
23947  assert(nvars != NULL);
23948  assert(success != NULL);
23949 
23950  SCIP_CALL( SCIPconsGetNVars(cons, scip->set, nvars, success) );
23951 
23952  return SCIP_OKAY;
23953 }
23954 
23955 /*
23956  * LP methods
23957  */
23958 
23959 /** returns, whether the LP was or is to be solved in the current node
23960  *
23961  * @return whether the LP was or is to be solved in the current node.
23962  *
23963  * @pre This method can be called if @p scip is in one of the following stages:
23964  * - \ref SCIP_STAGE_SOLVING
23965  *
23966  * See \ref SCIP_Stage "SCIP_STAGE" for a complete list of all possible solving stages.
23967  */
23969  SCIP* scip /**< SCIP data structure */
23970  )
23971 {
23972  SCIP_CALL_ABORT( checkStage(scip, "SCIPhasCurrentNodeLP", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) );
23973 
23974  return SCIPtreeHasCurrentNodeLP(scip->tree);
23975 }
23976 
23977 /** returns, whether the LP of the current node is already constructed
23978  *
23979  * @return whether the LP of the current node is already constructed.
23980  *
23981  * @pre This method can be called if @p scip is in one of the following stages:
23982  * - \ref SCIP_STAGE_SOLVING
23983  *
23984  * See \ref SCIP_Stage "SCIP_STAGE" for a complete list of all possible solving stages.
23985  */
23987  SCIP* scip /**< SCIP data structure */
23988  )
23989 {
23990  SCIP_CALL_ABORT( checkStage(scip, "SCIPisLPConstructed", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) );
23991 
23992  return SCIPtreeIsFocusNodeLPConstructed(scip->tree);
23993 }
23994 
23995 /** makes sure that the LP of the current node is loaded and may be accessed through the LP information methods
23996  *
23997  * @warning Contructing the LP might change the amount of variables known in the transformed problem and therefore also
23998  * the variables array of SCIP (returned by SCIPgetVars() and SCIPgetVarsData()), so it might be necessary to
23999  * call one of the later method after this one
24000  *
24001  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
24002  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
24003  *
24004  * @pre This method can be called if @p scip is in one of the following stages:
24005  * - \ref SCIP_STAGE_SOLVING
24006  *
24007  * See \ref SCIP_Stage "SCIP_STAGE" for a complete list of all possible solving stages.
24008  */
24010  SCIP* scip, /**< SCIP data structure */
24011  SCIP_Bool* cutoff /**< pointer to store whether the node can be cut off */
24012  )
24013 {
24014  SCIP_CALL( checkStage(scip, "SCIPconstructLP", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) );
24015 
24016  SCIP_CALL( SCIPconstructCurrentLP(scip->mem->probmem, scip->set, scip->stat, scip->transprob, scip->origprob,
24017  scip->tree, scip->lp, scip->pricestore, scip->sepastore, scip->branchcand, scip->eventqueue, scip->eventfilter,
24018  FALSE, cutoff) );
24019 
24020  return SCIP_OKAY;
24021 }
24022 
24023 /** makes sure that the LP of the current node is flushed
24024  *
24025  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
24026  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
24027  *
24028  * @pre This method can be called if @p scip is in one of the following stages:
24029  * - \ref SCIP_STAGE_SOLVING
24030  *
24031  * See \ref SCIP_Stage "SCIP_STAGE" for a complete list of all possible solving stages.
24032  */
24034  SCIP* scip /**< SCIP data structure */
24035  )
24036 {
24037  SCIP_CALL( checkStage(scip, "SCIPflushLP", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) );
24038 
24039  SCIP_CALL( SCIPlpFlush(scip->lp, scip->mem->probmem, scip->set, scip->eventqueue) );
24040 
24041  return SCIP_OKAY;
24042 }
24043 
24044 /** gets solution status of current LP
24045  *
24046  * @return the solution status of current LP.
24047  *
24048  * @pre This method can be called if @p scip is in one of the following stages:
24049  * - \ref SCIP_STAGE_SOLVING
24050  *
24051  * See \ref SCIP_Stage "SCIP_STAGE" for a complete list of all possible solving stages.
24052  */
24054  SCIP* scip /**< SCIP data structure */
24055  )
24056 {
24057  SCIP_CALL_ABORT( checkStage(scip, "SCIPgetLPSolstat", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) );
24058 
24060  return SCIPlpGetSolstat(scip->lp);
24061  else
24062  return SCIP_LPSOLSTAT_NOTSOLVED;
24063 }
24064 
24065 /** returns whether the current lp is a relaxation of the current problem and its optimal objective value is a local lower bound
24066  *
24067  * @return whether the current lp is a relaxation of the current problem and its optimal objective value is a local lower bound.
24068  *
24069  * @pre This method can be called if @p scip is in one of the following stages:
24070  * - \ref SCIP_STAGE_SOLVING
24071  *
24072  * See \ref SCIP_Stage "SCIP_STAGE" for a complete list of all possible solving stages.
24073  */
24075  SCIP* scip /**< SCIP data structure */
24076  )
24077 {
24078  SCIP_CALL_ABORT( checkStage(scip, "SCIPisLPRelax", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) );
24079 
24080  return SCIPlpIsRelax(scip->lp);
24081 }
24082 
24083 /** gets objective value of current LP (which is the sum of column and loose objective value)
24084  *
24085  * @return the objective value of current LP (which is the sum of column and loose objective value).
24086  *
24087  * @pre This method can be called if @p scip is in one of the following stages:
24088  * - \ref SCIP_STAGE_SOLVING
24089  *
24090  * @note This method returns the objective value of the current LP solution, which might be primal or dual infeasible
24091  * if a limit was hit during solving. It must not be used as a dual bound if the LP solution status returned by
24092  * SCIPgetLPSolstat() is SCIP_LPSOLSTAT_ITERLIMIT or SCIP_LPSOLSTAT_TIMELIMIT.
24093  *
24094  * See \ref SCIP_Stage "SCIP_STAGE" for a complete list of all possible solving stages.
24095  */
24097  SCIP* scip /**< SCIP data structure */
24098  )
24099 {
24100  SCIP_CALL_ABORT( checkStage(scip, "SCIPgetLPObjval", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) );
24101 
24102  return SCIPlpGetObjval(scip->lp, scip->set, scip->transprob);
24103 }
24104 
24105 /** gets part of objective value of current LP that results from COLUMN variables only
24106  *
24107  * @return the part of objective value of current LP that results from COLUMN variables only.
24108  *
24109  * @pre This method can be called if @p scip is in one of the following stages:
24110  * - \ref SCIP_STAGE_SOLVING
24111  *
24112  * See \ref SCIP_Stage "SCIP_STAGE" for a complete list of all possible solving stages.
24113  */
24115  SCIP* scip /**< SCIP data structure */
24116  )
24117 {
24118  SCIP_CALL_ABORT( checkStage(scip, "SCIPgetLPColumnObjval", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) );
24119 
24120  return SCIPlpGetColumnObjval(scip->lp);
24121 }
24122 
24123 /** gets part of objective value of current LP that results from LOOSE variables only
24124  *
24125  * @return part of objective value of current LP that results from LOOSE variables only.
24126  *
24127  * @pre This method can be called if @p scip is in one of the following stages:
24128  * - \ref SCIP_STAGE_SOLVING
24129  *
24130  * See \ref SCIP_Stage "SCIP_STAGE" for a complete list of all possible solving stages.
24131  */
24133  SCIP* scip /**< SCIP data structure */
24134  )
24135 {
24136  SCIP_CALL_ABORT( checkStage(scip, "SCIPgetLPLooseObjval", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) );
24137 
24138  return SCIPlpGetLooseObjval(scip->lp, scip->set, scip->transprob);
24139 }
24140 
24141 /** gets the global pseudo objective value; that is all variables set to their best (w.r.t. the objective
24142  * function) global bound
24143  *
24144  * @return the global pseudo objective value; that is all variables set to their best (w.r.t. the objective
24145  * function) global bound.
24146  *
24147  * @pre This method can be called if @p scip is in one of the following stages:
24148  * - \ref SCIP_STAGE_INITPRESOLVE
24149  * - \ref SCIP_STAGE_PRESOLVING
24150  * - \ref SCIP_STAGE_EXITPRESOLVE
24151  * - \ref SCIP_STAGE_PRESOLVED
24152  * - \ref SCIP_STAGE_INITSOLVE
24153  * - \ref SCIP_STAGE_SOLVING
24154  *
24155  * See \ref SCIP_Stage "SCIP_STAGE" for a complete list of all possible solving stages.
24156  */
24158  SCIP* scip /**< SCIP data structure */
24159  )
24160 {
24161  SCIP_CALL_ABORT( checkStage(scip, "SCIPgetGlobalPseudoObjval", FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE) );
24162 
24163  return SCIPlpGetGlobalPseudoObjval(scip->lp, scip->set, scip->transprob);
24164 }
24165 
24166 /** gets the pseudo objective value for the current search node; that is all variables set to their best (w.r.t. the
24167  * objective function) local bound
24168  *
24169  * @return the pseudo objective value for the current search node; that is all variables set to their best (w.r.t. the
24170  * objective function) local bound.
24171  *
24172  * @pre This method can be called if @p scip is in one of the following stages:
24173  * - \ref SCIP_STAGE_INITPRESOLVE
24174  * - \ref SCIP_STAGE_PRESOLVING
24175  * - \ref SCIP_STAGE_EXITPRESOLVE
24176  * - \ref SCIP_STAGE_PRESOLVED
24177  * - \ref SCIP_STAGE_INITSOLVE
24178  * - \ref SCIP_STAGE_SOLVING
24179  *
24180  * See \ref SCIP_Stage "SCIP_STAGE" for a complete list of all possible solving stages.
24181  */
24183  SCIP* scip /**< SCIP data structure */
24184  )
24185 {
24186  SCIP_CALL_ABORT( checkStage(scip, "SCIPgetPseudoObjval", FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE) );
24187 
24188  return SCIPlpGetPseudoObjval(scip->lp, scip->set, scip->transprob);
24189 }
24190 
24191 /** returns whether the root lp is a relaxation of the problem and its optimal objective value is a global lower bound
24192  *
24193  * @return whether the root lp is a relaxation of the problem and its optimal objective value is a global lower bound.
24194  *
24195  * @pre This method can be called if @p scip is in one of the following stages:
24196  * - \ref SCIP_STAGE_SOLVING
24197  *
24198  * See \ref SCIP_Stage "SCIP_STAGE" for a complete list of all possible solving stages.
24199  */
24201  SCIP* scip /**< SCIP data structure */
24202  )
24203 {
24204  SCIP_CALL_ABORT( checkStage(scip, "SCIPisRootLPRelax", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) );
24205 
24206  return SCIPlpIsRootLPRelax(scip->lp);
24207 }
24208 
24209 /** gets the objective value of the root node LP or SCIP_INVALID if the root node LP was not (yet) solved
24210  *
24211  * @return the objective value of the root node LP or SCIP_INVALID if the root node LP was not (yet) solved.
24212  *
24213  * @pre This method can be called if @p scip is in one of the following stages:
24214  * - \ref SCIP_STAGE_INITPRESOLVE
24215  * - \ref SCIP_STAGE_PRESOLVING
24216  * - \ref SCIP_STAGE_EXITPRESOLVE
24217  * - \ref SCIP_STAGE_SOLVING
24218  *
24219  * See \ref SCIP_Stage "SCIP_STAGE" for a complete list of all possible solving stages.
24220  */
24222  SCIP* scip /**< SCIP data structure */
24223  )
24224 {
24225  SCIP_CALL_ABORT( checkStage(scip, "SCIPgetLPRootObjval", FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) );
24226 
24227  return SCIPlpGetRootObjval(scip->lp);
24228 }
24229 
24230 /** gets part of the objective value of the root node LP that results from COLUMN variables only;
24231  * returns SCIP_INVALID if the root node LP was not (yet) solved
24232  *
24233  * @return the part of the objective value of the root node LP that results from COLUMN variables only;
24234  * or SCIP_INVALID if the root node LP was not (yet) solved.
24235  *
24236  * @pre This method can be called if @p scip is in one of the following stages:
24237  * - \ref SCIP_STAGE_INITPRESOLVE
24238  * - \ref SCIP_STAGE_PRESOLVING
24239  * - \ref SCIP_STAGE_EXITPRESOLVE
24240  * - \ref SCIP_STAGE_SOLVING
24241  *
24242  * See \ref SCIP_Stage "SCIP_STAGE" for a complete list of all possible solving stages.
24243  */
24245  SCIP* scip /**< SCIP data structure */
24246  )
24247 {
24248  SCIP_CALL_ABORT( checkStage(scip, "SCIPgetLPRootColumnObjval", FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) );
24249 
24250  return SCIPlpGetRootColumnObjval(scip->lp);
24251 }
24252 
24253 /** gets part of the objective value of the root node LP that results from LOOSE variables only;
24254  * returns SCIP_INVALID if the root node LP was not (yet) solved
24255  *
24256  * @return the part of the objective value of the root node LP that results from LOOSE variables only;
24257  * or SCIP_INVALID if the root node LP was not (yet) solved.
24258  *
24259  * @pre This method can be called if @p scip is in one of the following stages:
24260  * - \ref SCIP_STAGE_INITPRESOLVE
24261  * - \ref SCIP_STAGE_PRESOLVING
24262  * - \ref SCIP_STAGE_EXITPRESOLVE
24263  * - \ref SCIP_STAGE_SOLVING
24264  *
24265  * See \ref SCIP_Stage "SCIP_STAGE" for a complete list of all possible solving stages.
24266  */
24268  SCIP* scip /**< SCIP data structure */
24269  )
24270 {
24271  SCIP_CALL_ABORT( checkStage(scip, "SCIPgetLPRootLooseObjval", FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) );
24272 
24273  return SCIPlpGetRootLooseObjval(scip->lp);
24274 }
24275 
24276 /** gets current LP columns along with the current number of LP columns
24277  *
24278  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
24279  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
24280  *
24281  * @pre This method can be called if @p scip is in one of the following stages:
24282  * - \ref SCIP_STAGE_SOLVING
24283  *
24284  * See \ref SCIP_Stage "SCIP_STAGE" for a complete list of all possible solving stages.
24285  */
24287  SCIP* scip, /**< SCIP data structure */
24288  SCIP_COL*** cols, /**< pointer to store the array of LP columns, or NULL */
24289  int* ncols /**< pointer to store the number of LP columns, or NULL */
24290  )
24291 {
24292  SCIP_CALL( checkStage(scip, "SCIPgetLPColsData", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) );
24293 
24295  {
24296  if( cols != NULL )
24297  *cols = SCIPlpGetCols(scip->lp);
24298  if( ncols != NULL )
24299  *ncols = SCIPlpGetNCols(scip->lp);
24300  }
24301  else
24302  {
24303  if( cols != NULL )
24304  *cols = NULL;
24305  if( ncols != NULL )
24306  *ncols = 0;
24307  }
24308 
24309  return SCIP_OKAY;
24310 }
24311 
24312 /** gets current LP columns
24313  *
24314  * @return the current LP columns.
24315  *
24316  * @pre This method can be called if @p scip is in one of the following stages:
24317  * - \ref SCIP_STAGE_SOLVING
24318  *
24319  * See \ref SCIP_Stage "SCIP_STAGE" for a complete list of all possible solving stages.
24320  */
24322  SCIP* scip /**< SCIP data structure */
24323  )
24324 {
24325  SCIP_CALL_ABORT( checkStage(scip, "SCIPgetLPCols", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) );
24326 
24328  return SCIPlpGetCols(scip->lp);
24329  else
24330  return NULL;
24331 }
24332 
24333 /** gets current number of LP columns
24334  *
24335  * @return the current number of LP columns.
24336  *
24337  * @pre This method can be called if @p scip is in one of the following stages:
24338  * - \ref SCIP_STAGE_SOLVING
24339  *
24340  * See \ref SCIP_Stage "SCIP_STAGE" for a complete list of all possible solving stages.
24341  */
24343  SCIP* scip /**< SCIP data structure */
24344  )
24345 {
24346  SCIP_CALL_ABORT( checkStage(scip, "SCIPgetNLPCols", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) );
24347 
24349  return SCIPlpGetNCols(scip->lp);
24350  else
24351  return 0;
24352 }
24353 
24354 /** gets current LP rows along with the current number of LP rows
24355  *
24356  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
24357  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
24358  *
24359  * @pre This method can be called if @p scip is in one of the following stages:
24360  * - \ref SCIP_STAGE_SOLVING
24361  *
24362  * See \ref SCIP_Stage "SCIP_STAGE" for a complete list of all possible solving stages.
24363  */
24365  SCIP* scip, /**< SCIP data structure */
24366  SCIP_ROW*** rows, /**< pointer to store the array of LP rows, or NULL */
24367  int* nrows /**< pointer to store the number of LP rows, or NULL */
24368  )
24369 {
24370  SCIP_CALL( checkStage(scip, "SCIPgetLPRowsData", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) );
24371 
24373  {
24374  if( rows != NULL )
24375  *rows = SCIPlpGetRows(scip->lp);
24376  if( nrows != NULL )
24377  *nrows = SCIPlpGetNRows(scip->lp);
24378  }
24379  else
24380  {
24381  if( rows != NULL )
24382  *rows = NULL;
24383  if( nrows != NULL )
24384  *nrows = 0;
24385  }
24386 
24387  return SCIP_OKAY;
24388 }
24389 
24390 /** gets current LP rows
24391  *
24392  * @return the current LP rows.
24393  *
24394  * @pre This method can be called if @p scip is in one of the following stages:
24395  * - \ref SCIP_STAGE_SOLVING
24396  *
24397  * See \ref SCIP_Stage "SCIP_STAGE" for a complete list of all possible solving stages.
24398  */
24400  SCIP* scip /**< SCIP data structure */
24401  )
24402 {
24403  SCIP_CALL_ABORT( checkStage(scip, "SCIPgetLPRows", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) );
24404 
24406  return SCIPlpGetRows(scip->lp);
24407  else
24408  return NULL;
24409 }
24410 
24411 /** gets current number of LP rows
24412  *
24413  * @return the current number of LP rows.
24414  *
24415  * @pre This method can be called if @p scip is in one of the following stages:
24416  * - \ref SCIP_STAGE_SOLVING
24417  *
24418  * See \ref SCIP_Stage "SCIP_STAGE" for a complete list of all possible solving stages.
24419  */
24421  SCIP* scip /**< SCIP data structure */
24422  )
24423 {
24424  SCIP_CALL_ABORT( checkStage(scip, "SCIPgetNLPRows", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) );
24425 
24427  return SCIPlpGetNRows(scip->lp);
24428  else
24429  return 0;
24430 }
24431 
24432 /** returns TRUE iff all columns, i.e. every variable with non-empty column w.r.t. all ever created rows, are present
24433  * in the LP, and FALSE, if there are additional already existing columns, that may be added to the LP in pricing
24434  *
24435  * @return TRUE iff all columns, i.e. every variable with non-empty column w.r.t. all ever created rows, are present
24436  * in the LP, and FALSE, if there are additional already existing columns, that may be added to the LP in pricing.
24437  *
24438  * @pre This method can be called if @p scip is in one of the following stages:
24439  * - \ref SCIP_STAGE_SOLVING
24440  *
24441  * See \ref SCIP_Stage "SCIP_STAGE" for a complete list of all possible solving stages.
24442  */
24444  SCIP* scip /**< SCIP data structure */
24445  )
24446 {
24447  SCIP_CALL_ABORT( checkStage(scip, "SCIPallColsInLP", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) );
24448 
24449  return SCIPprobAllColsInLP(scip->transprob, scip->set, scip->lp);
24450 }
24451 
24452 /** returns whether the current LP solution is basic, i.e. is defined by a valid simplex basis
24453  *
24454  * @return whether the current LP solution is basic, i.e. is defined by a valid simplex basis.
24455  *
24456  * @pre This method can be called if @p scip is in one of the following stages:
24457  * - \ref SCIP_STAGE_SOLVING
24458  *
24459  * See \ref SCIP_Stage "SCIP_STAGE" for a complete list of all possible solving stages.
24460  */
24462  SCIP* scip /**< SCIP data structure */
24463  )
24464 {
24465  SCIP_CALL_ABORT( checkStage(scip, "SCIPisLPSolBasic", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) );
24466 
24467  return SCIPlpIsSolBasic(scip->lp);
24468 }
24469 
24470 /** gets all indices of basic columns and rows: index i >= 0 corresponds to column i, index i < 0 to row -i-1
24471  *
24472  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
24473  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
24474  *
24475  * @pre This method can be called if @p scip is in one of the following stages:
24476  * - \ref SCIP_STAGE_SOLVING
24477  *
24478  * See \ref SCIP_Stage "SCIP_STAGE" for a complete list of all possible solving stages.
24479  */
24481  SCIP* scip, /**< SCIP data structure */
24482  int* basisind /**< pointer to store basis indices ready to keep number of rows entries */
24483  )
24484 {
24485  SCIP_CALL( checkStage(scip, "SCIPgetLPBasisInd", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) );
24486 
24487  if( !SCIPlpIsSolBasic(scip->lp) )
24488  {
24489  SCIPerrorMessage("current LP solution is not basic\n");
24490  return SCIP_INVALIDCALL;
24491  }
24492 
24493  SCIP_CALL( SCIPlpGetBasisInd(scip->lp, basisind) );
24494 
24495  return SCIP_OKAY;
24496 }
24497 
24498 /** gets a row from the inverse basis matrix B^-1
24499  *
24500  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
24501  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
24502  *
24503  * @pre This method can be called if @p scip is in one of the following stages:
24504  * - \ref SCIP_STAGE_SOLVING
24505  *
24506  * See \ref SCIP_Stage "SCIP_STAGE" for a complete list of all possible solving stages.
24507  */
24509  SCIP* scip, /**< SCIP data structure */
24510  int r, /**< row number */
24511  SCIP_Real* coef /**< pointer to store the coefficients of the row */
24512  )
24513 {
24514  SCIP_CALL( checkStage(scip, "SCIPgetLPBInvRow", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) );
24515 
24516  if( !SCIPlpIsSolBasic(scip->lp) )
24517  {
24518  SCIPerrorMessage("current LP solution is not basic\n");
24519  return SCIP_INVALIDCALL;
24520  }
24521 
24522  SCIP_CALL( SCIPlpGetBInvRow(scip->lp, r, coef) );
24523 
24524  /* debug check if the coef is the r-th line of the inverse matrix B^-1 */
24525  SCIP_CALL( SCIPdebugCheckBInvRow(scip, r, coef) ); /*lint !e506 !e774*/
24526 
24527  return SCIP_OKAY;
24528 }
24529 
24530 /** gets a column from the inverse basis matrix B^-1
24531  *
24532  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
24533  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
24534  *
24535  * @pre This method can be called if @p scip is in one of the following stages:
24536  * - \ref SCIP_STAGE_SOLVING
24537  *
24538  * See \ref SCIP_Stage "SCIP_STAGE" for a complete list of all possible solving stages.
24539  */
24541  SCIP* scip, /**< SCIP data structure */
24542  int c, /**< column number of B^-1; this is NOT the number of the column in the LP
24543  * returned by SCIPcolGetLPPos(); you have to call SCIPgetBasisInd()
24544  * to get the array which links the B^-1 column numbers to the row and
24545  * column numbers of the LP! c must be between 0 and nrows-1, since the
24546  * basis has the size nrows * nrows */
24547  SCIP_Real* coef /**< pointer to store the coefficients of the column */
24548  )
24549 {
24550  SCIP_CALL( checkStage(scip, "SCIPgetLPBInvCol", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) );
24551 
24552  if( !SCIPlpIsSolBasic(scip->lp) )
24553  {
24554  SCIPerrorMessage("current LP solution is not basic\n");
24555  return SCIP_INVALIDCALL;
24556  }
24557 
24558  SCIP_CALL( SCIPlpGetBInvCol(scip->lp, c, coef) );
24559 
24560  return SCIP_OKAY;
24561 }
24562 
24563 /** gets a row from the product of inverse basis matrix B^-1 and coefficient matrix A (i.e. from B^-1 * A)
24564  *
24565  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
24566  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
24567  *
24568  * @pre This method can be called if @p scip is in one of the following stages:
24569  * - \ref SCIP_STAGE_SOLVING
24570  *
24571  * See \ref SCIP_Stage "SCIP_STAGE" for a complete list of all possible solving stages.
24572  */
24574  SCIP* scip, /**< SCIP data structure */
24575  int r, /**< row number */
24576  SCIP_Real* binvrow, /**< row in B^-1 from prior call to SCIPgetLPBInvRow(), or NULL */
24577  SCIP_Real* coef /**< array to store the coefficients of the row */
24578  )
24579 {
24580  SCIP_CALL( checkStage(scip, "SCIPgetLPBInvARow", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) );
24581 
24582  if( !SCIPlpIsSolBasic(scip->lp) )
24583  {
24584  SCIPerrorMessage("current LP solution is not basic\n");
24585  return SCIP_INVALIDCALL;
24586  }
24587 
24588  SCIP_CALL( SCIPlpGetBInvARow(scip->lp, r, binvrow, coef) );
24589 
24590  return SCIP_OKAY;
24591 }
24592 
24593 /** gets a column from the product of inverse basis matrix B^-1 and coefficient matrix A (i.e. from B^-1 * A),
24594  * i.e., it computes B^-1 * A_c with A_c being the c'th column of A
24595  *
24596  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
24597  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
24598  *
24599  * @pre This method can be called if @p scip is in one of the following stages:
24600  * - \ref SCIP_STAGE_SOLVING
24601  *
24602  * See \ref SCIP_Stage "SCIP_STAGE" for a complete list of all possible solving stages.
24603  */
24605  SCIP* scip, /**< SCIP data structure */
24606  int c, /**< column number which can be accessed by SCIPcolGetLPPos() */
24607  SCIP_Real* coef /**< pointer to store the coefficients of the column */
24608  )
24609 {
24610  SCIP_CALL( checkStage(scip, "SCIPgetLPBInvACol", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) );
24611 
24612  if( !SCIPlpIsSolBasic(scip->lp) )
24613  {
24614  SCIPerrorMessage("current LP solution is not basic\n");
24615  return SCIP_INVALIDCALL;
24616  }
24617 
24618  SCIP_CALL( SCIPlpGetBInvACol(scip->lp, c, coef) );
24619 
24620  return SCIP_OKAY;
24621 }
24622 
24623 /** calculates a weighted sum of all LP rows; for negative weights, the left and right hand side of the corresponding
24624  * LP row are swapped in the summation
24625  *
24626  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
24627  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
24628  *
24629  * @pre This method can be called if @p scip is in one of the following stages:
24630  * - \ref SCIP_STAGE_SOLVING
24631  *
24632  * See \ref SCIP_Stage "SCIP_STAGE" for a complete list of all possible solving stages.
24633  */
24635  SCIP* scip, /**< SCIP data structure */
24636  SCIP_Real* weights, /**< row weights in row summation */
24637  SCIP_REALARRAY* sumcoef, /**< array to store sum coefficients indexed by variables' probindex */
24638  SCIP_Real* sumlhs, /**< pointer to store the left hand side of the row summation */
24639  SCIP_Real* sumrhs /**< pointer to store the right hand side of the row summation */
24640  )
24641 {
24642  SCIP_CALL( checkStage(scip, "SCIPsumLPRows", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) );
24643 
24644  SCIP_CALL( SCIPlpSumRows(scip->lp, scip->set, scip->transprob, weights, sumcoef, sumlhs, sumrhs) );
24645 
24646  return SCIP_OKAY;
24647 }
24648 
24649 /** calculates a MIR cut out of the weighted sum of LP rows; The weights of modifiable rows are set to 0.0, because these
24650  * rows cannot participate in a MIR cut.
24651  *
24652  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
24653  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
24654  *
24655  * @pre This method can be called if @p scip is in one of the following stages:
24656  * - \ref SCIP_STAGE_SOLVING
24657  *
24658  * See \ref SCIP_Stage "SCIP_STAGE" for a complete list of all possible solving stages.
24659  */
24661  SCIP* scip, /**< SCIP data structure */
24662  SCIP_SOL* sol, /**< the solution that should be separated, or NULL for LP solution */
24663  SCIP_Real boundswitch, /**< fraction of domain up to which lower bound is used in transformation */
24664  SCIP_Bool usevbds, /**< should variable bounds be used in bound transformation? */
24665  SCIP_Bool allowlocal, /**< should local information allowed to be used, resulting in a local cut? */
24666  SCIP_Bool fixintegralrhs, /**< should complementation tried to be adjusted such that rhs gets fractional? */
24667  int* boundsfortrans, /**< bounds that should be used for transformed variables: vlb_idx/vub_idx,
24668  * -1 for global lb/ub, -2 for local lb/ub, or -3 for using closest bound;
24669  * NULL for using closest bound for all variables */
24670  SCIP_BOUNDTYPE* boundtypesfortrans, /**< type of bounds that should be used for transformed variables;
24671  * NULL for using closest bound for all variables */
24672  int maxmksetcoefs, /**< maximal number of nonzeros allowed in aggregated base inequality */
24673  SCIP_Real maxweightrange, /**< maximal valid range max(|weights|)/min(|weights|) of row weights */
24674  SCIP_Real minfrac, /**< minimal fractionality of rhs to produce MIR cut for */
24675  SCIP_Real maxfrac, /**< maximal fractionality of rhs to produce MIR cut for */
24676  SCIP_Real* weights, /**< row weights in row summation; some weights might be set to zero */
24677  int* sidetypes, /**< specify row side type (-1 = lhs, 0 = unkown, 1 = rhs) or NULL for automatic choices */
24678  SCIP_Real scale, /**< additional scaling factor multiplied to all rows */
24679  SCIP_Real* mksetcoefs, /**< array to store mixed knapsack set coefficients: size nvars; or NULL */
24680  SCIP_Bool* mksetcoefsvalid, /**< pointer to store whether mixed knapsack set coefficients are valid; or NULL */
24681  SCIP_Real* mircoef, /**< array to store MIR coefficients: must be of size SCIPgetNVars() */
24682  SCIP_Real* mirrhs, /**< pointer to store the right hand side of the MIR row */
24683  SCIP_Real* cutactivity, /**< pointer to store the activity of the resulting cut */
24684  SCIP_Bool* success, /**< pointer to store whether the returned coefficients are a valid MIR cut */
24685  SCIP_Bool* cutislocal, /**< pointer to store whether the returned cut is only valid locally */
24686  int* cutrank /**< pointer to store the rank of the returned cut; or NULL */
24687  )
24688 {
24689  SCIP_CALL( checkStage(scip, "SCIPcalcMIR", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) );
24690 
24691  SCIP_CALL( SCIPlpCalcMIR(scip->lp, scip->set, scip->stat, scip->transprob, sol,
24692  boundswitch, usevbds, allowlocal, fixintegralrhs, boundsfortrans, boundtypesfortrans, maxmksetcoefs,
24693  maxweightrange, minfrac, maxfrac, weights, sidetypes, scale, mksetcoefs, mksetcoefsvalid, mircoef, mirrhs, cutactivity,
24694  success, cutislocal, cutrank) );
24695 
24696  return SCIP_OKAY;
24697 }
24698 
24699 /** calculates a strong CG cut out of the weighted sum of LP rows; The weights of modifiable rows are set to 0.0, because these
24700  * rows cannot participate in a MIR cut.
24701  *
24702  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
24703  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
24704  *
24705  * @pre This method can be called if @p scip is in one of the following stages:
24706  * - \ref SCIP_STAGE_SOLVING
24707  *
24708  * See \ref SCIP_Stage "SCIP_STAGE" for a complete list of all possible solving stages.
24709  */
24711  SCIP* scip, /**< SCIP data structure */
24712  SCIP_Real boundswitch, /**< fraction of domain up to which lower bound is used in transformation */
24713  SCIP_Bool usevbds, /**< should variable bounds be used in bound transformation? */
24714  SCIP_Bool allowlocal, /**< should local information allowed to be used, resulting in a local cut? */
24715  int maxmksetcoefs, /**< maximal number of nonzeros allowed in aggregated base inequality */
24716  SCIP_Real maxweightrange, /**< maximal valid range max(|weights|)/min(|weights|) of row weights */
24717  SCIP_Real minfrac, /**< minimal fractionality of rhs to produce strong CG cut for */
24718  SCIP_Real maxfrac, /**< maximal fractionality of rhs to produce strong CG cut for */
24719  SCIP_Real* weights, /**< row weights in row summation; some weights might be set to zero */
24720  SCIP_Real scale, /**< additional scaling factor multiplied to all rows */
24721  SCIP_Real* mircoef, /**< array to store strong CG coefficients: must be of size SCIPgetNVars() */
24722  SCIP_Real* mirrhs, /**< pointer to store the right hand side of the strong CG row */
24723  SCIP_Real* cutactivity, /**< pointer to store the activity of the resulting cut */
24724  SCIP_Bool* success, /**< pointer to store whether the returned coefficients are a valid strong CG cut */
24725  SCIP_Bool* cutislocal, /**< pointer to store whether the returned cut is only valid locally */
24726  int* cutrank /**< pointer to store the rank of the returned cut; or NULL */
24727  )
24728 {
24729  SCIP_CALL( checkStage(scip, "SCIPcalcStrongCG", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) );
24730 
24731  SCIP_CALL( SCIPlpCalcStrongCG(scip->lp, scip->set, scip->stat, scip->transprob,
24732  boundswitch, usevbds, allowlocal, maxmksetcoefs, maxweightrange, minfrac, maxfrac, weights, scale,
24733  mircoef, mirrhs, cutactivity, success, cutislocal, cutrank) );
24734 
24735  return SCIP_OKAY;
24736 }
24737 
24738 /** writes current LP to a file
24739  *
24740  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
24741  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
24742  *
24743  * @pre This method can be called if @p scip is in one of the following stages:
24744  * - \ref SCIP_STAGE_SOLVING
24745  *
24746  * See \ref SCIP_Stage "SCIP_STAGE" for a complete list of all possible solving stages.
24747  */
24749  SCIP* scip, /**< SCIP data structure */
24750  const char* filename /**< file name */
24751  )
24752 {
24753 
24754  SCIP_Bool cutoff;
24755 
24756  SCIP_CALL( checkStage(scip, "SCIPwriteLP", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) );
24758  {
24759  SCIP_CALL( SCIPconstructCurrentLP(scip->mem->probmem, scip->set, scip->stat, scip->transprob, scip->origprob,
24760  scip->tree, scip->lp, scip->pricestore, scip->sepastore, scip->branchcand, scip->eventqueue,
24761  scip->eventfilter, FALSE, &cutoff) );
24762  }
24763 
24764  /* we need a flushed lp to write the current lp */
24765  SCIP_CALL( SCIPlpFlush(scip->lp, scip->mem->probmem, scip->set, scip->eventqueue) );
24766 
24767  SCIP_CALL( SCIPlpWrite(scip->lp, filename) );
24768 
24769  return SCIP_OKAY;
24770 }
24771 
24772 /** writes MIP relaxation of the current branch-and-bound node to a file
24773  *
24774  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
24775  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
24776  *
24777  * @pre This method can be called if @p scip is in one of the following stages:
24778  * - \ref SCIP_STAGE_SOLVING
24779  *
24780  * See \ref SCIP_Stage "SCIP_STAGE" for a complete list of all possible solving stages.
24781  */
24783  SCIP* scip, /**< SCIP data structure */
24784  const char* filename, /**< file name */
24785  SCIP_Bool genericnames, /**< should generic names like x_i and row_j be used in order to avoid
24786  * troubles with reserved symbols? */
24787  SCIP_Bool origobj, /**< should the original objective function be used? */
24788  SCIP_Bool lazyconss /**< output removable rows as lazy constraints? */
24789  )
24790 {
24791  SCIP_CALL( checkStage(scip, "SCIPwriteMIP", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) );
24792 
24793  /* we need a flushed lp to write the current mip */
24794  SCIP_CALL( SCIPlpFlush(scip->lp, scip->mem->probmem, scip->set, scip->eventqueue) );
24795 
24796  SCIP_CALL( SCIPlpWriteMip(scip->lp, scip->set, scip->messagehdlr, filename, genericnames,
24797  origobj, scip->origprob->objsense, scip->transprob->objscale, scip->transprob->objoffset, lazyconss) );
24798 
24799  return SCIP_OKAY;
24800 }
24801 
24802 /** gets the LP interface of SCIP;
24803  * with the LPI you can use all of the methods defined in lpi/lpi.h;
24804  *
24805  * @warning You have to make sure, that the full internal state of the LPI does not change or is recovered completely
24806  * after the end of the method that uses the LPI. In particular, if you manipulate the LP or its solution
24807  * (e.g. by calling one of the SCIPlpiAdd...() or one of the SCIPlpiSolve...() methods), you have to check in
24808  * advance with SCIPlpiWasSolved() whether the LP is currently solved. If this is the case, you have to make
24809  * sure, the internal solution status is recovered completely at the end of your method. This can be achieved
24810  * by getting the LPI state before applying any LPI manipulations with SCIPlpiGetState() and restoring it
24811  * afterwards with SCIPlpiSetState() and SCIPlpiFreeState(). Additionally you have to resolve the LP with the
24812  * appropriate SCIPlpiSolve...() call in order to reinstall the internal solution status.
24813  *
24814  * @warning Make also sure, that all parameter values that you have changed are set back to their original values.
24815  *
24816  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
24817  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
24818  *
24819  * @pre This method can be called if @p scip is in one of the following stages:
24820  * - \ref SCIP_STAGE_TRANSFORMED
24821  * - \ref SCIP_STAGE_INITPRESOLVE
24822  * - \ref SCIP_STAGE_PRESOLVING
24823  * - \ref SCIP_STAGE_EXITPRESOLVE
24824  * - \ref SCIP_STAGE_PRESOLVED
24825  * - \ref SCIP_STAGE_INITSOLVE
24826  * - \ref SCIP_STAGE_SOLVING
24827  * - \ref SCIP_STAGE_SOLVED
24828  * - \ref SCIP_STAGE_EXITSOLVE
24829  *
24830  * See \ref SCIP_Stage "SCIP_STAGE" for a complete list of all possible solving stages.
24831  */
24833  SCIP* scip, /**< SCIP data structure */
24834  SCIP_LPI** lpi /**< pointer to store the LP interface */
24835  )
24836 {
24837  assert(lpi != NULL);
24838 
24839  SCIP_CALL( checkStage(scip, "SCIPgetLPI", FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE) );
24840 
24841  *lpi = SCIPlpGetLPI(scip->lp);
24842 
24843  return SCIP_OKAY;
24844 }
24845 
24846 /** displays quality information about the current LP solution. An LP solution need to be available; information printed
24847  * is subject to what the LP solver supports
24848  *
24849  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
24850  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
24851  *
24852  * @pre This method can be called if @p scip is in one of the following stages:
24853  * - \ref SCIP_STAGE_INIT
24854  * - \ref SCIP_STAGE_PROBLEM
24855  * - \ref SCIP_STAGE_TRANSFORMED
24856  * - \ref SCIP_STAGE_INITPRESOLVE
24857  * - \ref SCIP_STAGE_PRESOLVING
24858  * - \ref SCIP_STAGE_EXITPRESOLVE
24859  * - \ref SCIP_STAGE_PRESOLVED
24860  * - \ref SCIP_STAGE_SOLVING
24861  * - \ref SCIP_STAGE_SOLVED
24862  * - \ref SCIP_STAGE_FREE
24863  *
24864  * See \ref SCIP_Stage "SCIP_STAGE" for a complete list of all possible solving stages.
24865  *
24866  * @note The printing process is done via the message handler system.
24867  */
24869  SCIP* scip, /**< SCIP data structure */
24870  FILE* file /**< output file (or NULL for standard output) */
24871  )
24872 {
24873  SCIP_LPI* lpi;
24874  SCIP_Real quality;
24875 
24876  SCIP_CALL( checkStage(scip, "SCIPprintLPSolutionQuality", TRUE, TRUE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, TRUE, TRUE, FALSE, FALSE, TRUE) );
24877 
24878  switch( scip->set->stage )
24879  {
24880  case SCIP_STAGE_INIT:
24881  case SCIP_STAGE_PROBLEM:
24884  case SCIP_STAGE_PRESOLVING:
24886  case SCIP_STAGE_PRESOLVED:
24887  SCIPmessageFPrintInfo(scip->messagehdlr, file, "Problem not solving yet, no LP available.\n");
24888  return SCIP_OKAY;
24889 
24890  case SCIP_STAGE_SOLVING:
24891  case SCIP_STAGE_SOLVED:
24892  break;
24893 
24894  default:
24895  SCIPerrorMessage("invalid SCIP stage <%d>\n", scip->set->stage);
24896  return SCIP_INVALIDCALL;
24897  } /*lint !e788*/
24898 
24899  /* note that after diving mode, the LPI may only have the basis information, but SCIPlpiWasSolved() can be false; in
24900  * this case, we will (depending on the LP solver) probably not obtain the quality measure; one solution would be to
24901  * store the results of SCIPlpiGetRealSolQuality() within the SCIP_LP after each LP solve; this would have the added
24902  * advantage, that we reduce direct access to the LPI, but it sounds potentially expensive
24903  */
24904  lpi = SCIPlpGetLPI(scip->lp);
24905  assert(lpi != NULL);
24906 
24908  SCIPmessageFPrintInfo(scip->messagehdlr, file, "Basis matrix condition (estimated): ");
24909  if( quality != SCIP_INVALID ) /*lint !e777*/
24910  SCIPmessageFPrintInfo(scip->messagehdlr, file, "%.6e\n", quality);
24911  else
24912  SCIPmessageFPrintInfo(scip->messagehdlr, file, "not available\n", quality);
24913 
24915  SCIPmessageFPrintInfo(scip->messagehdlr, file, "Basis matrix condition (exact): ");
24916  if( quality != SCIP_INVALID ) /*lint !e777*/
24917  SCIPmessageFPrintInfo(scip->messagehdlr, file, "%.6e\n", quality);
24918  else
24919  SCIPmessageFPrintInfo(scip->messagehdlr, file, "not available\n", quality);
24920 
24921  return SCIP_OKAY;
24922 }
24923 
24924 /** compute relative interior point to current LP
24925  * @see SCIPlpComputeRelIntPoint
24926  *
24927  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
24928  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
24929  *
24930  * @pre This method can be called if @p scip is in one of the following stages:
24931  * - \ref SCIP_STAGE_TRANSFORMED
24932  * - \ref SCIP_STAGE_INITPRESOLVE
24933  * - \ref SCIP_STAGE_PRESOLVING
24934  * - \ref SCIP_STAGE_EXITPRESOLVE
24935  * - \ref SCIP_STAGE_PRESOLVED
24936  * - \ref SCIP_STAGE_SOLVING
24937  * - \ref SCIP_STAGE_SOLVED
24938  *
24939  * See \ref SCIP_Stage "SCIP_STAGE" for a complete list of all possible solving stages.
24940  */
24942  SCIP* scip, /**< SCIP data structure */
24943  SCIP_Bool relaxrows, /**< should the rows be relaxed */
24944  SCIP_Bool inclobjcutoff, /**< should a row for the objective cutoff be included */
24945  SCIP_Real timelimit, /**< time limit for LP solver */
24946  int iterlimit, /**< iteration limit for LP solver */
24947  SCIP_SOL** point /**< relative interior point on exit */
24948  )
24949 {
24950  SCIP_Real* pointvals;
24951  SCIP_Bool success;
24952 
24953  SCIP_CALL( checkStage(scip, "SCIPcomputeLPRelIntPoint", FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE) );
24954 
24955  assert(scip != NULL);
24956  assert(scip->lp != NULL);
24957  assert(point != NULL);
24958 
24959  *point = NULL;
24960 
24961  SCIP_CALL( SCIPallocBufferArray(scip, &pointvals, SCIPlpGetNCols(scip->lp)) );
24962 
24963  SCIP_CALL( SCIPlpComputeRelIntPoint(scip->set, scip->messagehdlr, scip->lp, scip->transprob,
24964  relaxrows, inclobjcutoff, timelimit, iterlimit, pointvals, &success) );
24965 
24966  /* if successful, create new solution with point values */
24967  if( success )
24968  {
24969  int i;
24970 
24971  SCIP_CALL( SCIPcreateSol(scip, point, NULL) );
24972 
24973  for( i = 0; i < SCIPlpGetNCols(scip->lp); ++i )
24974  {
24975  SCIP_CALL( SCIPsetSolVal(scip, *point, SCIPcolGetVar(SCIPlpGetCols(scip->lp)[i]), pointvals[i]) );
24976  }
24977  }
24978 
24979  SCIPfreeBufferArray(scip, &pointvals);
24980 
24981  return SCIP_OKAY;
24982 }
24983 
24984 /*
24985  * LP column methods
24986  */
24987 
24988 /** returns the reduced costs of a column in the last (feasible) LP
24989  *
24990  * @return the reduced costs of a column in the last (feasible) LP
24991  *
24992  * @pre this method can be called in one of the following stages of the SCIP solving process:
24993  * - \ref SCIP_STAGE_SOLVING
24994  */
24996  SCIP* scip, /**< SCIP data structure */
24997  SCIP_COL* col /**< LP column */
24998  )
24999 {
25000  SCIP_CALL_ABORT( checkStage(scip, "SCIPgetColRedcost", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) );
25001 
25002  if( !SCIPtreeHasCurrentNodeLP(scip->tree) )
25003  {
25004  SCIPerrorMessage("cannot get reduced costs, because node LP is not processed\n");
25005  SCIPABORT();
25006  return 0.0; /*lint !e527*/
25007  }
25008 
25009  return SCIPcolGetRedcost(col, scip->stat, scip->lp);
25010 }
25011 
25012 
25013 /** returns the Farkas coefficient of a column in the last (infeasible) LP
25014  *
25015  * @return the Farkas coefficient of a column in the last (infeasible) LP
25016  *
25017  * @pre this method can be called in one of the following stages of the SCIP solving process:
25018  * - \ref SCIP_STAGE_SOLVING
25019  */
25021  SCIP* scip, /**< SCIP data structure */
25022  SCIP_COL* col /**< LP column */
25023  )
25024 {
25025  SCIP_CALL_ABORT( checkStage(scip, "SCIPgetColFarkasCoef", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) );
25026 
25027  if( !SCIPtreeHasCurrentNodeLP(scip->tree) )
25028  {
25029  SCIPerrorMessage("cannot get Farkas coeff, because node LP is not processed\n");
25030  SCIPABORT();
25031  return 0.0; /*lint !e527*/
25032  }
25033 
25034  return SCIPcolGetFarkasCoef(col, scip->stat, scip->lp);
25035 }
25036 
25037 /** marks a column to be not removable from the LP in the current node
25038  *
25039  * @pre this method can be called in the following stage of the SCIP solving process:
25040  * - \ref SCIP_STAGE_SOLVING
25041  */
25043  SCIP* scip, /**< SCIP data structure */
25044  SCIP_COL* col /**< LP column */
25045  )
25046 {
25047  SCIP_CALL_ABORT( checkStage(scip, "SCIPmarkColNotRemovableLocal", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) );
25048 
25049  SCIPcolMarkNotRemovableLocal(col, scip->stat);
25050 }
25051 
25052 /*
25053  * LP row methods
25054  */
25055 
25056 /** creates and captures an LP row from a constraint handler
25057  *
25058  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
25059  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
25060  *
25061  * @pre this method can be called in one of the following stages of the SCIP solving process:
25062  * - \ref SCIP_STAGE_INITSOLVE
25063  * - \ref SCIP_STAGE_SOLVING
25064  */
25066  SCIP* scip, /**< SCIP data structure */
25067  SCIP_ROW** row, /**< pointer to row */
25068  SCIP_CONSHDLR* conshdlr, /**< constraint handler that creates the row */
25069  const char* name, /**< name of row */
25070  int len, /**< number of nonzeros in the row */
25071  SCIP_COL** cols, /**< array with columns of row entries */
25072  SCIP_Real* vals, /**< array with coefficients of row entries */
25073  SCIP_Real lhs, /**< left hand side of row */
25074  SCIP_Real rhs, /**< right hand side of row */
25075  SCIP_Bool local, /**< is row only valid locally? */
25076  SCIP_Bool modifiable, /**< is row modifiable during node processing (subject to column generation)? */
25077  SCIP_Bool removable /**< should the row be removed from the LP due to aging or cleanup? */
25078  )
25079 {
25080  SCIP_CALL( checkStage(scip, "SCIPcreateRowCons", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE) );
25081 
25082  SCIP_CALL( SCIProwCreate(row, scip->mem->probmem, scip->set, scip->stat,
25083  name, len, cols, vals, lhs, rhs, SCIP_ROWORIGINTYPE_CONS, (void*) conshdlr, local, modifiable, removable) );
25084 
25085  return SCIP_OKAY;
25086 }
25087 
25088 /** creates and captures an LP row from a separator
25089  *
25090  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
25091  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
25092  *
25093  * @pre this method can be called in one of the following stages of the SCIP solving process:
25094  * - \ref SCIP_STAGE_INITSOLVE
25095  * - \ref SCIP_STAGE_SOLVING
25096  */
25098  SCIP* scip, /**< SCIP data structure */
25099  SCIP_ROW** row, /**< pointer to row */
25100  SCIP_SEPA* sepa, /**< separator that creates the row */
25101  const char* name, /**< name of row */
25102  int len, /**< number of nonzeros in the row */
25103  SCIP_COL** cols, /**< array with columns of row entries */
25104  SCIP_Real* vals, /**< array with coefficients of row entries */
25105  SCIP_Real lhs, /**< left hand side of row */
25106  SCIP_Real rhs, /**< right hand side of row */
25107  SCIP_Bool local, /**< is row only valid locally? */
25108  SCIP_Bool modifiable, /**< is row modifiable during node processing (subject to column generation)? */
25109  SCIP_Bool removable /**< should the row be removed from the LP due to aging or cleanup? */
25110  )
25111 {
25112  SCIP_CALL( checkStage(scip, "SCIPcreateRowSepa", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE) );
25113 
25114  SCIP_CALL( SCIProwCreate(row, scip->mem->probmem, scip->set, scip->stat,
25115  name, len, cols, vals, lhs, rhs, SCIP_ROWORIGINTYPE_SEPA, (void*) sepa, local, modifiable, removable) );
25116 
25117  return SCIP_OKAY;
25118 }
25119 
25120 /** creates and captures an LP row from an unspecified source
25121  *
25122  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
25123  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
25124  *
25125  * @pre this method can be called in one of the following stages of the SCIP solving process:
25126  * - \ref SCIP_STAGE_INITSOLVE
25127  * - \ref SCIP_STAGE_SOLVING
25128  */
25130  SCIP* scip, /**< SCIP data structure */
25131  SCIP_ROW** row, /**< pointer to row */
25132  const char* name, /**< name of row */
25133  int len, /**< number of nonzeros in the row */
25134  SCIP_COL** cols, /**< array with columns of row entries */
25135  SCIP_Real* vals, /**< array with coefficients of row entries */
25136  SCIP_Real lhs, /**< left hand side of row */
25137  SCIP_Real rhs, /**< right hand side of row */
25138  SCIP_Bool local, /**< is row only valid locally? */
25139  SCIP_Bool modifiable, /**< is row modifiable during node processing (subject to column generation)? */
25140  SCIP_Bool removable /**< should the row be removed from the LP due to aging or cleanup? */
25141  )
25142 {
25143  SCIP_CALL( checkStage(scip, "SCIPcreateRowUnspec", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE) );
25144 
25145  SCIP_CALL( SCIProwCreate(row, scip->mem->probmem, scip->set, scip->stat,
25146  name, len, cols, vals, lhs, rhs, SCIP_ROWORIGINTYPE_UNSPEC, NULL, local, modifiable, removable) );
25147 
25148  return SCIP_OKAY;
25149 }
25150 
25151 /** creates and captures an LP row
25152  *
25153  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
25154  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
25155  *
25156  * @pre this method can be called in one of the following stages of the SCIP solving process:
25157  * - \ref SCIP_STAGE_INITSOLVE
25158  * - \ref SCIP_STAGE_SOLVING
25159  *
25160  * @deprecated Please use SCIPcreateRowCons() or SCIPcreateRowSepa() when calling from a constraint handler or separator in order
25161  * to facilitate correct statistics. If the call is from neither a constraint handler or separator, use SCIPcreateRowUnspec().
25162  */
25164  SCIP* scip, /**< SCIP data structure */
25165  SCIP_ROW** row, /**< pointer to row */
25166  const char* name, /**< name of row */
25167  int len, /**< number of nonzeros in the row */
25168  SCIP_COL** cols, /**< array with columns of row entries */
25169  SCIP_Real* vals, /**< array with coefficients of row entries */
25170  SCIP_Real lhs, /**< left hand side of row */
25171  SCIP_Real rhs, /**< right hand side of row */
25172  SCIP_Bool local, /**< is row only valid locally? */
25173  SCIP_Bool modifiable, /**< is row modifiable during node processing (subject to column generation)? */
25174  SCIP_Bool removable /**< should the row be removed from the LP due to aging or cleanup? */
25175  )
25176 {
25177  SCIP_CALL( checkStage(scip, "SCIPcreateRow", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE) );
25178 
25179  SCIP_CALL( SCIPcreateRowUnspec(scip, row, name, len, cols, vals, lhs, rhs, local, modifiable, removable) );
25180 
25181  return SCIP_OKAY;
25182 }
25183 
25184 /** creates and captures an LP row without any coefficients from a constraint handler
25185  *
25186  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
25187  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
25188  *
25189  * @pre this method can be called in one of the following stages of the SCIP solving process:
25190  * - \ref SCIP_STAGE_INITSOLVE
25191  * - \ref SCIP_STAGE_SOLVING
25192  */
25194  SCIP* scip, /**< SCIP data structure */
25195  SCIP_ROW** row, /**< pointer to row */
25196  SCIP_CONSHDLR* conshdlr, /**< constraint handler that creates the row */
25197  const char* name, /**< name of row */
25198  SCIP_Real lhs, /**< left hand side of row */
25199  SCIP_Real rhs, /**< right hand side of row */
25200  SCIP_Bool local, /**< is row only valid locally? */
25201  SCIP_Bool modifiable, /**< is row modifiable during node processing (subject to column generation)? */
25202  SCIP_Bool removable /**< should the row be removed from the LP due to aging or cleanup? */
25203  )
25204 {
25205  SCIP_CALL( checkStage(scip, "SCIPcreateEmptyRowCons", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE) );
25206 
25207  SCIP_CALL( SCIProwCreate(row, scip->mem->probmem, scip->set, scip->stat,
25208  name, 0, NULL, NULL, lhs, rhs, SCIP_ROWORIGINTYPE_CONS, (void*) conshdlr, local, modifiable, removable) );
25209 
25210  return SCIP_OKAY;
25211 }
25212 
25213 /** creates and captures an LP row without any coefficients from a separator
25214  *
25215  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
25216  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
25217  *
25218  * @pre this method can be called in one of the following stages of the SCIP solving process:
25219  * - \ref SCIP_STAGE_INITSOLVE
25220  * - \ref SCIP_STAGE_SOLVING
25221  */
25223  SCIP* scip, /**< SCIP data structure */
25224  SCIP_ROW** row, /**< pointer to row */
25225  SCIP_SEPA* sepa, /**< separator that creates the row */
25226  const char* name, /**< name of row */
25227  SCIP_Real lhs, /**< left hand side of row */
25228  SCIP_Real rhs, /**< right hand side of row */
25229  SCIP_Bool local, /**< is row only valid locally? */
25230  SCIP_Bool modifiable, /**< is row modifiable during node processing (subject to column generation)? */
25231  SCIP_Bool removable /**< should the row be removed from the LP due to aging or cleanup? */
25232  )
25233 {
25234  SCIP_CALL( checkStage(scip, "SCIPcreateEmptyRowSepa", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE) );
25235 
25236  SCIP_CALL( SCIProwCreate(row, scip->mem->probmem, scip->set, scip->stat,
25237  name, 0, NULL, NULL, lhs, rhs, SCIP_ROWORIGINTYPE_SEPA, (void*) sepa, local, modifiable, removable) );
25238 
25239  return SCIP_OKAY;
25240 }
25241 
25242 /** creates and captures an LP row without any coefficients from an unspecified source
25243  *
25244  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
25245  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
25246  *
25247  * @pre this method can be called in one of the following stages of the SCIP solving process:
25248  * - \ref SCIP_STAGE_INITSOLVE
25249  * - \ref SCIP_STAGE_SOLVING
25250  */
25252  SCIP* scip, /**< SCIP data structure */
25253  SCIP_ROW** row, /**< pointer to row */
25254  const char* name, /**< name of row */
25255  SCIP_Real lhs, /**< left hand side of row */
25256  SCIP_Real rhs, /**< right hand side of row */
25257  SCIP_Bool local, /**< is row only valid locally? */
25258  SCIP_Bool modifiable, /**< is row modifiable during node processing (subject to column generation)? */
25259  SCIP_Bool removable /**< should the row be removed from the LP due to aging or cleanup? */
25260  )
25261 {
25262  SCIP_CALL( checkStage(scip, "SCIPcreateEmptyRowUnspec", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE) );
25263 
25264  SCIP_CALL( SCIProwCreate(row, scip->mem->probmem, scip->set, scip->stat,
25265  name, 0, NULL, NULL, lhs, rhs, SCIP_ROWORIGINTYPE_UNSPEC, NULL, local, modifiable, removable) );
25266 
25267  return SCIP_OKAY;
25268 }
25269 
25270 /** creates and captures an LP row without any coefficients
25271  *
25272  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
25273  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
25274  *
25275  * @pre this method can be called in one of the following stages of the SCIP solving process:
25276  * - \ref SCIP_STAGE_INITSOLVE
25277  * - \ref SCIP_STAGE_SOLVING
25278  *
25279  * @deprecated Please use SCIPcreateEmptyRowCons() or SCIPcreateEmptyRowSepa() when calling from a constraint handler or separator in order
25280  * to facilitate correct statistics. If the call is from neither a constraint handler or separator, use SCIPcreateEmptyRowUnspec().
25281  */
25283  SCIP* scip, /**< SCIP data structure */
25284  SCIP_ROW** row, /**< pointer to row */
25285  const char* name, /**< name of row */
25286  SCIP_Real lhs, /**< left hand side of row */
25287  SCIP_Real rhs, /**< right hand side of row */
25288  SCIP_Bool local, /**< is row only valid locally? */
25289  SCIP_Bool modifiable, /**< is row modifiable during node processing (subject to column generation)? */
25290  SCIP_Bool removable /**< should the row be removed from the LP due to aging or cleanup? */
25291  )
25292 {
25293  SCIP_CALL( checkStage(scip, "SCIPcreateEmptyRow", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE) );
25294 
25295  SCIP_CALL( SCIPcreateEmptyRowUnspec(scip, row, name, lhs, rhs, local, modifiable, removable) );
25296 
25297  return SCIP_OKAY;
25298 }
25299 
25300 /** increases usage counter of LP row
25301  *
25302  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
25303  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
25304  *
25305  * @pre this method can be called in one of the following stages of the SCIP solving process:
25306  * - \ref SCIP_STAGE_INITSOLVE
25307  * - \ref SCIP_STAGE_SOLVING
25308  */
25310  SCIP* scip, /**< SCIP data structure */
25311  SCIP_ROW* row /**< row to capture */
25312  )
25313 {
25314  SCIP_CALL( checkStage(scip, "SCIPcaptureRow", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE) );
25315 
25316  SCIProwCapture(row);
25317 
25318  return SCIP_OKAY;
25319 }
25320 
25321 /** decreases usage counter of LP row, and frees memory if necessary
25322  *
25323  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
25324  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
25325  *
25326  * @pre this method can be called in one of the following stages of the SCIP solving process:
25327  * - \ref SCIP_STAGE_INITSOLVE
25328  * - \ref SCIP_STAGE_SOLVING
25329  * - \ref SCIP_STAGE_EXITSOLVE
25330  */
25332  SCIP* scip, /**< SCIP data structure */
25333  SCIP_ROW** row /**< pointer to LP row */
25334  )
25335 {
25336  SCIP_CALL( checkStage(scip, "SCIPreleaseRow", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, TRUE, FALSE, FALSE) );
25337 
25338  SCIP_CALL( SCIProwRelease(row, scip->mem->probmem, scip->set, scip->lp) );
25339 
25340  return SCIP_OKAY;
25341 }
25342 
25343 /** changes left hand side of LP row
25344  *
25345  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
25346  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
25347  *
25348  * @pre this method can be called in one of the following stages of the SCIP solving process:
25349  * - \ref SCIP_STAGE_INITSOLVE
25350  * - \ref SCIP_STAGE_SOLVING
25351  */
25353  SCIP* scip, /**< SCIP data structure */
25354  SCIP_ROW* row, /**< LP row */
25355  SCIP_Real lhs /**< new left hand side */
25356  )
25357 {
25358  SCIP_CALL( checkStage(scip, "SCIPchgRowLhs", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE) );
25359 
25360  assert(!SCIPlpDiving(scip->lp) || (row->lppos == -1));
25361 
25362  SCIP_CALL( SCIProwChgLhs(row, scip->mem->probmem, scip->set, scip->eventqueue, scip->lp, lhs) );
25363 
25364  return SCIP_OKAY;
25365 }
25366 
25367 /** changes right hand side of LP row
25368  *
25369  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
25370  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
25371  *
25372  * @pre this method can be called in one of the following stages of the SCIP solving process:
25373  * - \ref SCIP_STAGE_INITSOLVE
25374  * - \ref SCIP_STAGE_SOLVING
25375  */
25377  SCIP* scip, /**< SCIP data structure */
25378  SCIP_ROW* row, /**< LP row */
25379  SCIP_Real rhs /**< new right hand side */
25380  )
25381 {
25382  SCIP_CALL( checkStage(scip, "SCIPchgRowRhs", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE) );
25383 
25384  assert(!SCIPlpDiving(scip->lp) || (row->lppos == -1));
25385 
25386  SCIP_CALL( SCIProwChgRhs(row, scip->mem->probmem, scip->set, scip->eventqueue, scip->lp, rhs) );
25387 
25388  return SCIP_OKAY;
25389 }
25390 
25391 /** informs row, that all subsequent additions of variables to the row should be cached and not directly applied;
25392  * after all additions were applied, SCIPflushRowExtensions() must be called;
25393  * while the caching of row extensions is activated, information methods of the row give invalid results;
25394  * caching should be used, if a row is build with SCIPaddVarToRow() calls variable by variable to increase
25395  * the performance
25396  *
25397  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
25398  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
25399  *
25400  * @pre this method can be called in one of the following stages of the SCIP solving process:
25401  * - \ref SCIP_STAGE_INITSOLVE
25402  * - \ref SCIP_STAGE_SOLVING
25403  */
25405  SCIP* scip, /**< SCIP data structure */
25406  SCIP_ROW* row /**< LP row */
25407  )
25408 {
25409  SCIP_CALL( checkStage(scip, "SCIPcacheRowExtensions", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE) );
25410 
25411  /* delay the row sorting */
25412  SCIProwDelaySort(row);
25413 
25414  return SCIP_OKAY;
25415 }
25416 
25417 /** flushes all cached row extensions after a call of SCIPcacheRowExtensions() and merges coefficients with
25418  * equal columns into a single coefficient
25419  *
25420  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
25421  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
25422  *
25423  * @pre this method can be called in one of the following stages of the SCIP solving process:
25424  * - \ref SCIP_STAGE_INITSOLVE
25425  * - \ref SCIP_STAGE_SOLVING
25426  */
25428  SCIP* scip, /**< SCIP data structure */
25429  SCIP_ROW* row /**< LP row */
25430  )
25431 {
25432  SCIP_CALL( checkStage(scip, "SCIPflushRowExtensions", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE) );
25433 
25434  /* force the row sorting, and merge equal column entries */
25435  SCIProwForceSort(row, scip->set);
25436 
25437  return SCIP_OKAY;
25438 }
25439 
25440 /** resolves variable to columns and adds them with the coefficient to the row
25441  *
25442  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
25443  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
25444  *
25445  * @pre this method can be called in one of the following stages of the SCIP solving process:
25446  * - \ref SCIP_STAGE_INITSOLVE
25447  * - \ref SCIP_STAGE_SOLVING
25448  *
25449  * @note In case calling this method in the enforcement process of an lp solution, it might be that some variables,
25450  * that were not yet in the LP (e.g. dynamic columns) will change their lp solution value returned by SCIP.
25451  * For example, a variable, which has a negative objective value, that has no column in the lp yet, is in the lp solution
25452  * on its upper bound (variables with status SCIP_VARSTATUS_LOOSE are in an lp solution on it's best bound), but
25453  * creating the column, changes the solution value (variable than has status SCIP_VARSTATUS_COLUMN, and the
25454  * initialization sets the lp solution value) to 0.0. (This leads to the conclusion that, if a constraint was
25455  * violated, the linear relaxation might not be violated anymore.)
25456  */
25458  SCIP* scip, /**< SCIP data structure */
25459  SCIP_ROW* row, /**< LP row */
25460  SCIP_VAR* var, /**< problem variable */
25461  SCIP_Real val /**< value of coefficient */
25462  )
25463 {
25464  SCIP_CALL( checkStage(scip, "SCIPaddVarToRow", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE) );
25465 
25466  SCIP_CALL( SCIPvarAddToRow(var, scip->mem->probmem, scip->set, scip->stat, scip->eventqueue, scip->transprob, scip->lp, row, val) );
25467 
25468  return SCIP_OKAY;
25469 }
25470 
25471 /** resolves variables to columns and adds them with the coefficients to the row;
25472  * this method caches the row extensions and flushes them afterwards to gain better performance
25473  *
25474  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
25475  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
25476  *
25477  * @pre this method can be called in one of the following stages of the SCIP solving process:
25478  * - \ref SCIP_STAGE_INITSOLVE
25479  * - \ref SCIP_STAGE_SOLVING
25480  */
25482  SCIP* scip, /**< SCIP data structure */
25483  SCIP_ROW* row, /**< LP row */
25484  int nvars, /**< number of variables to add to the row */
25485  SCIP_VAR** vars, /**< problem variables to add */
25486  SCIP_Real* vals /**< values of coefficients */
25487  )
25488 {
25489  int v;
25490 
25491  assert(nvars == 0 || vars != NULL);
25492  assert(nvars == 0 || vals != NULL);
25493 
25494  SCIP_CALL( checkStage(scip, "SCIPaddVarsToRow", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE) );
25495 
25496  /* resize the row to be able to store all variables (at least, if they are COLUMN variables) */
25497  SCIP_CALL( SCIProwEnsureSize(row, scip->mem->probmem, scip->set, SCIProwGetNNonz(row) + nvars) );
25498 
25499  /* delay the row sorting */
25500  SCIProwDelaySort(row);
25501 
25502  /* add the variables to the row */
25503  for( v = 0; v < nvars; ++v )
25504  {
25505  SCIP_CALL( SCIPvarAddToRow(vars[v], scip->mem->probmem, scip->set, scip->stat, scip->eventqueue, scip->transprob, scip->lp,
25506  row, vals[v]) );
25507  }
25508 
25509  /* force the row sorting */
25510  SCIProwForceSort(row, scip->set);
25511 
25512  return SCIP_OKAY;
25513 }
25514 
25515 /** resolves variables to columns and adds them with the same single coefficient to the row;
25516  * this method caches the row extensions and flushes them afterwards to gain better performance
25517  *
25518  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
25519  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
25520  *
25521  * @pre this method can be called in one of the following stages of the SCIP solving process:
25522  * - \ref SCIP_STAGE_INITSOLVE
25523  * - \ref SCIP_STAGE_SOLVING
25524  */
25526  SCIP* scip, /**< SCIP data structure */
25527  SCIP_ROW* row, /**< LP row */
25528  int nvars, /**< number of variables to add to the row */
25529  SCIP_VAR** vars, /**< problem variables to add */
25530  SCIP_Real val /**< unique value of all coefficients */
25531  )
25532 {
25533  int v;
25534 
25535  assert(nvars == 0 || vars != NULL);
25536 
25537  SCIP_CALL( checkStage(scip, "SCIPaddVarsToRowSameCoef", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE) );
25538 
25539  /* resize the row to be able to store all variables (at least, if they are COLUMN variables) */
25540  SCIP_CALL( SCIProwEnsureSize(row, scip->mem->probmem, scip->set, SCIProwGetNNonz(row) + nvars) );
25541 
25542  /* delay the row sorting */
25543  SCIProwDelaySort(row);
25544 
25545  /* add the variables to the row */
25546  for( v = 0; v < nvars; ++v )
25547  {
25548  SCIP_CALL( SCIPvarAddToRow(vars[v], scip->mem->probmem, scip->set, scip->stat, scip->eventqueue, scip->transprob, scip->lp,
25549  row, val) );
25550  }
25551 
25552  /* force the row sorting */
25553  SCIProwForceSort(row, scip->set);
25554 
25555  return SCIP_OKAY;
25556 }
25557 
25558 /** tries to find a value, such that all row coefficients, if scaled with this value become integral
25559  *
25560  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
25561  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
25562  *
25563  * @pre this method can be called in one of the following stages of the SCIP solving process:
25564  * - \ref SCIP_STAGE_INITSOLVE
25565  * - \ref SCIP_STAGE_SOLVING
25566  */
25568  SCIP* scip, /**< SCIP data structure */
25569  SCIP_ROW* row, /**< LP row */
25570  SCIP_Real mindelta, /**< minimal relative allowed difference of scaled coefficient s*c and integral i */
25571  SCIP_Real maxdelta, /**< maximal relative allowed difference of scaled coefficient s*c and integral i */
25572  SCIP_Longint maxdnom, /**< maximal denominator allowed in rational numbers */
25573  SCIP_Real maxscale, /**< maximal allowed scalar */
25574  SCIP_Bool usecontvars, /**< should the coefficients of the continuous variables also be made integral? */
25575  SCIP_Real* intscalar, /**< pointer to store scalar that would make the coefficients integral, or NULL */
25576  SCIP_Bool* success /**< stores whether returned value is valid */
25577  )
25578 {
25579  SCIP_CALL( checkStage(scip, "SCIPcalcRowIntegralScalar", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE) );
25580 
25581  SCIP_CALL( SCIProwCalcIntegralScalar(row, scip->set, mindelta, maxdelta, maxdnom, maxscale,
25582  usecontvars, intscalar, success) );
25583 
25584  return SCIP_OKAY;
25585 }
25586 
25587 /** tries to scale row, s.t. all coefficients (of integer variables) become integral
25588  *
25589  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
25590  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
25591  *
25592  * @pre this method can be called in one of the following stages of the SCIP solving process:
25593  * - \ref SCIP_STAGE_INITSOLVE
25594  * - \ref SCIP_STAGE_SOLVING
25595  */
25597  SCIP* scip, /**< SCIP data structure */
25598  SCIP_ROW* row, /**< LP row */
25599  SCIP_Real mindelta, /**< minimal relative allowed difference of scaled coefficient s*c and integral i */
25600  SCIP_Real maxdelta, /**< maximal relative allowed difference of scaled coefficient s*c and integral i */
25601  SCIP_Longint maxdnom, /**< maximal denominator allowed in rational numbers */
25602  SCIP_Real maxscale, /**< maximal value to scale row with */
25603  SCIP_Bool usecontvars, /**< should the coefficients of the continuous variables also be made integral? */
25604  SCIP_Bool* success /**< stores whether row could be made rational */
25605  )
25606 {
25607  SCIP_CALL( checkStage(scip, "SCIPmakeRowIntegral", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE) );
25608 
25609  SCIP_CALL( SCIProwMakeIntegral(row, scip->mem->probmem, scip->set, scip->eventqueue, scip->stat, scip->lp, mindelta, maxdelta, maxdnom, maxscale,
25610  usecontvars, success) );
25611 
25612  return SCIP_OKAY;
25613 }
25614 
25615 /** marks a row to be not removable from the LP in the current node
25616  *
25617  * @pre this method can be called in the following stage of the SCIP solving process:
25618  * - \ref SCIP_STAGE_SOLVING
25619  */
25621  SCIP* scip, /**< SCIP data structure */
25622  SCIP_ROW* row /**< LP row */
25623  )
25624 {
25625  SCIP_CALL_ABORT( checkStage(scip, "SCIPmarkRowNotRemovableLocal", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) );
25626 
25627  SCIProwMarkNotRemovableLocal(row, scip->stat);
25628 }
25629 
25630 /** returns minimal absolute value of row vector's non-zero coefficients
25631  *
25632  * @return minimal absolute value of row vector's non-zero coefficients
25633  *
25634  * @pre this method can be called in one of the following stages of the SCIP solving process:
25635  * - \ref SCIP_STAGE_INITSOLVE
25636  * - \ref SCIP_STAGE_SOLVING
25637  */
25639  SCIP* scip, /**< SCIP data structure */
25640  SCIP_ROW* row /**< LP row */
25641  )
25642 {
25643  SCIP_CALL_ABORT( checkStage(scip, "SCIPgetRowMinCoef", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE) );
25644 
25645  return SCIProwGetMinval(row, scip->set);
25646 }
25647 
25648 /** returns maximal absolute value of row vector's non-zero coefficients
25649  *
25650  * @return maximal absolute value of row vector's non-zero coefficients
25651  *
25652  * @pre this method can be called in one of the following stages of the SCIP solving process:
25653  * - \ref SCIP_STAGE_INITSOLVE
25654  * - \ref SCIP_STAGE_SOLVING
25655  */
25657  SCIP* scip, /**< SCIP data structure */
25658  SCIP_ROW* row /**< LP row */
25659  )
25660 {
25661  SCIP_CALL_ABORT( checkStage(scip, "SCIPgetRowMaxCoef", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE) );
25662 
25663  return SCIProwGetMaxval(row, scip->set);
25664 }
25665 
25666 /** returns the minimal activity of a row w.r.t. the column's bounds
25667  *
25668  * @return the minimal activity of a row w.r.t. the column's bounds
25669  *
25670  * @pre this method can be called in one of the following stages of the SCIP solving process:
25671  * - \ref SCIP_STAGE_SOLVING
25672  */
25674  SCIP* scip, /**< SCIP data structure */
25675  SCIP_ROW* row /**< LP row */
25676  )
25677 {
25678  SCIP_CALL_ABORT( checkStage(scip, "SCIPgetRowMinActivity", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) );
25679 
25680  return SCIProwGetMinActivity(row, scip->set, scip->stat);
25681 }
25682 
25683 /** returns the maximal activity of a row w.r.t. the column's bounds
25684  *
25685  * @return the maximal activity of a row w.r.t. the column's bounds
25686  *
25687  * @pre this method can be called in one of the following stages of the SCIP solving process:
25688  * - \ref SCIP_STAGE_SOLVING
25689  */
25691  SCIP* scip, /**< SCIP data structure */
25692  SCIP_ROW* row /**< LP row */
25693  )
25694 {
25695  SCIP_CALL_ABORT( checkStage(scip, "SCIPgetRowMaxActivity", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) );
25696 
25697  return SCIProwGetMaxActivity(row, scip->set, scip->stat);
25698 }
25699 
25700 /** recalculates the activity of a row in the last LP solution
25701  *
25702  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
25703  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
25704  *
25705  * @pre this method can be called in one of the following stages of the SCIP solving process:
25706  * - \ref SCIP_STAGE_SOLVING
25707  */
25709  SCIP* scip, /**< SCIP data structure */
25710  SCIP_ROW* row /**< LP row */
25711  )
25712 {
25713  SCIP_CALL( checkStage(scip, "SCIPrecalcRowLPActivity", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) );
25714 
25715  SCIProwRecalcLPActivity(row, scip->stat);
25716 
25717  return SCIP_OKAY;
25718 }
25719 
25720 /** returns the activity of a row in the last LP solution
25721  *
25722  * @return activity of a row in the last LP solution
25723  *
25724  * @pre this method can be called in one of the following stages of the SCIP solving process:
25725  * - \ref SCIP_STAGE_SOLVING
25726  */
25728  SCIP* scip, /**< SCIP data structure */
25729  SCIP_ROW* row /**< LP row */
25730  )
25731 {
25732  SCIP_CALL_ABORT( checkStage(scip, "SCIPgetRowLPActivity", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) );
25733 
25734  return SCIProwGetLPActivity(row, scip->set, scip->stat, scip->lp);
25735 }
25736 
25737 /** returns the feasibility of a row in the last LP solution
25738  *
25739  * @return the feasibility of a row in the last LP solution: negative value means infeasibility
25740  *
25741  * @pre this method can be called in one of the following stages of the SCIP solving process:
25742  * - \ref SCIP_STAGE_SOLVING
25743  */
25745  SCIP* scip, /**< SCIP data structure */
25746  SCIP_ROW* row /**< LP row */
25747  )
25748 {
25749  SCIP_CALL_ABORT( checkStage(scip, "SCIPgetRowLPFeasibility", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) );
25750 
25751  return SCIProwGetLPFeasibility(row, scip->set, scip->stat, scip->lp);
25752 }
25753 
25754 /** recalculates the activity of a row for the current pseudo solution
25755  *
25756  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
25757  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
25758  *
25759  * @pre this method can be called in one of the following stages of the SCIP solving process:
25760  * - \ref SCIP_STAGE_SOLVING
25761  */
25763  SCIP* scip, /**< SCIP data structure */
25764  SCIP_ROW* row /**< LP row */
25765  )
25766 {
25767  SCIP_CALL( checkStage(scip, "SCIPrecalcRowPseudoActivity", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) );
25768 
25769  SCIProwRecalcPseudoActivity(row, scip->stat);
25770 
25771  return SCIP_OKAY;
25772 }
25773 
25774 /** returns the activity of a row for the current pseudo solution
25775  *
25776  * @return the activity of a row for the current pseudo solution
25777  *
25778  * @pre this method can be called in one of the following stages of the SCIP solving process:
25779  * - \ref SCIP_STAGE_SOLVING
25780  */
25782  SCIP* scip, /**< SCIP data structure */
25783  SCIP_ROW* row /**< LP row */
25784  )
25785 {
25786  SCIP_CALL_ABORT( checkStage(scip, "SCIPgetRowPseudoActivity", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) );
25787 
25788  return SCIProwGetPseudoActivity(row, scip->set, scip->stat);
25789 }
25790 
25791 /** returns the feasibility of a row for the current pseudo solution: negative value means infeasibility
25792  *
25793  * @return the feasibility of a row for the current pseudo solution: negative value means infeasibility
25794  *
25795  * @pre this method can be called in one of the following stages of the SCIP solving process:
25796  * - \ref SCIP_STAGE_SOLVING
25797  */
25799  SCIP* scip, /**< SCIP data structure */
25800  SCIP_ROW* row /**< LP row */
25801  )
25802 {
25803  SCIP_CALL_ABORT( checkStage(scip, "SCIPgetRowPseudoFeasibility", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) );
25804 
25805  return SCIProwGetPseudoFeasibility(row, scip->set, scip->stat);
25806 }
25807 
25808 /** recalculates the activity of a row in the last LP or pseudo solution
25809  *
25810  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
25811  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
25812  *
25813  * @pre this method can be called in one of the following stages of the SCIP solving process:
25814  * - \ref SCIP_STAGE_SOLVING
25815  */
25817  SCIP* scip, /**< SCIP data structure */
25818  SCIP_ROW* row /**< LP row */
25819  )
25820 {
25821  SCIP_CALL( checkStage(scip, "SCIPrecalcRowActivity", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) );
25822 
25823  if( SCIPtreeHasCurrentNodeLP(scip->tree) )
25824  SCIProwRecalcLPActivity(row, scip->stat);
25825  else
25826  SCIProwRecalcPseudoActivity(row, scip->stat);
25827 
25828  return SCIP_OKAY;
25829 }
25830 
25831 /** returns the activity of a row in the last LP or pseudo solution
25832  *
25833  * @return the activity of a row in the last LP or pseudo solution
25834  *
25835  * @pre this method can be called in one of the following stages of the SCIP solving process:
25836  * - \ref SCIP_STAGE_SOLVING
25837  */
25839  SCIP* scip, /**< SCIP data structure */
25840  SCIP_ROW* row /**< LP row */
25841  )
25842 {
25843  SCIP_CALL_ABORT( checkStage(scip, "SCIPgetRowActivity", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) );
25844 
25845  if( SCIPtreeHasCurrentNodeLP(scip->tree) )
25846  return SCIProwGetLPActivity(row, scip->set, scip->stat, scip->lp);
25847  else
25848  return SCIProwGetPseudoActivity(row, scip->set, scip->stat);
25849 }
25850 
25851 /** returns the feasibility of a row in the last LP or pseudo solution
25852  *
25853  * @return the feasibility of a row in the last LP or pseudo solution
25854  *
25855  * @pre this method can be called in one of the following stages of the SCIP solving process:
25856  * - \ref SCIP_STAGE_SOLVING
25857  */
25859  SCIP* scip, /**< SCIP data structure */
25860  SCIP_ROW* row /**< LP row */
25861  )
25862 {
25863  SCIP_CALL_ABORT( checkStage(scip, "SCIPgetRowFeasibility", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) );
25864 
25865  if( SCIPtreeHasCurrentNodeLP(scip->tree) )
25866  return SCIProwGetLPFeasibility(row, scip->set, scip->stat, scip->lp);
25867  else
25868  return SCIProwGetPseudoFeasibility(row, scip->set, scip->stat);
25869 }
25870 
25871 /** returns the activity of a row for the given primal solution
25872  *
25873  * @return the activitiy of a row for the given primal solution
25874  *
25875  * @pre this method can be called in one of the following stages of the SCIP solving process:
25876  * - \ref SCIP_STAGE_SOLVING
25877  */
25879  SCIP* scip, /**< SCIP data structure */
25880  SCIP_ROW* row, /**< LP row */
25881  SCIP_SOL* sol /**< primal CIP solution */
25882  )
25883 {
25884  SCIP_CALL_ABORT( checkStage(scip, "SCIPgetRowSolActivity", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE) );
25885 
25886  if( sol != NULL )
25887  return SCIProwGetSolActivity(row, scip->set, scip->stat, sol);
25888  else if( SCIPtreeHasCurrentNodeLP(scip->tree) )
25889  return SCIProwGetLPActivity(row, scip->set, scip->stat, scip->lp);
25890  else
25891  return SCIProwGetPseudoActivity(row, scip->set, scip->stat);
25892 }
25893 
25894 /** returns the feasibility of a row for the given primal solution
25895  *
25896  * @return the feasibility of a row for the given primal solution
25897  *
25898  * @pre this method can be called in one of the following stages of the SCIP solving process:
25899  * - \ref SCIP_STAGE_SOLVING
25900  */
25902  SCIP* scip, /**< SCIP data structure */
25903  SCIP_ROW* row, /**< LP row */
25904  SCIP_SOL* sol /**< primal CIP solution */
25905  )
25906 {
25907  SCIP_CALL_ABORT( checkStage(scip, "SCIPgetRowSolFeasibility", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) );
25908 
25909  if( sol != NULL )
25910  return SCIProwGetSolFeasibility(row, scip->set, scip->stat, sol);
25911  else if( SCIPtreeHasCurrentNodeLP(scip->tree) )
25912  return SCIProwGetLPFeasibility(row, scip->set, scip->stat, scip->lp);
25913  else
25914  return SCIProwGetPseudoFeasibility(row, scip->set, scip->stat);
25915 }
25916 
25917 /** output row to file stream via the message handler system
25918  *
25919  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
25920  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
25921  *
25922  * @pre this method can be called in one of the following stages of the SCIP solving process:
25923  * - \ref SCIP_STAGE_SOLVING
25924  * - \ref SCIP_STAGE_SOLVED
25925  * - \ref SCIP_STAGE_EXITSOLVE
25926  */
25928  SCIP* scip, /**< SCIP data structure */
25929  SCIP_ROW* row, /**< LP row */
25930  FILE* file /**< output file (or NULL for standard output) */
25931  )
25932 {
25933  assert(row != NULL);
25934 
25935  SCIP_CALL( checkStage(scip, "SCIPprintRow", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, FALSE, FALSE) );
25936 
25937  SCIProwPrint(row, scip->messagehdlr, file);
25938 
25939  return SCIP_OKAY;
25940 }
25941 
25942 
25943 /*
25944  * NLP methods
25945  */
25946 
25947 /** returns whether the NLP relaxation has been enabled
25948  *
25949  * If the NLP relaxation is enabled, then SCIP will construct the NLP relaxation when the solving process is about to begin.
25950  * To check whether an NLP is existing, use SCIPisNLPConstructed().
25951  *
25952  * @pre This method can be called if SCIP is in one of the following stages:
25953  * - \ref SCIP_STAGE_INITPRESOLVE
25954  * - \ref SCIP_STAGE_PRESOLVING
25955  * - \ref SCIP_STAGE_EXITPRESOLVE
25956  * - \ref SCIP_STAGE_PRESOLVED
25957  * - \ref SCIP_STAGE_INITSOLVE
25958  * - \ref SCIP_STAGE_SOLVING
25959  *
25960  * @see SCIPenableNLP
25961  */
25963  SCIP* scip /**< SCIP data structure */
25964  )
25965 {
25966  SCIP_CALL_ABORT( checkStage(scip, "SCIPisNLPEnabled", FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE) );
25967 
25968  return scip->set->nlpenabled;
25969 }
25970 
25971 /** marks that there are constraints that are representable by nonlinear rows
25972  *
25973  * This method should be called by a constraint handler if it has constraints that have a representation as nonlinear rows.
25974  *
25975  * The function should be called before the branch-and-bound process is initialized, e.g., when presolve is exiting.
25976  *
25977  * @pre This method can be called if SCIP is in one of the following stages:
25978  * - \ref SCIP_STAGE_INITPRESOLVE
25979  * - \ref SCIP_STAGE_PRESOLVING
25980  * - \ref SCIP_STAGE_EXITPRESOLVE
25981  * - \ref SCIP_STAGE_PRESOLVED
25982  * - \ref SCIP_STAGE_INITSOLVE
25983  * - \ref SCIP_STAGE_SOLVING
25984  */
25986  SCIP* scip /**< SCIP data structure */
25987  )
25988 {
25989  SCIP_CALL_ABORT( checkStage(scip, "SCIPenableNLP", FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE) );
25990 
25991  scip->set->nlpenabled = TRUE;
25992 }
25993 
25994 /** returns, whether an NLP has been constructed
25995  *
25996  * @pre This method can be called if SCIP is in one of the following stages:
25997  * - \ref SCIP_STAGE_INITSOLVE
25998  * - \ref SCIP_STAGE_SOLVING
25999  */
26001  SCIP* scip /**< SCIP data structure */
26002  )
26003 {
26004  SCIP_CALL_ABORT( checkStage(scip, "SCIPisNLPConstructed", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE) );
26005 
26006  return (scip->nlp != NULL);
26007 }
26008 
26009 /** returns whether the NLP has a continuous variable in a nonlinear term
26010  *
26011  * @pre This method can be called if SCIP is in one of the following stages:
26012  * - \ref SCIP_STAGE_INITSOLVE
26013  * - \ref SCIP_STAGE_SOLVING
26014  */
26016  SCIP* scip /**< SCIP data structure */
26017  )
26018 {
26019  SCIP_CALL_ABORT( checkStage(scip, "SCIPhasNLPContinuousNonlinearity", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE) );
26020 
26021  if( scip->nlp == NULL )
26022  {
26023  SCIPerrorMessage("NLP has not been not constructed.\n");
26024  SCIPABORT();
26025  return FALSE; /*lint !e527*/
26026  }
26027 
26028  return SCIPnlpHasContinuousNonlinearity(scip->nlp);
26029 }
26030 
26031 /** gets current NLP variables along with the current number of NLP variables
26032  *
26033  * @pre This method can be called if SCIP is in one of the following stages:
26034  * - \ref SCIP_STAGE_INITSOLVE
26035  * - \ref SCIP_STAGE_SOLVING
26036  */
26038  SCIP* scip, /**< SCIP data structure */
26039  SCIP_VAR*** vars, /**< pointer to store the array of NLP variables, or NULL */
26040  int* nvars /**< pointer to store the number of NLP variables, or NULL */
26041  )
26042 {
26043  SCIP_CALL( checkStage(scip, "SCIPgetNLPVarsData", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE) );
26044 
26045  if( scip->nlp != NULL )
26046  {
26047  if( vars != NULL )
26048  *vars = SCIPnlpGetVars(scip->nlp);
26049  if( nvars != NULL )
26050  *nvars = SCIPnlpGetNVars(scip->nlp);
26051  }
26052  else
26053  {
26054  SCIPerrorMessage("NLP has not been constructed.\n");
26055  return SCIP_INVALIDCALL;
26056  }
26057 
26058  return SCIP_OKAY;
26059 }
26060 
26061 /** gets array with variables of the NLP
26062  *
26063  * @pre This method can be called if SCIP is in one of the following stages:
26064  * - \ref SCIP_STAGE_INITSOLVE
26065  * - \ref SCIP_STAGE_SOLVING
26066  */
26068  SCIP* scip /**< SCIP data structure */
26069  )
26070 {
26071  SCIP_CALL_ABORT( checkStage(scip, "SCIPgetNLPVars", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE) );
26072 
26073  if( scip->nlp == NULL )
26074  {
26075  SCIPerrorMessage("NLP has not been constructed.\n");
26076  SCIPABORT();
26077  return NULL; /*lint !e527*/
26078  }
26079 
26080  return SCIPnlpGetVars(scip->nlp);
26081 }
26082 
26083 /** gets current number of variables in NLP
26084  *
26085  * @pre This method can be called if SCIP is in one of the following stages:
26086  * - \ref SCIP_STAGE_INITSOLVE
26087  * - \ref SCIP_STAGE_SOLVING
26088  */
26090  SCIP* scip /**< SCIP data structure */
26091  )
26092 {
26093  SCIP_CALL_ABORT( checkStage(scip, "SCIPgetNNLPVars", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE) );
26094 
26095  if( scip->nlp == NULL )
26096  {
26097  SCIPerrorMessage("NLP has not been constructed.\n");
26098  SCIPABORT();
26099  return 0; /*lint !e527*/
26100  }
26101 
26102  return SCIPnlpGetNVars(scip->nlp);
26103 }
26104 
26105 /** computes for each variables the number of NLP rows in which the variable appears in a nonlinear var
26106  *
26107  * @pre This method can be called if SCIP is in one of the following stages:
26108  * - \ref SCIP_STAGE_INITSOLVE
26109  * - \ref SCIP_STAGE_SOLVING
26110  */
26112  SCIP* scip, /**< SCIP data structure */
26113  int* nlcount /**< an array of length at least SCIPnlpGetNVars() to store nonlinearity counts of variables */
26114  )
26115 {
26116  SCIP_CALL( checkStage(scip, "SCIPgetNLPVarsNonlinearity", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE) );
26117 
26118  if( scip->nlp == NULL )
26119  {
26120  SCIPerrorMessage("NLP has not been constructed.\n");
26121  return SCIP_INVALIDCALL;
26122  }
26123 
26124  SCIP_CALL( SCIPnlpGetVarsNonlinearity(scip->nlp, nlcount) );
26125 
26126  return SCIP_OKAY;
26127 }
26128 
26129 /** returns dual solution values associated with lower bounds of NLP variables
26130  *
26131  * @pre This method can be called if SCIP is in one of the following stages:
26132  * - \ref SCIP_STAGE_INITSOLVE
26133  * - \ref SCIP_STAGE_SOLVING
26134  */
26136  SCIP* scip /**< SCIP data structure */
26137  )
26138 {
26139  SCIP_CALL_ABORT( checkStage(scip, "SCIPgetNLPVarsLbDualsol", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE) );
26140 
26141  if( scip->nlp == NULL )
26142  {
26143  SCIPerrorMessage("NLP has not been constructed.\n");
26144  SCIPABORT();
26145  return NULL; /*lint !e527*/
26146  }
26147 
26148  return SCIPnlpGetVarsLbDualsol(scip->nlp);
26149 }
26150 
26151 /** returns dual solution values associated with upper bounds of NLP variables
26152  *
26153  * @pre This method can be called if SCIP is in one of the following stages:
26154  * - \ref SCIP_STAGE_INITSOLVE
26155  * - \ref SCIP_STAGE_SOLVING
26156  */
26158  SCIP* scip /**< SCIP data structure */
26159  )
26160 {
26161  SCIP_CALL_ABORT( checkStage(scip, "SCIPgetNLPVarsUbDualsol", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE) );
26162 
26163  if( scip->nlp == NULL )
26164  {
26165  SCIPerrorMessage("NLP has not been constructed.\n");
26166  SCIPABORT();
26167  return NULL; /*lint !e527*/
26168  }
26169 
26170  return SCIPnlpGetVarsUbDualsol(scip->nlp);
26171 }
26172 
26173 /** gets current NLP nonlinear rows along with the current number of NLP nonlinear rows
26174  *
26175  * @pre This method can be called if SCIP is in one of the following stages:
26176  * - \ref SCIP_STAGE_INITSOLVE
26177  * - \ref SCIP_STAGE_SOLVING
26178  */
26180  SCIP* scip, /**< SCIP data structure */
26181  SCIP_NLROW*** nlrows, /**< pointer to store the array of NLP nonlinear rows, or NULL */
26182  int* nnlrows /**< pointer to store the number of NLP nonlinear rows, or NULL */
26183  )
26184 {
26185  SCIP_CALL( checkStage(scip, "SCIPgetNLPNlRowsData", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE) );
26186 
26187  if( scip->nlp == NULL )
26188  {
26189  SCIPerrorMessage("NLP has not been constructed.\n");
26190  return SCIP_INVALIDCALL;
26191  }
26192 
26193  if( nlrows != NULL )
26194  *nlrows = SCIPnlpGetNlRows(scip->nlp);
26195  if( nnlrows != NULL )
26196  *nnlrows = SCIPnlpGetNNlRows(scip->nlp);
26197 
26198  return SCIP_OKAY;
26199 }
26200 
26201 /** gets array with nonlinear rows of the NLP
26202  *
26203  * @pre This method can be called if SCIP is in one of the following stages:
26204  * - \ref SCIP_STAGE_INITSOLVE
26205  * - \ref SCIP_STAGE_SOLVING
26206  */
26208  SCIP* scip /**< SCIP data structure */
26209  )
26210 {
26211  SCIP_CALL_ABORT( checkStage(scip, "SCIPgetNLPNlRows", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE) );
26212 
26213  if( scip->nlp == NULL )
26214  {
26215  SCIPerrorMessage("NLP has not been constructed.\n");
26216  SCIPABORT();
26217  return NULL; /*lint !e527*/
26218  }
26219 
26220  return SCIPnlpGetNlRows(scip->nlp);
26221 }
26222 
26223 /** gets current number of nonlinear rows in NLP
26224  *
26225  * @pre This method can be called if SCIP is in one of the following stages:
26226  * - \ref SCIP_STAGE_INITSOLVE
26227  * - \ref SCIP_STAGE_SOLVING
26228  */
26230  SCIP* scip /**< SCIP data structure */
26231  )
26232 {
26233  SCIP_CALL_ABORT( checkStage(scip, "SCIPgetNNLPNlRows", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE) );
26234 
26235  if( scip->nlp == NULL )
26236  {
26237  SCIPerrorMessage("NLP has not been constructed.\n");
26238  SCIPABORT();
26239  return 0; /*lint !e527*/
26240  }
26241 
26242  return SCIPnlpGetNNlRows(scip->nlp);
26243 }
26244 
26245 /** adds a nonlinear row to the NLP. This row is captured by the NLP.
26246  *
26247  * @pre This method can be called if SCIP is in one of the following stages:
26248  * - \ref SCIP_STAGE_INITSOLVE
26249  * - \ref SCIP_STAGE_SOLVING
26250  */
26252  SCIP* scip, /**< SCIP data structure */
26253  SCIP_NLROW* nlrow /**< nonlinear row to add to NLP */
26254  )
26255 {
26256  SCIP_CALL( checkStage(scip, "SCIPaddNlRow", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE) );
26257 
26258  if( scip->nlp == NULL )
26259  {
26260  SCIPerrorMessage("NLP has not been constructed.\n");
26261  return SCIP_INVALIDCALL;
26262  }
26263 
26264  SCIP_CALL( SCIPnlpAddNlRow(scip->nlp, SCIPblkmem(scip), scip->set, scip->stat, nlrow) );
26265 
26266  return SCIP_OKAY;
26267 }
26268 
26269 /** makes sure that the NLP of the current node is flushed
26270  *
26271  * @pre This method can be called if SCIP is in one of the following stages:
26272  * - \ref SCIP_STAGE_INITSOLVE
26273  * - \ref SCIP_STAGE_SOLVING
26274  */
26276  SCIP* scip /**< SCIP data structure */
26277  )
26278 {
26279  SCIP_CALL( checkStage(scip, "SCIPflushNLP", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE) );
26280 
26281  if( scip->nlp == NULL )
26282  {
26283  SCIPerrorMessage("NLP has not been constructed.\n");
26284  return SCIP_INVALIDCALL;
26285  }
26286 
26287  SCIP_CALL( SCIPnlpFlush(scip->nlp, scip->mem->probmem, scip->set) );
26288 
26289  return SCIP_OKAY;
26290 }
26291 
26292 /** sets or clears initial primal guess for NLP solution (start point for NLP solver)
26293  *
26294  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
26295  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
26296  *
26297  * @pre This method can be called if SCIP is in one of the following stages:
26298  * - \ref SCIP_STAGE_INITSOLVE
26299  * - \ref SCIP_STAGE_SOLVING
26300  */
26302  SCIP* scip, /**< SCIP data structure */
26303  SCIP_Real* initialguess /**< values of initial guess (corresponding to variables from SCIPgetNLPVarsData), or NULL to use no start point */
26304  )
26305 {
26306  SCIP_CALL( checkStage(scip, "SCIPsetNLPInitialGuess", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE) );
26307 
26308  if( scip->nlp == NULL )
26309  {
26310  SCIPerrorMessage("NLP has not been constructed.\n");
26311  return SCIP_INVALIDCALL;
26312  }
26313 
26314  SCIP_CALL( SCIPnlpSetInitialGuess(scip->nlp, SCIPblkmem(scip), initialguess) );
26315 
26316  return SCIP_OKAY;
26317 }
26318 
26319 /** sets initial primal guess for NLP solution (start point for NLP solver)
26320  *
26321  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
26322  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
26323  *
26324  * @pre This method can be called if SCIP is in one of the following stages:
26325  * - \ref SCIP_STAGE_INITSOLVE
26326  * - \ref SCIP_STAGE_SOLVING
26327  */
26329  SCIP* scip, /**< SCIP data structure */
26330  SCIP_SOL* sol /**< solution which values should be taken as initial guess, or NULL for LP solution */
26331  )
26332 {
26333  SCIP_Real* vals;
26334 
26335  SCIP_CALL( checkStage(scip, "SCIPsetNLPInitialGuessSol", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE) );
26336 
26337  if( scip->nlp == NULL )
26338  {
26339  SCIPerrorMessage("NLP has not been constructed.\n");
26340  return SCIP_INVALIDCALL;
26341  }
26342 
26343  SCIP_CALL( SCIPallocBufferArray(scip, &vals, SCIPnlpGetNVars(scip->nlp)) );
26344  SCIP_CALL( SCIPgetSolVals(scip, sol, SCIPnlpGetNVars(scip->nlp), SCIPnlpGetVars(scip->nlp), vals) );
26345  SCIP_CALL( SCIPnlpSetInitialGuess(scip->nlp, SCIPblkmem(scip), vals) );
26346  SCIPfreeBufferArray(scip, &vals);
26347 
26348  return SCIP_OKAY;
26349 }
26350 
26351 /** solves the current NLP
26352  *
26353  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
26354  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
26355  *
26356  * @pre This method can be called if SCIP is in one of the following stages:
26357  * - \ref SCIP_STAGE_INITSOLVE
26358  * - \ref SCIP_STAGE_SOLVING
26359  */
26361  SCIP* scip /**< SCIP data structure */
26362  )
26363 {
26364  SCIP_CALL( checkStage(scip, "SCIPsolveNLP", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE) );
26365 
26366  if( scip->nlp == NULL )
26367  {
26368  SCIPerrorMessage("NLP has not been constructed.\n");
26369  return SCIP_INVALIDCALL;
26370  }
26371 
26372  SCIP_CALL( SCIPnlpSolve(scip->nlp, SCIPblkmem(scip), scip->set, scip->messagehdlr, scip->stat) );
26373 
26374  return SCIP_OKAY;
26375 }
26376 
26377 /** gets solution status of current NLP
26378  *
26379  * @pre This method can be called if SCIP is in one of the following stages:
26380  * - \ref SCIP_STAGE_INITSOLVE
26381  * - \ref SCIP_STAGE_SOLVING
26382  */
26384  SCIP* scip /**< SCIP data structure */
26385  )
26386 {
26387  SCIP_CALL_ABORT( checkStage(scip, "SCIPgetNLPSolstat", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE) );
26388 
26389  if( scip->nlp == NULL )
26390  {
26391  SCIPerrorMessage("NLP has not been constructed.\n");
26392  SCIPABORT();
26393  return SCIP_NLPSOLSTAT_UNKNOWN; /*lint !e527*/
26394  }
26395 
26396  return SCIPnlpGetSolstat(scip->nlp);
26397 }
26398 
26399 /** gets termination status of last NLP solve
26400  *
26401  * @pre This method can be called if SCIP is in one of the following stages:
26402  * - \ref SCIP_STAGE_INITSOLVE
26403  * - \ref SCIP_STAGE_SOLVING
26404  */
26406  SCIP* scip /**< SCIP data structure */
26407  )
26408 {
26409  SCIP_CALL_ABORT( checkStage(scip, "SCIPgetNLPTermstat", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE) );
26410 
26411  if( scip->nlp == NULL )
26412  {
26413  SCIPerrorMessage("NLP has not been constructed.\n");
26414  SCIPABORT();
26415  return SCIP_NLPTERMSTAT_OTHER; /*lint !e527*/
26416  }
26417 
26418  return SCIPnlpGetTermstat(scip->nlp);
26419 }
26420 
26421 /** gives statistics (number of iterations, solving time, ...) of last NLP solve
26422  *
26423  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
26424  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
26425  *
26426  * @pre This method can be called if SCIP is in one of the following stages:
26427  * - \ref SCIP_STAGE_INITSOLVE
26428  * - \ref SCIP_STAGE_SOLVING
26429  */
26431  SCIP* scip, /**< SCIP data structure */
26432  SCIP_NLPSTATISTICS* statistics /**< pointer to store statistics */
26433  )
26434 {
26435  SCIP_CALL( checkStage(scip, "SCIPgetNLPStatistics", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE) );
26436 
26437  if( scip->nlp == NULL )
26438  {
26439  SCIPerrorMessage("NLP has not been constructed.\n");
26440  return SCIP_INVALIDCALL;
26441  }
26442 
26443  SCIP_CALL( SCIPnlpGetStatistics(scip->nlp, statistics) );
26444 
26445  return SCIP_OKAY;
26446 }
26447 
26448 /** gets objective value of current NLP
26449  *
26450  * @pre This method can be called if SCIP is in one of the following stages:
26451  * - \ref SCIP_STAGE_INITSOLVE
26452  * - \ref SCIP_STAGE_SOLVING
26453  */
26455  SCIP* scip /**< SCIP data structure */
26456  )
26457 {
26458  SCIP_CALL_ABORT( checkStage(scip, "SCIPgetNLPObjval", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE) );
26459 
26460  if( scip->nlp != NULL )
26461  {
26462  return SCIPnlpGetObjval(scip->nlp);
26463  }
26464  else
26465  {
26466  SCIPerrorMessage("NLP has not been constructed.\n");
26467  return SCIP_INVALID;
26468  }
26469 }
26470 
26471 /** indicates whether a feasible solution for the current NLP is available
26472  * thus, returns whether the solution status <= feasible
26473  *
26474  * @pre This method can be called if SCIP is in one of the following stages:
26475  * - \ref SCIP_STAGE_INITSOLVE
26476  * - \ref SCIP_STAGE_SOLVING
26477  */
26479  SCIP* scip /**< SCIP data structure */
26480  )
26481 {
26482  SCIP_CALL_ABORT( checkStage(scip, "SCIPhasNLPSolution", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE) );
26483 
26484  if( scip->nlp == NULL )
26485  {
26486  SCIPerrorMessage("NLP has not been constructed.\n");
26487  SCIPABORT();
26488  return FALSE; /*lint !e527*/
26489  }
26490 
26491  return SCIPnlpHasSolution(scip->nlp);
26492 }
26493 
26494 /** gets fractional variables of last NLP solution along with solution values and fractionalities
26495  *
26496  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
26497  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
26498  *
26499  * @pre This method can be called if SCIP is in one of the following stages:
26500  * - \ref SCIP_STAGE_INITSOLVE
26501  * - \ref SCIP_STAGE_SOLVING
26502  */
26504  SCIP* scip, /**< SCIP data structure */
26505  SCIP_VAR*** fracvars, /**< pointer to store the array of NLP fractional variables, or NULL */
26506  SCIP_Real** fracvarssol, /**< pointer to store the array of NLP fractional variables solution values, or NULL */
26507  SCIP_Real** fracvarsfrac, /**< pointer to store the array of NLP fractional variables fractionalities, or NULL */
26508  int* nfracvars, /**< pointer to store the number of NLP fractional variables , or NULL */
26509  int* npriofracvars /**< pointer to store the number of NLP fractional variables with maximal branching priority, or NULL */
26510  )
26511 {
26512  SCIP_CALL( checkStage(scip, "SCIPgetNLPFracVars", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE) );
26513 
26514  if( scip->nlp == NULL )
26515  {
26516  SCIPerrorMessage("NLP has not been constructed.\n");
26517  return SCIP_INVALIDCALL;
26518  }
26519 
26520  SCIP_CALL( SCIPnlpGetFracVars(scip->nlp, SCIPblkmem(scip), scip->set, scip->stat, fracvars, fracvarssol, fracvarsfrac, nfracvars, npriofracvars) );
26521 
26522  return SCIP_OKAY;
26523 }
26524 
26525 /** gets integer parameter of NLP
26526  *
26527  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
26528  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
26529  *
26530  * @pre This method can be called if SCIP is in one of the following stages:
26531  * - \ref SCIP_STAGE_INITSOLVE
26532  * - \ref SCIP_STAGE_SOLVING
26533  */
26535  SCIP* scip, /**< SCIP data structure */
26536  SCIP_NLPPARAM type, /**< parameter number */
26537  int* ival /**< pointer to store the parameter value */
26538  )
26539 {
26540  SCIP_CALL( checkStage(scip, "SCIPgetNLPIntPar", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE) );
26541 
26542  if( scip->nlp == NULL )
26543  {
26544  SCIPerrorMessage("NLP has not been constructed.\n");
26545  return SCIP_INVALIDCALL;
26546  }
26547 
26548  SCIP_CALL( SCIPnlpGetIntPar(scip->nlp, type, ival) );
26549 
26550  return SCIP_OKAY;
26551 }
26552 
26553 /** sets integer parameter of NLP
26554  *
26555  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
26556  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
26557  *
26558  * @pre This method can be called if SCIP is in one of the following stages:
26559  * - \ref SCIP_STAGE_INITSOLVE
26560  * - \ref SCIP_STAGE_SOLVING
26561  */
26563  SCIP* scip, /**< SCIP data structure */
26564  SCIP_NLPPARAM type, /**< parameter number */
26565  int ival /**< parameter value */
26566  )
26567 {
26568  SCIP_CALL( checkStage(scip, "SCIPsetNLPIntPar", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE) );
26569 
26570  if( scip->nlp == NULL )
26571  {
26572  SCIPerrorMessage("NLP has not been constructed.\n");
26573  return SCIP_INVALIDCALL;
26574  }
26575 
26576  SCIP_CALL( SCIPnlpSetIntPar(scip->nlp, type, ival) );
26577 
26578  return SCIP_OKAY;
26579 }
26580 
26581 /** gets floating point parameter of NLP
26582  *
26583  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
26584  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
26585  *
26586  * @pre This method can be called if SCIP is in one of the following stages:
26587  * - \ref SCIP_STAGE_INITSOLVE
26588  * - \ref SCIP_STAGE_SOLVING
26589  */
26591  SCIP* scip, /**< SCIP data structure */
26592  SCIP_NLPPARAM type, /**< parameter number */
26593  SCIP_Real* dval /**< pointer to store the parameter value */
26594  )
26595 {
26596  SCIP_CALL( checkStage(scip, "SCIPgetNLPRealPar", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE) );
26597 
26598  if( scip->nlp == NULL )
26599  {
26600  SCIPerrorMessage("NLP has not been constructed.\n");
26601  return SCIP_INVALIDCALL;
26602  }
26603 
26604  SCIP_CALL( SCIPnlpGetRealPar(scip->nlp, type, dval) );
26605 
26606  return SCIP_OKAY;
26607 }
26608 
26609 /** sets floating point parameter of NLP
26610  *
26611  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
26612  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
26613  *
26614  * @pre This method can be called if SCIP is in one of the following stages:
26615  * - \ref SCIP_STAGE_INITSOLVE
26616  * - \ref SCIP_STAGE_SOLVING
26617  */
26619  SCIP* scip, /**< SCIP data structure */
26620  SCIP_NLPPARAM type, /**< parameter number */
26621  SCIP_Real dval /**< parameter value */
26622  )
26623 {
26624  SCIP_CALL( checkStage(scip, "SCIPsetNLPRealPar", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE) );
26625 
26626  if( scip->nlp == NULL )
26627  {
26628  SCIPerrorMessage("NLP has not been constructed.\n");
26629  return SCIP_INVALIDCALL;
26630  }
26631 
26632  SCIP_CALL( SCIPnlpSetRealPar(scip->nlp, type, dval) );
26633 
26634  return SCIP_OKAY;
26635 }
26636 
26637 /** gets string parameter of NLP
26638  *
26639  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
26640  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
26641  *
26642  * @pre This method can be called if SCIP is in one of the following stages:
26643  * - \ref SCIP_STAGE_INITSOLVE
26644  * - \ref SCIP_STAGE_SOLVING
26645  */
26647  SCIP* scip, /**< SCIP data structure */
26648  SCIP_NLPPARAM type, /**< parameter number */
26649  const char** sval /**< pointer to store the parameter value */
26650  )
26651 {
26652  SCIP_CALL( checkStage(scip, "SCIPgetNLPStringPar", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE) );
26653 
26654  if( scip->nlp == NULL )
26655  {
26656  SCIPerrorMessage("NLP has not been constructed.\n");
26657  return SCIP_INVALIDCALL;
26658  }
26659 
26660  SCIP_CALL( SCIPnlpGetStringPar(scip->nlp, type, sval) );
26661 
26662  return SCIP_OKAY;
26663 }
26664 
26665 /** sets string parameter of NLP
26666  *
26667  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
26668  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
26669  *
26670  * @pre This method can be called if SCIP is in one of the following stages:
26671  * - \ref SCIP_STAGE_INITSOLVE
26672  * - \ref SCIP_STAGE_SOLVING
26673  */
26675  SCIP* scip, /**< SCIP data structure */
26676  SCIP_NLPPARAM type, /**< parameter number */
26677  const char* sval /**< parameter value */
26678  )
26679 {
26680  SCIP_CALL( checkStage(scip, "SCIPsetNLPStringPar", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE) );
26681 
26682  if( scip->nlp == NULL )
26683  {
26684  SCIPerrorMessage("NLP has not been constructed.\n");
26685  return SCIP_INVALIDCALL;
26686  }
26687 
26688  SCIP_CALL( SCIPnlpSetStringPar(scip->nlp, type, sval) );
26689 
26690  return SCIP_OKAY;
26691 }
26692 
26693 /** writes current NLP to a file
26694  *
26695  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
26696  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
26697  *
26698  * @pre This method can be called if SCIP is in one of the following stages:
26699  * - \ref SCIP_STAGE_INITSOLVE
26700  * - \ref SCIP_STAGE_SOLVING
26701  */
26703  SCIP* scip, /**< SCIP data structure */
26704  const char* filename /**< file name */
26705  )
26706 {
26707  SCIP_CALL( checkStage(scip, "SCIPwriteNLP", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE) );
26708 
26709  if( scip->nlp == NULL )
26710  {
26711  SCIPerrorMessage("NLP has not been constructed.\n");
26712  return SCIP_INVALIDCALL;
26713  }
26714 
26715  SCIP_CALL( SCIPnlpWrite(scip->nlp, scip->set, scip->messagehdlr, filename) );
26716 
26717  return SCIP_OKAY;
26718 }
26719 
26720 /** gets the NLP interface and problem used by the SCIP NLP;
26721  * with the NLPI and its problem you can use all of the methods defined in nlpi/nlpi.h;
26722  *
26723  * @warning You have to make sure, that the full internal state of the NLPI does not change or is recovered completely
26724  * after the end of the method that uses the NLPI. In particular, if you manipulate the NLP or its solution
26725  * (e.g. by calling one of the SCIPnlpiAdd...() or the SCIPnlpiSolve() method), you have to check in advance
26726  * whether the NLP is currently solved. If this is the case, you have to make sure, the internal solution
26727  * status is recovered completely at the end of your method. Additionally you have to resolve the NLP with
26728  * SCIPnlpiSolve() in order to reinstall the internal solution status.
26729  *
26730  * @warning Make also sure, that all parameter values that you have changed are set back to their original values.
26731  *
26732  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
26733  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
26734  *
26735  * @pre This method can be called if SCIP is in one of the following stages:
26736  * - \ref SCIP_STAGE_INITSOLVE
26737  * - \ref SCIP_STAGE_SOLVING
26738  */
26740  SCIP* scip, /**< SCIP data structure */
26741  SCIP_NLPI** nlpi, /**< pointer to store the NLP solver interface */
26742  SCIP_NLPIPROBLEM** nlpiproblem /**< pointer to store the NLP solver interface problem */
26743  )
26744 {
26745  assert(nlpi != NULL);
26746  assert(nlpiproblem != NULL);
26747 
26748  SCIP_CALL( checkStage(scip, "SCIPgetNLPI", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE) );
26749 
26750  if( scip->nlp == NULL )
26751  {
26752  SCIPerrorMessage("NLP has not been constructed.\n");
26753  return SCIP_INVALIDCALL;
26754  }
26755 
26756  *nlpi = SCIPnlpGetNLPI(scip->nlp);
26757  *nlpiproblem = SCIPnlpGetNLPIProblem(scip->nlp);
26758 
26759  return SCIP_OKAY;
26760 }
26761 
26762 
26763 /*
26764  * NLP diving methods
26765  */
26766 
26767 /**@name NLP Diving Methods */
26768 /**@{ */
26769 
26770 /** initiates NLP diving
26771  * making methods SCIPchgVarObjDiveNLP(), SCIPchgVarBoundsDiveNLP(), SCIPchgVarsBoundsDiveNLP(), and SCIPsolveDiveNLP() available
26772  *
26773  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
26774  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
26775  *
26776  * @pre This method can be called if SCIP is in one of the following stages:
26777  * - \ref SCIP_STAGE_INITSOLVE
26778  * - \ref SCIP_STAGE_SOLVING
26779  */
26781  SCIP* scip /**< SCIP data structure */
26782  )
26783 {
26784  SCIP_CALL( checkStage(scip, "SCIPstartDiveNLP", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE) );
26785 
26786  if( scip->nlp == NULL )
26787  {
26788  SCIPerrorMessage("NLP has not been constructed.\n");
26789  return SCIP_INVALIDCALL;
26790  }
26791 
26792  SCIP_CALL( SCIPnlpStartDive(scip->nlp, SCIPblkmem(scip), scip->set) );
26793 
26794  return SCIP_OKAY;
26795 }
26796 
26797 /** ends NLP diving
26798  * resets changes made by SCIPchgVarObjDiveNLP(), SCIPchgVarBoundsDiveNLP(), and SCIPchgVarsBoundsDiveNLP()
26799  *
26800  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
26801  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
26802  *
26803  * @pre This method can be called if SCIP is in one of the following stages:
26804  * - \ref SCIP_STAGE_INITSOLVE
26805  * - \ref SCIP_STAGE_SOLVING
26806  */
26808  SCIP* scip /**< SCIP data structure */
26809  )
26810 {
26811  SCIP_CALL( checkStage(scip, "SCIPendDiveNLP", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE) );
26812 
26813  if( scip->nlp == NULL )
26814  {
26815  SCIPerrorMessage("NLP has not been constructed.\n");
26816  return SCIP_INVALIDCALL;
26817  }
26818 
26819  SCIP_CALL( SCIPnlpEndDive(scip->nlp, SCIPblkmem(scip), scip->set) );
26820 
26821  return SCIP_OKAY;
26822 }
26823 
26824 /** changes linear objective coefficient of a variable in diving NLP
26825  *
26826  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
26827  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
26828  *
26829  * @pre This method can be called if SCIP is in one of the following stages:
26830  * - \ref SCIP_STAGE_INITSOLVE
26831  * - \ref SCIP_STAGE_SOLVING
26832  */
26834  SCIP* scip, /**< SCIP data structure */
26835  SCIP_VAR* var, /**< variable which coefficient to change */
26836  SCIP_Real coef /**< new value for coefficient */
26837  )
26838 {
26839  SCIP_CALL( checkStage(scip, "SCIPchgVarObjDiveNLP", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE) );
26840 
26841  if( scip->nlp == NULL )
26842  {
26843  SCIPerrorMessage("NLP has not been constructed.\n");
26844  return SCIP_INVALIDCALL;
26845  }
26846 
26847  SCIP_CALL( SCIPnlpChgVarObjDive(scip->nlp, SCIPblkmem(scip), scip->set, scip->stat, var, coef) );
26848 
26849  return SCIP_OKAY;
26850 }
26851 
26852 /** changes bounds of a variable in diving NLP
26853  *
26854  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
26855  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
26856  *
26857  * @pre This method can be called if SCIP is in one of the following stages:
26858  * - \ref SCIP_STAGE_INITSOLVE
26859  * - \ref SCIP_STAGE_SOLVING
26860  */
26862  SCIP* scip, /**< SCIP data structure */
26863  SCIP_VAR* var, /**< variable which bounds to change */
26864  SCIP_Real lb, /**< new lower bound */
26865  SCIP_Real ub /**< new upper bound */
26866  )
26867 {
26868  SCIP_CALL( checkStage(scip, "SCIPchgVarBoundsDiveNLP", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE) );
26869 
26870  if( scip->nlp == NULL )
26871  {
26872  SCIPerrorMessage("NLP has not been constructed.\n");
26873  return SCIP_INVALIDCALL;
26874  }
26875 
26876  SCIP_CALL( SCIPnlpChgVarBoundsDive(scip->nlp, var, lb, ub) );
26877 
26878  return SCIP_OKAY;
26879 }
26880 
26881 /** changes bounds of a set of variables in diving NLP
26882  *
26883  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
26884  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
26885  *
26886  * @pre This method can be called if SCIP is in one of the following stages:
26887  * - \ref SCIP_STAGE_INITSOLVE
26888  * - \ref SCIP_STAGE_SOLVING
26889  */
26891  SCIP* scip, /**< SCIP data structure */
26892  int nvars, /**< number of variables which bounds to changes */
26893  SCIP_VAR** vars, /**< variables which bounds to change */
26894  SCIP_Real* lbs, /**< new lower bounds */
26895  SCIP_Real* ubs /**< new upper bounds */
26896  )
26897 {
26898  SCIP_CALL( checkStage(scip, "SCIPchgVarsBoundsDiveNLP", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE) );
26899 
26900  if( scip->nlp == NULL )
26901  {
26902  SCIPerrorMessage("NLP has not been constructed.\n");
26903  return SCIP_INVALIDCALL;
26904  }
26905 
26906  SCIP_CALL( SCIPnlpChgVarsBoundsDive(scip->nlp, scip->set, nvars, vars, lbs, ubs) );
26907 
26908  return SCIP_OKAY;
26909 }
26910 
26911 /** solves diving NLP
26912  *
26913  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
26914  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
26915  *
26916  * @pre This method can be called if SCIP is in one of the following stages:
26917  * - \ref SCIP_STAGE_INITSOLVE
26918  * - \ref SCIP_STAGE_SOLVING
26919  */
26921  SCIP* scip /**< SCIP data structure */
26922  )
26923 {
26924  SCIP_CALL( checkStage(scip, "SCIPsolveDiveNLP", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE) );
26925 
26926  if( scip->nlp == NULL )
26927  {
26928  SCIPerrorMessage("NLP has not been constructed.\n");
26929  return SCIP_INVALIDCALL;
26930  }
26931 
26932  SCIP_CALL( SCIPnlpSolveDive(scip->nlp, SCIPblkmem(scip), scip->set, scip->messagehdlr, scip->stat) );
26933 
26934  return SCIP_OKAY;
26935 }
26936 
26937 /**@} */
26938 
26939 
26940 /*
26941  * NLP nonlinear row methods
26942  */
26943 
26944 /** creates and captures an NLP row
26945  *
26946  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
26947  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
26948  *
26949  * @pre This method can be called if SCIP is in one of the following stages:
26950  * - \ref SCIP_STAGE_PRESOLVED
26951  * - \ref SCIP_STAGE_INITSOLVE
26952  * - \ref SCIP_STAGE_SOLVING
26953  */
26955  SCIP* scip, /**< SCIP data structure */
26956  SCIP_NLROW** nlrow, /**< buffer to store pointer to nonlinear row */
26957  const char* name, /**< name of nonlinear row */
26958  SCIP_Real constant, /**< constant */
26959  int nlinvars, /**< number of linear variables */
26960  SCIP_VAR** linvars, /**< linear variables, or NULL if nlinvars == 0 */
26961  SCIP_Real* lincoefs, /**< linear coefficients, or NULL if nlinvars == 0 */
26962  int nquadvars, /**< number variables in quadratic terms */
26963  SCIP_VAR** quadvars, /**< variables in quadratic terms, or NULL if nquadvars == 0 */
26964  int nquadelems, /**< number of elements in quadratic term */
26965  SCIP_QUADELEM* quadelems, /**< elements (i.e., monomials) in quadratic term, or NULL if nquadelems == 0 */
26966  SCIP_EXPRTREE* expression, /**< nonlinear expression, or NULL */
26967  SCIP_Real lhs, /**< left hand side */
26968  SCIP_Real rhs /**< right hand side */
26969  )
26970 {
26971  SCIP_CALL( checkStage(scip, "SCIPcreateNlRow", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE) );
26972 
26973  SCIP_CALL( SCIPnlrowCreate(nlrow, scip->mem->probmem, scip->set,
26974  name, constant, nlinvars, linvars, lincoefs, nquadvars, quadvars, nquadelems, quadelems, expression, lhs, rhs) );
26975 
26976  return SCIP_OKAY;
26977 }
26978 
26979 /** creates and captures an NLP nonlinear row without any coefficients
26980  *
26981  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
26982  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
26983  *
26984  * @pre This method can be called if SCIP is in one of the following stages:
26985  * - \ref SCIP_STAGE_PRESOLVED
26986  * - \ref SCIP_STAGE_INITSOLVE
26987  * - \ref SCIP_STAGE_SOLVING
26988  */
26990  SCIP* scip, /**< SCIP data structure */
26991  SCIP_NLROW** nlrow, /**< pointer to nonlinear row */
26992  const char* name, /**< name of nonlinear row */
26993  SCIP_Real lhs, /**< left hand side */
26994  SCIP_Real rhs /**< right hand side */
26995  )
26996 {
26997  SCIP_CALL( checkStage(scip, "SCIPcreateEmptyNlRow", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE) );
26998 
26999  SCIP_CALL( SCIPnlrowCreate(nlrow, scip->mem->probmem, scip->set,
27000  name, 0.0, 0, NULL, NULL, 0, NULL, 0, NULL, NULL, lhs, rhs) );
27001 
27002  return SCIP_OKAY;
27003 }
27004 
27005 /** creates and captures an NLP row from a linear row
27006  *
27007  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
27008  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
27009  *
27010  * @pre This method can be called if SCIP is in one of the following stages:
27011  * - \ref SCIP_STAGE_PRESOLVED
27012  * - \ref SCIP_STAGE_INITSOLVE
27013  * - \ref SCIP_STAGE_SOLVING
27014  */
27016  SCIP* scip, /**< SCIP data structure */
27017  SCIP_NLROW** nlrow, /**< pointer to nonlinear row */
27018  SCIP_ROW* row /**< the linear row to copy */
27019  )
27020 {
27021  SCIP_CALL( checkStage(scip, "SCIPcreateNlRowFromRow", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE) );
27022 
27023  SCIP_CALL( SCIPnlrowCreateFromRow(nlrow, scip->mem->probmem, scip->set, row) );
27024 
27025  return SCIP_OKAY;
27026 }
27027 
27028 /** increases usage counter of NLP nonlinear row
27029  *
27030  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
27031  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
27032  *
27033  * @pre This method can be called if SCIP is in one of the following stages:
27034  * - \ref SCIP_STAGE_PRESOLVED
27035  * - \ref SCIP_STAGE_INITSOLVE
27036  * - \ref SCIP_STAGE_SOLVING
27037  */
27039  SCIP* scip, /**< SCIP data structure */
27040  SCIP_NLROW* nlrow /**< nonlinear row to capture */
27041  )
27042 {
27043  SCIP_CALL( checkStage(scip, "SCIPcaptureNlRow", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE) );
27044 
27045  SCIPnlrowCapture(nlrow);
27046 
27047  return SCIP_OKAY;
27048 }
27049 
27050 /** decreases usage counter of NLP nonlinear row, and frees memory if necessary
27051  *
27052  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
27053  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
27054  *
27055  * @pre This method can be called if SCIP is in one of the following stages:
27056  * - \ref SCIP_STAGE_PRESOLVED
27057  * - \ref SCIP_STAGE_INITSOLVE
27058  * - \ref SCIP_STAGE_SOLVING
27059  * - \ref SCIP_STAGE_EXITSOLVE
27060  */
27062  SCIP* scip, /**< SCIP data structure */
27063  SCIP_NLROW** nlrow /**< pointer to nonlinear row */
27064  )
27065 {
27066  SCIP_CALL( checkStage(scip, "SCIPreleaseNlRow", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, FALSE, TRUE, FALSE, FALSE) );
27067 
27068  SCIP_CALL( SCIPnlrowRelease(nlrow, scip->mem->probmem, scip->set) );
27069 
27070  return SCIP_OKAY;
27071 }
27072 
27073 /** changes left hand side of NLP nonlinear row
27074  *
27075  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
27076  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
27077  *
27078  * @pre This method can be called if SCIP is in one of the following stages:
27079  * - \ref SCIP_STAGE_PRESOLVED
27080  * - \ref SCIP_STAGE_INITSOLVE
27081  * - \ref SCIP_STAGE_SOLVING
27082  */
27084  SCIP* scip, /**< SCIP data structure */
27085  SCIP_NLROW* nlrow, /**< NLP nonlinear row */
27086  SCIP_Real lhs /**< new left hand side */
27087  )
27088 {
27089  SCIP_CALL( checkStage(scip, "SCIPchgNlRowLhs", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE) );
27090 
27091  SCIP_CALL( SCIPnlrowChgLhs(nlrow, scip->set, scip->stat, scip->nlp, lhs) );
27092 
27093  return SCIP_OKAY;
27094 }
27095 
27096 /** changes right hand side of NLP nonlinear row
27097  *
27098  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
27099  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
27100  *
27101  * @pre This method can be called if SCIP is in one of the following stages:
27102  * - \ref SCIP_STAGE_PRESOLVED
27103  * - \ref SCIP_STAGE_INITSOLVE
27104  * - \ref SCIP_STAGE_SOLVING
27105  */
27107  SCIP* scip, /**< SCIP data structure */
27108  SCIP_NLROW* nlrow, /**< NLP nonlinear row */
27109  SCIP_Real rhs /**< new right hand side */
27110  )
27111 {
27112  SCIP_CALL( checkStage(scip, "SCIPchgNlRowRhs", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE) );
27113 
27114  SCIP_CALL( SCIPnlrowChgRhs(nlrow, scip->set, scip->stat, scip->nlp, rhs) );
27115 
27116  return SCIP_OKAY;
27117 }
27118 
27119 /** changes constant of NLP nonlinear row
27120  *
27121  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
27122  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
27123  *
27124  * @pre This method can be called if SCIP is in one of the following stages:
27125  * - \ref SCIP_STAGE_PRESOLVED
27126  * - \ref SCIP_STAGE_INITSOLVE
27127  * - \ref SCIP_STAGE_SOLVING
27128  */
27130  SCIP* scip, /**< SCIP data structure */
27131  SCIP_NLROW* nlrow, /**< NLP row */
27132  SCIP_Real constant /**< new value for constant */
27133  )
27134 {
27135  SCIP_CALL( checkStage(scip, "SCIPchgNlRowConstant", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE) );
27136 
27137  SCIP_CALL( SCIPnlrowChgConstant(nlrow, scip->set, scip->stat, scip->nlp, constant) );
27138 
27139  return SCIP_OKAY;
27140 }
27141 
27142 /** adds variable with a linear coefficient to the nonlinear row
27143  *
27144  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
27145  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
27146  *
27147  * @pre This method can be called if SCIP is in one of the following stages:
27148  * - \ref SCIP_STAGE_PRESOLVED
27149  * - \ref SCIP_STAGE_INITSOLVE
27150  * - \ref SCIP_STAGE_SOLVING
27151  */
27153  SCIP* scip, /**< SCIP data structure */
27154  SCIP_NLROW* nlrow, /**< NLP row */
27155  SCIP_VAR* var, /**< problem variable */
27156  SCIP_Real val /**< value of coefficient in linear part of row */
27157  )
27158 {
27159  SCIP_CALL( checkStage(scip, "SCIPaddLinearCoefToNlRow", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE) );
27160 
27161  SCIP_CALL( SCIPnlrowAddLinearCoef(nlrow, scip->mem->probmem, scip->set, scip->stat, scip->nlp, var, val) );
27162 
27163  return SCIP_OKAY;
27164 }
27165 
27166 /** adds variables with linear coefficients to the row
27167  *
27168  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
27169  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
27170  *
27171  * @pre This method can be called if SCIP is in one of the following stages:
27172  * - \ref SCIP_STAGE_PRESOLVED
27173  * - \ref SCIP_STAGE_INITSOLVE
27174  * - \ref SCIP_STAGE_SOLVING
27175  */
27177  SCIP* scip, /**< SCIP data structure */
27178  SCIP_NLROW* nlrow, /**< NLP row */
27179  int nvars, /**< number of variables to add to the row */
27180  SCIP_VAR** vars, /**< problem variables to add */
27181  SCIP_Real* vals /**< values of coefficients in linear part of row */
27182  )
27183 {
27184  int v;
27185 
27186  assert(nvars == 0 || vars != NULL);
27187  assert(nvars == 0 || vals != NULL);
27188 
27189  SCIP_CALL( checkStage(scip, "SCIPaddLinearCoefsToNlRow", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE) );
27190 
27191  /* add the variables to the row */
27192  for( v = 0; v < nvars; ++v )
27193  {
27194  SCIP_CALL( SCIPnlrowAddLinearCoef(nlrow, scip->mem->probmem, scip->set, scip->stat, scip->nlp, vars[v], vals[v]) );
27195  }
27196 
27197  return SCIP_OKAY;
27198 }
27199 
27200 /** changes linear coefficient of a variables in a row
27201  * setting the coefficient to 0.0 means that it is removed from the row
27202  * the variable does not need to exists before
27203  *
27204  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
27205  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
27206  *
27207  * @pre This method can be called if SCIP is in one of the following stages:
27208  * - \ref SCIP_STAGE_PRESOLVED
27209  * - \ref SCIP_STAGE_INITSOLVE
27210  * - \ref SCIP_STAGE_SOLVING
27211  */
27213  SCIP* scip, /**< SCIP data structure */
27214  SCIP_NLROW* nlrow, /**< NLP row */
27215  SCIP_VAR* var, /**< variable */
27216  SCIP_Real coef /**< new value of coefficient */
27217  )
27218 {
27219  assert(var != NULL);
27220 
27221  SCIP_CALL( checkStage(scip, "SCIPchgNlRowLinearCoef", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE) );
27222 
27223  SCIP_CALL( SCIPnlrowChgLinearCoef(nlrow, scip->mem->probmem, scip->set, scip->stat, scip->nlp, var, coef) );
27224 
27225  return SCIP_OKAY;
27226 }
27227 
27228 /** adds quadratic variable to the nonlinear row
27229  * after adding a quadratic variable, it can be used to add quadratic elements
27230  *
27231  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
27232  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
27233  *
27234  * @pre This method can be called if SCIP is in one of the following stages:
27235  * - \ref SCIP_STAGE_PRESOLVED
27236  * - \ref SCIP_STAGE_INITSOLVE
27237  * - \ref SCIP_STAGE_SOLVING
27238  */
27240  SCIP* scip, /**< SCIP data structure */
27241  SCIP_NLROW* nlrow, /**< NLP row */
27242  SCIP_VAR* var /**< problem variable */
27243  )
27244 {
27245  SCIP_CALL( checkStage(scip, "SCIPaddQuadVarToNlRow", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE) );
27246 
27247  SCIP_CALL( SCIPnlrowAddQuadVar(nlrow, scip->mem->probmem, scip->set, var) );
27248 
27249  return SCIP_OKAY;
27250 }
27251 
27252 /** adds quadratic variables to the nonlinear row
27253  * after adding quadratic variables, they can be used to add quadratic elements
27254  *
27255  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
27256  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
27257  *
27258  * @pre This method can be called if SCIP is in one of the following stages:
27259  * - \ref SCIP_STAGE_PRESOLVED
27260  * - \ref SCIP_STAGE_INITSOLVE
27261  * - \ref SCIP_STAGE_SOLVING
27262  */
27264  SCIP* scip, /**< SCIP data structure */
27265  SCIP_NLROW* nlrow, /**< NLP row */
27266  int nvars, /**< number of problem variables */
27267  SCIP_VAR** vars /**< problem variables */
27268  )
27269 {
27270  int v;
27271 
27272  assert(nvars == 0 || vars != NULL);
27273 
27274  SCIP_CALL( checkStage(scip, "SCIPaddQuadVarsToNlRow", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE) );
27275 
27276  SCIP_CALL( SCIPnlrowEnsureQuadVarsSize(nlrow, scip->mem->probmem, scip->set, SCIPnlrowGetNQuadVars(nlrow) + nvars) );
27277  for( v = 0; v < nvars; ++v )
27278  {
27279  SCIP_CALL( SCIPnlrowAddQuadVar(nlrow, scip->mem->probmem, scip->set, vars[v]) );
27280  }
27281 
27282  return SCIP_OKAY;
27283 }
27284 
27285 /** add a quadratic element to the nonlinear row
27286  * variable indices of the quadratic element need to be relative to quadratic variables array of row
27287  *
27288  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
27289  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
27290  *
27291  * @pre This method can be called if SCIP is in one of the following stages:
27292  * - \ref SCIP_STAGE_PRESOLVED
27293  * - \ref SCIP_STAGE_INITSOLVE
27294  * - \ref SCIP_STAGE_SOLVING
27295  */
27297  SCIP* scip, /**< SCIP data structure */
27298  SCIP_NLROW* nlrow, /**< NLP row */
27299  SCIP_QUADELEM quadelem /**< quadratic element */
27300  )
27301 {
27302  SCIP_CALL( checkStage(scip, "SCIPaddQuadElementToNlRow", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE) );
27303 
27304  SCIP_CALL( SCIPnlrowAddQuadElement(nlrow, scip->mem->probmem, scip->set, scip->stat, scip->nlp, quadelem) );
27305 
27306  return SCIP_OKAY;
27307 }
27308 
27309 /** adds quadratic elements to the nonlinear row
27310  * variable indices of the quadratic elements need to be relative to quadratic variables array of row
27311  *
27312  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
27313  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
27314  *
27315  * @pre This method can be called if SCIP is in one of the following stages:
27316  * - \ref SCIP_STAGE_PRESOLVED
27317  * - \ref SCIP_STAGE_INITSOLVE
27318  * - \ref SCIP_STAGE_SOLVING
27319  */
27321  SCIP* scip, /**< SCIP data structure */
27322  SCIP_NLROW* nlrow, /**< NLP row */
27323  int nquadelems, /**< number of quadratic elements */
27324  SCIP_QUADELEM* quadelems /**< quadratic elements */
27325  )
27326 {
27327  int v;
27328 
27329  assert(nquadelems == 0 || quadelems != NULL);
27330 
27331  SCIP_CALL( checkStage(scip, "SCIPaddQuadElementsToNlRow", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE) );
27332 
27333  SCIP_CALL( SCIPnlrowEnsureQuadElementsSize(nlrow, scip->mem->probmem, scip->set, SCIPnlrowGetNQuadElems(nlrow) + nquadelems) );
27334  for( v = 0; v < nquadelems; ++v )
27335  {
27336  SCIP_CALL( SCIPnlrowAddQuadElement(nlrow, scip->mem->probmem, scip->set, scip->stat, scip->nlp, quadelems[v]) );
27337  }
27338 
27339  return SCIP_OKAY;
27340 }
27341 
27342 /** changes coefficient in quadratic part of a row
27343  * setting the coefficient in the quadelement to 0.0 means that it is removed from the row
27344  * the element does not need to exists before
27345  *
27346  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
27347  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
27348  *
27349  * @pre This method can be called if SCIP is in one of the following stages:
27350  * - \ref SCIP_STAGE_PRESOLVED
27351  * - \ref SCIP_STAGE_INITSOLVE
27352  * - \ref SCIP_STAGE_SOLVING
27353  */
27355  SCIP* scip, /**< SCIP data structure */
27356  SCIP_NLROW* nlrow, /**< NLP row */
27357  SCIP_QUADELEM quadelement /**< new quadratic element, or update for existing one */
27358  )
27359 {
27360  SCIP_CALL( checkStage(scip, "SCIPchgNlRowQuadElement", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE) );
27361 
27362  SCIP_CALL( SCIPnlrowChgQuadElem(nlrow, scip->mem->probmem, scip->set, scip->stat, scip->nlp, quadelement) );
27363 
27364  return SCIP_OKAY;
27365 }
27366 
27367 /** sets or deletes expression tree in the nonlinear row
27368  *
27369  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
27370  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
27371  *
27372  * @pre This method can be called if SCIP is in one of the following stages:
27373  * - \ref SCIP_STAGE_PRESOLVED
27374  * - \ref SCIP_STAGE_INITSOLVE
27375  * - \ref SCIP_STAGE_SOLVING
27376  */
27378  SCIP* scip, /**< SCIP data structure */
27379  SCIP_NLROW* nlrow, /**< NLP row */
27380  SCIP_EXPRTREE* exprtree /**< expression tree, or NULL */
27381  )
27382 {
27383  SCIP_CALL( checkStage(scip, "SCIPsetNlRowExprtree", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE) );
27384 
27385  SCIP_CALL( SCIPnlrowChgExprtree(nlrow, scip->mem->probmem, scip->set, scip->stat, scip->nlp, exprtree) );
27386 
27387  return SCIP_OKAY;
27388 }
27389 
27390 /** sets a parameter of expression tree in the nonlinear row
27391  *
27392  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
27393  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
27394  *
27395  * @pre This method can be called if SCIP is in one of the following stages:
27396  * - \ref SCIP_STAGE_PRESOLVED
27397  * - \ref SCIP_STAGE_INITSOLVE
27398  * - \ref SCIP_STAGE_SOLVING
27399  */
27401  SCIP* scip, /**< SCIP data structure */
27402  SCIP_NLROW* nlrow, /**< NLP row */
27403  int paramidx, /**< index of parameter in expression tree */
27404  SCIP_Real paramval /**< new value of parameter in expression tree */
27405  )
27406 {
27407  SCIP_CALL( checkStage(scip, "SCIPsetNlRowExprtreeParam", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE) );
27408 
27409  SCIP_CALL( SCIPnlrowChgExprtreeParam(nlrow, scip->mem->probmem, scip->set, scip->stat, scip->nlp, paramidx, paramval) );
27410 
27411  return SCIP_OKAY;
27412 }
27413 
27414 /** sets parameters of expression tree in the nonlinear row
27415  *
27416  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
27417  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
27418  *
27419  * @pre This method can be called if SCIP is in one of the following stages:
27420  * - \ref SCIP_STAGE_PRESOLVED
27421  * - \ref SCIP_STAGE_INITSOLVE
27422  * - \ref SCIP_STAGE_SOLVING
27423  */
27425  SCIP* scip, /**< SCIP data structure */
27426  SCIP_NLROW* nlrow, /**< NLP row */
27427  SCIP_Real* paramvals /**< new values of parameter in expression tree */
27428  )
27429 {
27430  SCIP_CALL( checkStage(scip, "SCIPsetNlRowExprtreeParams", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE) );
27431 
27432  SCIP_CALL( SCIPnlrowChgExprtreeParams(nlrow, scip->mem->probmem, scip->set, scip->stat, scip->nlp, paramvals) );
27433 
27434  return SCIP_OKAY;
27435 }
27436 
27437 /** recalculates the activity of a nonlinear row in the last NLP solution
27438  *
27439  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
27440  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
27441  *
27442  * @pre This method can be called if SCIP is in one of the following stages:
27443  * - \ref SCIP_STAGE_PRESOLVED
27444  * - \ref SCIP_STAGE_INITSOLVE
27445  * - \ref SCIP_STAGE_SOLVING
27446  */
27448  SCIP* scip, /**< SCIP data structure */
27449  SCIP_NLROW* nlrow /**< NLP nonlinear row */
27450  )
27451 {
27452  SCIP_CALL( checkStage(scip, "SCIPrecalcNlRowNLPActivity", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE) );
27453 
27454  if( scip->nlp == NULL )
27455  {
27456  SCIPerrorMessage("do not have NLP for computing NLP activity\n");
27457  return SCIP_INVALIDCALL;
27458  }
27459 
27460  SCIP_CALL( SCIPnlrowRecalcNLPActivity(nlrow, scip->set, scip->stat, scip->nlp) );
27461 
27462  return SCIP_OKAY;
27463 }
27464 
27465 /** returns the activity of a nonlinear row in the last NLP solution
27466  *
27467  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
27468  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
27469  *
27470  * @pre This method can be called if SCIP is in one of the following stages:
27471  * - \ref SCIP_STAGE_INITSOLVE
27472  * - \ref SCIP_STAGE_SOLVING
27473  */
27475  SCIP* scip, /**< SCIP data structure */
27476  SCIP_NLROW* nlrow, /**< NLP nonlinear row */
27477  SCIP_Real* activity /**< pointer to store activity value */
27478  )
27479 {
27480  SCIP_CALL( checkStage(scip, "SCIPgetNlRowNLPActivity", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE) );
27481 
27482  if( scip->nlp == NULL )
27483  {
27484  SCIPerrorMessage("do not have NLP for computing NLP activity\n");
27485  return SCIP_INVALIDCALL;
27486  }
27487 
27488  SCIP_CALL( SCIPnlrowGetNLPActivity(nlrow, scip->set, scip->stat, scip->nlp, activity) );
27489 
27490  return SCIP_OKAY;
27491 }
27492 
27493 /** gives the feasibility of a nonlinear row in the last NLP solution: negative value means infeasibility
27494  *
27495  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
27496  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
27497  *
27498  * @pre This method can be called if SCIP is in one of the following stages:
27499  * - \ref SCIP_STAGE_INITSOLVE
27500  * - \ref SCIP_STAGE_SOLVING
27501  */
27503  SCIP* scip, /**< SCIP data structure */
27504  SCIP_NLROW* nlrow, /**< NLP nonlinear row */
27505  SCIP_Real* feasibility /**< pointer to store feasibility value */
27506  )
27507 {
27508  SCIP_CALL( checkStage(scip, "SCIPgetNlRowNLPFeasibility", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE) );
27509 
27510  if( scip->nlp == NULL )
27511  {
27512  SCIPerrorMessage("do not have NLP for computing NLP feasibility\n");
27513  return SCIP_INVALIDCALL;
27514  }
27515 
27516  SCIP_CALL( SCIPnlrowGetNLPFeasibility(nlrow, scip->set, scip->stat, scip->nlp, feasibility) );
27517 
27518  return SCIP_OKAY;
27519 }
27520 
27521 /** recalculates the activity of a nonlinear row for the current pseudo solution
27522  *
27523  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
27524  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
27525  *
27526  * @pre This method can be called if SCIP is in one of the following stages:
27527  * - \ref SCIP_STAGE_INITSOLVE
27528  * - \ref SCIP_STAGE_SOLVING
27529  */
27531  SCIP* scip, /**< SCIP data structure */
27532  SCIP_NLROW* nlrow /**< NLP nonlinear row */
27533  )
27534 {
27535  SCIP_CALL( checkStage(scip, "SCIPrecalcNlRowPseudoActivity", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE) );
27536 
27537  SCIP_CALL( SCIPnlrowRecalcPseudoActivity(nlrow, scip->set, scip->stat) );
27538 
27539  return SCIP_OKAY;
27540 }
27541 
27542 /** gives the activity of a nonlinear row for the current pseudo solution
27543  *
27544  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
27545  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
27546  *
27547  * @pre This method can be called if SCIP is in one of the following stages:
27548  * - \ref SCIP_STAGE_INITSOLVE
27549  * - \ref SCIP_STAGE_SOLVING
27550  */
27552  SCIP* scip, /**< SCIP data structure */
27553  SCIP_NLROW* nlrow, /**< NLP nonlinear row */
27554  SCIP_Real* pseudoactivity /**< pointer to store pseudo activity value */
27555  )
27556 {
27557  SCIP_CALL( checkStage(scip, "SCIPgetNlRowPseudoActivity", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE) );
27558 
27559  SCIP_CALL( SCIPnlrowGetPseudoActivity(nlrow, scip->set, scip->stat, pseudoactivity) );
27560 
27561  return SCIP_OKAY;
27562 }
27563 
27564 /** gives the feasibility of a nonlinear row for the current pseudo solution: negative value means infeasibility
27565  *
27566  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
27567  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
27568  *
27569  * @pre This method can be called if SCIP is in one of the following stages:
27570  * - \ref SCIP_STAGE_INITSOLVE
27571  * - \ref SCIP_STAGE_SOLVING
27572  */
27574  SCIP* scip, /**< SCIP data structure */
27575  SCIP_NLROW* nlrow, /**< NLP nonlinear row */
27576  SCIP_Real* pseudofeasibility /**< pointer to store pseudo feasibility value */
27577  )
27578 {
27579  SCIP_CALL( checkStage(scip, "SCIPgetNlRowPseudoFeasibility", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE) );
27580 
27581  SCIP_CALL( SCIPnlrowGetPseudoFeasibility(nlrow, scip->set, scip->stat, pseudofeasibility) );
27582 
27583  return SCIP_OKAY;
27584 }
27585 
27586 /** recalculates the activity of a nonlinear row in the last NLP or pseudo solution
27587  *
27588  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
27589  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
27590  *
27591  * @pre This method can be called if SCIP is in one of the following stages:
27592  * - \ref SCIP_STAGE_INITSOLVE
27593  * - \ref SCIP_STAGE_SOLVING
27594  */
27596  SCIP* scip, /**< SCIP data structure */
27597  SCIP_NLROW* nlrow /**< NLP nonlinear row */
27598  )
27599 {
27600  SCIP_CALL( checkStage(scip, "SCIPrecalcNlRowActivity", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE) );
27601 
27602  if( scip->nlp != NULL && SCIPnlpHasCurrentNodeNLP(scip->nlp) && SCIPnlpHasSolution(scip->nlp) )
27603  {
27604  SCIP_CALL( SCIPnlrowRecalcNLPActivity(nlrow, scip->set, scip->stat, scip->nlp) );
27605  }
27606  else
27607  {
27608  SCIP_CALL( SCIPnlrowRecalcPseudoActivity(nlrow, scip->set, scip->stat) );
27609  }
27610 
27611  return SCIP_OKAY;
27612 }
27613 
27614 /** gives the activity of a nonlinear row in the last NLP or pseudo solution
27615  *
27616  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
27617  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
27618  *
27619  * @pre This method can be called if SCIP is in one of the following stages:
27620  * - \ref SCIP_STAGE_INITSOLVE
27621  * - \ref SCIP_STAGE_SOLVING
27622  */
27624  SCIP* scip, /**< SCIP data structure */
27625  SCIP_NLROW* nlrow, /**< NLP nonlinear row */
27626  SCIP_Real* activity /**< pointer to store activity value */
27627  )
27628 {
27629  SCIP_CALL( checkStage(scip, "SCIPgetNlRowActivity", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE) );
27630 
27631  if( scip->nlp != NULL && SCIPnlpHasCurrentNodeNLP(scip->nlp) && SCIPnlpHasSolution(scip->nlp) )
27632  {
27633  SCIP_CALL( SCIPnlrowGetNLPActivity(nlrow, scip->set, scip->stat, scip->nlp, activity) );
27634  }
27635  else
27636  {
27637  SCIP_CALL( SCIPnlrowGetPseudoActivity(nlrow, scip->set, scip->stat, activity) );
27638  }
27639 
27640  return SCIP_OKAY;
27641 }
27642 
27643 /** gives the feasibility of a nonlinear row in the last NLP or pseudo solution
27644  *
27645  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
27646  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
27647  *
27648  * @pre This method can be called if SCIP is in one of the following stages:
27649  * - \ref SCIP_STAGE_INITSOLVE
27650  * - \ref SCIP_STAGE_SOLVING
27651  */
27653  SCIP* scip, /**< SCIP data structure */
27654  SCIP_NLROW* nlrow, /**< NLP nonlinear row */
27655  SCIP_Real* feasibility /**< pointer to store feasibility value */
27656  )
27657 {
27658  SCIP_CALL( checkStage(scip, "SCIPgetNlRowFeasibility", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE) );
27659 
27660  if( scip->nlp != NULL && SCIPnlpHasCurrentNodeNLP(scip->nlp) && SCIPnlpHasSolution(scip->nlp) )
27661  {
27662  SCIP_CALL( SCIPnlrowGetNLPFeasibility(nlrow, scip->set, scip->stat, scip->nlp, feasibility) );
27663  }
27664  else
27665  {
27666  SCIP_CALL( SCIPnlrowGetPseudoFeasibility(nlrow, scip->set, scip->stat, feasibility) );
27667  }
27668 
27669  return SCIP_OKAY;
27670 }
27671 
27672 /** gives the activity of a nonlinear row for the given primal solution or NLP solution or pseudo solution
27673  *
27674  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
27675  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
27676  *
27677  * @pre This method can be called if SCIP is in one of the following stages:
27678  * - \ref SCIP_STAGE_INITSOLVE
27679  * - \ref SCIP_STAGE_SOLVING
27680  */
27682  SCIP* scip, /**< SCIP data structure */
27683  SCIP_NLROW* nlrow, /**< NLP nonlinear row */
27684  SCIP_SOL* sol, /**< primal CIP solution, or NULL for NLP solution of pseudo solution */
27685  SCIP_Real* activity /**< pointer to store activity value */
27686  )
27687 {
27688  SCIP_CALL( checkStage(scip, "SCIPgetNlRowSolActivity", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE) );
27689 
27690  if( sol != NULL )
27691  {
27692  SCIP_CALL( SCIPnlrowGetSolActivity(nlrow, scip->set, scip->stat, sol, activity) );
27693  }
27694  else if( scip->nlp != NULL && SCIPnlpHasCurrentNodeNLP(scip->nlp) && SCIPnlpHasSolution(scip->nlp) )
27695  {
27696  SCIP_CALL( SCIPnlrowGetNLPActivity(nlrow, scip->set, scip->stat, scip->nlp, activity) );
27697  }
27698  else
27699  {
27700  SCIP_CALL( SCIPnlrowGetPseudoActivity(nlrow, scip->set, scip->stat, activity) );
27701  }
27702 
27703  return SCIP_OKAY;
27704 }
27705 
27706 /** gives the feasibility of a nonlinear row for the given primal solution
27707  *
27708  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
27709  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
27710  *
27711  * @pre This method can be called if SCIP is in one of the following stages:
27712  * - \ref SCIP_STAGE_INITSOLVE
27713  * - \ref SCIP_STAGE_SOLVING
27714  */
27716  SCIP* scip, /**< SCIP data structure */
27717  SCIP_NLROW* nlrow, /**< NLP nonlinear row */
27718  SCIP_SOL* sol, /**< primal CIP solution */
27719  SCIP_Real* feasibility /**< pointer to store feasibility value */
27720  )
27721 {
27722  SCIP_CALL( checkStage(scip, "SCIPgetNlRowSolFeasibility", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE) );
27723 
27724  if( sol != NULL )
27725  {
27726  SCIP_CALL( SCIPnlrowGetSolFeasibility(nlrow, scip->set, scip->stat, sol, feasibility) );
27727  }
27728  else if( scip->nlp != NULL && SCIPnlpHasCurrentNodeNLP(scip->nlp) && SCIPnlpHasSolution(scip->nlp) )
27729  {
27730  SCIP_CALL( SCIPnlrowGetNLPFeasibility(nlrow, scip->set, scip->stat, scip->nlp, feasibility) );
27731  }
27732  else
27733  {
27734  SCIP_CALL( SCIPnlrowGetPseudoFeasibility(nlrow, scip->set, scip->stat, feasibility) );
27735  }
27736 
27737  return SCIP_OKAY;
27738 }
27739 
27740 /** gives the minimal and maximal activity of a nonlinear row w.r.t. the variable's bounds
27741  *
27742  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
27743  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
27744  *
27745  * @pre This method can be called if SCIP is in one of the following stages:
27746  * - \ref SCIP_STAGE_PRESOLVED
27747  * - \ref SCIP_STAGE_INITSOLVE
27748  * - \ref SCIP_STAGE_SOLVING
27749  */
27751  SCIP* scip, /**< SCIP data structure */
27752  SCIP_NLROW* nlrow, /**< NLP row */
27753  SCIP_Real* minactivity, /**< buffer to store minimal activity, or NULL */
27754  SCIP_Real* maxactivity /**< buffer to store maximal activity, or NULL */
27755  )
27756 {
27757  SCIP_CALL( checkStage(scip, "SCIPgetNlRowActivityBounds", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE) );
27758 
27759  SCIP_CALL( SCIPnlrowGetActivityBounds(nlrow, scip->set, scip->stat, minactivity, maxactivity) );
27760 
27761  return SCIP_OKAY;
27762 }
27763 
27764 /** output nonlinear row to file stream
27765  *
27766  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
27767  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
27768  *
27769  * @pre This method can be called if SCIP is in one of the following stages:
27770  * - \ref SCIP_STAGE_PRESOLVED
27771  * - \ref SCIP_STAGE_INITSOLVE
27772  * - \ref SCIP_STAGE_SOLVING
27773  */
27775  SCIP* scip, /**< SCIP data structure */
27776  SCIP_NLROW* nlrow, /**< NLP row */
27777  FILE* file /**< output file (or NULL for standard output) */
27778  )
27779 {
27780  assert(nlrow != NULL);
27781 
27782  SCIP_CALL( checkStage(scip, "SCIPprintNlRow", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE) );
27783 
27784  SCIP_CALL( SCIPnlrowPrint(nlrow, scip->messagehdlr, file) );
27785 
27786  return SCIP_OKAY;
27787 }
27788 
27789 /**@name Expression tree methods */
27790 /**@{ */
27791 
27792 /** translate from one value of infinity to another
27793  *
27794  * if val is >= infty1, then give infty2, else give val
27795  */
27796 #define infty2infty(infty1, infty2, val) (val >= infty1 ? infty2 : val)
27797 
27798 /** replaces array of variables in expression tree by corresponding transformed variables
27799  *
27800  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
27801  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
27802  *
27803  * @pre This method can be called if @p scip is in one of the following stages:
27804  * - \ref SCIP_STAGE_TRANSFORMING
27805  * - \ref SCIP_STAGE_TRANSFORMED
27806  * - \ref SCIP_STAGE_INITPRESOLVE
27807  * - \ref SCIP_STAGE_PRESOLVING
27808  * - \ref SCIP_STAGE_EXITPRESOLVE
27809  * - \ref SCIP_STAGE_PRESOLVED
27810  * - \ref SCIP_STAGE_INITSOLVE
27811  * - \ref SCIP_STAGE_SOLVING
27812  * - \ref SCIP_STAGE_SOLVED
27813  * - \ref SCIP_STAGE_EXITSOLVE
27814  * - \ref SCIP_STAGE_FREETRANS
27815  *
27816  * See \ref SCIP_Stage "SCIP_STAGE" for a complete list of all possible solving stages.
27817  */
27819  SCIP* scip, /**< SCIP data structure */
27820  SCIP_EXPRTREE* tree /**< expression tree */
27821  )
27822 {
27823  assert(scip != NULL);
27824  assert(tree != NULL);
27825 
27826  SCIP_CALL( checkStage(scip, "SCIPgetExprtreeTransformedVars", FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE) );
27827 
27828  if( SCIPexprtreeGetNVars(tree) == 0 )
27829  return SCIP_OKAY;
27830 
27832 
27833  return SCIP_OKAY;
27834 }
27835 
27836 /** evaluates an expression tree for a primal solution or LP solution
27837  *
27838  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
27839  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
27840  *
27841  * @pre This method can be called if @p scip is in one of the following stages:
27842  * - \ref SCIP_STAGE_PROBLEM
27843  * - \ref SCIP_STAGE_TRANSFORMING
27844  * - \ref SCIP_STAGE_TRANSFORMED
27845  * - \ref SCIP_STAGE_INITPRESOLVE
27846  * - \ref SCIP_STAGE_PRESOLVING
27847  * - \ref SCIP_STAGE_EXITPRESOLVE
27848  * - \ref SCIP_STAGE_PRESOLVED
27849  * - \ref SCIP_STAGE_INITSOLVE
27850  * - \ref SCIP_STAGE_SOLVING
27851  * - \ref SCIP_STAGE_SOLVED
27852  * - \ref SCIP_STAGE_EXITSOLVE
27853  * - \ref SCIP_STAGE_FREETRANS
27854  *
27855  * See \ref SCIP_Stage "SCIP_STAGE" for a complete list of all possible solving stages.
27856  */
27858  SCIP* scip, /**< SCIP data structure */
27859  SCIP_EXPRTREE* tree, /**< expression tree */
27860  SCIP_SOL* sol, /**< a solution, or NULL for current LP solution */
27861  SCIP_Real* val /**< buffer to store value */
27862  )
27863 {
27864  SCIP_Real* varvals;
27865  int nvars;
27866 
27867  assert(scip != NULL);
27868  assert(tree != NULL);
27869  assert(val != NULL);
27870 
27871  SCIP_CALL( checkStage(scip, "SCIPevalExprtreeSol", FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE) );
27872 
27873  nvars = SCIPexprtreeGetNVars(tree);
27874 
27875  if( nvars == 0 )
27876  {
27877  SCIP_CALL( SCIPexprtreeEval(tree, NULL, val) );
27878  return SCIP_OKAY;
27879  }
27880 
27881  SCIP_CALL( SCIPallocBufferArray(scip, &varvals, nvars) );
27882  SCIP_CALL( SCIPgetSolVals(scip, sol, nvars, SCIPexprtreeGetVars(tree), varvals) );
27883 
27884  SCIP_CALL( SCIPexprtreeEval(tree, varvals, val) );
27885 
27886  SCIPfreeBufferArray(scip, &varvals);
27887 
27888  return SCIP_OKAY;
27889 }
27890 
27891 /** evaluates an expression tree w.r.t. current global bounds
27892  *
27893  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
27894  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
27895  *
27896  * @pre This method can be called if @p scip is in one of the following stages:
27897  * - \ref SCIP_STAGE_PROBLEM
27898  * - \ref SCIP_STAGE_TRANSFORMING
27899  * - \ref SCIP_STAGE_TRANSFORMED
27900  * - \ref SCIP_STAGE_INITPRESOLVE
27901  * - \ref SCIP_STAGE_PRESOLVING
27902  * - \ref SCIP_STAGE_EXITPRESOLVE
27903  * - \ref SCIP_STAGE_PRESOLVED
27904  * - \ref SCIP_STAGE_INITSOLVE
27905  * - \ref SCIP_STAGE_SOLVING
27906  * - \ref SCIP_STAGE_SOLVED
27907  * - \ref SCIP_STAGE_EXITSOLVE
27908  * - \ref SCIP_STAGE_FREETRANS
27909  *
27910  * See \ref SCIP_Stage "SCIP_STAGE" for a complete list of all possible solving stages.
27911  */
27913  SCIP* scip, /**< SCIP data structure */
27914  SCIP_EXPRTREE* tree, /**< expression tree */
27915  SCIP_Real infinity, /**< value to use for infinity */
27916  SCIP_INTERVAL* val /**< buffer to store result */
27917  )
27918 {
27919  SCIP_INTERVAL* varvals;
27920  SCIP_VAR** vars;
27921  int nvars;
27922  int i;
27923 
27924  assert(scip != NULL);
27925  assert(tree != NULL);
27926  assert(val != NULL);
27927 
27928  SCIP_CALL( checkStage(scip, "SCIPevalExprtreeGlobalBounds", FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE) );
27929 
27930  nvars = SCIPexprtreeGetNVars(tree);
27931 
27932  if( nvars == 0 )
27933  {
27934  SCIP_CALL( SCIPexprtreeEvalInt(tree, infinity, NULL, val) );
27935  return SCIP_OKAY;
27936  }
27937 
27938  vars = SCIPexprtreeGetVars(tree);
27939  assert(vars != NULL);
27940 
27941  SCIP_CALL( SCIPallocBufferArray(scip, &varvals, nvars) );
27942  for( i = 0; i < nvars; ++i )
27943  {
27944  SCIPintervalSetBounds(&varvals[i],
27945  -infty2infty(SCIPinfinity(scip), infinity, -SCIPvarGetLbGlobal(vars[i])), /*lint !e666*/
27946  infty2infty(SCIPinfinity(scip), infinity, SCIPvarGetUbGlobal(vars[i]))); /*lint !e666*/
27947  }
27948 
27949  SCIP_CALL( SCIPexprtreeEvalInt(tree, infinity, varvals, val) );
27950 
27951  SCIPfreeBufferArray(scip, &varvals);
27952 
27953  return SCIP_OKAY;
27954 }
27955 
27956 /** evaluates an expression tree w.r.t. current local bounds
27957  *
27958  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
27959  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
27960  *
27961  * @pre This method can be called if @p scip is in one of the following stages:
27962  * - \ref SCIP_STAGE_PROBLEM
27963  * - \ref SCIP_STAGE_TRANSFORMING
27964  * - \ref SCIP_STAGE_TRANSFORMED
27965  * - \ref SCIP_STAGE_INITPRESOLVE
27966  * - \ref SCIP_STAGE_PRESOLVING
27967  * - \ref SCIP_STAGE_EXITPRESOLVE
27968  * - \ref SCIP_STAGE_PRESOLVED
27969  * - \ref SCIP_STAGE_INITSOLVE
27970  * - \ref SCIP_STAGE_SOLVING
27971  * - \ref SCIP_STAGE_SOLVED
27972  * - \ref SCIP_STAGE_EXITSOLVE
27973  * - \ref SCIP_STAGE_FREETRANS
27974  *
27975  * See \ref SCIP_Stage "SCIP_STAGE" for a complete list of all possible solving stages.
27976  */
27978  SCIP* scip, /**< SCIP data structure */
27979  SCIP_EXPRTREE* tree, /**< expression tree */
27980  SCIP_Real infinity, /**< value to use for infinity */
27981  SCIP_INTERVAL* val /**< buffer to store result */
27982  )
27983 {
27984  SCIP_INTERVAL* varvals;
27985  SCIP_VAR** vars;
27986  int nvars;
27987  int i;
27988 
27989  assert(scip != NULL);
27990  assert(tree != NULL);
27991  assert(val != NULL);
27992 
27993  SCIP_CALL( checkStage(scip, "SCIPevalExprtreeLocalBounds", FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE) );
27994 
27995  nvars = SCIPexprtreeGetNVars(tree);
27996 
27997  if( nvars == 0 )
27998  {
27999  SCIP_CALL( SCIPexprtreeEvalInt(tree, infinity, NULL, val) );
28000  return SCIP_OKAY;
28001  }
28002 
28003  vars = SCIPexprtreeGetVars(tree);
28004  assert(vars != NULL);
28005 
28006  SCIP_CALL( SCIPallocBufferArray(scip, &varvals, nvars) );
28007  for( i = 0; i < nvars; ++i )
28008  {
28009  /* due to numerics, the lower bound on a variable in SCIP can be slightly higher than the upper bound
28010  * in this case, we take the most conservative way and switch the bounds
28011  * further, we translate SCIP's value for infinity to the users value for infinity
28012  */
28013  SCIPintervalSetBounds(&varvals[i],
28014  -infty2infty(SCIPinfinity(scip), infinity, -MIN(SCIPvarGetLbLocal(vars[i]), SCIPvarGetUbLocal(vars[i]))), /*lint !e666*/
28015  infty2infty(SCIPinfinity(scip), infinity, MAX(SCIPvarGetLbLocal(vars[i]), SCIPvarGetUbLocal(vars[i])))); /*lint !e666*/
28016  }
28017 
28018  SCIP_CALL( SCIPexprtreeEvalInt(tree, infinity, varvals, val) );
28019 
28020  SCIPfreeBufferArray(scip, &varvals);
28021 
28022  return SCIP_OKAY;
28023 }
28024 
28025 #undef infty2infty
28026 
28027 /**@} */
28028 
28029 /*
28030  * cutting plane methods
28031  */
28032 
28033 /** returns efficacy of the cut with respect to the given primal solution or the current LP solution:
28034  * e = -feasibility/norm
28035  *
28036  * @return the efficacy of the cut with respect to the given primal solution or the current LP solution:
28037  * e = -feasibility/norm
28038  *
28039  * @pre This method can be called if @p scip is in one of the following stages:
28040  * - \ref SCIP_STAGE_SOLVING
28041  */
28043  SCIP* scip, /**< SCIP data structure */
28044  SCIP_SOL* sol, /**< primal CIP solution, or NULL for current LP solution */
28045  SCIP_ROW* cut /**< separated cut */
28046  )
28047 {
28048  SCIP_CALL_ABORT( checkStage(scip, "SCIPgetCutEfficacy", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) );
28049 
28050  if( sol == NULL )
28051  return SCIProwGetLPEfficacy(cut, scip->set, scip->stat, scip->lp);
28052  else
28053  return SCIProwGetSolEfficacy(cut, scip->set, scip->stat, sol);
28054 }
28055 
28056 /** returns whether the cut's efficacy with respect to the given primal solution or the current LP solution is greater
28057  * than the minimal cut efficacy
28058  *
28059  * @return TRUE if the cut's efficacy with respect to the given primal solution or the current LP solution is greater
28060  * than the minimal cut efficacy, otherwise FALSE
28061  *
28062  * @pre This method can be called if @p scip is in one of the following stages:
28063  * - \ref SCIP_STAGE_SOLVING
28064  */
28066  SCIP* scip, /**< SCIP data structure */
28067  SCIP_SOL* sol, /**< primal CIP solution, or NULL for current LP solution */
28068  SCIP_ROW* cut /**< separated cut */
28069  )
28070 {
28071  SCIP_CALL_ABORT( checkStage(scip, "SCIPisCutEfficacious", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) );
28072 
28073  if( sol == NULL )
28074  return SCIProwIsLPEfficacious(cut, scip->set, scip->stat, scip->lp, (SCIPtreeGetCurrentDepth(scip->tree) == 0));
28075  else
28076  return SCIProwIsSolEfficacious(cut, scip->set, scip->stat, sol, (SCIPtreeGetCurrentDepth(scip->tree) == 0));
28077 }
28078 
28079 /** checks, if the given cut's efficacy is larger than the minimal cut efficacy
28080  *
28081  * @return TRUE if the given cut's efficacy is larger than the minimal cut efficacy, otherwise FALSE
28082  */
28084  SCIP* scip, /**< SCIP data structure */
28085  SCIP_Real efficacy /**< efficacy of the cut */
28086  )
28087 {
28088  assert(scip != NULL);
28089 
28090  return SCIPsetIsEfficacious(scip->set, (SCIPtreeGetCurrentDepth(scip->tree) == 0), efficacy);
28091 }
28092 
28093 /** calculates the efficacy norm of the given vector, which depends on the "separating/efficacynorm" parameter
28094  *
28095  * @return the efficacy norm of the given vector, which depends on the "separating/efficacynorm" parameter
28096  */
28098  SCIP* scip, /**< SCIP data structure */
28099  SCIP_Real* vals, /**< array of values */
28100  int nvals /**< number of values */
28101  )
28102 {
28103  SCIP_Real norm;
28104  int i;
28105 
28106  assert(scip != NULL);
28107  assert(scip->set != NULL);
28108 
28109  norm = 0.0;
28110  switch( scip->set->sepa_efficacynorm )
28111  {
28112  case 'e':
28113  for( i = 0; i < nvals; ++i )
28114  norm += SQR(vals[i]);
28115  norm = SQRT(norm);
28116  break;
28117  case 'm':
28118  for( i = 0; i < nvals; ++i )
28119  {
28120  SCIP_Real absval;
28121 
28122  absval = REALABS(vals[i]);
28123  norm = MAX(norm, absval);
28124  }
28125  break;
28126  case 's':
28127  for( i = 0; i < nvals; ++i )
28128  norm += REALABS(vals[i]);
28129  break;
28130  case 'd':
28131  for( i = 0; i < nvals; ++i )
28132  {
28133  if( !SCIPisZero(scip, vals[i]) )
28134  {
28135  norm = 1.0;
28136  break;
28137  }
28138  }
28139  break;
28140  default:
28141  SCIPerrorMessage("invalid efficacy norm parameter '%c'\n", scip->set->sepa_efficacynorm);
28142  assert(FALSE);
28143  }
28144 
28145  return norm;
28146 }
28147 
28148 /** indicates whether a cut is applicable, i.e., will modify the LP when applied
28149  *
28150  * @pre This method can be called if @p scip is in one of the following stages:
28151  * - \ref SCIP_STAGE_SOLVING
28152  *
28153  * @return whether the cut is modifiable, not a bound change, or a bound change that changes bounds by at least epsilon
28154  */
28156  SCIP* scip, /**< SCIP data structure */
28157  SCIP_ROW* cut /**< separated cut */
28158  )
28159 {
28160  SCIP_CALL_ABORT( checkStage(scip, "SCIPisCutApplicable", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) );
28161 
28162  return SCIPsepastoreIsCutApplicable(scip->set, cut);
28163 }
28164 
28165 /** adds cut to separation storage
28166  *
28167  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
28168  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
28169  *
28170  * @pre This method can be called if @p scip is in one of the following stages:
28171  * - \ref SCIP_STAGE_SOLVING
28172  */
28174  SCIP* scip, /**< SCIP data structure */
28175  SCIP_SOL* sol, /**< primal solution that was separated, or NULL for LP solution */
28176  SCIP_ROW* cut, /**< separated cut */
28177  SCIP_Bool forcecut, /**< should the cut be forced to enter the LP? */
28178  SCIP_Bool* infeasible /**< pointer to store whether cut has been detected to be infeasible for local bounds */
28179  )
28180 {
28181  SCIP_CALL( checkStage(scip, "SCIPaddCut", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) );
28182 
28183  assert(SCIPtreeGetCurrentNode(scip->tree) != NULL);
28184 
28185  SCIP_CALL( SCIPsepastoreAddCut(scip->sepastore, scip->mem->probmem, scip->set, scip->stat, scip->eventqueue,
28186  scip->eventfilter, scip->lp, sol, cut, forcecut, (SCIPtreeGetCurrentDepth(scip->tree) == 0), infeasible) );
28187 
28188  /* possibly run conflict analysis */
28189  if ( *infeasible && SCIPprobAllColsInLP(scip->transprob, scip->set, scip->lp) && SCIPisConflictAnalysisApplicable(scip) )
28190  {
28191  SCIP_Real act;
28192  SCIP_VAR* var;
28193  SCIP_Real val;
28194  int ncols;
28195  int j;
28196 
28197  /* initialize conflict analysis */
28199 
28200  if ( ! SCIPisInfinity(scip, -cut->lhs) )
28201  {
28202  act = SCIProwGetMaxActivity(cut, scip->set, scip->stat);
28203  if ( SCIPisLT(scip, act, cut->lhs) )
28204  {
28205  ncols = SCIProwGetNNonz(cut);
28206  for (j = 0; j < ncols; ++j)
28207  {
28208  val = cut->vals[j];
28209  if ( ! SCIPisZero(scip, val) )
28210  {
28211  var = SCIPcolGetVar(cut->cols[j]);
28212  assert( var != NULL );
28213 
28214  if ( val > 0.0 )
28215  {
28216  SCIP_CALL( SCIPaddConflictUb(scip, var, NULL) );
28217  }
28218  else
28219  {
28220  SCIP_CALL( SCIPaddConflictLb(scip, var, NULL) );
28221  }
28222  }
28223  }
28224  }
28225  }
28226  else if ( ! SCIPisInfinity(scip, cut->rhs) )
28227  {
28228  act = SCIProwGetMinActivity(cut, scip->set, scip->stat);
28229  if ( SCIPisGT(scip, act, cut->rhs) )
28230  {
28231  ncols = SCIProwGetNNonz(cut);
28232  for (j = 0; j < ncols; ++j)
28233  {
28234  val = cut->vals[j];
28235  if ( ! SCIPisZero(scip, val) )
28236  {
28237  var = SCIPcolGetVar(cut->cols[j]);
28238  assert( var != NULL );
28239 
28240  if ( val > 0.0 )
28241  {
28242  SCIP_CALL( SCIPaddConflictLb(scip, var, NULL) );
28243  }
28244  else
28245  {
28246  SCIP_CALL( SCIPaddConflictUb(scip, var, NULL) );
28247  }
28248  }
28249  }
28250  }
28251  }
28252 
28253  /* analyze the conflict */
28255  }
28256 
28257  return SCIP_OKAY;
28258 }
28259 
28260 /** if not already existing, adds row to global cut pool
28261  *
28262  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
28263  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
28264  *
28265  * @pre This method can be called if @p scip is in one of the following stages:
28266  * - \ref SCIP_STAGE_SOLVING
28267  */
28269  SCIP* scip, /**< SCIP data structure */
28270  SCIP_ROW* row /**< cutting plane to add */
28271  )
28272 {
28273  SCIP_CALL( checkStage(scip, "SCIPaddPoolCut", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) );
28274 
28275  SCIP_CALL( SCIPcutpoolAddRow(scip->cutpool, scip->mem->probmem, scip->set, row) );
28276 
28277  return SCIP_OKAY;
28278 }
28279 
28280 /** removes the row from the global cut pool
28281  *
28282  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
28283  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
28284  *
28285  * @pre This method can be called if @p scip is in one of the following stages:
28286  * - \ref SCIP_STAGE_SOLVING
28287  */
28289  SCIP* scip, /**< SCIP data structure */
28290  SCIP_ROW* row /**< cutting plane to add */
28291  )
28292 {
28293  SCIP_CALL( checkStage(scip, "SCIPdelPoolCut", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) );
28294 
28295  SCIP_CALL( SCIPcutpoolDelRow(scip->cutpool, scip->mem->probmem, scip->set, scip->stat, scip->lp, row) );
28296 
28297  return SCIP_OKAY;
28298 }
28299 
28300 /** gets current cuts in the global cut pool
28301  *
28302  * @return the current cuts in the global cut pool
28303  *
28304  * @pre This method can be called if @p scip is in one of the following stages:
28305  * - \ref SCIP_STAGE_SOLVING
28306  * - \ref SCIP_STAGE_SOLVED
28307  * - \ref SCIP_STAGE_EXITSOLVE
28308  */
28310  SCIP* scip /**< SCIP data structure */
28311  )
28312 {
28313  SCIP_CALL_ABORT( checkStage(scip, "SCIPgetPoolCuts", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, FALSE, FALSE) );
28314 
28315  return SCIPcutpoolGetCuts(scip->cutpool);
28316 }
28317 
28318 /** gets current number of rows in the global cut pool
28319  *
28320  * @return the current number of rows in the global cut pool
28321  *
28322  * @pre This method can be called if @p scip is in one of the following stages:
28323  * - \ref SCIP_STAGE_SOLVING
28324  * - \ref SCIP_STAGE_SOLVED
28325  * - \ref SCIP_STAGE_EXITSOLVE
28326  */
28328  SCIP* scip /**< SCIP data structure */
28329  )
28330 {
28331  SCIP_CALL_ABORT( checkStage(scip, "SCIPgetNPoolCuts", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, FALSE, FALSE) );
28332 
28333  return SCIPcutpoolGetNCuts(scip->cutpool);
28334 }
28335 
28336 /** gets the global cut pool used by SCIP
28337  *
28338  * @return the global cut pool used by SCIP
28339  *
28340  * @pre This method can be called if @p scip is in one of the following stages:
28341  * - \ref SCIP_STAGE_SOLVING
28342  * - \ref SCIP_STAGE_SOLVED
28343  * - \ref SCIP_STAGE_EXITSOLVE
28344  */
28346  SCIP* scip /**< SCIP data structure */
28347  )
28348 {
28349  SCIP_CALL_ABORT( checkStage(scip, "SCIPgetGlobalCutpool", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, FALSE, FALSE) );
28350 
28351  return scip->cutpool;
28352 }
28353 
28354 /** creates a cut pool
28355  *
28356  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
28357  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
28358  *
28359  * @pre This method can be called if @p scip is in one of the following stages:
28360  * - \ref SCIP_STAGE_TRANSFORMING
28361  * - \ref SCIP_STAGE_TRANSFORMED
28362  * - \ref SCIP_STAGE_INITPRESOLVE
28363  * - \ref SCIP_STAGE_PRESOLVING
28364  * - \ref SCIP_STAGE_EXITPRESOLVE
28365  * - \ref SCIP_STAGE_PRESOLVED
28366  * - \ref SCIP_STAGE_INITSOLVE
28367  * - \ref SCIP_STAGE_SOLVING
28368  */
28370  SCIP* scip, /**< SCIP data structure */
28371  SCIP_CUTPOOL** cutpool, /**< pointer to store cut pool */
28372  int agelimit /**< maximum age a cut can reach before it is deleted from the pool */
28373  )
28374 {
28375  SCIP_CALL( checkStage(scip, "SCIPcreateCutpool", FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE) );
28376 
28377  SCIP_CALL( SCIPcutpoolCreate(cutpool, scip->mem->probmem, scip->set, agelimit, FALSE) );
28378 
28379  return SCIP_OKAY;
28380 }
28381 
28382 /** frees a cut pool
28383  *
28384  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
28385  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
28386  *
28387  * @pre This method can be called if @p scip is in one of the following stages:
28388  * - \ref SCIP_STAGE_TRANSFORMING
28389  * - \ref SCIP_STAGE_TRANSFORMED
28390  * - \ref SCIP_STAGE_INITPRESOLVE
28391  * - \ref SCIP_STAGE_PRESOLVING
28392  * - \ref SCIP_STAGE_EXITPRESOLVE
28393  * - \ref SCIP_STAGE_PRESOLVED
28394  * - \ref SCIP_STAGE_INITSOLVE
28395  * - \ref SCIP_STAGE_SOLVING
28396  * - \ref SCIP_STAGE_SOLVED
28397  * - \ref SCIP_STAGE_EXITSOLVE
28398  * - \ref SCIP_STAGE_FREETRANS
28399  */
28401  SCIP* scip, /**< SCIP data structure */
28402  SCIP_CUTPOOL** cutpool /**< pointer to store cut pool */
28403  )
28404 {
28405  SCIP_CALL( checkStage(scip, "SCIPfreeCutpool", FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE) );
28406 
28407  SCIP_CALL( SCIPcutpoolFree(cutpool, scip->mem->probmem, scip->set, scip->lp) );
28408 
28409  return SCIP_OKAY;
28410 }
28411 
28412 /** if not already existing, adds row to a cut pool and captures it
28413  *
28414  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
28415  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
28416  *
28417  * @pre This method can be called if @p scip is in one of the following stages:
28418  * - \ref SCIP_STAGE_INITSOLVE
28419  * - \ref SCIP_STAGE_SOLVING
28420  */
28422  SCIP* scip, /**< SCIP data structure */
28423  SCIP_CUTPOOL* cutpool, /**< cut pool */
28424  SCIP_ROW* row /**< cutting plane to add */
28425  )
28426 {
28427  SCIP_CALL( checkStage(scip, "SCIPaddRowCutpool", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE) );
28428 
28429  SCIP_CALL( SCIPcutpoolAddRow(cutpool, scip->mem->probmem, scip->set, row) );
28430 
28431  return SCIP_OKAY;
28432 }
28433 
28434 /** adds row to a cut pool and captures it; doesn't check for multiple cuts
28435  *
28436  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
28437  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
28438  *
28439  * @pre This method can be called if @p scip is in one of the following stages:
28440  * - \ref SCIP_STAGE_INITSOLVE
28441  * - \ref SCIP_STAGE_SOLVING
28442  */
28444  SCIP* scip, /**< SCIP data structure */
28445  SCIP_CUTPOOL* cutpool, /**< cut pool */
28446  SCIP_ROW* row /**< cutting plane to add */
28447  )
28448 {
28449  SCIP_CALL( checkStage(scip, "SCIPaddNewRowCutpool", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE) );
28450 
28451  SCIP_CALL( SCIPcutpoolAddNewRow(cutpool, scip->mem->probmem, scip->set, row) );
28452 
28453  return SCIP_OKAY;
28454 }
28455 
28456 /** removes the LP row from a cut pool
28457  *
28458  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
28459  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
28460  *
28461  * @pre This method can be called if @p scip is in one of the following stages:
28462  * - \ref SCIP_STAGE_INITSOLVE
28463  * - \ref SCIP_STAGE_SOLVING
28464  * - \ref SCIP_STAGE_SOLVED
28465  */
28467  SCIP* scip, /**< SCIP data structure */
28468  SCIP_CUTPOOL* cutpool, /**< cut pool */
28469  SCIP_ROW* row /**< row to remove */
28470  )
28471 {
28472  SCIP_CALL( checkStage(scip, "SCIPdelRowCutpool", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE) );
28473 
28474  SCIP_CALL( SCIPcutpoolDelRow(cutpool, scip->mem->probmem, scip->set, scip->stat, scip->lp, row) );
28475 
28476  return SCIP_OKAY;
28477 }
28478 
28479 /** separates cuts from a cut pool
28480  *
28481  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
28482  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
28483  *
28484  * @pre This method can be called if @p scip is in one of the following stages:
28485  * - \ref SCIP_STAGE_SOLVING
28486  */
28488  SCIP* scip, /**< SCIP data structure */
28489  SCIP_CUTPOOL* cutpool, /**< cut pool */
28490  SCIP_RESULT* result /**< pointer to store the result of the separation call */
28491  )
28492 {
28493  SCIP_CALL( checkStage(scip, "SCIPseparateCutpool", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) );
28494 
28495  assert(SCIPtreeGetCurrentNode(scip->tree) != NULL);
28496 
28497  if( !SCIPtreeHasCurrentNodeLP(scip->tree) )
28498  {
28499  SCIPerrorMessage("cannot add cuts, because node LP is not processed\n");
28500  return SCIP_INVALIDCALL;
28501  }
28502 
28503  SCIP_CALL( SCIPcutpoolSeparate(cutpool, scip->mem->probmem, scip->set, scip->stat, scip->eventqueue, scip->eventfilter,
28504  scip->lp, scip->sepastore, NULL, FALSE, (SCIPtreeGetCurrentDepth(scip->tree) == 0), result) );
28505 
28506  return SCIP_OKAY;
28507 }
28508 
28509 /** separates cuts w.r.t. given solution from a cut pool
28510  *
28511  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
28512  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
28513  *
28514  * @pre This method can be called if @p scip is in one of the following stages:
28515  * - \ref SCIP_STAGE_SOLVING
28516  */
28518  SCIP* scip, /**< SCIP data structure */
28519  SCIP_CUTPOOL* cutpool, /**< cut pool */
28520  SCIP_SOL* sol, /**< solution to be separated */
28521  SCIP_RESULT* result /**< pointer to store the result of the separation call */
28522  )
28523 {
28524  SCIP_CALL( checkStage(scip, "SCIPseparateSolCutpool", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) );
28525 
28526  assert(SCIPtreeGetCurrentNode(scip->tree) != NULL);
28527 
28528  if( !SCIPtreeHasCurrentNodeLP(scip->tree) )
28529  {
28530  SCIPerrorMessage("cannot add cuts, because node LP is not processed\n");
28531  return SCIP_INVALIDCALL;
28532  }
28533 
28534  SCIP_CALL( SCIPcutpoolSeparate(cutpool, scip->mem->probmem, scip->set, scip->stat, scip->eventqueue, scip->eventfilter,
28535  scip->lp, scip->sepastore, sol, FALSE, (SCIPtreeGetCurrentDepth(scip->tree) == 0), result) );
28536 
28537  return SCIP_OKAY;
28538 }
28539 
28540 /** if not already existing, adds row to delayed global cut pool
28541  *
28542  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
28543  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
28544  *
28545  * @pre This method can be called if @p scip is the stages \ref SCIP_STAGE_SOLVING
28546  */
28548  SCIP* scip, /**< SCIP data structure */
28549  SCIP_ROW* row /**< cutting plane to add */
28550  )
28551 {
28552  SCIP_CALL( checkStage(scip, "SCIPaddDelayedPoolCut", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) );
28553 
28554  SCIP_CALL( SCIPcutpoolAddRow(scip->delayedcutpool, scip->mem->probmem, scip->set, row) );
28555 
28556  return SCIP_OKAY;
28557 }
28558 
28559 /** removes the row from the delayed global cut pool
28560  *
28561  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
28562  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
28563  *
28564  * @pre This method can be called if @p scip is the stages \ref SCIP_STAGE_SOLVING
28565  */
28567  SCIP* scip, /**< SCIP data structure */
28568  SCIP_ROW* row /**< cutting plane to add */
28569  )
28570 {
28571  SCIP_CALL( checkStage(scip, "SCIPdelDelayedPoolCut", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) );
28572 
28573  SCIP_CALL( SCIPcutpoolDelRow(scip->delayedcutpool, scip->mem->probmem, scip->set, scip->stat, scip->lp, row) );
28574 
28575  return SCIP_OKAY;
28576 }
28577 
28578 /** gets current cuts in the delayed global cut pool
28579  *
28580  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
28581  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
28582  *
28583  * @pre This method can be called if @p scip is the stages \ref SCIP_STAGE_SOLVING
28584  */
28586  SCIP* scip /**< SCIP data structure */
28587  )
28588 {
28589  SCIP_CALL_ABORT( checkStage(scip, "SCIPgetDelayedPoolCuts", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, FALSE, FALSE) );
28590 
28591  return SCIPcutpoolGetCuts(scip->delayedcutpool);
28592 }
28593 
28594 /** gets current number of rows in the delayed global cut pool
28595  *
28596  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
28597  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
28598  *
28599  * @pre This method can be called if @p scip is the stages \ref SCIP_STAGE_SOLVING
28600  */
28602  SCIP* scip /**< SCIP data structure */
28603  )
28604 {
28605  SCIP_CALL_ABORT( checkStage(scip, "SCIPgetNDelayedPoolCuts", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, FALSE, FALSE) );
28606 
28607  return SCIPcutpoolGetNCuts(scip->delayedcutpool);
28608 }
28609 
28610 /** gets the delayed global cut pool used by SCIP
28611  *
28612  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
28613  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
28614  *
28615  * @pre This method can be called if @p scip is the stages \ref SCIP_STAGE_SOLVING
28616  */
28618  SCIP* scip /**< SCIP data structure */
28619  )
28620 {
28621  SCIP_CALL_ABORT( checkStage(scip, "SCIPgetDelayedGlobalCutpool", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, FALSE, FALSE) );
28622 
28623  return scip->delayedcutpool;
28624 }
28625 
28626 /** separates the given primal solution or the current LP solution by calling the separators and constraint handlers'
28627  * separation methods;
28628  * the generated cuts are stored in the separation storage and can be accessed with the methods SCIPgetCuts() and
28629  * SCIPgetNCuts();
28630  * after evaluating the cuts, you have to call SCIPclearCuts() in order to remove the cuts from the
28631  * separation storage;
28632  * it is possible to call SCIPseparateSol() multiple times with different solutions and evaluate the found cuts
28633  * afterwards
28634  *
28635  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
28636  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
28637  *
28638  * @pre This method can be called if @p scip is in one of the following stages:
28639  * - \ref SCIP_STAGE_SOLVING
28640  */
28642  SCIP* scip, /**< SCIP data structure */
28643  SCIP_SOL* sol, /**< primal solution that should be separated, or NULL for LP solution */
28644  SCIP_Bool pretendroot, /**< should the cut separators be called as if we are at the root node? */
28645  SCIP_Bool onlydelayed, /**< should only separators be called that were delayed in the previous round? */
28646  SCIP_Bool* delayed, /**< pointer to store whether a separator was delayed */
28647  SCIP_Bool* cutoff /**< pointer to store whether the node can be cut off */
28648  )
28649 {
28650  int actdepth;
28651 
28652  SCIP_CALL( checkStage(scip, "SCIPseparateSol", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) );
28653 
28654  /* get current depth */
28655  actdepth = (pretendroot ? 0 : SCIPtreeGetCurrentDepth(scip->tree));
28656 
28657  /* apply separation round */
28658  SCIP_CALL( SCIPseparationRound(scip->mem->probmem, scip->set, scip->messagehdlr, scip->stat, scip->eventqueue, scip->eventfilter, scip->transprob, scip->primal, scip->tree, scip->lp, scip->sepastore,
28659  sol, actdepth, onlydelayed, delayed, cutoff) );
28660 
28661  return SCIP_OKAY;
28662 }
28663 
28664 /** gets the array of cuts currently stored in the separation storage
28665  *
28666  * @return the array of cuts currently stored in the separation storage
28667  *
28668  * @pre This method can be called if @p scip is in one of the following stages:
28669  * - \ref SCIP_STAGE_PRESOLVED
28670  * - \ref SCIP_STAGE_SOLVING
28671  * - \ref SCIP_STAGE_SOLVED
28672  */
28674  SCIP* scip /**< SCIP data structure */
28675  )
28676 {
28677  SCIP_CALL_ABORT( checkStage(scip, "SCIPgetCuts", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE) );
28678 
28679  return SCIPsepastoreGetCuts(scip->sepastore);
28680 }
28681 
28682 /** get current number of cuts in the separation storage
28683  *
28684  * @return the current number of cuts in the separation storage
28685  *
28686  * @pre This method can be called if @p scip is in one of the following stages:
28687  * - \ref SCIP_STAGE_PRESOLVED
28688  * - \ref SCIP_STAGE_SOLVING
28689  * - \ref SCIP_STAGE_SOLVED
28690  */
28692  SCIP* scip /**< SCIP data structure */
28693  )
28694 {
28695  SCIP_CALL_ABORT( checkStage(scip, "SCIPgetNCuts", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE) );
28696 
28697  return SCIPsepastoreGetNCuts(scip->sepastore);
28698 }
28699 
28700 /** clears the separation storage
28701  *
28702  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
28703  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
28704  *
28705  * @pre This method can be called if @p scip is in one of the following stages:
28706  * - \ref SCIP_STAGE_SOLVING
28707  */
28709  SCIP* scip /**< SCIP data structure */
28710  )
28711 {
28712  SCIP_CALL( checkStage(scip, "SCIPclearCuts", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) );
28713 
28714  SCIP_CALL( SCIPsepastoreClearCuts(scip->sepastore, scip->mem->probmem, scip->set, scip->eventqueue, scip->eventfilter, scip->lp) );
28715 
28716  return SCIP_OKAY;
28717 }
28718 
28719 /** removes cuts that are inefficacious w.r.t. the current LP solution from separation storage without adding the cuts to the LP
28720  *
28721  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
28722  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
28723  *
28724  * @pre This method can be called if @p scip is in one of the following stages:
28725  * - \ref SCIP_STAGE_SOLVING
28726  */
28728  SCIP* scip /**< SCIP data structure */
28729  )
28730 {
28731  SCIP_Bool isroot;
28732 
28733  SCIP_CALL( checkStage(scip, "SCIPremoveInefficaciousCuts", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) );
28734 
28735  isroot = FALSE;
28736  if( SCIPtreeGetCurrentDepth(scip->tree) == 0 )
28737  isroot = TRUE;
28739  scip->eventqueue, scip->eventfilter, scip->lp, isroot, SCIP_EFFICIACYCHOICE_LP) );
28740 
28741  return SCIP_OKAY;
28742 }
28743 
28744 /** returns current factor on cut infeasibility to limit feasibility tolerance for relaxation solver
28745  *
28746  * Gives value of separating/feastolfac parameter.
28747  *
28748  * @return factor on cut infeasibility to limit feasibility tolerance for relaxation solver
28749  *
28750  * @pre This method can be called if @p scip is in one of the following stages:
28751  * - \ref SCIP_STAGE_SOLVING
28752  */
28754  SCIP* scip /**< SCIP data structure */
28755  )
28756 {
28757  SCIP_CALL_ABORT( checkStage(scip, "SCIPgetRelaxFeastolFactor", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) );
28758 
28759  return scip->set->sepa_feastolfac;
28760 }
28761 
28762 #if 0
28763 /**@todo make this method available; implement methods SCIPaddProbingRow() and SCIPaddProbingCol();
28764  * -> the probing node needs a counter (like the fork) on the number of added rows and cols,
28765  * and treeBacktrackProbing() needs to shrink the LP;
28766  * this is useful, e.g., for the feaspump heuristic, s.t. it can temporarily add the auxiliary columns
28767  * needed to represent the objective function for integer variables not on one of their bounds
28768  */
28769 /** applies the cuts in the separation storage to the LP and clears the storage afterwards;
28770  * this method can only be applied during probing; the user should resolve the probing LP afterwards
28771  * in order to get a new solution
28772  */
28773 SCIP_RETCODE SCIPapplyCuts(
28774  SCIP* scip, /**< SCIP data structure */
28775  SCIP_Bool* cutoff /**< pointer to store whether an empty domain was created */
28776  )
28777 {
28778  SCIP_CALL( checkStage(scip, "SCIPapplyCuts", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) );
28779 
28780  if( !SCIPtreeProbing(scip->tree) )
28781  {
28782  SCIPerrorMessage("not in probing mode\n");
28783  return SCIP_INVALIDCALL;
28784  }
28785 
28786  SCIP_CALL( SCIPsepastoreApplyCuts(scip->sepastore, scip->mem->probmem, scip->set, scip->stat, scip->transprob,
28787  scip->origprob, scip->eventqueue, scip->eventfilter, scip->tree, scip->lp, scip->branchcand, scip->eventqueue, cutoff) );
28788 
28789  return SCIP_OKAY;
28790 }
28791 #endif
28792 
28793 
28794 
28795 
28796 /*
28797  * LP diving methods
28798  */
28799 
28800 /** initiates LP diving, making methods SCIPchgVarObjDive(), SCIPchgVarLbDive(), and SCIPchgVarUbDive() available
28801  *
28802  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
28803  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
28804  *
28805  * @pre This method can be called if @p scip is in one of the following stages:
28806  * - \ref SCIP_STAGE_SOLVING
28807  *
28808  * See \ref SCIP_Stage "SCIP_STAGE" for a complete list of all possible solving stages.
28809  *
28810  * @note diving is allowed even if the current LP is not flushed, not solved, or not solved to optimality; be aware
28811  * that solving the (first) diving LP may take longer than expect and that the latter two cases could stem from
28812  * numerical troubles during the last LP solve; because of this, most users will want to call this method only if
28813  * SCIPgetLPSolstat(scip) == SCIP_LPSOLSTAT_OPTIMAL
28814  */
28816  SCIP* scip /**< SCIP data structure */
28817  )
28818 {
28819  assert(scip != NULL);
28820 
28821  SCIP_CALL( checkStage(scip, "SCIPstartDive", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) );
28823 
28824  if( SCIPlpDiving(scip->lp) )
28825  {
28826  SCIPerrorMessage("already in diving mode\n");
28827  return SCIP_INVALIDCALL;
28828  }
28829 
28830  if( SCIPtreeProbing(scip->tree) )
28831  {
28832  SCIPerrorMessage("cannot start diving while being in probing mode\n");
28833  return SCIP_INVALIDCALL;
28834  }
28835 
28837  {
28838  SCIPerrorMessage("cannot start diving if LP has not been constructed\n");
28839  return SCIP_INVALIDCALL;
28840  }
28841  assert(SCIPtreeHasCurrentNodeLP(scip->tree));
28842 
28843  SCIP_CALL( SCIPlpStartDive(scip->lp, scip->mem->probmem, scip->set, scip->stat) );
28844 
28845  return SCIP_OKAY;
28846 }
28847 
28848 /** quits LP diving and resets bounds and objective values of columns to the current node's values
28849  *
28850  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
28851  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
28852  *
28853  * @pre This method can be called if @p scip is in one of the following stages:
28854  * - \ref SCIP_STAGE_SOLVING
28855  *
28856  * See \ref SCIP_Stage "SCIP_STAGE" for a complete list of all possible solving stages.
28857  */
28859  SCIP* scip /**< SCIP data structure */
28860  )
28861 {
28862  assert(scip != NULL);
28863 
28864  SCIP_CALL( checkStage(scip, "SCIPendDive", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) );
28865 
28866  if( !SCIPlpDiving(scip->lp) )
28867  {
28868  SCIPerrorMessage("not in diving mode\n");
28869  return SCIP_INVALIDCALL;
28870  }
28871 
28872  /* unmark the diving flag in the LP and reset all variables' objective and bound values */
28873  SCIP_CALL( SCIPlpEndDive(scip->lp, scip->mem->probmem, scip->set, scip->messagehdlr, scip->stat, scip->eventqueue, scip->eventfilter,
28874  scip->transprob, scip->transprob->vars, scip->transprob->nvars) );
28875 
28876  /* the lower bound may have changed slightly due to LP resolve in SCIPlpEndDive() */
28877  if( !scip->lp->resolvelperror && scip->tree->focusnode != NULL && SCIPlpIsRelax(scip->lp) && SCIPlpIsSolved(scip->lp) )
28878  {
28879  assert(SCIPtreeIsFocusNodeLPConstructed(scip->tree));
28880  SCIP_CALL( SCIPnodeUpdateLowerboundLP(scip->tree->focusnode, scip->set, scip->stat, scip->tree, scip->transprob,
28881  scip->origprob, scip->lp) );
28882  }
28883  /* reset the probably changed LP's cutoff bound */
28884  SCIP_CALL( SCIPlpSetCutoffbound(scip->lp, scip->set, scip->transprob, scip->primal->cutoffbound) );
28885  assert(scip->lp->cutoffbound == scip->primal->cutoffbound); /*lint !e777*/
28886 
28887  /* if a new best solution was created, the cutoff of the tree was delayed due to diving;
28888  * the cutoff has to be done now.
28889  */
28890  if( scip->tree->cutoffdelayed )
28891  {
28892  SCIP_CALL( SCIPtreeCutoff(scip->tree, scip->mem->probmem, scip->set, scip->stat, scip->eventqueue,
28893  scip->lp, scip->primal->cutoffbound) );
28894  }
28895 
28896  return SCIP_OKAY;
28897 }
28898 
28899 /** changes cutoffbound in current dive
28900  *
28901  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
28902  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
28903  *
28904  * @pre This method can be called if @p scip is in one of the following stages:
28905  * - \ref SCIP_STAGE_SOLVING
28906  *
28907  * See \ref SCIP_Stage "SCIP_STAGE" for a complete list of all possible solving stages.
28908  */
28910  SCIP* scip, /**< SCIP data structure */
28911  SCIP_Real newcutoffbound /**< new cutoffbound */
28912  )
28913 {
28914  assert(scip != NULL);
28915 
28916  SCIP_CALL( checkStage(scip, "SCIPchgCutoffboundDive", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) );
28917 
28918  if( !SCIPlpDiving(scip->lp) )
28919  {
28920  SCIPerrorMessage("not in diving mode\n");
28921  return SCIP_INVALIDCALL;
28922  }
28923 
28924  SCIP_CALL( SCIPlpSetCutoffbound(scip->lp, scip->set, scip->transprob, newcutoffbound) );
28925 
28926  return SCIP_OKAY;
28927 }
28928 
28929 /** changes variable's objective value in current dive
28930  *
28931  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
28932  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
28933  *
28934  * @pre This method can be called if @p scip is in one of the following stages:
28935  * - \ref SCIP_STAGE_SOLVING
28936  *
28937  * See \ref SCIP_Stage "SCIP_STAGE" for a complete list of all possible solving stages.
28938  */
28940  SCIP* scip, /**< SCIP data structure */
28941  SCIP_VAR* var, /**< variable to change the objective value for */
28942  SCIP_Real newobj /**< new objective value */
28943  )
28944 {
28945  assert(scip != NULL);
28946  assert(var != NULL);
28947 
28948  SCIP_CALL( checkStage(scip, "SCIPchgVarObjDive", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) );
28949 
28950  if( !SCIPlpDiving(scip->lp) )
28951  {
28952  SCIPerrorMessage("not in diving mode\n");
28953  return SCIP_INVALIDCALL;
28954  }
28955 
28956  /* invalidate the LP's cutoff bound, since this has nothing to do with the current objective value anymore;
28957  * the cutoff bound is reset in SCIPendDive()
28958  */
28959  SCIP_CALL( SCIPlpSetCutoffbound(scip->lp, scip->set, scip->transprob, SCIPsetInfinity(scip->set)) );
28960 
28961  /* mark the LP's objective function invalid */
28963 
28964  /* change the objective value of the variable in the diving LP */
28965  SCIP_CALL( SCIPvarChgObjDive(var, scip->set, scip->lp, newobj) );
28966 
28967  return SCIP_OKAY;
28968 }
28969 
28970 /** changes variable's lower bound in current dive
28971  *
28972  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
28973  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
28974  *
28975  * @pre This method can be called if @p scip is in one of the following stages:
28976  * - \ref SCIP_STAGE_SOLVING
28977  *
28978  * See \ref SCIP_Stage "SCIP_STAGE" for a complete list of all possible solving stages.
28979  */
28981  SCIP* scip, /**< SCIP data structure */
28982  SCIP_VAR* var, /**< variable to change the bound for */
28983  SCIP_Real newbound /**< new value for bound */
28984  )
28985 {
28986  assert(scip != NULL);
28987  assert(var != NULL);
28988 
28989  SCIP_CALL( checkStage(scip, "SCIPchgVarLbDive", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) );
28990 
28991  if( !SCIPlpDiving(scip->lp) )
28992  {
28993  SCIPerrorMessage("not in diving mode\n");
28994  return SCIP_INVALIDCALL;
28995  }
28996 
28997  SCIP_CALL( SCIPvarChgLbDive(var, scip->set, scip->lp, newbound) );
28998 
28999  return SCIP_OKAY;
29000 }
29001 
29002 /** changes variable's upper bound in current dive
29003  *
29004  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
29005  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
29006  *
29007  * @pre This method can be called if @p scip is in one of the following stages:
29008  * - \ref SCIP_STAGE_SOLVING
29009  *
29010  * See \ref SCIP_Stage "SCIP_STAGE" for a complete list of all possible solving stages.
29011  */
29013  SCIP* scip, /**< SCIP data structure */
29014  SCIP_VAR* var, /**< variable to change the bound for */
29015  SCIP_Real newbound /**< new value for bound */
29016  )
29017 {
29018  assert(scip != NULL);
29019  assert(var != NULL);
29020 
29021  SCIP_CALL( checkStage(scip, "SCIPchgVarUbDive", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) );
29022 
29023  if( !SCIPlpDiving(scip->lp) )
29024  {
29025  SCIPerrorMessage("not in diving mode\n");
29026  return SCIP_INVALIDCALL;
29027  }
29028 
29029  SCIP_CALL( SCIPvarChgUbDive(var, scip->set, scip->lp, newbound) );
29030 
29031  return SCIP_OKAY;
29032 }
29033 
29034 /** adds a row to the LP in current dive
29035  *
29036  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
29037  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
29038  *
29039  * @pre This method can be called if @p scip is in one of the following stages:
29040  * - \ref SCIP_STAGE_SOLVING
29041  *
29042  * See \ref SCIP_Stage "SCIP_STAGE" for a complete list of all possible solving stages.
29043  */
29045  SCIP* scip, /**< SCIP data structure */
29046  SCIP_ROW* row /**< row to be added */
29047  )
29048 {
29049  SCIP_NODE* node;
29050  int depth;
29051 
29052  assert(scip != NULL);
29053  assert(row != NULL);
29054 
29055  SCIP_CALL( checkStage(scip, "SCIPaddRowDive", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) );
29056 
29057  if( !SCIPlpDiving(scip->lp) )
29058  {
29059  SCIPerrorMessage("not in diving mode\n");
29060  return SCIP_INVALIDCALL;
29061  }
29062 
29063  /* get depth of current node */
29064  node = SCIPtreeGetCurrentNode(scip->tree);
29065  assert(node != NULL);
29066  depth = SCIPnodeGetDepth(node);
29067 
29068  SCIP_CALL( SCIPlpAddRow(scip->lp, scip->mem->probmem, scip->set, scip->eventqueue, scip->eventfilter, row, depth) );
29069 
29070  return SCIP_OKAY;
29071 }
29072 
29073 /** changes row lhs in current dive, change will be undone after diving ends, for permanent changes use SCIPchgRowLhs()
29074  *
29075  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
29076  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
29077  *
29078  * @pre This method can be called if @p scip is in one of the following stages:
29079  * - \ref SCIP_STAGE_SOLVING
29080  *
29081  * See \ref SCIP_Stage "SCIP_STAGE" for a complete list of all possible solving stages.
29082  */
29084  SCIP* scip, /**< SCIP data structure */
29085  SCIP_ROW* row, /**< row to change the lhs for */
29086  SCIP_Real newlhs /**< new value for lhs */
29087  )
29088 {
29089  assert(scip != NULL);
29090  assert(row != NULL);
29091 
29092  SCIP_CALL( checkStage(scip, "SCIPchgRowLhsDive", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) );
29093 
29094  if( !SCIPlpDiving(scip->lp) )
29095  {
29096  SCIPerrorMessage("not in diving mode\n");
29097  return SCIP_INVALIDCALL;
29098  }
29099 
29101  SCIP_CALL( SCIProwChgLhs(row, scip->mem->probmem, scip->set, scip->eventqueue, scip->lp, newlhs) );
29102 
29103  return SCIP_OKAY;
29104 }
29105 
29106 /** changes row rhs in current dive, change will be undone after diving ends, for permanent changes use SCIPchgRowRhs()
29107  *
29108  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
29109  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
29110  *
29111  * @pre This method can be called if @p scip is in one of the following stages:
29112  * - \ref SCIP_STAGE_SOLVING
29113  *
29114  * See \ref SCIP_Stage "SCIP_STAGE" for a complete list of all possible solving stages.
29115  */
29117  SCIP* scip, /**< SCIP data structure */
29118  SCIP_ROW* row, /**< row to change the lhs for */
29119  SCIP_Real newrhs /**< new value for rhs */
29120  )
29121 {
29122  assert(scip != NULL);
29123  assert(row != NULL);
29124 
29125  SCIP_CALL( checkStage(scip, "SCIPchgRowRhsDive", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) );
29126 
29127  if( !SCIPlpDiving(scip->lp) )
29128  {
29129  SCIPerrorMessage("not in diving mode\n");
29130  return SCIP_INVALIDCALL;
29131  }
29132 
29134  SCIP_CALL( SCIProwChgRhs(row, scip->mem->probmem, scip->set, scip->eventqueue, scip->lp, newrhs) );
29135 
29136  return SCIP_OKAY;
29137 }
29138 
29139 /** gets variable's objective value in current dive
29140  *
29141  * @return the variable's objective value in current dive.
29142  *
29143  * @pre This method can be called if @p scip is in one of the following stages:
29144  * - \ref SCIP_STAGE_SOLVING
29145  *
29146  * See \ref SCIP_Stage "SCIP_STAGE" for a complete list of all possible solving stages.
29147  */
29149  SCIP* scip, /**< SCIP data structure */
29150  SCIP_VAR* var /**< variable to get the bound for */
29151  )
29152 {
29153  assert(scip != NULL);
29154  assert(var != NULL);
29155 
29156  SCIP_CALL_ABORT( checkStage(scip, "SCIPgetVarObjDive", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) );
29157 
29158  if( !SCIPlpDiving(scip->lp) )
29159  {
29160  SCIPerrorMessage("not in diving mode\n");
29161  SCIPABORT();
29162  return SCIP_INVALID; /*lint !e527*/
29163  }
29164 
29165  return SCIPvarGetObjLP(var);
29166 }
29167 
29168 /** gets variable's lower bound in current dive
29169  *
29170  * @return the variable's lower bound in current dive.
29171  *
29172  * @pre This method can be called if @p scip is in one of the following stages:
29173  * - \ref SCIP_STAGE_SOLVING
29174  *
29175  * See \ref SCIP_Stage "SCIP_STAGE" for a complete list of all possible solving stages.
29176  */
29178  SCIP* scip, /**< SCIP data structure */
29179  SCIP_VAR* var /**< variable to get the bound for */
29180  )
29181 {
29182  assert(scip != NULL);
29183  assert(var != NULL);
29184 
29185  SCIP_CALL_ABORT( checkStage(scip, "SCIPgetVarLbDive", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) );
29186 
29187  if( !SCIPlpDiving(scip->lp) )
29188  {
29189  SCIPerrorMessage("not in diving mode\n");
29190  SCIPABORT();
29191  return SCIP_INVALID; /*lint !e527*/
29192  }
29193 
29194  return SCIPvarGetLbLP(var, scip->set);
29195 }
29196 
29197 /** gets variable's upper bound in current dive
29198  *
29199  * @return the variable's upper bound in current dive.
29200  *
29201  * @pre This method can be called if @p scip is in one of the following stages:
29202  * - \ref SCIP_STAGE_SOLVING
29203  *
29204  * See \ref SCIP_Stage "SCIP_STAGE" for a complete list of all possible solving stages.
29205  */
29207  SCIP* scip, /**< SCIP data structure */
29208  SCIP_VAR* var /**< variable to get the bound for */
29209  )
29210 {
29211  assert(scip != NULL);
29212  assert(var != NULL);
29213 
29214  SCIP_CALL_ABORT( checkStage(scip, "SCIPgetVarUbDive", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) );
29215 
29216  if( !SCIPlpDiving(scip->lp) )
29217  {
29218  SCIPerrorMessage("not in diving mode\n");
29219  SCIPABORT();
29220  return SCIP_INVALID; /*lint !e527*/
29221  }
29222 
29223  return SCIPvarGetUbLP(var, scip->set);
29224 }
29225 
29226 /** solves the LP of the current dive; no separation or pricing is applied
29227  *
29228  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
29229  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
29230  *
29231  * @pre This method can be called if @p scip is in one of the following stages:
29232  * - \ref SCIP_STAGE_SOLVING
29233  *
29234  * See \ref SCIP_Stage "SCIP_STAGE" for a complete list of all possible solving stages.
29235  *
29236  * @note be aware that the LP solve may take longer than expected if SCIPgetLPSolstat(scip) != SCIP_LPSOLSTAT_OPTIMAL,
29237  * compare the explanation of SCIPstartDive()
29238  */
29240  SCIP* scip, /**< SCIP data structure */
29241  int itlim, /**< maximal number of LP iterations to perform, or -1 for no limit */
29242  SCIP_Bool* lperror, /**< pointer to store whether an unresolved LP error occurred */
29243  SCIP_Bool* cutoff /**< pointer to store whether the diving LP was infeasible or the objective
29244  * limit was reached (or NULL, if not needed) */
29245  )
29246 {
29247  assert(scip != NULL);
29248 
29249  SCIP_CALL( checkStage(scip, "SCIPsolveDiveLP", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) );
29250 
29251  if( !SCIPlpDiving(scip->lp) )
29252  {
29253  SCIPerrorMessage("not in diving mode\n");
29254  return SCIP_INVALIDCALL;
29255  }
29256 
29257  if( cutoff != NULL )
29258  *cutoff = FALSE;
29259 
29260  /* solve diving LP */
29261  SCIP_CALL( SCIPlpSolveAndEval(scip->lp, scip->set, scip->messagehdlr, scip->mem->probmem, scip->stat,
29262  scip->eventqueue, scip->eventfilter, scip->transprob, (SCIP_Longint)itlim, FALSE, FALSE, FALSE, lperror) );
29263 
29264  /* the LP is infeasible or the objective limit was reached */
29266  || (SCIPlpGetSolstat(scip->lp) == SCIP_LPSOLSTAT_OPTIMAL &&
29267  SCIPisGE(scip, SCIPgetLPObjval(scip), SCIPgetCutoffbound(scip))) )
29268  {
29269  /* analyze the infeasible LP (only if the objective was not changed, all columns are in the LP, and no external
29270  * pricers exist)
29271  */
29272  if( !scip->set->misc_exactsolve && !SCIPlpDivingObjChanged(scip->lp)
29273  && SCIPprobAllColsInLP(scip->transprob, scip->set, scip->lp) )
29274  {
29275  SCIP_CALL( SCIPconflictAnalyzeLP(scip->conflict, scip->mem->probmem, scip->set, scip->stat, scip->transprob,
29276  scip->origprob, scip->tree, scip->lp, scip->branchcand, scip->eventqueue, NULL) );
29277  }
29278 
29279  if( cutoff != NULL )
29280  *cutoff = TRUE;
29281  }
29282 
29283  return SCIP_OKAY;
29284 }
29285 
29286 /** returns the number of the node in the current branch and bound run, where the last LP was solved in diving
29287  * or probing mode
29288  *
29289  * @return the number of the node in the current branch and bound run, where the last LP was solved in diving
29290  * or probing mode.
29291  *
29292  * @pre This method can be called if @p scip is in one of the following stages:
29293  * - \ref SCIP_STAGE_TRANSFORMING
29294  * - \ref SCIP_STAGE_TRANSFORMED
29295  * - \ref SCIP_STAGE_INITPRESOLVE
29296  * - \ref SCIP_STAGE_PRESOLVING
29297  * - \ref SCIP_STAGE_EXITPRESOLVE
29298  * - \ref SCIP_STAGE_PRESOLVED
29299  * - \ref SCIP_STAGE_INITSOLVE
29300  * - \ref SCIP_STAGE_SOLVING
29301  * - \ref SCIP_STAGE_SOLVED
29302  * - \ref SCIP_STAGE_EXITSOLVE
29303  * - \ref SCIP_STAGE_FREETRANS
29304  *
29305  * See \ref SCIP_Stage "SCIP_STAGE" for a complete list of all possible solving stages.
29306  */
29308  SCIP* scip /**< SCIP data structure */
29309  )
29310 {
29311  assert(scip != NULL);
29312 
29313  SCIP_CALL_ABORT( checkStage(scip, "SCIPgetLastDivenode", FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE) );
29314 
29315  return scip->stat->lastdivenode;
29316 }
29317 
29318 /** returns whether we are in diving mode
29319  *
29320  * @return whether we are in diving mode.
29321  *
29322  * @pre This method can be called if @p scip is in one of the following stages:
29323  * - \ref SCIP_STAGE_TRANSFORMING
29324  * - \ref SCIP_STAGE_TRANSFORMED
29325  * - \ref SCIP_STAGE_INITPRESOLVE
29326  * - \ref SCIP_STAGE_PRESOLVING
29327  * - \ref SCIP_STAGE_EXITPRESOLVE
29328  * - \ref SCIP_STAGE_PRESOLVED
29329  * - \ref SCIP_STAGE_INITSOLVE
29330  * - \ref SCIP_STAGE_SOLVING
29331  * - \ref SCIP_STAGE_SOLVED
29332  * - \ref SCIP_STAGE_EXITSOLVE
29333  * - \ref SCIP_STAGE_FREETRANS
29334  *
29335  * See \ref SCIP_Stage "SCIP_STAGE" for a complete list of all possible solving stages.
29336  */
29338  SCIP* scip /**< SCIP data structure */
29339  )
29340 {
29341  assert(scip != NULL);
29342 
29343  SCIP_CALL_ABORT( checkStage(scip, "SCIPinDive", FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE) );
29344 
29345  return SCIPlpDiving(scip->lp);
29346 }
29347 
29348 
29349 
29350 
29351 /*
29352  * probing methods
29353  */
29354 
29355 /** returns whether we are in probing mode; probing mode is activated via SCIPstartProbing() and stopped
29356  * via SCIPendProbing()
29357  *
29358  * @return TRUE, if SCIP is currently in probing mode, otherwise FALSE
29359  *
29360  * @pre This method can be called if @p scip is in one of the following stages:
29361  * - \ref SCIP_STAGE_TRANSFORMED
29362  * - \ref SCIP_STAGE_INITPRESOLVE
29363  * - \ref SCIP_STAGE_PRESOLVING
29364  * - \ref SCIP_STAGE_EXITPRESOLVE
29365  * - \ref SCIP_STAGE_PRESOLVED
29366  * - \ref SCIP_STAGE_INITSOLVE
29367  * - \ref SCIP_STAGE_SOLVING
29368  * - \ref SCIP_STAGE_SOLVED
29369  * - \ref SCIP_STAGE_EXITSOLVE
29370  */
29372  SCIP* scip /**< SCIP data structure */
29373  )
29374 {
29375  SCIP_CALL_ABORT( checkStage(scip, "SCIPinProbing", FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE) );
29376 
29377  return SCIPtreeProbing(scip->tree);
29378 }
29379 
29380 /** initiates probing, making methods SCIPnewProbingNode(), SCIPbacktrackProbing(), SCIPchgVarLbProbing(),
29381  * SCIPchgVarUbProbing(), SCIPfixVarProbing(), SCIPpropagateProbing(), and SCIPsolveProbingLP() available
29382  *
29383  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
29384  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
29385  *
29386  * @pre This method can be called if @p scip is in one of the following stages:
29387  * - \ref SCIP_STAGE_PRESOLVING
29388  * - \ref SCIP_STAGE_SOLVING
29389  *
29390  * @note The collection of variable statistics is turned off during probing. If these statistics should be collected
29391  * during probing use the method SCIPenableVarHistory() to turn the collection explicitly on.
29392  */
29394  SCIP* scip /**< SCIP data structure */
29395  )
29396 {
29397  SCIP_CALL( checkStage(scip, "SCIPstartProbing", FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) );
29398 
29399  if( SCIPtreeProbing(scip->tree) )
29400  {
29401  SCIPerrorMessage("already in probing mode\n");
29402  return SCIP_INVALIDCALL;
29403  }
29404 
29405  if( scip->lp != NULL && SCIPlpDiving(scip->lp) )
29406  {
29407  SCIPerrorMessage("cannot start probing while in diving mode\n");
29408  return SCIP_INVALIDCALL;
29409  }
29410 
29411  SCIP_CALL( SCIPtreeStartProbing(scip->tree, scip->mem->probmem, scip->set, scip->lp, FALSE) );
29412 
29413  /* disables the collection of any statistic for a variable */
29415 
29416  return SCIP_OKAY;
29417 }
29418 
29419 /** creates a new probing sub node, whose changes can be undone by backtracking to a higher node in the probing path
29420  * with a call to SCIPbacktrackProbing();
29421  * using a sub node for each set of probing bound changes can improve conflict analysis
29422  *
29423  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
29424  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
29425  *
29426  * @pre This method can be called if @p scip is in one of the following stages:
29427  * - \ref SCIP_STAGE_PRESOLVING
29428  * - \ref SCIP_STAGE_SOLVING
29429  */
29431  SCIP* scip /**< SCIP data structure */
29432  )
29433 {
29434  SCIP_RETCODE retcode;
29435 
29436  SCIP_CALL( checkStage(scip, "SCIPnewProbingNode", FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) );
29437 
29438  if( !SCIPtreeProbing(scip->tree) )
29439  {
29440  SCIPerrorMessage("not in probing mode\n");
29441  return SCIP_INVALIDCALL;
29442  }
29443 
29444  retcode = SCIPtreeCreateProbingNode(scip->tree, scip->mem->probmem, scip->set, scip->lp);
29445 
29446  if( retcode == SCIP_MAXDEPTHLEVEL )
29447  {
29448  SCIPwarningMessage(scip, "probing reached maximal depth; it should be stopped\n");
29449  }
29450  SCIP_CALL( retcode );
29451 
29452  return SCIP_OKAY;
29453 }
29454 
29455 /** returns the current probing depth
29456  *
29457  * @return the probing depth, i.e. the number of probing sub nodes existing in the probing path
29458  *
29459  * @pre This method can be called if @p scip is in one of the following stages:
29460  * - \ref SCIP_STAGE_PRESOLVING
29461  * - \ref SCIP_STAGE_SOLVING
29462  */
29464  SCIP* scip /**< SCIP data structure */
29465  )
29466 {
29467  SCIP_CALL_ABORT( checkStage(scip, "SCIPgetProbingDepth", FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) );
29468 
29469  if( !SCIPtreeProbing(scip->tree) )
29470  {
29471  SCIPerrorMessage("not in probing mode\n");
29472  SCIPABORT();
29473  return -1; /*lint !e527*/
29474  }
29475 
29476  return SCIPtreeGetProbingDepth(scip->tree);
29477 }
29478 
29479 /** undoes all changes to the problem applied in probing up to the given probing depth;
29480  * the changes of the probing node of the given probing depth are the last ones that remain active;
29481  * changes that were applied before calling SCIPnewProbingNode() cannot be undone
29482  *
29483  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
29484  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
29485  *
29486  * @pre This method can be called if @p scip is in one of the following stages:
29487  * - \ref SCIP_STAGE_PRESOLVING
29488  * - \ref SCIP_STAGE_SOLVING
29489  */
29491  SCIP* scip, /**< SCIP data structure */
29492  int probingdepth /**< probing depth of the node in the probing path that should be reactivated */
29493  )
29494 {
29495  SCIP_CALL( checkStage(scip, "SCIPbacktrackProbing", FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) );
29496 
29497  if( !SCIPtreeProbing(scip->tree) )
29498  {
29499  SCIPerrorMessage("not in probing mode\n");
29500  return SCIP_INVALIDCALL;
29501  }
29502  if( probingdepth < 0 || probingdepth > SCIPtreeGetProbingDepth(scip->tree) )
29503  {
29504  SCIPerrorMessage("backtracking probing depth %d out of current probing range [0,%d]\n",
29505  probingdepth, SCIPtreeGetProbingDepth(scip->tree));
29506  return SCIP_INVALIDDATA;
29507  }
29508 
29509  SCIP_CALL( SCIPtreeBacktrackProbing(scip->tree, scip->mem->probmem, scip->set, scip->stat, scip->transprob,
29510  scip->origprob, scip->lp, scip->branchcand, scip->eventqueue, scip->eventfilter, probingdepth) );
29511 
29512  return SCIP_OKAY;
29513 }
29514 
29515 /** quits probing and resets bounds and constraints to the focus node's environment
29516  *
29517  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
29518  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
29519  *
29520  * @pre This method can be called if @p scip is in one of the following stages:
29521  * - \ref SCIP_STAGE_PRESOLVING
29522  * - \ref SCIP_STAGE_SOLVING
29523  */
29525  SCIP* scip /**< SCIP data structure */
29526  )
29527 {
29528  SCIP_CALL( checkStage(scip, "SCIPendProbing", FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) );
29529 
29530  if( !SCIPtreeProbing(scip->tree) )
29531  {
29532  SCIPerrorMessage("not in probing mode\n");
29533  return SCIP_INVALIDCALL;
29534  }
29535 
29536  /* switch back from probing to normal operation mode and restore variables and constraints to focus node */
29537  SCIP_CALL( SCIPtreeEndProbing(scip->tree, scip->mem->probmem, scip->set, scip->messagehdlr, scip->stat,
29538  scip->transprob, scip->origprob, scip->lp,
29539  scip->branchcand, scip->eventqueue, scip->eventfilter) );
29540 
29541  /* enables the collection of statistics for a variable */
29543 
29544  return SCIP_OKAY;
29545 }
29546 
29547 /** injects a change of variable's lower bound into current probing node; the same can also be achieved with a call to
29548  * SCIPchgVarLb(), but in this case, the bound change would be treated like a deduction instead of a branching decision
29549  *
29550  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
29551  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
29552  *
29553  * @pre This method can be called if @p scip is in one of the following stages:
29554  * - \ref SCIP_STAGE_PRESOLVING
29555  * - \ref SCIP_STAGE_SOLVING
29556  */
29558  SCIP* scip, /**< SCIP data structure */
29559  SCIP_VAR* var, /**< variable to change the bound for */
29560  SCIP_Real newbound /**< new value for bound */
29561  )
29562 {
29563  SCIP_CALL( checkStage(scip, "SCIPchgVarLbProbing", FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) );
29564 
29565  if( !SCIPtreeProbing(scip->tree) )
29566  {
29567  SCIPerrorMessage("not in probing mode\n");
29568  return SCIP_INVALIDCALL;
29569  }
29571 
29572  SCIPvarAdjustLb(var, scip->set, &newbound);
29573 
29575  scip->transprob, scip->origprob, scip->tree, scip->lp, scip->branchcand, scip->eventqueue, var, newbound,
29577 
29578  return SCIP_OKAY;
29579 }
29580 
29581 /** injects a change of variable's upper bound into current probing node; the same can also be achieved with a call to
29582  * SCIPchgVarUb(), but in this case, the bound change would be treated like a deduction instead of a branching decision
29583  *
29584  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
29585  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
29586  *
29587  * @pre This method can be called if @p scip is in one of the following stages:
29588  * - \ref SCIP_STAGE_PRESOLVING
29589  * - \ref SCIP_STAGE_SOLVING
29590  */
29592  SCIP* scip, /**< SCIP data structure */
29593  SCIP_VAR* var, /**< variable to change the bound for */
29594  SCIP_Real newbound /**< new value for bound */
29595  )
29596 {
29597  SCIP_CALL( checkStage(scip, "SCIPchgVarUbProbing", FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) );
29598 
29599  if( !SCIPtreeProbing(scip->tree) )
29600  {
29601  SCIPerrorMessage("not in probing mode\n");
29602  return SCIP_INVALIDCALL;
29603  }
29605 
29606  SCIPvarAdjustUb(var, scip->set, &newbound);
29607 
29609  scip->transprob, scip->origprob, scip->tree, scip->lp, scip->branchcand, scip->eventqueue, var, newbound,
29611 
29612  return SCIP_OKAY;
29613 }
29614 
29615 /** injects a change of variable's bounds into current probing node to fix the variable to the specified value;
29616  * the same can also be achieved with a call to SCIPfixVar(), but in this case, the bound changes would be treated
29617  * like deductions instead of branching decisions
29618  *
29619  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
29620  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
29621  *
29622  * @pre This method can be called if @p scip is in one of the following stages:
29623  * - \ref SCIP_STAGE_PRESOLVING
29624  * - \ref SCIP_STAGE_SOLVING
29625  */
29627  SCIP* scip, /**< SCIP data structure */
29628  SCIP_VAR* var, /**< variable to change the bound for */
29629  SCIP_Real fixedval /**< value to fix variable to */
29630  )
29631 {
29632  SCIP_Real fixlb;
29633  SCIP_Real fixub;
29634 
29635  SCIP_CALL( checkStage(scip, "SCIPfixVarProbing", FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) );
29636 
29637  if( !SCIPtreeProbing(scip->tree) )
29638  {
29639  SCIPerrorMessage("not in probing mode\n");
29640  return SCIP_INVALIDCALL;
29641  }
29643 
29644  /* we adjust the fixing value here and compare the old bound with the adjusted values because otherwise,
29645  * it might happen that the unadjusted value is better and we add the boundchange,
29646  * but within SCIPnodeAddBoundchg() the bounds are adjusted - using the feasibility epsilon for integer variables -
29647  * and it is asserted, that the bound is still better than the old one which might then be incorrect.
29648  */
29649  fixlb = fixedval;
29650  fixub = fixedval;
29651  SCIPvarAdjustLb(var, scip->set, &fixlb);
29652  SCIPvarAdjustUb(var, scip->set, &fixub);
29653  assert(SCIPsetIsEQ(scip->set, fixlb, fixub));
29654 
29655  if( SCIPsetIsGT(scip->set, fixlb, SCIPvarGetLbLocal(var)) )
29656  {
29658  scip->transprob, scip->origprob, scip->tree, scip->lp, scip->branchcand, scip->eventqueue, var, fixlb,
29660  }
29661  if( SCIPsetIsLT(scip->set, fixub, SCIPvarGetUbLocal(var)) )
29662  {
29664  scip->transprob, scip->origprob, scip->tree, scip->lp, scip->branchcand, scip->eventqueue, var, fixub,
29666  }
29667 
29668  return SCIP_OKAY;
29669 }
29670 
29671 /** applies domain propagation on the probing sub problem, that was changed after SCIPstartProbing() was called;
29672  * the propagated domains of the variables can be accessed with the usual bound accessing calls SCIPvarGetLbLocal()
29673  * and SCIPvarGetUbLocal(); the propagation is only valid locally, i.e. the local bounds as well as the changed
29674  * bounds due to SCIPchgVarLbProbing(), SCIPchgVarUbProbing(), and SCIPfixVarProbing() are used for propagation
29675  *
29676  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
29677  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
29678  *
29679  * @pre This method can be called if @p scip is in one of the following stages:
29680  * - \ref SCIP_STAGE_PRESOLVING
29681  * - \ref SCIP_STAGE_SOLVING
29682  */
29684  SCIP* scip, /**< SCIP data structure */
29685  int maxproprounds, /**< maximal number of propagation rounds (-1: no limit, 0: parameter settings) */
29686  SCIP_Bool* cutoff, /**< pointer to store whether the probing node can be cut off */
29687  SCIP_Longint* ndomredsfound /**< pointer to store the number of domain reductions found, or NULL */
29688  )
29689 {
29690  SCIP_CALL( checkStage(scip, "SCIPpropagateProbing", FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) );
29691 
29692  if( !SCIPtreeProbing(scip->tree) )
29693  {
29694  SCIPerrorMessage("not in probing mode\n");
29695  return SCIP_INVALIDCALL;
29696  }
29697 
29698  if( ndomredsfound != NULL )
29699  *ndomredsfound = -(scip->stat->nprobboundchgs + scip->stat->nprobholechgs);
29700 
29701  SCIP_CALL( SCIPpropagateDomains(scip->mem->probmem, scip->set, scip->stat, scip->transprob, scip->origprob,
29702  scip->primal, scip->tree, scip->lp, scip->branchcand, scip->eventqueue, scip->conflict,
29703  SCIPgetDepth(scip), maxproprounds, SCIP_PROPTIMING_ALWAYS, cutoff) );
29704 
29705  if( ndomredsfound != NULL )
29706  *ndomredsfound += scip->stat->nprobboundchgs + scip->stat->nprobholechgs;
29707 
29708  return SCIP_OKAY;
29709 }
29710 
29711 /** applies domain propagation on the probing sub problem, that was changed after SCIPstartProbing() was called;
29712  * only propagations of the binary variables fixed at the current probing node that are triggered by the implication
29713  * graph and the clique table are applied;
29714  * the propagated domains of the variables can be accessed with the usual bound accessing calls SCIPvarGetLbLocal()
29715  * and SCIPvarGetUbLocal(); the propagation is only valid locally, i.e. the local bounds as well as the changed
29716  * bounds due to SCIPchgVarLbProbing(), SCIPchgVarUbProbing(), and SCIPfixVarProbing() are used for propagation
29717  *
29718  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
29719  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
29720  *
29721  * @pre This method can be called if @p scip is in one of the following stages:
29722  * - \ref SCIP_STAGE_PRESOLVING
29723  * - \ref SCIP_STAGE_SOLVING
29724  */
29726  SCIP* scip, /**< SCIP data structure */
29727  SCIP_Bool* cutoff /**< pointer to store whether the probing node can be cut off */
29728  )
29729 {
29730  SCIP_CALL( checkStage(scip, "SCIPpropagateProbingImplications", FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) );
29731 
29732  if( !SCIPtreeProbing(scip->tree) )
29733  {
29734  SCIPerrorMessage("not in probing mode\n");
29735  return SCIP_INVALIDCALL;
29736  }
29737 
29739  scip->transprob, scip->origprob, scip->tree, scip->lp, scip->branchcand, scip->eventqueue, cutoff) );
29740 
29741  return SCIP_OKAY;
29742 }
29743 
29744 /** solves the LP at the current probing node (cannot be applied at preprocessing stage) with or without pricing */
29745 static
29747  SCIP* scip, /**< SCIP data structure */
29748  int itlim, /**< maximal number of LP iterations to perform, or -1 for no limit */
29749  SCIP_Bool pricing, /**< should pricing be applied? */
29750  SCIP_Bool pretendroot, /**< should the pricers be called as if we are at the root node? */
29751  SCIP_Bool displayinfo, /**< should info lines be displayed after each pricing round? */
29752  int maxpricerounds, /**< maximal number of pricing rounds (-1: no limit) */
29753  SCIP_Bool* lperror, /**< pointer to store whether an unresolved LP error occurred */
29754  SCIP_Bool* cutoff /**< pointer to store whether the probing LP was infeasible or the objective
29755  * limit was reached (or NULL, if not needed) */
29756  )
29757 {
29758  SCIP_Bool initcutoff;
29759 
29760  assert(lperror != NULL);
29761  assert(SCIPtreeIsFocusNodeLPConstructed(scip->tree));
29762 
29763  if( !SCIPtreeProbing(scip->tree) )
29764  {
29765  SCIPerrorMessage("not in probing mode\n");
29766  return SCIP_INVALIDCALL;
29767  }
29768  assert(SCIPtreeGetCurrentDepth(scip->tree) > 0);
29769 
29770  SCIP_CALL( SCIPinitConssLP(scip->mem->probmem, scip->set, scip->sepastore, scip->stat, scip->transprob,
29771  scip->origprob, scip->tree, scip->lp, scip->branchcand, scip->eventqueue, scip->eventfilter, FALSE, FALSE,
29772  &initcutoff) );
29773 
29774  if( initcutoff )
29775  {
29776  if( cutoff != NULL )
29777  *cutoff = TRUE;
29778 
29779  return SCIP_OKAY;
29780  }
29781  else if( cutoff != NULL )
29782  *cutoff = FALSE;
29783 
29784  /* load the LP state (if necessary) */
29785  SCIP_CALL( SCIPtreeLoadProbingLPState(scip->tree, scip->mem->probmem, scip->set, scip->eventqueue, scip->lp) );
29786 
29787  /* solve probing LP */
29788  SCIP_CALL( SCIPlpSolveAndEval(scip->lp, scip->set, scip->messagehdlr, scip->mem->probmem, scip->stat,
29789  scip->eventqueue, scip->eventfilter, scip->transprob, (SCIP_Longint)itlim, FALSE, FALSE, FALSE, lperror) );
29790 
29791  assert((*lperror) || SCIPlpGetSolstat(scip->lp) != SCIP_LPSOLSTAT_NOTSOLVED);
29792 
29793  /* mark the probing node to have a solved LP */
29794  if( !(*lperror) )
29795  {
29796  SCIP_CALL( SCIPtreeMarkProbingNodeHasLP(scip->tree, scip->mem->probmem, scip->lp) );
29797 
29798  /* call pricing */
29799  if( pricing )
29800  {
29801  SCIP_Bool mustsepa;
29802  int npricedcolvars;
29803  SCIP_Bool result;
29804 
29805  mustsepa = FALSE;
29806  SCIP_CALL( SCIPpriceLoop(scip->mem->probmem, scip->set, scip->messagehdlr, scip->stat, scip->transprob,
29807  scip->origprob, scip->primal, scip->tree, scip->lp, scip->pricestore, scip->sepastore, scip->branchcand,
29808  scip->eventqueue, scip->eventfilter, pretendroot, displayinfo, maxpricerounds,
29809  &npricedcolvars, &mustsepa, lperror, &result) );
29810 
29811  /* mark the probing node again to update the LP size in the node and the tree path */
29812  if( !(*lperror) )
29813  {
29814  SCIP_CALL( SCIPtreeMarkProbingNodeHasLP(scip->tree, scip->mem->probmem, scip->lp) );
29815  }
29816  }
29817  }
29818 
29819  /* remember that probing might have changed the LPi state; this holds even if solving returned with an LP error */
29820  scip->tree->probingsolvedlp = TRUE;
29821 
29822  /* the LP is infeasible or the objective limit was reached */
29823  if( !(*lperror) && SCIPlpIsRelax(scip->lp) && (SCIPlpGetSolstat(scip->lp) == SCIP_LPSOLSTAT_INFEASIBLE
29826  && SCIPisGE(scip, SCIPgetLPObjval(scip), SCIPgetCutoffbound(scip)))) )
29827  {
29828  /* analyze the infeasible LP (only if all columns are in the LP and no external pricers exist) */
29829  if( !scip->set->misc_exactsolve && SCIPprobAllColsInLP(scip->transprob, scip->set, scip->lp) )
29830  {
29831  SCIP_CALL( SCIPconflictAnalyzeLP(scip->conflict, scip->mem->probmem, scip->set, scip->stat, scip->transprob,
29832  scip->origprob, scip->tree, scip->lp, scip->branchcand, scip->eventqueue, NULL) );
29833  }
29834 
29835  if( cutoff != NULL )
29836  *cutoff = TRUE;
29837  }
29838 
29839  return SCIP_OKAY;
29840 }
29841 
29842 /** solves the LP at the current probing node (cannot be applied at preprocessing stage);
29843  * no separation or pricing is applied
29844  *
29845  * The LP has to be constructed before (you can use SCIPisLPConstructed() or SCIPconstructLP()).
29846  *
29847  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
29848  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
29849  *
29850  * @pre This method can be called if @p scip is in one of the following stages:
29851  * - \ref SCIP_STAGE_SOLVING
29852  */
29854  SCIP* scip, /**< SCIP data structure */
29855  int itlim, /**< maximal number of LP iterations to perform, or -1 for no limit */
29856  SCIP_Bool* lperror, /**< pointer to store whether an unresolved LP error occurred */
29857  SCIP_Bool* cutoff /**< pointer to store whether the probing LP was infeasible or the objective
29858  * limit was reached (or NULL, if not needed) */
29859  )
29860 {
29861  SCIP_CALL( checkStage(scip, "SCIPsolveProbingLP", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) );
29862 
29863  SCIP_CALL( solveProbingLP(scip, itlim, FALSE, FALSE, FALSE, -1, lperror, cutoff) );
29864 
29865  return SCIP_OKAY;
29866 }
29867 
29868 /** solves the LP at the current probing node (cannot be applied at preprocessing stage) and applies pricing
29869  * until the LP is solved to optimality; no separation is applied
29870  *
29871  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
29872  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
29873  *
29874  * @pre This method can be called if @p scip is in one of the following stages:
29875  * - \ref SCIP_STAGE_SOLVING
29876  */
29878  SCIP* scip, /**< SCIP data structure */
29879  SCIP_Bool pretendroot, /**< should the pricers be called as if we were at the root node? */
29880  SCIP_Bool displayinfo, /**< should info lines be displayed after each pricing round? */
29881  int maxpricerounds, /**< maximal number of pricing rounds (-1: no limit);
29882  * a finite limit means that the LP might not be solved to optimality! */
29883  SCIP_Bool* lperror, /**< pointer to store whether an unresolved LP error occurred */
29884  SCIP_Bool* cutoff /**< pointer to store whether the probing LP was infeasible or the objective
29885  * limit was reached (or NULL, if not needed) */
29886  )
29887 {
29888  SCIP_CALL( checkStage(scip, "SCIPsolveProbingLPWithPricing", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) );
29889 
29890  SCIP_CALL( solveProbingLP(scip, -1, TRUE, pretendroot, displayinfo, maxpricerounds, lperror, cutoff) );
29891 
29892  return SCIP_OKAY;
29893 }
29894 
29895 
29896 
29897 
29898 /*
29899  * branching methods
29900  */
29901 
29902 /** gets branching candidates for LP solution branching (fractional variables) along with solution values,
29903  * fractionalities, and number of branching candidates; The number of branching candidates does NOT
29904  * account for fractional implicit integer variables which should not be used for branching decisions.
29905  *
29906  * Fractional implicit integer variables are stored at the positions *nlpcands to *nlpcands + *nfracimplvars - 1
29907  *
29908  * branching rules should always select the branching candidate among the first npriolpcands of the candidate
29909  * list
29910  *
29911  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
29912  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
29913  *
29914  * @pre This method can be called if @p scip is in one of the following stages:
29915  * - \ref SCIP_STAGE_SOLVING
29916  *
29917  * See \ref SCIP_Stage "SCIP_STAGE" for a complete list of all possible solving stages.
29918  */
29920  SCIP* scip, /**< SCIP data structure */
29921  SCIP_VAR*** lpcands, /**< pointer to store the array of LP branching candidates, or NULL */
29922  SCIP_Real** lpcandssol, /**< pointer to store the array of LP candidate solution values, or NULL */
29923  SCIP_Real** lpcandsfrac, /**< pointer to store the array of LP candidate fractionalities, or NULL */
29924  int* nlpcands, /**< pointer to store the number of LP branching candidates, or NULL */
29925  int* npriolpcands, /**< pointer to store the number of candidates with maximal priority, or NULL */
29926  int* nfracimplvars /**< pointer to store the number of fractional implicit integer variables, or NULL */
29927  )
29928 {
29929  SCIP_CALL( checkStage(scip, "SCIPgetLPBranchCands", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) );
29930 
29932  {
29933  SCIPerrorMessage("LP not solved to optimality - solstat=%d\n", SCIPlpGetSolstat(scip->lp));
29934  return SCIP_INVALIDDATA;
29935  }
29936 
29937  SCIP_CALL( SCIPbranchcandGetLPCands(scip->branchcand, scip->set, scip->stat, scip->lp,
29938  lpcands, lpcandssol, lpcandsfrac, nlpcands, npriolpcands, nfracimplvars) );
29939 
29940  return SCIP_OKAY;
29941 }
29942 
29943 /** gets number of branching candidates for LP solution branching (number of fractional variables)
29944  *
29945  * @return the number of branching candidates for LP solution branching (number of fractional variables).
29946  *
29947  * @pre This method can be called if @p scip is in one of the following stages:
29948  * - \ref SCIP_STAGE_SOLVING
29949  *
29950  * See \ref SCIP_Stage "SCIP_STAGE" for a complete list of all possible solving stages.
29951  */
29953  SCIP* scip /**< SCIP data structure */
29954  )
29955 {
29956  SCIP_RETCODE retcode;
29957  int nlpcands;
29958 
29959  SCIP_CALL_ABORT( checkStage(scip, "SCIPgetNLPBranchCands", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) );
29960 
29962  {
29963  SCIPerrorMessage("LP not solved to optimality\n");
29964  SCIPABORT();
29965  return 0; /*lint !e527*/
29966  }
29967 
29968  retcode = SCIPbranchcandGetLPCands(scip->branchcand, scip->set, scip->stat, scip->lp,
29969  NULL, NULL, NULL, &nlpcands, NULL, NULL);
29970 
29971  if( retcode != SCIP_OKAY )
29972  {
29973  SCIPerrorMessage("Error <%u> during computation of the number of LP branching candidates\n", retcode);
29974  SCIPABORT();
29975  return 0; /*lint !e527*/
29976  }
29977 
29978  return nlpcands;
29979 }
29980 
29981 /** gets number of branching candidates with maximal priority for LP solution branching
29982  *
29983  * @return the number of branching candidates with maximal priority for LP solution branching.
29984  *
29985  * @pre This method can be called if @p scip is in one of the following stages:
29986  * - \ref SCIP_STAGE_SOLVING
29987  *
29988  * See \ref SCIP_Stage "SCIP_STAGE" for a complete list of all possible solving stages.
29989  */
29991  SCIP* scip /**< SCIP data structure */
29992  )
29993 {
29994  SCIP_RETCODE retcode;
29995  int npriolpcands;
29996 
29997  SCIP_CALL_ABORT( checkStage(scip, "SCIPgetNPrioLPBranchCands", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) );
29998 
30000  {
30001  SCIPerrorMessage("LP not solved to optimality\n");
30002  SCIPABORT();
30003  return 0; /*lint !e527*/
30004  }
30005 
30006  retcode = SCIPbranchcandGetLPCands(scip->branchcand, scip->set, scip->stat, scip->lp,
30007  NULL, NULL, NULL, NULL, &npriolpcands, NULL);
30008 
30009  if( retcode != SCIP_OKAY )
30010  {
30011  SCIPerrorMessage("Error <%u> during computation of the number of LP branching candidates with maximal priority\n", retcode);
30012  SCIPABORT();
30013  return 0; /*lint !e527*/
30014  }
30015 
30016  return npriolpcands;
30017 }
30018 
30019 /** gets external branching candidates along with solution values, scores, and number of branching candidates;
30020  * these branching candidates can be used by relaxations or nonlinear constraint handlers
30021  * branching rules should always select the branching candidate among the first nprioexterncands of the candidate
30022  * list
30023  *
30024  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
30025  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
30026  *
30027  * @pre This method can be called if @p scip is in one of the following stages:
30028  * - \ref SCIP_STAGE_SOLVING
30029  *
30030  * See \ref SCIP_Stage "SCIP_STAGE" for a complete list of all possible solving stages.
30031  *
30032  * @note Candidate variables with maximal priority are ordered: binaries first, then integers, implicit integers and
30033  * continuous last.
30034  */
30036  SCIP* scip, /**< SCIP data structure */
30037  SCIP_VAR*** externcands, /**< pointer to store the array of extern branching candidates, or NULL */
30038  SCIP_Real** externcandssol, /**< pointer to store the array of extern candidate solution values, or NULL */
30039  SCIP_Real** externcandsscore, /**< pointer to store the array of extern candidate scores, or NULL */
30040  int* nexterncands, /**< pointer to store the number of extern branching candidates, or NULL */
30041  int* nprioexterncands, /**< pointer to store the number of candidates with maximal priority, or NULL */
30042  int* nprioexternbins, /**< pointer to store the number of binary candidates with maximal priority, or NULL */
30043  int* nprioexternints, /**< pointer to store the number of integer candidates with maximal priority, or NULL */
30044  int* nprioexternimpls /**< pointer to store the number of implicit integer candidates with maximal priority,
30045  * or NULL */
30046  )
30047 {
30048  assert(scip != NULL);
30049 
30050  SCIP_CALL( checkStage(scip, "SCIPgetExternBranchCands", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) );
30051 
30052  SCIP_CALL( SCIPbranchcandGetExternCands(scip->branchcand, externcands, externcandssol, externcandsscore, nexterncands,
30053  nprioexterncands, nprioexternbins, nprioexternints, nprioexternimpls) );
30054 
30055  return SCIP_OKAY;
30056 }
30057 
30058 /** gets number of external branching candidates
30059  *
30060  * @return the number of external branching candidates.
30061  *
30062  * @pre This method can be called if @p scip is in one of the following stages:
30063  * - \ref SCIP_STAGE_SOLVING
30064  *
30065  * See \ref SCIP_Stage "SCIP_STAGE" for a complete list of all possible solving stages.
30066  */
30068  SCIP* scip /**< SCIP data structure */
30069  )
30070 {
30071  assert(scip != NULL);
30072 
30073  SCIP_CALL_ABORT( checkStage(scip, "SCIPgetNExternBranchCands", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) );
30074 
30076 }
30077 
30078 /** gets number of external branching candidates with maximal branch priority
30079  *
30080  * @return the number of external branching candidates with maximal branch priority.
30081  *
30082  * @pre This method can be called if @p scip is in one of the following stages:
30083  * - \ref SCIP_STAGE_SOLVING
30084  *
30085  * See \ref SCIP_Stage "SCIP_STAGE" for a complete list of all possible solving stages.
30086  */
30088  SCIP* scip /**< SCIP data structure */
30089  )
30090 {
30091  assert(scip != NULL);
30092 
30093  SCIP_CALL_ABORT( checkStage(scip, "SCIPgetNPrioExternBranchCands", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) );
30094 
30096 }
30097 
30098 /** gets number of binary external branching candidates with maximal branch priority
30099  *
30100  * @return the number of binary external branching candidates with maximal branch priority.
30101  *
30102  * @pre This method can be called if @p scip is in one of the following stages:
30103  * - \ref SCIP_STAGE_SOLVING
30104  *
30105  * See \ref SCIP_Stage "SCIP_STAGE" for a complete list of all possible solving stages.
30106  */
30108  SCIP* scip /**< SCIP data structure */
30109  )
30110 {
30111  assert(scip != NULL);
30112 
30113  SCIP_CALL_ABORT( checkStage(scip, "SCIPgetNPrioExternBranchBins", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) );
30114 
30116 }
30117 
30118 
30119 /** gets number of integer external branching candidates with maximal branch priority
30120  *
30121  * @return the number of integer external branching candidates with maximal branch priority.
30122  *
30123  * @pre This method can be called if @p scip is in one of the following stages:
30124  * - \ref SCIP_STAGE_SOLVING
30125  *
30126  * See \ref SCIP_Stage "SCIP_STAGE" for a complete list of all possible solving stages.
30127  */
30129  SCIP* scip /**< SCIP data structure */
30130  )
30131 {
30132  assert(scip != NULL);
30133 
30134  SCIP_CALL_ABORT( checkStage(scip, "SCIPgetNPrioExternBranchInts", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) );
30135 
30137 }
30138 
30139 /** gets number of implicit integer external branching candidates with maximal branch priority
30140  *
30141  * @return the number of implicit integer external branching candidates with maximal branch priority.
30142  *
30143  * @pre This method can be called if @p scip is in one of the following stages:
30144  * - \ref SCIP_STAGE_SOLVING
30145  *
30146  * See \ref SCIP_Stage "SCIP_STAGE" for a complete list of all possible solving stages.
30147  */
30149  SCIP* scip /**< SCIP data structure */
30150  )
30151 {
30152  assert(scip != NULL);
30153 
30154  SCIP_CALL_ABORT( checkStage(scip, "SCIPgetNPrioExternBranchImpls", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) );
30155 
30157 }
30158 
30159 /** gets number of continuous external branching candidates with maximal branch priority
30160  *
30161  * @return the number of continuous external branching candidates with maximal branch priority.
30162  *
30163  * @pre This method can be called if @p scip is in one of the following stages:
30164  * - \ref SCIP_STAGE_SOLVING
30165  *
30166  * See \ref SCIP_Stage "SCIP_STAGE" for a complete list of all possible solving stages.
30167  */
30169  SCIP* scip /**< SCIP data structure */
30170  )
30171 {
30172  assert(scip != NULL);
30173 
30174  SCIP_CALL_ABORT( checkStage(scip, "SCIPgetNPrioExternBranchConts", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) );
30175 
30177 }
30178 
30179 /** insert variable, its score and its solution value into the external branching candidate storage
30180  * the relative difference of the current lower and upper bounds of a continuous variable must be at least epsilon
30181  *
30182  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
30183  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
30184  *
30185  * @pre This method can be called if @p scip is in one of the following stages:
30186  * - \ref SCIP_STAGE_SOLVING
30187  *
30188  * See \ref SCIP_Stage "SCIP_STAGE" for a complete list of all possible solving stages.
30189  */
30191  SCIP* scip, /**< SCIP data structure */
30192  SCIP_VAR* var, /**< variable to insert */
30193  SCIP_Real score, /**< score of external candidate, e.g. infeasibility */
30194  SCIP_Real solval /**< value of the variable in the current solution */
30195  )
30196 {
30197  assert(scip != NULL);
30198 
30199  SCIP_CALL( checkStage(scip, "SCIPaddExternBranchCand", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) );
30200 
30201  SCIP_CALL( SCIPbranchcandAddExternCand(scip->branchcand, scip->set, var, score, solval) );
30202 
30203  return SCIP_OKAY;
30204 }
30205 
30206 /** removes all external candidates from the storage for external branching
30207  *
30208  * @pre This method can be called if @p scip is in one of the following stages:
30209  * - \ref SCIP_STAGE_SOLVING
30210  *
30211  * See \ref SCIP_Stage "SCIP_STAGE" for a complete list of all possible solving stages.
30212  */
30214  SCIP* scip /**< SCIP data structure */
30215  )
30216 {
30217  assert(scip != NULL);
30218 
30219  SCIP_CALL_ABORT( checkStage(scip, "SCIPclearExternBranchCands", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) );
30220 
30222 }
30223 
30224 /** checks whether the given variable is contained in the candidate storage for external branching
30225  *
30226  * @return whether the given variable is contained in the candidate storage for external branching.
30227  *
30228  * @pre This method can be called if @p scip is in one of the following stages:
30229  * - \ref SCIP_STAGE_SOLVING
30230  *
30231  * See \ref SCIP_Stage "SCIP_STAGE" for a complete list of all possible solving stages.
30232  */
30234  SCIP* scip, /**< SCIP data structure */
30235  SCIP_VAR* var /**< variable to look for */
30236  )
30237 {
30238  assert(scip != NULL);
30239 
30240  SCIP_CALL_ABORT( checkStage(scip, "SCIPcontainsExternBranchCand", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) );
30241 
30242  return SCIPbranchcandContainsExternCand(scip->branchcand, var);
30243 }
30244 
30245 /** gets branching candidates for pseudo solution branching (non-fixed variables) along with the number of candidates
30246  *
30247  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
30248  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
30249  *
30250  * @pre This method can be called if @p scip is in one of the following stages:
30251  * - \ref SCIP_STAGE_PRESOLVING
30252  * - \ref SCIP_STAGE_SOLVING
30253  *
30254  * See \ref SCIP_Stage "SCIP_STAGE" for a complete list of all possible solving stages.
30255  */
30257  SCIP* scip, /**< SCIP data structure */
30258  SCIP_VAR*** pseudocands, /**< pointer to store the array of pseudo branching candidates, or NULL */
30259  int* npseudocands, /**< pointer to store the number of pseudo branching candidates, or NULL */
30260  int* npriopseudocands /**< pointer to store the number of candidates with maximal priority, or NULL */
30261  )
30262 {
30263  SCIP_CALL( checkStage(scip, "SCIPgetPseudoBranchCands", FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) );
30264 
30266  pseudocands, npseudocands, npriopseudocands) );
30267 
30268  return SCIP_OKAY;
30269 }
30270 
30271 /** gets number of branching candidates for pseudo solution branching (non-fixed variables)
30272  *
30273  * @return the number branching candidates for pseudo solution branching (non-fixed variables).
30274  *
30275  * @pre This method can be called if @p scip is in one of the following stages:
30276  * - \ref SCIP_STAGE_PRESOLVING
30277  * - \ref SCIP_STAGE_SOLVING
30278  *
30279  * See \ref SCIP_Stage "SCIP_STAGE" for a complete list of all possible solving stages.
30280  */
30282  SCIP* scip /**< SCIP data structure */
30283  )
30284 {
30285  SCIP_CALL_ABORT( checkStage(scip, "SCIPgetNPseudoBranchCands", FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) );
30286 
30288 }
30289 
30290 /** gets number of branching candidates with maximal branch priority for pseudo solution branching
30291  *
30292  * @return the number of branching candidates with maximal branch priority for pseudo solution branching.
30293  *
30294  * @pre This method can be called if @p scip is in one of the following stages:
30295  * - \ref SCIP_STAGE_PRESOLVING
30296  * - \ref SCIP_STAGE_SOLVING
30297  *
30298  * See \ref SCIP_Stage "SCIP_STAGE" for a complete list of all possible solving stages.
30299  */
30301  SCIP* scip /**< SCIP data structure */
30302  )
30303 {
30304  SCIP_CALL_ABORT( checkStage(scip, "SCIPgetNPrioPseudoBranchCands", FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) );
30305 
30307 }
30308 
30309 /** gets number of binary branching candidates with maximal branch priority for pseudo solution branching
30310  *
30311  * @return the number of binary branching candidates with maximal branch priority for pseudo solution branching.
30312  *
30313  * @pre This method can be called if @p scip is in one of the following stages:
30314  * - \ref SCIP_STAGE_SOLVING
30315  *
30316  * See \ref SCIP_Stage "SCIP_STAGE" for a complete list of all possible solving stages.
30317  */
30319  SCIP* scip /**< SCIP data structure */
30320  )
30321 {
30322  SCIP_CALL_ABORT( checkStage(scip, "SCIPgetNPrioPseudoBranchBins", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) );
30323 
30325 }
30326 
30327 /** gets number of integer branching candidates with maximal branch priority for pseudo solution branching
30328  *
30329  * @return the number of integer branching candidates with maximal branch priority for pseudo solution branching.
30330  *
30331  * @pre This method can be called if @p scip is in one of the following stages:
30332  * - \ref SCIP_STAGE_SOLVING
30333  *
30334  * See \ref SCIP_Stage "SCIP_STAGE" for a complete list of all possible solving stages.
30335  */
30337  SCIP* scip /**< SCIP data structure */
30338  )
30339 {
30340  SCIP_CALL_ABORT( checkStage(scip, "SCIPgetNPrioPseudoBranchInts", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) );
30341 
30343 }
30344 
30345 /** gets number of implicit integer branching candidates with maximal branch priority for pseudo solution branching
30346  *
30347  * @return the number of implicit integer branching candidates with maximal branch priority for pseudo solution branching.
30348  *
30349  * @pre This method can be called if @p scip is in one of the following stages:
30350  * - \ref SCIP_STAGE_SOLVING
30351  *
30352  * See \ref SCIP_Stage "SCIP_STAGE" for a complete list of all possible solving stages.
30353  */
30355  SCIP* scip /**< SCIP data structure */
30356  )
30357 {
30358  SCIP_CALL_ABORT( checkStage(scip, "SCIPgetNPrioPseudoBranchImpls", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) );
30359 
30361 }
30362 
30363 /** calculates the branching score out of the gain predictions for a binary branching
30364  *
30365  * @return the branching score out of the gain predictions for a binary branching.
30366  *
30367  * @pre This method can be called if @p scip is in one of the following stages:
30368  * - \ref SCIP_STAGE_SOLVING
30369  *
30370  * See \ref SCIP_Stage "SCIP_STAGE" for a complete list of all possible solving stages.
30371  */
30373  SCIP* scip, /**< SCIP data structure */
30374  SCIP_VAR* var, /**< variable, of which the branching factor should be applied, or NULL */
30375  SCIP_Real downgain, /**< prediction of objective gain for rounding downwards */
30376  SCIP_Real upgain /**< prediction of objective gain for rounding upwards */
30377  )
30378 {
30379  SCIP_CALL_ABORT( checkStage(scip, "SCIPgetBranchScore", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) );
30380 
30381  return SCIPbranchGetScore(scip->set, var, downgain, upgain);
30382 }
30383 
30384 /** calculates the branching score out of the gain predictions for a branching with arbitrary many children
30385  *
30386  * @return the branching score out of the gain predictions for a branching with arbitrary many children.
30387  *
30388  * @pre This method can be called if @p scip is in one of the following stages:
30389  * - \ref SCIP_STAGE_SOLVING
30390  *
30391  * See \ref SCIP_Stage "SCIP_STAGE" for a complete list of all possible solving stages.
30392  */
30394  SCIP* scip, /**< SCIP data structure */
30395  SCIP_VAR* var, /**< variable, of which the branching factor should be applied, or NULL */
30396  int nchildren, /**< number of children that the branching will create */
30397  SCIP_Real* gains /**< prediction of objective gain for each child */
30398  )
30399 {
30400  SCIP_CALL_ABORT( checkStage(scip, "SCIPgetBranchScoreMultiple", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) );
30401 
30402  return SCIPbranchGetScoreMultiple(scip->set, var, nchildren, gains);
30403 }
30404 
30405 /** computes a branching point for a continuous or discrete variable
30406  * @see SCIPbranchGetBranchingPoint
30407  *
30408  * @return the branching point for a continuous or discrete variable.
30409  *
30410  * @pre This method can be called if @p scip is in one of the following stages:
30411  * - \ref SCIP_STAGE_SOLVING
30412  *
30413  * See \ref SCIP_Stage "SCIP_STAGE" for a complete list of all possible solving stages.
30414  */
30416  SCIP* scip, /**< SCIP data structure */
30417  SCIP_VAR* var, /**< variable, of which the branching point should be computed */
30418  SCIP_Real suggestion /**< suggestion for branching point, or SCIP_INVALID if no suggestion */
30419  )
30420 {
30421  SCIP_CALL_ABORT( checkStage(scip, "SCIPgetBranchingPoint", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) );
30422 
30423  return SCIPbranchGetBranchingPoint(scip->set, scip->tree, var, suggestion);
30424 }
30425 
30426 /** calculates the node selection priority for moving the given variable's LP value to the given target value;
30427  * this node selection priority can be given to the SCIPcreateChild() call
30428  *
30429  * @return the node selection priority for moving the given variable's LP value to the given target value.
30430  *
30431  * @pre This method can be called if @p scip is in one of the following stages:
30432  * - \ref SCIP_STAGE_SOLVING
30433  *
30434  * See \ref SCIP_Stage "SCIP_STAGE" for a complete list of all possible solving stages.
30435  */
30437  SCIP* scip, /**< SCIP data structure */
30438  SCIP_VAR* var, /**< variable on which the branching is applied */
30439  SCIP_BRANCHDIR branchdir, /**< type of branching that was performed: upwards, downwards, or fixed;
30440  * fixed should only be used, when both bounds changed
30441  */
30442  SCIP_Real targetvalue /**< new value of the variable in the child node */
30443  )
30444 {
30445  SCIP_CALL_ABORT( checkStage(scip, "SCIPcalcNodeselPriority", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) );
30446 
30447  return SCIPtreeCalcNodeselPriority(scip->tree, scip->set, scip->stat, var, branchdir, targetvalue);
30448 }
30449 
30450 /** calculates an estimate for the objective of the best feasible solution contained in the subtree after applying the given
30451  * branching; this estimate can be given to the SCIPcreateChild() call
30452  *
30453  * @return the estimate for the objective of the best feasible solution contained in the subtree after applying the given
30454  * branching.
30455  *
30456  * @pre This method can be called if @p scip is in one of the following stages:
30457  * - \ref SCIP_STAGE_SOLVING
30458  *
30459  * See \ref SCIP_Stage "SCIP_STAGE" for a complete list of all possible solving stages.
30460  */
30462  SCIP* scip, /**< SCIP data structure */
30463  SCIP_VAR* var, /**< variable on which the branching is applied */
30464  SCIP_Real targetvalue /**< new value of the variable in the child node */
30465  )
30466 {
30467  SCIP_CALL_ABORT( checkStage(scip, "SCIPcalcChildEstimate", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) );
30468 
30469  return SCIPtreeCalcChildEstimate(scip->tree, scip->set, scip->stat, var, targetvalue);
30470 }
30471 
30472 /** creates a child node of the focus node
30473  *
30474  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
30475  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
30476  *
30477  * @pre This method can be called if @p scip is in one of the following stages:
30478  * - \ref SCIP_STAGE_SOLVING
30479  *
30480  * See \ref SCIP_Stage "SCIP_STAGE" for a complete list of all possible solving stages.
30481  */
30483  SCIP* scip, /**< SCIP data structure */
30484  SCIP_NODE** node, /**< pointer to node data structure */
30485  SCIP_Real nodeselprio, /**< node selection priority of new node */
30486  SCIP_Real estimate /**< estimate for(transformed) objective value of best feasible solution in subtree */
30487  )
30488 {
30489  assert(node != NULL);
30490 
30491  SCIP_CALL( checkStage(scip, "SCIPcreateChild", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) );
30492 
30493  SCIP_CALL( SCIPnodeCreateChild(node, scip->mem->probmem, scip->set, scip->stat, scip->tree, nodeselprio, estimate) );
30494 
30495  return SCIP_OKAY;
30496 }
30497 
30498 /** branches on a non-continuous variable v using the current LP or pseudo solution;
30499  * if solution value x' is fractional, two child nodes will be created
30500  * (x <= floor(x'), x >= ceil(x')),
30501  * if solution value is integral, the x' is equal to lower or upper bound of the branching
30502  * variable and the bounds of v are finite, then two child nodes will be created
30503  * (x <= x'', x >= x''+1 with x'' = floor((lb + ub)/2)),
30504  * otherwise (up to) three child nodes will be created
30505  * (x <= x'-1, x == x', x >= x'+1)
30506  *
30507  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
30508  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
30509  *
30510  * @pre This method can be called if @p scip is in one of the following stages:
30511  * - \ref SCIP_STAGE_SOLVING
30512  *
30513  * See \ref SCIP_Stage "SCIP_STAGE" for a complete list of all possible solving stages.
30514  */
30516  SCIP* scip, /**< SCIP data structure */
30517  SCIP_VAR* var, /**< variable to branch on */
30518  SCIP_NODE** downchild, /**< pointer to return the left child with variable rounded down, or NULL */
30519  SCIP_NODE** eqchild, /**< pointer to return the middle child with variable fixed, or NULL */
30520  SCIP_NODE** upchild /**< pointer to return the right child with variable rounded up, or NULL */
30521  )
30522 {
30523  SCIP_CALL( checkStage(scip, "SCIPbranchVar", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) );
30524 
30526  {
30527  SCIPerrorMessage("cannot branch on continuous variable <%s>\n", SCIPvarGetName(var));
30528  return SCIP_INVALIDDATA;
30529  }
30530 
30531  if( SCIPsetIsEQ(scip->set, SCIPvarGetLbLocal(var), SCIPvarGetUbLocal(var)) )
30532  {
30533  SCIPerrorMessage("cannot branch on variable <%s> with fixed domain [%.15g,%.15g]\n",
30535  return SCIP_INVALIDDATA;
30536  }
30537 
30538  SCIP_CALL( SCIPtreeBranchVar(scip->tree, scip->mem->probmem, scip->set, scip->stat, scip->transprob, scip->origprob,
30539  scip->lp, scip->branchcand, scip->eventqueue, var, SCIP_INVALID, downchild, eqchild, upchild) );
30540 
30541  return SCIP_OKAY;
30542 }
30543 
30544 /** branches a variable x using a given domain hole; two child nodes (x <= left, x >= right) are created
30545  *
30546  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
30547  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
30548  *
30549  * @pre This method can be called if @p scip is in one of the following stages:
30550  * - \ref SCIP_STAGE_SOLVING
30551  *
30552  * See \ref SCIP_Stage "SCIP_STAGE" for a complete list of all possible solving stages.
30553  */
30555  SCIP* scip, /**< SCIP data structure */
30556  SCIP_VAR* var, /**< variable to branch on */
30557  SCIP_Real left, /**< left side of the domain hole */
30558  SCIP_Real right, /**< right side of the domain hole */
30559  SCIP_NODE** downchild, /**< pointer to return the left child (x <= left), or NULL */
30560  SCIP_NODE** upchild /**< pointer to return the right child (x >= right), or NULL */
30561  )
30562 {
30563  SCIP_CALL( checkStage(scip, "SCIPbranchVarHole", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) );
30564 
30565  SCIP_CALL( SCIPtreeBranchVarHole(scip->tree, scip->mem->probmem, scip->set, scip->stat, scip->transprob, scip->origprob,
30566  scip->lp, scip->branchcand, scip->eventqueue, var, left, right, downchild, upchild) );
30567 
30568  return SCIP_OKAY;
30569 }
30570 
30571 /** branches on a variable x using a given value x';
30572  * for continuous variables with relative domain width larger epsilon, x' must not be one of the bounds;
30573  * two child nodes (x <= x', x >= x') are created;
30574  * for integer variables, if solution value x' is fractional, two child nodes are created
30575  * (x <= floor(x'), x >= ceil(x')),
30576  * if x' is integral, three child nodes are created
30577  * (x <= x'-1, x == x', x >= x'+1)
30578  *
30579  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
30580  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
30581  *
30582  * @pre This method can be called if @p scip is in one of the following stages:
30583  * - \ref SCIP_STAGE_SOLVING
30584  *
30585  * See \ref SCIP_Stage "SCIP_STAGE" for a complete list of all possible solving stages.
30586  */
30588  SCIP* scip, /**< SCIP data structure */
30589  SCIP_VAR* var, /**< variable to branch on */
30590  SCIP_Real val, /**< value to branch on */
30591  SCIP_NODE** downchild, /**< pointer to return the left child with variable rounded down, or NULL */
30592  SCIP_NODE** eqchild, /**< pointer to return the middle child with variable fixed, or NULL */
30593  SCIP_NODE** upchild /**< pointer to return the right child with variable rounded up, or NULL */
30594  )
30595 {
30596  SCIP_CALL( checkStage(scip, "SCIPbranchVarVal", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) );
30597 
30598  /* A continuous variable will be fixed if SCIPisRelEQ(lb,ub) is true. Otherwise, the given branching value should be
30599  * such that its value is not equal to one of the bounds. We assert this by requiring that it is at least eps/2 away
30600  * from each bound. The 2.1 is there, because ub-lb may be in (eps, 2*eps], in which case there is no way to choose a
30601  * branching value that is at least eps away from both bounds. However, if the variable bounds are below/above
30602  * -/+infinity * 2.1, then SCIPisLT will give an assert, so we omit the check in this case.
30603  */
30604  assert(SCIPvarGetType(var) != SCIP_VARTYPE_CONTINUOUS ||
30605  SCIPisRelEQ(scip, SCIPvarGetLbLocal(var), SCIPvarGetUbLocal(var)) ||
30606  SCIPisInfinity(scip, -2.1*SCIPvarGetLbLocal(var)) || SCIPisInfinity(scip, 2.1*SCIPvarGetUbLocal(var)) ||
30607  (SCIPisLT(scip, 2.1*SCIPvarGetLbLocal(var), 2.1*val) && SCIPisLT(scip, 2.1*val, 2.1*SCIPvarGetUbLocal(var)) ) );
30608 
30609  if( SCIPsetIsEQ(scip->set, SCIPvarGetLbLocal(var), SCIPvarGetUbLocal(var)) )
30610  {
30611  SCIPerrorMessage("cannot branch on variable <%s> with fixed domain [%.15g,%.15g]\n",
30613  return SCIP_INVALIDDATA;
30614  }
30615 
30616  SCIP_CALL( SCIPtreeBranchVar(scip->tree, scip->mem->probmem, scip->set, scip->stat, scip->transprob, scip->origprob,
30617  scip->lp, scip->branchcand, scip->eventqueue, var, val, downchild, eqchild, upchild) );
30618 
30619  return SCIP_OKAY;
30620 }
30621 
30622 /** n-ary branching on a variable x using a given value
30623  * Branches on variable x such that up to n/2 children are created on each side of the usual branching value.
30624  * The branching value is selected as in SCIPbranchVarVal().
30625  * The parameters minwidth and widthfactor determine the domain width of the branching variable in the child nodes.
30626  * If n is odd, one child with domain width 'width' and having the branching value in the middle is created.
30627  * Otherwise, two children with domain width 'width' and being left and right of the branching value are created.
30628  * Next further nodes to the left and right are created, where width is multiplied by widthfactor with increasing distance from the first nodes.
30629  * The initial width is calculated such that n/2 nodes are created to the left and to the right of the branching value.
30630  * If this value is below minwidth, the initial width is set to minwidth, which may result in creating less than n nodes.
30631  *
30632  * Giving a large value for widthfactor results in creating children with small domain when close to the branching value
30633  * and large domain when closer to the current variable bounds. That is, setting widthfactor to a very large value and n to 3
30634  * results in a ternary branching where the branching variable is mostly fixed in the middle child.
30635  * Setting widthfactor to 1.0 results in children where the branching variable always has the same domain width
30636  * (except for one child if the branching value is not in the middle).
30637  *
30638  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
30639  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
30640  *
30641  * @pre This method can be called if @p scip is in one of the following stages:
30642  * - \ref SCIP_STAGE_SOLVING
30643  *
30644  * See \ref SCIP_Stage "SCIP_STAGE" for a complete list of all possible solving stages.
30645  */
30647  SCIP* scip, /**< SCIP data structure */
30648  SCIP_VAR* var, /**< variable to branch on */
30649  SCIP_Real val, /**< value to branch on */
30650  int n, /**< attempted number of children to be created, must be >= 2 */
30651  SCIP_Real minwidth, /**< minimal domain width in children */
30652  SCIP_Real widthfactor, /**< multiplier for children domain width with increasing distance from val, must be >= 1.0 */
30653  int* nchildren /**< pointer to store number of created children, or NULL */
30654  )
30655 {
30656  SCIP_CALL( checkStage(scip, "SCIPbranchVarValNary", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) );
30657 
30658  /* see comment in SCIPbranchVarVal */
30659  assert(SCIPvarGetType(var) != SCIP_VARTYPE_CONTINUOUS ||
30660  SCIPisRelEQ(scip, SCIPvarGetLbLocal(var), SCIPvarGetUbLocal(var)) ||
30661  SCIPisInfinity(scip, -2.1*SCIPvarGetLbLocal(var)) || SCIPisInfinity(scip, 2.1*SCIPvarGetUbLocal(var)) ||
30662  (SCIPisLT(scip, 2.1*SCIPvarGetLbLocal(var), 2.1*val) && SCIPisLT(scip, 2.1*val, 2.1*SCIPvarGetUbLocal(var)) ) );
30663 
30664  if( SCIPsetIsEQ(scip->set, SCIPvarGetLbLocal(var), SCIPvarGetUbLocal(var)) )
30665  {
30666  SCIPerrorMessage("cannot branch on variable <%s> with fixed domain [%.15g,%.15g]\n",
30668  return SCIP_INVALIDDATA;
30669  }
30670 
30671  SCIP_CALL( SCIPtreeBranchVarNary(scip->tree, scip->mem->probmem, scip->set, scip->stat, scip->transprob, scip->origprob,
30672  scip->lp, scip->branchcand, scip->eventqueue, var, val, n, minwidth, widthfactor, nchildren) );
30673 
30674  return SCIP_OKAY;
30675 }
30676 
30677 /** calls branching rules to branch on an LP solution; if no fractional variables exist, the result is SCIP_DIDNOTRUN;
30678  * if the branch priority of an unfixed variable is larger than the maximal branch priority of the fractional
30679  * variables, pseudo solution branching is applied on the unfixed variables with maximal branch priority
30680  *
30681  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
30682  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
30683  *
30684  * @pre This method can be called if @p scip is in one of the following stages:
30685  * - \ref SCIP_STAGE_SOLVING
30686  *
30687  * See \ref SCIP_Stage "SCIP_STAGE" for a complete list of all possible solving stages.
30688  */
30690  SCIP* scip, /**< SCIP data structure */
30691  SCIP_RESULT* result /**< pointer to store the result of the branching (s. branch.h) */
30692  )
30693 {
30694  SCIP_CALL( checkStage(scip, "SCIPbranchLP", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) );
30695 
30696  SCIP_CALL( SCIPbranchExecLP(scip->mem->probmem, scip->set, scip->stat, scip->transprob, scip->origprob,
30697  scip->tree, scip->lp, scip->sepastore, scip->branchcand, scip->eventqueue, scip->primal->cutoffbound, TRUE,
30698  result) );
30699 
30700  return SCIP_OKAY;
30701 }
30702 
30703 /** calls branching rules to branch on a external candidates; if no such candidates exist, the result is SCIP_DIDNOTRUN
30704  *
30705  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
30706  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
30707  *
30708  * @pre This method can be called if @p scip is in one of the following stages:
30709  * - \ref SCIP_STAGE_SOLVING
30710  *
30711  * See \ref SCIP_Stage "SCIP_STAGE" for a complete list of all possible solving stages.
30712  */
30714  SCIP* scip, /**< SCIP data structure */
30715  SCIP_RESULT* result /**< pointer to store the result of the branching (s. branch.h) */
30716  )
30717 {
30718  SCIP_CALL( checkStage(scip, "SCIPbranchExtern", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) );
30719 
30720  SCIP_CALL( SCIPbranchExecExtern(scip->mem->probmem, scip->set, scip->stat, scip->transprob, scip->origprob,
30721  scip->tree, scip->lp, scip->sepastore, scip->branchcand, scip->eventqueue, scip->primal->cutoffbound, TRUE,
30722  result) );
30723 
30724  return SCIP_OKAY;
30725 }
30726 
30727 /** calls branching rules to branch on a pseudo solution; if no unfixed variables exist, the result is SCIP_DIDNOTRUN
30728  *
30729  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
30730  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
30731  *
30732  * @pre This method can be called if @p scip is in one of the following stages:
30733  * - \ref SCIP_STAGE_SOLVING
30734  *
30735  * See \ref SCIP_Stage "SCIP_STAGE" for a complete list of all possible solving stages.
30736  */
30738  SCIP* scip, /**< SCIP data structure */
30739  SCIP_RESULT* result /**< pointer to store the result of the branching (s. branch.h) */
30740  )
30741 {
30742  SCIP_CALL( checkStage(scip, "SCIPbranchPseudo", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) );
30743 
30744  SCIP_CALL( SCIPbranchExecPseudo(scip->mem->probmem, scip->set, scip->stat, scip->transprob, scip->origprob,
30745  scip->tree, scip->lp, scip->branchcand, scip->eventqueue, scip->primal->cutoffbound, TRUE, result) );
30746 
30747  return SCIP_OKAY;
30748 }
30749 
30750 
30751 
30752 
30753 /*
30754  * primal solutions
30755  */
30756 
30757 /** creates a primal solution, initialized to zero
30758  *
30759  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
30760  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
30761  *
30762  * @pre This method can be called if SCIP is in one of the following stages:
30763  * - \ref SCIP_STAGE_PROBLEM
30764  * - \ref SCIP_STAGE_TRANSFORMING
30765  * - \ref SCIP_STAGE_TRANSFORMED
30766  * - \ref SCIP_STAGE_INITPRESOLVE
30767  * - \ref SCIP_STAGE_PRESOLVING
30768  * - \ref SCIP_STAGE_EXITPRESOLVE
30769  * - \ref SCIP_STAGE_PRESOLVED
30770  * - \ref SCIP_STAGE_INITSOLVE
30771  * - \ref SCIP_STAGE_SOLVING
30772  */
30774  SCIP* scip, /**< SCIP data structure */
30775  SCIP_SOL** sol, /**< pointer to store the solution */
30776  SCIP_HEUR* heur /**< heuristic that found the solution (or NULL if it's from the tree) */
30777  )
30778 {
30779  SCIP_CALL( checkStage(scip, "SCIPcreateSol", FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE) );
30780 
30781  switch( scip->set->stage )
30782  {
30783  case SCIP_STAGE_PROBLEM:
30784  SCIP_CALL( SCIPsolCreateOriginal(sol, scip->mem->probmem, scip->set, scip->stat, scip->origprob, scip->origprimal, NULL, heur) );
30785  return SCIP_OKAY;
30786 
30790  case SCIP_STAGE_PRESOLVING:
30792  case SCIP_STAGE_PRESOLVED:
30793  case SCIP_STAGE_INITSOLVE:
30794  case SCIP_STAGE_SOLVING:
30795  SCIP_CALL( SCIPsolCreate(sol, scip->mem->probmem, scip->set, scip->stat, scip->primal, scip->tree, heur) );
30796  return SCIP_OKAY;
30797 
30798  case SCIP_STAGE_SOLVED:
30799  case SCIP_STAGE_EXITSOLVE:
30800  case SCIP_STAGE_FREETRANS:
30801  default:
30802  SCIPerrorMessage("invalid SCIP stage <%d>\n", scip->set->stage);
30803  return SCIP_INVALIDDATA;
30804  } /*lint !e788*/
30805 }
30806 
30807 /** creates a primal solution, initialized to the current LP solution
30808  *
30809  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
30810  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
30811  *
30812  * @pre This method can be called if SCIP is in one of the following stages:
30813  * - \ref SCIP_STAGE_SOLVING
30814  */
30816  SCIP* scip, /**< SCIP data structure */
30817  SCIP_SOL** sol, /**< pointer to store the solution */
30818  SCIP_HEUR* heur /**< heuristic that found the solution (or NULL if it's from the tree) */
30819  )
30820 {
30821  SCIP_CALL( checkStage(scip, "SCIPcreateLPSol", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) );
30822 
30823  if( !SCIPtreeHasCurrentNodeLP(scip->tree) )
30824  {
30825  SCIPerrorMessage("LP solution does not exist\n");
30826  return SCIP_INVALIDCALL;
30827  }
30828 
30829  SCIP_CALL( SCIPsolCreateLPSol(sol, scip->mem->probmem, scip->set, scip->stat, scip->transprob, scip->primal,
30830  scip->tree, scip->lp, heur) );
30831 
30832  return SCIP_OKAY;
30833 }
30834 
30835 /** creates a primal solution, initialized to the current NLP solution
30836  *
30837  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
30838  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
30839  *
30840  * @pre This method can be called if SCIP is in one of the following stages:
30841  * - \ref SCIP_STAGE_SOLVING
30842  */
30844  SCIP* scip, /**< SCIP data structure */
30845  SCIP_SOL** sol, /**< pointer to store the solution */
30846  SCIP_HEUR* heur /**< heuristic that found the solution (or NULL if it's from the tree) */
30847  )
30848 {
30849  SCIP_CALL( checkStage(scip, "SCIPcreateNLPSol", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) );
30850 
30851  if( !SCIPisNLPConstructed(scip) )
30852  {
30853  SCIPerrorMessage("NLP does not exist\n");
30854  return SCIP_INVALIDCALL;
30855  }
30856  assert(scip->nlp != NULL);
30857 
30858  if( !SCIPnlpHasSolution(scip->nlp) )
30859  {
30860  SCIPerrorMessage("NLP solution does not exist\n");
30861  return SCIP_INVALIDCALL;
30862  }
30863 
30864  SCIP_CALL( SCIPsolCreateNLPSol(sol, scip->mem->probmem, scip->set, scip->stat, scip->primal, scip->tree, scip->nlp,
30865  heur) );
30866 
30867  return SCIP_OKAY;
30868 }
30869 
30870 /** creates a primal solution, initialized to the current relaxation solution
30871  *
30872  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
30873  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
30874  *
30875  * @pre This method can be called if SCIP is in one of the following stages:
30876  * - \ref SCIP_STAGE_SOLVING
30877  */
30879  SCIP* scip, /**< SCIP data structure */
30880  SCIP_SOL** sol, /**< pointer to store the solution */
30881  SCIP_HEUR* heur /**< heuristic that found the solution (or NULL if it's from the tree) */
30882  )
30883 {
30884  SCIP_CALL( checkStage(scip, "SCIPcreateRelaxSol", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) );
30885 
30886  if( !SCIPrelaxationIsSolValid(scip->relaxation) )
30887  {
30888  SCIPerrorMessage("relaxation solution is not valid\n");
30889  return SCIP_INVALIDCALL;
30890  }
30891 
30892  SCIP_CALL( SCIPsolCreateRelaxSol(sol, scip->mem->probmem, scip->set, scip->stat, scip->primal, scip->tree, scip->relaxation, heur) );
30893 
30894  return SCIP_OKAY;
30895 }
30896 
30897 /** creates a primal solution, initialized to the current pseudo solution
30898  *
30899  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
30900  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
30901  *
30902  * @pre This method can be called if SCIP is in one of the following stages:
30903  * - \ref SCIP_STAGE_SOLVING
30904  */
30906  SCIP* scip, /**< SCIP data structure */
30907  SCIP_SOL** sol, /**< pointer to store the solution */
30908  SCIP_HEUR* heur /**< heuristic that found the solution (or NULL if it's from the tree) */
30909  )
30910 {
30911  SCIP_CALL( checkStage(scip, "SCIPcreatePseudoSol", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) );
30912 
30913  SCIP_CALL( SCIPsolCreatePseudoSol(sol, scip->mem->probmem, scip->set, scip->stat, scip->transprob, scip->primal,
30914  scip->tree, scip->lp, heur) );
30915 
30916  return SCIP_OKAY;
30917 }
30918 
30919 /** creates a primal solution, initialized to the current LP or pseudo solution, depending on whether the LP was solved
30920  * at the current node
30921  *
30922  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
30923  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
30924  *
30925  * @pre This method can be called if SCIP is in one of the following stages:
30926  * - \ref SCIP_STAGE_SOLVING
30927  */
30929  SCIP* scip, /**< SCIP data structure */
30930  SCIP_SOL** sol, /**< pointer to store the solution */
30931  SCIP_HEUR* heur /**< heuristic that found the solution (or NULL if it's from the tree) */
30932  )
30933 {
30934  SCIP_CALL( checkStage(scip, "SCIPcreateCurrentSol", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) );
30935 
30936  SCIP_CALL( SCIPsolCreateCurrentSol(sol, scip->mem->probmem, scip->set, scip->stat, scip->transprob, scip->primal,
30937  scip->tree, scip->lp, heur) );
30938 
30939  return SCIP_OKAY;
30940 }
30941 
30942 /** creates a primal solution, initialized to unknown values
30943  *
30944  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
30945  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
30946  *
30947  * @pre This method can be called if SCIP is in one of the following stages:
30948  * - \ref SCIP_STAGE_TRANSFORMING
30949  * - \ref SCIP_STAGE_TRANSFORMED
30950  * - \ref SCIP_STAGE_INITPRESOLVE
30951  * - \ref SCIP_STAGE_PRESOLVING
30952  * - \ref SCIP_STAGE_EXITPRESOLVE
30953  * - \ref SCIP_STAGE_PRESOLVED
30954  * - \ref SCIP_STAGE_INITSOLVE
30955  * - \ref SCIP_STAGE_SOLVING
30956  */
30958  SCIP* scip, /**< SCIP data structure */
30959  SCIP_SOL** sol, /**< pointer to store the solution */
30960  SCIP_HEUR* heur /**< heuristic that found the solution (or NULL if it's from the tree) */
30961  )
30962 {
30963  SCIP_CALL( checkStage(scip, "SCIPcreateUnknownSol", FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE) );
30964 
30965  SCIP_CALL( SCIPsolCreateUnknown(sol, scip->mem->probmem, scip->set, scip->stat, scip->primal, scip->tree, heur) );
30966 
30967  return SCIP_OKAY;
30968 }
30969 
30970 /** creates a primal solution living in the original problem space, initialized to zero;
30971  * a solution in original space allows to set original variables to values that would be invalid in the
30972  * transformed problem due to preprocessing fixings or aggregations
30973  *
30974  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
30975  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
30976  *
30977  * @pre This method can be called if SCIP is in one of the following stages:
30978  * - \ref SCIP_STAGE_PROBLEM
30979  * - \ref SCIP_STAGE_TRANSFORMING
30980  * - \ref SCIP_STAGE_TRANSFORMED
30981  * - \ref SCIP_STAGE_INITPRESOLVE
30982  * - \ref SCIP_STAGE_PRESOLVING
30983  * - \ref SCIP_STAGE_EXITPRESOLVE
30984  * - \ref SCIP_STAGE_PRESOLVED
30985  * - \ref SCIP_STAGE_INITSOLVE
30986  * - \ref SCIP_STAGE_SOLVING
30987  * - \ref SCIP_STAGE_SOLVED
30988  */
30990  SCIP* scip, /**< SCIP data structure */
30991  SCIP_SOL** sol, /**< pointer to store the solution */
30992  SCIP_HEUR* heur /**< heuristic that found the solution (or NULL if it's from the tree) */
30993  )
30994 {
30995  SCIP_CALL( checkStage(scip, "SCIPcreateOrigSol", FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE) );
30996 
30997  switch( scip->set->stage )
30998  {
30999  case SCIP_STAGE_PROBLEM:
31000  SCIP_CALL( SCIPsolCreateOriginal(sol, scip->mem->probmem, scip->set, scip->stat, scip->origprob, scip->origprimal, NULL, heur) );
31001  return SCIP_OKAY;
31002 
31006  case SCIP_STAGE_PRESOLVING:
31008  case SCIP_STAGE_PRESOLVED:
31009  case SCIP_STAGE_INITSOLVE:
31010  case SCIP_STAGE_SOLVING:
31011  case SCIP_STAGE_SOLVED:
31012  SCIP_CALL( SCIPsolCreateOriginal(sol, scip->mem->probmem, scip->set, scip->stat, scip->origprob, scip->primal, scip->tree, heur) );
31013  return SCIP_OKAY;
31014 
31015  case SCIP_STAGE_EXITSOLVE:
31016  case SCIP_STAGE_FREETRANS:
31017  default:
31018  SCIPerrorMessage("invalid SCIP stage <%d>\n", scip->set->stage);
31019  return SCIP_INVALIDCALL;
31020  } /*lint !e788*/
31021 }
31022 
31023 /** creates a copy of a primal solution; note that a copy of a linked solution is also linked and needs to be unlinked
31024  * if it should stay unaffected from changes in the LP or pseudo solution
31025  *
31026  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
31027  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
31028  *
31029  * @pre This method can be called if SCIP is in one of the following stages:
31030  * - \ref SCIP_STAGE_PROBLEM
31031  * - \ref SCIP_STAGE_TRANSFORMING
31032  * - \ref SCIP_STAGE_TRANSFORMED
31033  * - \ref SCIP_STAGE_INITPRESOLVE
31034  * - \ref SCIP_STAGE_PRESOLVING
31035  * - \ref SCIP_STAGE_EXITPRESOLVE
31036  * - \ref SCIP_STAGE_PRESOLVED
31037  * - \ref SCIP_STAGE_INITSOLVE
31038  * - \ref SCIP_STAGE_SOLVING
31039  * - \ref SCIP_STAGE_SOLVED
31040  */
31042  SCIP* scip, /**< SCIP data structure */
31043  SCIP_SOL** sol, /**< pointer to store the solution */
31044  SCIP_SOL* sourcesol /**< primal CIP solution to copy */
31045  )
31046 {
31047  SCIP_CALL( checkStage(scip, "SCIPcreateSolCopy", FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE) );
31048 
31049  /* check if we want to copy the current solution, which is the same as creating a current solution */
31050  if( sourcesol == NULL )
31051  {
31052  SCIP_CALL( SCIPcreateCurrentSol(scip, sol, NULL) );
31053  }
31054  else
31055  {
31056  SCIP_CALL( SCIPsolCopy(sol, scip->mem->probmem, scip->set, scip->stat, scip->primal, sourcesol) );
31057  }
31058 
31059  return SCIP_OKAY;
31060 }
31061 
31062 /** creates a copy of a primal solution, thereby replacing infinite fixings of variables by finite values;
31063  * the copy is always defined in the original variable space;
31064  * success indicates whether the objective value of the solution was changed by removing infinite values
31065  *
31066  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
31067  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
31068  *
31069  * @pre This method can be called if SCIP is in one of the following stages:
31070  * - \ref SCIP_STAGE_PROBLEM
31071  * - \ref SCIP_STAGE_TRANSFORMING
31072  * - \ref SCIP_STAGE_TRANSFORMED
31073  * - \ref SCIP_STAGE_INITPRESOLVE
31074  * - \ref SCIP_STAGE_PRESOLVING
31075  * - \ref SCIP_STAGE_EXITPRESOLVE
31076  * - \ref SCIP_STAGE_PRESOLVED
31077  * - \ref SCIP_STAGE_INITSOLVE
31078  * - \ref SCIP_STAGE_SOLVING
31079  * - \ref SCIP_STAGE_SOLVED
31080  * - \ref SCIP_STAGE_EXITSOLVE
31081  */
31083  SCIP* scip, /**< SCIP data structure */
31084  SCIP_SOL** sol, /**< pointer to store the solution */
31085  SCIP_SOL* sourcesol, /**< primal CIP solution to copy */
31086  SCIP_Bool* success /**< does the finite solution have the same objective value? */
31087  )
31088 {
31089  SCIP_VAR** fixedvars;
31090  SCIP_VAR** origvars;
31091  SCIP_Real* solvals;
31092  SCIP_VAR* var;
31093  int nfixedvars;
31094  int norigvars;
31095  int v;
31096 
31097  SCIP_CALL( checkStage(scip, "SCIPcreateFiniteSolCopy", FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE) );
31098 
31099  assert(scip != NULL);
31100  assert(sol != NULL);
31101  assert(sourcesol != NULL);
31102  assert(success != NULL);
31103 
31104  *success = TRUE;
31105  *sol = NULL;
31106 
31107  fixedvars = SCIPgetFixedVars(scip);
31108  nfixedvars = SCIPgetNFixedVars(scip);
31109  assert(fixedvars != NULL || nfixedvars == 0);
31110 
31111  /* get original variables and their values in the optimal solution */
31112  SCIP_CALL( SCIPgetOrigVarsData(scip, &origvars, &norigvars, NULL, NULL, NULL, NULL) );
31113  SCIP_CALL( SCIPallocBufferArray(scip, &solvals, norigvars) );
31114  SCIP_CALL( SCIPgetSolVals(scip, sourcesol, norigvars, origvars, solvals) );
31115 
31116  /* check whether there are variables fixed to an infinite value */
31117  for( v = 0; v < nfixedvars; ++v )
31118  {
31119  var = fixedvars[v]; /*lint !e613*/
31120 
31121  /* skip (multi-)aggregated variables */
31123  continue;
31124 
31125  assert(SCIPisEQ(scip, SCIPvarGetLbGlobal(var), SCIPvarGetUbGlobal(var)));
31126 
31127  if( (SCIPisInfinity(scip, SCIPvarGetLbGlobal(var)) || SCIPisInfinity(scip, -SCIPvarGetLbGlobal(var))) )
31128  {
31129  SCIPdebugMessage("var <%s> is fixed to infinite value %g\n", SCIPvarGetName(var), SCIPvarGetLbGlobal(var));
31130  break;
31131  }
31132  }
31133 
31134  /* there were variables fixed to infinite values */
31135  if( v < nfixedvars )
31136  {
31137  SCIP_HASHMAP* varmap;
31138  SCIP* subscip;
31139  SCIP_VAR* varcopy;
31140  SCIP_Real fixval;
31141  SCIP_Bool valid;
31142  SCIP_SOL* bestsol;
31143 
31144  /* if one of the variables was fixed to infinity in the original problem, we stop here */
31145  for( v = 0; v < norigvars; ++v )
31146  {
31147  var = origvars[v];
31148 
31150  {
31151  assert(SCIPisEQ(scip, SCIPvarGetLbOriginal(var), SCIPvarGetUbOriginal(var)));
31152 
31153  SCIPdebugMessage("--> var <%s> is fixed to infinite value %g in the original problem, stop making solution finite\n",
31155 
31156  goto TERMINATE;
31157  }
31158  }
31159 
31160  /* create sub-SCIP */
31161  SCIP_CALL( SCIPcreate(&subscip) );
31162 
31163  /* copy the original problem to the sub-SCIP */
31164  SCIP_CALL( SCIPhashmapCreate(&varmap, SCIPblkmem(scip), SCIPcalcHashtableSize(5 * norigvars)) );
31165  SCIP_CALL( SCIPcopyOrig(scip, subscip, varmap, NULL, "removeinffixings", TRUE, TRUE, &valid) );
31166 
31167  SCIP_CALL( SCIPsetIntParam(subscip, "display/verblevel", (int)SCIP_VERBLEVEL_NONE) );
31168 
31169  /* in the sub-SCIP, we try to minimize the absolute values of all variables with infinite values in the solution
31170  * and fix all other variables to the value they have in the solution
31171  */
31172  for( v = 0; v < norigvars; ++v )
31173  {
31174  varcopy = (SCIP_VAR*) SCIPhashmapGetImage(varmap, (void*)origvars[v]);
31175  assert(varcopy != NULL);
31176  assert(SCIPisFeasGE(scip, solvals[v], SCIPvarGetLbLocal(varcopy)));
31177  assert(SCIPisFeasLE(scip, solvals[v], SCIPvarGetUbLocal(varcopy)));
31178 
31179  fixval = solvals[v];
31180 
31181  if( SCIPisInfinity(scip, fixval) || SCIPisInfinity(scip, -fixval) )
31182  {
31183  /* If a variable with a finite finite lower bound was set to +infinity, we just change its objective to 1.0
31184  * to minimize its value; if a variable with a finite finite upper bound was set to -infinity, we just
31185  * change its objective to -1.0 to maximize its value; if a variable is free, we split the variable into
31186  * positive and negative part by creating two new non-negative variables and one constraint linking those
31187  * variables.
31188  */
31189  if( SCIPisInfinity(scip, fixval) && !SCIPisInfinity(scip, -SCIPvarGetLbLocal(varcopy)) )
31190  {
31191  SCIP_CALL( SCIPchgVarObj(subscip, varcopy, 1.0) );
31192  }
31193  else if( SCIPisInfinity(scip, -fixval) && !SCIPisInfinity(scip, SCIPvarGetUbLocal(varcopy)) )
31194  {
31195  SCIP_CALL( SCIPchgVarObj(subscip, varcopy, -1.0) );
31196  }
31197  else
31198  {
31199  char name[SCIP_MAXSTRLEN];
31200  SCIP_VAR* posvar;
31201  SCIP_VAR* negvar;
31202  SCIP_CONS* linkcons;
31203 
31204  (void) SCIPsnprintf(name, SCIP_MAXSTRLEN, "%s_%s", SCIPvarGetName(varcopy), "pos");
31205  SCIP_CALL( SCIPcreateVar(subscip, &posvar, name, 0.0, SCIPinfinity(scip), 1.0,
31207  SCIP_CALL( SCIPaddVar(subscip, posvar) );
31208 
31209  (void) SCIPsnprintf(name, SCIP_MAXSTRLEN, "%s_%s", SCIPvarGetName(varcopy), "neg");
31210  SCIP_CALL( SCIPcreateVar(subscip, &negvar, name, 0.0, SCIPinfinity(scip), 1.0,
31212  SCIP_CALL( SCIPaddVar(subscip, negvar) );
31213 
31214  (void) SCIPsnprintf(name, SCIP_MAXSTRLEN, "%s_%s", SCIPvarGetName(varcopy), "linkcons");
31215  SCIP_CALL( SCIPcreateConsBasicLinear(subscip, &linkcons, name, 0, NULL, NULL, 0.0, 0.0 ) );
31216  SCIP_CALL( SCIPaddCoefLinear(subscip, linkcons, varcopy, 1.0) );
31217  SCIP_CALL( SCIPaddCoefLinear(subscip, linkcons, posvar, -1.0) );
31218  SCIP_CALL( SCIPaddCoefLinear(subscip, linkcons, negvar, 1.0) );
31219  SCIP_CALL( SCIPaddCons(subscip, linkcons) );
31220 
31221  SCIP_CALL( SCIPreleaseCons(subscip, &linkcons) );
31222  SCIP_CALL( SCIPreleaseVar(subscip, &posvar) );
31223  SCIP_CALL( SCIPreleaseVar(subscip, &negvar) );
31224 
31225  SCIP_CALL( SCIPchgVarObj(subscip, varcopy, 0.0) );
31226  }
31227  }
31228  else
31229  {
31230  SCIP_Bool infeasible;
31231  SCIP_Bool fixed;
31232 
31233  /* fix variable to its value in the solution */
31234  SCIP_CALL( SCIPfixVar(subscip, varcopy, fixval, &infeasible, &fixed) );
31235  assert(!infeasible);
31236  }
31237  }
31238 
31239  SCIP_CALL( SCIPsolve(subscip) );
31240 
31241  bestsol = SCIPgetBestSol(subscip);
31242 
31243  if( bestsol != NULL )
31244  {
31245  /* change the stored solution values for variables fixed to infinite values */
31246  for( v = 0; v < norigvars; ++v )
31247  {
31248  varcopy = (SCIP_VAR*) SCIPhashmapGetImage(varmap, (void*)origvars[v]);
31249  assert(varcopy != NULL);
31250 
31251  if( (SCIPisInfinity(scip, solvals[v]) || SCIPisInfinity(scip, -solvals[v])) )
31252  {
31253  solvals[v] = SCIPgetSolVal(subscip, bestsol, varcopy);
31254  }
31255  }
31256  }
31257  else
31258  {
31259  *success = FALSE;
31260  }
31261 
31262  /* free sub-SCIP */
31263  SCIP_CALL( SCIPfree(&subscip) );
31264  SCIPhashmapFree(&varmap);
31265  }
31266 
31267  /* create original solution and set the solution values */
31268  if( *success )
31269  {
31270  SCIP_CALL( SCIPcreateOrigSol(scip, sol, NULL) );
31271  for( v = 0; v < norigvars; ++v )
31272  {
31273  SCIP_CALL( SCIPsetSolVal(scip, *sol, origvars[v], solvals[v]) );
31274  }
31275  }
31276 
31277 #ifdef SCIP_DEBUG
31278  SCIPdebugMessage("created finites solution copy:\n");
31279  SCIP_CALL( SCIPprintSol(scip, *sol, NULL, FALSE) );
31280 #endif
31281 
31282  /* the solution of the sub-SCIP should have the same objective value */
31283  if( *success && !SCIPisEQ(scip, SCIPgetSolOrigObj(scip, *sol), SCIPgetSolOrigObj(scip, sourcesol)) )
31284  {
31285  *success = FALSE;
31286  }
31287 
31288  TERMINATE:
31289  SCIPfreeBufferArray(scip, &solvals);
31290 
31291  return SCIP_OKAY;
31292 }
31293 
31294 /** frees primal CIP solution
31295  *
31296  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
31297  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
31298  *
31299  * @pre This method can be called if SCIP is in one of the following stages:
31300  * - \ref SCIP_STAGE_PROBLEM
31301  * - \ref SCIP_STAGE_TRANSFORMING
31302  * - \ref SCIP_STAGE_TRANSFORMED
31303  * - \ref SCIP_STAGE_INITPRESOLVE
31304  * - \ref SCIP_STAGE_PRESOLVING
31305  * - \ref SCIP_STAGE_EXITPRESOLVE
31306  * - \ref SCIP_STAGE_PRESOLVED
31307  * - \ref SCIP_STAGE_INITSOLVE
31308  * - \ref SCIP_STAGE_SOLVING
31309  * - \ref SCIP_STAGE_SOLVED
31310  * - \ref SCIP_STAGE_EXITSOLVE
31311  * - \ref SCIP_STAGE_FREETRANS
31312  */
31314  SCIP* scip, /**< SCIP data structure */
31315  SCIP_SOL** sol /**< pointer to the solution */
31316  )
31317 {
31318  SCIP_CALL( checkStage(scip, "SCIPfreeSol", FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE) );
31319 
31320  switch( scip->set->stage )
31321  {
31322  case SCIP_STAGE_PROBLEM:
31323  SCIP_CALL( SCIPsolFree(sol, scip->mem->probmem, scip->origprimal) );
31324  break;
31325  case SCIP_STAGE_FREETRANS:
31328  case SCIP_STAGE_PRESOLVING:
31330  case SCIP_STAGE_PRESOLVED:
31331  case SCIP_STAGE_SOLVING:
31333  case SCIP_STAGE_INITSOLVE:
31334  case SCIP_STAGE_SOLVED:
31335  case SCIP_STAGE_EXITSOLVE:
31336  SCIP_CALL( SCIPsolFree(sol, scip->mem->probmem, scip->primal) );
31337  break;
31338  default:
31339  SCIPerrorMessage("invalid SCIP stage <%d>\n", scip->set->stage);
31340  return SCIP_INVALIDCALL;
31341  } /*lint !e788*/
31342 
31343  return SCIP_OKAY;
31344 }
31345 
31346 /** links a primal solution to the current LP solution
31347  *
31348  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
31349  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
31350  *
31351  * @pre This method can be called if SCIP is in one of the following stages:
31352  * - \ref SCIP_STAGE_SOLVING
31353  */
31355  SCIP* scip, /**< SCIP data structure */
31356  SCIP_SOL* sol /**< primal solution */
31357  )
31358 {
31359  SCIP_CALL( checkStage(scip, "SCIPlinkLPSol", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) );
31360 
31361  if( !SCIPlpIsSolved(scip->lp) )
31362  {
31363  SCIPerrorMessage("LP solution does not exist\n");
31364  return SCIP_INVALIDCALL;
31365  }
31366 
31367  SCIP_CALL( SCIPsolLinkLPSol(sol, scip->set, scip->stat, scip->transprob, scip->tree, scip->lp) );
31368 
31369  return SCIP_OKAY;
31370 }
31371 
31372 /** links a primal solution to the current NLP solution
31373  *
31374  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
31375  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
31376  *
31377  * @pre This method can be called if SCIP is in one of the following stages:
31378  * - \ref SCIP_STAGE_SOLVING
31379  */
31381  SCIP* scip, /**< SCIP data structure */
31382  SCIP_SOL* sol /**< primal solution */
31383  )
31384 {
31385  SCIP_CALL( checkStage(scip, "SCIPlinkNLPSol", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) );
31386 
31387  if( scip->nlp == NULL )
31388  {
31389  SCIPerrorMessage("NLP does not exist\n");
31390  return SCIP_INVALIDCALL;
31391  }
31392 
31394  {
31395  SCIPerrorMessage("NLP solution does not exist\n");
31396  return SCIP_INVALIDCALL;
31397  }
31398 
31399  SCIP_CALL( SCIPsolLinkNLPSol(sol, scip->stat, scip->tree, scip->nlp) );
31400 
31401  return SCIP_OKAY;
31402 }
31403 
31404 /** links a primal solution to the current relaxation solution
31405  *
31406  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
31407  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
31408  *
31409  * @pre This method can be called if SCIP is in one of the following stages:
31410  * - \ref SCIP_STAGE_SOLVING
31411  */
31413  SCIP* scip, /**< SCIP data structure */
31414  SCIP_SOL* sol /**< primal solution */
31415  )
31416 {
31417  SCIP_CALL( checkStage(scip, "SCIPlinkRelaxSol", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) );
31418 
31419  if( !SCIPrelaxationIsSolValid(scip->relaxation) )
31420  {
31421  SCIPerrorMessage("relaxation solution is not valid\n");
31422  return SCIP_INVALIDCALL;
31423  }
31424 
31425  SCIP_CALL( SCIPsolLinkRelaxSol(sol, scip->set, scip->stat, scip->tree, scip->relaxation) );
31426 
31427  return SCIP_OKAY;
31428 }
31429 
31430 /** links a primal solution to the current pseudo solution
31431  *
31432  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
31433  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
31434  *
31435  * @pre This method can be called if SCIP is in one of the following stages:
31436  * - \ref SCIP_STAGE_PRESOLVING
31437  * - \ref SCIP_STAGE_SOLVING
31438  */
31440  SCIP* scip, /**< SCIP data structure */
31441  SCIP_SOL* sol /**< primal solution */
31442  )
31443 {
31444  SCIP_CALL( checkStage(scip, "SCIPlinkPseudoSol", FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) );
31445 
31446  SCIP_CALL( SCIPsolLinkPseudoSol(sol, scip->set, scip->stat, scip->transprob, scip->tree, scip->lp) );
31447 
31448  return SCIP_OKAY;
31449 }
31450 
31451 /** links a primal solution to the current LP or pseudo solution
31452  *
31453  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
31454  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
31455  *
31456  * @pre This method can be called if SCIP is in one of the following stages:
31457  * - \ref SCIP_STAGE_SOLVING
31458  */
31460  SCIP* scip, /**< SCIP data structure */
31461  SCIP_SOL* sol /**< primal solution */
31462  )
31463 {
31464  SCIP_CALL( checkStage(scip, "SCIPlinkCurrentSol", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) );
31465 
31466  SCIP_CALL( SCIPsolLinkCurrentSol(sol, scip->set, scip->stat, scip->transprob, scip->tree, scip->lp) );
31467 
31468  return SCIP_OKAY;
31469 }
31470 
31471 /** clears a primal solution
31472  *
31473  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
31474  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
31475  *
31476  * @pre This method can be called if SCIP is in one of the following stages:
31477  * - \ref SCIP_STAGE_PROBLEM
31478  * - \ref SCIP_STAGE_TRANSFORMING
31479  * - \ref SCIP_STAGE_TRANSFORMED
31480  * - \ref SCIP_STAGE_INITPRESOLVE
31481  * - \ref SCIP_STAGE_PRESOLVING
31482  * - \ref SCIP_STAGE_EXITPRESOLVE
31483  * - \ref SCIP_STAGE_PRESOLVED
31484  * - \ref SCIP_STAGE_INITSOLVE
31485  * - \ref SCIP_STAGE_SOLVING
31486  * - \ref SCIP_STAGE_SOLVED
31487  * - \ref SCIP_STAGE_EXITSOLVE
31488  * - \ref SCIP_STAGE_FREETRANS
31489  */
31491  SCIP* scip, /**< SCIP data structure */
31492  SCIP_SOL* sol /**< primal solution */
31493  )
31494 {
31495  SCIP_CALL( checkStage(scip, "SCIPclearSol", FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE) );
31496 
31497  SCIP_CALL( SCIPsolClear(sol, scip->stat, scip->tree) );
31498 
31499  return SCIP_OKAY;
31500 }
31501 
31502 /** stores solution values of variables in solution's own array
31503  *
31504  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
31505  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
31506  *
31507  * @pre This method can be called if SCIP is in one of the following stages:
31508  * - \ref SCIP_STAGE_TRANSFORMING
31509  * - \ref SCIP_STAGE_TRANSFORMED
31510  * - \ref SCIP_STAGE_PRESOLVING
31511  * - \ref SCIP_STAGE_PRESOLVED
31512  * - \ref SCIP_STAGE_INITSOLVE
31513  * - \ref SCIP_STAGE_SOLVING
31514  * - \ref SCIP_STAGE_SOLVED
31515  * - \ref SCIP_STAGE_EXITSOLVE
31516  * - \ref SCIP_STAGE_FREETRANS
31517  */
31519  SCIP* scip, /**< SCIP data structure */
31520  SCIP_SOL* sol /**< primal solution */
31521  )
31522 {
31523  SCIP_CALL( checkStage(scip, "SCIPunlinkSol", FALSE, FALSE, TRUE, TRUE, FALSE, TRUE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE) );
31524 
31525  SCIP_CALL( SCIPsolUnlink(sol, scip->set, scip->transprob) );
31526 
31527  return SCIP_OKAY;
31528 }
31529 
31530 /** sets value of variable in primal CIP solution
31531  *
31532  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
31533  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
31534  *
31535  * @pre This method can be called if SCIP is in one of the following stages:
31536  * - \ref SCIP_STAGE_PROBLEM
31537  * - \ref SCIP_STAGE_TRANSFORMING
31538  * - \ref SCIP_STAGE_TRANSFORMED
31539  * - \ref SCIP_STAGE_INITPRESOLVE
31540  * - \ref SCIP_STAGE_PRESOLVING
31541  * - \ref SCIP_STAGE_EXITPRESOLVE
31542  * - \ref SCIP_STAGE_PRESOLVED
31543  * - \ref SCIP_STAGE_INITSOLVE
31544  * - \ref SCIP_STAGE_SOLVING
31545  * - \ref SCIP_STAGE_SOLVED
31546  * - \ref SCIP_STAGE_EXITSOLVE
31547  * - \ref SCIP_STAGE_FREETRANS
31548  */
31550  SCIP* scip, /**< SCIP data structure */
31551  SCIP_SOL* sol, /**< primal solution */
31552  SCIP_VAR* var, /**< variable to add to solution */
31553  SCIP_Real val /**< solution value of variable */
31554  )
31555 {
31556  SCIP_CALL( checkStage(scip, "SCIPsetSolVal", FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE) );
31557 
31558  if( SCIPsolIsOriginal(sol) && SCIPvarIsTransformed(var) )
31559  {
31560  SCIPerrorMessage("cannot set value of transformed variable <%s> in original space solution\n",
31561  SCIPvarGetName(var));
31562  return SCIP_INVALIDCALL;
31563  }
31564 
31565  SCIP_CALL( SCIPsolSetVal(sol, scip->set, scip->stat, scip->tree, var, val) );
31566 
31567  return SCIP_OKAY;
31568 }
31569 
31570 /** sets values of multiple variables in primal CIP solution
31571  *
31572  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
31573  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
31574  *
31575  * @pre This method can be called if SCIP is in one of the following stages:
31576  * - \ref SCIP_STAGE_PROBLEM
31577  * - \ref SCIP_STAGE_TRANSFORMING
31578  * - \ref SCIP_STAGE_TRANSFORMED
31579  * - \ref SCIP_STAGE_INITPRESOLVE
31580  * - \ref SCIP_STAGE_PRESOLVING
31581  * - \ref SCIP_STAGE_EXITPRESOLVE
31582  * - \ref SCIP_STAGE_PRESOLVED
31583  * - \ref SCIP_STAGE_INITSOLVE
31584  * - \ref SCIP_STAGE_SOLVING
31585  * - \ref SCIP_STAGE_SOLVED
31586  * - \ref SCIP_STAGE_EXITSOLVE
31587  * - \ref SCIP_STAGE_FREETRANS
31588  */
31590  SCIP* scip, /**< SCIP data structure */
31591  SCIP_SOL* sol, /**< primal solution */
31592  int nvars, /**< number of variables to set solution value for */
31593  SCIP_VAR** vars, /**< array with variables to add to solution */
31594  SCIP_Real* vals /**< array with solution values of variables */
31595  )
31596 {
31597  int v;
31598 
31599  assert(nvars == 0 || vars != NULL);
31600  assert(nvars == 0 || vals != NULL);
31601 
31602  SCIP_CALL( checkStage(scip, "SCIPsetSolVals", FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE) );
31603 
31604  if( SCIPsolIsOriginal(sol) )
31605  {
31606  for( v = 0; v < nvars; ++v )
31607  {
31608  if( SCIPvarIsTransformed(vars[v]) )
31609  {
31610  SCIPerrorMessage("cannot set value of transformed variable <%s> in original space solution\n",
31611  SCIPvarGetName(vars[v]));
31612  return SCIP_INVALIDCALL;
31613  }
31614  }
31615  }
31616 
31617  for( v = 0; v < nvars; ++v )
31618  {
31619  SCIP_CALL( SCIPsolSetVal(sol, scip->set, scip->stat, scip->tree, vars[v], vals[v]) );
31620  }
31621 
31622  return SCIP_OKAY;
31623 }
31624 
31625 /** increases value of variable in primal CIP solution
31626  *
31627  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
31628  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
31629  *
31630  * @pre This method can be called if SCIP is in one of the following stages:
31631  * - \ref SCIP_STAGE_PROBLEM
31632  * - \ref SCIP_STAGE_TRANSFORMING
31633  * - \ref SCIP_STAGE_TRANSFORMED
31634  * - \ref SCIP_STAGE_INITPRESOLVE
31635  * - \ref SCIP_STAGE_PRESOLVING
31636  * - \ref SCIP_STAGE_EXITPRESOLVE
31637  * - \ref SCIP_STAGE_PRESOLVED
31638  * - \ref SCIP_STAGE_INITSOLVE
31639  * - \ref SCIP_STAGE_SOLVING
31640  * - \ref SCIP_STAGE_SOLVED
31641  * - \ref SCIP_STAGE_EXITSOLVE
31642  * - \ref SCIP_STAGE_FREETRANS
31643  */
31645  SCIP* scip, /**< SCIP data structure */
31646  SCIP_SOL* sol, /**< primal solution */
31647  SCIP_VAR* var, /**< variable to increase solution value for */
31648  SCIP_Real incval /**< increment for solution value of variable */
31649  )
31650 {
31651  SCIP_CALL( checkStage(scip, "SCIPincSolVal", FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE) );
31652 
31653  if( SCIPsolIsOriginal(sol) && SCIPvarIsTransformed(var) )
31654  {
31655  SCIPerrorMessage("cannot increase value of transformed variable <%s> in original space solution\n",
31656  SCIPvarGetName(var));
31657  return SCIP_INVALIDCALL;
31658  }
31659 
31660  SCIP_CALL( SCIPsolIncVal(sol, scip->set, scip->stat, scip->tree, var, incval) );
31661 
31662  return SCIP_OKAY;
31663 }
31664 
31665 /** returns value of variable in primal CIP solution, or in current LP/pseudo solution
31666  *
31667  * @return value of variable in primal CIP solution, or in current LP/pseudo solution
31668  *
31669  * @pre In case the solution pointer @p sol is @b NULL, that means it is asked for the LP or pseudo solution, this method
31670  * can only be called if @p scip is in the solving stage \ref SCIP_STAGE_SOLVING. In any other case, this method
31671  * can be called if @p scip is in one of the following stages:
31672  * - \ref SCIP_STAGE_PROBLEM
31673  * - \ref SCIP_STAGE_TRANSFORMING
31674  * - \ref SCIP_STAGE_TRANSFORMED
31675  * - \ref SCIP_STAGE_INITPRESOLVE
31676  * - \ref SCIP_STAGE_PRESOLVING
31677  * - \ref SCIP_STAGE_EXITPRESOLVE
31678  * - \ref SCIP_STAGE_PRESOLVED
31679  * - \ref SCIP_STAGE_INITSOLVE
31680  * - \ref SCIP_STAGE_SOLVING
31681  * - \ref SCIP_STAGE_SOLVED
31682  * - \ref SCIP_STAGE_EXITSOLVE
31683  * - \ref SCIP_STAGE_FREETRANS
31684  */
31686  SCIP* scip, /**< SCIP data structure */
31687  SCIP_SOL* sol, /**< primal solution, or NULL for current LP/pseudo solution */
31688  SCIP_VAR* var /**< variable to get value for */
31689  )
31690 {
31691  SCIP_CALL_ABORT( checkStage(scip, "SCIPgetSolVal", FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE) );
31692 
31693  if( sol != NULL )
31694  return SCIPsolGetVal(sol, scip->set, scip->stat, var);
31695 
31696  SCIP_CALL_ABORT( checkStage(scip, "SCIPgetSolVal(sol==NULL)", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) );
31697  return SCIPvarGetSol(var, SCIPtreeHasCurrentNodeLP(scip->tree));
31698 }
31699 
31700 /** gets values of multiple variables in primal CIP solution
31701  *
31702  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
31703  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
31704  *
31705  * @pre This method can be called if SCIP is in one of the following stages:
31706  * - \ref SCIP_STAGE_PROBLEM
31707  * - \ref SCIP_STAGE_TRANSFORMING
31708  * - \ref SCIP_STAGE_TRANSFORMED
31709  * - \ref SCIP_STAGE_INITPRESOLVE
31710  * - \ref SCIP_STAGE_PRESOLVING
31711  * - \ref SCIP_STAGE_EXITPRESOLVE
31712  * - \ref SCIP_STAGE_PRESOLVED
31713  * - \ref SCIP_STAGE_INITSOLVE
31714  * - \ref SCIP_STAGE_SOLVING
31715  * - \ref SCIP_STAGE_SOLVED
31716  * - \ref SCIP_STAGE_EXITSOLVE
31717  * - \ref SCIP_STAGE_FREETRANS
31718  */
31720  SCIP* scip, /**< SCIP data structure */
31721  SCIP_SOL* sol, /**< primal solution, or NULL for current LP/pseudo solution */
31722  int nvars, /**< number of variables to get solution value for */
31723  SCIP_VAR** vars, /**< array with variables to get value for */
31724  SCIP_Real* vals /**< array to store solution values of variables */
31725  )
31726 {
31727  assert(nvars == 0 || vars != NULL);
31728  assert(nvars == 0 || vals != NULL);
31729 
31730  SCIP_CALL( checkStage(scip, "SCIPgetSolVals", FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE) );
31731 
31732  if( sol != NULL )
31733  {
31734  int v;
31735 
31736  for( v = 0; v < nvars; ++v )
31737  vals[v] = SCIPsolGetVal(sol, scip->set, scip->stat, vars[v]);
31738  }
31739  else
31740  {
31741  SCIP_CALL( SCIPgetVarSols(scip, nvars, vars, vals) );
31742  }
31743 
31744  return SCIP_OKAY;
31745 }
31746 
31747 /** returns objective value of primal CIP solution w.r.t. original problem, or current LP/pseudo objective value
31748  *
31749  * @return objective value of primal CIP solution w.r.t. original problem, or current LP/pseudo objective value
31750  *
31751  * @pre This method can be called if SCIP is in one of the following stages:
31752  * - \ref SCIP_STAGE_PROBLEM
31753  * - \ref SCIP_STAGE_TRANSFORMING
31754  * - \ref SCIP_STAGE_TRANSFORMED
31755  * - \ref SCIP_STAGE_INITPRESOLVE
31756  * - \ref SCIP_STAGE_PRESOLVING
31757  * - \ref SCIP_STAGE_EXITPRESOLVE
31758  * - \ref SCIP_STAGE_PRESOLVED
31759  * - \ref SCIP_STAGE_INITSOLVE
31760  * - \ref SCIP_STAGE_SOLVING
31761  * - \ref SCIP_STAGE_SOLVED
31762  * - \ref SCIP_STAGE_EXITSOLVE
31763  * - \ref SCIP_STAGE_FREETRANS
31764  */
31766  SCIP* scip, /**< SCIP data structure */
31767  SCIP_SOL* sol /**< primal solution, or NULL for current LP/pseudo objective value */
31768  )
31769 {
31770  /* for original solutions, an original objective value is already available in SCIP_STAGE_PROBLEM
31771  * for all other solutions, we should be at least in SCIP_STAGE_TRANSFORMING
31772  */
31773  if( sol != NULL && SCIPsolIsOriginal(sol) )
31774  {
31775  SCIP_CALL_ABORT( checkStage(scip, "SCIPgetSolOrigObj", FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE) );
31776 
31777  return SCIPsolGetOrigObj(sol);
31778  }
31779 
31780  SCIP_CALL_ABORT( checkStage(scip, "SCIPgetSolOrigObj", FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE) );
31781 
31782  if( sol != NULL )
31783  return SCIPprobExternObjval(scip->transprob, scip->origprob, scip->set, SCIPsolGetObj(sol, scip->set, scip->transprob, scip->origprob));
31784  else
31785  {
31786  SCIP_CALL_ABORT( checkStage(scip, "SCIPgetSolOrigObj(sol==NULL)",
31788  if( SCIPtreeHasCurrentNodeLP(scip->tree) )
31789  return SCIPprobExternObjval(scip->transprob, scip->origprob, scip->set, SCIPlpGetObjval(scip->lp, scip->set, scip->transprob));
31790  else
31791  return SCIPprobExternObjval(scip->transprob, scip->origprob, scip->set, SCIPlpGetPseudoObjval(scip->lp, scip->set, scip->transprob));
31792  }
31793 }
31794 
31795 /** returns transformed objective value of primal CIP solution, or transformed current LP/pseudo objective value
31796  *
31797  * @return transformed objective value of primal CIP solution, or transformed current LP/pseudo objective value
31798  *
31799  * @pre This method can be called if SCIP is in one of the following stages:
31800  * - \ref SCIP_STAGE_TRANSFORMING
31801  * - \ref SCIP_STAGE_TRANSFORMED
31802  * - \ref SCIP_STAGE_INITPRESOLVE
31803  * - \ref SCIP_STAGE_PRESOLVING
31804  * - \ref SCIP_STAGE_EXITPRESOLVE
31805  * - \ref SCIP_STAGE_PRESOLVED
31806  * - \ref SCIP_STAGE_INITSOLVE
31807  * - \ref SCIP_STAGE_SOLVING
31808  * - \ref SCIP_STAGE_SOLVED
31809  * - \ref SCIP_STAGE_EXITSOLVE
31810  * - \ref SCIP_STAGE_FREETRANS
31811  */
31813  SCIP* scip, /**< SCIP data structure */
31814  SCIP_SOL* sol /**< primal solution, or NULL for current LP/pseudo objective value */
31815  )
31816 {
31817  SCIP_CALL_ABORT( checkStage(scip, "SCIPgetSolTransObj", FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE) );
31818 
31819  if( sol != NULL )
31820  return SCIPsolGetObj(sol, scip->set, scip->transprob, scip->origprob);
31821  else
31822  {
31823  SCIP_CALL_ABORT( checkStage(scip, "SCIPgetSolTransObj(sol==NULL)",
31825  if( SCIPtreeHasCurrentNodeLP(scip->tree) )
31826  return SCIPlpGetObjval(scip->lp, scip->set, scip->transprob);
31827  else
31828  return SCIPlpGetPseudoObjval(scip->lp, scip->set, scip->transprob);
31829  }
31830 }
31831 
31832 /** maps original space objective value into transformed objective value
31833  *
31834  * @return transformed objective value
31835  *
31836  * @pre This method can be called if SCIP is in one of the following stages:
31837  * - \ref SCIP_STAGE_TRANSFORMING
31838  * - \ref SCIP_STAGE_TRANSFORMED
31839  * - \ref SCIP_STAGE_INITPRESOLVE
31840  * - \ref SCIP_STAGE_PRESOLVING
31841  * - \ref SCIP_STAGE_EXITPRESOLVE
31842  * - \ref SCIP_STAGE_PRESOLVED
31843  * - \ref SCIP_STAGE_INITSOLVE
31844  * - \ref SCIP_STAGE_SOLVING
31845  * - \ref SCIP_STAGE_SOLVED
31846  */
31848  SCIP* scip, /**< SCIP data structure */
31849  SCIP_Real obj /**< original space objective value to transform */
31850  )
31851 {
31852  SCIP_CALL_ABORT( checkStage(scip, "SCIPtransformObj", FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE) );
31853 
31854  return SCIPprobInternObjval(scip->transprob, scip->origprob, scip->set, obj);
31855 }
31856 
31857 /** maps transformed objective value into original space
31858  *
31859  * @return objective value into original space
31860  *
31861  * @pre This method can be called if SCIP is in one of the following stages:
31862  * - \ref SCIP_STAGE_TRANSFORMING
31863  * - \ref SCIP_STAGE_TRANSFORMED
31864  * - \ref SCIP_STAGE_INITPRESOLVE
31865  * - \ref SCIP_STAGE_PRESOLVING
31866  * - \ref SCIP_STAGE_EXITPRESOLVE
31867  * - \ref SCIP_STAGE_PRESOLVED
31868  * - \ref SCIP_STAGE_INITSOLVE
31869  * - \ref SCIP_STAGE_SOLVING
31870  * - \ref SCIP_STAGE_SOLVED
31871  */
31873  SCIP* scip, /**< SCIP data structure */
31874  SCIP_Real obj /**< transformed objective value to retransform in original space */
31875  )
31876 {
31877  SCIP_CALL_ABORT( checkStage(scip, "SCIPretransformObj", FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE) );
31878 
31879  return SCIPprobExternObjval(scip->transprob, scip->origprob, scip->set, obj);
31880 }
31881 
31882 /** gets clock time, when this solution was found
31883  *
31884  * @return clock time, when this solution was found
31885  *
31886  * @pre This method can be called if SCIP is in one of the following stages:
31887  * - \ref SCIP_STAGE_TRANSFORMING
31888  * - \ref SCIP_STAGE_TRANSFORMED
31889  * - \ref SCIP_STAGE_INITPRESOLVE
31890  * - \ref SCIP_STAGE_PRESOLVING
31891  * - \ref SCIP_STAGE_EXITPRESOLVE
31892  * - \ref SCIP_STAGE_PRESOLVED
31893  * - \ref SCIP_STAGE_INITSOLVE
31894  * - \ref SCIP_STAGE_SOLVING
31895  * - \ref SCIP_STAGE_SOLVED
31896  * - \ref SCIP_STAGE_EXITSOLVE
31897  * - \ref SCIP_STAGE_FREETRANS
31898  */
31900  SCIP* scip, /**< SCIP data structure */
31901  SCIP_SOL* sol /**< primal solution */
31902  )
31903 {
31904  SCIP_CALL_ABORT( checkStage(scip, "SCIPgetSolTime", FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE) );
31905 
31906  return SCIPsolGetTime(sol);
31907 }
31908 
31909 /** gets branch and bound run number, where this solution was found
31910  *
31911  * @return branch and bound run number, where this solution was found
31912  *
31913  * @pre This method can be called if SCIP is in one of the following stages:
31914  * - \ref SCIP_STAGE_TRANSFORMING
31915  * - \ref SCIP_STAGE_TRANSFORMED
31916  * - \ref SCIP_STAGE_INITPRESOLVE
31917  * - \ref SCIP_STAGE_PRESOLVING
31918  * - \ref SCIP_STAGE_EXITPRESOLVE
31919  * - \ref SCIP_STAGE_PRESOLVED
31920  * - \ref SCIP_STAGE_INITSOLVE
31921  * - \ref SCIP_STAGE_SOLVING
31922  * - \ref SCIP_STAGE_SOLVED
31923  * - \ref SCIP_STAGE_EXITSOLVE
31924  * - \ref SCIP_STAGE_FREETRANS
31925  */
31927  SCIP* scip, /**< SCIP data structure */
31928  SCIP_SOL* sol /**< primal solution */
31929  )
31930 {
31931  SCIP_CALL_ABORT( checkStage(scip, "SCIPgetSolRunnum", FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE) );
31932 
31933  return SCIPsolGetRunnum(sol);
31934 }
31935 
31936 /** gets node number of the specific branch and bound run, where this solution was found
31937  *
31938  * @return node number of the specific branch and bound run, where this solution was found
31939  *
31940  * @pre This method can be called if SCIP is in one of the following stages:
31941  * - \ref SCIP_STAGE_TRANSFORMING
31942  * - \ref SCIP_STAGE_TRANSFORMED
31943  * - \ref SCIP_STAGE_INITPRESOLVE
31944  * - \ref SCIP_STAGE_PRESOLVING
31945  * - \ref SCIP_STAGE_EXITPRESOLVE
31946  * - \ref SCIP_STAGE_PRESOLVED
31947  * - \ref SCIP_STAGE_INITSOLVE
31948  * - \ref SCIP_STAGE_SOLVING
31949  * - \ref SCIP_STAGE_SOLVED
31950  * - \ref SCIP_STAGE_EXITSOLVE
31951  * - \ref SCIP_STAGE_FREETRANS
31952  */
31954  SCIP* scip, /**< SCIP data structure */
31955  SCIP_SOL* sol /**< primal solution */
31956  )
31957 {
31958  SCIP_CALL_ABORT( checkStage(scip, "SCIPgetSolNodenum", FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE) );
31959 
31960  return SCIPsolGetNodenum(sol);
31961 }
31962 
31963 /** gets heuristic, that found this solution (or NULL if it's from the tree)
31964  *
31965  * @return heuristic, that found this solution (or NULL if it's from the tree)
31966  *
31967  * @pre This method can be called if SCIP is in one of the following stages:
31968  * - \ref SCIP_STAGE_TRANSFORMING
31969  * - \ref SCIP_STAGE_TRANSFORMED
31970  * - \ref SCIP_STAGE_INITPRESOLVE
31971  * - \ref SCIP_STAGE_PRESOLVING
31972  * - \ref SCIP_STAGE_EXITPRESOLVE
31973  * - \ref SCIP_STAGE_PRESOLVED
31974  * - \ref SCIP_STAGE_INITSOLVE
31975  * - \ref SCIP_STAGE_SOLVING
31976  * - \ref SCIP_STAGE_SOLVED
31977  * - \ref SCIP_STAGE_EXITSOLVE
31978  * - \ref SCIP_STAGE_FREETRANS
31979  */
31981  SCIP* scip, /**< SCIP data structure */
31982  SCIP_SOL* sol /**< primal solution */
31983  )
31984 {
31985  SCIP_CALL_ABORT( checkStage(scip, "SCIPgetSolHeur", FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE) );
31986 
31987  return SCIPsolGetHeur(sol);
31988 }
31989 
31990 /** returns whether two given solutions are exactly equal
31991  *
31992  * @return returns whether two given solutions are exactly equal
31993  *
31994  * @pre This method can be called if SCIP is in one of the following stages:
31995  * - \ref SCIP_STAGE_PROBLEM
31996  * - \ref SCIP_STAGE_TRANSFORMING
31997  * - \ref SCIP_STAGE_TRANSFORMED
31998  * - \ref SCIP_STAGE_INITPRESOLVE
31999  * - \ref SCIP_STAGE_PRESOLVING
32000  * - \ref SCIP_STAGE_EXITPRESOLVE
32001  * - \ref SCIP_STAGE_PRESOLVED
32002  * - \ref SCIP_STAGE_INITSOLVE
32003  * - \ref SCIP_STAGE_SOLVING
32004  * - \ref SCIP_STAGE_SOLVED
32005  * - \ref SCIP_STAGE_EXITSOLVE
32006  * - \ref SCIP_STAGE_FREETRANS
32007  */
32009  SCIP* scip, /**< SCIP data structure */
32010  SCIP_SOL* sol1, /**< first primal CIP solution */
32011  SCIP_SOL* sol2 /**< second primal CIP solution */
32012  )
32013 {
32014  SCIP_CALL_ABORT( checkStage(scip, "SCIPareSolsEqual", FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE) );
32015 
32016  return SCIPsolsAreEqual(sol1, sol2, scip->set, scip->stat, scip->origprob, scip->transprob);
32017 }
32018 
32019 /** adjusts solution values of implicit integer variables in handed solution. Solution objective value is not
32020  * deteriorated by this method.
32021  *
32022  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
32023  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
32024  *
32025  * @pre This method can be called if SCIP is in one of the following stages:
32026  * - \ref SCIP_STAGE_SOLVING
32027  */
32029  SCIP* scip, /**< SCIP data structure */
32030  SCIP_SOL* sol, /**< primal CIP solution */
32031  SCIP_Bool uselprows /**< should LP row information be considered for none-objective variables */
32032  )
32033 {
32034  assert(scip != NULL);
32035  SCIP_CALL( checkStage(scip, "SCIPadjustImplicitSolVals", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) );
32036 
32037  assert(sol != NULL);
32038  SCIP_CALL( SCIPsolAdjustImplicitSolVals(sol, scip->set, scip->stat, scip->transprob, scip->tree, uselprows) );
32039 
32040  return SCIP_OKAY;
32041 }
32042 
32043 /** outputs non-zero variables of solution in original problem space to the given file stream
32044  *
32045  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
32046  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
32047  *
32048  * @pre In case the solution pointer @p sol is NULL (asking for the current LP/pseudo solution), this method can be
32049  * called if @p scip is in one of the following stages:
32050  * - \ref SCIP_STAGE_PRESOLVING
32051  * - \ref SCIP_STAGE_EXITPRESOLVE
32052  * - \ref SCIP_STAGE_PRESOLVED
32053  * - \ref SCIP_STAGE_INITSOLVE
32054  * - \ref SCIP_STAGE_SOLVING
32055  * - \ref SCIP_STAGE_SOLVED
32056  * - \ref SCIP_STAGE_EXITSOLVE
32057  *
32058  * @pre In case the solution pointer @p sol is @b not NULL, this method can be called if @p scip is in one of the
32059  * following stages:
32060  * - \ref SCIP_STAGE_PROBLEM
32061  * - \ref SCIP_STAGE_TRANSFORMED
32062  * - \ref SCIP_STAGE_INITPRESOLVE
32063  * - \ref SCIP_STAGE_PRESOLVING
32064  * - \ref SCIP_STAGE_EXITPRESOLVE
32065  * - \ref SCIP_STAGE_PRESOLVED
32066  * - \ref SCIP_STAGE_INITSOLVE
32067  * - \ref SCIP_STAGE_SOLVING
32068  * - \ref SCIP_STAGE_SOLVED
32069  * - \ref SCIP_STAGE_EXITSOLVE
32070  */
32072  SCIP* scip, /**< SCIP data structure */
32073  SCIP_SOL* sol, /**< primal solution, or NULL for current LP/pseudo solution */
32074  FILE* file, /**< output file (or NULL for standard output) */
32075  SCIP_Bool printzeros /**< should variables set to zero be printed? */
32076  )
32077 {
32078  SCIP_Real objvalue;
32079  SCIP_Bool currentsol;
32080 
32081  assert(SCIPisTransformed(scip) || sol != NULL);
32082 
32083  SCIP_CALL( checkStage(scip, "SCIPprintSol", FALSE, TRUE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE) );
32084 
32085  currentsol = (sol == NULL);
32086  if( currentsol )
32087  {
32088  SCIP_CALL( checkStage(scip, "SCIPprintSol(sol==NULL)",
32090 
32091  /* create a temporary solution that is linked to the current solution */
32092  SCIP_CALL( SCIPsolCreateCurrentSol(&sol, scip->mem->probmem, scip->set, scip->stat, scip->transprob, scip->primal,
32093  scip->tree, scip->lp, NULL) );
32094  }
32095 
32096  SCIPmessageFPrintInfo(scip->messagehdlr, file, "objective value: ");
32097  if( SCIPsolIsOriginal(sol) )
32098  objvalue = SCIPsolGetOrigObj(sol);
32099  else
32100  objvalue = SCIPprobExternObjval(scip->transprob, scip->origprob, scip->set, SCIPsolGetObj(sol, scip->set, scip->transprob, scip->origprob));
32101 
32102  SCIPprintReal(scip, file, objvalue, 20, 15);
32103  SCIPmessageFPrintInfo(scip->messagehdlr, file, "\n");
32104 
32105  SCIP_CALL( SCIPsolPrint(sol, scip->set, scip->messagehdlr, scip->stat, scip->origprob, scip->transprob, file, printzeros) );
32106 
32107  if( currentsol )
32108  {
32109  /* free temporary solution */
32110  SCIP_CALL( SCIPsolFree(&sol, scip->mem->probmem, scip->primal) );
32111  }
32112 
32113  return SCIP_OKAY;
32114 }
32115 
32116 /** outputs non-zero variables of solution in transformed problem space to file stream
32117  *
32118  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
32119  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
32120  *
32121  * @pre This method can be called if SCIP is in one of the following stages:
32122  * - \ref SCIP_STAGE_TRANSFORMED
32123  * - \ref SCIP_STAGE_INITPRESOLVE
32124  * - \ref SCIP_STAGE_PRESOLVING
32125  * - \ref SCIP_STAGE_EXITPRESOLVE
32126  * - \ref SCIP_STAGE_PRESOLVED
32127  * - \ref SCIP_STAGE_INITSOLVE
32128  * - \ref SCIP_STAGE_SOLVING
32129  * - \ref SCIP_STAGE_SOLVED
32130  * - \ref SCIP_STAGE_EXITSOLVE
32131  */
32133  SCIP* scip, /**< SCIP data structure */
32134  SCIP_SOL* sol, /**< primal solution, or NULL for current LP/pseudo solution */
32135  FILE* file, /**< output file (or NULL for standard output) */
32136  SCIP_Bool printzeros /**< should variables set to zero be printed? */
32137  )
32138 {
32139  SCIP_Bool currentsol;
32140 
32141  SCIP_CALL( checkStage(scip, "SCIPprintTransSol", FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE) );
32142 
32143  currentsol = (sol == NULL);
32144  if( currentsol )
32145  {
32146  /* create a temporary solution that is linked to the current solution */
32147  SCIP_CALL( SCIPsolCreateCurrentSol(&sol, scip->mem->probmem, scip->set, scip->stat, scip->transprob, scip->primal,
32148  scip->tree, scip->lp, NULL) );
32149  }
32150 
32151  if( SCIPsolIsOriginal(sol) )
32152  {
32153  SCIPerrorMessage("cannot print original space solution as transformed solution\n");
32154  return SCIP_INVALIDCALL;
32155  }
32156 
32157  SCIPmessageFPrintInfo(scip->messagehdlr, file, "objective value: ");
32158  SCIPprintReal(scip, file, SCIPsolGetObj(sol, scip->set, scip->transprob, scip->origprob), 20, 9);
32159  SCIPmessageFPrintInfo(scip->messagehdlr, file, "\n");
32160 
32161  SCIP_CALL( SCIPsolPrint(sol, scip->set, scip->messagehdlr, scip->stat, scip->transprob, NULL, file, printzeros) );
32162 
32163  if( currentsol )
32164  {
32165  /* free temporary solution */
32166  SCIP_CALL( SCIPsolFree(&sol, scip->mem->probmem, scip->primal) );
32167  }
32168 
32169  return SCIP_OKAY;
32170 }
32171 
32172 
32173 /** outputs dual solution from LP solver to file stream */
32174 static
32176  SCIP* scip, /**< SCIP data structure */
32177  FILE* file, /**< output file (or NULL for standard output) */
32178  SCIP_Bool printzeros /**< should variables set to zero be printed? */
32179  )
32180 {
32181  int c;
32182 
32183  assert(scip->lp != NULL);
32184  assert(scip->lp->solved);
32185  assert(scip->lp->dualfeasible);
32186 
32187  /* print dual solution values of all constraints */
32188  for( c = 0; c < scip->transprob->nconss; ++c )
32189  {
32190  SCIP_CONS* cons;
32191  SCIP_Real solval;
32192 #ifndef NDEBUG
32193  SCIP_CONSHDLR* conshdlr;
32194 #endif
32195  cons = scip->transprob->conss[c];
32196  assert(cons != NULL);
32197 
32198 #ifndef NDEBUG
32199  conshdlr = SCIPconsGetHdlr(cons);
32200  assert(conshdlr != NULL);
32201  assert(strcmp(SCIPconshdlrGetName(conshdlr), "linear" ) == 0);
32202 #endif
32203 
32204  solval = SCIPgetDualsolLinear(scip, cons);
32205  assert(solval != SCIP_INVALID); /*lint !e777*/
32206 
32207  if( printzeros || !SCIPisZero(scip, solval) )
32208  {
32209  SCIP_MESSAGEHDLR* messagehdlr = scip->messagehdlr;
32210 
32211  SCIPmessageFPrintInfo(messagehdlr, file, "%-32s", SCIPconsGetName(cons));
32212 
32213  if( SCIPisInfinity(scip, solval) )
32214  SCIPmessageFPrintInfo(messagehdlr, file, " +infinity\n");
32215  else if( SCIPisInfinity(scip, -solval) )
32216  SCIPmessageFPrintInfo(messagehdlr, file, " -infinity\n");
32217  else
32218  SCIPmessageFPrintInfo(messagehdlr, file, " % 20.15g\n", solval);
32219  }
32220  }
32221 
32222  return SCIP_OKAY;
32223 }
32224 
32225 /** outputs dual solution from LP solver to file stream
32226  *
32227  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
32228  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
32229  *
32230  * @pre This method can be called in all stages but only prints dual information when called in \ref SCIP_STAGE_SOLVED
32231  */
32233  SCIP* scip, /**< SCIP data structure */
32234  FILE* file, /**< output file (or NULL for standard output) */
32235  SCIP_Bool printzeros /**< should variables set to zero be printed? */
32236  )
32237 {
32238  int c;
32239 
32240  assert(scip != NULL);
32241 
32242  SCIP_CALL( checkStage(scip, "SCIPprintDualSol", TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE) );
32243 
32244  if( SCIPgetStage(scip) != SCIP_STAGE_SOLVED )
32245  {
32246  SCIPmessageFPrintInfo(scip->messagehdlr, NULL, "No dual solution available.\n");
32247  return SCIP_OKAY;
32248  }
32249 
32250  assert(scip->stat != NULL);
32251  assert(scip->transprob != NULL);
32252 
32253  /* dual solution only useful when no presolving was performed */
32254  if( scip->stat->performpresol )
32255  {
32256  SCIPwarningMessage(scip, "No dual information available when presolving was performed.\n");
32257  return SCIP_OKAY;
32258  }
32259 
32260  /* dual solution is created by LP solver and therefore only available for pure LPs */
32261  if( scip->transprob->nvars != scip->transprob->ncontvars )
32262  {
32263  SCIPwarningMessage(scip, "Dual information only available for pure LPs (only continuous variables).\n");
32264  return SCIP_OKAY;
32265  }
32266 
32267  /* dual solution is created by LP solver and therefore only available for linear constraints */
32268  for( c = scip->transprob->nconss - 1; c >= 0; --c )
32269  {
32270  SCIP_CONSHDLR* conshdlr;
32271 
32272  conshdlr = SCIPconsGetHdlr(scip->transprob->conss[c]);
32273  assert(conshdlr != NULL);
32274 
32275  if( strcmp(SCIPconshdlrGetName(conshdlr), "linear" ) != 0 )
32276  {
32277  SCIPwarningMessage(scip, "Dual information only available for pure LPs (only linear constraints).\n");
32278  return SCIP_OKAY;
32279  }
32280  }
32281 
32282  /* print dual solution */
32283  SCIP_CALL( printDualSol(scip, file, printzeros) );
32284 
32285  return SCIP_OKAY;
32286 }
32287 
32288 
32289 /** outputs non-zero variables of solution representing a ray in original problem space to file stream
32290  *
32291  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
32292  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
32293  *
32294  * @pre This method can be called if SCIP is in one of the following stages:
32295  * - \ref SCIP_STAGE_PROBLEM
32296  * - \ref SCIP_STAGE_TRANSFORMED
32297  * - \ref SCIP_STAGE_INITPRESOLVE
32298  * - \ref SCIP_STAGE_PRESOLVING
32299  * - \ref SCIP_STAGE_EXITPRESOLVE
32300  * - \ref SCIP_STAGE_PRESOLVED
32301  * - \ref SCIP_STAGE_INITSOLVE
32302  * - \ref SCIP_STAGE_SOLVING
32303  * - \ref SCIP_STAGE_SOLVED
32304  * - \ref SCIP_STAGE_EXITSOLVE
32305  */
32307  SCIP* scip, /**< SCIP data structure */
32308  SCIP_SOL* sol, /**< primal solution representing ray */
32309  FILE* file, /**< output file (or NULL for standard output) */
32310  SCIP_Bool printzeros /**< should variables set to zero be printed? */
32311  )
32312 {
32313  assert(scip != NULL);
32314  assert(sol != NULL);
32315 
32316  SCIP_CALL( checkStage(scip, "SCIPprintRay", FALSE, TRUE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE) );
32317 
32318  SCIP_CALL( SCIPsolPrintRay(sol, scip->set, scip->messagehdlr, scip->stat, scip->origprob, scip->transprob, file, printzeros) );
32319 
32320  return SCIP_OKAY;
32321 }
32322 
32323 /** gets number of feasible primal solutions stored in the solution storage in case the problem is transformed;
32324  * in case the problem stage is SCIP_STAGE_PROBLEM, the number of solution in the original solution candidate
32325  * storage is returned
32326  *
32327  * @return number of feasible primal solutions stored in the solution storage in case the problem is transformed; or
32328  * number of solution in the original solution candidate storage if the problem stage is SCIP_STAGE_PROBLEM
32329  *
32330  * @pre This method can be called if SCIP is in one of the following stages:
32331  * - \ref SCIP_STAGE_PROBLEM
32332  * - \ref SCIP_STAGE_TRANSFORMED
32333  * - \ref SCIP_STAGE_INITPRESOLVE
32334  * - \ref SCIP_STAGE_PRESOLVING
32335  * - \ref SCIP_STAGE_EXITPRESOLVE
32336  * - \ref SCIP_STAGE_PRESOLVED
32337  * - \ref SCIP_STAGE_INITSOLVE
32338  * - \ref SCIP_STAGE_SOLVING
32339  * - \ref SCIP_STAGE_SOLVED
32340  * - \ref SCIP_STAGE_EXITSOLVE
32341  */
32343  SCIP* scip /**< SCIP data structure */
32344  )
32345 {
32346  SCIP_CALL_ABORT( checkStage(scip, "SCIPgetNSols", FALSE, TRUE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE) );
32347 
32348  switch( scip->set->stage )
32349  {
32350  case SCIP_STAGE_PROBLEM:
32351  return scip->origprimal->nsols;
32352 
32355  case SCIP_STAGE_PRESOLVING:
32357  case SCIP_STAGE_PRESOLVED:
32358  case SCIP_STAGE_INITSOLVE:
32359  case SCIP_STAGE_SOLVING:
32360  case SCIP_STAGE_SOLVED:
32361  case SCIP_STAGE_EXITSOLVE:
32362  return scip->primal->nsols;
32363 
32364  case SCIP_STAGE_INIT:
32366  case SCIP_STAGE_FREETRANS:
32367  default:
32368  SCIPerrorMessage("invalid SCIP stage <%d>\n", scip->set->stage);
32369  SCIPABORT();
32370  return -1; /*lint !e527*/
32371  } /*lint !e788*/
32372 }
32373 
32374 /** gets array of feasible primal solutions stored in the solution storage in case the problem is transformed; in case
32375  * if the problem stage is in SCIP_STAGE_PROBLEM, it returns the number array of solution candidate stored
32376  *
32377  * @return array of feasible primal solutions
32378  *
32379  * @pre This method can be called if SCIP is in one of the following stages:
32380  * - \ref SCIP_STAGE_PROBLEM
32381  * - \ref SCIP_STAGE_TRANSFORMED
32382  * - \ref SCIP_STAGE_INITPRESOLVE
32383  * - \ref SCIP_STAGE_PRESOLVING
32384  * - \ref SCIP_STAGE_EXITPRESOLVE
32385  * - \ref SCIP_STAGE_PRESOLVED
32386  * - \ref SCIP_STAGE_INITSOLVE
32387  * - \ref SCIP_STAGE_SOLVING
32388  * - \ref SCIP_STAGE_SOLVED
32389  * - \ref SCIP_STAGE_EXITSOLVE
32390  */
32392  SCIP* scip /**< SCIP data structure */
32393  )
32394 {
32395  SCIP_CALL_ABORT( checkStage(scip, "SCIPgetSols", FALSE, TRUE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE) );
32396 
32397  switch( scip->set->stage )
32398  {
32399  case SCIP_STAGE_PROBLEM:
32400  return scip->origprimal->sols;
32401 
32404  case SCIP_STAGE_PRESOLVING:
32406  case SCIP_STAGE_PRESOLVED:
32407  case SCIP_STAGE_INITSOLVE:
32408  case SCIP_STAGE_SOLVING:
32409  case SCIP_STAGE_SOLVED:
32410  case SCIP_STAGE_EXITSOLVE:
32411  return scip->primal->sols;
32412 
32413  case SCIP_STAGE_INIT:
32415  case SCIP_STAGE_FREETRANS:
32416  case SCIP_STAGE_FREE:
32417  default:
32418  SCIPerrorMessage("invalid SCIP stage <%d>\n", scip->set->stage);
32419  return NULL;
32420  } /*lint !e788*/
32421 }
32422 
32423 /** gets best feasible primal solution found so far if the problem is transformed; in case the problem is in
32424  * SCIP_STAGE_PROBLEM it returns the best solution candidate, or NULL if no solution has been found or the candidate
32425  * store is empty;
32426  *
32427  * @return best feasible primal solution so far
32428  *
32429  * @pre This method can be called if SCIP is in one of the following stages:
32430  * - \ref SCIP_STAGE_PROBLEM
32431  * - \ref SCIP_STAGE_TRANSFORMED
32432  * - \ref SCIP_STAGE_INITPRESOLVE
32433  * - \ref SCIP_STAGE_PRESOLVING
32434  * - \ref SCIP_STAGE_EXITPRESOLVE
32435  * - \ref SCIP_STAGE_PRESOLVED
32436  * - \ref SCIP_STAGE_INITSOLVE
32437  * - \ref SCIP_STAGE_SOLVING
32438  * - \ref SCIP_STAGE_SOLVED
32439  * - \ref SCIP_STAGE_EXITSOLVE
32440  */
32442  SCIP* scip /**< SCIP data structure */
32443  )
32444 {
32445  SCIP_CALL_ABORT( checkStage(scip, "SCIPgetBestSol", TRUE, TRUE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE) );
32446  switch( scip->set->stage )
32447  {
32448  case SCIP_STAGE_INIT:
32449  return NULL;
32450  case SCIP_STAGE_PROBLEM:
32451  assert(scip->origprimal != NULL);
32452  if( scip->origprimal->nsols > 0 )
32453  {
32454  assert(scip->origprimal->sols != NULL);
32455  assert(scip->origprimal->sols[0] != NULL);
32456  return scip->origprimal->sols[0];
32457  }
32458  break;
32459 
32462  case SCIP_STAGE_PRESOLVING:
32464  case SCIP_STAGE_PRESOLVED:
32465  case SCIP_STAGE_INITSOLVE:
32466  case SCIP_STAGE_SOLVING:
32467  case SCIP_STAGE_SOLVED:
32468  case SCIP_STAGE_EXITSOLVE:
32469  assert(scip->primal != NULL);
32470  if( scip->primal->nsols > 0 )
32471  {
32472  assert(scip->primal->sols != NULL);
32473  assert(scip->primal->sols[0] != NULL);
32474  return scip->primal->sols[0];
32475  }
32476  break;
32477 
32479  case SCIP_STAGE_FREETRANS:
32480  case SCIP_STAGE_FREE:
32481  default:
32482  SCIPerrorMessage("invalid SCIP stage <%d>\n", scip->set->stage);
32483  return NULL;
32484  }
32485 
32486  return NULL;
32487 }
32488 
32489 /** outputs best feasible primal solution found so far to file stream
32490  *
32491  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
32492  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
32493  *
32494  * @pre This method can be called if SCIP is in one of the following stages:
32495  * - \ref SCIP_STAGE_INIT
32496  * - \ref SCIP_STAGE_PROBLEM
32497  * - \ref SCIP_STAGE_TRANSFORMED
32498  * - \ref SCIP_STAGE_INITPRESOLVE
32499  * - \ref SCIP_STAGE_PRESOLVING
32500  * - \ref SCIP_STAGE_EXITPRESOLVE
32501  * - \ref SCIP_STAGE_PRESOLVED
32502  * - \ref SCIP_STAGE_INITSOLVE
32503  * - \ref SCIP_STAGE_SOLVING
32504  * - \ref SCIP_STAGE_SOLVED
32505  * - \ref SCIP_STAGE_EXITSOLVE
32506  */
32508  SCIP* scip, /**< SCIP data structure */
32509  FILE* file, /**< output file (or NULL for standard output) */
32510  SCIP_Bool printzeros /**< should variables set to zero be printed? */
32511  )
32512 {
32513  SCIP_SOL* sol;
32514 
32515  SCIP_CALL( checkStage(scip, "SCIPprintBestSol", TRUE, TRUE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE) );
32516 
32517  sol = SCIPgetBestSol(scip);
32518 
32519  if( sol == NULL )
32520  SCIPmessageFPrintInfo(scip->messagehdlr, file, "no solution available\n");
32521  else
32522  {
32523  SCIP_CALL( SCIPprintSol(scip, sol, file, printzeros) );
32524  }
32525 
32526  return SCIP_OKAY;
32527 }
32528 
32529 /** outputs best feasible primal solution found so far in transformed variables to file stream
32530  *
32531  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
32532  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
32533  *
32534  * @pre This method can be called if SCIP is in one of the following stages:
32535  * - \ref SCIP_STAGE_INIT
32536  * - \ref SCIP_STAGE_PROBLEM
32537  * - \ref SCIP_STAGE_TRANSFORMED
32538  * - \ref SCIP_STAGE_INITPRESOLVE
32539  * - \ref SCIP_STAGE_PRESOLVING
32540  * - \ref SCIP_STAGE_EXITPRESOLVE
32541  * - \ref SCIP_STAGE_PRESOLVED
32542  * - \ref SCIP_STAGE_INITSOLVE
32543  * - \ref SCIP_STAGE_SOLVING
32544  * - \ref SCIP_STAGE_SOLVED
32545  * - \ref SCIP_STAGE_EXITSOLVE
32546  */
32548  SCIP* scip, /**< SCIP data structure */
32549  FILE* file, /**< output file (or NULL for standard output) */
32550  SCIP_Bool printzeros /**< should variables set to zero be printed? */
32551  )
32552 {
32553  SCIP_SOL* sol;
32554 
32555  SCIP_CALL( checkStage(scip, "SCIPprintBestTransSol", TRUE, TRUE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE) );
32556 
32557  sol = SCIPgetBestSol(scip);
32558 
32559  if( sol != NULL && SCIPsolIsOriginal(sol) )
32560  {
32561  SCIPerrorMessage("best solution is defined in original space - cannot print it as transformed solution\n");
32562  return SCIP_INVALIDCALL;
32563  }
32564 
32565  if( sol == NULL )
32566  SCIPmessageFPrintInfo(scip->messagehdlr, file, "no solution available\n");
32567  else
32568  {
32569  SCIP_CALL( SCIPprintTransSol(scip, sol, file, printzeros) );
32570  }
32571 
32572  return SCIP_OKAY;
32573 }
32574 
32575 /** try to round given solution
32576  *
32577  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
32578  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
32579  *
32580  * @pre This method can be called if SCIP is in one of the following stages:
32581  * - \ref SCIP_STAGE_SOLVING
32582  */
32584  SCIP* scip, /**< SCIP data structure */
32585  SCIP_SOL* sol, /**< primal solution */
32586  SCIP_Bool* success /**< pointer to store whether rounding was successful */
32587  )
32588 {
32589  SCIP_CALL( checkStage(scip, "SCIProundSol", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) );
32590 
32591  if( SCIPsolIsOriginal(sol) )
32592  {
32593  SCIPerrorMessage("cannot round original space solution\n");
32594  return SCIP_INVALIDCALL;
32595  }
32596 
32597  SCIP_CALL( SCIPsolRound(sol, scip->set, scip->stat, scip->transprob, scip->tree, success) );
32598 
32599  return SCIP_OKAY;
32600 }
32601 
32602 /** retransforms solution to original problem space
32603  *
32604  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
32605  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
32606  *
32607  * @pre This method can be called if SCIP is in one of the following stages:
32608  * - \ref SCIP_STAGE_TRANSFORMED
32609  * - \ref SCIP_STAGE_INITPRESOLVE
32610  * - \ref SCIP_STAGE_PRESOLVING
32611  * - \ref SCIP_STAGE_EXITPRESOLVE
32612  * - \ref SCIP_STAGE_PRESOLVED
32613  * - \ref SCIP_STAGE_INITSOLVE
32614  * - \ref SCIP_STAGE_SOLVING
32615  * - \ref SCIP_STAGE_SOLVED
32616  * - \ref SCIP_STAGE_EXITSOLVE
32617  * - \ref SCIP_STAGE_FREETRANS
32618  */
32620  SCIP* scip, /**< SCIP data structure */
32621  SCIP_SOL* sol /**< primal CIP solution */
32622  )
32623 {
32624  SCIP_CALL( checkStage(scip, "SCIPretransformSol", FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE) );
32625 
32626  switch ( SCIPsolGetOrigin(sol) )
32627  {
32629  /* nothing to do */
32630  return SCIP_OKAY;
32631 
32632  case SCIP_SOLORIGIN_LPSOL:
32633  case SCIP_SOLORIGIN_NLPSOL:
32636 
32637  /* first unlink solution */
32638  SCIP_CALL( SCIPunlinkSol(scip, sol) );
32639 
32640  /*lint -fallthrough*/
32641  case SCIP_SOLORIGIN_ZERO:
32642  {
32643  SCIP_Bool hasinfval;
32644 
32645  SCIP_CALL( SCIPsolRetransform(sol, scip->set, scip->stat, scip->origprob, scip->transprob, &hasinfval) );
32646  break;
32647  }
32649  SCIPerrorMessage("unkown solution origin.\n");
32650  return SCIP_INVALIDCALL;
32651 
32652  default:
32653  /* note that this is in an internal SCIP error since all solution origins are covert in the switch above */
32654  SCIPerrorMessage("invalid solution origin <%d>\n", SCIPsolGetOrigin(sol));
32655  return SCIP_ERROR;
32656  }
32657 
32658  return SCIP_OKAY;
32659 }
32660 
32661 /** reads a given solution file, problem has to be transformed in advance
32662  *
32663  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
32664  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
32665  *
32666  * @pre This method can be called if SCIP is in one of the following stages:
32667  * - \ref SCIP_STAGE_PROBLEM
32668  * - \ref SCIP_STAGE_TRANSFORMED
32669  * - \ref SCIP_STAGE_INITPRESOLVE
32670  * - \ref SCIP_STAGE_PRESOLVING
32671  * - \ref SCIP_STAGE_EXITPRESOLVE
32672  * - \ref SCIP_STAGE_PRESOLVED
32673  * - \ref SCIP_STAGE_INITSOLVE
32674  * - \ref SCIP_STAGE_SOLVING
32675  */
32677  SCIP* scip, /**< SCIP data structure */
32678  const char* filename /**< name of the input file */
32679  )
32680 {
32681  SCIP_CALL( checkStage(scip, "SCIPreadSol", FALSE, TRUE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE) );
32682 
32683  /* we pass the reading of the solution file on to reader_sol via the following call */
32684  SCIP_CALL( SCIPreadProb(scip, filename, "sol") );
32685 
32686  return SCIP_OKAY;
32687 }
32688 
32689 /** adds feasible primal solution to solution storage by copying it
32690  *
32691  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
32692  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
32693  *
32694  * @pre This method can be called if SCIP is in one of the following stages:
32695  * - \ref SCIP_STAGE_PROBLEM
32696  * - \ref SCIP_STAGE_TRANSFORMED
32697  * - \ref SCIP_STAGE_INITPRESOLVE
32698  * - \ref SCIP_STAGE_PRESOLVING
32699  * - \ref SCIP_STAGE_EXITPRESOLVE
32700  * - \ref SCIP_STAGE_PRESOLVED
32701  * - \ref SCIP_STAGE_SOLVING
32702  * - \ref SCIP_STAGE_FREETRANS
32703  *
32704  * @note Do not call during propagation, use heur_trysol instead.
32705  */
32707  SCIP* scip, /**< SCIP data structure */
32708  SCIP_SOL* sol, /**< primal CIP solution */
32709  SCIP_Bool* stored /**< stores whether given solution was good enough to keep */
32710  )
32711 {
32712  SCIP_CALL( checkStage(scip, "SCIPaddSol", FALSE, TRUE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, TRUE, FALSE, FALSE, TRUE, FALSE) );
32713 
32714  switch( scip->set->stage )
32715  {
32716  case SCIP_STAGE_PROBLEM:
32717  case SCIP_STAGE_FREETRANS:
32718  assert(SCIPsolIsOriginal(sol));
32719  SCIP_CALL( SCIPprimalAddOrigSol(scip->origprimal, scip->mem->probmem, scip->set, scip->stat, scip->origprob, sol, stored) );
32720  return SCIP_OKAY;
32721 
32724  case SCIP_STAGE_PRESOLVING:
32726  /* if the solution is added during presolving and it is not defined on original variables,
32727  * presolving operations will destroy its validity, so we retransform it to the original space
32728  */
32729  if( !SCIPsolIsOriginal(sol) )
32730  {
32731  SCIP_Bool hasinfval;
32732 
32733  SCIP_CALL( SCIPsolUnlink(sol, scip->set, scip->transprob) );
32734  SCIP_CALL( SCIPsolRetransform(sol, scip->set, scip->stat, scip->origprob, scip->transprob, &hasinfval) );
32735  }
32736  /*lint -fallthrough*/
32737  case SCIP_STAGE_PRESOLVED:
32738  case SCIP_STAGE_SOLVING:
32739  {
32740  SCIP_SOL* bestsol = SCIPgetBestSol(scip);
32741 
32742  SCIP_CALL( SCIPprimalAddSol(scip->primal, scip->mem->probmem, scip->set, scip->messagehdlr, scip->stat, scip->origprob, scip->transprob, scip->tree,
32743  scip->lp, scip->eventqueue, scip->eventfilter, sol, stored) );
32744 
32745 
32746  if( *stored && (bestsol != SCIPgetBestSol(scip)) )
32747  {
32748  SCIPstoreSolutionGap(scip);
32749  }
32750 
32751  return SCIP_OKAY;
32752  }
32754  case SCIP_STAGE_INITSOLVE:
32755  case SCIP_STAGE_SOLVED:
32756  case SCIP_STAGE_EXITSOLVE:
32757  default:
32758  SCIPerrorMessage("invalid SCIP stage <%d>\n", scip->set->stage);
32759  return SCIP_INVALIDCALL;
32760  } /*lint !e788*/
32761 }
32762 
32763 /** adds primal solution to solution storage, frees the solution afterwards
32764  *
32765  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
32766  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
32767  *
32768  * @pre This method can be called if SCIP is in one of the following stages:
32769  * - \ref SCIP_STAGE_PROBLEM
32770  * - \ref SCIP_STAGE_TRANSFORMED
32771  * - \ref SCIP_STAGE_INITPRESOLVE
32772  * - \ref SCIP_STAGE_PRESOLVING
32773  * - \ref SCIP_STAGE_EXITPRESOLVE
32774  * - \ref SCIP_STAGE_PRESOLVED
32775  * - \ref SCIP_STAGE_SOLVING
32776  * - \ref SCIP_STAGE_FREETRANS
32777  *
32778  * @note Do not call during propagation, use heur_trysol instead.
32779  */
32781  SCIP* scip, /**< SCIP data structure */
32782  SCIP_SOL** sol, /**< pointer to primal CIP solution; is cleared in function call */
32783  SCIP_Bool* stored /**< stores whether given solution was good enough to keep */
32784  )
32785 {
32786  SCIP_CALL( checkStage(scip, "SCIPaddSolFree", FALSE, TRUE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, TRUE, FALSE, FALSE, TRUE, FALSE) );
32787 
32788  switch( scip->set->stage )
32789  {
32790  case SCIP_STAGE_PROBLEM:
32791  case SCIP_STAGE_FREETRANS:
32792  assert(SCIPsolIsOriginal(*sol));
32793  SCIP_CALL( SCIPprimalAddOrigSolFree(scip->origprimal, scip->mem->probmem, scip->set, scip->stat, scip->origprob, sol, stored) );
32794  return SCIP_OKAY;
32795 
32798  case SCIP_STAGE_PRESOLVING:
32800  /* if the solution is added during presolving and it is not defined on original variables,
32801  * presolving operations will destroy its validity, so we retransform it to the original space
32802  */
32803  if( !SCIPsolIsOriginal(*sol) )
32804  {
32805  SCIP_Bool hasinfval;
32806 
32807  SCIP_CALL( SCIPsolUnlink(*sol, scip->set, scip->transprob) );
32808  SCIP_CALL( SCIPsolRetransform(*sol, scip->set, scip->stat, scip->origprob, scip->transprob, &hasinfval) );
32809  }
32810  /*lint -fallthrough*/
32811  case SCIP_STAGE_PRESOLVED:
32812  case SCIP_STAGE_SOLVING:
32813  {
32814  SCIP_SOL* bestsol = SCIPgetBestSol(scip);
32815 
32816  SCIP_CALL( SCIPprimalAddSolFree(scip->primal, scip->mem->probmem, scip->set, scip->messagehdlr, scip->stat, scip->origprob, scip->transprob, scip->tree,
32817  scip->lp, scip->eventqueue, scip->eventfilter, sol, stored) );
32818 
32819  if( *stored )
32820  {
32821  if( bestsol != SCIPgetBestSol(scip) )
32822  {
32823  assert(SCIPgetBestSol(scip) != NULL);
32824  SCIPstoreSolutionGap(scip);
32825  }
32826  }
32827 
32828  return SCIP_OKAY;
32829  }
32831  case SCIP_STAGE_INITSOLVE:
32832  case SCIP_STAGE_SOLVED:
32833  case SCIP_STAGE_EXITSOLVE:
32834  default:
32835  SCIPerrorMessage("invalid SCIP stage <%d>\n", scip->set->stage);
32836  return SCIP_INVALIDCALL;
32837  } /*lint !e788*/
32838 }
32839 
32840 /** adds current LP/pseudo solution to solution storage
32841  *
32842  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
32843  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
32844  *
32845  * @pre This method can be called if SCIP is in one of the following stages:
32846  * - \ref SCIP_STAGE_PRESOLVED
32847  * - \ref SCIP_STAGE_SOLVING
32848  */
32850  SCIP* scip, /**< SCIP data structure */
32851  SCIP_HEUR* heur, /**< heuristic that found the solution */
32852  SCIP_Bool* stored /**< stores whether given solution was good enough to keep */
32853  )
32854 {
32855  SCIP_SOL* bestsol;
32856 
32857  SCIP_CALL( checkStage(scip, "SCIPaddCurrentSol", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) );
32858 
32859  bestsol = SCIPgetBestSol(scip);
32860 
32861  SCIP_CALL( SCIPprimalAddCurrentSol(scip->primal, scip->mem->probmem, scip->set, scip->messagehdlr, scip->stat, scip->origprob, scip->transprob,
32862  scip->tree, scip->lp, scip->eventqueue, scip->eventfilter, heur, stored) );
32863 
32864  if( *stored )
32865  {
32866  if( bestsol != SCIPgetBestSol(scip) )
32867  SCIPstoreSolutionGap(scip);
32868  }
32869 
32870  return SCIP_OKAY;
32871 }
32872 
32873 /** checks solution for feasibility; if possible, adds it to storage by copying
32874  *
32875  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
32876  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
32877  *
32878  * @pre This method can be called if SCIP is in one of the following stages:
32879  * - \ref SCIP_STAGE_TRANSFORMED
32880  * - \ref SCIP_STAGE_INITPRESOLVE
32881  * - \ref SCIP_STAGE_PRESOLVING
32882  * - \ref SCIP_STAGE_EXITPRESOLVE
32883  * - \ref SCIP_STAGE_PRESOLVED
32884  * - \ref SCIP_STAGE_SOLVING
32885  *
32886  * @note Do not call during propagation, use heur_trysol instead.
32887  */
32889  SCIP* scip, /**< SCIP data structure */
32890  SCIP_SOL* sol, /**< primal CIP solution */
32891  SCIP_Bool printreason, /**< should all reasons of violation be printed? */
32892  SCIP_Bool checkbounds, /**< should the bounds of the variables be checked? */
32893  SCIP_Bool checkintegrality, /**< has integrality to be checked? */
32894  SCIP_Bool checklprows, /**< have current LP rows (both local and global) to be checked? */
32895  SCIP_Bool* stored /**< stores whether given solution was feasible and good enough to keep */
32896  )
32897 {
32898  SCIP_SOL* bestsol;
32899 
32900  assert(stored != NULL);
32901 
32902  SCIP_CALL( checkStage(scip, "SCIPtrySol", FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) );
32903 
32904  bestsol = SCIPgetBestSol(scip);
32905 
32906  /* if the solution is added during presolving and it is not defined on original variables,
32907  * presolving operations will destroy its validity, so we retransform it to the original space
32908  */
32909  if( scip->set->stage == SCIP_STAGE_PRESOLVING && !SCIPsolIsOriginal(sol) )
32910  {
32911  SCIP_Bool hasinfval;
32912 
32913  SCIP_CALL( SCIPsolUnlink(sol, scip->set, scip->transprob) );
32914  SCIP_CALL( SCIPsolRetransform(sol, scip->set, scip->stat, scip->origprob, scip->transprob, &hasinfval) );
32915  }
32916 
32917  if( SCIPsolIsOriginal(sol) )
32918  {
32919  SCIP_Bool feasible;
32920 
32921  /* SCIPprimalTrySol() can only be called on transformed solutions; therefore check solutions in original problem
32922  * including modifiable constraints */
32923  SCIP_CALL( checkSolOrig(scip, sol, &feasible, printreason, FALSE, checkbounds, checkintegrality, checklprows, TRUE) );
32924  if( feasible )
32925  {
32926  SCIP_CALL( SCIPprimalAddSol(scip->primal, scip->mem->probmem, scip->set, scip->messagehdlr, scip->stat, scip->origprob, scip->transprob,
32927  scip->tree, scip->lp, scip->eventqueue, scip->eventfilter, sol, stored) );
32928 
32929  if( *stored )
32930  {
32931  if( bestsol != SCIPgetBestSol(scip) )
32932  SCIPstoreSolutionGap(scip);
32933  }
32934  }
32935  else
32936  *stored = FALSE;
32937  }
32938  else
32939  {
32940  SCIP_CALL( SCIPprimalTrySol(scip->primal, scip->mem->probmem, scip->set, scip->messagehdlr, scip->stat, scip->origprob, scip->transprob, scip->tree,
32941  scip->lp, scip->eventqueue, scip->eventfilter, sol, printreason, checkbounds, checkintegrality, checklprows, stored) );
32942 
32943  if( *stored )
32944  {
32945  if( bestsol != SCIPgetBestSol(scip) )
32946  SCIPstoreSolutionGap(scip);
32947  }
32948  }
32949 
32950  return SCIP_OKAY;
32951 }
32952 
32953 /** checks primal solution; if feasible, adds it to storage; solution is freed afterwards
32954  *
32955  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
32956  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
32957  *
32958  * @pre This method can be called if SCIP is in one of the following stages:
32959  * - \ref SCIP_STAGE_TRANSFORMED
32960  * - \ref SCIP_STAGE_INITPRESOLVE
32961  * - \ref SCIP_STAGE_PRESOLVING
32962  * - \ref SCIP_STAGE_EXITPRESOLVE
32963  * - \ref SCIP_STAGE_PRESOLVED
32964  * - \ref SCIP_STAGE_SOLVING
32965  *
32966  * @note Do not call during propagation, use heur_trysol instead.
32967  */
32969  SCIP* scip, /**< SCIP data structure */
32970  SCIP_SOL** sol, /**< pointer to primal CIP solution; is cleared in function call */
32971  SCIP_Bool printreason, /**< should all reasons of violations be printed */
32972  SCIP_Bool checkbounds, /**< should the bounds of the variables be checked? */
32973  SCIP_Bool checkintegrality, /**< has integrality to be checked? */
32974  SCIP_Bool checklprows, /**< have current LP rows (both local and global) to be checked? */
32975  SCIP_Bool* stored /**< stores whether solution was feasible and good enough to keep */
32976  )
32977 {
32978  SCIP_SOL* bestsol;
32979 
32980  assert(stored != NULL);
32981  assert(sol != NULL);
32982 
32983  SCIP_CALL( checkStage(scip, "SCIPtrySolFree", FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) );
32984 
32985  bestsol = SCIPgetBestSol(scip);
32986 
32987  /* if the solution is added during presolving and it is not defined on original variables,
32988  * presolving operations will destroy its validity, so we retransform it to the original space
32989  */
32990  if( scip->set->stage == SCIP_STAGE_PRESOLVING && !SCIPsolIsOriginal(*sol) )
32991  {
32992  SCIP_Bool hasinfval;
32993 
32994  SCIP_CALL( SCIPsolUnlink(*sol, scip->set, scip->transprob) );
32995  SCIP_CALL( SCIPsolRetransform(*sol, scip->set, scip->stat, scip->origprob, scip->transprob, &hasinfval) );
32996  }
32997 
32998  if( SCIPsolIsOriginal(*sol) )
32999  {
33000  SCIP_Bool feasible;
33001 
33002  /* SCIPprimalTrySol() can only be called on transformed solutions; therefore check solutions in original problem
33003  * including modifiable constraints
33004  */
33005  SCIP_CALL( checkSolOrig(scip, *sol, &feasible, printreason, FALSE, checkbounds, checkintegrality, checklprows, TRUE) );
33006 
33007  if( feasible )
33008  {
33009  SCIP_CALL( SCIPprimalAddSolFree(scip->primal, scip->mem->probmem, scip->set, scip->messagehdlr, scip->stat, scip->origprob, scip->transprob,
33010  scip->tree, scip->lp, scip->eventqueue, scip->eventfilter, sol, stored) );
33011 
33012  if( *stored )
33013  {
33014  if( bestsol != SCIPgetBestSol(scip) )
33015  SCIPstoreSolutionGap(scip);
33016  }
33017  }
33018  else
33019  {
33020  SCIP_CALL( SCIPsolFree(sol, scip->mem->probmem, scip->primal) );
33021  *stored = FALSE;
33022  }
33023  }
33024  else
33025  {
33026  SCIP_CALL( SCIPprimalTrySolFree(scip->primal, scip->mem->probmem, scip->set, scip->messagehdlr, scip->stat, scip->origprob, scip->transprob,
33027  scip->tree, scip->lp, scip->eventqueue, scip->eventfilter, sol, printreason, checkbounds, checkintegrality, checklprows, stored) );
33028 
33029  if( *stored )
33030  {
33031  if( bestsol != SCIPgetBestSol(scip) )
33032  SCIPstoreSolutionGap(scip);
33033  }
33034  }
33035 
33036  return SCIP_OKAY;
33037 }
33038 
33039 /** checks current LP/pseudo solution for feasibility; if possible, adds it to storage
33040  *
33041  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
33042  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
33043  *
33044  * @pre This method can be called if SCIP is in one of the following stages:
33045  * - \ref SCIP_STAGE_PRESOLVED
33046  * - \ref SCIP_STAGE_SOLVING
33047  */
33049  SCIP* scip, /**< SCIP data structure */
33050  SCIP_HEUR* heur, /**< heuristic that found the solution */
33051  SCIP_Bool printreason, /**< should all reasons of violations be printed */
33052  SCIP_Bool checkintegrality, /**< has integrality to be checked? */
33053  SCIP_Bool checklprows, /**< have current LP rows (both local and global) to be checked? */
33054  SCIP_Bool* stored /**< stores whether given solution was feasible and good enough to keep */
33055  )
33056 {
33057  SCIP_SOL* bestsol;
33058 
33059  SCIP_CALL( checkStage(scip, "SCIPtryCurrentSol", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) );
33060 
33061  bestsol = SCIPgetBestSol(scip);
33062 
33063  SCIP_CALL( SCIPprimalTryCurrentSol(scip->primal, scip->mem->probmem, scip->set, scip->messagehdlr, scip->stat, scip->origprob, scip->transprob,
33064  scip->tree, scip->lp, scip->eventqueue, scip->eventfilter, heur, printreason, checkintegrality, checklprows, stored) );
33065 
33066  if( *stored )
33067  {
33068  if( bestsol != SCIPgetBestSol(scip) )
33069  SCIPstoreSolutionGap(scip);
33070  }
33071 
33072  return SCIP_OKAY;
33073 }
33074 
33075 /** checks solution for feasibility without adding it to the solution store
33076  *
33077  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
33078  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
33079  *
33080  * @pre This method can be called if SCIP is in one of the following stages:
33081  * - \ref SCIP_STAGE_PROBLEM
33082  * - \ref SCIP_STAGE_TRANSFORMED
33083  * - \ref SCIP_STAGE_INITPRESOLVE
33084  * - \ref SCIP_STAGE_PRESOLVING
33085  * - \ref SCIP_STAGE_EXITPRESOLVE
33086  * - \ref SCIP_STAGE_PRESOLVED
33087  * - \ref SCIP_STAGE_INITSOLVE
33088  * - \ref SCIP_STAGE_SOLVING
33089  * - \ref SCIP_STAGE_SOLVED
33090  */
33092  SCIP* scip, /**< SCIP data structure */
33093  SCIP_SOL* sol, /**< primal CIP solution */
33094  SCIP_Bool printreason, /**< should all reasons of violations be printed? */
33095  SCIP_Bool checkbounds, /**< should the bounds of the variables be checked? */
33096  SCIP_Bool checkintegrality, /**< has integrality to be checked? */
33097  SCIP_Bool checklprows, /**< have current LP rows (both local and global) to be checked? */
33098  SCIP_Bool* feasible /**< stores whether given solution is feasible */
33099  )
33100 {
33101  SCIP_CALL( checkStage(scip, "SCIPcheckSol", FALSE, TRUE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE) );
33102 
33103  /* if we want to solve exactly, the constraint handlers cannot rely on the LP's feasibility */
33104  checklprows = checklprows || scip->set->misc_exactsolve;
33105 
33106  if( SCIPsolIsOriginal(sol) )
33107  {
33108  /* SCIPsolCheck() can only be called on transformed solutions */
33109  SCIP_CALL( checkSolOrig(scip, sol, feasible, printreason, FALSE, checkbounds, checkintegrality, checklprows, FALSE) );
33110  }
33111  else
33112  {
33113  SCIP_CALL( SCIPsolCheck(sol, scip->set, scip->messagehdlr, scip->mem->probmem, scip->stat, scip->transprob, printreason,
33114  checkbounds, checkintegrality, checklprows, feasible) );
33115  }
33116 
33117  return SCIP_OKAY;
33118 }
33119 
33120 /** checks solution for feasibility in original problem without adding it to the solution store;
33121  * this method is used to double check a solution in order to validate the presolving process
33122  *
33123  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
33124  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
33125  *
33126  * @pre This method can be called if SCIP is in one of the following stages:
33127  * - \ref SCIP_STAGE_PROBLEM
33128  * - \ref SCIP_STAGE_TRANSFORMED
33129  * - \ref SCIP_STAGE_INITPRESOLVE
33130  * - \ref SCIP_STAGE_PRESOLVING
33131  * - \ref SCIP_STAGE_EXITPRESOLVE
33132  * - \ref SCIP_STAGE_PRESOLVED
33133  * - \ref SCIP_STAGE_INITSOLVE
33134  * - \ref SCIP_STAGE_SOLVING
33135  * - \ref SCIP_STAGE_SOLVED
33136  */
33138  SCIP* scip, /**< SCIP data structure */
33139  SCIP_SOL* sol, /**< primal CIP solution */
33140  SCIP_Bool* feasible, /**< stores whether given solution is feasible */
33141  SCIP_Bool printreason, /**< should the reason for the violation be printed? */
33142  SCIP_Bool completely /**< should all violation be checked? */
33143  )
33144 {
33145  assert(scip != NULL);
33146  assert(sol != NULL);
33147  assert(feasible != NULL);
33148 
33149  SCIP_CALL( checkStage(scip, "SCIPcheckSolOrig", FALSE, TRUE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE) );
33150 
33151  /* check solution in original problem; that includes bounds, integrality, and non modifiable constraints */
33152  SCIP_CALL( checkSolOrig(scip, sol, feasible, printreason, completely, TRUE, TRUE, TRUE, FALSE) );
33153 
33154  return SCIP_OKAY;
33155 }
33156 
33157 /** return whether a primal ray is stored that proves unboundedness of the LP relaxation
33158  *
33159  * @return return whether a primal ray is stored that proves unboundedness of the LP relaxation
33160  *
33161  * @pre This method can be called if SCIP is in one of the following stages:
33162  * - \ref SCIP_STAGE_SOLVING
33163  * - \ref SCIP_STAGE_SOLVED
33164  */
33166  SCIP* scip /**< SCIP data structure */
33167  )
33168 {
33169  SCIP_CALL_ABORT( checkStage(scip, "SCIPhasPrimalRay", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE) );
33170 
33171  return scip->primal->primalray != NULL;
33172 }
33173 
33174 /** gets value of given variable in primal ray causing unboundedness of the LP relaxation;
33175  * should only be called if such a ray is stored (check with SCIPhasPrimalRay())
33176  *
33177  * @return value of given variable in primal ray causing unboundedness of the LP relaxation
33178  *
33179  * @pre This method can be called if SCIP is in one of the following stages:
33180  * - \ref SCIP_STAGE_SOLVING
33181  * - \ref SCIP_STAGE_SOLVED
33182  */
33184  SCIP* scip, /**< SCIP data structure */
33185  SCIP_VAR* var /**< variable to get value for */
33186  )
33187 {
33188  SCIP_CALL_ABORT( checkStage(scip, "SCIPgetPrimalRayVal", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE) );
33189 
33190  assert(var != NULL);
33191  assert(scip->primal->primalray != NULL);
33192 
33193  return SCIPsolGetRayVal(scip->primal->primalray, scip->set, scip->stat, var);
33194 }
33195 
33196 
33197 
33198 /*
33199  * event methods
33200  */
33201 
33202 /** catches a global (not variable or row dependent) event
33203  *
33204  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
33205  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
33206  *
33207  * @pre This method can be called if @p scip is in one of the following stages:
33208  * - \ref SCIP_STAGE_TRANSFORMING
33209  * - \ref SCIP_STAGE_TRANSFORMED
33210  * - \ref SCIP_STAGE_INITPRESOLVE
33211  * - \ref SCIP_STAGE_PRESOLVING
33212  * - \ref SCIP_STAGE_EXITPRESOLVE
33213  * - \ref SCIP_STAGE_PRESOLVED
33214  * - \ref SCIP_STAGE_INITSOLVE
33215  * - \ref SCIP_STAGE_SOLVING
33216  * - \ref SCIP_STAGE_SOLVED
33217  * - \ref SCIP_STAGE_EXITSOLVE
33218  * - \ref SCIP_STAGE_FREETRANS
33219  */
33221  SCIP* scip, /**< SCIP data structure */
33222  SCIP_EVENTTYPE eventtype, /**< event type mask to select events to catch */
33223  SCIP_EVENTHDLR* eventhdlr, /**< event handler to process events with */
33224  SCIP_EVENTDATA* eventdata, /**< event data to pass to the event handler when processing this event */
33225  int* filterpos /**< pointer to store position of event filter entry, or NULL */
33226  )
33227 {
33228  SCIP_CALL( checkStage(scip, "SCIPcatchEvent", FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE) );
33229 
33230  SCIP_CALL( SCIPeventfilterAdd(scip->eventfilter, scip->mem->probmem, scip->set,
33231  eventtype, eventhdlr, eventdata, filterpos) );
33232 
33233  return SCIP_OKAY;
33234 }
33235 
33236 /** drops a global event (stops to track event)
33237  *
33238  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
33239  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
33240  *
33241  * @pre This method can be called if @p scip is in one of the following stages:
33242  * - \ref SCIP_STAGE_TRANSFORMING
33243  * - \ref SCIP_STAGE_TRANSFORMED
33244  * - \ref SCIP_STAGE_INITPRESOLVE
33245  * - \ref SCIP_STAGE_PRESOLVING
33246  * - \ref SCIP_STAGE_EXITPRESOLVE
33247  * - \ref SCIP_STAGE_PRESOLVED
33248  * - \ref SCIP_STAGE_INITSOLVE
33249  * - \ref SCIP_STAGE_SOLVING
33250  * - \ref SCIP_STAGE_SOLVED
33251  * - \ref SCIP_STAGE_EXITSOLVE
33252  * - \ref SCIP_STAGE_FREETRANS
33253  */
33255  SCIP* scip, /**< SCIP data structure */
33256  SCIP_EVENTTYPE eventtype, /**< event type mask of dropped event */
33257  SCIP_EVENTHDLR* eventhdlr, /**< event handler to process events with */
33258  SCIP_EVENTDATA* eventdata, /**< event data to pass to the event handler when processing this event */
33259  int filterpos /**< position of event filter entry returned by SCIPcatchEvent(), or -1 */
33260  )
33261 {
33262  SCIP_CALL( checkStage(scip, "SCIPdropEvent", FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE) );
33263 
33264  SCIP_CALL( SCIPeventfilterDel(scip->eventfilter, scip->mem->probmem, scip->set,
33265  eventtype, eventhdlr, eventdata, filterpos) );
33266 
33267  return SCIP_OKAY;
33268 }
33269 
33270 /** catches an objective value or domain change event on the given transformed variable
33271  *
33272  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
33273  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
33274  *
33275  * @pre This method can be called if @p scip is in one of the following stages:
33276  * - \ref SCIP_STAGE_TRANSFORMING
33277  * - \ref SCIP_STAGE_TRANSFORMED
33278  * - \ref SCIP_STAGE_INITPRESOLVE
33279  * - \ref SCIP_STAGE_PRESOLVING
33280  * - \ref SCIP_STAGE_EXITPRESOLVE
33281  * - \ref SCIP_STAGE_PRESOLVED
33282  * - \ref SCIP_STAGE_INITSOLVE
33283  * - \ref SCIP_STAGE_SOLVING
33284  * - \ref SCIP_STAGE_SOLVED
33285  * - \ref SCIP_STAGE_EXITSOLVE
33286  * - \ref SCIP_STAGE_FREETRANS
33287  */
33289  SCIP* scip, /**< SCIP data structure */
33290  SCIP_VAR* var, /**< transformed variable to catch event for */
33291  SCIP_EVENTTYPE eventtype, /**< event type mask to select events to catch */
33292  SCIP_EVENTHDLR* eventhdlr, /**< event handler to process events with */
33293  SCIP_EVENTDATA* eventdata, /**< event data to pass to the event handler when processing this event */
33294  int* filterpos /**< pointer to store position of event filter entry, or NULL */
33295  )
33296 {
33297  SCIP_CALL( checkStage(scip, "SCIPcatchVarEvent", FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE) );
33298 
33299  if( (eventtype & SCIP_EVENTTYPE_VARCHANGED) == 0 )
33300  {
33301  SCIPerrorMessage("event does not operate on a single variable\n");
33302  return SCIP_INVALIDDATA;
33303  }
33304 
33305  if( SCIPvarIsOriginal(var) )
33306  {
33307  SCIPerrorMessage("cannot catch events on original variable <%s>\n", SCIPvarGetName(var));
33308  return SCIP_INVALIDDATA;
33309  }
33310 
33311  SCIP_CALL( SCIPvarCatchEvent(var, scip->mem->probmem, scip->set, eventtype, eventhdlr, eventdata, filterpos) );
33312 
33313  return SCIP_OKAY;
33314 }
33315 
33316 /** drops an objective value or domain change event (stops to track event) on the given transformed variable
33317  *
33318  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
33319  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
33320  *
33321  * @pre This method can be called if @p scip is in one of the following stages:
33322  * - \ref SCIP_STAGE_TRANSFORMING
33323  * - \ref SCIP_STAGE_TRANSFORMED
33324  * - \ref SCIP_STAGE_INITPRESOLVE
33325  * - \ref SCIP_STAGE_PRESOLVING
33326  * - \ref SCIP_STAGE_EXITPRESOLVE
33327  * - \ref SCIP_STAGE_PRESOLVED
33328  * - \ref SCIP_STAGE_INITSOLVE
33329  * - \ref SCIP_STAGE_SOLVING
33330  * - \ref SCIP_STAGE_SOLVED
33331  * - \ref SCIP_STAGE_EXITSOLVE
33332  * - \ref SCIP_STAGE_FREETRANS
33333  */
33335  SCIP* scip, /**< SCIP data structure */
33336  SCIP_VAR* var, /**< transformed variable to drop event for */
33337  SCIP_EVENTTYPE eventtype, /**< event type mask of dropped event */
33338  SCIP_EVENTHDLR* eventhdlr, /**< event handler to process events with */
33339  SCIP_EVENTDATA* eventdata, /**< event data to pass to the event handler when processing this event */
33340  int filterpos /**< position of event filter entry returned by SCIPcatchVarEvent(), or -1 */
33341  )
33342 {
33343  SCIP_CALL( checkStage(scip, "SCIPdropVarEvent", FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE) );
33344 
33345  if( SCIPvarIsOriginal(var) )
33346  {
33347  SCIPerrorMessage("cannot drop events on original variable <%s>\n", SCIPvarGetName(var));
33348  return SCIP_INVALIDDATA;
33349  }
33350 
33351  SCIP_CALL( SCIPvarDropEvent(var, scip->mem->probmem, scip->set, eventtype, eventhdlr, eventdata, filterpos) );
33352 
33353  return SCIP_OKAY;
33354 }
33355 
33356 /** catches a row coefficient, constant, or side change event on the given row
33357  *
33358  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
33359  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
33360  *
33361  * @pre This method can be called if @p scip is in one of the following stages:
33362  * - \ref SCIP_STAGE_TRANSFORMING
33363  * - \ref SCIP_STAGE_TRANSFORMED
33364  * - \ref SCIP_STAGE_INITPRESOLVE
33365  * - \ref SCIP_STAGE_PRESOLVING
33366  * - \ref SCIP_STAGE_EXITPRESOLVE
33367  * - \ref SCIP_STAGE_PRESOLVED
33368  * - \ref SCIP_STAGE_INITSOLVE
33369  * - \ref SCIP_STAGE_SOLVING
33370  * - \ref SCIP_STAGE_SOLVED
33371  * - \ref SCIP_STAGE_EXITSOLVE
33372  * - \ref SCIP_STAGE_FREETRANS
33373  */
33375  SCIP* scip, /**< SCIP data structure */
33376  SCIP_ROW* row, /**< linear row to catch event for */
33377  SCIP_EVENTTYPE eventtype, /**< event type mask to select events to catch */
33378  SCIP_EVENTHDLR* eventhdlr, /**< event handler to process events with */
33379  SCIP_EVENTDATA* eventdata, /**< event data to pass to the event handler when processing this event */
33380  int* filterpos /**< pointer to store position of event filter entry, or NULL */
33381  )
33382 {
33383  SCIP_CALL( checkStage(scip, "SCIPcatchRowEvent", FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE) );
33384 
33385  if( (eventtype & SCIP_EVENTTYPE_ROWCHANGED) == 0 )
33386  {
33387  SCIPerrorMessage("event does not operate on a single row\n");
33388  return SCIP_INVALIDDATA;
33389  }
33390 
33391  SCIP_CALL( SCIProwCatchEvent(row, scip->mem->probmem, scip->set, eventtype, eventhdlr, eventdata, filterpos) );
33392 
33393  return SCIP_OKAY;
33394 }
33395 
33396 /** drops a row coefficient, constant, or side change event (stops to track event) on the given row
33397  *
33398  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
33399  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
33400  *
33401  * @pre This method can be called if @p scip is in one of the following stages:
33402  * - \ref SCIP_STAGE_TRANSFORMING
33403  * - \ref SCIP_STAGE_TRANSFORMED
33404  * - \ref SCIP_STAGE_INITPRESOLVE
33405  * - \ref SCIP_STAGE_PRESOLVING
33406  * - \ref SCIP_STAGE_EXITPRESOLVE
33407  * - \ref SCIP_STAGE_PRESOLVED
33408  * - \ref SCIP_STAGE_INITSOLVE
33409  * - \ref SCIP_STAGE_SOLVING
33410  * - \ref SCIP_STAGE_SOLVED
33411  * - \ref SCIP_STAGE_EXITSOLVE
33412  * - \ref SCIP_STAGE_FREETRANS
33413  */
33415  SCIP* scip, /**< SCIP data structure */
33416  SCIP_ROW* row, /**< linear row to drop event for */
33417  SCIP_EVENTTYPE eventtype, /**< event type mask of dropped event */
33418  SCIP_EVENTHDLR* eventhdlr, /**< event handler to process events with */
33419  SCIP_EVENTDATA* eventdata, /**< event data to pass to the event handler when processing this event */
33420  int filterpos /**< position of event filter entry returned by SCIPcatchVarEvent(), or -1 */
33421  )
33422 {
33423  SCIP_CALL( checkStage(scip, "SCIPdropRowEvent", FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE) );
33424 
33425  SCIP_CALL( SCIProwDropEvent(row, scip->mem->probmem, scip->set, eventtype, eventhdlr, eventdata, filterpos) );
33426 
33427  return SCIP_OKAY;
33428 }
33429 
33430 
33431 /*
33432  * tree methods
33433  */
33434 
33435 /** gets current node in the tree
33436  *
33437  * @return the current node of the search tree
33438  *
33439  * @pre This method can be called if @p scip is in one of the following stages:
33440  * - \ref SCIP_STAGE_INITPRESOLVE
33441  * - \ref SCIP_STAGE_PRESOLVING
33442  * - \ref SCIP_STAGE_EXITPRESOLVE
33443  * - \ref SCIP_STAGE_SOLVING
33444  */
33446  SCIP* scip /**< SCIP data structure */
33447  )
33448 {
33449  SCIP_CALL_ABORT( checkStage(scip, "SCIPgetCurrentNode", FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) );
33450 
33451  return SCIPtreeGetCurrentNode(scip->tree);
33452 }
33453 
33454 /** gets the root node of the tree
33455  *
33456  * @return the root node of the search tree
33457  *
33458  * @pre This method can be called if @p scip is in one of the following stages:
33459  * - \ref SCIP_STAGE_INITPRESOLVE
33460  * - \ref SCIP_STAGE_PRESOLVING
33461  * - \ref SCIP_STAGE_EXITPRESOLVE
33462  * - \ref SCIP_STAGE_SOLVING
33463  */
33465  SCIP* scip /**< SCIP data structure */
33466  )
33467 {
33468  SCIP_CALL_ABORT( checkStage(scip, "SCIPgetRootNode", FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) );
33469 
33470  return SCIPtreeGetRootNode(scip->tree);
33471 }
33472 
33473 /** returns whether the current node is already solved and only propagated again
33474  *
33475  * @return TRUE is returned if \SCIP performance repropagation, otherwise FALSE.
33476  *
33477  * @pre This method can be called if @p scip is in one of the following stages:
33478  * - \ref SCIP_STAGE_INITPRESOLVE
33479  * - \ref SCIP_STAGE_PRESOLVING
33480  * - \ref SCIP_STAGE_EXITPRESOLVE
33481  * - \ref SCIP_STAGE_SOLVING
33482  */
33484  SCIP* scip /**< SCIP data structure */
33485  )
33486 {
33487  SCIP_CALL_ABORT( checkStage(scip, "SCIPinRepropagation", FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) );
33488 
33489  return SCIPtreeInRepropagation(scip->tree);
33490 }
33491 
33492 /** gets children of focus node along with the number of children
33493  *
33494  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
33495  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
33496  *
33497  * @pre This method can be called if @p scip is in one of the following stages:
33498  * - \ref SCIP_STAGE_SOLVING
33499  */
33501  SCIP* scip, /**< SCIP data structure */
33502  SCIP_NODE*** children, /**< pointer to store children array, or NULL if not needed */
33503  int* nchildren /**< pointer to store number of children, or NULL if not needed */
33504  )
33505 {
33506  SCIP_CALL( checkStage(scip, "SCIPgetChildren", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) );
33507 
33508  if( children != NULL )
33509  *children = scip->tree->children;
33510  if( nchildren != NULL )
33511  *nchildren = scip->tree->nchildren;
33512 
33513  return SCIP_OKAY;
33514 }
33515 
33516 /** gets number of children of focus node
33517  *
33518  * @return number of children of the focus node
33519  *
33520  * @pre This method can be called if @p scip is in one of the following stages:
33521  * - \ref SCIP_STAGE_SOLVING
33522  */
33524  SCIP* scip /**< SCIP data structure */
33525  )
33526 {
33527  SCIP_CALL_ABORT( checkStage(scip, "SCIPgetNChildren", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) );
33528 
33529  return scip->tree->nchildren;
33530 }
33531 
33532 /** gets siblings of focus node along with the number of siblings
33533  *
33534  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
33535  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
33536  *
33537  * @pre This method can be called if @p scip is in one of the following stages:
33538  * - \ref SCIP_STAGE_SOLVING
33539  */
33541  SCIP* scip, /**< SCIP data structure */
33542  SCIP_NODE*** siblings, /**< pointer to store siblings array, or NULL if not needed */
33543  int* nsiblings /**< pointer to store number of siblings, or NULL if not needed */
33544  )
33545 {
33546  SCIP_CALL( checkStage(scip, "SCIPgetSiblings", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) );
33547 
33548  if( siblings != NULL )
33549  *siblings = scip->tree->siblings;
33550  if( nsiblings != NULL )
33551  *nsiblings = scip->tree->nsiblings;
33552 
33553  return SCIP_OKAY;
33554 }
33555 
33556 /** gets number of siblings of focus node
33557  *
33558  * @return the number of siblings of focus node
33559  *
33560  * @pre This method can be called if @p scip is in one of the following stages:
33561  * - \ref SCIP_STAGE_SOLVING
33562  */
33564  SCIP* scip /**< SCIP data structure */
33565  )
33566 {
33567  SCIP_CALL_ABORT( checkStage(scip, "SCIPgetNSiblings", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) );
33568 
33569  return scip->tree->nsiblings;
33570 }
33571 
33572 /** gets leaves of the tree along with the number of leaves
33573  *
33574  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
33575  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
33576  *
33577  * @pre This method can be called if @p scip is in one of the following stages:
33578  * - \ref SCIP_STAGE_SOLVING
33579  */
33581  SCIP* scip, /**< SCIP data structure */
33582  SCIP_NODE*** leaves, /**< pointer to store leaves array, or NULL if not needed */
33583  int* nleaves /**< pointer to store number of leaves, or NULL if not needed */
33584  )
33585 {
33586  SCIP_CALL( checkStage(scip, "SCIPgetLeaves", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) );
33587 
33588  if( leaves != NULL )
33589  *leaves = SCIPnodepqNodes(scip->tree->leaves);
33590  if( nleaves != NULL )
33591  *nleaves = SCIPnodepqLen(scip->tree->leaves);
33592 
33593  return SCIP_OKAY;
33594 }
33595 
33596 /** gets number of leaves in the tree
33597  *
33598  * @return the number of leaves in the tree
33599  *
33600  * @pre This method can be called if @p scip is in one of the following stages:
33601  * - \ref SCIP_STAGE_SOLVING
33602  */
33604  SCIP* scip /**< SCIP data structure */
33605  )
33606 {
33607  SCIP_CALL_ABORT( checkStage(scip, "SCIPgetNLeaves", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) );
33608 
33609  return SCIPnodepqLen(scip->tree->leaves);
33610 }
33611 
33612 /** gets the best child of the focus node w.r.t. the node selection priority assigned by the branching rule
33613  *
33614  * @return the best child of the focus node w.r.t. the node selection priority assigned by the branching rule
33615  *
33616  * @pre This method can be called if @p scip is in one of the following stages:
33617  * - \ref SCIP_STAGE_SOLVING
33618  */
33620  SCIP* scip /**< SCIP data structure */
33621  )
33622 {
33623  SCIP_CALL_ABORT( checkStage(scip, "SCIPgetPrioChild", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) );
33624 
33625  return SCIPtreeGetPrioChild(scip->tree);
33626 }
33627 
33628 /** gets the best sibling of the focus node w.r.t. the node selection priority assigned by the branching rule
33629  *
33630  * @return the best sibling of the focus node w.r.t. the node selection priority assigned by the branching rule
33631  *
33632  * @pre This method can be called if @p scip is in one of the following stages:
33633  * - \ref SCIP_STAGE_SOLVING
33634  */
33636  SCIP* scip /**< SCIP data structure */
33637  )
33638 {
33639  SCIP_CALL_ABORT( checkStage(scip, "SCIPgetPrioSibling", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) );
33640 
33641  return SCIPtreeGetPrioSibling(scip->tree);
33642 }
33643 
33644 /** gets the best child of the focus node w.r.t. the node selection strategy
33645  *
33646  * @return the best child of the focus node w.r.t. the node selection strategy
33647  *
33648  * @pre This method can be called if @p scip is in one of the following stages:
33649  * - \ref SCIP_STAGE_SOLVING
33650  */
33652  SCIP* scip /**< SCIP data structure */
33653  )
33654 {
33655  SCIP_CALL_ABORT( checkStage(scip, "SCIPgetBestChild", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) );
33656 
33657  return SCIPtreeGetBestChild(scip->tree, scip->set);
33658 }
33659 
33660 /** gets the best sibling of the focus node w.r.t. the node selection strategy
33661  *
33662  * @return the best sibling of the focus node w.r.t. the node selection strategy
33663  *
33664  * @pre This method can be called if @p scip is in one of the following stages:
33665  * - \ref SCIP_STAGE_SOLVING
33666  */
33668  SCIP* scip /**< SCIP data structure */
33669  )
33670 {
33671  SCIP_CALL_ABORT( checkStage(scip, "SCIPgetBestSibling", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) );
33672 
33673  return SCIPtreeGetBestSibling(scip->tree, scip->set);
33674 }
33675 
33676 /** gets the best leaf from the node queue w.r.t. the node selection strategy
33677  *
33678  * @return the best leaf from the node queue w.r.t. the node selection strategy
33679  *
33680  * @pre This method can be called if @p scip is in one of the following stages:
33681  * - \ref SCIP_STAGE_SOLVING
33682  */
33684  SCIP* scip /**< SCIP data structure */
33685  )
33686 {
33687  SCIP_CALL_ABORT( checkStage(scip, "SCIPgetBestLeaf", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) );
33688 
33689  return SCIPtreeGetBestLeaf(scip->tree);
33690 }
33691 
33692 /** gets the best node from the tree (child, sibling, or leaf) w.r.t. the node selection strategy
33693  *
33694  * @return the best node from the tree (child, sibling, or leaf) w.r.t. the node selection strategy
33695  *
33696  * @pre This method can be called if @p scip is in one of the following stages:
33697  * - \ref SCIP_STAGE_SOLVING
33698  */
33700  SCIP* scip /**< SCIP data structure */
33701  )
33702 {
33703  SCIP_CALL_ABORT( checkStage(scip, "SCIPgetBestNode", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) );
33704 
33705  return SCIPtreeGetBestNode(scip->tree, scip->set);
33706 }
33707 
33708 /** gets the node with smallest lower bound from the tree (child, sibling, or leaf)
33709  *
33710  * @return the node with smallest lower bound from the tree (child, sibling, or leaf)
33711  *
33712  * @pre This method can be called if @p scip is in one of the following stages:
33713  * - \ref SCIP_STAGE_SOLVING
33714  */
33716  SCIP* scip /**< SCIP data structure */
33717  )
33718 {
33719  SCIP_CALL_ABORT( checkStage(scip, "SCIPgetBestboundNode", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) );
33720 
33721  return SCIPtreeGetLowerboundNode(scip->tree, scip->set);
33722 }
33723 
33724 /** access to all data of open nodes (leaves, children, and siblings)
33725  *
33726  * @pre This method can be called if @p scip is in one of the following stages:
33727  * - \ref SCIP_STAGE_SOLVING
33728  */
33730  SCIP* scip, /**< SCIP data structure */
33731  SCIP_NODE*** leaves, /**< pointer to store the leaves, or NULL if not needed */
33732  SCIP_NODE*** children, /**< pointer to store the children, or NULL if not needed */
33733  SCIP_NODE*** siblings, /**< pointer to store the siblings, or NULL if not needed */
33734  int* nleaves, /**< pointer to store the number of leaves, or NULL */
33735  int* nchildren, /**< pointer to store the number of children, or NULL */
33736  int* nsiblings /**< pointer to store the number of siblings, or NULL */
33737  )
33738 {
33739  SCIP_CALL( checkStage(scip, "SCIPgetOpenNodesData", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) );
33740 
33741  if( leaves != NULL )
33742  *leaves = SCIPnodepqNodes(scip->tree->leaves);
33743  if( children != NULL )
33744  *children = scip->tree->children;
33745  if( siblings != NULL )
33746  *siblings = scip->tree->siblings;
33747  if( nleaves != NULL )
33748  *nleaves = SCIPnodepqLen(scip->tree->leaves);
33749  if( nchildren != NULL )
33750  *nchildren = SCIPtreeGetNChildren(scip->tree);
33751  if( nsiblings != NULL )
33752  *nsiblings = SCIPtreeGetNSiblings(scip->tree);
33753 
33754  return SCIP_OKAY;
33755 }
33756 
33757 /** cuts off node and whole sub tree from branch and bound tree
33758  *
33759  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
33760  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
33761  *
33762  * @pre This method can be called if @p scip is in one of the following stages:
33763  * - \ref SCIP_STAGE_SOLVING
33764  */
33766  SCIP* scip, /**< SCIP data structure */
33767  SCIP_NODE* node /**< node that should be cut off */
33768  )
33769 {
33770  SCIP_CALL( checkStage(scip, "SCIPcutoffNode", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) );
33771 
33772  SCIPnodeCutoff(node, scip->set, scip->stat, scip->tree);
33773 
33774  return SCIP_OKAY;
33775 }
33776 
33777 /** marks the given node to be propagated again the next time a node of its subtree is processed
33778  *
33779  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
33780  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
33781  *
33782  * @pre This method can be called if @p scip is in one of the following stages:
33783  * - \ref SCIP_STAGE_SOLVING
33784  */
33786  SCIP* scip, /**< SCIP data structure */
33787  SCIP_NODE* node /**< node that should be propagated again */
33788  )
33789 {
33790  SCIP_CALL( checkStage(scip, "SCIPrepropagateNode", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) );
33791 
33792  SCIPnodePropagateAgain(node, scip->set, scip->stat, scip->tree);
33793 
33794  return SCIP_OKAY;
33795 }
33796 
33797 /** returns depth of first node in active path that is marked being cutoff
33798  *
33799  * @return depth of first node in active path that is marked being cutoff
33800  *
33801  * @pre This method can be called if @p scip is in one of the following stages:
33802  * - \ref SCIP_STAGE_SOLVING
33803  */
33805  SCIP* scip /**< SCIP data structure */
33806  )
33807 {
33808  SCIP_CALL_ABORT( checkStage(scip, "SCIPgetCutoffdepth", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) );
33809 
33810  return scip->tree->cutoffdepth;
33811 }
33812 
33813 /** returns depth of first node in active path that has to be propagated again
33814  *
33815  * @return depth of first node in active path that has to be propagated again
33816  *
33817  * @pre This method can be called if @p scip is in one of the following stages:
33818  * - \ref SCIP_STAGE_SOLVING
33819  */
33821  SCIP* scip /**< SCIP data structure */
33822  )
33823 {
33824  SCIP_CALL_ABORT( checkStage(scip, "SCIPgetRepropdepth", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) );
33825 
33826  return scip->tree->repropdepth;
33827 }
33828 
33829 /** prints all branching decisions on variables from the root to the given node
33830  *
33831  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
33832  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
33833  *
33834  * @pre This method can be called if @p scip is in one of the following stages:
33835  * - \ref SCIP_STAGE_SOLVING
33836  */
33838  SCIP* scip, /**< SCIP data structure */
33839  SCIP_NODE* node, /**< node data */
33840  FILE* file /**< output file (or NULL for standard output) */
33841  )
33842 {
33843  SCIP_VAR** branchvars; /* array of variables on which the branchings has been performed in all ancestors */
33844  SCIP_Real* branchbounds; /* array of bounds which the branchings in all ancestors set */
33845  SCIP_BOUNDTYPE* boundtypes; /* array of boundtypes which the branchings in all ancestors set */
33846  int* nodeswitches; /* marks, where in the arrays the branching decisions of the next node on the path start
33847  * branchings performed at the parent of node always start at position 0. For single variable branching,
33848  * nodeswitches[i] = i holds */
33849  int nbranchvars; /* number of variables on which branchings have been performed in all ancestors
33850  * if this is larger than the array size, arrays should be reallocated and method should be called again */
33851  int branchvarssize; /* available slots in arrays */
33852  int nnodes; /* number of nodes in the nodeswitch array */
33853  int nodeswitchsize; /* available slots in node switch array */
33854 
33855  branchvarssize = SCIPnodeGetDepth(node);
33856  nodeswitchsize = branchvarssize;
33857 
33858  /* memory allocation */
33859  SCIP_CALL( SCIPallocBufferArray(scip, &branchvars, branchvarssize) );
33860  SCIP_CALL( SCIPallocBufferArray(scip, &branchbounds, branchvarssize) );
33861  SCIP_CALL( SCIPallocBufferArray(scip, &boundtypes, branchvarssize) );
33862  SCIP_CALL( SCIPallocBufferArray(scip, &nodeswitches, nodeswitchsize) );
33863 
33864  SCIPnodeGetAncestorBranchingPath(node, branchvars, branchbounds, boundtypes, &nbranchvars, branchvarssize, nodeswitches, &nnodes, nodeswitchsize );
33865 
33866  /* if the arrays were to small, we have to reallocate them and recall SCIPnodeGetAncestorBranchingPath */
33867  if( nbranchvars > branchvarssize || nnodes > nodeswitchsize )
33868  {
33869  branchvarssize = nbranchvars;
33870  nodeswitchsize = nnodes;
33871 
33872  /* memory reallocation */
33873  SCIP_CALL( SCIPreallocBufferArray(scip, &branchvars, branchvarssize) );
33874  SCIP_CALL( SCIPreallocBufferArray(scip, &branchbounds, branchvarssize) );
33875  SCIP_CALL( SCIPreallocBufferArray(scip, &boundtypes, branchvarssize) );
33876  SCIP_CALL( SCIPreallocBufferArray(scip, &nodeswitches, nodeswitchsize) );
33877 
33878  SCIPnodeGetAncestorBranchingPath(node, branchvars, branchbounds, boundtypes, &nbranchvars, branchvarssize, nodeswitches, &nnodes, nodeswitchsize);
33879  assert(nbranchvars == branchvarssize);
33880  }
33881 
33882  /* we only want to create output, if branchings were performed */
33883  if( nbranchvars >= 1 )
33884  {
33885  int i;
33886  int j;
33887 
33888  /* print all nodes, starting from the root, which is last in the arrays */
33889  for( j = nnodes-1; j >= 0; --j)
33890  {
33891  int end;
33892  if(j == nnodes-1)
33893  end = nbranchvars;
33894  else
33895  end = nodeswitches[j+1];
33896 
33897  for( i = nodeswitches[j]; i < end; ++i )
33898  {
33899  if( i > nodeswitches[j] )
33900  SCIPmessageFPrintInfo(scip->messagehdlr, file, " AND ");
33901  SCIPmessageFPrintInfo(scip->messagehdlr, file, "<%s> %s %.1f",SCIPvarGetName(branchvars[i]), boundtypes[i] == SCIP_BOUNDTYPE_LOWER ? ">=" : "<=", branchbounds[i]);
33902  }
33903  SCIPmessageFPrintInfo(scip->messagehdlr, file, "\n");
33904  if( j > 0 )
33905  {
33906  if( nodeswitches[j]-nodeswitches[j-1] != 1 )
33907  SCIPmessageFPrintInfo(scip->messagehdlr, file, " |\n |\n");
33908  else if( boundtypes[i-1] == SCIP_BOUNDTYPE_LOWER )
33909  SCIPmessageFPrintInfo(scip->messagehdlr, file, "\\ \n \\\n");
33910  else
33911  SCIPmessageFPrintInfo(scip->messagehdlr, file, " /\n/ \n");
33912  }
33913  }
33914  }
33915 
33916  /* free all local memory */
33917  SCIPfreeBufferArray(scip, &nodeswitches);
33918  SCIPfreeBufferArray(scip, &boundtypes);
33919  SCIPfreeBufferArray(scip, &branchbounds);
33920  SCIPfreeBufferArray(scip, &branchvars);
33921 
33922  return SCIP_OKAY;
33923 }
33924 
33925 
33926 /*
33927  * statistic methods
33928  */
33929 
33930 /** gets number of branch and bound runs performed, including the current run
33931  *
33932  * @return the number of branch and bound runs performed, including the current run
33933  *
33934  * @pre This method can be called if SCIP is in one of the following stages:
33935  * - \ref SCIP_STAGE_PROBLEM
33936  * - \ref SCIP_STAGE_TRANSFORMING
33937  * - \ref SCIP_STAGE_TRANSFORMED
33938  * - \ref SCIP_STAGE_INITPRESOLVE
33939  * - \ref SCIP_STAGE_PRESOLVING
33940  * - \ref SCIP_STAGE_EXITPRESOLVE
33941  * - \ref SCIP_STAGE_PRESOLVED
33942  * - \ref SCIP_STAGE_INITSOLVE
33943  * - \ref SCIP_STAGE_SOLVING
33944  * - \ref SCIP_STAGE_SOLVED
33945  * - \ref SCIP_STAGE_EXITSOLVE
33946  * - \ref SCIP_STAGE_FREETRANS
33947  */
33949  SCIP* scip /**< SCIP data structure */
33950  )
33951 {
33952  SCIP_CALL_ABORT( checkStage(scip, "SCIPgetNRuns", FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE) );
33953 
33954  return scip->stat->nruns;
33955 }
33956 
33957 /** gets number of processed nodes in current run, including the focus node
33958  *
33959  * @return the number of processed nodes in current run, including the focus node
33960  *
33961  * @pre This method can be called if SCIP is in one of the following stages:
33962  * - \ref SCIP_STAGE_PROBLEM
33963  * - \ref SCIP_STAGE_TRANSFORMING
33964  * - \ref SCIP_STAGE_TRANSFORMED
33965  * - \ref SCIP_STAGE_INITPRESOLVE
33966  * - \ref SCIP_STAGE_PRESOLVING
33967  * - \ref SCIP_STAGE_EXITPRESOLVE
33968  * - \ref SCIP_STAGE_PRESOLVED
33969  * - \ref SCIP_STAGE_INITSOLVE
33970  * - \ref SCIP_STAGE_SOLVING
33971  * - \ref SCIP_STAGE_SOLVED
33972  * - \ref SCIP_STAGE_EXITSOLVE
33973  * - \ref SCIP_STAGE_FREETRANS
33974  */
33976  SCIP* scip /**< SCIP data structure */
33977  )
33978 {
33979  SCIP_CALL_ABORT( checkStage(scip, "SCIPgetNNodes", FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE) );
33980 
33981  return scip->stat->nnodes;
33982 }
33983 
33984 /** gets total number of processed nodes in all runs, including the focus node
33985  *
33986  * @return the total number of processed nodes in all runs, including the focus node
33987  *
33988  * @pre This method can be called if SCIP is in one of the following stages:
33989  * - \ref SCIP_STAGE_PROBLEM
33990  * - \ref SCIP_STAGE_TRANSFORMING
33991  * - \ref SCIP_STAGE_TRANSFORMED
33992  * - \ref SCIP_STAGE_INITPRESOLVE
33993  * - \ref SCIP_STAGE_PRESOLVING
33994  * - \ref SCIP_STAGE_EXITPRESOLVE
33995  * - \ref SCIP_STAGE_PRESOLVED
33996  * - \ref SCIP_STAGE_INITSOLVE
33997  * - \ref SCIP_STAGE_SOLVING
33998  * - \ref SCIP_STAGE_SOLVED
33999  * - \ref SCIP_STAGE_EXITSOLVE
34000  * - \ref SCIP_STAGE_FREETRANS
34001  */
34003  SCIP* scip /**< SCIP data structure */
34004  )
34005 {
34006  SCIP_CALL_ABORT( checkStage(scip, "SCIPgetNTotalNodes", FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE) );
34007 
34008  return scip->stat->ntotalnodes;
34009 }
34010 
34011 /** gets number of nodes left in the tree (children + siblings + leaves)
34012  *
34013  * @return the number of nodes left in the tree (children + siblings + leaves)
34014  *
34015  * @pre This method can be called if SCIP is in one of the following stages:
34016  * - \ref SCIP_STAGE_PRESOLVED
34017  * - \ref SCIP_STAGE_SOLVING
34018  * - \ref SCIP_STAGE_SOLVED
34019  */
34021  SCIP* scip /**< SCIP data structure */
34022  )
34023 {
34024  SCIP_CALL_ABORT( checkStage(scip, "SCIPgetNNodesLeft", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE) );
34025 
34026  return SCIPtreeGetNNodes(scip->tree);
34027 }
34028 
34029 /** gets total number of LPs solved so far
34030  *
34031  * @return the total number of LPs solved so far
34032  *
34033  * @pre This method can be called if SCIP is in one of the following stages:
34034  * - \ref SCIP_STAGE_PRESOLVED
34035  * - \ref SCIP_STAGE_SOLVING
34036  * - \ref SCIP_STAGE_SOLVED
34037  */
34039  SCIP* scip /**< SCIP data structure */
34040  )
34041 {
34042  SCIP_CALL_ABORT( checkStage(scip, "SCIPgetNLPs", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE) );
34043 
34044  return scip->stat->nlps;
34045 }
34046 
34047 /** gets total number of iterations used so far in primal and dual simplex and barrier algorithm
34048  *
34049  * @return the total number of iterations used so far in primal and dual simplex and barrier algorithm
34050  *
34051  * @pre This method can be called if SCIP is in one of the following stages:
34052  * - \ref SCIP_STAGE_PRESOLVING
34053  * - \ref SCIP_STAGE_PRESOLVED
34054  * - \ref SCIP_STAGE_SOLVING
34055  * - \ref SCIP_STAGE_SOLVED
34056  */
34058  SCIP* scip /**< SCIP data structure */
34059  )
34060 {
34061  SCIP_CALL_ABORT( checkStage(scip, "SCIPgetNLPIterations", FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, TRUE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE) );
34062 
34063  return scip->stat->nlpiterations;
34064 }
34065 
34066 /** gets total number of iterations used so far in primal and dual simplex and barrier algorithm for the root node
34067  *
34068  * @return the total number of iterations used so far in primal and dual simplex and barrier algorithm for the root node
34069  *
34070  * @pre This method can be called if SCIP is in one of the following stages:
34071  * - \ref SCIP_STAGE_PRESOLVED
34072  * - \ref SCIP_STAGE_SOLVING
34073  * - \ref SCIP_STAGE_SOLVED
34074  */
34076  SCIP* scip /**< SCIP data structure */
34077  )
34078 {
34079  SCIP_CALL_ABORT( checkStage(scip, "SCIPgetNRootLPIterations", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE) );
34080 
34081  return scip->stat->nrootlpiterations;
34082 }
34083 
34084 /** gets total number of iterations used in primal and dual simplex and barrier algorithm for the first LP at the root
34085  * node
34086  *
34087  * @return the total number of iterations used in primal and dual simplex and barrier algorithm for the first root LP
34088  *
34089  * @pre This method can be called if SCIP is in one of the following stages:
34090  * - \ref SCIP_STAGE_PRESOLVED
34091  * - \ref SCIP_STAGE_SOLVING
34092  * - \ref SCIP_STAGE_SOLVED
34093  */
34095  SCIP* scip /**< SCIP data structure */
34096  )
34097 {
34098  SCIP_CALL_ABORT( checkStage(scip, "SCIPgetNRootFirstLPIterations", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE) );
34099 
34100  return scip->stat->nrootfirstlpiterations;
34101 }
34102 
34103 /** gets total number of primal LPs solved so far
34104  *
34105  * @return the total number of primal LPs solved so far
34106  *
34107  * @pre This method can be called if SCIP is in one of the following stages:
34108  * - \ref SCIP_STAGE_PRESOLVED
34109  * - \ref SCIP_STAGE_SOLVING
34110  * - \ref SCIP_STAGE_SOLVED
34111  */
34113  SCIP* scip /**< SCIP data structure */
34114  )
34115 {
34116  SCIP_CALL_ABORT( checkStage(scip, "SCIPgetNPrimalLPs", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE) );
34117 
34118  return scip->stat->nprimallps;
34119 }
34120 
34121 /** gets total number of iterations used so far in primal simplex
34122  *
34123  * @return total number of iterations used so far in primal simplex
34124  *
34125  * @pre This method can be called if SCIP is in one of the following stages:
34126  * - \ref SCIP_STAGE_PRESOLVED
34127  * - \ref SCIP_STAGE_SOLVING
34128  * - \ref SCIP_STAGE_SOLVED
34129  */
34131  SCIP* scip /**< SCIP data structure */
34132  )
34133 {
34134  SCIP_CALL_ABORT( checkStage(scip, "SCIPgetNPrimalLPIterations", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE) );
34135 
34136  return scip->stat->nprimallpiterations;
34137 }
34138 
34139 /** gets total number of dual LPs solved so far
34140  *
34141  * @return the total number of dual LPs solved so far
34142  *
34143  * @pre This method can be called if SCIP is in one of the following stages:
34144  * - \ref SCIP_STAGE_PRESOLVED
34145  * - \ref SCIP_STAGE_SOLVING
34146  * - \ref SCIP_STAGE_SOLVED
34147  */
34149  SCIP* scip /**< SCIP data structure */
34150  )
34151 {
34152  SCIP_CALL_ABORT( checkStage(scip, "SCIPgetNDualLPs", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE) );
34153 
34154  return scip->stat->nduallps;
34155 }
34156 
34157 /** gets total number of iterations used so far in dual simplex
34158  *
34159  * @return the total number of iterations used so far in dual simplex
34160  *
34161  * @pre This method can be called if SCIP is in one of the following stages:
34162  * - \ref SCIP_STAGE_PRESOLVED
34163  * - \ref SCIP_STAGE_SOLVING
34164  * - \ref SCIP_STAGE_SOLVED
34165  */
34167  SCIP* scip /**< SCIP data structure */
34168  )
34169 {
34170  SCIP_CALL_ABORT( checkStage(scip, "SCIPgetNDualLPIterations", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE) );
34171 
34172  return scip->stat->nduallpiterations;
34173 }
34174 
34175 /** gets total number of barrier LPs solved so far
34176  *
34177  * @return the total number of barrier LPs solved so far
34178  *
34179  * @pre This method can be called if SCIP is in one of the following stages:
34180  * - \ref SCIP_STAGE_PRESOLVED
34181  * - \ref SCIP_STAGE_SOLVING
34182  * - \ref SCIP_STAGE_SOLVED
34183  */
34185  SCIP* scip /**< SCIP data structure */
34186  )
34187 {
34188  SCIP_CALL_ABORT( checkStage(scip, "SCIPgetNBarrierLPs", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE) );
34189 
34190  return scip->stat->nbarrierlps;
34191 }
34192 
34193 /** gets total number of iterations used so far in barrier algorithm
34194  *
34195  * @return the total number of iterations used so far in barrier algorithm
34196  *
34197  * @pre This method can be called if SCIP is in one of the following stages:
34198  * - \ref SCIP_STAGE_PRESOLVED
34199  * - \ref SCIP_STAGE_SOLVING
34200  * - \ref SCIP_STAGE_SOLVED
34201  */
34203  SCIP* scip /**< SCIP data structure */
34204  )
34205 {
34206  SCIP_CALL_ABORT( checkStage(scip, "SCIPgetNBarrierLPIterations", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE) );
34207 
34208  return scip->stat->nbarrierlpiterations;
34209 }
34210 
34211 /** gets total number of LPs solved so far that were resolved from an advanced start basis
34212  *
34213  * @return the total number of LPs solved so far that were resolved from an advanced start basis
34214  *
34215  * @pre This method can be called if SCIP is in one of the following stages:
34216  * - \ref SCIP_STAGE_PRESOLVED
34217  * - \ref SCIP_STAGE_SOLVING
34218  * - \ref SCIP_STAGE_SOLVED
34219  */
34221  SCIP* scip /**< SCIP data structure */
34222  )
34223 {
34224  SCIP_CALL_ABORT( checkStage(scip, "SCIPgetNResolveLPs", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE) );
34225 
34226  return scip->stat->nprimalresolvelps + scip->stat->ndualresolvelps;
34227 }
34228 
34229 /** gets total number of simplex iterations used so far in primal and dual simplex calls where an advanced start basis
34230  * was available
34231  *
34232  * @return the total number of simplex iterations used so far in primal and dual simplex calls where an advanced start
34233  * basis was available
34234  *
34235  * @pre This method can be called if SCIP is in one of the following stages:
34236  * - \ref SCIP_STAGE_PRESOLVED
34237  * - \ref SCIP_STAGE_SOLVING
34238  * - \ref SCIP_STAGE_SOLVED
34239  */
34241  SCIP* scip /**< SCIP data structure */
34242  )
34243 {
34244  SCIP_CALL_ABORT( checkStage(scip, "SCIPgetNResolveLPIterations", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE) );
34245 
34247 }
34248 
34249 /** gets total number of primal LPs solved so far that were resolved from an advanced start basis
34250  *
34251  * @return the total number of primal LPs solved so far that were resolved from an advanced start basis
34252  *
34253  * @pre This method can be called if SCIP is in one of the following stages:
34254  * - \ref SCIP_STAGE_PRESOLVED
34255  * - \ref SCIP_STAGE_SOLVING
34256  * - \ref SCIP_STAGE_SOLVED
34257  */
34259  SCIP* scip /**< SCIP data structure */
34260  )
34261 {
34262  SCIP_CALL_ABORT( checkStage(scip, "SCIPgetNPrimalResolveLPs", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE) );
34263 
34264  return scip->stat->nprimalresolvelps;
34265 }
34266 
34267 /** gets total number of simplex iterations used so far in primal simplex calls where an advanced start basis
34268  * was available
34269  *
34270  * @return the total number of simplex iterations used so far in primal simplex calls where an advanced start
34271  * basis was available
34272  *
34273  * @pre This method can be called if SCIP is in one of the following stages:
34274  * - \ref SCIP_STAGE_PRESOLVED
34275  * - \ref SCIP_STAGE_SOLVING
34276  * - \ref SCIP_STAGE_SOLVED
34277  */
34279  SCIP* scip /**< SCIP data structure */
34280  )
34281 {
34282  SCIP_CALL_ABORT( checkStage(scip, "SCIPgetNPrimalResolveLPIterations", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE) );
34283 
34284  return scip->stat->nprimalresolvelpiterations;
34285 }
34286 
34287 /** gets total number of dual LPs solved so far that were resolved from an advanced start basis
34288  *
34289  * @return the total number of dual LPs solved so far that were resolved from an advanced start basis
34290  *
34291  * @pre This method can be called if SCIP is in one of the following stages:
34292  * - \ref SCIP_STAGE_PRESOLVED
34293  * - \ref SCIP_STAGE_SOLVING
34294  * - \ref SCIP_STAGE_SOLVED
34295  */
34297  SCIP* scip /**< SCIP data structure */
34298  )
34299 {
34300  SCIP_CALL_ABORT( checkStage(scip, "SCIPgetNDualResolveLPs", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE) );
34301 
34302  return scip->stat->ndualresolvelps;
34303 }
34304 
34305 /** gets total number of simplex iterations used so far in dual simplex calls where an advanced start basis
34306  * was available
34307  *
34308  * @return the total number of simplex iterations used so far in dual simplex calls where an advanced start
34309  * basis was available
34310  *
34311  * @pre This method can be called if SCIP is in one of the following stages:
34312  * - \ref SCIP_STAGE_PRESOLVED
34313  * - \ref SCIP_STAGE_SOLVING
34314  * - \ref SCIP_STAGE_SOLVED
34315  */
34317  SCIP* scip /**< SCIP data structure */
34318  )
34319 {
34320  SCIP_CALL_ABORT( checkStage(scip, "SCIPgetNDualResolveLPIterations", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE) );
34321 
34322  return scip->stat->ndualresolvelpiterations;
34323 }
34324 
34325 /** gets total number of LPs solved so far for node relaxations
34326  *
34327  * @return the total number of LPs solved so far for node relaxations
34328  *
34329  * @pre This method can be called if SCIP is in one of the following stages:
34330  * - \ref SCIP_STAGE_PRESOLVED
34331  * - \ref SCIP_STAGE_SOLVING
34332  * - \ref SCIP_STAGE_SOLVED
34333  */
34335  SCIP* scip /**< SCIP data structure */
34336  )
34337 {
34338  SCIP_CALL_ABORT( checkStage(scip, "SCIPgetNNodeLPs", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE) );
34339 
34340  return scip->stat->nnodelps;
34341 }
34342 
34343 /** gets total number of simplex iterations used so far for node relaxations
34344  *
34345  * @return the total number of simplex iterations used so far for node relaxations
34346  *
34347  * @pre This method can be called if SCIP is in one of the following stages:
34348  * - \ref SCIP_STAGE_PRESOLVED
34349  * - \ref SCIP_STAGE_SOLVING
34350  * - \ref SCIP_STAGE_SOLVED
34351  */
34353  SCIP* scip /**< SCIP data structure */
34354  )
34355 {
34356  SCIP_CALL_ABORT( checkStage(scip, "SCIPgetNNodeLPIterations", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE) );
34357 
34358  return scip->stat->nnodelpiterations;
34359 }
34360 
34361 /** gets total number of LPs solved so far for initial LP in node relaxations
34362  *
34363  * @return the total number of LPs solved so far for initial LP in node relaxations
34364  *
34365  * @pre This method can be called if SCIP is in one of the following stages:
34366  * - \ref SCIP_STAGE_PRESOLVED
34367  * - \ref SCIP_STAGE_SOLVING
34368  * - \ref SCIP_STAGE_SOLVED
34369  */
34371  SCIP* scip /**< SCIP data structure */
34372  )
34373 {
34374  SCIP_CALL_ABORT( checkStage(scip, "SCIPgetNNodeInitLPs", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE) );
34375 
34376  return scip->stat->ninitlps;
34377 }
34378 
34379 /** gets total number of simplex iterations used so far for initial LP in node relaxations
34380  *
34381  * @return the total number of simplex iterations used so far for initial LP in node relaxations
34382  *
34383  * @pre This method can be called if SCIP is in one of the following stages:
34384  * - \ref SCIP_STAGE_PRESOLVED
34385  * - \ref SCIP_STAGE_SOLVING
34386  * - \ref SCIP_STAGE_SOLVED
34387  */
34389  SCIP* scip /**< SCIP data structure */
34390  )
34391 {
34392  SCIP_CALL_ABORT( checkStage(scip, "SCIPgetNNodeInitLPIterations", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE) );
34393 
34394  return scip->stat->ninitlpiterations;
34395 }
34396 
34397 /** gets total number of LPs solved so far during diving and probing
34398  *
34399  * @return total number of LPs solved so far during diving and probing
34400  *
34401  * @pre This method can be called if SCIP is in one of the following stages:
34402  * - \ref SCIP_STAGE_PRESOLVED
34403  * - \ref SCIP_STAGE_SOLVING
34404  * - \ref SCIP_STAGE_SOLVED
34405  */
34407  SCIP* scip /**< SCIP data structure */
34408  )
34409 {
34410  SCIP_CALL_ABORT( checkStage(scip, "SCIPgetNDivingLPs", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE) );
34411 
34412  return scip->stat->ndivinglps;
34413 }
34414 
34415 /** gets total number of simplex iterations used so far during diving and probing
34416  *
34417  * @return the total number of simplex iterations used so far during diving and probing
34418  *
34419  * @pre This method can be called if SCIP is in one of the following stages:
34420  * - \ref SCIP_STAGE_PRESOLVED
34421  * - \ref SCIP_STAGE_SOLVING
34422  * - \ref SCIP_STAGE_SOLVED
34423  */
34425  SCIP* scip /**< SCIP data structure */
34426  )
34427 {
34428  SCIP_CALL_ABORT( checkStage(scip, "SCIPgetNDivingLPIterations", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE) );
34429 
34430  return scip->stat->ndivinglpiterations;
34431 }
34432 
34433 /** gets total number of times, strong branching was called (each call represents solving two LPs)
34434  *
34435  * @return the total number of times, strong branching was called (each call represents solving two LPs)
34436  *
34437  * @pre This method can be called if SCIP is in one of the following stages:
34438  * - \ref SCIP_STAGE_PRESOLVED
34439  * - \ref SCIP_STAGE_SOLVING
34440  * - \ref SCIP_STAGE_SOLVED
34441  */
34443  SCIP* scip /**< SCIP data structure */
34444  )
34445 {
34446  SCIP_CALL_ABORT( checkStage(scip, "SCIPgetNStrongbranchs", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE) );
34447 
34448  return scip->stat->nstrongbranchs;
34449 }
34450 
34451 /** gets total number of simplex iterations used so far in strong branching
34452  *
34453  * @return the total number of simplex iterations used so far in strong branching
34454  *
34455  * @pre This method can be called if SCIP is in one of the following stages:
34456  * - \ref SCIP_STAGE_PRESOLVED
34457  * - \ref SCIP_STAGE_SOLVING
34458  * - \ref SCIP_STAGE_SOLVED
34459  */
34461  SCIP* scip /**< SCIP data structure */
34462  )
34463 {
34464  SCIP_CALL_ABORT( checkStage(scip, "SCIPgetNStrongbranchLPIterations", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE) );
34465 
34466  return scip->stat->nsblpiterations;
34467 }
34468 
34469 /** gets total number of times, strong branching was called at the root node (each call represents solving two LPs)
34470  *
34471  * @return the total number of times, strong branching was called at the root node (each call represents solving two LPs)
34472  *
34473  * @pre This method can be called if SCIP is in one of the following stages:
34474  * - \ref SCIP_STAGE_PRESOLVED
34475  * - \ref SCIP_STAGE_SOLVING
34476  * - \ref SCIP_STAGE_SOLVED
34477  */
34479  SCIP* scip /**< SCIP data structure */
34480  )
34481 {
34482  SCIP_CALL_ABORT( checkStage(scip, "SCIPgetNRootStrongbranchs", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE) );
34483 
34484  return scip->stat->nrootstrongbranchs;
34485 }
34486 
34487 /** gets total number of simplex iterations used so far in strong branching at the root node
34488  *
34489  * @return the total number of simplex iterations used so far in strong branching at the root node
34490  *
34491  * @pre This method can be called if SCIP is in one of the following stages:
34492  * - \ref SCIP_STAGE_PRESOLVED
34493  * - \ref SCIP_STAGE_SOLVING
34494  * - \ref SCIP_STAGE_SOLVED
34495  */
34497  SCIP* scip /**< SCIP data structure */
34498  )
34499 {
34500  SCIP_CALL_ABORT( checkStage(scip, "SCIPgetNRootStrongbranchLPIterations", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE) );
34501 
34502  return scip->stat->nrootsblpiterations;
34503 }
34504 
34505 /** gets number of pricing rounds performed so far at the current node
34506  *
34507  * @return the number of pricing rounds performed so far at the current node
34508  *
34509  * @pre This method can be called if SCIP is in one of the following stages:
34510  * - \ref SCIP_STAGE_SOLVING
34511  */
34513  SCIP* scip /**< SCIP data structure */
34514  )
34515 {
34516  SCIP_CALL_ABORT( checkStage(scip, "SCIPgetNPriceRounds", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) );
34517 
34518  return scip->stat->npricerounds;
34519 }
34520 
34521 /** get current number of variables in the pricing store
34522  *
34523  * @return the current number of variables in the pricing store
34524  *
34525  * @pre This method can be called if SCIP is in one of the following stages:
34526  * - \ref SCIP_STAGE_PRESOLVED
34527  * - \ref SCIP_STAGE_SOLVING
34528  * - \ref SCIP_STAGE_SOLVED
34529  */
34531  SCIP* scip /**< SCIP data structure */
34532  )
34533 {
34534  SCIP_CALL_ABORT( checkStage(scip, "SCIPgetNPricevars", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE) );
34535 
34536  return SCIPpricestoreGetNVars(scip->pricestore);
34537 }
34538 
34539 /** get total number of pricing variables found so far
34540  *
34541  * @return the total number of pricing variables found so far
34542  *
34543  * @pre This method can be called if SCIP is in one of the following stages:
34544  * - \ref SCIP_STAGE_PRESOLVED
34545  * - \ref SCIP_STAGE_SOLVING
34546  * - \ref SCIP_STAGE_SOLVED
34547  */
34549  SCIP* scip /**< SCIP data structure */
34550  )
34551 {
34552  SCIP_CALL_ABORT( checkStage(scip, "SCIPgetNPricevarsFound", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE) );
34553 
34555 }
34556 
34557 /** get total number of pricing variables applied to the LPs
34558  *
34559  * @return the total number of pricing variables applied to the LPs
34560  *
34561  * @pre This method can be called if SCIP is in one of the following stages:
34562  * - \ref SCIP_STAGE_PRESOLVED
34563  * - \ref SCIP_STAGE_SOLVING
34564  * - \ref SCIP_STAGE_SOLVED
34565  */
34567  SCIP* scip /**< SCIP data structure */
34568  )
34569 {
34570  SCIP_CALL_ABORT( checkStage(scip, "SCIPgetNPricevarsApplied", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE) );
34571 
34573 }
34574 
34575 /** gets number of separation rounds performed so far at the current node
34576  *
34577  * @return the number of separation rounds performed so far at the current node
34578  *
34579  * @pre This method can be called if SCIP is in one of the following stages:
34580  * - \ref SCIP_STAGE_SOLVING
34581  */
34583  SCIP* scip /**< SCIP data structure */
34584  )
34585 {
34586  SCIP_CALL_ABORT( checkStage(scip, "SCIPgetNSepaRounds", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) );
34587 
34588  return scip->stat->nseparounds;
34589 }
34590 
34591 /** get total number of cuts found so far
34592  *
34593  * @return the total number of cuts found so far
34594  *
34595  * @pre This method can be called if SCIP is in one of the following stages:
34596  * - \ref SCIP_STAGE_PRESOLVED
34597  * - \ref SCIP_STAGE_SOLVING
34598  * - \ref SCIP_STAGE_SOLVED
34599  */
34601  SCIP* scip /**< SCIP data structure */
34602  )
34603 {
34604  SCIP_CALL_ABORT( checkStage(scip, "SCIPgetNCutsFound", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE) );
34605 
34606  return SCIPsepastoreGetNCutsFound(scip->sepastore);
34607 }
34608 
34609 /** get number of cuts found so far in current separation round
34610  *
34611  * @return the number of cuts found so far in current separation round
34612  *
34613  * @pre This method can be called if SCIP is in one of the following stages:
34614  * - \ref SCIP_STAGE_PRESOLVED
34615  * - \ref SCIP_STAGE_SOLVING
34616  * - \ref SCIP_STAGE_SOLVED
34617  */
34619  SCIP* scip /**< SCIP data structure */
34620  )
34621 {
34622  SCIP_CALL_ABORT( checkStage(scip, "SCIPgetNCutsFoundRound", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE) );
34623 
34625 }
34626 
34627 /** get total number of cuts applied to the LPs
34628  *
34629  * @return the total number of cuts applied to the LPs
34630  *
34631  * @pre This method can be called if SCIP is in one of the following stages:
34632  * - \ref SCIP_STAGE_PRESOLVED
34633  * - \ref SCIP_STAGE_SOLVING
34634  * - \ref SCIP_STAGE_SOLVED
34635  */
34637  SCIP* scip /**< SCIP data structure */
34638  )
34639 {
34640  SCIP_CALL_ABORT( checkStage(scip, "SCIPgetNCutsApplied", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE) );
34641 
34643 }
34644 
34645 /** get total number of constraints found in conflict analysis (conflict and reconvergence constraints)
34646  *
34647  * @return the total number of constraints found in conflict analysis (conflict and reconvergence constraints)
34648  *
34649  * @pre This method can be called if SCIP is in one of the following stages:
34650  * - \ref SCIP_STAGE_TRANSFORMED
34651  * - \ref SCIP_STAGE_INITPRESOLVE
34652  * - \ref SCIP_STAGE_PRESOLVING
34653  * - \ref SCIP_STAGE_EXITPRESOLVE
34654  * - \ref SCIP_STAGE_PRESOLVED
34655  * - \ref SCIP_STAGE_INITSOLVE
34656  * - \ref SCIP_STAGE_SOLVING
34657  * - \ref SCIP_STAGE_SOLVED
34658  * - \ref SCIP_STAGE_EXITSOLVE
34659  */
34661  SCIP* scip /**< SCIP data structure */
34662  )
34663 {
34664  SCIP_CALL_ABORT( checkStage(scip, "SCIPgetNConflictConssFound", FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE) );
34665 
34676 }
34677 
34678 /** get number of conflict constraints found so far at the current node
34679  *
34680  * @return the number of conflict constraints found so far at the current node
34681  *
34682  * @pre This method can be called if SCIP is in one of the following stages:
34683  * - \ref SCIP_STAGE_TRANSFORMED
34684  * - \ref SCIP_STAGE_INITPRESOLVE
34685  * - \ref SCIP_STAGE_PRESOLVING
34686  * - \ref SCIP_STAGE_EXITPRESOLVE
34687  * - \ref SCIP_STAGE_PRESOLVED
34688  * - \ref SCIP_STAGE_INITSOLVE
34689  * - \ref SCIP_STAGE_SOLVING
34690  * - \ref SCIP_STAGE_SOLVED
34691  * - \ref SCIP_STAGE_EXITSOLVE
34692  */
34694  SCIP* scip /**< SCIP data structure */
34695  )
34696 {
34697  SCIP_CALL_ABORT( checkStage(scip, "SCIPgetNConflictConssFoundNode", FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE) );
34698 
34699  return SCIPconflictGetNConflicts(scip->conflict);
34700 }
34701 
34702 /** get total number of conflict constraints added to the problem
34703  *
34704  * @return the total number of conflict constraints added to the problem
34705  *
34706  * @pre This method can be called if SCIP is in one of the following stages:
34707  * - \ref SCIP_STAGE_TRANSFORMED
34708  * - \ref SCIP_STAGE_INITPRESOLVE
34709  * - \ref SCIP_STAGE_PRESOLVING
34710  * - \ref SCIP_STAGE_EXITPRESOLVE
34711  * - \ref SCIP_STAGE_PRESOLVED
34712  * - \ref SCIP_STAGE_INITSOLVE
34713  * - \ref SCIP_STAGE_SOLVING
34714  * - \ref SCIP_STAGE_SOLVED
34715  * - \ref SCIP_STAGE_EXITSOLVE
34716  */
34718  SCIP* scip /**< SCIP data structure */
34719  )
34720 {
34721  SCIP_CALL_ABORT( checkStage(scip, "SCIPgetNConflictConssApplied", FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE) );
34722 
34723  return SCIPconflictGetNAppliedConss(scip->conflict);
34724 }
34725 
34726 /** gets depth of current node, or -1 if no current node exists; in probing, the current node is the last probing node,
34727  * such that the depth includes the probing path
34728  *
34729  * @return the depth of current node, or -1 if no current node exists; in probing, the current node is the last probing node,
34730  * such that the depth includes the probing path
34731  *
34732  * @pre This method can be called if SCIP is in one of the following stages:
34733  * - \ref SCIP_STAGE_TRANSFORMED
34734  * - \ref SCIP_STAGE_INITPRESOLVE
34735  * - \ref SCIP_STAGE_PRESOLVING
34736  * - \ref SCIP_STAGE_EXITPRESOLVE
34737  * - \ref SCIP_STAGE_PRESOLVED
34738  * - \ref SCIP_STAGE_INITSOLVE
34739  * - \ref SCIP_STAGE_SOLVING
34740  * - \ref SCIP_STAGE_SOLVED
34741  * - \ref SCIP_STAGE_EXITSOLVE
34742  */
34744  SCIP* scip /**< SCIP data structure */
34745  )
34746 {
34747  SCIP_CALL_ABORT( checkStage(scip, "SCIPgetDepth", FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE) );
34748 
34749  return SCIPtreeGetCurrentDepth(scip->tree);
34750 }
34751 
34752 /** gets depth of the focus node, or -1 if no focus node exists; the focus node is the currently processed node in the
34753  * branching tree, excluding the nodes of the probing path
34754  *
34755  * @return the depth of the focus node, or -1 if no focus node exists; the focus node is the currently processed node in the
34756  * branching tree, excluding the nodes of the probing path
34757  *
34758  * @pre This method can be called if SCIP is in one of the following stages:
34759  * - \ref SCIP_STAGE_TRANSFORMED
34760  * - \ref SCIP_STAGE_INITPRESOLVE
34761  * - \ref SCIP_STAGE_PRESOLVING
34762  * - \ref SCIP_STAGE_EXITPRESOLVE
34763  * - \ref SCIP_STAGE_PRESOLVED
34764  * - \ref SCIP_STAGE_INITSOLVE
34765  * - \ref SCIP_STAGE_SOLVING
34766  * - \ref SCIP_STAGE_SOLVED
34767  * - \ref SCIP_STAGE_EXITSOLVE
34768  */
34770  SCIP* scip /**< SCIP data structure */
34771  )
34772 {
34773  SCIP_CALL_ABORT( checkStage(scip, "SCIPgetFocusDepth", FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE) );
34774 
34775  return SCIPtreeGetFocusDepth(scip->tree);
34776 }
34777 
34778 /** gets maximal depth of all processed nodes in current branch and bound run (excluding probing nodes)
34779  *
34780  * @return the maximal depth of all processed nodes in current branch and bound run (excluding probing nodes)
34781  *
34782  * @pre This method can be called if SCIP is in one of the following stages:
34783  * - \ref SCIP_STAGE_TRANSFORMED
34784  * - \ref SCIP_STAGE_INITPRESOLVE
34785  * - \ref SCIP_STAGE_PRESOLVING
34786  * - \ref SCIP_STAGE_EXITPRESOLVE
34787  * - \ref SCIP_STAGE_PRESOLVED
34788  * - \ref SCIP_STAGE_INITSOLVE
34789  * - \ref SCIP_STAGE_SOLVING
34790  * - \ref SCIP_STAGE_SOLVED
34791  * - \ref SCIP_STAGE_EXITSOLVE
34792  */
34794  SCIP* scip /**< SCIP data structure */
34795  )
34796 {
34797  SCIP_CALL_ABORT( checkStage(scip, "SCIPgetMaxDepth", FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE) );
34798 
34799  return scip->stat->maxdepth;
34800 }
34801 
34802 /** gets maximal depth of all processed nodes over all branch and bound runs
34803  *
34804  * @return the maximal depth of all processed nodes over all branch and bound runs
34805  *
34806  * @pre This method can be called if SCIP is in one of the following stages:
34807  * - \ref SCIP_STAGE_TRANSFORMED
34808  * - \ref SCIP_STAGE_INITPRESOLVE
34809  * - \ref SCIP_STAGE_PRESOLVING
34810  * - \ref SCIP_STAGE_EXITPRESOLVE
34811  * - \ref SCIP_STAGE_PRESOLVED
34812  * - \ref SCIP_STAGE_INITSOLVE
34813  * - \ref SCIP_STAGE_SOLVING
34814  * - \ref SCIP_STAGE_SOLVED
34815  * - \ref SCIP_STAGE_EXITSOLVE
34816  */
34818  SCIP* scip /**< SCIP data structure */
34819  )
34820 {
34821  SCIP_CALL_ABORT( checkStage(scip, "SCIPgetMaxTotalDepth", FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE) );
34822 
34823  return scip->stat->maxtotaldepth;
34824 }
34825 
34826 /** gets total number of backtracks, i.e. number of times, the new node was selected from the leaves queue
34827  *
34828  * @return the total number of backtracks, i.e. number of times, the new node was selected from the leaves queue
34829  *
34830  * @pre This method can be called if SCIP is in one of the following stages:
34831  * - \ref SCIP_STAGE_TRANSFORMED
34832  * - \ref SCIP_STAGE_INITPRESOLVE
34833  * - \ref SCIP_STAGE_PRESOLVING
34834  * - \ref SCIP_STAGE_EXITPRESOLVE
34835  * - \ref SCIP_STAGE_PRESOLVED
34836  * - \ref SCIP_STAGE_INITSOLVE
34837  * - \ref SCIP_STAGE_SOLVING
34838  * - \ref SCIP_STAGE_SOLVED
34839  * - \ref SCIP_STAGE_EXITSOLVE
34840  */
34842  SCIP* scip /**< SCIP data structure */
34843  )
34844 {
34845  SCIP_CALL_ABORT( checkStage(scip, "SCIPgetNBacktracks", FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE) );
34846 
34847  return scip->stat->nbacktracks;
34848 }
34849 
34850 /** gets current plunging depth (successive times, a child was selected as next node)
34851  *
34852  * @return the current plunging depth (successive times, a child was selected as next node)
34853  *
34854  * @pre This method can be called if SCIP is in one of the following stages:
34855  * - \ref SCIP_STAGE_PRESOLVED
34856  * - \ref SCIP_STAGE_SOLVING
34857  */
34859  SCIP* scip /**< SCIP data structure */
34860  )
34861 {
34862  SCIP_CALL_ABORT( checkStage(scip, "SCIPgetPlungeDepth", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) );
34863 
34864  return scip->stat->plungedepth;
34865 }
34866 
34867 /** gets total number of active constraints at the current node
34868  *
34869  * @return the total number of active constraints at the current node
34870  *
34871  * @pre This method can be called if SCIP is in one of the following stages:
34872  * - \ref SCIP_STAGE_PRESOLVED
34873  * - \ref SCIP_STAGE_SOLVING
34874  */
34876  SCIP* scip /**< SCIP data structure */
34877  )
34878 {
34879  SCIP_CALL_ABORT( checkStage(scip, "SCIPgetNActiveConss", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) );
34880 
34881  return scip->stat->nactiveconss;
34882 }
34883 
34884 /** gets total number of enabled constraints at the current node
34885  *
34886  * @return the total number of enabled constraints at the current node
34887  *
34888  * @pre This method can be called if SCIP is in one of the following stages:
34889  * - \ref SCIP_STAGE_PRESOLVED
34890  * - \ref SCIP_STAGE_SOLVING
34891  */
34893  SCIP* scip /**< SCIP data structure */
34894  )
34895 {
34896  SCIP_CALL_ABORT( checkStage(scip, "SCIPgetNEnabledConss", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) );
34897 
34898  return scip->stat->nenabledconss;
34899 }
34900 
34901 /** gets average dual bound of all unprocessed nodes for original problem
34902  *
34903  * @return the average dual bound of all unprocessed nodes for original problem
34904  *
34905  * @pre This method can be called if SCIP is in one of the following stages:
34906  * - \ref SCIP_STAGE_PRESOLVED
34907  * - \ref SCIP_STAGE_SOLVING
34908  * - \ref SCIP_STAGE_SOLVED
34909  */
34911  SCIP* scip /**< SCIP data structure */
34912  )
34913 {
34914  SCIP_CALL_ABORT( checkStage(scip, "SCIPgetAvgDualbound", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE) );
34915 
34916  return SCIPprobExternObjval(scip->transprob, scip->origprob, scip->set,
34918 }
34919 
34920 /** gets average lower (dual) bound of all unprocessed nodes in transformed problem
34921  *
34922  * @return the average lower (dual) bound of all unprocessed nodes in transformed problem
34923  *
34924  * @pre This method can be called if SCIP is in one of the following stages:
34925  * - \ref SCIP_STAGE_PRESOLVED
34926  * - \ref SCIP_STAGE_SOLVING
34927  * - \ref SCIP_STAGE_SOLVED
34928  */
34930  SCIP* scip /**< SCIP data structure */
34931  )
34932 {
34933  SCIP_CALL_ABORT( checkStage(scip, "SCIPgetAvgLowerbound", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE) );
34934 
34935  return SCIPtreeGetAvgLowerbound(scip->tree, scip->primal->cutoffbound);
34936 }
34937 
34938 /** gets global dual bound
34939  *
34940  * @return the global dual bound
34941  *
34942  * @pre This method can be called if SCIP is in one of the following stages:
34943  * - \ref SCIP_STAGE_PRESOLVING
34944  * - \ref SCIP_STAGE_EXITPRESOLVE
34945  * - \ref SCIP_STAGE_PRESOLVED
34946  * - \ref SCIP_STAGE_INITSOLVE
34947  * - \ref SCIP_STAGE_SOLVING
34948  * - \ref SCIP_STAGE_SOLVED
34949  */
34951  SCIP* scip /**< SCIP data structure */
34952  )
34953 {
34954  SCIP_CALL_ABORT( checkStage(scip, "SCIPgetDualbound", FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE) );
34955 
34956  return getDualbound(scip);
34957 }
34958 
34959 /** gets global lower (dual) bound in transformed problem
34960  *
34961  * @return the global lower (dual) bound in transformed problem
34962  *
34963  * @pre This method can be called if SCIP is in one of the following stages:
34964  * - \ref SCIP_STAGE_PRESOLVING
34965  * - \ref SCIP_STAGE_EXITPRESOLVE
34966  * - \ref SCIP_STAGE_PRESOLVED
34967  * - \ref SCIP_STAGE_INITSOLVE
34968  * - \ref SCIP_STAGE_SOLVING
34969  * - \ref SCIP_STAGE_SOLVED
34970  */
34972  SCIP* scip /**< SCIP data structure */
34973  )
34974 {
34975  SCIP_CALL_ABORT( checkStage(scip, "SCIPgetLowerbound", FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE) );
34976 
34977  return getLowerbound(scip);
34978 }
34979 
34980 /** gets dual bound of the root node for the original problem
34981  *
34982  * @return the dual bound of the root node for the original problem
34983  *
34984  * @pre This method can be called if SCIP is in one of the following stages:
34985  * - \ref SCIP_STAGE_PRESOLVING
34986  * - \ref SCIP_STAGE_EXITPRESOLVE
34987  * - \ref SCIP_STAGE_PRESOLVED
34988  * - \ref SCIP_STAGE_INITSOLVE
34989  * - \ref SCIP_STAGE_SOLVING
34990  * - \ref SCIP_STAGE_SOLVED
34991  */
34993  SCIP* scip /**< SCIP data structure */
34994  )
34995 {
34996  SCIP_CALL_ABORT( checkStage(scip, "SCIPgetDualboundRoot", FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE) );
34997 
34998  if( SCIPsetIsInfinity(scip->set, scip->stat->rootlowerbound) )
34999  return getPrimalbound(scip);
35000  else
35001  return SCIPprobExternObjval(scip->transprob, scip->origprob, scip->set, scip->stat->rootlowerbound);
35002 }
35003 
35004 /** gets lower (dual) bound in transformed problem of the root node
35005  *
35006  * @return the lower (dual) bound in transformed problem of the root node
35007  *
35008  * @pre This method can be called if SCIP is in one of the following stages:
35009  * - \ref SCIP_STAGE_PRESOLVING
35010  * - \ref SCIP_STAGE_EXITPRESOLVE
35011  * - \ref SCIP_STAGE_PRESOLVED
35012  * - \ref SCIP_STAGE_INITSOLVE
35013  * - \ref SCIP_STAGE_SOLVING
35014  * - \ref SCIP_STAGE_SOLVED
35015  */
35017  SCIP* scip /**< SCIP data structure */
35018  )
35019 {
35020  SCIP_CALL_ABORT( checkStage(scip, "SCIPgetLowerboundRoot", FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE) );
35021 
35022  if( SCIPsetIsInfinity(scip->set, scip->stat->rootlowerbound) )
35023  return getUpperbound(scip);
35024  else
35025  return scip->stat->rootlowerbound;
35026 }
35027 
35028 /** gets dual bound for the original problem obtained by the first LP solve at the root node
35029  *
35030  * @return the dual bound for the original problem of the first LP solve at the root node
35031  *
35032  * @pre This method can be called if SCIP is in one of the following stages:
35033  * - \ref SCIP_STAGE_PRESOLVING
35034  * - \ref SCIP_STAGE_EXITPRESOLVE
35035  * - \ref SCIP_STAGE_PRESOLVED
35036  * - \ref SCIP_STAGE_INITSOLVE
35037  * - \ref SCIP_STAGE_SOLVING
35038  * - \ref SCIP_STAGE_SOLVED
35039  */
35041  SCIP* scip /**< SCIP data structure */
35042  )
35043 {
35044  SCIP_CALL_ABORT( checkStage(scip, "SCIPgetFirstLPDualboundRoot", FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE) );
35045 
35046  return scip->stat->firstlpdualbound;
35047 }
35048 
35049 /** gets lower (dual) bound in transformed problem obtained by the first LP solve at the root node
35050  *
35051  * @return the lower (dual) bound in transformed problem obtained by first LP solve at the root node
35052  *
35053  * @pre This method can be called if SCIP is in one of the following stages:
35054  * - \ref SCIP_STAGE_PRESOLVING
35055  * - \ref SCIP_STAGE_EXITPRESOLVE
35056  * - \ref SCIP_STAGE_PRESOLVED
35057  * - \ref SCIP_STAGE_INITSOLVE
35058  * - \ref SCIP_STAGE_SOLVING
35059  * - \ref SCIP_STAGE_SOLVED
35060  */
35062  SCIP* scip /**< SCIP data structure */
35063  )
35064 {
35065  SCIP_CALL_ABORT( checkStage(scip, "SCIPgetFirstLPLowerboundRoot", FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE) );
35066 
35067  if( scip->stat->firstlpdualbound == SCIP_INVALID ) /*lint !e777*/
35068  return -SCIPinfinity(scip);
35069  else
35070  return SCIPprobInternObjval(scip->transprob, scip->origprob, scip->set, scip->stat->firstlpdualbound);
35071 }
35072 
35073 /** gets global primal bound (objective value of best solution or user objective limit) for the original problem
35074  *
35075  * @return the global primal bound (objective value of best solution or user objective limit) for the original problem
35076  *
35077  * @pre This method can be called if SCIP is in one of the following stages:
35078  * - \ref SCIP_STAGE_TRANSFORMED
35079  * - \ref SCIP_STAGE_INITPRESOLVE
35080  * - \ref SCIP_STAGE_PRESOLVING
35081  * - \ref SCIP_STAGE_EXITPRESOLVE
35082  * - \ref SCIP_STAGE_PRESOLVED
35083  * - \ref SCIP_STAGE_INITSOLVE
35084  * - \ref SCIP_STAGE_SOLVING
35085  * - \ref SCIP_STAGE_SOLVED
35086  * - \ref SCIP_STAGE_EXITSOLVE
35087  */
35089  SCIP* scip /**< SCIP data structure */
35090  )
35091 {
35092  SCIP_CALL_ABORT( checkStage(scip, "SCIPgetPrimalbound", FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE) );
35093 
35094  return getPrimalbound(scip);
35095 }
35096 
35097 /** gets global upper (primal) bound in transformed problem (objective value of best solution or user objective limit)
35098  *
35099  * @return the global upper (primal) bound in transformed problem (objective value of best solution or user objective limit)
35100  *
35101  * @pre This method can be called if SCIP is in one of the following stages:
35102  * - \ref SCIP_STAGE_TRANSFORMED
35103  * - \ref SCIP_STAGE_INITPRESOLVE
35104  * - \ref SCIP_STAGE_PRESOLVING
35105  * - \ref SCIP_STAGE_EXITPRESOLVE
35106  * - \ref SCIP_STAGE_PRESOLVED
35107  * - \ref SCIP_STAGE_INITSOLVE
35108  * - \ref SCIP_STAGE_SOLVING
35109  * - \ref SCIP_STAGE_SOLVED
35110  * - \ref SCIP_STAGE_EXITSOLVE
35111  */
35113  SCIP* scip /**< SCIP data structure */
35114  )
35115 {
35116  SCIP_CALL_ABORT( checkStage(scip, "SCIPgetUpperbound", FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE) );
35117 
35118  return getUpperbound(scip);
35119 }
35120 
35121 /** gets global cutoff bound in transformed problem: a sub problem with lower bound larger than the cutoff
35122  * cannot contain a better feasible solution; usually, this bound is equal to the upper bound, but if the
35123  * objective value is always integral, the cutoff bound is (nearly) one less than the upper bound;
35124  * additionally, due to objective function domain propagation, the cutoff bound can be further reduced
35125  *
35126  * @return global cutoff bound in transformed problem
35127  *
35128  * @pre This method can be called if SCIP is in one of the following stages:
35129  * - \ref SCIP_STAGE_TRANSFORMED
35130  * - \ref SCIP_STAGE_INITPRESOLVE
35131  * - \ref SCIP_STAGE_PRESOLVING
35132  * - \ref SCIP_STAGE_EXITPRESOLVE
35133  * - \ref SCIP_STAGE_PRESOLVED
35134  * - \ref SCIP_STAGE_INITSOLVE
35135  * - \ref SCIP_STAGE_SOLVING
35136  * - \ref SCIP_STAGE_SOLVED
35137  * - \ref SCIP_STAGE_EXITSOLVE
35138  */
35140  SCIP* scip /**< SCIP data structure */
35141  )
35142 {
35143  SCIP_CALL_ABORT( checkStage(scip, "SCIPgetCutoffbound", FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE) );
35144 
35145  return scip->primal->cutoffbound;
35146 }
35147 
35148 /** updates the cutoff bound
35149  *
35150  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
35151  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
35152  *
35153  * @pre This method can be called if SCIP is in one of the following stages:
35154  * - \ref SCIP_STAGE_TRANSFORMED
35155  * - \ref SCIP_STAGE_PRESOLVING
35156  * - \ref SCIP_STAGE_PRESOLVED
35157  * - \ref SCIP_STAGE_INITSOLVE
35158  * - \ref SCIP_STAGE_SOLVING
35159  *
35160  * @note the given cutoff bound has to better or equal to known one (SCIPgetCutoffbound())
35161  * @note a given cutoff bound is also used for updating the objective limit, if possible
35162  */
35164  SCIP* scip, /**< SCIP data structure */
35165  SCIP_Real cutoffbound /**< new cutoff bound */
35166  )
35167 {
35168  SCIP_CALL( checkStage(scip, "SCIPupdateCutoffbound", FALSE, FALSE, FALSE, TRUE, FALSE, TRUE, FALSE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE) );
35169 
35170  assert(cutoffbound <= SCIPgetCutoffbound(scip));
35171 
35172  SCIP_CALL( SCIPprimalSetCutoffbound(scip->primal, scip->mem->probmem, scip->set, scip->stat, scip->eventqueue,
35173  scip->transprob, scip->origprob, scip->tree, scip->lp, cutoffbound, TRUE) );
35174 
35175  return SCIP_OKAY;
35176 }
35177 
35178 
35179 /** returns whether the current primal bound is justified with a feasible primal solution; if not, the primal bound
35180  * was set from the user as objective limit
35181  *
35182  * @return TRUE if the current primal bound is justified with a feasible primal solution, otherwise FALSE
35183  *
35184  * @pre This method can be called if SCIP is in one of the following stages:
35185  * - \ref SCIP_STAGE_TRANSFORMED
35186  * - \ref SCIP_STAGE_INITPRESOLVE
35187  * - \ref SCIP_STAGE_PRESOLVING
35188  * - \ref SCIP_STAGE_EXITPRESOLVE
35189  * - \ref SCIP_STAGE_PRESOLVED
35190  * - \ref SCIP_STAGE_INITSOLVE
35191  * - \ref SCIP_STAGE_SOLVING
35192  * - \ref SCIP_STAGE_SOLVED
35193  * - \ref SCIP_STAGE_EXITSOLVE
35194  */
35196  SCIP* scip /**< SCIP data structure */
35197  )
35198 {
35199  SCIP_CALL_ABORT( checkStage(scip, "SCIPisPrimalboundSol", FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE) );
35200 
35201  return SCIPprimalUpperboundIsSol(scip->primal, scip->set, scip->transprob, scip->origprob);
35202 }
35203 
35204 /** gets current gap |(primalbound - dualbound)/min(|primalbound|,|dualbound|)| if both bounds have same sign,
35205  * or infinity, if they have opposite sign
35206  *
35207  * @return the current gap |(primalbound - dualbound)/min(|primalbound|,|dualbound|)| if both bounds have same sign,
35208  * or infinity, if they have opposite sign
35209  *
35210  * @pre This method can be called if SCIP is in one of the following stages:
35211  * - \ref SCIP_STAGE_PRESOLVING
35212  * - \ref SCIP_STAGE_EXITPRESOLVE
35213  * - \ref SCIP_STAGE_PRESOLVED
35214  * - \ref SCIP_STAGE_SOLVING
35215  * - \ref SCIP_STAGE_SOLVED
35216  */
35218  SCIP* scip /**< SCIP data structure */
35219  )
35220 {
35221  SCIP_Real primalbound;
35222  SCIP_Real dualbound;
35223 
35224  SCIP_CALL_ABORT( checkStage(scip, "SCIPgetGap", FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE) );
35225 
35226  if( SCIPsetIsInfinity(scip->set, getLowerbound(scip)) )
35227  {
35228  /* in case we could not prove whether the problem is unbounded or infeasible, we want to terminate with
35229  * gap = +inf instead of gap = 0
35230  */
35231  if( SCIPgetStatus(scip) == SCIP_STATUS_INFORUNBD )
35232  return SCIPsetInfinity(scip->set);
35233  else
35234  return 0.0;
35235  }
35236 
35237  primalbound = getPrimalbound(scip);
35238  dualbound = getDualbound(scip);
35239 
35240  if( SCIPsetIsEQ(scip->set, primalbound, dualbound) )
35241  return 0.0;
35242  else if( SCIPsetIsZero(scip->set, dualbound)
35243  || SCIPsetIsZero(scip->set, primalbound)
35244  || SCIPsetIsInfinity(scip->set, REALABS(primalbound))
35245  || SCIPsetIsInfinity(scip->set, REALABS(dualbound))
35246  || primalbound * dualbound < 0.0 )
35247  return SCIPsetInfinity(scip->set);
35248  else
35249  {
35250  SCIP_Real absdual = REALABS(dualbound);
35251  SCIP_Real absprimal = REALABS(primalbound);
35252 
35253  return REALABS((primalbound - dualbound)/MIN(absdual, absprimal));
35254  }
35255 }
35256 
35257 /** gets current gap |(upperbound - lowerbound)/min(|upperbound|,|lowerbound|)| in transformed problem if both bounds
35258  * have same sign, or infinity, if they have opposite sign
35259  *
35260  * @return current gap |(upperbound - lowerbound)/min(|upperbound|,|lowerbound|)| in transformed problem if both bounds
35261  * have same sign, or infinity, if they have opposite sign
35262  *
35263  * @pre This method can be called if SCIP is in one of the following stages:
35264  * - \ref SCIP_STAGE_PRESOLVED
35265  * - \ref SCIP_STAGE_SOLVING
35266  * - \ref SCIP_STAGE_SOLVED
35267  */
35269  SCIP* scip /**< SCIP data structure */
35270  )
35271 {
35272  SCIP_Real upperbound;
35273  SCIP_Real lowerbound;
35274 
35275  SCIP_CALL_ABORT( checkStage(scip, "SCIPgetTransGap", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE) );
35276 
35277  upperbound = getUpperbound(scip);
35278  lowerbound = getLowerbound(scip);
35279 
35280  if( SCIPsetIsInfinity(scip->set, lowerbound) )
35281  /* in case we could not prove whether the problem is unbounded or infeasible, we want to terminate with
35282  * gap = +inf instead of gap = 0
35283  */
35284  if( SCIPgetStatus(scip) == SCIP_STATUS_INFORUNBD )
35285  return SCIPsetInfinity(scip->set);
35286  else
35287  return 0.0;
35288  else if( SCIPsetIsEQ(scip->set, upperbound, lowerbound) )
35289  return 0.0;
35290  else if( SCIPsetIsZero(scip->set, lowerbound)
35291  || SCIPsetIsZero(scip->set, upperbound)
35292  || SCIPsetIsInfinity(scip->set, upperbound)
35293  || SCIPsetIsInfinity(scip->set, -lowerbound)
35294  || lowerbound * upperbound < 0.0 )
35295  return SCIPsetInfinity(scip->set);
35296  else
35297  {
35298  SCIP_Real abslower = REALABS(lowerbound);
35299  SCIP_Real absupper = REALABS(upperbound);
35300 
35301  return REALABS((upperbound - lowerbound)/MIN(abslower, absupper));
35302  }
35303 }
35304 
35305 /** gets number of feasible primal solutions found so far
35306  *
35307  * @return the number of feasible primal solutions found so far
35308  *
35309  * @pre This method can be called if SCIP is in one of the following stages:
35310  * - \ref SCIP_STAGE_TRANSFORMED
35311  * - \ref SCIP_STAGE_INITPRESOLVE
35312  * - \ref SCIP_STAGE_PRESOLVING
35313  * - \ref SCIP_STAGE_EXITPRESOLVE
35314  * - \ref SCIP_STAGE_PRESOLVED
35315  * - \ref SCIP_STAGE_INITSOLVE
35316  * - \ref SCIP_STAGE_SOLVING
35317  * - \ref SCIP_STAGE_SOLVED
35318  * - \ref SCIP_STAGE_EXITSOLVE
35319  */
35321  SCIP* scip /**< SCIP data structure */
35322  )
35323 {
35324  SCIP_CALL_ABORT( checkStage(scip, "SCIPgetNSolsFound", FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE) );
35325 
35326  return scip->primal->nsolsfound;
35327 }
35328 
35329 /** gets number of feasible primal solutions respecting the objective limit found so far
35330  *
35331  * @return the number of feasible primal solutions respecting the objective limit found so far
35332  *
35333  * @pre This method can be called if SCIP is in one of the following stages:
35334  * - \ref SCIP_STAGE_TRANSFORMED
35335  * - \ref SCIP_STAGE_INITPRESOLVE
35336  * - \ref SCIP_STAGE_PRESOLVING
35337  * - \ref SCIP_STAGE_EXITPRESOLVE
35338  * - \ref SCIP_STAGE_PRESOLVED
35339  * - \ref SCIP_STAGE_INITSOLVE
35340  * - \ref SCIP_STAGE_SOLVING
35341  * - \ref SCIP_STAGE_SOLVED
35342  * - \ref SCIP_STAGE_EXITSOLVE
35343  */
35345  SCIP* scip /**< SCIP data structure */
35346  )
35347 {
35348  SCIP_CALL_ABORT( checkStage(scip, "SCIPgetNLimSolsFound", FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE) );
35349 
35350  return scip->primal->nlimsolsfound;
35351 }
35352 
35353 /** gets number of feasible primal solutions found so far, that improved the primal bound at the time they were found
35354  *
35355  * @return the number of feasible primal solutions found so far, that improved the primal bound at the time they were found
35356  *
35357  * @pre This method can be called if SCIP is in one of the following stages:
35358  * - \ref SCIP_STAGE_TRANSFORMED
35359  * - \ref SCIP_STAGE_INITPRESOLVE
35360  * - \ref SCIP_STAGE_PRESOLVING
35361  * - \ref SCIP_STAGE_EXITPRESOLVE
35362  * - \ref SCIP_STAGE_PRESOLVED
35363  * - \ref SCIP_STAGE_INITSOLVE
35364  * - \ref SCIP_STAGE_SOLVING
35365  * - \ref SCIP_STAGE_SOLVED
35366  * - \ref SCIP_STAGE_EXITSOLVE
35367  */
35369  SCIP* scip /**< SCIP data structure */
35370  )
35371 {
35372  SCIP_CALL_ABORT( checkStage(scip, "SCIPgetNBestSolsFound", FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE) );
35373 
35374  return scip->primal->nbestsolsfound;
35375 }
35376 
35377 /** gets the average pseudo cost value for the given direction over all variables
35378  *
35379  * @return the average pseudo cost value for the given direction over all variables
35380  *
35381  * @pre This method can be called if SCIP is in one of the following stages:
35382  * - \ref SCIP_STAGE_SOLVING
35383  * - \ref SCIP_STAGE_SOLVED
35384  */
35386  SCIP* scip, /**< SCIP data structure */
35387  SCIP_Real solvaldelta /**< difference of variable's new LP value - old LP value */
35388  )
35389 {
35390  SCIP_CALL_ABORT( checkStage(scip, "SCIPgetAvgPseudocost", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE) );
35391 
35392  return SCIPhistoryGetPseudocost(scip->stat->glbhistory, solvaldelta);
35393 }
35394 
35395 /** gets the average pseudo cost value for the given direction over all variables,
35396  * only using the pseudo cost information of the current run
35397  *
35398  * @return the average pseudo cost value for the given direction over all variables,
35399  * only using the pseudo cost information of the current run
35400  *
35401  * @pre This method can be called if SCIP is in one of the following stages:
35402  * - \ref SCIP_STAGE_SOLVING
35403  * - \ref SCIP_STAGE_SOLVED
35404  */
35406  SCIP* scip, /**< SCIP data structure */
35407  SCIP_Real solvaldelta /**< difference of variable's new LP value - old LP value */
35408  )
35409 {
35410  SCIP_CALL_ABORT( checkStage(scip, "SCIPgetAvgPseudocostCurrentRun", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE) );
35411 
35412  return SCIPhistoryGetPseudocost(scip->stat->glbhistorycrun, solvaldelta);
35413 }
35414 
35415 /** gets the average number of pseudo cost updates for the given direction over all variables
35416  *
35417  * @return the average number of pseudo cost updates for the given direction over all variables
35418  *
35419  * @pre This method can be called if SCIP is in one of the following stages:
35420  * - \ref SCIP_STAGE_SOLVING
35421  * - \ref SCIP_STAGE_SOLVED
35422  */
35424  SCIP* scip, /**< SCIP data structure */
35425  SCIP_BRANCHDIR dir /**< branching direction (downwards, or upwards) */
35426  )
35427 {
35428  SCIP_CALL_ABORT( checkStage(scip, "SCIPgetAvgPseudocostCount", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE) );
35429 
35430  return SCIPhistoryGetPseudocostCount(scip->stat->glbhistory, dir)
35431  / MAX(scip->transprob->nbinvars + scip->transprob->nintvars, 1);
35432 }
35433 
35434 /** gets the average number of pseudo cost updates for the given direction over all variables,
35435  * only using the pseudo cost information of the current run
35436  *
35437  * @return the average number of pseudo cost updates for the given direction over all variables,
35438  * only using the pseudo cost information of the current run
35439  *
35440  * @pre This method can be called if SCIP is in one of the following stages:
35441  * - \ref SCIP_STAGE_SOLVING
35442  * - \ref SCIP_STAGE_SOLVED
35443  */
35445  SCIP* scip, /**< SCIP data structure */
35446  SCIP_BRANCHDIR dir /**< branching direction (downwards, or upwards) */
35447  )
35448 {
35449  SCIP_CALL_ABORT( checkStage(scip, "SCIPgetAvgPseudocostCountCurrentRun", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE) );
35450 
35452  / MAX(scip->transprob->nbinvars + scip->transprob->nintvars, 1);
35453 }
35454 
35455 /** gets the average pseudo cost score value over all variables, assuming a fractionality of 0.5
35456  *
35457  * @return the average pseudo cost score value over all variables, assuming a fractionality of 0.5
35458  *
35459  * @pre This method can be called if SCIP is in one of the following stages:
35460  * - \ref SCIP_STAGE_SOLVING
35461  * - \ref SCIP_STAGE_SOLVED
35462  */
35464  SCIP* scip /**< SCIP data structure */
35465  )
35466 {
35467  SCIP_Real pscostdown;
35468  SCIP_Real pscostup;
35469 
35470  SCIP_CALL_ABORT( checkStage(scip, "SCIPgetAvgPseudocostScore", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE) );
35471 
35472  pscostdown = SCIPhistoryGetPseudocost(scip->stat->glbhistory, -0.5);
35473  pscostup = SCIPhistoryGetPseudocost(scip->stat->glbhistory, +0.5);
35474 
35475  return SCIPbranchGetScore(scip->set, NULL, pscostdown, pscostup);
35476 }
35477 
35478 /** gets the average pseudo cost score value over all variables, assuming a fractionality of 0.5,
35479  * only using the pseudo cost information of the current run
35480  *
35481  * @return the average pseudo cost score value over all variables, assuming a fractionality of 0.5,
35482  * only using the pseudo cost information of the current run
35483  *
35484  * @pre This method can be called if SCIP is in one of the following stages:
35485  * - \ref SCIP_STAGE_SOLVING
35486  * - \ref SCIP_STAGE_SOLVED
35487  */
35489  SCIP* scip /**< SCIP data structure */
35490  )
35491 {
35492  SCIP_Real pscostdown;
35493  SCIP_Real pscostup;
35494 
35495  SCIP_CALL_ABORT( checkStage(scip, "SCIPgetAvgPseudocostScoreCurrentRun", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE) );
35496 
35497  pscostdown = SCIPhistoryGetPseudocost(scip->stat->glbhistorycrun, -0.5);
35498  pscostup = SCIPhistoryGetPseudocost(scip->stat->glbhistorycrun, +0.5);
35499 
35500  return SCIPbranchGetScore(scip->set, NULL, pscostdown, pscostup);
35501 }
35502 
35503 /** gets the average conflict score value over all variables
35504  *
35505  * @return the average conflict score value over all variables
35506  *
35507  * @pre This method can be called if SCIP is in one of the following stages:
35508  * - \ref SCIP_STAGE_SOLVING
35509  * - \ref SCIP_STAGE_SOLVED
35510  */
35512  SCIP* scip /**< SCIP data structure */
35513  )
35514 {
35515  SCIP_Real conflictscoredown;
35516  SCIP_Real conflictscoreup;
35517  SCIP_Real scale;
35518 
35519  SCIP_CALL_ABORT( checkStage(scip, "SCIPgetAvgConflictScore", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE) );
35520 
35521  scale = scip->transprob->nvars * scip->stat->vsidsweight;
35522  conflictscoredown = SCIPhistoryGetVSIDS(scip->stat->glbhistory, SCIP_BRANCHDIR_DOWNWARDS) / scale;
35523  conflictscoreup = SCIPhistoryGetVSIDS(scip->stat->glbhistory, SCIP_BRANCHDIR_UPWARDS) / scale;
35524 
35525  return SCIPbranchGetScore(scip->set, NULL, conflictscoredown, conflictscoreup);
35526 }
35527 
35528 /** gets the average conflict score value over all variables, only using the pseudo cost information of the current run
35529  *
35530  * @return the average conflict score value over all variables, only using the pseudo cost information of the current run
35531  *
35532  * @pre This method can be called if SCIP is in one of the following stages:
35533  * - \ref SCIP_STAGE_SOLVING
35534  * - \ref SCIP_STAGE_SOLVED
35535  */
35537  SCIP* scip /**< SCIP data structure */
35538  )
35539 {
35540  SCIP_Real conflictscoredown;
35541  SCIP_Real conflictscoreup;
35542  SCIP_Real scale;
35543 
35544  SCIP_CALL_ABORT( checkStage(scip, "SCIPgetAvgConflictScoreCurrentRun", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE) );
35545 
35546  scale = scip->transprob->nvars * scip->stat->vsidsweight;
35547  conflictscoredown = SCIPhistoryGetVSIDS(scip->stat->glbhistorycrun, SCIP_BRANCHDIR_DOWNWARDS) / scale;
35548  conflictscoreup = SCIPhistoryGetVSIDS(scip->stat->glbhistorycrun, SCIP_BRANCHDIR_UPWARDS) / scale;
35549 
35550  return SCIPbranchGetScore(scip->set, NULL, conflictscoredown, conflictscoreup);
35551 }
35552 
35553 /** gets the average inference score value over all variables
35554  *
35555  * @return the average inference score value over all variables
35556  *
35557  * @pre This method can be called if SCIP is in one of the following stages:
35558  * - \ref SCIP_STAGE_SOLVING
35559  * - \ref SCIP_STAGE_SOLVED
35560  */
35562  SCIP* scip /**< SCIP data structure */
35563  )
35564 {
35565  SCIP_Real conflictlengthdown;
35566  SCIP_Real conflictlengthup;
35567 
35568  SCIP_CALL_ABORT( checkStage(scip, "SCIPgetAvgConflictlengthScore", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE) );
35569 
35572 
35573  return SCIPbranchGetScore(scip->set, NULL, conflictlengthdown, conflictlengthup);
35574 }
35575 
35576 /** gets the average conflictlength score value over all variables, only using the pseudo cost information of the
35577  * current run
35578  *
35579  * @return the average conflictlength score value over all variables, only using the pseudo cost information of the
35580  * current run
35581  *
35582  * @pre This method can be called if SCIP is in one of the following stages:
35583  * - \ref SCIP_STAGE_SOLVING
35584  * - \ref SCIP_STAGE_SOLVED
35585  */
35587  SCIP* scip /**< SCIP data structure */
35588  )
35589 {
35590  SCIP_Real conflictlengthdown;
35591  SCIP_Real conflictlengthup;
35592 
35593  SCIP_CALL_ABORT( checkStage(scip, "SCIPgetAvgConflictlengthScoreCurrentRun", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE) );
35594 
35597 
35598  return SCIPbranchGetScore(scip->set, NULL, conflictlengthdown, conflictlengthup);
35599 }
35600 
35601 /** returns the average number of inferences found after branching in given direction over all variables
35602  *
35603  * @return the average number of inferences found after branching in given direction over all variables
35604  *
35605  * @pre This method can be called if SCIP is in one of the following stages:
35606  * - \ref SCIP_STAGE_SOLVING
35607  * - \ref SCIP_STAGE_SOLVED
35608  */
35610  SCIP* scip, /**< SCIP data structure */
35611  SCIP_BRANCHDIR dir /**< branching direction (downwards, or upwards) */
35612  )
35613 {
35614  SCIP_CALL_ABORT( checkStage(scip, "SCIPgetAvgInferences", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE) );
35615 
35616  return SCIPhistoryGetAvgInferences(scip->stat->glbhistory, dir);
35617 }
35618 
35619 /** returns the average number of inferences found after branching in given direction over all variables,
35620  * only using the pseudo cost information of the current run
35621  *
35622  * @return the average number of inferences found after branching in given direction over all variables,
35623  * only using the pseudo cost information of the current run
35624  *
35625  * @pre This method can be called if SCIP is in one of the following stages:
35626  * - \ref SCIP_STAGE_SOLVING
35627  * - \ref SCIP_STAGE_SOLVED
35628  */
35630  SCIP* scip, /**< SCIP data structure */
35631  SCIP_BRANCHDIR dir /**< branching direction (downwards, or upwards) */
35632  )
35633 {
35634  SCIP_CALL_ABORT( checkStage(scip, "SCIPgetAvgInferencesCurrentRun", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE) );
35635 
35636  return SCIPhistoryGetAvgInferences(scip->stat->glbhistorycrun, dir);
35637 }
35638 
35639 /** gets the average inference score value over all variables
35640  *
35641  * @return the average inference score value over all variables
35642  *
35643  * @pre This method can be called if SCIP is in one of the following stages:
35644  * - \ref SCIP_STAGE_SOLVING
35645  * - \ref SCIP_STAGE_SOLVED
35646  */
35648  SCIP* scip /**< SCIP data structure */
35649  )
35650 {
35651  SCIP_Real inferencesdown;
35652  SCIP_Real inferencesup;
35653 
35654  SCIP_CALL_ABORT( checkStage(scip, "SCIPgetAvgInferenceScore", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE) );
35655 
35658 
35659  return SCIPbranchGetScore(scip->set, NULL, inferencesdown, inferencesup);
35660 }
35661 
35662 /** gets the average inference score value over all variables, only using the inference information information of the
35663  * current run
35664  *
35665  * @return the average inference score value over all variables, only using the inference information information of the
35666  * current run
35667  *
35668  * @pre This method can be called if SCIP is in one of the following stages:
35669  * - \ref SCIP_STAGE_SOLVING
35670  * - \ref SCIP_STAGE_SOLVED
35671  */
35673  SCIP* scip /**< SCIP data structure */
35674  )
35675 {
35676  SCIP_Real inferencesdown;
35677  SCIP_Real inferencesup;
35678 
35679  SCIP_CALL_ABORT( checkStage(scip, "SCIPgetAvgInferenceScoreCurrentRun", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE) );
35680 
35683 
35684  return SCIPbranchGetScore(scip->set, NULL, inferencesdown, inferencesup);
35685 }
35686 
35687 /** returns the average number of cutoffs found after branching in given direction over all variables
35688  *
35689  * @return the average number of cutoffs found after branching in given direction over all variables
35690  *
35691  * @pre This method can be called if SCIP is in one of the following stages:
35692  * - \ref SCIP_STAGE_SOLVING
35693  * - \ref SCIP_STAGE_SOLVED
35694  */
35696  SCIP* scip, /**< SCIP data structure */
35697  SCIP_BRANCHDIR dir /**< branching direction (downwards, or upwards) */
35698  )
35699 {
35700  SCIP_CALL_ABORT( checkStage(scip, "SCIPgetAvgCutoffs", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE) );
35701 
35702  return SCIPhistoryGetAvgCutoffs(scip->stat->glbhistory, dir);
35703 }
35704 
35705 /** returns the average number of cutoffs found after branching in given direction over all variables,
35706  * only using the pseudo cost information of the current run
35707  *
35708  * @return the average number of cutoffs found after branching in given direction over all variables,
35709  * only using the pseudo cost information of the current run
35710  *
35711  * @pre This method can be called if SCIP is in one of the following stages:
35712  * - \ref SCIP_STAGE_SOLVING
35713  * - \ref SCIP_STAGE_SOLVED
35714  */
35716  SCIP* scip, /**< SCIP data structure */
35717  SCIP_BRANCHDIR dir /**< branching direction (downwards, or upwards) */
35718  )
35719 {
35720  SCIP_CALL_ABORT( checkStage(scip, "SCIPgetAvgCutoffsCurrentRun", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE) );
35721 
35722  return SCIPhistoryGetAvgCutoffs(scip->stat->glbhistorycrun, dir);
35723 }
35724 
35725 /** gets the average cutoff score value over all variables
35726  *
35727  * @return the average cutoff score value over all variables
35728  *
35729  * @pre This method can be called if SCIP is in one of the following stages:
35730  * - \ref SCIP_STAGE_SOLVING
35731  * - \ref SCIP_STAGE_SOLVED
35732  */
35734  SCIP* scip /**< SCIP data structure */
35735  )
35736 {
35737  SCIP_Real cutoffsdown;
35738  SCIP_Real cutoffsup;
35739 
35740  SCIP_CALL_ABORT( checkStage(scip, "SCIPgetAvgCutoffScore", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE) );
35741 
35744 
35745  return SCIPbranchGetScore(scip->set, NULL, cutoffsdown, cutoffsup);
35746 }
35747 
35748 /** gets the average cutoff score value over all variables, only using the pseudo cost information of the current run
35749  *
35750  * @return the average cutoff score value over all variables, only using the pseudo cost information of the current run
35751  *
35752  * @pre This method can be called if SCIP is in one of the following stages:
35753  * - \ref SCIP_STAGE_SOLVING
35754  * - \ref SCIP_STAGE_SOLVED
35755  */
35757  SCIP* scip /**< SCIP data structure */
35758  )
35759 {
35760  SCIP_Real cutoffsdown;
35761  SCIP_Real cutoffsup;
35762 
35763  SCIP_CALL_ABORT( checkStage(scip, "SCIPgetAvgCutoffScoreCurrentRun", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE) );
35764 
35767 
35768  return SCIPbranchGetScore(scip->set, NULL, cutoffsdown, cutoffsup);
35769 }
35770 
35771 /** outputs problem to file stream */
35772 static
35774  SCIP* scip, /**< SCIP data structure */
35775  SCIP_PROB* prob, /**< problem data */
35776  FILE* file, /**< output file (or NULL for standard output) */
35777  const char* extension, /**< file format (or NULL for default CIP format) */
35778  SCIP_Bool genericnames /**< using generic variable and constraint names? */
35779  )
35780 {
35781  SCIP_RESULT result;
35782  int i;
35783  assert(scip != NULL);
35784  assert(prob != NULL);
35785 
35786  /* try all readers until one could read the file */
35787  result = SCIP_DIDNOTRUN;
35788  for( i = 0; i < scip->set->nreaders && result == SCIP_DIDNOTRUN; ++i )
35789  {
35790  SCIP_RETCODE retcode;
35791 
35792  if( extension != NULL )
35793  retcode = SCIPreaderWrite(scip->set->readers[i], prob, scip->set, file, extension, genericnames, &result);
35794  else
35795  retcode = SCIPreaderWrite(scip->set->readers[i], prob, scip->set, file, "cip", genericnames, &result);
35796 
35797  /* check for reader errors */
35798  if( retcode == SCIP_WRITEERROR )
35799  return retcode;
35800 
35801  SCIP_CALL( retcode );
35802  }
35803 
35804  switch( result )
35805  {
35806  case SCIP_DIDNOTRUN:
35807  return SCIP_PLUGINNOTFOUND;
35808 
35809  case SCIP_SUCCESS:
35810  return SCIP_OKAY;
35811 
35812  default:
35813  assert(i < scip->set->nreaders);
35814  SCIPerrorMessage("invalid result code <%d> from reader <%s> writing <%s> format\n",
35815  result, SCIPreaderGetName(scip->set->readers[i]), extension);
35816  return SCIP_READERROR;
35817  } /*lint !e788*/
35818 }
35819 
35820 /** outputs original problem to file stream
35821  *
35822  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
35823  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
35824  *
35825  * @pre This method can be called if SCIP is in one of the following stages:
35826  * - \ref SCIP_STAGE_PROBLEM
35827  * - \ref SCIP_STAGE_TRANSFORMING
35828  * - \ref SCIP_STAGE_TRANSFORMED
35829  * - \ref SCIP_STAGE_INITPRESOLVE
35830  * - \ref SCIP_STAGE_PRESOLVING
35831  * - \ref SCIP_STAGE_EXITPRESOLVE
35832  * - \ref SCIP_STAGE_PRESOLVED
35833  * - \ref SCIP_STAGE_INITSOLVE
35834  * - \ref SCIP_STAGE_SOLVING
35835  * - \ref SCIP_STAGE_SOLVED
35836  * - \ref SCIP_STAGE_EXITSOLVE
35837  * - \ref SCIP_STAGE_FREETRANS
35838  */
35840  SCIP* scip, /**< SCIP data structure */
35841  FILE* file, /**< output file (or NULL for standard output) */
35842  const char* extension, /**< file format (or NULL for default CIP format)*/
35843  SCIP_Bool genericnames /**< using generic variable and constraint names? */
35844  )
35845 {
35846  SCIP_RETCODE retcode;
35847 
35848  SCIP_CALL( checkStage(scip, "SCIPprintOrigProblem", FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE) );
35849 
35850  assert(scip != NULL);
35851  assert( scip->origprob != NULL );
35852 
35853  retcode = printProblem(scip, scip->origprob, file, extension, genericnames);
35854 
35855  /* check for write errors */
35856  if( retcode == SCIP_WRITEERROR || retcode == SCIP_PLUGINNOTFOUND )
35857  return retcode;
35858  else
35859  {
35860  SCIP_CALL( retcode );
35861  }
35862 
35863  return SCIP_OKAY;
35864 }
35865 
35866 /** outputs transformed problem of the current node to file stream
35867  *
35868  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
35869  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
35870  *
35871  * @pre This method can be called if SCIP is in one of the following stages:
35872  * - \ref SCIP_STAGE_TRANSFORMED
35873  * - \ref SCIP_STAGE_INITPRESOLVE
35874  * - \ref SCIP_STAGE_PRESOLVING
35875  * - \ref SCIP_STAGE_EXITPRESOLVE
35876  * - \ref SCIP_STAGE_PRESOLVED
35877  * - \ref SCIP_STAGE_INITSOLVE
35878  * - \ref SCIP_STAGE_SOLVING
35879  * - \ref SCIP_STAGE_SOLVED
35880  * - \ref SCIP_STAGE_EXITSOLVE
35881  * - \ref SCIP_STAGE_FREETRANS
35882  */
35884  SCIP* scip, /**< SCIP data structure */
35885  FILE* file, /**< output file (or NULL for standard output) */
35886  const char* extension, /**< file format (or NULL for default CIP format)*/
35887  SCIP_Bool genericnames /**< using generic variable and constraint names? */
35888  )
35889 {
35890  SCIP_RETCODE retcode;
35891 
35892  SCIP_CALL( checkStage(scip, "SCIPprintTransProblem", FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE) );
35893 
35894  assert(scip != NULL);
35895  assert(scip->transprob != NULL );
35896 
35897  retcode = printProblem(scip, scip->transprob, file, extension, genericnames);
35898 
35899  /* check for write errors */
35900  if( retcode == SCIP_WRITEERROR || retcode == SCIP_PLUGINNOTFOUND )
35901  return retcode;
35902  else
35903  {
35904  SCIP_CALL( retcode );
35905  }
35906 
35907  return SCIP_OKAY;
35908 }
35909 
35910 static
35912  SCIP* scip, /**< SCIP data structure */
35913  FILE* file /**< output file */
35914  )
35915 {
35916  int i;
35917 
35918  assert(scip != NULL);
35919  assert(scip->set != NULL);
35920 
35921  SCIPmessageFPrintInfo(scip->messagehdlr, file, "Presolvers : ExecTime SetupTime Calls FixedVars AggrVars ChgTypes ChgBounds AddHoles DelCons AddCons ChgSides ChgCoefs\n");
35922 
35923  /* sort presolvers w.r.t. their name */
35924  SCIPsetSortPresolsName(scip->set);
35925 
35926  /* presolver statistics */
35927  for( i = 0; i < scip->set->npresols; ++i )
35928  {
35929  SCIP_PRESOL* presol;
35930  presol = scip->set->presols[i];
35931  SCIPmessageFPrintInfo(scip->messagehdlr, file, " %-17.17s:", SCIPpresolGetName(presol));
35932  SCIPmessageFPrintInfo(scip->messagehdlr, file, " %10.2f %10.2f %6d %10d %10d %10d %10d %10d %10d %10d %10d %10d\n",
35933  SCIPpresolGetTime(presol),
35934  SCIPpresolGetSetupTime(presol),
35935  SCIPpresolGetNCalls(presol),
35936  SCIPpresolGetNFixedVars(presol),
35937  SCIPpresolGetNAggrVars(presol),
35938  SCIPpresolGetNChgVarTypes(presol),
35939  SCIPpresolGetNChgBds(presol),
35940  SCIPpresolGetNAddHoles(presol),
35941  SCIPpresolGetNDelConss(presol),
35942  SCIPpresolGetNAddConss(presol),
35943  SCIPpresolGetNChgSides(presol),
35944  SCIPpresolGetNChgCoefs(presol));
35945  }
35946 
35947  /* sort propagators w.r.t. their name */
35948  SCIPsetSortPropsName(scip->set);
35949 
35950  for( i = 0; i < scip->set->nprops; ++i )
35951  {
35952  SCIP_PROP* prop;
35953  prop = scip->set->props[i];
35954  if( SCIPpropDoesPresolve(prop)
35955 #if 0
35956  && ( SCIPpropGetNFixedVars(prop) > 0
35957  || SCIPpropGetNAggrVars(prop) > 0
35958  || SCIPpropGetNChgVarTypes(prop) > 0
35959  || SCIPpropGetNChgBds(prop) > 0
35960  || SCIPpropGetNAddHoles(prop) > 0
35961  || SCIPpropGetNDelConss(prop) > 0
35962  || SCIPpropGetNAddConss(prop) > 0
35963  || SCIPpropGetNChgSides(prop) > 0
35964  || SCIPpropGetNChgCoefs(prop) > 0
35965  || SCIPpropGetNUpgdConss(prop) > 0)
35966 #endif
35967  )
35968  {
35969  SCIPmessageFPrintInfo(scip->messagehdlr, file, " %-17.17s:", SCIPpropGetName(prop));
35970  SCIPmessageFPrintInfo(scip->messagehdlr, file, " %10.2f %10.2f %6d %10d %10d %10d %10d %10d %10d %10d %10d %10d\n",
35971  SCIPpropGetPresolTime(prop),
35972  SCIPpropGetSetupTime(prop),
35974  SCIPpropGetNFixedVars(prop),
35975  SCIPpropGetNAggrVars(prop),
35977  SCIPpropGetNChgBds(prop),
35978  SCIPpropGetNAddHoles(prop),
35979  SCIPpropGetNDelConss(prop),
35980  SCIPpropGetNAddConss(prop),
35981  SCIPpropGetNChgSides(prop),
35982  SCIPpropGetNChgCoefs(prop));
35983  }
35984  }
35985 
35986  /* constraint handler presolving methods statistics */
35987  for( i = 0; i < scip->set->nconshdlrs; ++i )
35988  {
35989  SCIP_CONSHDLR* conshdlr;
35990  int maxnactiveconss;
35991 
35992  conshdlr = scip->set->conshdlrs[i];
35993  maxnactiveconss = SCIPconshdlrGetMaxNActiveConss(conshdlr);
35994  if( SCIPconshdlrDoesPresolve(conshdlr)
35995  && (maxnactiveconss > 0 || !SCIPconshdlrNeedsCons(conshdlr)
35996  || SCIPconshdlrGetNFixedVars(conshdlr) > 0
35997  || SCIPconshdlrGetNAggrVars(conshdlr) > 0
35998  || SCIPconshdlrGetNChgVarTypes(conshdlr) > 0
35999  || SCIPconshdlrGetNChgBds(conshdlr) > 0
36000  || SCIPconshdlrGetNAddHoles(conshdlr) > 0
36001  || SCIPconshdlrGetNDelConss(conshdlr) > 0
36002  || SCIPconshdlrGetNAddConss(conshdlr) > 0
36003  || SCIPconshdlrGetNChgSides(conshdlr) > 0
36004  || SCIPconshdlrGetNChgCoefs(conshdlr) > 0
36005  || SCIPconshdlrGetNUpgdConss(conshdlr) > 0) )
36006  {
36007  SCIPmessageFPrintInfo(scip->messagehdlr, file, " %-17.17s:", SCIPconshdlrGetName(conshdlr));
36008  SCIPmessageFPrintInfo(scip->messagehdlr, file, " %10.2f %10.2f %6d %10d %10d %10d %10d %10d %10d %10d %10d %10d\n",
36009  SCIPconshdlrGetPresolTime(conshdlr),
36010  SCIPconshdlrGetSetupTime(conshdlr),
36011  SCIPconshdlrGetNPresolCalls(conshdlr),
36012  SCIPconshdlrGetNFixedVars(conshdlr),
36013  SCIPconshdlrGetNAggrVars(conshdlr),
36014  SCIPconshdlrGetNChgVarTypes(conshdlr),
36015  SCIPconshdlrGetNChgBds(conshdlr),
36016  SCIPconshdlrGetNAddHoles(conshdlr),
36017  SCIPconshdlrGetNDelConss(conshdlr),
36018  SCIPconshdlrGetNAddConss(conshdlr),
36019  SCIPconshdlrGetNChgSides(conshdlr),
36020  SCIPconshdlrGetNChgCoefs(conshdlr));
36021  }
36022  }
36023 
36024  /* root node bound changes */
36025  SCIPmessageFPrintInfo(scip->messagehdlr, file, " root node : - - - %10d - - %10d - - - - -\n",
36026  scip->stat->nrootintfixings, scip->stat->nrootboundchgs);
36027 }
36028 
36029 /** print constraint statistics to output file */
36030 static
36032  SCIP* scip, /**< SCIP data structure */
36033  FILE* file /**< output file */
36034  )
36035 {
36036  int i;
36037 
36038  assert(scip != NULL);
36039  assert(scip->set != NULL);
36040 
36041  /* Add maximal number of constraints of the same type? So far this information is not added because of lack of space. */
36042  SCIPmessageFPrintInfo(scip->messagehdlr, file, "Constraints : Number MaxNumber #Separate #Propagate #EnfoLP #EnfoPS #Check #ResProp Cutoffs DomReds Cuts Applied Conss Children\n");
36043 
36044  for( i = 0; i < scip->set->nconshdlrs; ++i )
36045  {
36046  SCIP_CONSHDLR* conshdlr;
36047  int startnactiveconss;
36048  int maxnactiveconss;
36049 
36050  conshdlr = scip->set->conshdlrs[i];
36051  startnactiveconss = SCIPconshdlrGetStartNActiveConss(conshdlr);
36052  maxnactiveconss = SCIPconshdlrGetMaxNActiveConss(conshdlr);
36053  if( maxnactiveconss > 0 || !SCIPconshdlrNeedsCons(conshdlr) )
36054  {
36055  SCIPmessageFPrintInfo(scip->messagehdlr, file, " %-17.17s:", SCIPconshdlrGetName(conshdlr));
36056  SCIPmessageFPrintInfo(scip->messagehdlr, file, " %10d%c%10d %10"SCIP_LONGINT_FORMAT" %10"SCIP_LONGINT_FORMAT" %10"SCIP_LONGINT_FORMAT" %10"SCIP_LONGINT_FORMAT" %10"SCIP_LONGINT_FORMAT" %10"SCIP_LONGINT_FORMAT" %10"SCIP_LONGINT_FORMAT" %10"SCIP_LONGINT_FORMAT" %10"SCIP_LONGINT_FORMAT" %10"SCIP_LONGINT_FORMAT" %10"SCIP_LONGINT_FORMAT" %10"SCIP_LONGINT_FORMAT"\n",
36057  startnactiveconss,
36058  maxnactiveconss > startnactiveconss ? '+' : ' ',
36059  maxnactiveconss,
36060  SCIPconshdlrGetNSepaCalls(conshdlr),
36061  SCIPconshdlrGetNPropCalls(conshdlr),
36062  SCIPconshdlrGetNEnfoLPCalls(conshdlr),
36063  SCIPconshdlrGetNEnfoPSCalls(conshdlr),
36064  SCIPconshdlrGetNCheckCalls(conshdlr),
36065  SCIPconshdlrGetNRespropCalls(conshdlr),
36066  SCIPconshdlrGetNCutoffs(conshdlr),
36067  SCIPconshdlrGetNDomredsFound(conshdlr),
36068  SCIPconshdlrGetNCutsFound(conshdlr),
36069  SCIPconshdlrGetNCutsApplied(conshdlr),
36070  SCIPconshdlrGetNConssFound(conshdlr),
36071  SCIPconshdlrGetNChildren(conshdlr));
36072  }
36073  }
36074 }
36075 
36076 /** print constraint timing statistics to output file */
36077 static
36079  SCIP* scip, /**< SCIP data structure */
36080  FILE* file /**< output file */
36081  )
36082 {
36083  int i;
36084 
36085  assert(scip != NULL);
36086  assert(scip->set != NULL);
36087 
36088  SCIPmessageFPrintInfo(scip->messagehdlr, file, "Constraint Timings : TotalTime SetupTime Separate Propagate EnfoLP EnfoPS Check ResProp SB-Prop\n");
36089 
36090  for( i = 0; i < scip->set->nconshdlrs; ++i )
36091  {
36092  SCIP_CONSHDLR* conshdlr;
36093  int maxnactiveconss;
36094 
36095  conshdlr = scip->set->conshdlrs[i];
36096  maxnactiveconss = SCIPconshdlrGetMaxNActiveConss(conshdlr);
36097  if( maxnactiveconss > 0 || !SCIPconshdlrNeedsCons(conshdlr) )
36098  {
36099  SCIP_Real totaltime;
36100 
36101  totaltime = SCIPconshdlrGetSepaTime(conshdlr) + SCIPconshdlrGetPropTime(conshdlr)
36103  + SCIPconshdlrGetEnfoLPTime(conshdlr)
36104  + SCIPconshdlrGetEnfoPSTime(conshdlr)
36105  + SCIPconshdlrGetCheckTime(conshdlr)
36106  + SCIPconshdlrGetRespropTime(conshdlr)
36107  + SCIPconshdlrGetSetupTime(conshdlr);
36108 
36109  SCIPmessageFPrintInfo(scip->messagehdlr, file, " %-17.17s:", SCIPconshdlrGetName(conshdlr));
36110  SCIPmessageFPrintInfo(scip->messagehdlr, file, " %10.2f %10.2f %10.2f %10.2f %10.2f %10.2f %10.2f %10.2f %10.2f\n",
36111  totaltime,
36112  SCIPconshdlrGetSetupTime(conshdlr),
36113  SCIPconshdlrGetSepaTime(conshdlr),
36114  SCIPconshdlrGetPropTime(conshdlr),
36115  SCIPconshdlrGetEnfoLPTime(conshdlr),
36116  SCIPconshdlrGetEnfoPSTime(conshdlr),
36117  SCIPconshdlrGetCheckTime(conshdlr),
36118  SCIPconshdlrGetRespropTime(conshdlr),
36120  }
36121  }
36122 }
36123 
36124 /** print propagator statistics to output file */
36125 static
36127  SCIP* scip, /**< SCIP data structure */
36128  FILE* file /**< output file */
36129  )
36130 {
36131  int i;
36132 
36133  assert(scip != NULL);
36134  assert(scip->set != NULL);
36135 
36136  SCIPmessageFPrintInfo(scip->messagehdlr, file, "Propagators : #Propagate #ResProp Cutoffs DomReds\n");
36137 
36138  /* sort propagaters w.r.t. their name */
36139  SCIPsetSortPropsName(scip->set);
36140 
36141  for( i = 0; i < scip->set->nprops; ++i )
36142  {
36143  SCIP_PROP* prop;
36144  prop = scip->set->props[i];
36145 
36146  SCIPmessageFPrintInfo(scip->messagehdlr, file, " %-17.17s: %10"SCIP_LONGINT_FORMAT" %10"SCIP_LONGINT_FORMAT" %10"SCIP_LONGINT_FORMAT" %10"SCIP_LONGINT_FORMAT"\n",
36147  SCIPpropGetName(prop),
36148  SCIPpropGetNCalls(prop),
36150  SCIPpropGetNCutoffs(prop),
36151  SCIPpropGetNDomredsFound(prop));
36152  }
36153 
36154  SCIPmessageFPrintInfo(scip->messagehdlr, file, "Propagator Timings : TotalTime SetupTime Presolve Propagate ResProp SB-Prop\n");
36155 
36156  for( i = 0; i < scip->set->nprops; ++i )
36157  {
36158  SCIP_PROP* prop;
36159  SCIP_Real totaltime;
36160 
36161  prop = scip->set->props[i];
36162  totaltime = SCIPpropGetPresolTime(prop) + SCIPpropGetTime(prop) + SCIPpropGetRespropTime(prop)
36164 
36165  SCIPmessageFPrintInfo(scip->messagehdlr, file, " %-17.17s:", SCIPpropGetName(prop));
36166  SCIPmessageFPrintInfo(scip->messagehdlr, file, " %10.2f %10.2f %10.2f %10.2f %10.2f %10.2f\n",
36167  totaltime,
36168  SCIPpropGetSetupTime(prop),
36169  SCIPpropGetPresolTime(prop),
36170  SCIPpropGetTime(prop),
36171  SCIPpropGetRespropTime(prop),
36173  }
36174 }
36175 
36176 /** print conflict statistic to given output stream */
36177 static
36179  SCIP* scip, /**< SCIP data structure */
36180  FILE* file /**< output file */
36181  )
36182 {
36183  SCIPmessageFPrintInfo(scip->messagehdlr, file, "Conflict Analysis : Time Calls Success DomReds Conflicts Literals Reconvs ReconvLits LP Iters\n");
36184  SCIPmessageFPrintInfo(scip->messagehdlr, file, " propagation : %10.2f %10"SCIP_LONGINT_FORMAT" %10"SCIP_LONGINT_FORMAT" - %10"SCIP_LONGINT_FORMAT" %10.1f %10"SCIP_LONGINT_FORMAT" %10.1f -\n",
36196  SCIPmessageFPrintInfo(scip->messagehdlr, file, " infeasible LP : %10.2f %10"SCIP_LONGINT_FORMAT" %10"SCIP_LONGINT_FORMAT" - %10"SCIP_LONGINT_FORMAT" %10.1f %10"SCIP_LONGINT_FORMAT" %10.1f %10"SCIP_LONGINT_FORMAT"\n",
36209  SCIPmessageFPrintInfo(scip->messagehdlr, file, " bound exceed. LP : %10.2f %10"SCIP_LONGINT_FORMAT" %10"SCIP_LONGINT_FORMAT" - %10"SCIP_LONGINT_FORMAT" %10.1f %10"SCIP_LONGINT_FORMAT" %10.1f %10"SCIP_LONGINT_FORMAT"\n",
36222  SCIPmessageFPrintInfo(scip->messagehdlr, file, " strong branching : %10.2f %10"SCIP_LONGINT_FORMAT" %10"SCIP_LONGINT_FORMAT" - %10"SCIP_LONGINT_FORMAT" %10.1f %10"SCIP_LONGINT_FORMAT" %10.1f %10"SCIP_LONGINT_FORMAT"\n",
36235  SCIPmessageFPrintInfo(scip->messagehdlr, file, " pseudo solution : %10.2f %10"SCIP_LONGINT_FORMAT" %10"SCIP_LONGINT_FORMAT" - %10"SCIP_LONGINT_FORMAT" %10.1f %10"SCIP_LONGINT_FORMAT" %10.1f -\n",
36247  SCIPmessageFPrintInfo(scip->messagehdlr, file, " applied globally : %10.2f - - %10"SCIP_LONGINT_FORMAT" %10"SCIP_LONGINT_FORMAT" %10.1f - - -\n",
36254  SCIPmessageFPrintInfo(scip->messagehdlr, file, " applied locally : - - - %10"SCIP_LONGINT_FORMAT" %10"SCIP_LONGINT_FORMAT" %10.1f - - -\n",
36260 }
36261 
36262 static
36264  SCIP* scip, /**< SCIP data structure */
36265  FILE* file /**< output file */
36266  )
36267 {
36268  int i;
36269 
36270  assert(scip != NULL);
36271  assert(scip->set != NULL);
36272 
36273  SCIPmessageFPrintInfo(scip->messagehdlr, file, "Separators : ExecTime SetupTime Calls Cutoffs DomReds Cuts Applied Conss\n");
36274  SCIPmessageFPrintInfo(scip->messagehdlr, file, " cut pool : %10.2f %10"SCIP_LONGINT_FORMAT" - - %10"SCIP_LONGINT_FORMAT" - - (maximal pool size: %d)\n",
36275  SCIPcutpoolGetTime(scip->cutpool),
36279 
36280  /* sort separators w.r.t. their name */
36281  SCIPsetSortSepasName(scip->set);
36282 
36283  for( i = 0; i < scip->set->nsepas; ++i )
36284  {
36285  SCIPmessageFPrintInfo(scip->messagehdlr, file, " %-17.17s: %10.2f %10.2f %10"SCIP_LONGINT_FORMAT" %10"SCIP_LONGINT_FORMAT" %10"SCIP_LONGINT_FORMAT" %10"SCIP_LONGINT_FORMAT" %10"SCIP_LONGINT_FORMAT" %10"SCIP_LONGINT_FORMAT"\n",
36286  SCIPsepaGetName(scip->set->sepas[i]),
36287  SCIPsepaGetTime(scip->set->sepas[i]),
36288  SCIPsepaGetSetupTime(scip->set->sepas[i]),
36289  SCIPsepaGetNCalls(scip->set->sepas[i]),
36290  SCIPsepaGetNCutoffs(scip->set->sepas[i]),
36291  SCIPsepaGetNDomredsFound(scip->set->sepas[i]),
36292  SCIPsepaGetNCutsFound(scip->set->sepas[i]),
36293  SCIPsepaGetNCutsApplied(scip->set->sepas[i]),
36294  SCIPsepaGetNConssFound(scip->set->sepas[i]));
36295  }
36296 }
36297 
36298 static
36300  SCIP* scip, /**< SCIP data structure */
36301  FILE* file /**< output file */
36302  )
36303 {
36304  int i;
36305 
36306  assert(scip != NULL);
36307  assert(scip->set != NULL);
36308 
36309  SCIPmessageFPrintInfo(scip->messagehdlr, file, "Pricers : ExecTime SetupTime Calls Vars\n");
36310  SCIPmessageFPrintInfo(scip->messagehdlr, file, " problem variables: %10.2f - %10d %10d\n",
36314 
36315  /* sort pricers w.r.t. their name */
36316  SCIPsetSortPricersName(scip->set);
36317 
36318  for( i = 0; i < scip->set->nactivepricers; ++i )
36319  {
36320  SCIPmessageFPrintInfo(scip->messagehdlr, file, " %-17.17s: %10.2f %10.2f %10d %10d\n",
36321  SCIPpricerGetName(scip->set->pricers[i]),
36322  SCIPpricerGetTime(scip->set->pricers[i]),
36323  SCIPpricerGetSetupTime(scip->set->pricers[i]),
36324  SCIPpricerGetNCalls(scip->set->pricers[i]),
36325  SCIPpricerGetNVarsFound(scip->set->pricers[i]));
36326  }
36327 }
36328 
36329 static
36331  SCIP* scip, /**< SCIP data structure */
36332  FILE* file /**< output file */
36333  )
36334 {
36335  int i;
36336 
36337  assert(scip != NULL);
36338  assert(scip->set != NULL);
36339 
36340  SCIPmessageFPrintInfo(scip->messagehdlr, file, "Branching Rules : ExecTime SetupTime BranchLP BranchExt BranchPS Cutoffs DomReds Cuts Conss Children\n");
36341 
36342  /* sort branching rules w.r.t. their name */
36344 
36345  for( i = 0; i < scip->set->nbranchrules; ++i )
36346  {
36347  SCIPmessageFPrintInfo(scip->messagehdlr, file, " %-17.17s: %10.2f %10.2f %10"SCIP_LONGINT_FORMAT" %10"SCIP_LONGINT_FORMAT" %10"SCIP_LONGINT_FORMAT" %10"SCIP_LONGINT_FORMAT" %10"SCIP_LONGINT_FORMAT" %10"SCIP_LONGINT_FORMAT" %10"SCIP_LONGINT_FORMAT" %10"SCIP_LONGINT_FORMAT"\n",
36359  }
36360 }
36361 
36362 static
36364  SCIP* scip, /**< SCIP data structure */
36365  FILE* file /**< output file */
36366  )
36367 {
36368  int i;
36369 
36370  assert(scip != NULL);
36371  assert(scip->set != NULL);
36372  assert(scip->tree != NULL);
36373 
36374  SCIPmessageFPrintInfo(scip->messagehdlr, file, "Primal Heuristics : ExecTime SetupTime Calls Found\n");
36375  SCIPmessageFPrintInfo(scip->messagehdlr, file, " LP solutions : %10.2f - - %10"SCIP_LONGINT_FORMAT"\n",
36377  scip->stat->nlpsolsfound);
36378  SCIPmessageFPrintInfo(scip->messagehdlr, file, " pseudo solutions : %10.2f - - %10"SCIP_LONGINT_FORMAT"\n",
36380  scip->stat->npssolsfound);
36381  SCIPmessageFPrintInfo(scip->messagehdlr, file, " strong branching : %10.2f - - %10"SCIP_LONGINT_FORMAT"\n",
36383  scip->stat->nsbsolsfound);
36384 
36385  /* sort heuristics w.r.t. their names */
36386  SCIPsetSortHeursName(scip->set);
36387 
36388  for( i = 0; i < scip->set->nheurs; ++i )
36389  {
36390  SCIPmessageFPrintInfo(scip->messagehdlr, file, " %-17.17s: %10.2f %10.2f %10"SCIP_LONGINT_FORMAT" %10"SCIP_LONGINT_FORMAT"\n",
36391  SCIPheurGetName(scip->set->heurs[i]),
36392  SCIPheurGetTime(scip->set->heurs[i]),
36393  SCIPheurGetSetupTime(scip->set->heurs[i]),
36394  SCIPheurGetNCalls(scip->set->heurs[i]),
36395  SCIPheurGetNSolsFound(scip->set->heurs[i]));
36396  }
36397 
36398  SCIPmessageFPrintInfo(scip->messagehdlr, file, " other solutions : - - - %10"SCIP_LONGINT_FORMAT"\n",
36399  scip->stat->nexternalsolsfound);
36400 
36401 }
36402 
36403 static
36405  SCIP* scip, /**< SCIP data structure */
36406  FILE* file /**< output file */
36407  )
36408 {
36409  assert(scip != NULL);
36410  assert(scip->stat != NULL);
36411  assert(scip->lp != NULL);
36412 
36413  SCIPmessageFPrintInfo(scip->messagehdlr, file, "LP : Time Calls Iterations Iter/call Iter/sec Time-0-It Calls-0-It\n");
36414 
36415  SCIPmessageFPrintInfo(scip->messagehdlr, file, " primal LP : %10.2f %10"SCIP_LONGINT_FORMAT" %10"SCIP_LONGINT_FORMAT" %10.2f",
36417  scip->stat->nprimallps + scip->stat->nprimalzeroitlps,
36418  scip->stat->nprimallpiterations,
36419  scip->stat->nprimallps > 0 ? (SCIP_Real)scip->stat->nprimallpiterations/(SCIP_Real)scip->stat->nprimallps : 0.0);
36420  if( SCIPclockGetTime(scip->stat->primallptime) >= 0.01 )
36422  else
36423  SCIPmessageFPrintInfo(scip->messagehdlr, file, " -");
36424  SCIPmessageFPrintInfo(scip->messagehdlr, file, " %10.2f %10"SCIP_LONGINT_FORMAT"\n",
36425  scip->stat->primalzeroittime,
36426  scip->stat->nprimalzeroitlps);
36427 
36428  SCIPmessageFPrintInfo(scip->messagehdlr, file, " dual LP : %10.2f %10"SCIP_LONGINT_FORMAT" %10"SCIP_LONGINT_FORMAT" %10.2f",
36430  scip->stat->nduallps + scip->stat->ndualzeroitlps,
36431  scip->stat->nduallpiterations,
36432  scip->stat->nduallps > 0 ? (SCIP_Real)scip->stat->nduallpiterations/(SCIP_Real)scip->stat->nduallps : 0.0);
36433  if( SCIPclockGetTime(scip->stat->duallptime) >= 0.01 )
36435  else
36436  SCIPmessageFPrintInfo(scip->messagehdlr, file, " -");
36437  SCIPmessageFPrintInfo(scip->messagehdlr, file, " %10.2f %10"SCIP_LONGINT_FORMAT"\n",
36438  scip->stat->dualzeroittime,
36439  scip->stat->ndualzeroitlps);
36440 
36441  SCIPmessageFPrintInfo(scip->messagehdlr, file, " lex dual LP : %10.2f %10"SCIP_LONGINT_FORMAT" %10"SCIP_LONGINT_FORMAT" %10.2f",
36443  scip->stat->nlexduallps,
36444  scip->stat->nlexduallpiterations,
36445  scip->stat->nlexduallps > 0 ? (SCIP_Real)scip->stat->nlexduallpiterations/(SCIP_Real)scip->stat->nlexduallps : 0.0);
36446  if( SCIPclockGetTime(scip->stat->lexduallptime) >= 0.01 )
36448  else
36449  SCIPmessageFPrintInfo(scip->messagehdlr, file, " -\n");
36450 
36451  SCIPmessageFPrintInfo(scip->messagehdlr, file, " barrier LP : %10.2f %10"SCIP_LONGINT_FORMAT" %10"SCIP_LONGINT_FORMAT" %10.2f",
36453  scip->stat->nbarrierlps,
36454  scip->stat->nbarrierlpiterations,
36455  scip->stat->nbarrierlps > 0 ? (SCIP_Real)scip->stat->nbarrierlpiterations/(SCIP_Real)scip->stat->nbarrierlps : 0.0);
36456  if( SCIPclockGetTime(scip->stat->barrierlptime) >= 0.01 )
36458  else
36459  SCIPmessageFPrintInfo(scip->messagehdlr, file, " -");
36460  SCIPmessageFPrintInfo(scip->messagehdlr, file, " %10.2f %10"SCIP_LONGINT_FORMAT"\n",
36461  scip->stat->barrierzeroittime,
36462  scip->stat->nbarrierzeroitlps);
36463 
36464  SCIPmessageFPrintInfo(scip->messagehdlr, file, " diving/probing LP: %10.2f %10"SCIP_LONGINT_FORMAT" %10"SCIP_LONGINT_FORMAT" %10.2f",
36466  scip->stat->ndivinglps,
36467  scip->stat->ndivinglpiterations,
36468  scip->stat->ndivinglps > 0 ? (SCIP_Real)scip->stat->ndivinglpiterations/(SCIP_Real)scip->stat->ndivinglps : 0.0);
36469  if( SCIPclockGetTime(scip->stat->divinglptime) >= 0.01 )
36471  else
36472  SCIPmessageFPrintInfo(scip->messagehdlr, file, " -\n");
36473 
36474  SCIPmessageFPrintInfo(scip->messagehdlr, file, " strong branching : %10.2f %10"SCIP_LONGINT_FORMAT" %10"SCIP_LONGINT_FORMAT" %10.2f",
36476  scip->stat->nstrongbranchs,
36477  scip->stat->nsblpiterations,
36478  scip->stat->nstrongbranchs > 0 ? (SCIP_Real)scip->stat->nsblpiterations/(SCIP_Real)scip->stat->nstrongbranchs : 0.0);
36479  if( SCIPclockGetTime(scip->stat->strongbranchtime) >= 0.01 )
36481  else
36482  SCIPmessageFPrintInfo(scip->messagehdlr, file, " -\n");
36483 
36484  SCIPmessageFPrintInfo(scip->messagehdlr, file, " (at root node) : - %10"SCIP_LONGINT_FORMAT" %10"SCIP_LONGINT_FORMAT" %10.2f -\n",
36485  scip->stat->nrootstrongbranchs,
36486  scip->stat->nrootsblpiterations,
36487  scip->stat->nrootstrongbranchs > 0
36489 
36490  SCIPmessageFPrintInfo(scip->messagehdlr, file, " conflict analysis: %10.2f %10"SCIP_LONGINT_FORMAT" %10"SCIP_LONGINT_FORMAT" %10.2f",
36492  scip->stat->nconflictlps,
36493  scip->stat->nconflictlpiterations,
36494  scip->stat->nconflictlps > 0 ? (SCIP_Real)scip->stat->nconflictlpiterations/(SCIP_Real)scip->stat->nconflictlps : 0.0);
36495  if( SCIPclockGetTime(scip->stat->conflictlptime) >= 0.01 )
36497  else
36498  SCIPmessageFPrintInfo(scip->messagehdlr, file, " -\n");
36499 }
36500 
36501 static
36503  SCIP* scip, /**< SCIP data structure */
36504  FILE* file /**< output file */
36505  )
36506 {
36507  assert(scip != NULL);
36508  assert(scip->stat != NULL);
36509 
36510  if( scip->nlp == NULL )
36511  return;
36512 
36513  SCIPmessageFPrintInfo(scip->messagehdlr, file, "NLP : Time Calls\n");
36514 
36515  SCIPmessageFPrintInfo(scip->messagehdlr, file, " all NLPs : %10.2f %10"SCIP_LONGINT_FORMAT"\n",
36517  scip->stat->nnlps);
36518 }
36519 
36520 static
36522  SCIP* scip, /**< SCIP data structure */
36523  FILE* file /**< output file */
36524  )
36525 {
36526  int i;
36527 
36528  assert(scip != NULL);
36529  assert(scip->set != NULL);
36530 
36531  if( scip->set->nrelaxs == 0 )
36532  return;
36533 
36534  SCIPmessageFPrintInfo(scip->messagehdlr, file, "Relaxators : Time Calls\n");
36535 
36536  /* sort relaxators w.r.t. their name */
36537  SCIPsetSortRelaxsName(scip->set);
36538 
36539  for( i = 0; i < scip->set->nrelaxs; ++i )
36540  {
36541  SCIPmessageFPrintInfo(scip->messagehdlr, file, " %-17.17s: %10.2f %10"SCIP_LONGINT_FORMAT"\n",
36542  SCIPrelaxGetName(scip->set->relaxs[i]),
36543  SCIPrelaxGetTime(scip->set->relaxs[i]),
36544  SCIPrelaxGetNCalls(scip->set->relaxs[i]));
36545  }
36546 }
36547 
36548 static
36550  SCIP* scip, /**< SCIP data structure */
36551  FILE* file /**< output file */
36552  )
36553 {
36554  assert(scip != NULL);
36555  assert(scip->stat != NULL);
36556  assert(scip->tree != NULL);
36557 
36558  SCIPmessageFPrintInfo(scip->messagehdlr, file, "B&B Tree :\n");
36559  SCIPmessageFPrintInfo(scip->messagehdlr, file, " number of runs : %10d\n", scip->stat->nruns);
36560  SCIPmessageFPrintInfo(scip->messagehdlr, file,
36561  " nodes : %10"SCIP_LONGINT_FORMAT" (%"SCIP_LONGINT_FORMAT" internal, %"SCIP_LONGINT_FORMAT" leaves)\n",
36562  scip->stat->nnodes, scip->stat->ninternalnodes, scip->stat->nnodes - scip->stat->ninternalnodes );
36563  SCIPmessageFPrintInfo(scip->messagehdlr, file,
36564  " nodes (total) : %10"SCIP_LONGINT_FORMAT" (%"SCIP_LONGINT_FORMAT" internal, %"SCIP_LONGINT_FORMAT" leaves)\n",
36566  SCIPmessageFPrintInfo(scip->messagehdlr, file, " nodes left : %10d\n", SCIPtreeGetNNodes(scip->tree));
36567  SCIPmessageFPrintInfo(scip->messagehdlr, file, " max depth : %10d\n", scip->stat->maxdepth);
36568  SCIPmessageFPrintInfo(scip->messagehdlr, file, " max depth (total): %10d\n", scip->stat->maxtotaldepth);
36569  SCIPmessageFPrintInfo(scip->messagehdlr, file, " backtracks : %10"SCIP_LONGINT_FORMAT" (%.1f%%)\n", scip->stat->nbacktracks,
36570  scip->stat->nnodes > 0 ? 100.0 * (SCIP_Real)scip->stat->nbacktracks / (SCIP_Real)scip->stat->nnodes : 0.0);
36571  SCIPmessageFPrintInfo(scip->messagehdlr, file, " delayed cutoffs : %10"SCIP_LONGINT_FORMAT"\n", scip->stat->ndelayedcutoffs);
36572  SCIPmessageFPrintInfo(scip->messagehdlr, file, " repropagations : %10"SCIP_LONGINT_FORMAT" (%"SCIP_LONGINT_FORMAT" domain reductions, %"SCIP_LONGINT_FORMAT" cutoffs)\n",
36573  scip->stat->nreprops, scip->stat->nrepropboundchgs, scip->stat->nrepropcutoffs);
36574  SCIPmessageFPrintInfo(scip->messagehdlr, file, " avg switch length: %10.2f\n",
36575  scip->stat->nnodes > 0
36576  ? (SCIP_Real)(scip->stat->nactivatednodes + scip->stat->ndeactivatednodes) / (SCIP_Real)scip->stat->nnodes : 0.0);
36577  SCIPmessageFPrintInfo(scip->messagehdlr, file, " switching time : %10.2f\n", SCIPclockGetTime(scip->stat->nodeactivationtime));
36578 }
36579 
36580 /** display solution statistics */
36581 static
36583  SCIP* scip, /**< SCIP data structure */
36584  FILE* file /**< output file */
36585  )
36586 {
36587  SCIP_Real primalbound;
36588  SCIP_Real dualbound;
36589  SCIP_Real bestsol;
36590  SCIP_Real gap;
36591  SCIP_Real firstprimalbound;
36592  SCIP_Bool objlimitreached;
36593  char limsolstring[SCIP_MAXSTRLEN];
36594 
36595  assert(scip != NULL);
36596  assert(scip->stat != NULL);
36597  assert(scip->primal != NULL);
36598 
36599  primalbound = getPrimalbound(scip);
36600  dualbound = getDualbound(scip);
36601  gap = SCIPgetGap(scip);
36602 
36603  objlimitreached = FALSE;
36604  if( scip->primal->nlimsolsfound == 0 && !SCIPisInfinity(scip, getPrimalbound(scip)) )
36605  objlimitreached = TRUE;
36606 
36607  if( scip->primal->nsolsfound != scip->primal->nlimsolsfound )
36608  (void) SCIPsnprintf(limsolstring, SCIP_MAXSTRLEN, ", %"SCIP_LONGINT_FORMAT" respecting the objective limit", scip->primal->nlimsolsfound);
36609  else
36610  limsolstring[0] = '\0';
36611 
36612  SCIPmessageFPrintInfo(scip->messagehdlr, file, "Solution :\n");
36613  SCIPmessageFPrintInfo(scip->messagehdlr, file, " Solutions found : %10"SCIP_LONGINT_FORMAT" (%d improvements%s)\n",
36614  scip->primal->nsolsfound, scip->primal->nbestsolsfound, limsolstring);
36615 
36616  if( objlimitreached || SCIPsetIsInfinity(scip->set, REALABS(primalbound)) )
36617  {
36618  if( scip->set->stage == SCIP_STAGE_SOLVED )
36619  {
36620  if( scip->primal->nsols == 0 )
36621  {
36622  if( SCIPgetStatus(scip) == SCIP_STATUS_INFORUNBD )
36623  {
36624  assert(!objlimitreached);
36625  SCIPmessageFPrintInfo(scip->messagehdlr, file, " Primal Bound : infeasible or unbounded\n");
36626  }
36627  else
36628  {
36629  assert(SCIPgetStatus(scip) == SCIP_STATUS_INFEASIBLE);
36630  if( objlimitreached )
36631  SCIPmessageFPrintInfo(scip->messagehdlr, file, " Primal Bound : infeasible (objective limit reached)\n");
36632  else
36633  SCIPmessageFPrintInfo(scip->messagehdlr, file, " Primal Bound : infeasible\n");
36634  }
36635  }
36636  else
36637  {
36638  assert(!objlimitreached);
36639  assert(SCIPgetStatus(scip) == SCIP_STATUS_UNBOUNDED);
36640  SCIPmessageFPrintInfo(scip->messagehdlr, file, " Primal Bound : unbounded\n");
36641  }
36642  }
36643  else
36644  SCIPmessageFPrintInfo(scip->messagehdlr, file, " Primal Bound : -\n");
36645  }
36646  else
36647  {
36648  if( scip->primal->nsols == 0 )
36649  {
36650  SCIPmessageFPrintInfo(scip->messagehdlr, file, " Primal Bound : %+21.14e", primalbound);
36651  SCIPmessageFPrintInfo(scip->messagehdlr, file, " (user objective limit)\n");
36652  }
36653  else
36654  {
36655  /* display first primal bound line */
36656  firstprimalbound = scip->stat->firstprimalbound;
36657  SCIPmessageFPrintInfo(scip->messagehdlr, file, " First Solution : %+21.14e", firstprimalbound);
36658 
36659  SCIPmessageFPrintInfo(scip->messagehdlr, file, " (in run %d, after %"SCIP_LONGINT_FORMAT" nodes, %.2f seconds, depth %d, found by <%s>)\n",
36660  scip->stat->nrunsbeforefirst,
36661  scip->stat->nnodesbeforefirst,
36662  scip->stat->firstprimaltime,
36663  scip->stat->firstprimaldepth,
36664  ( scip->stat->firstprimalheur != NULL )
36665  ? ( SCIPheurGetName(scip->stat->firstprimalheur) )
36666  : (( scip->stat->nrunsbeforefirst == 0 ) ? "initial" : "relaxation"));
36667 
36668  if( SCIPisInfinity(scip, scip->stat->firstsolgap) )
36669  SCIPmessageFPrintInfo(scip->messagehdlr, file, " Gap First Sol. : infinite\n");
36670  else
36671  SCIPmessageFPrintInfo(scip->messagehdlr, file, " Gap First Sol. : %10.2f %%\n", 100.0 * scip->stat->firstsolgap);
36672 
36673  if( SCIPisInfinity(scip, scip->stat->lastsolgap) )
36674  SCIPmessageFPrintInfo(scip->messagehdlr, file, " Gap Last Sol. : infinite\n");
36675  else
36676  SCIPmessageFPrintInfo(scip->messagehdlr, file, " Gap Last Sol. : %10.2f %%\n", 100.0 * scip->stat->lastsolgap);
36677 
36678  SCIPmessageFPrintInfo(scip->messagehdlr, file, " Primal Bound : %+21.14e", primalbound);
36679 
36680  /* display (best) primal bound */
36681  bestsol = SCIPsolGetObj(scip->primal->sols[0], scip->set, scip->transprob, scip->origprob);
36682  bestsol = SCIPretransformObj(scip, bestsol);
36683  if( SCIPsetIsGT(scip->set, bestsol, primalbound) )
36684  {
36685  SCIPmessageFPrintInfo(scip->messagehdlr, file, " (user objective limit)\n");
36686  SCIPmessageFPrintInfo(scip->messagehdlr, file, " Best Solution : %+21.14e", bestsol);
36687  }
36688  SCIPmessageFPrintInfo(scip->messagehdlr, file, " (in run %d, after %"SCIP_LONGINT_FORMAT" nodes, %.2f seconds, depth %d, found by <%s>)\n",
36689  SCIPsolGetRunnum(scip->primal->sols[0]),
36690  SCIPsolGetNodenum(scip->primal->sols[0]),
36691  SCIPsolGetTime(scip->primal->sols[0]),
36692  SCIPsolGetDepth(scip->primal->sols[0]),
36693  SCIPsolGetHeur(scip->primal->sols[0]) != NULL
36695  : (SCIPsolGetRunnum(scip->primal->sols[0]) == 0 ? "initial" : "relaxation"));
36696  }
36697  }
36698  if( objlimitreached || SCIPsetIsInfinity(scip->set, REALABS(dualbound)) )
36699  SCIPmessageFPrintInfo(scip->messagehdlr, file, " Dual Bound : -\n");
36700  else
36701  SCIPmessageFPrintInfo(scip->messagehdlr, file, " Dual Bound : %+21.14e\n", dualbound);
36702  if( SCIPsetIsInfinity(scip->set, gap) )
36703  SCIPmessageFPrintInfo(scip->messagehdlr, file, " Gap : infinite\n");
36704  else
36705  SCIPmessageFPrintInfo(scip->messagehdlr, file, " Gap : %10.2f %%\n", 100.0 * gap);
36706 
36707  if( scip->set->misc_calcintegral )
36708  {
36709  if( SCIPgetStatus(scip) == SCIP_STATUS_INFEASIBLE )
36710  SCIPmessageFPrintInfo(scip->messagehdlr, file, " Avg. Gap : - (problem infeasible)\n");
36711  else
36712  {
36713  SCIP_Real avggap;
36714 
36715  avggap = 0.0;
36716 
36717  if( !SCIPisFeasZero(scip, SCIPgetSolvingTime(scip)) )
36718  avggap = scip->stat->primaldualintegral/SCIPgetSolvingTime(scip);
36719 
36720  /* caution: this assert is non-deterministic since it depends on the solving time */
36721  assert(0.0 <= avggap && SCIPisLE(scip, avggap, 100.0));
36722 
36723  SCIPmessageFPrintInfo(scip->messagehdlr, file, " Avg. Gap : %10.2f %% (%.2f primal-dual integral)\n",
36724  avggap, scip->stat->primaldualintegral);
36725  }
36726  }
36727  else
36728  SCIPmessageFPrintInfo(scip->messagehdlr, file, " Avg. Gap : - (not evaluated)\n");
36729 }
36730 
36731 /** display first LP statistics */
36732 static
36734  SCIP* scip, /**< SCIP data structure */
36735  FILE* file /**< output file */
36736  )
36737 {
36738  SCIP_Real dualboundroot;
36739  SCIP_Real firstdualboundroot;
36740  SCIP_Real firstlptime;
36741  SCIP_Real firstlpspeed;
36742 
36743  assert(scip != NULL);
36744  assert(scip->stat != NULL);
36745  assert(scip->primal != NULL);
36746 
36747  dualboundroot = SCIPgetDualboundRoot(scip);
36748  firstdualboundroot = SCIPgetFirstLPDualboundRoot(scip);
36749  firstlptime = SCIPgetFirstLPTime(scip);
36750 
36751  if( firstlptime > 0.0 )
36752  firstlpspeed = (SCIP_Real)scip->stat->nrootfirstlpiterations/firstlptime;
36753  else
36754  firstlpspeed = 0.0;
36755 
36756  SCIPmessageFPrintInfo(scip->messagehdlr, file, "Root Node :\n");
36757  if( SCIPsetIsInfinity(scip->set, REALABS(firstdualboundroot)) )
36758  SCIPmessageFPrintInfo(scip->messagehdlr, file, " First LP value : -\n");
36759  else
36760  SCIPmessageFPrintInfo(scip->messagehdlr, file, " First LP value : %+21.14e\n", firstdualboundroot);
36761  if( firstlpspeed > 0.0 )
36762  SCIPmessageFPrintInfo(scip->messagehdlr, file, " First LP Iters : %10"SCIP_LONGINT_FORMAT" (%.2f Iter/sec)\n",
36764  (SCIP_Real)scip->stat->nrootfirstlpiterations/firstlptime);
36765  else
36766  SCIPmessageFPrintInfo(scip->messagehdlr, file, " First LP Iters : %10"SCIP_LONGINT_FORMAT"\n", scip->stat->nrootfirstlpiterations);
36767  SCIPmessageFPrintInfo(scip->messagehdlr, file, " First LP Time : %10.2f\n", firstlptime);
36768 
36769  if( SCIPsetIsInfinity(scip->set, REALABS(dualboundroot)) )
36770  SCIPmessageFPrintInfo(scip->messagehdlr, file, " Final Dual Bound : -\n");
36771  else
36772  SCIPmessageFPrintInfo(scip->messagehdlr, file, " Final Dual Bound : %+21.14e\n", dualboundroot);
36773  SCIPmessageFPrintInfo(scip->messagehdlr, file, " Final Root Iters : %10"SCIP_LONGINT_FORMAT"\n", scip->stat->nrootlpiterations);
36774 
36775 }
36776 
36777 /** display timing statistics */
36778 static
36780  SCIP* scip, /**< SCIP data structure */
36781  FILE* file /**< output file */
36782  )
36783 {
36784  SCIP_Real readingtime;
36785 
36786  assert(SCIPgetStage(scip) >= SCIP_STAGE_PROBLEM);
36787 
36788  readingtime = SCIPgetReadingTime(scip);
36789 
36790  if( SCIPgetStage(scip) == SCIP_STAGE_PROBLEM )
36791  {
36792  SCIPmessageFPrintInfo(scip->messagehdlr, file, "Total Time : %10.2f\n", readingtime);
36793  SCIPmessageFPrintInfo(scip->messagehdlr, file, " reading : %10.2f\n", readingtime);
36794  }
36795  else
36796  {
36797  SCIP_Real totaltime;
36798  SCIP_Real solvingtime;
36799 
36800  solvingtime = SCIPclockGetTime(scip->stat->solvingtime);
36801 
36802  if( scip->set->time_reading )
36803  totaltime = solvingtime;
36804  else
36805  totaltime = solvingtime + readingtime;
36806 
36807  SCIPmessageFPrintInfo(scip->messagehdlr, file, "Total Time : %10.2f\n", totaltime);
36808  SCIPmessageFPrintInfo(scip->messagehdlr, file, " solving : %10.2f\n", solvingtime);
36809  SCIPmessageFPrintInfo(scip->messagehdlr, file, " presolving : %10.2f (included in solving)\n", SCIPclockGetTime(scip->stat->presolvingtime));
36810  SCIPmessageFPrintInfo(scip->messagehdlr, file, " reading : %10.2f%s\n", readingtime, scip->set->time_reading ? " (included in solving)" : "");
36811 
36812  if( scip->stat->ncopies > 0 )
36813  {
36814  SCIP_Real copytime;
36815 
36816  copytime = SCIPclockGetTime(scip->stat->copyclock);
36817 
36818  SCIPmessageFPrintInfo(scip->messagehdlr, file, " copying : %10.2f (%d #copies) (minimal %.2f, maximal %.2f, average %.2f)\n",
36819  copytime, scip->stat->ncopies, scip->stat->mincopytime, scip->stat->maxcopytime, copytime / scip->stat->ncopies);
36820  }
36821  else
36822  SCIPmessageFPrintInfo(scip->messagehdlr, file, " copying : %10.2f %s\n", 0.0, "(0 times copied the problem)");
36823  }
36824 }
36825 
36826 /** outputs solving statistics
36827  *
36828  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
36829  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
36830  *
36831  * @note If limits have been changed between the solution and the call to this function, the status is recomputed and
36832  * thus may to correspond to the original status.
36833  *
36834  * @pre This method can be called if SCIP is in one of the following stages:
36835  * - \ref SCIP_STAGE_INIT
36836  * - \ref SCIP_STAGE_PROBLEM
36837  * - \ref SCIP_STAGE_TRANSFORMED
36838  * - \ref SCIP_STAGE_INITPRESOLVE
36839  * - \ref SCIP_STAGE_PRESOLVING
36840  * - \ref SCIP_STAGE_EXITPRESOLVE
36841  * - \ref SCIP_STAGE_PRESOLVED
36842  * - \ref SCIP_STAGE_SOLVING
36843  * - \ref SCIP_STAGE_SOLVED
36844  */
36846  SCIP* scip, /**< SCIP data structure */
36847  FILE* file /**< output file (or NULL for standard output) */
36848  )
36849 {
36850  SCIP_CALL( checkStage(scip, "SCIPprintStatistics", TRUE, TRUE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE) );
36851 
36852  SCIPmessageFPrintInfo(scip->messagehdlr, file, "SCIP Status : ");
36853  SCIP_CALL( SCIPprintStage(scip, file) );
36854  SCIPmessageFPrintInfo(scip->messagehdlr, file, "\n");
36855 
36856  switch( scip->set->stage )
36857  {
36858  case SCIP_STAGE_INIT:
36859  SCIPmessageFPrintInfo(scip->messagehdlr, file, "Original Problem : no problem exists.\n");
36860  return SCIP_OKAY;
36861 
36862  case SCIP_STAGE_PROBLEM:
36863  {
36864  printTimingStatistics(scip, file);
36865  SCIPmessageFPrintInfo(scip->messagehdlr, file, "Original Problem :\n");
36866  SCIPprobPrintStatistics(scip->origprob, scip->messagehdlr, file);
36867  return SCIP_OKAY;
36868  }
36871  {
36872  printTimingStatistics(scip, file);
36873  SCIPmessageFPrintInfo(scip->messagehdlr, file, "Original Problem :\n");
36874  SCIPprobPrintStatistics(scip->origprob, scip->messagehdlr, file);
36875  SCIPmessageFPrintInfo(scip->messagehdlr, file, "Presolved Problem :\n");
36876  SCIPprobPrintStatistics(scip->transprob, scip->messagehdlr, file);
36877  printPresolverStatistics(scip, file);
36878  printConstraintStatistics(scip, file);
36879  printConstraintTimingStatistics(scip, file);
36880  printPropagatorStatistics(scip, file);
36881  printConflictStatistics(scip, file);
36882  return SCIP_OKAY;
36883  }
36884  case SCIP_STAGE_PRESOLVING:
36886  case SCIP_STAGE_PRESOLVED:
36887  {
36888  printTimingStatistics(scip, file);
36889  SCIPmessageFPrintInfo(scip->messagehdlr, file, "Original Problem :\n");
36890  SCIPprobPrintStatistics(scip->origprob, scip->messagehdlr, file);
36891  SCIPmessageFPrintInfo(scip->messagehdlr, file, "Presolved Problem :\n");
36892  SCIPprobPrintStatistics(scip->transprob, scip->messagehdlr, file);
36893  printPresolverStatistics(scip, file);
36894  printConstraintStatistics(scip, file);
36895  printConstraintTimingStatistics(scip, file);
36896  printPropagatorStatistics(scip, file);
36897  printConflictStatistics(scip, file);
36898  printHeuristicStatistics(scip, file);
36899  printSolutionStatistics(scip, file);
36900  return SCIP_OKAY;
36901  }
36902  case SCIP_STAGE_SOLVING:
36903  case SCIP_STAGE_SOLVED:
36904  {
36905  printTimingStatistics(scip, file);
36906  SCIPmessageFPrintInfo(scip->messagehdlr, file, "Original Problem :\n");
36907  SCIPprobPrintStatistics(scip->origprob, scip->messagehdlr, file);
36908  SCIPmessageFPrintInfo(scip->messagehdlr, file, "Presolved Problem :\n");
36909  SCIPprobPrintStatistics(scip->transprob, scip->messagehdlr, file);
36910  printPresolverStatistics(scip, file);
36911  printConstraintStatistics(scip, file);
36912  printConstraintTimingStatistics(scip, file);
36913  printPropagatorStatistics(scip, file);
36914  printConflictStatistics(scip, file);
36915  printSeparatorStatistics(scip, file);
36916  printPricerStatistics(scip, file);
36917  printBranchruleStatistics(scip, file);
36918  printHeuristicStatistics(scip, file);
36919  printLPStatistics(scip, file);
36920  printNLPStatistics(scip, file);
36921  printRelaxatorStatistics(scip, file);
36922  printTreeStatistics(scip, file);
36923  printRootStatistics(scip, file);
36924  printSolutionStatistics(scip, file);
36925 
36926  return SCIP_OKAY;
36927  }
36928  default:
36929  SCIPerrorMessage("invalid SCIP stage <%d>\n", scip->set->stage);
36930  return SCIP_INVALIDCALL;
36931  } /*lint !e788*/
36932 }
36933 
36934 /** outputs history statistics about branchings on variables
36935  *
36936  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
36937  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
36938  *
36939  * @pre This method can be called if SCIP is in one of the following stages:
36940  * - \ref SCIP_STAGE_INIT
36941  * - \ref SCIP_STAGE_PROBLEM
36942  * - \ref SCIP_STAGE_TRANSFORMED
36943  * - \ref SCIP_STAGE_INITPRESOLVE
36944  * - \ref SCIP_STAGE_PRESOLVING
36945  * - \ref SCIP_STAGE_EXITPRESOLVE
36946  * - \ref SCIP_STAGE_PRESOLVED
36947  * - \ref SCIP_STAGE_SOLVING
36948  * - \ref SCIP_STAGE_SOLVED
36949  */
36951  SCIP* scip, /**< SCIP data structure */
36952  FILE* file /**< output file (or NULL for standard output) */
36953  )
36954 {
36955  SCIP_VAR** vars;
36956  int totalnstrongbranchs;
36957  int v;
36958 
36959  SCIP_CALL( checkStage(scip, "SCIPprintBranchingStatistics", TRUE, TRUE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE) );
36960 
36961  switch( scip->set->stage )
36962  {
36963  case SCIP_STAGE_INIT:
36964  case SCIP_STAGE_PROBLEM:
36965  SCIPmessageFPrintInfo(scip->messagehdlr, file, "problem not yet solved. branching statistics not available.\n");
36966  return SCIP_OKAY;
36967 
36970  case SCIP_STAGE_PRESOLVING:
36972  case SCIP_STAGE_PRESOLVED:
36973  case SCIP_STAGE_SOLVING:
36974  case SCIP_STAGE_SOLVED:
36975  SCIP_CALL( SCIPallocBufferArray(scip, &vars, scip->transprob->nvars) );
36976  for( v = 0; v < scip->transprob->nvars; ++v )
36977  {
36978  SCIP_VAR* var;
36979  int i;
36980 
36981  var = scip->transprob->vars[v];
36982  for( i = v; i > 0 && strcmp(SCIPvarGetName(var), SCIPvarGetName(vars[i-1])) < 0; i-- )
36983  vars[i] = vars[i-1];
36984  vars[i] = var;
36985  }
36986 
36987  SCIPmessageFPrintInfo(scip->messagehdlr, file, " locks branchings inferences cutoffs LP gain pscostcount\n");
36988  SCIPmessageFPrintInfo(scip->messagehdlr, file, "variable prio factor down up depth down up sb down up down up down up down up\n");
36989 
36990  totalnstrongbranchs = 0;
36991  for( v = 0; v < scip->transprob->nvars; ++v )
36992  {
36995  || SCIPgetVarNStrongbranchs(scip, vars[v]) > 0 )
36996  {
36997  int nstrongbranchs;
36998 
36999  nstrongbranchs = SCIPgetVarNStrongbranchs(scip, vars[v]);
37000  totalnstrongbranchs += nstrongbranchs;
37001  SCIPmessageFPrintInfo(scip->messagehdlr, file, "%-16s %5d %8.1f %6d %6d %6.1f %7"SCIP_LONGINT_FORMAT" %7"SCIP_LONGINT_FORMAT" %5d %8.1f %8.1f %5.1f%% %5.1f%% %9.4f %9.4f %7.1f %7.1f\n",
37002  SCIPvarGetName(vars[v]),
37003  SCIPvarGetBranchPriority(vars[v]),
37004  SCIPvarGetBranchFactor(vars[v]),
37005  SCIPvarGetNLocksDown(vars[v]),
37006  SCIPvarGetNLocksUp(vars[v]),
37008  + SCIPvarGetAvgBranchdepth(vars[v], SCIP_BRANCHDIR_UPWARDS))/2.0 - 1.0,
37011  nstrongbranchs,
37014  100.0 * SCIPvarGetAvgCutoffs(vars[v], scip->stat, SCIP_BRANCHDIR_DOWNWARDS),
37015  100.0 * SCIPvarGetAvgCutoffs(vars[v], scip->stat, SCIP_BRANCHDIR_UPWARDS),
37016  SCIPvarGetPseudocost(vars[v], scip->stat, -1.0),
37017  SCIPvarGetPseudocost(vars[v], scip->stat, +1.0),
37020  }
37021  }
37022  SCIPmessageFPrintInfo(scip->messagehdlr, file, "total %7"SCIP_LONGINT_FORMAT" %7"SCIP_LONGINT_FORMAT" %5d %8.1f %8.1f %5.1f%% %5.1f%% %9.4f %9.4f %7.1f %7.1f\n",
37025  totalnstrongbranchs,
37042 
37043  SCIPfreeBufferArray(scip, &vars);
37044 
37045  return SCIP_OKAY;
37046 
37047  default:
37048  SCIPerrorMessage("invalid SCIP stage <%d>\n", scip->set->stage);
37049  return SCIP_INVALIDCALL;
37050  } /*lint !e788*/
37051 }
37052 
37053 /** outputs node information display line
37054  *
37055  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
37056  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
37057  *
37058  * @pre This method can be called if SCIP is in one of the following stages:
37059  * - \ref SCIP_STAGE_SOLVING
37060  */
37062  SCIP* scip, /**< SCIP data structure */
37063  FILE* file, /**< output file (or NULL for standard output) */
37064  SCIP_VERBLEVEL verblevel, /**< minimal verbosity level to actually display the information line */
37065  SCIP_Bool endline /**< should the line be terminated with a newline symbol? */
37066  )
37067 {
37068  SCIP_CALL( checkStage(scip, "SCIPprintDisplayLine", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) );
37069 
37070  if( (SCIP_VERBLEVEL)scip->set->disp_verblevel >= verblevel )
37071  {
37072  SCIP_CALL( SCIPdispPrintLine(scip->set, scip->messagehdlr, scip->stat, file, TRUE, endline) );
37073  }
37074 
37075  return SCIP_OKAY;
37076 }
37077 
37078 /** gets total number of implications between variables that are stored in the implication graph
37079  *
37080  * @return the total number of implications between variables that are stored in the implication graph
37081  *
37082  * @pre This method can be called if SCIP is in one of the following stages:
37083  * - \ref SCIP_STAGE_INITPRESOLVE
37084  * - \ref SCIP_STAGE_PRESOLVING
37085  * - \ref SCIP_STAGE_EXITPRESOLVE
37086  * - \ref SCIP_STAGE_PRESOLVED
37087  * - \ref SCIP_STAGE_INITSOLVE
37088  * - \ref SCIP_STAGE_SOLVING
37089  * - \ref SCIP_STAGE_SOLVED
37090  */
37092  SCIP* scip /**< SCIP data structure */
37093  )
37094 {
37095  SCIP_CALL_ABORT( checkStage(scip, "SCIPgetNImplications", FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE) );
37096 
37097  return scip->stat->nimplications;
37098 }
37099 
37100 /** stores conflict graph of binary variables' implications into a file, which can be used as input for the DOT tool
37101  *
37102  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
37103  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
37104  *
37105  * @pre This method can be called if SCIP is in one of the following stages:
37106  * - \ref SCIP_STAGE_TRANSFORMED
37107  * - \ref SCIP_STAGE_INITPRESOLVE
37108  * - \ref SCIP_STAGE_PRESOLVING
37109  * - \ref SCIP_STAGE_EXITPRESOLVE
37110  * - \ref SCIP_STAGE_PRESOLVED
37111  * - \ref SCIP_STAGE_INITSOLVE
37112  * - \ref SCIP_STAGE_SOLVING
37113  * - \ref SCIP_STAGE_SOLVED
37114  * - \ref SCIP_STAGE_EXITSOLVE
37115  */
37117  SCIP* scip, /**< SCIP data structure */
37118  const char* filename /**< file name, or NULL for stdout */
37119  )
37120 {
37121  FILE* file;
37122  SCIP_VAR** vars;
37123  int nvars;
37124  int v;
37125 
37126  SCIP_CALL( checkStage(scip, "SCIPwriteImplicationConflictGraph", FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE) );
37127 
37128  /* open file */
37129  if( filename == NULL )
37130  file = NULL;
37131  else
37132  {
37133  file = fopen(filename, "w");
37134  if( file == NULL )
37135  {
37136  SCIPerrorMessage("cannot create file <%s>\n", filename);
37137  SCIPprintSysError(filename);
37138  return SCIP_FILECREATEERROR;
37139  }
37140  }
37141 
37142  vars = scip->transprob->vars;
37143  nvars = scip->transprob->nbinvars;
37144 
37145  /* write header */
37146  SCIPmessageFPrintInfo(scip->messagehdlr, file, "digraph implconfgraph {\n");
37147 
37148  /* store nodes */
37149  for( v = 0; v < nvars; ++v )
37150  {
37151  if( SCIPvarGetNImpls(vars[v], TRUE) > 0 )
37152  SCIPmessageFPrintInfo(scip->messagehdlr, file, "pos%d [label=\"%s\"];\n", v, SCIPvarGetName(vars[v]));
37153  if( SCIPvarGetNImpls(vars[v], FALSE) > 0 )
37154  SCIPmessageFPrintInfo(scip->messagehdlr, file, "neg%d [style=filled,fillcolor=red,label=\"%s\"];\n", v, SCIPvarGetName(vars[v]));
37155  if( SCIPvarGetNImpls(vars[v], TRUE) > 0 && SCIPvarGetNImpls(vars[v], FALSE) > 0 )
37156  SCIPmessageFPrintInfo(scip->messagehdlr, file, "pos%d -> neg%d [dir=both];\n", v, v);
37157  }
37158 
37159  /* store edges */
37160  for( v = 0; v < nvars; ++v )
37161  {
37162  SCIP_Bool fix;
37163 
37164  fix = FALSE;
37165  do
37166  {
37167  SCIP_VAR** implvars;
37168  SCIP_BOUNDTYPE* impltypes;
37169  int nimpls;
37170  int i;
37171 
37172  nimpls = SCIPvarGetNBinImpls(vars[v], fix);
37173  implvars = SCIPvarGetImplVars(vars[v], fix);
37174  impltypes = SCIPvarGetImplTypes(vars[v], fix);
37175  for( i = 0; i < nimpls; ++i )
37176  {
37177  int implidx;
37178 
37179  implidx = SCIPvarGetProbindex(implvars[i]);
37180  if( implidx > v )
37181  SCIPmessageFPrintInfo(scip->messagehdlr, file, "%s%d -> %s%d [dir=none];\n", fix == TRUE ? "pos" : "neg", v,
37182  impltypes[i] == SCIP_BOUNDTYPE_UPPER ? "pos" : "neg", implidx);
37183  }
37184  fix = !fix;
37185  }
37186  while( fix == TRUE );
37187  }
37188 
37189  /* write footer */
37190  SCIPmessageFPrintInfo(scip->messagehdlr, file, "}\n");
37191 
37192  /* close file */
37193  if( filename != NULL )
37194  {
37195  assert(file != NULL);
37196  fclose(file);
37197  }
37198 
37199  return SCIP_OKAY;
37200 }
37201 
37202 
37203 
37204 
37205 /*
37206  * timing methods
37207  */
37208 
37209 /** gets current time of day in seconds (standard time zone)
37210  *
37211  * @return the current time of day in seconds (standard time zone).
37212  */
37214  SCIP* scip /**< SCIP data structure */
37215  )
37216 {
37217  assert(scip != NULL);
37218 
37219  return SCIPclockGetTimeOfDay();
37220 }
37221 
37222 /** creates a clock using the default clock type
37223  *
37224  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
37225  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
37226  */
37228  SCIP* scip, /**< SCIP data structure */
37229  SCIP_CLOCK** clck /**< pointer to clock timer */
37230  )
37231 {
37232  assert(scip != NULL);
37233 
37235 
37236  return SCIP_OKAY;
37237 }
37238 
37239 /** creates a clock counting the CPU user seconds
37240  *
37241  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
37242  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
37243  */
37245  SCIP* scip, /**< SCIP data structure */
37246  SCIP_CLOCK** clck /**< pointer to clock timer */
37247  )
37248 {
37249  assert(scip != NULL);
37250 
37252 
37253  return SCIP_OKAY;
37254 }
37255 
37256 /** creates a clock counting the wall clock seconds
37257  *
37258  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
37259  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
37260  */
37262  SCIP* scip, /**< SCIP data structure */
37263  SCIP_CLOCK** clck /**< pointer to clock timer */
37264  )
37265 {
37266  assert(scip != NULL);
37267 
37269 
37270  return SCIP_OKAY;
37271 }
37272 
37273 /** frees a clock
37274  *
37275  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
37276  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
37277  */
37279  SCIP* scip, /**< SCIP data structure */
37280  SCIP_CLOCK** clck /**< pointer to clock timer */
37281  )
37282 {
37283  assert(scip != NULL);
37284 
37285  SCIPclockFree(clck);
37286 
37287  return SCIP_OKAY;
37288 }
37289 
37290 /** resets the time measurement of a clock to zero and completely stops the clock
37291  *
37292  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
37293  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
37294  */
37296  SCIP* scip, /**< SCIP data structure */
37297  SCIP_CLOCK* clck /**< clock timer */
37298  )
37299 {
37300  assert(scip != NULL);
37301 
37302  SCIPclockReset(clck);
37303 
37304  return SCIP_OKAY;
37305 }
37306 
37307 /** starts the time measurement of a clock
37308  *
37309  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
37310  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
37311  */
37313  SCIP* scip, /**< SCIP data structure */
37314  SCIP_CLOCK* clck /**< clock timer */
37315  )
37316 {
37317  assert(scip != NULL);
37318 
37319  SCIPclockStart(clck, scip->set);
37320 
37321  return SCIP_OKAY;
37322 }
37323 
37324 /** stops the time measurement of a clock
37325  *
37326  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
37327  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
37328  */
37330  SCIP* scip, /**< SCIP data structure */
37331  SCIP_CLOCK* clck /**< clock timer */
37332  )
37333 {
37334  assert(scip != NULL);
37335 
37336  SCIPclockStop(clck, scip->set);
37337 
37338  return SCIP_OKAY;
37339 }
37340 
37341 /** starts the current solving time
37342  *
37343  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
37344  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
37345  *
37346  * @pre This method can be called if SCIP is in one of the following stages:
37347  * - \ref SCIP_STAGE_PROBLEM
37348  * - \ref SCIP_STAGE_TRANSFORMING
37349  * - \ref SCIP_STAGE_TRANSFORMED
37350  * - \ref SCIP_STAGE_INITPRESOLVE
37351  * - \ref SCIP_STAGE_PRESOLVING
37352  * - \ref SCIP_STAGE_EXITPRESOLVE
37353  * - \ref SCIP_STAGE_PRESOLVED
37354  * - \ref SCIP_STAGE_INITSOLVE
37355  * - \ref SCIP_STAGE_SOLVING
37356  * - \ref SCIP_STAGE_SOLVED
37357  * - \ref SCIP_STAGE_EXITSOLVE
37358  * - \ref SCIP_STAGE_FREETRANS
37359  *
37360  * See \ref SCIP_Stage "SCIP_STAGE" for a complete list of all possible solving stages.
37361  */
37363  SCIP* scip /**< SCIP data structure */
37364  )
37365 {
37366  SCIP_CALL( checkStage(scip, "SCIPstartSolvingTime", FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE) );
37367 
37368  SCIPclockStart(scip->stat->solvingtime, scip->set);
37369 
37370  return SCIP_OKAY;
37371 }
37372 
37373 /** stops the current solving time in seconds
37374  *
37375  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
37376  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
37377  *
37378  * @pre This method can be called if SCIP is in one of the following stages:
37379  * - \ref SCIP_STAGE_PROBLEM
37380  * - \ref SCIP_STAGE_TRANSFORMING
37381  * - \ref SCIP_STAGE_TRANSFORMED
37382  * - \ref SCIP_STAGE_INITPRESOLVE
37383  * - \ref SCIP_STAGE_PRESOLVING
37384  * - \ref SCIP_STAGE_EXITPRESOLVE
37385  * - \ref SCIP_STAGE_PRESOLVED
37386  * - \ref SCIP_STAGE_INITSOLVE
37387  * - \ref SCIP_STAGE_SOLVING
37388  * - \ref SCIP_STAGE_SOLVED
37389  * - \ref SCIP_STAGE_EXITSOLVE
37390  * - \ref SCIP_STAGE_FREETRANS
37391  *
37392  * See \ref SCIP_Stage "SCIP_STAGE" for a complete list of all possible solving stages.
37393  */
37395  SCIP* scip /**< SCIP data structure */
37396  )
37397 {
37398  SCIP_CALL( checkStage(scip, "SCIPstopSolvingTime", FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE) );
37399 
37400  SCIPclockStop(scip->stat->solvingtime, scip->set);
37401 
37402  return SCIP_OKAY;
37403 }
37404 
37405 /** gets the measured time of a clock in seconds
37406  *
37407  * @return the measured time of a clock in seconds.
37408  */
37410  SCIP* scip, /**< SCIP data structure */
37411  SCIP_CLOCK* clck /**< clock timer */
37412  )
37413 {
37414  assert(scip != NULL);
37415 
37416  return SCIPclockGetTime(clck);
37417 }
37418 
37419 /** sets the measured time of a clock to the given value in seconds
37420  *
37421  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
37422  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
37423  */
37425  SCIP* scip, /**< SCIP data structure */
37426  SCIP_CLOCK* clck, /**< clock timer */
37427  SCIP_Real sec /**< time in seconds to set the clock's timer to */
37428  )
37429 {
37430  assert(scip != NULL);
37431 
37432  SCIPclockSetTime(clck, sec);
37433 
37434  return SCIP_OKAY;
37435 }
37436 
37437 /** gets the current total SCIP time in seconds
37438  *
37439  * @return the current total SCIP time in seconds.
37440  */
37442  SCIP* scip /**< SCIP data structure */
37443  )
37444 {
37445  assert(scip != NULL);
37446 
37447  return SCIPclockGetTime(scip->totaltime);
37448 }
37449 
37450 /** gets the current solving time in seconds
37451  *
37452  * @return the current solving time in seconds.
37453  *
37454  * @pre This method can be called if SCIP is in one of the following stages:
37455  * - \ref SCIP_STAGE_PROBLEM
37456  * - \ref SCIP_STAGE_TRANSFORMING
37457  * - \ref SCIP_STAGE_TRANSFORMED
37458  * - \ref SCIP_STAGE_INITPRESOLVE
37459  * - \ref SCIP_STAGE_PRESOLVING
37460  * - \ref SCIP_STAGE_EXITPRESOLVE
37461  * - \ref SCIP_STAGE_PRESOLVED
37462  * - \ref SCIP_STAGE_INITSOLVE
37463  * - \ref SCIP_STAGE_SOLVING
37464  * - \ref SCIP_STAGE_SOLVED
37465  *
37466  * See \ref SCIP_Stage "SCIP_STAGE" for a complete list of all possible solving stages.
37467  */
37469  SCIP* scip /**< SCIP data structure */
37470  )
37471 {
37472  SCIP_CALL_ABORT( checkStage(scip, "SCIPgetSolvingTime", FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE) );
37473 
37474  return SCIPclockGetTime(scip->stat->solvingtime);
37475 }
37476 
37477 /** gets the current reading time in seconds
37478  *
37479  * @return the current reading time in seconds.
37480  *
37481  * @pre This method can be called if SCIP is in one of the following stages:
37482  * - \ref SCIP_STAGE_PROBLEM
37483  * - \ref SCIP_STAGE_TRANSFORMING
37484  * - \ref SCIP_STAGE_TRANSFORMED
37485  * - \ref SCIP_STAGE_INITPRESOLVE
37486  * - \ref SCIP_STAGE_PRESOLVING
37487  * - \ref SCIP_STAGE_EXITPRESOLVE
37488  * - \ref SCIP_STAGE_PRESOLVED
37489  * - \ref SCIP_STAGE_INITSOLVE
37490  * - \ref SCIP_STAGE_SOLVING
37491  * - \ref SCIP_STAGE_SOLVED
37492  *
37493  * See \ref SCIP_Stage "SCIP_STAGE" for a complete list of all possible solving stages.
37494  */
37496  SCIP* scip /**< SCIP data structure */
37497  )
37498 {
37499  SCIP_Real readingtime;
37500  int r;
37501 
37502  SCIP_CALL_ABORT( checkStage(scip, "SCIPgetReadingTime", FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE) );
37503 
37504  readingtime = 0.0;
37505 
37506  /* sum up the reading time of all readers */
37507  for( r = 0; r < scip->set->nreaders; ++r )
37508  {
37509  assert(scip->set->readers[r] != NULL);
37510  assert(!SCIPisNegative(scip, SCIPreaderGetReadingTime(scip->set->readers[r])));
37511  readingtime += SCIPreaderGetReadingTime(scip->set->readers[r]);
37512  }
37513 
37514  return readingtime;
37515 }
37516 
37517 /** gets the current presolving time in seconds
37518  *
37519  * @return the current presolving time in seconds.
37520  *
37521  * @pre This method can be called if SCIP is in one of the following stages:
37522  * - \ref SCIP_STAGE_INITPRESOLVE
37523  * - \ref SCIP_STAGE_PRESOLVING
37524  * - \ref SCIP_STAGE_EXITPRESOLVE
37525  * - \ref SCIP_STAGE_PRESOLVED
37526  * - \ref SCIP_STAGE_INITSOLVE
37527  * - \ref SCIP_STAGE_SOLVING
37528  * - \ref SCIP_STAGE_SOLVED
37529  *
37530  * See \ref SCIP_Stage "SCIP_STAGE" for a complete list of all possible solving stages.
37531  */
37533  SCIP* scip /**< SCIP data structure */
37534  )
37535 {
37536  SCIP_CALL_ABORT( checkStage(scip, "SCIPgetPresolvingTime", FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE) );
37537 
37538  return SCIPclockGetTime(scip->stat->presolvingtime);
37539 }
37540 
37541 /** gets the time need to solve the first LP in the root node
37542  *
37543  * @return the solving time for the first LP in the root node in seconds.
37544  *
37545  * @pre This method can be called if SCIP is in one of the following stages:
37546  * - \ref SCIP_STAGE_TRANSFORMING
37547  * - \ref SCIP_STAGE_TRANSFORMED
37548  * - \ref SCIP_STAGE_INITPRESOLVE
37549  * - \ref SCIP_STAGE_PRESOLVING
37550  * - \ref SCIP_STAGE_EXITPRESOLVE
37551  * - \ref SCIP_STAGE_PRESOLVED
37552  * - \ref SCIP_STAGE_INITSOLVE
37553  * - \ref SCIP_STAGE_SOLVING
37554  * - \ref SCIP_STAGE_SOLVED
37555  *
37556  * See \ref SCIP_Stage "SCIP_STAGE" for a complete list of all possible solving stages.
37557  */
37559  SCIP* scip /**< SCIP data structure */
37560  )
37561 {
37562  SCIP_CALL_ABORT( checkStage(scip, "SCIPgetFirstLPTime", FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE) );
37563 
37564  return scip->stat->firstlptime;
37565 }
37566 
37567 
37568 
37569 /*
37570  * numeric values and comparisons
37571  */
37572 
37573 /** returns value treated as zero
37574  *
37575  * @return value treated as zero
37576  */
37578  SCIP* scip /**< SCIP data structure */
37579  )
37580 {
37581  assert(scip != NULL);
37582  assert(scip->set != NULL);
37583 
37584  return SCIPsetEpsilon(scip->set);
37585 }
37586 
37587 /** returns value treated as zero for sums of floating point values
37588  *
37589  * @return value treated as zero for sums of floating point values
37590  */
37592  SCIP* scip /**< SCIP data structure */
37593  )
37594 {
37595  assert(scip != NULL);
37596  assert(scip->set != NULL);
37597 
37598  return SCIPsetSumepsilon(scip->set);
37599 }
37600 
37601 /** returns feasibility tolerance for constraints
37602  *
37603  * @return feasibility tolerance for constraints
37604  */
37606  SCIP* scip /**< SCIP data structure */
37607  )
37608 {
37609  assert(scip != NULL);
37610  assert(scip->set != NULL);
37611 
37612  return SCIPsetFeastol(scip->set);
37613 }
37614 
37615 /** returns primal feasibility tolerance of LP solver
37616  *
37617  * @return primal feasibility tolerance of LP solver
37618  */
37620  SCIP* scip /**< SCIP data structure */
37621  )
37622 {
37623  assert(scip != NULL);
37624  assert(scip->set != NULL);
37625 
37626  return SCIPsetLpfeastol(scip->set);
37627 }
37628 
37629 /** returns feasibility tolerance for reduced costs
37630  *
37631  * @return feasibility tolerance for reduced costs
37632  */
37634  SCIP* scip /**< SCIP data structure */
37635  )
37636 {
37637  assert(scip != NULL);
37638  assert(scip->set != NULL);
37639 
37640  return SCIPsetDualfeastol(scip->set);
37641 }
37642 
37643 /** returns convergence tolerance used in barrier algorithm
37644  *
37645  * @return convergence tolerance used in barrier algorithm
37646  */
37648  SCIP* scip /**< SCIP data structure */
37649  )
37650 {
37651  assert(scip != NULL);
37652  assert(scip->set != NULL);
37653 
37654  return SCIPsetBarrierconvtol(scip->set);
37655 }
37656 
37657 /** return the cutoff bound delta
37658  *
37659  * @return cutoff bound data
37660  */
37662  SCIP* scip /**< SCIP data structure */
37663  )
37664 {
37665  assert(scip != NULL);
37666  assert(scip->set != NULL);
37667 
37668  return SCIPsetCutoffbounddelta(scip->set);
37669 }
37670 
37671 /** sets the feasibility tolerance for constraints
37672  *
37673  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
37674  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
37675  */
37677  SCIP* scip, /**< SCIP data structure */
37678  SCIP_Real feastol /**< new feasibility tolerance for constraints */
37679  )
37680 {
37681  assert(scip != NULL);
37682 
37683  /* change the settings */
37684  SCIP_CALL( SCIPsetSetFeastol(scip->set, feastol) );
37685 
37686  return SCIP_OKAY;
37687 }
37688 
37689 /** sets the primal feasibility tolerance of LP solver
37690  *
37691  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
37692  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
37693  */
37695  SCIP* scip, /**< SCIP data structure */
37696  SCIP_Real lpfeastol, /**< new primal feasibility tolerance of LP solver */
37697  SCIP_Bool printnewvalue /**< should "numerics/lpfeastol = ..." be printed? */
37698  )
37699 {
37700  assert(scip != NULL);
37701 
37702  /* mark the LP unsolved, if the primal feasibility tolerance was tightened */
37703  if( scip->lp != NULL && lpfeastol < SCIPsetLpfeastol(scip->set) )
37704  {
37705  scip->lp->solved = FALSE;
37707  }
37708 
37709  /* change the settings */
37710  SCIP_CALL( SCIPsetSetLpfeastol(scip->set, lpfeastol, printnewvalue) );
37711 
37712  return SCIP_OKAY;
37713 }
37714 
37715 /** sets the feasibility tolerance for reduced costs
37716  *
37717  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
37718  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
37719  */
37721  SCIP* scip, /**< SCIP data structure */
37722  SCIP_Real dualfeastol /**< new feasibility tolerance for reduced costs */
37723  )
37724 {
37725  assert(scip != NULL);
37726 
37727  /* mark the LP unsolved, if the dual feasibility tolerance was tightened */
37728  if( scip->lp != NULL && dualfeastol < SCIPsetDualfeastol(scip->set) )
37729  {
37730  scip->lp->solved = FALSE;
37732  }
37733 
37734  /* change the settings */
37735  SCIP_CALL( SCIPsetSetDualfeastol(scip->set, dualfeastol) );
37736 
37737  return SCIP_OKAY;
37738 }
37739 
37740 /** sets the convergence tolerance used in barrier algorithm
37741  *
37742  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
37743  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
37744  */
37746  SCIP* scip, /**< SCIP data structure */
37747  SCIP_Real barrierconvtol /**< new convergence tolerance used in barrier algorithm */
37748  )
37749 {
37750  assert(scip != NULL);
37751 
37752  /* mark the LP unsolved, if the convergence tolerance was tightened, and the LP was solved with the barrier algorithm */
37753  if( scip->lp != NULL && barrierconvtol < SCIPsetBarrierconvtol(scip->set)
37755  scip->lp->solved = FALSE;
37756 
37757  /* change the settings */
37758  SCIP_CALL( SCIPsetSetBarrierconvtol(scip->set, barrierconvtol) );
37759 
37760  return SCIP_OKAY;
37761 }
37762 
37763 /** marks that some limit parameter was changed */
37765  SCIP* scip /**< SCIP data structure */
37766  )
37767 {
37768  assert(scip != NULL);
37769 
37770  /* change the settings */
37771  SCIPsetSetLimitChanged(scip->set);
37772 }
37773 
37774 /** outputs a real number, or "+infinity", or "-infinity" to a file */
37776  SCIP* scip, /**< SCIP data structure */
37777  FILE* file, /**< output file (or NULL for standard output) */
37778  SCIP_Real val, /**< value to print */
37779  int width, /**< width of the field */
37780  int precision /**< number of significant digits printed */
37781  )
37782 {
37783  char s[SCIP_MAXSTRLEN];
37784  char strformat[SCIP_MAXSTRLEN];
37785 
37786  assert(scip != NULL);
37787 
37788  if( SCIPsetIsInfinity(scip->set, val) )
37789  (void) SCIPsnprintf(s, SCIP_MAXSTRLEN, "+infinity");
37790  else if( SCIPsetIsInfinity(scip->set, -val) )
37791  (void) SCIPsnprintf(s, SCIP_MAXSTRLEN, "-infinity");
37792  else
37793  {
37794  (void) SCIPsnprintf(strformat, SCIP_MAXSTRLEN, "%%.%dg", precision);
37795  (void) SCIPsnprintf(s, SCIP_MAXSTRLEN, (const char*)strformat, val);
37796  }
37797  (void) SCIPsnprintf(strformat, SCIP_MAXSTRLEN, "%%%ds", width);
37798  SCIPmessageFPrintInfo(scip->messagehdlr, file, (const char*)strformat, s);
37799 }
37800 
37801 
37802 
37803 
37804 /*
37805  * memory management
37806  */
37807 
37808 /** returns block memory to use at the current time
37809  *
37810  * @return the block memory to use at the current time.
37811  */
37813  SCIP* scip /**< SCIP data structure */
37814  )
37815 {
37816  assert(scip != NULL);
37817  assert(scip->set != NULL);
37818  assert(scip->mem != NULL);
37819 
37820  switch( scip->set->stage )
37821  {
37822  case SCIP_STAGE_INIT:
37823  case SCIP_STAGE_PROBLEM:
37827  case SCIP_STAGE_PRESOLVING:
37829  case SCIP_STAGE_PRESOLVED:
37830  case SCIP_STAGE_INITSOLVE:
37831  case SCIP_STAGE_SOLVING:
37832  case SCIP_STAGE_SOLVED:
37833  case SCIP_STAGE_EXITSOLVE:
37834  case SCIP_STAGE_FREETRANS:
37835  case SCIP_STAGE_FREE:
37836  return scip->mem->probmem;
37837  default:
37838  SCIPerrorMessage("invalid SCIP stage <%d>\n", scip->set->stage);
37839  return NULL;
37840  } /*lint !e788*/
37841 }
37842 
37843 /** returns the total number of bytes used in block memory
37844  *
37845  * @return the total number of bytes used in block memory.
37846  */
37848  SCIP* scip /**< SCIP data structure */
37849  )
37850 {
37851  assert(scip != NULL);
37852 
37853  return SCIPmemGetUsed(scip->mem);
37854 }
37855 
37856 /** returns the estimated number of bytes used by external software, e.g., the LP solver
37857  *
37858  * @return the estimated number of bytes used by external software, e.g., the LP solver.
37859  */
37861  SCIP* scip /**< SCIP data structure */
37862  )
37863 {
37864  assert(scip != NULL);
37865 
37866  return SCIPsetGetMemExternEstim(scip->set);
37867 }
37868 
37869 /** calculate memory size for dynamically allocated arrays
37870  *
37871  * @return the memory size for dynamically allocated arrays.
37872  */
37874  SCIP* scip, /**< SCIP data structure */
37875  int num /**< minimum number of entries to store */
37876  )
37877 {
37878  assert(scip != NULL);
37879 
37880  return SCIPsetCalcMemGrowSize(scip->set, num);
37881 }
37882 
37883 /** extends a dynamically allocated block memory array to be able to store at least the given number of elements;
37884  * use SCIPensureBlockMemoryArray() define to call this method!
37885  *
37886  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
37887  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
37888  */
37890  SCIP* scip, /**< SCIP data structure */
37891  void** arrayptr, /**< pointer to dynamically sized array */
37892  size_t elemsize, /**< size in bytes of each element in array */
37893  int* arraysize, /**< pointer to current array size */
37894  int minsize /**< required minimal array size */
37895  )
37896 {
37897  assert(scip != NULL);
37898  assert(arrayptr != NULL);
37899  assert(elemsize > 0);
37900  assert(arraysize != NULL);
37901 
37902  if( minsize > *arraysize )
37903  {
37904  int newsize;
37905 
37906  newsize = SCIPsetCalcMemGrowSize(scip->set, minsize);
37907  SCIP_ALLOC( BMSreallocBlockMemorySize(SCIPblkmem(scip), arrayptr, *arraysize * elemsize, newsize * elemsize) );
37908  *arraysize = newsize;
37909  }
37910 
37911  return SCIP_OKAY;
37912 }
37913 
37914 /** gets a memory buffer with at least the given size
37915  *
37916  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
37917  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
37918  */
37920  SCIP* scip, /**< SCIP data structure */
37921  void** ptr, /**< pointer to store the buffer */
37922  int size /**< required size in bytes of buffer */
37923  )
37924 {
37925  assert(scip != NULL);
37926  assert(ptr != NULL);
37927 
37928  SCIP_CALL( SCIPsetAllocBufferSize(scip->set, ptr, size) );
37929 
37930  return SCIP_OKAY;
37931 }
37932 
37933 /** allocates a memory buffer with at least the given size and copies the given memory into the buffer
37934  *
37935  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
37936  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
37937  */
37939  SCIP* scip, /**< SCIP data structure */
37940  void** ptr, /**< pointer to store the buffer */
37941  const void* source, /**< memory block to copy into the buffer */
37942  int size /**< required size in bytes of buffer */
37943  )
37944 {
37945  assert(scip != NULL);
37946  assert(ptr != NULL);
37947 
37948  SCIP_CALL( SCIPsetDuplicateBufferSize(scip->set, ptr, source, size) );
37949 
37950  return SCIP_OKAY;
37951 }
37952 
37953 /** reallocates a memory buffer to at least the given size
37954  *
37955  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
37956  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
37957  */
37959  SCIP* scip, /**< SCIP data structure */
37960  void** ptr, /**< pointer to the buffer */
37961  int size /**< required size in bytes of buffer */
37962  )
37963 {
37964  assert(scip != NULL);
37965  assert(ptr != NULL);
37966 
37967  SCIP_CALL( SCIPsetReallocBufferSize(scip->set, ptr, size) );
37968 
37969  return SCIP_OKAY;
37970 }
37971 
37972 /** frees a memory buffer */
37974  SCIP* scip, /**< SCIP data structure */
37975  void** ptr, /**< pointer to the buffer */
37976  int dummysize /**< used to get a safer define for SCIPfreeBuffer() and SCIPfreeBufferArray() */
37977  )
37978 { /*lint --e{715}*/
37979  assert(scip != NULL);
37980  assert(ptr != NULL);
37981  assert(dummysize == 0);
37982 
37983  SCIPsetFreeBufferSize(scip->set, ptr);
37984 }
37985 
37986 /** prints output about used memory */
37988  SCIP* scip /**< SCIP data structure */
37989  )
37990 {
37991  assert(scip != NULL);
37992  assert(scip->mem != NULL);
37993  assert(scip->set != NULL);
37994 
37995  BMSdisplayMemory();
37996 
37997  SCIPmessagePrintInfo(scip->messagehdlr, "\nParameter Block Memory (%p):\n", scip->mem->setmem);
37999 
38000  SCIPmessagePrintInfo(scip->messagehdlr, "\nSolution Block Memory (%p):\n", scip->mem->probmem);
38002 
38003  SCIPmessagePrintInfo(scip->messagehdlr, "\nMemory Buffers:\n");
38004  SCIPbufferPrint(scip->set->buffer);
38005 }
38006 
38007 
38008 
38009 
38010 /*
38011  * simple functions implemented as defines
38012  */
38013 
38014 /* In debug mode, the following methods are implemented as function calls to ensure
38015  * type validity.
38016  * In optimized mode, the methods are implemented as defines to improve performance.
38017  * However, we want to have them in the library anyways, so we have to undef the defines.
38018  */
38019 
38020 #undef SCIPinfinity
38021 #undef SCIPisInfinity
38022 #undef SCIPisEQ
38023 #undef SCIPisLT
38024 #undef SCIPisLE
38025 #undef SCIPisGT
38026 #undef SCIPisGE
38027 #undef SCIPisZero
38028 #undef SCIPisPositive
38029 #undef SCIPisNegative
38030 #undef SCIPisIntegral
38031 #undef SCIPisScalingIntegral
38032 #undef SCIPisFracIntegral
38033 #undef SCIPfloor
38034 #undef SCIPceil
38035 #undef SCIPround
38036 #undef SCIPfrac
38037 #undef SCIPisSumEQ
38038 #undef SCIPisSumLT
38039 #undef SCIPisSumLE
38040 #undef SCIPisSumGT
38041 #undef SCIPisSumGE
38042 #undef SCIPisSumZero
38043 #undef SCIPisSumPositive
38044 #undef SCIPisSumNegative
38045 #undef SCIPisFeasEQ
38046 #undef SCIPisFeasLT
38047 #undef SCIPisFeasLE
38048 #undef SCIPisFeasGT
38049 #undef SCIPisFeasGE
38050 #undef SCIPisFeasZero
38051 #undef SCIPisFeasPositive
38052 #undef SCIPisFeasNegative
38053 #undef SCIPisFeasIntegral
38054 #undef SCIPisFeasFracIntegral
38055 #undef SCIPfeasFloor
38056 #undef SCIPfeasCeil
38057 #undef SCIPfeasRound
38058 #undef SCIPfeasFrac
38059 #undef SCIPisLbBetter
38060 #undef SCIPisUbBetter
38061 #undef SCIPisRelEQ
38062 #undef SCIPisRelLT
38063 #undef SCIPisRelLE
38064 #undef SCIPisRelGT
38065 #undef SCIPisRelGE
38066 #undef SCIPisSumRelEQ
38067 #undef SCIPisSumRelLT
38068 #undef SCIPisSumRelLE
38069 #undef SCIPisSumRelGT
38070 #undef SCIPisSumRelGE
38071 #undef SCIPisUpdateUnreliable
38072 #undef SCIPisHugeValue
38073 #undef SCIPgetHugeValue
38074 #undef SCIPcreateRealarray
38075 #undef SCIPfreeRealarray
38076 #undef SCIPextendRealarray
38077 #undef SCIPclearRealarray
38078 #undef SCIPgetRealarrayVal
38079 #undef SCIPsetRealarrayVal
38080 #undef SCIPincRealarrayVal
38081 #undef SCIPgetRealarrayMinIdx
38082 #undef SCIPgetRealarrayMaxIdx
38083 #undef SCIPcreateIntarray
38084 #undef SCIPfreeIntarray
38085 #undef SCIPextendIntarray
38086 #undef SCIPclearIntarray
38087 #undef SCIPgetIntarrayVal
38088 #undef SCIPsetIntarrayVal
38089 #undef SCIPincIntarrayVal
38090 #undef SCIPgetIntarrayMinIdx
38091 #undef SCIPgetIntarrayMaxIdx
38092 #undef SCIPcreateBoolarray
38093 #undef SCIPfreeBoolarray
38094 #undef SCIPextendBoolarray
38095 #undef SCIPclearBoolarray
38096 #undef SCIPgetBoolarrayVal
38097 #undef SCIPsetBoolarrayVal
38098 #undef SCIPgetBoolarrayMinIdx
38099 #undef SCIPgetBoolarrayMaxIdx
38100 #undef SCIPcreatePtrarray
38101 #undef SCIPfreePtrarray
38102 #undef SCIPextendPtrarray
38103 #undef SCIPclearPtrarray
38104 #undef SCIPgetPtrarrayVal
38105 #undef SCIPsetPtrarrayVal
38106 #undef SCIPgetPtrarrayMinIdx
38107 #undef SCIPgetPtrarrayMaxIdx
38108 
38109 /** checks, if values are in range of epsilon */
38111  SCIP* scip, /**< SCIP data structure */
38112  SCIP_Real val1, /**< first value to be compared */
38113  SCIP_Real val2 /**< second value to be compared */
38114  )
38115 {
38116  assert(scip != NULL);
38117  assert(scip->set != NULL);
38118 
38119  /* avoid to compare two different infinities; the reason for that is
38120  * that such a comparison can lead to unexpected results */
38121  assert( ((!SCIPisInfinity(scip, val1) || !SCIPisInfinity(scip, val2))
38122  && (!SCIPisInfinity(scip, -val1) || !SCIPisInfinity(scip, -val2)))
38123  || val1 == val2 ); /*lint !e777*/
38124 
38125  return SCIPsetIsEQ(scip->set, val1, val2);
38126 }
38127 
38128 /** checks, if val1 is (more than epsilon) lower than val2 */
38130  SCIP* scip, /**< SCIP data structure */
38131  SCIP_Real val1, /**< first value to be compared */
38132  SCIP_Real val2 /**< second value to be compared */
38133  )
38134 {
38135  assert(scip != NULL);
38136  assert(scip->set != NULL);
38137 
38138  /* avoid to compare two different infinities; the reason for that is
38139  * that such a comparison can lead to unexpected results */
38140  assert( ((!SCIPisInfinity(scip, val1) || !SCIPisInfinity(scip, val2))
38141  && (!SCIPisInfinity(scip, -val1) || !SCIPisInfinity(scip, -val2)))
38142  || val1 == val2 ); /*lint !e777*/
38143 
38144  return SCIPsetIsLT(scip->set, val1, val2);
38145 }
38146 
38147 /** checks, if val1 is not (more than epsilon) greater than val2 */
38149  SCIP* scip, /**< SCIP data structure */
38150  SCIP_Real val1, /**< first value to be compared */
38151  SCIP_Real val2 /**< second value to be compared */
38152  )
38153 {
38154  assert(scip != NULL);
38155  assert(scip->set != NULL);
38156 
38157  /* avoid to compare two different infinities; the reason for that is
38158  * that such a comparison can lead to unexpected results */
38159  assert( ((!SCIPisInfinity(scip, val1) || !SCIPisInfinity(scip, val2))
38160  && (!SCIPisInfinity(scip, -val1) || !SCIPisInfinity(scip, -val2)))
38161  || val1 == val2 ); /*lint !e777*/
38162 
38163  return SCIPsetIsLE(scip->set, val1, val2);
38164 }
38165 
38166 /** checks, if val1 is (more than epsilon) greater than val2 */
38168  SCIP* scip, /**< SCIP data structure */
38169  SCIP_Real val1, /**< first value to be compared */
38170  SCIP_Real val2 /**< second value to be compared */
38171  )
38172 {
38173  assert(scip != NULL);
38174  assert(scip->set != NULL);
38175 
38176  /* avoid to compare two different infinities; the reason for that is
38177  * that such a comparison can lead to unexpected results */
38178  assert( ((!SCIPisInfinity(scip, val1) || !SCIPisInfinity(scip, val2))
38179  && (!SCIPisInfinity(scip, -val1) || !SCIPisInfinity(scip, -val2)))
38180  || val1 == val2 ); /*lint !e777*/
38181 
38182  return SCIPsetIsGT(scip->set, val1, val2);
38183 }
38184 
38185 /** checks, if val1 is not (more than epsilon) lower than val2 */
38187  SCIP* scip, /**< SCIP data structure */
38188  SCIP_Real val1, /**< first value to be compared */
38189  SCIP_Real val2 /**< second value to be compared */
38190  )
38191 {
38192  assert(scip != NULL);
38193  assert(scip->set != NULL);
38194 
38195  /* avoid to compare two different infinities; the reason for that is
38196  * that such a comparison can lead to unexpected results */
38197  assert( ((!SCIPisInfinity(scip, val1) || !SCIPisInfinity(scip, val2))
38198  && (!SCIPisInfinity(scip, -val1) || !SCIPisInfinity(scip, -val2)))
38199  || val1 == val2 ); /*lint !e777*/
38200 
38201  return SCIPsetIsGE(scip->set, val1, val2);
38202 }
38203 
38204 /** returns value treated as infinity */
38206  SCIP* scip /**< SCIP data structure */
38207  )
38208 {
38209  assert(scip != NULL);
38210  assert(scip->set != NULL);
38211 
38212  return SCIPsetInfinity(scip->set);
38213 }
38214 
38215 /** checks, if value is (positive) infinite */
38217  SCIP* scip, /**< SCIP data structure */
38218  SCIP_Real val /**< value to be compared against infinity */
38219  )
38220 {
38221  assert(scip != NULL);
38222  assert(scip->set != NULL);
38223 
38224  return SCIPsetIsInfinity(scip->set, val);
38225 }
38226 
38227 /** checks, if value is huge and should be handled separately (e.g., in activity computation) */
38229  SCIP* scip, /**< SCIP data structure */
38230  SCIP_Real val /**< value to be checked whether it is huge */
38231  )
38232 {
38233  assert(scip != NULL);
38234  assert(scip->set != NULL);
38235 
38236  return SCIPsetIsHugeValue(scip->set, val);
38237 }
38238 
38239 /** returns the minimum value that is regarded as huge and should be handled separately (e.g., in activity
38240  * computation)
38241  */
38243  SCIP* scip /**< SCIP data structure */
38244  )
38245 {
38246  assert(scip != NULL);
38247  assert(scip->set != NULL);
38248 
38249  return SCIPsetGetHugeValue(scip->set);
38250 }
38251 
38252 /** checks, if value is in range epsilon of 0.0 */
38254  SCIP* scip, /**< SCIP data structure */
38255  SCIP_Real val /**< value to process */
38256  )
38257 {
38258  assert(scip != NULL);
38259  assert(scip->set != NULL);
38260 
38261  return SCIPsetIsZero(scip->set, val);
38262 }
38263 
38264 /** checks, if value is greater than epsilon */
38266  SCIP* scip, /**< SCIP data structure */
38267  SCIP_Real val /**< value to process */
38268  )
38269 {
38270  assert(scip != NULL);
38271  assert(scip->set != NULL);
38272 
38273  return SCIPsetIsPositive(scip->set, val);
38274 }
38275 
38276 /** checks, if value is lower than -epsilon */
38278  SCIP* scip, /**< SCIP data structure */
38279  SCIP_Real val /**< value to process */
38280  )
38281 {
38282  assert(scip != NULL);
38283  assert(scip->set != NULL);
38284 
38285  return SCIPsetIsNegative(scip->set, val);
38286 }
38287 
38288 /** checks, if value is integral within epsilon */
38290  SCIP* scip, /**< SCIP data structure */
38291  SCIP_Real val /**< value to process */
38292  )
38293 {
38294  assert(scip != NULL);
38295  assert(scip->set != NULL);
38296 
38297  return SCIPsetIsIntegral(scip->set, val);
38298 }
38299 
38300 /** checks whether the product val * scalar is integral in epsilon scaled by scalar */
38302  SCIP* scip, /**< SCIP data structure */
38303  SCIP_Real val, /**< unscaled value to check for scaled integrality */
38304  SCIP_Real scalar /**< value to scale val with for checking for integrality */
38305  )
38306 {
38307  assert(scip != NULL);
38308  assert(scip->set != NULL);
38309 
38310  return SCIPsetIsScalingIntegral(scip->set, val, scalar);
38311 }
38312 
38313 /** checks, if given fractional part is smaller than epsilon */
38315  SCIP* scip, /**< SCIP data structure */
38316  SCIP_Real val /**< value to process */
38317  )
38318 {
38319  assert(scip != NULL);
38320  assert(scip->set != NULL);
38321 
38322  return SCIPsetIsFracIntegral(scip->set, val);
38323 }
38324 
38325 /** rounds value + epsilon down to the next integer */
38327  SCIP* scip, /**< SCIP data structure */
38328  SCIP_Real val /**< value to process */
38329  )
38330 {
38331  assert(scip != NULL);
38332  assert(scip->set != NULL);
38333 
38334  return SCIPsetFloor(scip->set, val);
38335 }
38336 
38337 /** rounds value - epsilon up to the next integer */
38339  SCIP* scip, /**< SCIP data structure */
38340  SCIP_Real val /**< value to process */
38341  )
38342 {
38343  assert(scip != NULL);
38344  assert(scip->set != NULL);
38345 
38346  return SCIPsetCeil(scip->set, val);
38347 }
38348 
38349 /** rounds value to the nearest integer with epsilon tolerance */
38351  SCIP* scip, /**< SCIP data structure */
38352  SCIP_Real val /**< value to process */
38353  )
38354 {
38355  assert(scip != NULL);
38356  assert(scip->set != NULL);
38357 
38358  return SCIPsetRound(scip->set, val);
38359 }
38360 
38361 /** returns fractional part of value, i.e. x - floor(x) in epsilon tolerance */
38363  SCIP* scip, /**< SCIP data structure */
38364  SCIP_Real val /**< value to return fractional part for */
38365  )
38366 {
38367  assert(scip != NULL);
38368  assert(scip->set != NULL);
38369 
38370  return SCIPsetFrac(scip->set, val);
38371 }
38372 
38373 /** checks, if values are in range of sumepsilon */
38375  SCIP* scip, /**< SCIP data structure */
38376  SCIP_Real val1, /**< first value to be compared */
38377  SCIP_Real val2 /**< second value to be compared */
38378  )
38379 {
38380  assert(scip != NULL);
38381  assert(scip->set != NULL);
38382 
38383  /* avoid to compare two different infinities; the reason for that is
38384  * that such a comparison can lead to unexpected results */
38385  assert( ((!SCIPisInfinity(scip, val1) || !SCIPisInfinity(scip, val2))
38386  && (!SCIPisInfinity(scip, -val1) || !SCIPisInfinity(scip, -val2)))
38387  || val1 == val2 ); /*lint !e777*/
38388 
38389  return SCIPsetIsSumEQ(scip->set, val1, val2);
38390 }
38391 
38392 /** checks, if val1 is (more than sumepsilon) lower than val2 */
38394  SCIP* scip, /**< SCIP data structure */
38395  SCIP_Real val1, /**< first value to be compared */
38396  SCIP_Real val2 /**< second value to be compared */
38397  )
38398 {
38399  assert(scip != NULL);
38400  assert(scip->set != NULL);
38401 
38402  /* avoid to compare two different infinities; the reason for that is
38403  * that such a comparison can lead to unexpected results */
38404  assert( ((!SCIPisInfinity(scip, val1) || !SCIPisInfinity(scip, val2))
38405  && (!SCIPisInfinity(scip, -val1) || !SCIPisInfinity(scip, -val2)))
38406  || val1 == val2 ); /*lint !e777*/
38407 
38408  return SCIPsetIsSumLT(scip->set, val1, val2);
38409 }
38410 
38411 /** checks, if val1 is not (more than sumepsilon) greater than val2 */
38413  SCIP* scip, /**< SCIP data structure */
38414  SCIP_Real val1, /**< first value to be compared */
38415  SCIP_Real val2 /**< second value to be compared */
38416  )
38417 {
38418  assert(scip != NULL);
38419  assert(scip->set != NULL);
38420  /* avoid to compare two different infinities; the reason for that is
38421  * that such a comparison can lead to unexpected results */
38422  assert( ((!SCIPisInfinity(scip, val1) || !SCIPisInfinity(scip, val2))
38423  && (!SCIPisInfinity(scip, -val1) || !SCIPisInfinity(scip, -val2)))
38424  || val1 == val2 ); /*lint !e777*/
38425 
38426  return SCIPsetIsSumLE(scip->set, val1, val2);
38427 }
38428 
38429 /** checks, if val1 is (more than sumepsilon) greater than val2 */
38431  SCIP* scip, /**< SCIP data structure */
38432  SCIP_Real val1, /**< first value to be compared */
38433  SCIP_Real val2 /**< second value to be compared */
38434  )
38435 {
38436  assert(scip != NULL);
38437  assert(scip->set != NULL);
38438 
38439  /* avoid to compare two different infinities; the reason for that is
38440  * that such a comparison can lead to unexpected results */
38441  assert( ((!SCIPisInfinity(scip, val1) || !SCIPisInfinity(scip, val2))
38442  && (!SCIPisInfinity(scip, -val1) || !SCIPisInfinity(scip, -val2)))
38443  || val1 == val2 ); /*lint !e777*/
38444 
38445  return SCIPsetIsSumGT(scip->set, val1, val2);
38446 }
38447 
38448 /** checks, if val1 is not (more than sumepsilon) lower than val2 */
38450  SCIP* scip, /**< SCIP data structure */
38451  SCIP_Real val1, /**< first value to be compared */
38452  SCIP_Real val2 /**< second value to be compared */
38453  )
38454 {
38455  assert(scip != NULL);
38456  assert(scip->set != NULL);
38457 
38458  /* avoid to compare two different infinities; the reason for that is
38459  * that such a comparison can lead to unexpected results */
38460  assert( ((!SCIPisInfinity(scip, val1) || !SCIPisInfinity(scip, val2))
38461  && (!SCIPisInfinity(scip, -val1) || !SCIPisInfinity(scip, -val2)))
38462  || val1 == val2 ); /*lint !e777*/
38463 
38464  return SCIPsetIsSumGE(scip->set, val1, val2);
38465 }
38466 
38467 /** checks, if value is in range sumepsilon of 0.0 */
38469  SCIP* scip, /**< SCIP data structure */
38470  SCIP_Real val /**< value to process */
38471  )
38472 {
38473  assert(scip != NULL);
38474  assert(scip->set != NULL);
38475 
38476  return SCIPsetIsSumZero(scip->set, val);
38477 }
38478 
38479 /** checks, if value is greater than sumepsilon */
38481  SCIP* scip, /**< SCIP data structure */
38482  SCIP_Real val /**< value to process */
38483  )
38484 {
38485  assert(scip != NULL);
38486  assert(scip->set != NULL);
38487 
38488  return SCIPsetIsSumPositive(scip->set, val);
38489 }
38490 
38491 /** checks, if value is lower than -sumepsilon */
38493  SCIP* scip, /**< SCIP data structure */
38494  SCIP_Real val /**< value to process */
38495  )
38496 {
38497  assert(scip != NULL);
38498  assert(scip->set != NULL);
38499 
38500  return SCIPsetIsSumNegative(scip->set, val);
38501 }
38502 
38503 /** checks, if relative difference of values is in range of feasibility tolerance */
38505  SCIP* scip, /**< SCIP data structure */
38506  SCIP_Real val1, /**< first value to be compared */
38507  SCIP_Real val2 /**< second value to be compared */
38508  )
38509 {
38510  assert(scip != NULL);
38511  assert(scip->set != NULL);
38512 
38513  /* avoid to compare two different infinities; the reason for that is
38514  * that such a comparison can lead to unexpected results */
38515  assert( ((!SCIPisInfinity(scip, val1) || !SCIPisInfinity(scip, val2))
38516  && (!SCIPisInfinity(scip, -val1) || !SCIPisInfinity(scip, -val2)))
38517  || val1 == val2 ); /*lint !e777*/
38518 
38519  return SCIPsetIsFeasEQ(scip->set, val1, val2);
38520 }
38521 
38522 /** checks, if relative difference val1 and val2 is lower than feasibility tolerance */
38524  SCIP* scip, /**< SCIP data structure */
38525  SCIP_Real val1, /**< first value to be compared */
38526  SCIP_Real val2 /**< second value to be compared */
38527  )
38528 {
38529  assert(scip != NULL);
38530  assert(scip->set != NULL);
38531 
38532  /* avoid to compare two different infinities; the reason for that is
38533  * that such a comparison can lead to unexpected results */
38534  assert( ((!SCIPisInfinity(scip, val1) || !SCIPisInfinity(scip, val2))
38535  && (!SCIPisInfinity(scip, -val1) || !SCIPisInfinity(scip, -val2)))
38536  || val1 == val2 ); /*lint !e777*/
38537 
38538  return SCIPsetIsFeasLT(scip->set, val1, val2);
38539 }
38540 
38541 /** checks, if relative difference of val1 and val2 is not greater than feasibility tolerance */
38543  SCIP* scip, /**< SCIP data structure */
38544  SCIP_Real val1, /**< first value to be compared */
38545  SCIP_Real val2 /**< second value to be compared */
38546  )
38547 {
38548  assert(scip != NULL);
38549  assert(scip->set != NULL);
38550 
38551  /* avoid to compare two different infinities; the reason for that is
38552  * that such a comparison can lead to unexpected results */
38553  assert( ((!SCIPisInfinity(scip, val1) || !SCIPisInfinity(scip, val2))
38554  && (!SCIPisInfinity(scip, -val1) || !SCIPisInfinity(scip, -val2)))
38555  || val1 == val2 ); /*lint !e777*/
38556 
38557  return SCIPsetIsFeasLE(scip->set, val1, val2);
38558 }
38559 
38560 /** checks, if relative difference of val1 and val2 is greater than feastol */
38562  SCIP* scip, /**< SCIP data structure */
38563  SCIP_Real val1, /**< first value to be compared */
38564  SCIP_Real val2 /**< second value to be compared */
38565  )
38566 {
38567  assert(scip != NULL);
38568  assert(scip->set != NULL);
38569 
38570  /* avoid to compare two different infinities; the reason for that is
38571  * that such a comparison can lead to unexpected results */
38572  assert( ((!SCIPisInfinity(scip, val1) || !SCIPisInfinity(scip, val2))
38573  && (!SCIPisInfinity(scip, -val1) || !SCIPisInfinity(scip, -val2)))
38574  || val1 == val2 ); /*lint !e777*/
38575 
38576  return SCIPsetIsFeasGT(scip->set, val1, val2);
38577 }
38578 
38579 /** checks, if relative difference of val1 and val2 is not lower than -feastol */
38581  SCIP* scip, /**< SCIP data structure */
38582  SCIP_Real val1, /**< first value to be compared */
38583  SCIP_Real val2 /**< second value to be compared */
38584  )
38585 {
38586  assert(scip != NULL);
38587  assert(scip->set != NULL);
38588 
38589  /* avoid to compare two different infinities; the reason for that is
38590  * that such a comparison can lead to unexpected results */
38591  assert( ((!SCIPisInfinity(scip, val1) || !SCIPisInfinity(scip, val2))
38592  && (!SCIPisInfinity(scip, -val1) || !SCIPisInfinity(scip, -val2)))
38593  || val1 == val2 ); /*lint !e777*/
38594 
38595  return SCIPsetIsFeasGE(scip->set, val1, val2);
38596 }
38597 
38598 /** checks, if value is in range feasibility tolerance of 0.0 */
38600  SCIP* scip, /**< SCIP data structure */
38601  SCIP_Real val /**< value to process */
38602  )
38603 {
38604  assert(scip != NULL);
38605  assert(scip->set != NULL);
38606 
38607  return SCIPsetIsFeasZero(scip->set, val);
38608 }
38609 
38610 /** checks, if value is greater than feasibility tolerance */
38612  SCIP* scip, /**< SCIP data structure */
38613  SCIP_Real val /**< value to process */
38614  )
38615 {
38616  assert(scip != NULL);
38617  assert(scip->set != NULL);
38618 
38619  return SCIPsetIsFeasPositive(scip->set, val);
38620 }
38621 
38622 /** checks, if value is lower than -feasibility tolerance */
38624  SCIP* scip, /**< SCIP data structure */
38625  SCIP_Real val /**< value to process */
38626  )
38627 {
38628  assert(scip != NULL);
38629  assert(scip->set != NULL);
38630 
38631  return SCIPsetIsFeasNegative(scip->set, val);
38632 }
38633 
38634 /** checks, if value is integral within the LP feasibility bounds */
38636  SCIP* scip, /**< SCIP data structure */
38637  SCIP_Real val /**< value to process */
38638  )
38639 {
38640  assert(scip != NULL);
38641  assert(scip->set != NULL);
38642 
38643  return SCIPsetIsFeasIntegral(scip->set, val);
38644 }
38645 
38646 /** checks, if given fractional part is smaller than feastol */
38648  SCIP* scip, /**< SCIP data structure */
38649  SCIP_Real val /**< value to process */
38650  )
38651 {
38652  assert(scip != NULL);
38653  assert(scip->set != NULL);
38654 
38655  return SCIPsetIsFeasFracIntegral(scip->set, val);
38656 }
38657 
38658 /** rounds value + feasibility tolerance down to the next integer */
38660  SCIP* scip, /**< SCIP data structure */
38661  SCIP_Real val /**< value to process */
38662  )
38663 {
38664  assert(scip != NULL);
38665  assert(scip->set != NULL);
38666 
38667  return SCIPsetFeasFloor(scip->set, val);
38668 }
38669 
38670 /** rounds value - feasibility tolerance up to the next integer */
38672  SCIP* scip, /**< SCIP data structure */
38673  SCIP_Real val /**< value to process */
38674  )
38675 {
38676  assert(scip != NULL);
38677  assert(scip->set != NULL);
38678 
38679  return SCIPsetFeasCeil(scip->set, val);
38680 }
38681 
38682 /** rounds value - feasibility tolerance up to the next integer in feasibility tolerance */
38684  SCIP* scip, /**< SCIP data structure */
38685  SCIP_Real val /**< value to process */
38686  )
38687 {
38688  assert(scip != NULL);
38689  assert(scip->set != NULL);
38690 
38691  return SCIPsetFeasRound(scip->set, val);
38692 }
38693 
38694 /** returns fractional part of value, i.e. x - floor(x) */
38696  SCIP* scip, /**< SCIP data structure */
38697  SCIP_Real val /**< value to process */
38698  )
38699 {
38700  assert(scip != NULL);
38701  assert(scip->set != NULL);
38702 
38703  return SCIPsetFeasFrac(scip->set, val);
38704 }
38705 
38706 /** checks, if the given new lower bound is tighter (w.r.t. bound strengthening epsilon) than the old one */
38708  SCIP* scip, /**< SCIP data structure */
38709  SCIP_Real newlb, /**< new lower bound */
38710  SCIP_Real oldlb, /**< old lower bound */
38711  SCIP_Real oldub /**< old upper bound */
38712  )
38713 {
38714  assert(scip != NULL);
38715 
38716  return SCIPsetIsLbBetter(scip->set, newlb, oldlb, oldub);
38717 }
38718 
38719 /** checks, if the given new upper bound is tighter (w.r.t. bound strengthening epsilon) than the old one */
38721  SCIP* scip, /**< SCIP data structure */
38722  SCIP_Real newub, /**< new upper bound */
38723  SCIP_Real oldlb, /**< old lower bound */
38724  SCIP_Real oldub /**< old upper bound */
38725  )
38726 {
38727  assert(scip != NULL);
38728 
38729  return SCIPsetIsUbBetter(scip->set, newub, oldlb, oldub);
38730 }
38731 
38732 /** checks, if relative difference of values is in range of epsilon */
38734  SCIP* scip, /**< SCIP data structure */
38735  SCIP_Real val1, /**< first value to be compared */
38736  SCIP_Real val2 /**< second value to be compared */
38737  )
38738 {
38739  assert(scip != NULL);
38740  assert(scip->set != NULL);
38741 
38742  /* avoid to compare two different infinities; the reason for that is
38743  * that such a comparison can lead to unexpected results */
38744  assert( ((!SCIPisInfinity(scip, val1) || !SCIPisInfinity(scip, val2))
38745  && (!SCIPisInfinity(scip, -val1) || !SCIPisInfinity(scip, -val2)))
38746  || val1 == val2 ); /*lint !e777*/
38747 
38748  return SCIPsetIsRelEQ(scip->set, val1, val2);
38749 }
38750 
38751 /** checks, if relative difference of val1 and val2 is lower than epsilon */
38753  SCIP* scip, /**< SCIP data structure */
38754  SCIP_Real val1, /**< first value to be compared */
38755  SCIP_Real val2 /**< second value to be compared */
38756  )
38757 {
38758  assert(scip != NULL);
38759  assert(scip->set != NULL);
38760 
38761  /* avoid to compare two different infinities; the reason for that is
38762  * that such a comparison can lead to unexpected results */
38763  assert( ((!SCIPisInfinity(scip, val1) || !SCIPisInfinity(scip, val2))
38764  && (!SCIPisInfinity(scip, -val1) || !SCIPisInfinity(scip, -val2)))
38765  || val1 == val2 ); /*lint !e777*/
38766 
38767  return SCIPsetIsRelLT(scip->set, val1, val2);
38768 }
38769 
38770 /** checks, if relative difference of val1 and val2 is not greater than epsilon */
38772  SCIP* scip, /**< SCIP data structure */
38773  SCIP_Real val1, /**< first value to be compared */
38774  SCIP_Real val2 /**< second value to be compared */
38775  )
38776 {
38777  assert(scip != NULL);
38778  assert(scip->set != NULL);
38779 
38780  /* avoid to compare two different infinities; the reason for that is
38781  * that such a comparison can lead to unexpected results */
38782  assert( ((!SCIPisInfinity(scip, val1) || !SCIPisInfinity(scip, val2))
38783  && (!SCIPisInfinity(scip, -val1) || !SCIPisInfinity(scip, -val2)))
38784  || val1 == val2 ); /*lint !e777*/
38785 
38786  return SCIPsetIsRelLE(scip->set, val1, val2);
38787 }
38788 
38789 /** checks, if relative difference of val1 and val2 is greater than epsilon */
38791  SCIP* scip, /**< SCIP data structure */
38792  SCIP_Real val1, /**< first value to be compared */
38793  SCIP_Real val2 /**< second value to be compared */
38794  )
38795 {
38796  assert(scip != NULL);
38797  assert(scip->set != NULL);
38798 
38799  /* avoid to compare two different infinities; the reason for that is
38800  * that such a comparison can lead to unexpected results */
38801  assert( ((!SCIPisInfinity(scip, val1) || !SCIPisInfinity(scip, val2))
38802  && (!SCIPisInfinity(scip, -val1) || !SCIPisInfinity(scip, -val2)))
38803  || val1 == val2 ); /*lint !e777*/
38804 
38805  return SCIPsetIsRelGT(scip->set, val1, val2);
38806 }
38807 
38808 /** checks, if relative difference of val1 and val2 is not lower than -epsilon */
38810  SCIP* scip, /**< SCIP data structure */
38811  SCIP_Real val1, /**< first value to be compared */
38812  SCIP_Real val2 /**< second value to be compared */
38813  )
38814 {
38815  assert(scip != NULL);
38816  assert(scip->set != NULL);
38817 
38818  /* avoid to compare two different infinities; the reason for that is
38819  * that such a comparison can lead to unexpected results */
38820  assert( ((!SCIPisInfinity(scip, val1) || !SCIPisInfinity(scip, val2))
38821  && (!SCIPisInfinity(scip, -val1) || !SCIPisInfinity(scip, -val2)))
38822  || val1 == val2 ); /*lint !e777*/
38823 
38824  return SCIPsetIsRelGE(scip->set, val1, val2);
38825 }
38826 
38827 /** checks, if relative difference of values is in range of sumepsilon */
38829  SCIP* scip, /**< SCIP data structure */
38830  SCIP_Real val1, /**< first value to be compared */
38831  SCIP_Real val2 /**< second value to be compared */
38832  )
38833 {
38834  assert(scip != NULL);
38835  assert(scip->set != NULL);
38836 
38837  /* avoid to compare two different infinities; the reason for that is
38838  * that such a comparison can lead to unexpected results */
38839  assert( ((!SCIPisInfinity(scip, val1) || !SCIPisInfinity(scip, val2))
38840  && (!SCIPisInfinity(scip, -val1) || !SCIPisInfinity(scip, -val2)))
38841  || val1 == val2 ); /*lint !e777*/
38842 
38843  return SCIPsetIsSumRelEQ(scip->set, val1, val2);
38844 }
38845 
38846 /** checks, if relative difference of val1 and val2 is lower than sumepsilon */
38848  SCIP* scip, /**< SCIP data structure */
38849  SCIP_Real val1, /**< first value to be compared */
38850  SCIP_Real val2 /**< second value to be compared */
38851  )
38852 {
38853  assert(scip != NULL);
38854  assert(scip->set != NULL);
38855 
38856  /* avoid to compare two different infinities; the reason for that is
38857  * that such a comparison can lead to unexpected results */
38858  assert( ((!SCIPisInfinity(scip, val1) || !SCIPisInfinity(scip, val2))
38859  && (!SCIPisInfinity(scip, -val1) || !SCIPisInfinity(scip, -val2)))
38860  || val1 == val2 ); /*lint !e777*/
38861 
38862  return SCIPsetIsSumRelLT(scip->set, val1, val2);
38863 }
38864 
38865 /** checks, if relative difference of val1 and val2 is not greater than sumepsilon */
38867  SCIP* scip, /**< SCIP data structure */
38868  SCIP_Real val1, /**< first value to be compared */
38869  SCIP_Real val2 /**< second value to be compared */
38870  )
38871 {
38872  assert(scip != NULL);
38873  assert(scip->set != NULL);
38874 
38875  /* avoid to compare two different infinities; the reason for that is
38876  * that such a comparison can lead to unexpected results */
38877  assert( ((!SCIPisInfinity(scip, val1) || !SCIPisInfinity(scip, val2))
38878  && (!SCIPisInfinity(scip, -val1) || !SCIPisInfinity(scip, -val2)))
38879  || val1 == val2 ); /*lint !e777*/
38880 
38881  return SCIPsetIsSumRelLE(scip->set, val1, val2);
38882 }
38883 
38884 /** checks, if relative difference of val1 and val2 is greater than sumepsilon */
38886  SCIP* scip, /**< SCIP data structure */
38887  SCIP_Real val1, /**< first value to be compared */
38888  SCIP_Real val2 /**< second value to be compared */
38889  )
38890 {
38891  assert(scip != NULL);
38892  assert(scip->set != NULL);
38893 
38894  /* avoid to compare two different infinities; the reason for that is
38895  * that such a comparison can lead to unexpected results */
38896  assert( ((!SCIPisInfinity(scip, val1) || !SCIPisInfinity(scip, val2))
38897  && (!SCIPisInfinity(scip, -val1) || !SCIPisInfinity(scip, -val2)))
38898  || val1 == val2 ); /*lint !e777*/
38899 
38900  return SCIPsetIsSumRelGT(scip->set, val1, val2);
38901 }
38902 
38903 /** checks, if relative difference of val1 and val2 is not lower than -sumepsilon */
38905  SCIP* scip, /**< SCIP data structure */
38906  SCIP_Real val1, /**< first value to be compared */
38907  SCIP_Real val2 /**< second value to be compared */
38908  )
38909 {
38910  assert(scip != NULL);
38911  assert(scip->set != NULL);
38912 
38913  /* avoid to compare two different infinities; the reason for that is
38914  * that such a comparison can lead to unexpected results */
38915  assert( ((!SCIPisInfinity(scip, val1) || !SCIPisInfinity(scip, val2))
38916  && (!SCIPisInfinity(scip, -val1) || !SCIPisInfinity(scip, -val2)))
38917  || val1 == val2 ); /*lint !e777*/
38918 
38919  return SCIPsetIsSumRelGE(scip->set, val1, val2);
38920 }
38921 
38922 /** Checks, if an iteratively updated value is reliable or should be recomputed from scratch.
38923  * This is useful, if the value, e.g., the activity of a linear constraint or the pseudo objective value, gets a high
38924  * absolute value during the optimization process which is later reduced significantly. In this case, the last digits
38925  * were canceled out when increasing the value and are random after decreasing it.
38926  * We do not consider the cancellations which can occur during increasing the absolute value because they just cannot
38927  * be expressed using fixed precision floating point arithmetic, anymore.
38928  * In order to get more reliable values, the idea is to always store the last reliable value, where increasing the
38929  * absolute of the value is viewed as preserving reliability. Then, after each update, the new absolute value can be
38930  * compared against the last reliable one with this method, checking whether it was decreased by a factor of at least
38931  * "lp/recompfac" and should be recomputed.
38932  */
38934  SCIP* scip, /**< SCIP data structure */
38935  SCIP_Real newvalue, /**< new value after update */
38936  SCIP_Real oldvalue /**< old value, i.e., last reliable value */
38937  )
38938 {
38939  assert(scip != NULL);
38940 
38941  SCIP_CALL_ABORT( checkStage(scip, "SCIPisUpdateUnreliable", FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE) );
38942 
38943  return SCIPsetIsUpdateUnreliable(scip->set, newvalue, oldvalue);
38944 }
38945 
38946 /** creates a dynamic array of real values
38947  *
38948  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
38949  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
38950  */
38952  SCIP* scip, /**< SCIP data structure */
38953  SCIP_REALARRAY** realarray /**< pointer to store the real array */
38954  )
38955 {
38956  assert(scip != NULL);
38957 
38958  SCIP_CALL( SCIPrealarrayCreate(realarray, SCIPblkmem(scip)) );
38959 
38960  return SCIP_OKAY;
38961 }
38962 
38963 /** frees a dynamic array of real values
38964  *
38965  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
38966  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
38967  */
38969  SCIP* scip, /**< SCIP data structure */
38970  SCIP_REALARRAY** realarray /**< pointer to the real array */
38971  )
38972 {
38973  assert(scip != NULL);
38974 
38975  SCIP_CALL( SCIPrealarrayFree(realarray) );
38976 
38977  return SCIP_OKAY;
38978 }
38979 
38980 /** extends dynamic array to be able to store indices from minidx to maxidx
38981  *
38982  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
38983  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
38984  */
38986  SCIP* scip, /**< SCIP data structure */
38987  SCIP_REALARRAY* realarray, /**< dynamic real array */
38988  int minidx, /**< smallest index to allocate storage for */
38989  int maxidx /**< largest index to allocate storage for */
38990  )
38991 {
38992  assert(scip != NULL);
38993 
38994  SCIP_CALL( SCIPrealarrayExtend(realarray, scip->set->mem_arraygrowinit, scip->set->mem_arraygrowfac, minidx, maxidx) );
38995 
38996  return SCIP_OKAY;
38997 }
38998 
38999 /** clears a dynamic real array
39000  *
39001  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
39002  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
39003  */
39005  SCIP* scip, /**< SCIP data structure */
39006  SCIP_REALARRAY* realarray /**< dynamic real array */
39007  )
39008 {
39009  assert(scip != NULL);
39010 
39011  SCIP_CALL( SCIPrealarrayClear(realarray) );
39012 
39013  return SCIP_OKAY;
39014 }
39015 
39016 /** gets value of entry in dynamic array
39017  *
39018  * @return value of entry in dynamic array
39019  */
39021  SCIP* scip, /**< SCIP data structure */
39022  SCIP_REALARRAY* realarray, /**< dynamic real array */
39023  int idx /**< array index to get value for */
39024  )
39025 {
39026  assert(scip != NULL);
39027 
39028  return SCIPrealarrayGetVal(realarray, idx);
39029 }
39030 
39031 /** sets value of entry in dynamic array
39032  *
39033  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
39034  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
39035  */
39037  SCIP* scip, /**< SCIP data structure */
39038  SCIP_REALARRAY* realarray, /**< dynamic real array */
39039  int idx, /**< array index to set value for */
39040  SCIP_Real val /**< value to set array index to */
39041  )
39042 {
39043  assert(scip != NULL);
39044 
39045  SCIP_CALL( SCIPrealarraySetVal(realarray, scip->set->mem_arraygrowinit, scip->set->mem_arraygrowfac, idx, val) );
39046 
39047  return SCIP_OKAY;
39048 }
39049 
39050 /** increases value of entry in dynamic array
39051  *
39052  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
39053  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
39054  */
39056  SCIP* scip, /**< SCIP data structure */
39057  SCIP_REALARRAY* realarray, /**< dynamic real array */
39058  int idx, /**< array index to increase value for */
39059  SCIP_Real incval /**< value to increase array index */
39060  )
39061 {
39062  assert(scip != NULL);
39063 
39064  SCIP_CALL( SCIPrealarrayIncVal(realarray, scip->set->mem_arraygrowinit, scip->set->mem_arraygrowfac, idx, incval) );
39065 
39066  return SCIP_OKAY;
39067 }
39068 
39069 /** returns the minimal index of all stored non-zero elements
39070  *
39071  * @return the minimal index of all stored non-zero elements
39072  */
39074  SCIP* scip, /**< SCIP data structure */
39075  SCIP_REALARRAY* realarray /**< dynamic real array */
39076  )
39077 {
39078  assert(scip != NULL);
39079 
39080  return SCIPrealarrayGetMinIdx(realarray);
39081 }
39082 
39083 /** returns the maximal index of all stored non-zero elements
39084  *
39085  * @return the maximal index of all stored non-zero elements
39086  */
39088  SCIP* scip, /**< SCIP data structure */
39089  SCIP_REALARRAY* realarray /**< dynamic real array */
39090  )
39091 {
39092  assert(scip != NULL);
39093 
39094  return SCIPrealarrayGetMaxIdx(realarray);
39095 }
39096 
39097 /** creates a dynamic array of int values
39098  *
39099  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
39100  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
39101  */
39103  SCIP* scip, /**< SCIP data structure */
39104  SCIP_INTARRAY** intarray /**< pointer to store the int array */
39105  )
39106 {
39107  assert(scip != NULL);
39108 
39109  SCIP_CALL( SCIPintarrayCreate(intarray, SCIPblkmem(scip)) );
39110 
39111  return SCIP_OKAY;
39112 }
39113 
39114 /** frees a dynamic array of int values
39115  *
39116  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
39117  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
39118  */
39120  SCIP* scip, /**< SCIP data structure */
39121  SCIP_INTARRAY** intarray /**< pointer to the int array */
39122  )
39123 {
39124  assert(scip != NULL);
39125 
39126  SCIP_CALL( SCIPintarrayFree(intarray) );
39127 
39128  return SCIP_OKAY;
39129 }
39130 
39131 /** extends dynamic array to be able to store indices from minidx to maxidx
39132  *
39133  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
39134  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
39135  */
39137  SCIP* scip, /**< SCIP data structure */
39138  SCIP_INTARRAY* intarray, /**< dynamic int array */
39139  int minidx, /**< smallest index to allocate storage for */
39140  int maxidx /**< largest index to allocate storage for */
39141  )
39142 {
39143  assert(scip != NULL);
39144 
39145  SCIP_CALL( SCIPintarrayExtend(intarray, scip->set->mem_arraygrowinit, scip->set->mem_arraygrowfac, minidx, maxidx) );
39146 
39147  return SCIP_OKAY;
39148 }
39149 
39150 /** clears a dynamic int array
39151  *
39152  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
39153  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
39154  */
39156  SCIP* scip, /**< SCIP data structure */
39157  SCIP_INTARRAY* intarray /**< dynamic int array */
39158  )
39159 {
39160  assert(scip != NULL);
39161 
39162  SCIP_CALL( SCIPintarrayClear(intarray) );
39163 
39164  return SCIP_OKAY;
39165 }
39166 
39167 /** gets value of entry in dynamic array
39168  *
39169  * @return value of entry in dynamic array
39170  */
39172  SCIP* scip, /**< SCIP data structure */
39173  SCIP_INTARRAY* intarray, /**< dynamic int array */
39174  int idx /**< array index to get value for */
39175  )
39176 {
39177  assert(scip != NULL);
39178 
39179  return SCIPintarrayGetVal(intarray, idx);
39180 }
39181 
39182 /** sets value of entry in dynamic array
39183  *
39184  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
39185  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
39186  */
39188  SCIP* scip, /**< SCIP data structure */
39189  SCIP_INTARRAY* intarray, /**< dynamic int array */
39190  int idx, /**< array index to set value for */
39191  int val /**< value to set array index to */
39192  )
39193 {
39194  assert(scip != NULL);
39195 
39196  SCIP_CALL( SCIPintarraySetVal(intarray, scip->set->mem_arraygrowinit, scip->set->mem_arraygrowfac, idx, val) );
39197 
39198  return SCIP_OKAY;
39199 }
39200 
39201 /** increases value of entry in dynamic array
39202  *
39203  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
39204  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
39205  */
39207  SCIP* scip, /**< SCIP data structure */
39208  SCIP_INTARRAY* intarray, /**< dynamic int array */
39209  int idx, /**< array index to increase value for */
39210  int incval /**< value to increase array index */
39211  )
39212 {
39213  assert(scip != NULL);
39214 
39215  SCIP_CALL( SCIPintarrayIncVal(intarray, scip->set->mem_arraygrowinit, scip->set->mem_arraygrowfac, idx, incval) );
39216 
39217  return SCIP_OKAY;
39218 }
39219 
39220 /** returns the minimal index of all stored non-zero elements
39221  *
39222  * @return the minimal index of all stored non-zero elements
39223  */
39225  SCIP* scip, /**< SCIP data structure */
39226  SCIP_INTARRAY* intarray /**< dynamic int array */
39227  )
39228 {
39229  assert(scip != NULL);
39230 
39231  return SCIPintarrayGetMinIdx(intarray);
39232 }
39233 
39234 /** returns the maximal index of all stored non-zero elements
39235  *
39236  * @return the maximal index of all stored non-zero elements
39237  */
39239  SCIP* scip, /**< SCIP data structure */
39240  SCIP_INTARRAY* intarray /**< dynamic int array */
39241  )
39242 {
39243  assert(scip != NULL);
39244 
39245  return SCIPintarrayGetMaxIdx(intarray);
39246 }
39247 
39248 /** creates a dynamic array of bool values
39249  *
39250  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
39251  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
39252  */
39254  SCIP* scip, /**< SCIP data structure */
39255  SCIP_BOOLARRAY** boolarray /**< pointer to store the bool array */
39256  )
39257 {
39258  assert(scip != NULL);
39259 
39260  SCIP_CALL( SCIPboolarrayCreate(boolarray, SCIPblkmem(scip)) );
39261 
39262  return SCIP_OKAY;
39263 }
39264 
39265 /** frees a dynamic array of bool values
39266  *
39267  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
39268  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
39269  */
39271  SCIP* scip, /**< SCIP data structure */
39272  SCIP_BOOLARRAY** boolarray /**< pointer to the bool array */
39273  )
39274 {
39275  assert(scip != NULL);
39276 
39277  SCIP_CALL( SCIPboolarrayFree(boolarray) );
39278 
39279  return SCIP_OKAY;
39280 }
39281 
39282 /** extends dynamic array to be able to store indices from minidx to maxidx
39283  *
39284  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
39285  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
39286  */
39288  SCIP* scip, /**< SCIP data structure */
39289  SCIP_BOOLARRAY* boolarray, /**< dynamic bool array */
39290  int minidx, /**< smallest index to allocate storage for */
39291  int maxidx /**< largest index to allocate storage for */
39292  )
39293 {
39294  assert(scip != NULL);
39295 
39296  SCIP_CALL( SCIPboolarrayExtend(boolarray, scip->set->mem_arraygrowinit, scip->set->mem_arraygrowfac, minidx, maxidx) );
39297 
39298  return SCIP_OKAY;
39299 }
39300 
39301 /** clears a dynamic bool array
39302  *
39303  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
39304  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
39305  */
39307  SCIP* scip, /**< SCIP data structure */
39308  SCIP_BOOLARRAY* boolarray /**< dynamic bool array */
39309  )
39310 {
39311  assert(scip != NULL);
39312 
39313  SCIP_CALL( SCIPboolarrayClear(boolarray) );
39314 
39315  return SCIP_OKAY;
39316 }
39317 
39318 /** gets value of entry in dynamic array
39319  *
39320  * @return value of entry in dynamic array at position idx
39321  */
39323  SCIP* scip, /**< SCIP data structure */
39324  SCIP_BOOLARRAY* boolarray, /**< dynamic bool array */
39325  int idx /**< array index to get value for */
39326  )
39327 {
39328  assert(scip != NULL);
39329 
39330  return SCIPboolarrayGetVal(boolarray, idx);
39331 }
39332 
39333 /** sets value of entry in dynamic array
39334  *
39335  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
39336  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
39337  */
39339  SCIP* scip, /**< SCIP data structure */
39340  SCIP_BOOLARRAY* boolarray, /**< dynamic bool array */
39341  int idx, /**< array index to set value for */
39342  SCIP_Bool val /**< value to set array index to */
39343  )
39344 {
39345  assert(scip != NULL);
39346 
39347  SCIP_CALL( SCIPboolarraySetVal(boolarray, scip->set->mem_arraygrowinit, scip->set->mem_arraygrowfac, idx, val) );
39348 
39349  return SCIP_OKAY;
39350 }
39351 
39352 /** returns the minimal index of all stored non-zero elements
39353  *
39354  * @return the minimal index of all stored non-zero elements
39355  */
39357  SCIP* scip, /**< SCIP data structure */
39358  SCIP_BOOLARRAY* boolarray /**< dynamic bool array */
39359  )
39360 {
39361  assert(scip != NULL);
39362 
39363  return SCIPboolarrayGetMinIdx(boolarray);
39364 }
39365 
39366 /** returns the maximal index of all stored non-zero elements
39367  *
39368  * @return the maximal index of all stored non-zero elements
39369  */
39371  SCIP* scip, /**< SCIP data structure */
39372  SCIP_BOOLARRAY* boolarray /**< dynamic bool array */
39373  )
39374 {
39375  assert(scip != NULL);
39376 
39377  return SCIPboolarrayGetMaxIdx(boolarray);
39378 }
39379 
39380 /** creates a dynamic array of pointers
39381  *
39382  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
39383  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
39384  */
39386  SCIP* scip, /**< SCIP data structure */
39387  SCIP_PTRARRAY** ptrarray /**< pointer to store the int array */
39388  )
39389 {
39390  assert(scip != NULL);
39391 
39392  SCIP_CALL( SCIPptrarrayCreate(ptrarray, SCIPblkmem(scip)) );
39393 
39394  return SCIP_OKAY;
39395 }
39396 
39397 /** frees a dynamic array of pointers
39398  *
39399  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
39400  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
39401  */
39403  SCIP* scip, /**< SCIP data structure */
39404  SCIP_PTRARRAY** ptrarray /**< pointer to the int array */
39405  )
39406 {
39407  assert(scip != NULL);
39408 
39409  SCIP_CALL( SCIPptrarrayFree(ptrarray) );
39410 
39411  return SCIP_OKAY;
39412 }
39413 
39414 /** extends dynamic array to be able to store indices from minidx to maxidx
39415  *
39416  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
39417  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
39418  */
39420  SCIP* scip, /**< SCIP data structure */
39421  SCIP_PTRARRAY* ptrarray, /**< dynamic int array */
39422  int minidx, /**< smallest index to allocate storage for */
39423  int maxidx /**< largest index to allocate storage for */
39424  )
39425 {
39426  assert(scip != NULL);
39427 
39428  SCIP_CALL( SCIPptrarrayExtend(ptrarray, scip->set->mem_arraygrowinit, scip->set->mem_arraygrowfac, minidx, maxidx) );
39429 
39430  return SCIP_OKAY;
39431 }
39432 
39433 /** clears a dynamic pointer array
39434  *
39435  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
39436  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
39437  */
39439  SCIP* scip, /**< SCIP data structure */
39440  SCIP_PTRARRAY* ptrarray /**< dynamic int array */
39441  )
39442 {
39443  assert(scip != NULL);
39444 
39445  SCIP_CALL( SCIPptrarrayClear(ptrarray) );
39446 
39447  return SCIP_OKAY;
39448 }
39449 
39450 /** gets value of entry in dynamic array */
39452  SCIP* scip, /**< SCIP data structure */
39453  SCIP_PTRARRAY* ptrarray, /**< dynamic int array */
39454  int idx /**< array index to get value for */
39455  )
39456 {
39457  assert(scip != NULL);
39458 
39459  return SCIPptrarrayGetVal(ptrarray, idx);
39460 }
39461 
39462 /** sets value of entry in dynamic array
39463  *
39464  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
39465  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
39466  */
39468  SCIP* scip, /**< SCIP data structure */
39469  SCIP_PTRARRAY* ptrarray, /**< dynamic int array */
39470  int idx, /**< array index to set value for */
39471  void* val /**< value to set array index to */
39472  )
39473 {
39474  assert(scip != NULL);
39475 
39476  SCIP_CALL( SCIPptrarraySetVal(ptrarray, scip->set->mem_arraygrowinit, scip->set->mem_arraygrowfac, idx, val) );
39477 
39478  return SCIP_OKAY;
39479 }
39480 
39481 /** returns the minimal index of all stored non-zero elements
39482  *
39483  * @return the minimal index of all stored non-zero elements
39484  */
39486  SCIP* scip, /**< SCIP data structure */
39487  SCIP_PTRARRAY* ptrarray /**< dynamic ptr array */
39488  )
39489 {
39490  assert(scip != NULL);
39491 
39492  return SCIPptrarrayGetMinIdx(ptrarray);
39493 }
39494 
39495 /** returns the maximal index of all stored non-zero elements
39496  *
39497  * @return the maximal index of all stored non-zero elements
39498  */
39500  SCIP* scip, /**< SCIP data structure */
39501  SCIP_PTRARRAY* ptrarray /**< dynamic ptr array */
39502  )
39503 {
39504  assert(scip != NULL);
39505 
39506  return SCIPptrarrayGetMaxIdx(ptrarray);
39507 }
39508