Scippy

SCIP

Solving Constraint Integer Programs

scip_prob.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-2019 Konrad-Zuse-Zentrum */
7 /* fuer Informationstechnik Berlin */
8 /* */
9 /* SCIP is distributed under the terms of the ZIB Academic License. */
10 /* */
11 /* You should have received a copy of the ZIB Academic License */
12 /* along with SCIP; see the file COPYING. If not visit scip.zib.de. */
13 /* */
14 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
15 
16 /**@file scip_prob.c
17  * @brief public methods for global and local (sub)problems
18  * @author Tobias Achterberg
19  * @author Timo Berthold
20  * @author Gerald Gamrath
21  * @author Robert Lion Gottwald
22  * @author Stefan Heinz
23  * @author Gregor Hendel
24  * @author Thorsten Koch
25  * @author Alexander Martin
26  * @author Marc Pfetsch
27  * @author Michael Winkler
28  * @author Kati Wolter
29  *
30  * @todo check all SCIP_STAGE_* switches, and include the new stages TRANSFORMED and INITSOLVE
31  */
32 
33 /*---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0----+----1----+----2*/
34 
35 #include "blockmemshell/memory.h"
36 #include "scip/benders.h"
37 #include "scip/clock.h"
38 #include "scip/concurrent.h"
39 #include "scip/conflictstore.h"
40 #include "scip/cons.h"
41 #include "scip/debug.h"
42 #include "scip/lp.h"
43 #include "scip/pricer.h"
44 #include "scip/pricestore.h"
45 #include "scip/primal.h"
46 #include "scip/prob.h"
47 #include "scip/pub_cons.h"
48 #include "scip/pub_event.h"
49 #include "scip/pub_message.h"
50 #include "scip/pub_misc.h"
51 #include "scip/pub_reader.h"
52 #include "scip/pub_sol.h"
53 #include "scip/pub_tree.h"
54 #include "scip/pub_var.h"
55 #include "scip/reader.h"
56 #include "scip/reopt.h"
57 #include "scip/scip_cons.h"
58 #include "scip/scip_general.h"
59 #include "scip/scip_mem.h"
60 #include "scip/scip_numerics.h"
61 #include "scip/scip_param.h"
62 #include "scip/scip_prob.h"
63 #include "scip/scip_randnumgen.h"
64 #include "scip/scip_sol.h"
65 #include "scip/scip_solve.h"
66 #include "scip/scip_solvingstats.h"
67 #include "scip/scip_timing.h"
68 #include "scip/scip_var.h"
69 #include "scip/set.h"
70 #include "scip/stat.h"
71 #include "scip/struct_cons.h"
72 #include "scip/struct_lp.h"
73 #include "scip/struct_mem.h"
74 #include "scip/struct_primal.h"
75 #include "scip/struct_prob.h"
76 #include "scip/struct_scip.h"
77 #include "scip/struct_set.h"
78 #include "scip/struct_stat.h"
79 #include "scip/struct_var.h"
80 #include "scip/syncstore.h"
81 #include "scip/tree.h"
82 #include <stdio.h>
83 #include <string.h>
84 
85 /** creates empty problem and initializes all solving data structures (the objective sense is set to MINIMIZE)
86  * If the problem type requires the use of variable pricers, these pricers should be added to the problem with calls
87  * to SCIPactivatePricer(). These pricers are automatically deactivated, when the problem is freed.
88  *
89  * @return \ref SCIP_OKAY is returned if everything worked. otherwise a suitable error code is passed. see \ref
90  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
91  *
92  * @pre This method can be called if @p scip is in one of the following stages:
93  * - \ref SCIP_STAGE_INIT
94  * - \ref SCIP_STAGE_PROBLEM
95  * - \ref SCIP_STAGE_TRANSFORMED
96  * - \ref SCIP_STAGE_PRESOLVING
97  * - \ref SCIP_STAGE_PRESOLVED
98  * - \ref SCIP_STAGE_SOLVING
99  * - \ref SCIP_STAGE_SOLVED
100  * - \ref SCIP_STAGE_FREE
101  *
102  * @post After calling this method, \SCIP reaches the following stage:
103  * - \ref SCIP_STAGE_PROBLEM
104  */
106  SCIP* scip, /**< SCIP data structure */
107  const char* name, /**< problem name */
108  SCIP_DECL_PROBDELORIG ((*probdelorig)), /**< frees user data of original problem */
109  SCIP_DECL_PROBTRANS ((*probtrans)), /**< creates user data of transformed problem by transforming original user data */
110  SCIP_DECL_PROBDELTRANS((*probdeltrans)), /**< frees user data of transformed problem */
111  SCIP_DECL_PROBINITSOL ((*probinitsol)), /**< solving process initialization method of transformed data */
112  SCIP_DECL_PROBEXITSOL ((*probexitsol)), /**< solving process deinitialization method of transformed data */
113  SCIP_DECL_PROBCOPY ((*probcopy)), /**< copies user data if you want to copy it to a subscip, or NULL */
114  SCIP_PROBDATA* probdata /**< user problem data set by the reader */
115  )
116 {
117  SCIP_CALL( SCIPcheckStage(scip, "SCIPcreateProb", TRUE, TRUE, FALSE, TRUE, FALSE, TRUE, FALSE, TRUE, FALSE, TRUE, TRUE, FALSE, FALSE, TRUE) );
118 
119  /* free old problem */
120  SCIP_CALL( SCIPfreeProb(scip) );
121  assert(scip->set->stage == SCIP_STAGE_INIT);
122 
123  /* switch stage to PROBLEM */
124  scip->set->stage = SCIP_STAGE_PROBLEM;
125 
126  SCIP_CALL( SCIPstatCreate(&scip->stat, scip->mem->probmem, scip->set, NULL, NULL, scip->messagehdlr) );
127 
128  SCIP_CALL( SCIPprobCreate(&scip->origprob, scip->mem->probmem, scip->set, name,
129  probdelorig, probtrans, probdeltrans, probinitsol, probexitsol, probcopy, probdata, FALSE) );
130 
131  /* create solution pool for original solution candidates */
133 
134  /* create conflict pool for storing conflict constraints */
136 
137  /* initialize reoptimization structure, if needed */
139 
140  return SCIP_OKAY;
141 }
142 
143 /** creates empty problem and initializes all solving data structures (the objective sense is set to MINIMIZE)
144  * all callback methods will be set to NULL and can be set afterwards, if needed, via SCIPsetProbDelorig(),
145  * SCIPsetProbTrans(), SCIPsetProbDeltrans(), SCIPsetProbInitsol(), SCIPsetProbExitsol(), and
146  * SCIPsetProbCopy()
147  * If the problem type requires the use of variable pricers, these pricers should be added to the problem with calls
148  * to SCIPactivatePricer(). These pricers are automatically deactivated, when the problem is freed.
149  *
150  * @return \ref SCIP_OKAY is returned if everything worked. otherwise a suitable error code is passed. see \ref
151  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
152  *
153  * @pre This method can be called if @p scip is in one of the following stages:
154  * - \ref SCIP_STAGE_INIT
155  * - \ref SCIP_STAGE_PROBLEM
156  * - \ref SCIP_STAGE_TRANSFORMED
157  * - \ref SCIP_STAGE_PRESOLVING
158  * - \ref SCIP_STAGE_PRESOLVED
159  * - \ref SCIP_STAGE_SOLVING
160  * - \ref SCIP_STAGE_SOLVED
161  * - \ref SCIP_STAGE_FREE
162  *
163  * @post After calling this method, \SCIP reaches the following stage:
164  * - \ref SCIP_STAGE_PROBLEM
165  */
167  SCIP* scip, /**< SCIP data structure */
168  const char* name /**< problem name */
169  )
170 {
171  SCIP_CALL( SCIPcheckStage(scip, "SCIPcreateProbBasic", TRUE, TRUE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, TRUE, TRUE, FALSE, FALSE, TRUE) );
172 
173  SCIP_CALL( SCIPcreateProb(scip, name, NULL, NULL, NULL, NULL, NULL, NULL, NULL) );
174 
175  return SCIP_OKAY;
176 }
177 
178 /** sets callback to free user data of original problem
179  *
180  * @return \ref SCIP_OKAY is returned if everything worked. otherwise a suitable error code is passed. see \ref
181  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
182  *
183  * @pre This method can be called if @p scip is in one of the following stages:
184  * - \ref SCIP_STAGE_PROBLEM
185  */
187  SCIP* scip, /**< SCIP data structure */
188  SCIP_DECL_PROBDELORIG ((*probdelorig)) /**< frees user data of original problem */
189  )
190 {
191  assert(scip != NULL);
192  SCIP_CALL( SCIPcheckStage(scip, "SCIPsetProbDelorig", FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE) );
193 
194  SCIPprobSetDelorig(scip->origprob, probdelorig);
195 
196  return SCIP_OKAY;
197 }
198 
199 /** sets callback to create user data of transformed problem by transforming original user data
200  *
201  * @return \ref SCIP_OKAY is returned if everything worked. otherwise a suitable error code is passed. see \ref
202  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
203  *
204  * @pre This method can be called if @p scip is in one of the following stages:
205  * - \ref SCIP_STAGE_PROBLEM
206  */
208  SCIP* scip, /**< SCIP data structure */
209  SCIP_DECL_PROBTRANS ((*probtrans)) /**< creates user data of transformed problem by transforming original user data */
210  )
211 {
212  assert(scip != NULL);
213  SCIP_CALL( SCIPcheckStage(scip, "SCIPsetProbTrans", FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE) );
214 
215  SCIPprobSetTrans(scip->origprob, probtrans);
216 
217  return SCIP_OKAY;
218 }
219 
220 /** sets callback to free user data of transformed problem
221  *
222  * @return \ref SCIP_OKAY is returned if everything worked. otherwise a suitable error code is passed. see \ref
223  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
224  *
225  * @pre This method can be called if @p scip is in one of the following stages:
226  * - \ref SCIP_STAGE_PROBLEM
227  */
229  SCIP* scip, /**< SCIP data structure */
230  SCIP_DECL_PROBDELTRANS((*probdeltrans)) /**< frees user data of transformed problem */
231  )
232 {
233  assert(scip != NULL);
234  SCIP_CALL( SCIPcheckStage(scip, "SCIPsetProbDeltrans", FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE) );
235 
236  SCIPprobSetDeltrans(scip->origprob, probdeltrans);
237 
238  return SCIP_OKAY;
239 }
240 
241 /** sets solving process initialization callback of transformed data
242  *
243  * @return \ref SCIP_OKAY is returned if everything worked. otherwise a suitable error code is passed. see \ref
244  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
245  *
246  * @pre This method can be called if @p scip is in one of the following stages:
247  * - \ref SCIP_STAGE_PROBLEM
248  */
250  SCIP* scip, /**< SCIP data structure */
251  SCIP_DECL_PROBINITSOL ((*probinitsol)) /**< solving process initialization method of transformed data */
252  )
253 {
254  assert(scip != NULL);
255 
256  SCIP_CALL( SCIPcheckStage(scip, "SCIPsetProbInitsol", FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE) );
257 
258  SCIPprobSetInitsol(scip->origprob, probinitsol);
259 
260  return SCIP_OKAY;
261 }
262 
263 /** sets solving process deinitialization callback of transformed data
264  *
265  * @return \ref SCIP_OKAY is returned if everything worked. otherwise a suitable error code is passed. see \ref
266  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
267  *
268  * @pre This method can be called if @p scip is in one of the following stages:
269  * - \ref SCIP_STAGE_PROBLEM
270  */
272  SCIP* scip, /**< SCIP data structure */
273  SCIP_DECL_PROBEXITSOL ((*probexitsol)) /**< solving process deinitialization method of transformed data */
274  )
275 {
276  assert(scip != NULL);
277  SCIP_CALL( SCIPcheckStage(scip, "SCIPsetProbExitsol", FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE) );
278 
279  SCIPprobSetExitsol(scip->origprob, probexitsol);
280 
281  return SCIP_OKAY;
282 }
283 
284 /** sets callback to copy user data to a subscip
285  *
286  * @return \ref SCIP_OKAY is returned if everything worked. otherwise a suitable error code is passed. see \ref
287  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
288  *
289  * @pre This method can be called if @p scip is in one of the following stages:
290  * - \ref SCIP_STAGE_PROBLEM
291  */
293  SCIP* scip, /**< SCIP data structure */
294  SCIP_DECL_PROBCOPY ((*probcopy)) /**< copies user data if you want to copy it to a subscip, or NULL */
295  )
296 {
297  assert(scip != NULL);
298  SCIP_CALL( SCIPcheckStage(scip, "SCIPsetProbCopy", FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE) );
299 
300  SCIPprobSetCopy(scip->origprob, probcopy);
301 
302  return SCIP_OKAY;
303 }
304 
305 /** reads problem from file and initializes all solving data structures
306  *
307  * @return \ref SCIP_OKAY is returned if everything worked. otherwise a suitable error code is passed. see \ref
308  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
309  *
310  * @pre This method can be called if @p scip is in one of the following stages:
311  * - \ref SCIP_STAGE_INIT
312  * - \ref SCIP_STAGE_PROBLEM
313  * - \ref SCIP_STAGE_TRANSFORMED
314  * - \ref SCIP_STAGE_INITPRESOLVE
315  * - \ref SCIP_STAGE_PRESOLVING
316  * - \ref SCIP_STAGE_EXITPRESOLVE
317  * - \ref SCIP_STAGE_PRESOLVED
318  * - \ref SCIP_STAGE_SOLVING
319  * - \ref SCIP_STAGE_EXITSOLVE
320  *
321  * @post After the method was called, \SCIP is in one of the following stages:
322  * - \ref SCIP_STAGE_INIT if reading failed (usually, when a SCIP_READERROR occurs)
323  * - \ref SCIP_STAGE_PROBLEM if the problem file was successfully read
324  */
326  SCIP* scip, /**< SCIP data structure */
327  const char* filename, /**< problem file name */
328  const char* extension /**< extension of the desired file reader,
329  * or NULL if file extension should be used */
330  )
331 {
332  SCIP_RETCODE retcode;
333  SCIP_RESULT result;
334  SCIP_Bool usevartable;
335  SCIP_Bool useconstable;
336  int i;
337  char* tmpfilename;
338  char* fileextension;
339 
340  assert(scip != NULL);
341  assert(filename != NULL);
342 
343  SCIP_CALL( SCIPcheckStage(scip, "SCIPreadProb", TRUE, TRUE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE) );
344 
345  SCIP_CALL( SCIPgetBoolParam(scip, "misc/usevartable", &usevartable) );
346  SCIP_CALL( SCIPgetBoolParam(scip, "misc/useconstable", &useconstable) );
347 
348  if( !usevartable || !useconstable )
349  {
350  SCIPerrorMessage("Cannot read problem if vartable or constable is disabled. Make sure parameters 'misc/usevartable' and 'misc/useconstable' are set to TRUE.\n");
351  return SCIP_READERROR;
352  }
353 
354  /* try all readers until one could read the file */
355  result = SCIP_DIDNOTRUN;
356 
357  /* copy filename */
358  SCIP_CALL( SCIPduplicateBufferArray(scip, &tmpfilename, filename, (int)strlen(filename)+1) );
359 
360  fileextension = NULL;
361  if( extension == NULL )
362  {
363  /* get extension from filename */
364  SCIPsplitFilename(tmpfilename, NULL, NULL, &fileextension, NULL);
365  }
366 
367  for( i = 0; i < scip->set->nreaders && result == SCIP_DIDNOTRUN; ++i )
368  {
369  retcode = SCIPreaderRead(scip->set->readers[i], scip->set, filename,
370  extension != NULL ? extension : fileextension, &result);
371 
372  /* check for reader errors */
373  if( retcode == SCIP_NOFILE || retcode == SCIP_READERROR )
374  goto TERMINATE;
375  SCIP_CALL( retcode );
376  }
377 
378  switch( result )
379  {
380  case SCIP_DIDNOTRUN:
381  retcode = SCIP_PLUGINNOTFOUND;
382  break;
383  case SCIP_SUCCESS:
384  if( scip->origprob != NULL )
385  {
386  SCIP_Real readingtime;
387 
389  "original problem has %d variables (%d bin, %d int, %d impl, %d cont) and %d constraints\n",
390  scip->origprob->nvars, scip->origprob->nbinvars, scip->origprob->nintvars,
391  scip->origprob->nimplvars, scip->origprob->ncontvars,
392  scip->origprob->nconss);
393 
394  /* in full verbose mode we will also print the number of constraints per constraint handler */
395  if( scip->set->disp_verblevel == SCIP_VERBLEVEL_FULL )
396  {
397  int* nconss;
398  int c;
399  int h;
400 
401  SCIP_CALL( SCIPallocClearBufferArray(scip, &nconss, scip->set->nconshdlrs) );
402 
403  /* loop over all constraints and constraint-handlers to count for each type the amount of original
404  * constraints
405  */
406  for( c = scip->origprob->nconss - 1; c >= 0; --c )
407  {
408  for( h = scip->set->nconshdlrs - 1; h >= 0; --h )
409  {
410  if( scip->origprob->conss[c]->conshdlr == scip->set->conshdlrs[h] )
411  {
412  ++(nconss[h]);
413  break;
414  }
415  }
416  /* constraint handler should be found */
417  assert(h >= 0);
418  }
419 
420  /* loop over all constraints handlers for printing the number of original constraints */
421  for( h = 0; h < scip->set->nconshdlrs; ++h )
422  {
423  if( nconss[h] > 0 )
424  {
426  "%7d constraints of type <%s>\n", nconss[h], SCIPconshdlrGetName(scip->set->conshdlrs[h]));
427  }
428  }
429 
430  SCIPfreeBufferArray(scip, &nconss);
431  }
432 
433  /* in case the permutation seed is different to 0, permute the original problem */
434  if( scip->set->random_permutationseed > 0 )
435  {
436  SCIP_Bool permuteconss;
437  SCIP_Bool permutevars;
438  int permutationseed;
439 
440  permuteconss = scip->set->random_permuteconss;
441  permutevars = scip->set->random_permutevars;
442  permutationseed = scip->set->random_permutationseed;
443 
444  SCIP_CALL( SCIPpermuteProb(scip, (unsigned int)permutationseed, permuteconss, permutevars, permutevars, permutevars, permutevars) );
445  }
446 
447  /* get reading time */
448  readingtime = SCIPgetReadingTime(scip);
449 
450  /* display timing statistics */
452  "Reading Time: %.2f\n", readingtime);
453  }
454  retcode = SCIP_OKAY;
455  break;
456  default:
457  assert(i < scip->set->nreaders);
458  SCIPerrorMessage("invalid result code <%d> from reader <%s> reading file <%s>\n",
459  result, SCIPreaderGetName(scip->set->readers[i]), filename);
460  retcode = SCIP_READERROR;
461  } /*lint !e788*/
462 
463  TERMINATE:
464  /* free buffer array */
465  SCIPfreeBufferArray(scip, &tmpfilename);
466 
467  /* check if reading time should belong to solving time */
468  if( scip->set->time_reading )
469  {
470  SCIP_Real readingtime;
471 
472  /* get reading time */
473  readingtime = SCIPgetReadingTime(scip);
474 
475  /* add reading time to solving time */
476  SCIPclockSetTime(scip->stat->solvingtime, readingtime);
477  }
478 
479  return retcode;
480 }
481 
482 /** write original or transformed problem */
483 static
485  SCIP* scip, /**< SCIP data structure */
486  const char* filename, /**< output file (or NULL for standard output) */
487  const char* extension, /**< extension of the desired file reader,
488  * or NULL if file extension should be used */
489  SCIP_Bool transformed, /**< output the transformed problem? */
490  SCIP_Bool genericnames /**< using generic variable and constraint names? */
491  )
492 {
493  SCIP_RETCODE retcode;
494  char* tmpfilename;
495  char* fileextension;
496  char* compression;
497  FILE* file;
498 
499  assert(scip != NULL );
500 
501  fileextension = NULL;
502  compression = NULL;
503  file = NULL;
504  tmpfilename = NULL;
505 
506  if( filename != NULL && filename[0] != '\0' )
507  {
508  int success;
509 
510  file = fopen(filename, "w");
511  if( file == NULL )
512  {
513  SCIPerrorMessage("cannot create file <%s> for writing\n", filename);
514  SCIPprintSysError(filename);
515  return SCIP_FILECREATEERROR;
516  }
517 
518  /* get extension from filename,
519  * if an error occurred, close the file before returning */
520  if( BMSduplicateMemoryArray(&tmpfilename, filename, strlen(filename)+1) == NULL )
521  {
522  (void) fclose(file);
523  SCIPerrorMessage("Error <%d> in function call\n", SCIP_NOMEMORY);
524  return SCIP_NOMEMORY;
525  }
526 
527  SCIPsplitFilename(tmpfilename, NULL, NULL, &fileextension, &compression);
528 
529  if( compression != NULL )
530  {
531  SCIPmessagePrintWarning(scip->messagehdlr, "currently it is not possible to write files with any compression\n");
532  BMSfreeMemoryArray(&tmpfilename);
533  (void) fclose(file);
534  return SCIP_FILECREATEERROR;
535  }
536 
537  if( extension == NULL && fileextension == NULL )
538  {
539  SCIPmessagePrintWarning(scip->messagehdlr, "filename <%s> has no file extension, select default <cip> format for writing\n", filename);
540  }
541 
542  if( transformed )
543  retcode = SCIPprintTransProblem(scip, file, extension != NULL ? extension : fileextension, genericnames);
544  else
545  retcode = SCIPprintOrigProblem(scip, file, extension != NULL ? extension : fileextension, genericnames);
546 
547  BMSfreeMemoryArray(&tmpfilename);
548 
549  success = fclose(file);
550  if( success != 0 )
551  {
552  SCIPerrorMessage("An error occurred while closing file <%s>\n", filename);
553  return SCIP_FILECREATEERROR;
554  }
555  }
556  else
557  {
558  /* print to stdout */
559  if( transformed )
560  retcode = SCIPprintTransProblem(scip, NULL, extension, genericnames);
561  else
562  retcode = SCIPprintOrigProblem(scip, NULL, extension, genericnames);
563  }
564 
565  /* check for write errors */
566  if( retcode == SCIP_WRITEERROR || retcode == SCIP_PLUGINNOTFOUND )
567  return retcode;
568  else
569  {
570  SCIP_CALL( retcode );
571  }
572 
573  return SCIP_OKAY;
574 }
575 
576 /** writes original problem to file
577  *
578  * @return \ref SCIP_OKAY is returned if everything worked. otherwise a suitable error code is passed. see \ref
579  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
580  *
581  * @pre This method can be called if @p scip is in one of the following stages:
582  * - \ref SCIP_STAGE_PROBLEM
583  * - \ref SCIP_STAGE_TRANSFORMING
584  * - \ref SCIP_STAGE_TRANSFORMED
585  * - \ref SCIP_STAGE_INITPRESOLVE
586  * - \ref SCIP_STAGE_PRESOLVING
587  * - \ref SCIP_STAGE_EXITPRESOLVE
588  * - \ref SCIP_STAGE_PRESOLVED
589  * - \ref SCIP_STAGE_INITSOLVE
590  * - \ref SCIP_STAGE_SOLVING
591  * - \ref SCIP_STAGE_SOLVED
592  * - \ref SCIP_STAGE_EXITSOLVE
593  * - \ref SCIP_STAGE_FREETRANS
594  */
596  SCIP* scip, /**< SCIP data structure */
597  const char* filename, /**< output file (or NULL for standard output) */
598  const char* extension, /**< extension of the desired file reader,
599  * or NULL if file extension should be used */
600  SCIP_Bool genericnames /**< using generic variable and constraint names? */
601  )
602 {
603  SCIP_RETCODE retcode;
604 
605  SCIP_CALL( SCIPcheckStage(scip, "SCIPwriteOrigProblem", FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE) );
606 
607  assert( scip != NULL );
608  assert( scip->origprob != NULL );
609 
610  retcode = writeProblem(scip, filename, extension, FALSE, genericnames);
611 
612  /* check for write errors */
613  if( retcode == SCIP_FILECREATEERROR || retcode == SCIP_WRITEERROR || retcode == SCIP_PLUGINNOTFOUND )
614  return retcode;
615  else
616  {
617  SCIP_CALL( retcode );
618  }
619 
620  return SCIP_OKAY;
621 }
622 
623 /** writes transformed problem which are valid in the current node to file
624  *
625  * @return \ref SCIP_OKAY is returned if everything worked. otherwise a suitable error code is passed. see \ref
626  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
627  *
628  * @pre This method can be called if @p scip is in one of the following stages:
629  * - \ref SCIP_STAGE_TRANSFORMED
630  * - \ref SCIP_STAGE_INITPRESOLVE
631  * - \ref SCIP_STAGE_PRESOLVING
632  * - \ref SCIP_STAGE_EXITPRESOLVE
633  * - \ref SCIP_STAGE_PRESOLVED
634  * - \ref SCIP_STAGE_INITSOLVE
635  * - \ref SCIP_STAGE_SOLVING
636  * - \ref SCIP_STAGE_SOLVED
637  * - \ref SCIP_STAGE_EXITSOLVE
638  *
639  * @note If you want the write all constraints (including the once which are redundant for example), you need to set
640  * the parameter <write/allconss> to TRUE
641  */
643  SCIP* scip, /**< SCIP data structure */
644  const char* filename, /**< output file (or NULL for standard output) */
645  const char* extension, /**< extension of the desired file reader,
646  * or NULL if file extension should be used */
647  SCIP_Bool genericnames /**< using generic variable and constraint names? */
648  )
649 {
650  SCIP_RETCODE retcode;
651 
652  SCIP_CALL( SCIPcheckStage(scip, "SCIPwriteTransProblem", FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE) );
653 
654  assert( scip != NULL );
655  assert( scip->transprob != NULL );
656 
657  retcode = writeProblem(scip, filename, extension, TRUE, genericnames);
658 
659  /* check for write errors */
660  if( retcode == SCIP_FILECREATEERROR || retcode == SCIP_WRITEERROR || retcode == SCIP_PLUGINNOTFOUND )
661  return retcode;
662  else
663  {
664  SCIP_CALL( retcode );
665  }
666 
667  return SCIP_OKAY;
668 }
669 
670 /** frees problem and solution process data
671  *
672  * @return \ref SCIP_OKAY is returned if everything worked. otherwise a suitable error code is passed. see \ref
673  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
674  *
675  * @pre This method can be called if @p scip is in one of the following stages:
676  * - \ref SCIP_STAGE_INIT
677  * - \ref SCIP_STAGE_PROBLEM
678  * - \ref SCIP_STAGE_TRANSFORMED
679  * - \ref SCIP_STAGE_PRESOLVING
680  * - \ref SCIP_STAGE_PRESOLVED
681  * - \ref SCIP_STAGE_SOLVING
682  * - \ref SCIP_STAGE_SOLVED
683  * - \ref SCIP_STAGE_FREE
684  *
685  * @post After this method was called, SCIP is in the following stage:
686  * - \ref SCIP_STAGE_INIT
687  */
689  SCIP* scip /**< SCIP data structure */
690  )
691 {
692  SCIP_Bool transsolorig;
693 
694  SCIP_CALL( SCIPcheckStage(scip, "SCIPfreeProb", TRUE, TRUE, FALSE, TRUE, FALSE, TRUE, FALSE, TRUE, FALSE, TRUE, TRUE, FALSE, FALSE, TRUE) );
695 
696  /* if we free the problem, we do not have to transfer transformed solutions to the original space, so temporarily disable it */
697  transsolorig = scip->set->misc_transsolsorig;
698  scip->set->misc_transsolsorig = FALSE;
699 
700  /* release variables and constraints captured by reoptimization */
701  if( scip->set->reopt_enable || scip->reopt != NULL)
702  {
703  SCIP_CALL( SCIPreoptReleaseData(scip->reopt, scip->set, scip->mem->probmem) );
704  }
705 
706  SCIP_CALL( SCIPfreeTransform(scip) );
707  /* for some reason the free transform can generate events caught in the globalbnd eventhander
708  * which requires the concurrent so it must be freed afterwards this happened o instance fiber
709  */
710  SCIP_CALL( SCIPfreeConcurrent(scip) );
711 
712  assert(scip->set->stage == SCIP_STAGE_INIT || scip->set->stage == SCIP_STAGE_PROBLEM);
713  scip->set->misc_transsolsorig = transsolorig;
714 
715  if( scip->set->stage == SCIP_STAGE_PROBLEM )
716  {
717  int i;
718 
719  /* free concsolvers and deinitialize the syncstore */
720  if( scip->set->nconcsolvers > 0 )
721  {
722  assert(SCIPsyncstoreIsInitialized(scip->syncstore));
723 
726  }
727 
728  /* deactivate all pricers */
729  for( i = scip->set->nactivepricers-1; i >= 0; --i )
730  {
731  SCIP_CALL( SCIPpricerDeactivate(scip->set->pricers[i], scip->set) );
732  }
733  assert(scip->set->nactivepricers == 0);
734 
735  /* deactivate all Benders' decomposition */
736  for( i = scip->set->nactivebenders-1; i >= 0; --i )
737  {
738  SCIPbendersDeactivate(scip->set->benders[i], scip->set);
739  }
740  assert(scip->set->nactivebenders == 0);
741 
742  /* free all debug data */
744 
745  /* free original primal solution candidate pool, original problem and problem statistics data structures */
746  if( scip->set->reopt_enable || scip->reopt != NULL)
747  {
748  SCIP_CALL( SCIPreoptFree(&scip->reopt, scip->set, scip->origprimal, scip->mem->probmem) );
749  }
750  SCIP_CALL( SCIPconflictstoreFree(&scip->conflictstore, scip->mem->probmem, scip->set, scip->stat, scip->reopt) );
751  SCIP_CALL( SCIPprimalFree(&scip->origprimal, scip->mem->probmem) );
752  SCIP_CALL( SCIPprobFree(&scip->origprob, scip->messagehdlr, scip->mem->probmem, scip->set, scip->stat, scip->eventqueue, scip->lp) );
753  SCIP_CALL( SCIPstatFree(&scip->stat, scip->mem->probmem) );
754 
755  /* readers */
756  for( i = 0; i < scip->set->nreaders; ++i )
757  {
759  }
760 
761  /* switch stage to INIT */
762  scip->set->stage = SCIP_STAGE_INIT;
763  }
764  assert(scip->set->stage == SCIP_STAGE_INIT);
765 
766  return SCIP_OKAY;
767 }
768 
769 /** permutes parts of the problem data structure
770  *
771  * @return \ref SCIP_OKAY is returned if everything worked. otherwise a suitable error code is passed. see \ref
772  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
773  *
774  * @pre This method can be called if @p scip is in one of the following stages:
775  * - \ref SCIP_STAGE_PROBLEM
776  * - \ref SCIP_STAGE_TRANSFORMED
777  *
778  * @todo This need to be changed to use the new random number generator implemented in random.c
779  */
781  SCIP* scip, /**< SCIP data structure */
782  unsigned int randseed, /**< seed value for random generator */
783  SCIP_Bool permuteconss, /**< should the list of constraints in each constraint handler be permuted? */
784  SCIP_Bool permutebinvars, /**< should the list of binary variables be permuted? */
785  SCIP_Bool permuteintvars, /**< should the list of integer variables be permuted? */
786  SCIP_Bool permuteimplvars, /**< should the list of implicit integer variables be permuted? */
787  SCIP_Bool permutecontvars /**< should the list of continuous integer variables be permuted? */
788  )
789 {
790  SCIP_VAR** vars;
791  SCIP_CONSHDLR** conshdlrs;
792  SCIP_RANDNUMGEN* randnumgen;
793  SCIP_Bool permuted;
794  int nconshdlrs;
795  int nbinvars;
796  int nintvars;
797  int nimplvars;
798  int nvars;
799  int j;
800 
801  assert(scip != NULL);
802  SCIP_CALL( SCIPcheckStage(scip, "SCIPpermuteProb", FALSE, TRUE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE) );
803 
804  SCIP_CALL( SCIPgetVarsData(scip, &vars, &nvars, &nbinvars, &nintvars, &nimplvars, NULL) );
805 
806  assert(nvars == 0 || vars != NULL);
807  assert(nvars == nbinvars+nintvars+nimplvars+SCIPgetNContVars(scip));
808 
809  conshdlrs = SCIPgetConshdlrs(scip);
810  nconshdlrs = SCIPgetNConshdlrs(scip);
811  assert(nconshdlrs == 0 || conshdlrs != NULL);
812 
813  /* create a random number generator */
814  SCIP_CALL( SCIPcreateRandom(scip, &randnumgen, randseed, TRUE) );
815 
816  /* The constraint handler should not be permuted since they are called w.r.t. to certain properties; besides
817  * that the "conshdlrs" array should stay in the order as it is since this array is used to copy the plugins for
818  * sub-SCIPs and contains the dependencies between the constraint handlers; for example the linear constraint
819  * handler stays in front of all constraint handler which can upgrade a linear constraint (such as logicor,
820  * setppc, and knapsack).
821  */
822 
823  permuted = FALSE;
824 
825  /* for each constraint handler, permute its constraints */
826  if( permuteconss )
827  {
828  int i;
829 
830  /* we must only permute active constraints */
831  if( SCIPisTransformed(scip) && !SCIPprobIsPermuted(scip->transprob) )
832  {
833  /* loop over all constraint handlers */
834  for( i = 0; i < nconshdlrs; ++i )
835  {
836  SCIP_CONS** conss;
837  int nconss;
838 
839  conss = SCIPconshdlrGetConss(conshdlrs[i]);
840  nconss = SCIPconshdlrGetNActiveConss(conshdlrs[i]);
841 
842  assert(nconss == 0 || conss != NULL);
843 
844  SCIPrandomPermuteArray(randnumgen, (void**)conss, 0, nconss);
845 
846  /* readjust the mapping of constraints to array positions */
847  for( j = 0; j < nconss; ++j )
848  conss[j]->consspos = j;
849 
850  permuted = TRUE;
851  }
852  }
853  else if( !SCIPisTransformed(scip) && !SCIPprobIsPermuted(scip->origprob) )
854  {
855  SCIP_CONS** conss = scip->origprob->conss;
856  int nconss = scip->origprob->nconss;
857 
858  SCIPrandomPermuteArray(randnumgen, (void**)conss, 0, nconss);
859 
860  for( j = 0; j < nconss; ++j )
861  {
862  assert(conss[j]->consspos == -1);
863  conss[j]->addarraypos = j;
864  }
865 
866  permuted = TRUE;
867  }
868  }
869 
870  /* permute binary variables */
871  if( permutebinvars && !SCIPprobIsPermuted(scip->origprob) )
872  {
873  SCIPrandomPermuteArray(randnumgen, (void**)vars, 0, nbinvars);
874 
875  /* readjust the mapping of variables to array positions */
876  for( j = 0; j < nbinvars; ++j )
877  vars[j]->probindex = j;
878 
879  permuted = TRUE;
880  }
881 
882  /* permute general integer variables */
883  if( permuteintvars && !SCIPprobIsPermuted(scip->origprob) )
884  {
885  SCIPrandomPermuteArray(randnumgen, (void**)vars, nbinvars, nbinvars+nintvars);
886 
887  /* readjust the mapping of variables to array positions */
888  for( j = nbinvars; j < nbinvars+nintvars; ++j )
889  vars[j]->probindex = j;
890 
891  permuted = TRUE;
892  }
893 
894  /* permute general integer variables */
895  if( permuteimplvars && !SCIPprobIsPermuted(scip->origprob) )
896  {
897  SCIPrandomPermuteArray(randnumgen, (void**)vars, nbinvars+nintvars, nbinvars+nintvars+nimplvars);
898 
899  /* readjust the mapping of variables to array positions */
900  for( j = nbinvars+nintvars; j < nbinvars+nintvars+nimplvars; ++j )
901  vars[j]->probindex = j;
902 
903  permuted = TRUE;
904  }
905 
906  /* permute general integer variables */
907  if( permutecontvars && !SCIPprobIsPermuted(scip->origprob) )
908  {
909  SCIPrandomPermuteArray(randnumgen, (void**)vars, nbinvars+nintvars+nimplvars, nvars);
910 
911  /* readjust the mapping of variables to array positions */
912  for( j = nbinvars+nintvars+nimplvars; j < nvars; ++j )
913  vars[j]->probindex = j;
914 
915  permuted = TRUE;
916  }
917 
918  if( permuted && SCIPisTransformed(scip) )
919  {
920  assert(!SCIPprobIsPermuted(scip->transprob));
921 
922  /* mark tranformed problem as permuted */
924 
926  "permute transformed problem using random seed %u\n", randseed);
927  }
928  else if( permuted && !SCIPisTransformed(scip) )
929  {
930  assert(!SCIPprobIsPermuted(scip->origprob));
931 
932  /* mark original problem as permuted */
934 
936  "permute original problem using random seed %u\n", randseed);
937  }
938 
939  /* free random number generator */
940  SCIPfreeRandom(scip, &randnumgen);
941 
942  return SCIP_OKAY;
943 }
944 
945 /** gets user problem data
946  *
947  * @return a SCIP_PROBDATA pointer, or NULL if no problem data was allocated
948  *
949  * @pre This method can be called if @p scip is in one of the following stages:
950  * - \ref SCIP_STAGE_PROBLEM
951  * - \ref SCIP_STAGE_TRANSFORMING
952  * - \ref SCIP_STAGE_TRANSFORMED
953  * - \ref SCIP_STAGE_INITPRESOLVE
954  * - \ref SCIP_STAGE_PRESOLVING
955  * - \ref SCIP_STAGE_EXITPRESOLVE
956  * - \ref SCIP_STAGE_PRESOLVED
957  * - \ref SCIP_STAGE_INITSOLVE
958  * - \ref SCIP_STAGE_SOLVING
959  * - \ref SCIP_STAGE_SOLVED
960  * - \ref SCIP_STAGE_EXITSOLVE
961  * - \ref SCIP_STAGE_FREETRANS
962  */
964  SCIP* scip /**< SCIP data structure */
965  )
966 {
967  SCIP_CALL_ABORT( SCIPcheckStage(scip, "SCIPgetProbData", FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE) );
968 
969  switch( scip->set->stage )
970  {
971  case SCIP_STAGE_PROBLEM:
972  return SCIPprobGetData(scip->origprob);
973 
981  case SCIP_STAGE_SOLVING:
982  case SCIP_STAGE_SOLVED:
985  return SCIPprobGetData(scip->transprob);
986 
987  default:
988  SCIPerrorMessage("invalid SCIP stage <%d>\n", scip->set->stage);
989  SCIPABORT();
990  return NULL; /*lint !e527*/
991  } /*lint !e788*/
992 }
993 
994 /** sets user problem data
995  *
996  * @return \ref SCIP_OKAY is returned if everything worked. otherwise a suitable error code is passed. see \ref
997  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
998  *
999  * @pre This method can be called if @p scip is in one of the following stages:
1000  * - \ref SCIP_STAGE_PROBLEM
1001  * - \ref SCIP_STAGE_TRANSFORMING
1002  * - \ref SCIP_STAGE_TRANSFORMED
1003  * - \ref SCIP_STAGE_INITPRESOLVE
1004  * - \ref SCIP_STAGE_PRESOLVING
1005  * - \ref SCIP_STAGE_EXITPRESOLVE
1006  * - \ref SCIP_STAGE_PRESOLVED
1007  * - \ref SCIP_STAGE_INITSOLVE
1008  * - \ref SCIP_STAGE_SOLVING
1009  * - \ref SCIP_STAGE_SOLVED
1010  * - \ref SCIP_STAGE_EXITSOLVE
1011  * - \ref SCIP_STAGE_FREETRANS
1012  */
1014  SCIP* scip, /**< SCIP data structure */
1015  SCIP_PROBDATA* probdata /**< user problem data to use */
1016  )
1017 {
1018  SCIP_CALL( SCIPcheckStage(scip, "SCIPsetProbData", FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE) );
1019 
1020  switch( scip->set->stage )
1021  {
1022  case SCIP_STAGE_PROBLEM:
1023  SCIPprobSetData(scip->origprob, probdata);
1024  return SCIP_OKAY;
1025 
1029  case SCIP_STAGE_PRESOLVING:
1031  case SCIP_STAGE_PRESOLVED:
1032  case SCIP_STAGE_INITSOLVE:
1033  case SCIP_STAGE_SOLVING:
1034  case SCIP_STAGE_SOLVED:
1035  case SCIP_STAGE_EXITSOLVE:
1036  case SCIP_STAGE_FREETRANS:
1037  SCIPprobSetData(scip->transprob, probdata);
1038  return SCIP_OKAY;
1039 
1040  case SCIP_STAGE_INIT:
1041  case SCIP_STAGE_FREE:
1042  default:
1043  SCIPerrorMessage("invalid SCIP stage <%d>\n", scip->set->stage);
1044  return SCIP_INVALIDCALL;
1045  }
1046 }
1047 
1048 /** returns name of the current problem instance
1049  *
1050  * @return name of the current problem instance
1051  *
1052  * @pre This method can be called if @p scip is in one of the following stages:
1053  * - \ref SCIP_STAGE_PROBLEM
1054  * - \ref SCIP_STAGE_TRANSFORMING
1055  * - \ref SCIP_STAGE_TRANSFORMED
1056  * - \ref SCIP_STAGE_INITPRESOLVE
1057  * - \ref SCIP_STAGE_PRESOLVING
1058  * - \ref SCIP_STAGE_EXITPRESOLVE
1059  * - \ref SCIP_STAGE_PRESOLVED
1060  * - \ref SCIP_STAGE_INITSOLVE
1061  * - \ref SCIP_STAGE_SOLVING
1062  * - \ref SCIP_STAGE_SOLVED
1063  * - \ref SCIP_STAGE_EXITSOLVE
1064  * - \ref SCIP_STAGE_FREETRANS
1065  */
1066 const char* SCIPgetProbName(
1067  SCIP* scip /**< SCIP data structure */
1068  )
1069 {
1070  SCIP_CALL_ABORT( SCIPcheckStage(scip, "SCIPgetProbName", FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE) );
1071 
1072  return SCIPprobGetName(scip->origprob);
1073 }
1074 
1075 /** sets name of the current problem instance
1076  *
1077  * @return \ref SCIP_OKAY is returned if everything worked. otherwise a suitable error code is passed. see \ref
1078  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
1079  *
1080  * @pre This method can be called if @p scip is in one of the following stages:
1081  * - \ref SCIP_STAGE_PROBLEM
1082  * - \ref SCIP_STAGE_TRANSFORMING
1083  * - \ref SCIP_STAGE_TRANSFORMED
1084  * - \ref SCIP_STAGE_INITPRESOLVE
1085  * - \ref SCIP_STAGE_PRESOLVING
1086  * - \ref SCIP_STAGE_EXITPRESOLVE
1087  * - \ref SCIP_STAGE_PRESOLVED
1088  * - \ref SCIP_STAGE_INITSOLVE
1089  * - \ref SCIP_STAGE_SOLVING
1090  * - \ref SCIP_STAGE_SOLVED
1091  * - \ref SCIP_STAGE_EXITSOLVE
1092  * - \ref SCIP_STAGE_FREETRANS
1093  */
1095  SCIP* scip, /**< SCIP data structure */
1096  const char* name /**< name to be set */
1097  )
1098 {
1099  SCIP_CALL( SCIPcheckStage(scip, "SCIPsetProbName", FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE) );
1100 
1101  return SCIPprobSetName(scip->origprob, name);
1102 }
1103 
1104 /** changes the objective function of the original problem.
1105  *
1106  * @return \ref SCIP_OKAY is returned if everything worked. otherwise a suitable error code is passed. see \ref
1107  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
1108  *
1109  * @pre This method can be called if @p scip is in one of the following stages:
1110  * - \ref SCIP_STAGE_PROBLEM
1111  * - \ref SCIP_STAGE_PRESOLVED
1112  *
1113  * @note This method should be only used to change the objective function during two reoptimization runs and is only
1114  * recommended to an experienced user.
1115  *
1116  * @note All variables not given in \p vars array are assumed to have an objective coefficient of zero.
1117  */
1119  SCIP* scip, /**< SCIP data structure */
1120  SCIP_OBJSENSE objsense, /**< new objective function */
1121  SCIP_VAR** vars, /**< original problem variables */
1122  SCIP_Real* coefs, /**< objective coefficients */
1123  int nvars /**< variables in vars array */
1124  )
1125 {
1126  SCIP_VAR** origvars;
1127  int norigvars;
1128  int i;
1129 
1130  SCIP_CALL( SCIPcheckStage(scip, "SCIPchgReoptObjective", FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE) );
1131 
1132  assert(nvars == 0 || vars != NULL);
1133  assert(nvars == 0 || coefs != NULL);
1134 
1135  origvars = scip->origprob->vars;
1136  norigvars = scip->origprob->nvars;
1137 
1138 #ifdef SCIP_MORE_DEBUG
1139  SCIPdebugMsg(scip, "objective function need to be set:\n");
1140  for( i = 0; i < nvars; i++ )
1141  {
1142  if( !SCIPisZero(scip, coefs[i]) )
1143  SCIPdebugMsg(scip, "%s%g <%s> ", SCIPisPositive(scip, coefs[i]) ? "+" : "", coefs[i], SCIPvarGetName(vars[i]));
1144  }
1145  SCIPdebugMsg(scip, "\n");
1146 #endif
1147 
1148  /* Set all coefficients of original variables to 0, since we will add the new objective coefficients later. */
1149  for( i = 0; i < norigvars; i++ )
1150  {
1151  SCIP_CALL( SCIPchgVarObj(scip, origvars[i], 0.0) );
1152  }
1153 
1154  if( scip->set->stage >= SCIP_STAGE_TRANSFORMED )
1155  {
1156  /* In order to avoid numerical troubles, also explicitly set all transformed objective coefficients to 0. */
1157  for( i = 0; i < scip->transprob->nvars; i++ )
1158  {
1159  SCIP_CALL( SCIPchgVarObj(scip, scip->transprob->vars[i], 0.0) );
1160  }
1161  }
1162 
1163  /* reset objective data of original problem */
1164  scip->origprob->objscale = 1.0;
1165  scip->origprob->objsense = objsense;
1166  scip->origprob->objoffset = 0.0;
1167  scip->origprob->objisintegral = FALSE;
1168 
1169  if( scip->set->stage >= SCIP_STAGE_TRANSFORMED )
1170  {
1171  /* reset objective data of transformed problem */
1172  scip->transprob->objscale = 1.0;
1173  scip->transprob->objsense = objsense;
1174  scip->transprob->objoffset = 0.0;
1175  scip->transprob->objisintegral = FALSE;
1176  }
1177 
1178  /* set new objective values */
1179  for( i = 0; i < nvars; ++i )
1180  {
1181  if( !SCIPvarIsOriginal(vars[i]) )
1182  {
1183  SCIPerrorMessage("Cannot handle variable <%s> (status: %d) in SCIPchgReoptObjective().\n",
1184  SCIPvarGetName(vars[i]), SCIPvarGetStatus(vars[i]));
1185  return SCIP_INVALIDDATA;
1186  }
1187 
1188  /* Add coefficients because this gets transferred to the transformed problem (the coefficients were set to 0 above). */
1189  SCIP_CALL( SCIPaddVarObj(scip, vars[i], coefs[i]) );
1190  }
1191 
1192 #ifdef SCIP_MORE_DEBUG
1193  SCIPdebugMsg(scip, "new objective function:\n");
1194  for( i = 0; i < norigvars; i++ )
1195  {
1196  SCIP_Real objval = SCIPvarGetObj(origvars[i]);
1197  if( !SCIPisZero(scip, objval) )
1198  SCIPdebugMsg(scip, "%s%g <%s> ", SCIPisPositive(scip, objval) ? "+" : "", objval, SCIPvarGetName(origvars[i]));
1199  }
1200  SCIPdebugMsg(scip, "\n");
1201 #endif
1202 
1203  return SCIP_OKAY;
1204 }
1205 
1206 /** returns objective sense of original problem
1207  *
1208  * @return objective sense of original problem
1209  *
1210  * @pre This method can be called if @p scip is in one of the following stages:
1211  * - \ref SCIP_STAGE_PROBLEM
1212  * - \ref SCIP_STAGE_TRANSFORMING
1213  * - \ref SCIP_STAGE_TRANSFORMED
1214  * - \ref SCIP_STAGE_INITPRESOLVE
1215  * - \ref SCIP_STAGE_PRESOLVING
1216  * - \ref SCIP_STAGE_EXITPRESOLVE
1217  * - \ref SCIP_STAGE_PRESOLVED
1218  * - \ref SCIP_STAGE_INITSOLVE
1219  * - \ref SCIP_STAGE_SOLVING
1220  * - \ref SCIP_STAGE_SOLVED
1221  * - \ref SCIP_STAGE_EXITSOLVE
1222  * - \ref SCIP_STAGE_FREETRANS
1223  */
1225  SCIP* scip /**< SCIP data structure */
1226  )
1227 {
1228  SCIP_CALL_ABORT( SCIPcheckStage(scip, "SCIPgetObjsense", FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE) );
1229 
1230  return scip->origprob->objsense;
1231 }
1232 
1233 /** sets objective sense of problem
1234  *
1235  * @return \ref SCIP_OKAY is returned if everything worked. otherwise a suitable error code is passed. see \ref
1236  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
1237  *
1238  * @pre This method can be called if @p scip is in one of the following stages:
1239  * - \ref SCIP_STAGE_PROBLEM
1240  */
1242  SCIP* scip, /**< SCIP data structure */
1243  SCIP_OBJSENSE objsense /**< new objective sense */
1244  )
1245 {
1246  SCIP_CALL( SCIPcheckStage(scip, "SCIPsetObjsense", FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE) );
1247 
1248  if( objsense != SCIP_OBJSENSE_MAXIMIZE && objsense != SCIP_OBJSENSE_MINIMIZE )
1249  {
1250  SCIPerrorMessage("invalid objective sense\n");
1251  return SCIP_INVALIDDATA;
1252  }
1253 
1254  SCIPprobSetObjsense(scip->origprob, objsense);
1255 
1256  return SCIP_OKAY;
1257 }
1258 
1259 /** adds offset of objective function
1260  *
1261  * @return \ref SCIP_OKAY is returned if everything worked. otherwise a suitable error code is passed. see \ref
1262  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
1263  *
1264  * @pre This method can be called if @p scip is in one of the following stages:
1265  * - \ref SCIP_STAGE_PRESOLVING
1266  */
1268  SCIP* scip, /**< SCIP data structure */
1269  SCIP_Real addval /**< value to add to objective offset */
1270  )
1271 {
1272  SCIP_CALL( SCIPcheckStage(scip, "SCIPaddObjoffset", FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE) );
1273 
1274  SCIPprobAddObjoffset(scip->transprob, addval);
1275  SCIP_CALL( SCIPprimalUpdateObjoffset(scip->primal, SCIPblkmem(scip), scip->set, scip->stat,
1276  scip->eventqueue, scip->transprob, scip->origprob, scip->tree, scip->reopt, scip->lp) );
1277 
1278  return SCIP_OKAY;
1279 }
1280 
1281 /** adds offset of objective function to original problem and to all existing solution in original space
1282  *
1283  * @return \ref SCIP_OKAY is returned if everything worked. otherwise a suitable error code is passed. see \ref
1284  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
1285  *
1286  * @pre This method can be called if @p scip is in one of the following stages:
1287  * - \ref SCIP_STAGE_PROBLEM
1288  */
1290  SCIP* scip, /**< SCIP data structure */
1291  SCIP_Real addval /**< value to add to objective offset */
1292  )
1293 {
1294  SCIP_CALL( SCIPcheckStage(scip, "SCIPaddOrigObjoffset", FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE) );
1295 
1296  scip->origprob->objoffset += addval;
1297  SCIPprimalAddOrigObjoffset(scip->origprimal, scip->set, addval);
1298 
1299  return SCIP_OKAY;
1300 }
1301 
1302 /** returns the objective offset of the original problem
1303  *
1304  * @return the objective offset of the original problem
1305  *
1306  * @pre This method can be called if @p scip is in one of the following stages:
1307  * - \ref SCIP_STAGE_PROBLEM
1308  * - \ref SCIP_STAGE_TRANSFORMING
1309  * - \ref SCIP_STAGE_TRANSFORMED
1310  * - \ref SCIP_STAGE_INITPRESOLVE
1311  * - \ref SCIP_STAGE_PRESOLVING
1312  * - \ref SCIP_STAGE_EXITPRESOLVE
1313  * - \ref SCIP_STAGE_PRESOLVED
1314  * - \ref SCIP_STAGE_INITSOLVE
1315  * - \ref SCIP_STAGE_SOLVING
1316  * - \ref SCIP_STAGE_SOLVED
1317  */
1319  SCIP* scip /**< SCIP data structure */
1320  )
1321 {
1322  SCIP_CALL_ABORT( SCIPcheckStage(scip, "SCIPgetOrigObjoffset", FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE) );
1323 
1324  return scip->origprob->objoffset;
1325 }
1326 
1327 /** returns the objective scale of the original problem
1328  *
1329  * @return the objective scale of the original problem
1330  *
1331  * @pre This method can be called if @p scip is in one of the following stages:
1332  * - \ref SCIP_STAGE_PROBLEM
1333  * - \ref SCIP_STAGE_TRANSFORMING
1334  * - \ref SCIP_STAGE_TRANSFORMED
1335  * - \ref SCIP_STAGE_INITPRESOLVE
1336  * - \ref SCIP_STAGE_PRESOLVING
1337  * - \ref SCIP_STAGE_EXITPRESOLVE
1338  * - \ref SCIP_STAGE_PRESOLVED
1339  * - \ref SCIP_STAGE_INITSOLVE
1340  * - \ref SCIP_STAGE_SOLVING
1341  * - \ref SCIP_STAGE_SOLVED
1342  */
1344  SCIP* scip /**< SCIP data structure */
1345  )
1346 {
1347  SCIP_CALL_ABORT( SCIPcheckStage(scip, "SCIPgetOrigObjscale", FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE) );
1348 
1349  return scip->origprob->objscale;
1350 }
1351 
1352 /** returns the objective offset of the transformed problem
1353  *
1354  * @return the objective offset of the transformed problem
1355  *
1356  * @pre This method can be called if @p scip is in one of the following stages:
1357  * - \ref SCIP_STAGE_TRANSFORMED
1358  * - \ref SCIP_STAGE_INITPRESOLVE
1359  * - \ref SCIP_STAGE_PRESOLVING
1360  * - \ref SCIP_STAGE_EXITPRESOLVE
1361  * - \ref SCIP_STAGE_PRESOLVED
1362  * - \ref SCIP_STAGE_INITSOLVE
1363  * - \ref SCIP_STAGE_SOLVING
1364  * - \ref SCIP_STAGE_SOLVED
1365  */
1367  SCIP* scip /**< SCIP data structure */
1368  )
1369 {
1370  SCIP_CALL_ABORT( SCIPcheckStage(scip, "SCIPgetTransObjoffset", FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE) );
1371 
1372  return scip->transprob->objoffset;
1373 }
1374 
1375 /** returns the objective scale of the transformed problem
1376  *
1377  * @return the objective scale of the transformed problem
1378  *
1379  * @pre This method can be called if @p scip is in one of the following stages:
1380  * - \ref SCIP_STAGE_TRANSFORMED
1381  * - \ref SCIP_STAGE_INITPRESOLVE
1382  * - \ref SCIP_STAGE_PRESOLVING
1383  * - \ref SCIP_STAGE_EXITPRESOLVE
1384  * - \ref SCIP_STAGE_PRESOLVED
1385  * - \ref SCIP_STAGE_INITSOLVE
1386  * - \ref SCIP_STAGE_SOLVING
1387  * - \ref SCIP_STAGE_SOLVED
1388  */
1390  SCIP* scip /**< SCIP data structure */
1391  )
1392 {
1393  SCIP_CALL_ABORT( SCIPcheckStage(scip, "SCIPgetTransObjscale", FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE) );
1394 
1395  return scip->transprob->objscale;
1396 }
1397 
1398 /** sets limit on objective function, such that only solutions better than this limit are accepted
1399  *
1400  * @note SCIP will only look for solutions with a strictly better objective value, thus, e.g., prune
1401  * all branch-and-bound nodes with dual bound equal or worse to the objective limit.
1402  * However, SCIP will also collect solutions with objective value worse than the objective limit and
1403  * use them to run improvement heuristics on them.
1404  * @note If SCIP can prove that there exists no solution with a strictly better objective value, the solving status
1405  * will normally be infeasible (the objective limit is interpreted as part of the problem).
1406  * The only exception is that by chance, SCIP found a solution with the same objective value and thus
1407  * proved the optimality of this solution, resulting in solution status optimal.
1408  *
1409  * @return \ref SCIP_OKAY is returned if everything worked. otherwise a suitable error code is passed. see \ref
1410  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
1411  *
1412  * @pre This method can be called if @p scip is in one of the following stages:
1413  * - \ref SCIP_STAGE_PROBLEM
1414  * - \ref SCIP_STAGE_TRANSFORMED
1415  * - \ref SCIP_STAGE_INITPRESOLVE
1416  * - \ref SCIP_STAGE_PRESOLVING
1417  * - \ref SCIP_STAGE_EXITPRESOLVE
1418  * - \ref SCIP_STAGE_PRESOLVED
1419  * - \ref SCIP_STAGE_SOLVING
1420  */
1422  SCIP* scip, /**< SCIP data structure */
1423  SCIP_Real objlimit /**< new primal objective limit */
1424  )
1425 {
1426  SCIP_Real oldobjlimit;
1427 
1428  SCIP_CALL( SCIPcheckStage(scip, "SCIPsetObjlimit", FALSE, TRUE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) );
1429 
1430  switch( scip->set->stage )
1431  {
1432  case SCIP_STAGE_PROBLEM:
1433  SCIPprobSetObjlim(scip->origprob, objlimit);
1434  break;
1435  case SCIP_STAGE_PRESOLVED:
1436  oldobjlimit = SCIPprobGetObjlim(scip->origprob, scip->set);
1437  assert(oldobjlimit == SCIPprobGetObjlim(scip->transprob, scip->set)); /*lint !e777*/
1438  if( SCIPtransformObj(scip, objlimit) > SCIPprobInternObjval(scip->transprob, scip->origprob, scip->set, oldobjlimit) && ! scip->set->reopt_enable)
1439  {
1440  SCIPerrorMessage("cannot relax objective limit from %.15g to %.15g in presolved stage.\n", oldobjlimit, objlimit);
1441  return SCIP_INVALIDDATA;
1442  }
1443  SCIPprobSetObjlim(scip->origprob, objlimit);
1444  SCIPprobSetObjlim(scip->transprob, objlimit);
1445  SCIP_CALL( SCIPprimalUpdateObjlimit(scip->primal, scip->mem->probmem, scip->set, scip->stat, scip->eventqueue,
1446  scip->transprob, scip->origprob, scip->tree, scip->reopt, scip->lp) );
1447  break;
1448 
1451  case SCIP_STAGE_PRESOLVING:
1453  case SCIP_STAGE_SOLVING:
1454  oldobjlimit = SCIPprobGetObjlim(scip->origprob, scip->set);
1455  assert(oldobjlimit == SCIPprobGetObjlim(scip->transprob, scip->set)); /*lint !e777*/
1456  if( SCIPtransformObj(scip, objlimit) > SCIPprobInternObjval(scip->transprob, scip->origprob, scip->set, oldobjlimit) )
1457  {
1458  SCIPerrorMessage("cannot relax objective limit from %.15g to %.15g after problem was transformed.\n", oldobjlimit, objlimit);
1459  return SCIP_INVALIDDATA;
1460  }
1461  SCIPprobSetObjlim(scip->origprob, objlimit);
1462  SCIPprobSetObjlim(scip->transprob, objlimit);
1463  SCIP_CALL( SCIPprimalUpdateObjlimit(scip->primal, scip->mem->probmem, scip->set, scip->stat, scip->eventqueue,
1464  scip->transprob, scip->origprob, scip->tree, scip->reopt, scip->lp) );
1465  break;
1466 
1467  default:
1468  SCIPerrorMessage("method is not callable in SCIP stage <%d>\n", scip->set->stage);
1469  return SCIP_INVALIDCALL;
1470  } /*lint !e788*/
1471 
1472  return SCIP_OKAY;
1473 }
1474 
1475 /** returns current limit on objective function
1476  *
1477  * @return the current objective limit of the original problem
1478  *
1479  * @pre This method can be called if @p scip is in one of the following stages:
1480  * - \ref SCIP_STAGE_PROBLEM
1481  * - \ref SCIP_STAGE_TRANSFORMING
1482  * - \ref SCIP_STAGE_TRANSFORMED
1483  * - \ref SCIP_STAGE_INITPRESOLVE
1484  * - \ref SCIP_STAGE_PRESOLVING
1485  * - \ref SCIP_STAGE_EXITPRESOLVE
1486  * - \ref SCIP_STAGE_PRESOLVED
1487  * - \ref SCIP_STAGE_INITSOLVE
1488  * - \ref SCIP_STAGE_SOLVING
1489  * - \ref SCIP_STAGE_SOLVED
1490  */
1492  SCIP* scip /**< SCIP data structure */
1493  )
1494 {
1495  SCIP_CALL_ABORT( SCIPcheckStage(scip, "SCIPgetObjlimit", FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE) );
1496 
1497  return SCIPprobGetObjlim(scip->origprob, scip->set);
1498 }
1499 
1500 /** informs SCIP, that the objective value is always integral in every feasible solution
1501  *
1502  * @return \ref SCIP_OKAY is returned if everything worked. otherwise a suitable error code is passed. see \ref
1503  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
1504  *
1505  * @pre This method can be called if @p scip is in one of the following stages:
1506  * - \ref SCIP_STAGE_PROBLEM
1507  * - \ref SCIP_STAGE_TRANSFORMING
1508  * - \ref SCIP_STAGE_INITPRESOLVE
1509  * - \ref SCIP_STAGE_EXITPRESOLVE
1510  * - \ref SCIP_STAGE_SOLVING
1511  *
1512  * @note This function should be used to inform SCIP that the objective function is integral, helping to improve the
1513  * performance. This is useful when using column generation. If no column generation (pricing) is used, SCIP
1514  * automatically detects whether the objective function is integral or can be scaled to be integral. However, in
1515  * any case, the user has to make sure that no variable is added during the solving process that destroys this
1516  * property.
1517  */
1519  SCIP* scip /**< SCIP data structure */
1520  )
1521 {
1522  SCIP_CALL( SCIPcheckStage(scip, "SCIPsetObjIntegral", FALSE, TRUE, TRUE, FALSE, TRUE, FALSE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) );
1523 
1524  switch( scip->set->stage )
1525  {
1526  case SCIP_STAGE_PROBLEM:
1528  return SCIP_OKAY;
1529 
1531  case SCIP_STAGE_PRESOLVING:
1532  case SCIP_STAGE_PRESOLVED:
1533  case SCIP_STAGE_SOLVING:
1535  return SCIP_OKAY;
1536 
1537  default:
1538  SCIPerrorMessage("method is not callable in SCIP stage <%d>\n", scip->set->stage);
1539  return SCIP_INVALIDCALL;
1540  } /*lint !e788*/
1541 }
1542 
1543 /** returns whether the objective value is known to be integral in every feasible solution
1544  *
1545  * @return TRUE, if objective value is known to be always integral, otherwise FALSE
1546  *
1547  * @pre This method can be called if @p scip is in one of the following stages:
1548  * - \ref SCIP_STAGE_PROBLEM
1549  * - \ref SCIP_STAGE_TRANSFORMING
1550  * - \ref SCIP_STAGE_INITPRESOLVE
1551  * - \ref SCIP_STAGE_PRESOLVING
1552  * - \ref SCIP_STAGE_EXITPRESOLVE
1553  * - \ref SCIP_STAGE_PRESOLVED
1554  * - \ref SCIP_STAGE_SOLVING
1555  *
1556  * @note If no pricing is performed, SCIP automatically detects whether the objective function is integral or can be
1557  * scaled to be integral, helping to improve performance. This function returns the result. Otherwise
1558  * SCIPsetObjIntegral() can be used to inform SCIP. However, in any case, the user has to make sure that no
1559  * variable is added during the solving process that destroys this property.
1560  */
1562  SCIP* scip /**< SCIP data structure */
1563  )
1564 {
1565  int v;
1566 
1567  SCIP_CALL_ABORT( SCIPcheckStage(scip, "SCIPisObjIntegral", FALSE, TRUE, TRUE, FALSE, TRUE, TRUE, TRUE, TRUE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) );
1568 
1569  switch( scip->set->stage )
1570  {
1571  case SCIP_STAGE_PROBLEM:
1572  /* if the user explicitly added the information that there is an integral objective, return TRUE */
1573  if( SCIPprobIsObjIntegral(scip->origprob) )
1574  return TRUE;
1575 
1576  /* if there exist unknown variables, we cannot conclude that the objective value is always integral */
1577  if ( scip->set->nactivepricers != 0 )
1578  return FALSE;
1579 
1580  /* if the objective value offset is fractional, the value itself is possibly fractional */
1581  if ( ! SCIPisIntegral(scip, scip->origprob->objoffset) )
1582  return FALSE;
1583 
1584  /* scan through the variables */
1585  for (v = 0; v < scip->origprob->nvars; ++v)
1586  {
1587  SCIP_Real obj;
1588 
1589  /* get objective value of variable */
1590  obj = SCIPvarGetObj(scip->origprob->vars[v]);
1591 
1592  /* check, if objective value is non-zero */
1593  if ( ! SCIPisZero(scip, obj) )
1594  {
1595  /* if variable's objective value is fractional, the problem's objective value may also be fractional */
1596  if ( ! SCIPisIntegral(scip, obj) )
1597  break;
1598 
1599  /* if variable with non-zero objective value is continuous, the problem's objective value may be fractional */
1601  break;
1602  }
1603  }
1604 
1605  /* we do not store the result, since we assume that the original problem might be changed */
1606  if ( v == scip->origprob->nvars )
1607  return TRUE;
1608  return FALSE;
1609 
1612  case SCIP_STAGE_PRESOLVING:
1614  case SCIP_STAGE_PRESOLVED:
1615  case SCIP_STAGE_SOLVING:
1616  return SCIPprobIsObjIntegral(scip->transprob);
1617 
1618  default:
1619  SCIPerrorMessage("invalid SCIP stage <%d>\n", scip->set->stage);
1620  SCIPABORT();
1621  return FALSE; /*lint !e527*/
1622  } /*lint !e788*/
1623 }
1624 
1625 /** returns the Euclidean norm of the objective function vector (available only for transformed problem)
1626  *
1627  * @return the Euclidean norm of the transformed objective function vector
1628  *
1629  * @pre This method can be called if @p scip is in one of the following stages:
1630  * - \ref SCIP_STAGE_TRANSFORMED
1631  * - \ref SCIP_STAGE_INITPRESOLVE
1632  * - \ref SCIP_STAGE_PRESOLVING
1633  * - \ref SCIP_STAGE_EXITPRESOLVE
1634  * - \ref SCIP_STAGE_PRESOLVED
1635  * - \ref SCIP_STAGE_INITSOLVE
1636  * - \ref SCIP_STAGE_SOLVING
1637  * - \ref SCIP_STAGE_SOLVED
1638  * - \ref SCIP_STAGE_EXITSOLVE
1639  */
1641  SCIP* scip /**< SCIP data structure */
1642  )
1643 {
1644  SCIP_CALL_ABORT( SCIPcheckStage(scip, "SCIPgetObjNorm", FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE) );
1645 
1646  if( scip->lp->objsqrnormunreliable )
1647  SCIPlpRecalculateObjSqrNorm(scip->set, scip->lp);
1648  assert(!scip->lp->objsqrnormunreliable);
1649 
1650  return SCIPlpGetObjNorm(scip->lp);
1651 }
1652 
1653 /** adds variable to the problem
1654  *
1655  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
1656  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
1657  *
1658  * @pre This method can be called if @p scip is in one of the following stages:
1659  * - \ref SCIP_STAGE_PROBLEM
1660  * - \ref SCIP_STAGE_TRANSFORMING
1661  * - \ref SCIP_STAGE_INITPRESOLVE
1662  * - \ref SCIP_STAGE_PRESOLVING
1663  * - \ref SCIP_STAGE_EXITPRESOLVE
1664  * - \ref SCIP_STAGE_PRESOLVED
1665  * - \ref SCIP_STAGE_SOLVING
1666  */
1668  SCIP* scip, /**< SCIP data structure */
1669  SCIP_VAR* var /**< variable to add */
1670  )
1671 {
1672  SCIP_CALL( SCIPcheckStage(scip, "SCIPaddVar", FALSE, TRUE, TRUE, FALSE, TRUE, TRUE, TRUE, TRUE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) );
1673 
1674  /* avoid inserting the same variable twice */
1675  if( SCIPvarGetProbindex(var) != -1 )
1676  return SCIP_OKAY;
1677 
1678  /* insert the negation variable x instead of the negated variable x' in x' = offset - x */
1680  {
1681  assert(SCIPvarGetNegationVar(var) != NULL);
1683  return SCIP_OKAY;
1684  }
1685 
1686  switch( scip->set->stage )
1687  {
1688  case SCIP_STAGE_PROBLEM:
1690  {
1691  SCIPerrorMessage("cannot add transformed variables to original problem\n");
1692  return SCIP_INVALIDDATA;
1693  }
1694  SCIP_CALL( SCIPprobAddVar(scip->origprob, scip->mem->probmem, scip->set, scip->lp, scip->branchcand,
1695  scip->eventfilter, scip->eventqueue, var) );
1696  return SCIP_OKAY;
1697 
1700  case SCIP_STAGE_PRESOLVING:
1702  case SCIP_STAGE_PRESOLVED:
1703  case SCIP_STAGE_SOLVING:
1704  /* check variable's status */
1706  {
1707  SCIPerrorMessage("cannot add original variables to transformed problem\n");
1708  return SCIP_INVALIDDATA;
1709  }
1711  {
1712  SCIPerrorMessage("cannot add fixed or aggregated variables to transformed problem\n");
1713  return SCIP_INVALIDDATA;
1714  }
1715  SCIP_CALL( SCIPprobAddVar(scip->transprob, scip->mem->probmem, scip->set, scip->lp,
1716  scip->branchcand, scip->eventfilter, scip->eventqueue, var) );
1717  return SCIP_OKAY;
1718 
1719  default:
1720  SCIPerrorMessage("invalid SCIP stage <%d>\n", scip->set->stage);
1721  return SCIP_INVALIDCALL;
1722  } /*lint !e788*/
1723 }
1724 
1725 /** adds variable to the problem and uses it as pricing candidate to enter the LP
1726  *
1727  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
1728  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
1729  *
1730  * @pre This method can only be called if @p scip is in stage \ref SCIP_STAGE_SOLVING
1731  */
1733  SCIP* scip, /**< SCIP data structure */
1734  SCIP_VAR* var, /**< variable to add */
1735  SCIP_Real score /**< pricing score of variable (the larger, the better the variable) */
1736  )
1737 {
1738  SCIP_CALL( SCIPcheckStage(scip, "SCIPaddPricedVar", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) );
1739 
1740  /* insert the negation variable x instead of the negated variable x' in x' = offset - x */
1742  {
1743  assert(SCIPvarGetNegationVar(var) != NULL);
1744  SCIP_CALL( SCIPaddPricedVar(scip, SCIPvarGetNegationVar(var), score) );
1745  return SCIP_OKAY;
1746  }
1747 
1748  /* add variable to problem if not yet inserted */
1749  if( SCIPvarGetProbindex(var) == -1 )
1750  {
1751  /* check variable's status */
1753  {
1754  SCIPerrorMessage("cannot add original variables to transformed problem\n");
1755  return SCIP_INVALIDDATA;
1756  }
1758  {
1759  SCIPerrorMessage("cannot add fixed or aggregated variables to transformed problem\n");
1760  return SCIP_INVALIDDATA;
1761  }
1762  SCIP_CALL( SCIPprobAddVar(scip->transprob, scip->mem->probmem, scip->set, scip->lp,
1763  scip->branchcand, scip->eventfilter, scip->eventqueue, var) );
1764  }
1765 
1766  /* add variable to pricing storage */
1767  SCIP_CALL( SCIPpricestoreAddVar(scip->pricestore, scip->mem->probmem, scip->set, scip->eventqueue, scip->lp, var, score,
1768  (SCIPtreeGetCurrentDepth(scip->tree) == 0)) );
1769 
1770  return SCIP_OKAY;
1771 }
1772 
1773 /** removes variable from the problem
1774  *
1775  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
1776  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
1777  *
1778  * @pre This method can be called if @p scip is in one of the following stages:
1779  * - \ref SCIP_STAGE_PROBLEM
1780  * - \ref SCIP_STAGE_TRANSFORMING
1781  * - \ref SCIP_STAGE_TRANSFORMED
1782  * - \ref SCIP_STAGE_PRESOLVING
1783  * - \ref SCIP_STAGE_FREETRANS
1784  */
1786  SCIP* scip, /**< SCIP data structure */
1787  SCIP_VAR* var, /**< variable to delete */
1788  SCIP_Bool* deleted /**< pointer to store whether marking variable to be deleted was successful */
1789  )
1790 {
1791  assert(scip != NULL);
1792  assert(var != NULL);
1793  assert(deleted != NULL);
1794 
1795  SCIP_CALL( SCIPcheckStage(scip, "SCIPdelVar", FALSE, TRUE, TRUE, TRUE, FALSE, TRUE, FALSE, TRUE, FALSE, TRUE, FALSE, TRUE, TRUE, FALSE) );
1796 
1797  switch( scip->set->stage )
1798  {
1799  case SCIP_STAGE_PROBLEM:
1801  {
1802  SCIPerrorMessage("cannot remove transformed variables from original problem\n");
1803  return SCIP_INVALIDDATA;
1804  }
1805  SCIP_CALL( SCIPprobDelVar(scip->origprob, scip->mem->probmem, scip->set, scip->eventqueue, var, deleted) );
1806 
1807  /* delete the variables from the problems that were marked to be deleted */
1808  SCIP_CALL( SCIPprobPerformVarDeletions(scip->origprob, scip->mem->probmem, scip->set, scip->stat, scip->eventqueue, scip->cliquetable, scip->lp, scip->branchcand) );
1809 
1810  return SCIP_OKAY;
1811 
1814  case SCIP_STAGE_PRESOLVING:
1815  /* check variable's status */
1817  {
1818  SCIPerrorMessage("cannot remove original variables from transformed problem\n");
1819  return SCIP_INVALIDDATA;
1820  }
1822  {
1823  SCIPerrorMessage("cannot remove fixed or aggregated variables from transformed problem\n");
1824  return SCIP_INVALIDDATA;
1825  }
1826 
1827  SCIP_CALL( SCIPprobDelVar(scip->transprob, scip->mem->probmem, scip->set, scip->eventqueue, var, deleted) );
1828 
1829  return SCIP_OKAY;
1830  case SCIP_STAGE_FREETRANS:
1831  /* in FREETRANS stage, we don't need to remove the variable, because the transformed problem is freed anyways */
1832  *deleted = FALSE;
1833 
1834  return SCIP_OKAY;
1835  default:
1836  SCIPerrorMessage("invalid SCIP stage <%d>\n", scip->set->stage);
1837  return SCIP_INVALIDCALL;
1838  } /*lint !e788*/
1839 }
1840 
1841 /** gets variables of the problem along with the numbers of different variable types; data may become invalid after
1842  * calls to SCIPchgVarType(), SCIPfixVar(), SCIPaggregateVars(), and SCIPmultiaggregateVar()
1843  *
1844  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
1845  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
1846  *
1847  * @pre This method can be called if @p scip is in one of the following stages:
1848  * - \ref SCIP_STAGE_PROBLEM
1849  * - \ref SCIP_STAGE_TRANSFORMED
1850  * - \ref SCIP_STAGE_INITPRESOLVE
1851  * - \ref SCIP_STAGE_PRESOLVING
1852  * - \ref SCIP_STAGE_EXITPRESOLVE
1853  * - \ref SCIP_STAGE_PRESOLVED
1854  * - \ref SCIP_STAGE_INITSOLVE
1855  * - \ref SCIP_STAGE_SOLVING
1856  * - \ref SCIP_STAGE_SOLVED
1857  * - \ref SCIP_STAGE_EXITSOLVE
1858  *
1859  * @note Variables in the vars array are ordered: binaries first, then integers, implicit integers and continuous last.
1860  */
1862  SCIP* scip, /**< SCIP data structure */
1863  SCIP_VAR*** vars, /**< pointer to store variables array or NULL if not needed */
1864  int* nvars, /**< pointer to store number of variables or NULL if not needed */
1865  int* nbinvars, /**< pointer to store number of binary variables or NULL if not needed */
1866  int* nintvars, /**< pointer to store number of integer variables or NULL if not needed */
1867  int* nimplvars, /**< pointer to store number of implicit integral vars or NULL if not needed */
1868  int* ncontvars /**< pointer to store number of continuous variables or NULL if not needed */
1869  )
1870 {
1871  SCIP_CALL( SCIPcheckStage(scip, "SCIPgetVarsData", FALSE, TRUE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE) );
1872 
1873  switch( scip->set->stage )
1874  {
1875  case SCIP_STAGE_PROBLEM:
1876  if( vars != NULL )
1877  *vars = scip->origprob->vars;
1878  if( nvars != NULL )
1879  *nvars = scip->origprob->nvars;
1880  if( nbinvars != NULL )
1881  *nbinvars = scip->origprob->nbinvars;
1882  if( nintvars != NULL )
1883  *nintvars = scip->origprob->nintvars;
1884  if( nimplvars != NULL )
1885  *nimplvars = scip->origprob->nimplvars;
1886  if( ncontvars != NULL )
1887  *ncontvars = scip->origprob->ncontvars;
1888  return SCIP_OKAY;
1889 
1892  case SCIP_STAGE_PRESOLVING:
1894  case SCIP_STAGE_PRESOLVED:
1895  case SCIP_STAGE_INITSOLVE:
1896  case SCIP_STAGE_SOLVING:
1897  case SCIP_STAGE_SOLVED:
1898  case SCIP_STAGE_EXITSOLVE:
1899  if( vars != NULL )
1900  *vars = scip->transprob->vars;
1901  if( nvars != NULL )
1902  *nvars = scip->transprob->nvars;
1903  if( nbinvars != NULL )
1904  *nbinvars = scip->transprob->nbinvars;
1905  if( nintvars != NULL )
1906  *nintvars = scip->transprob->nintvars;
1907  if( nimplvars != NULL )
1908  *nimplvars = scip->transprob->nimplvars;
1909  if( ncontvars != NULL )
1910  *ncontvars = scip->transprob->ncontvars;
1911  return SCIP_OKAY;
1912 
1913  default:
1914  SCIPerrorMessage("invalid SCIP stage <%d>\n", scip->set->stage);
1915  return SCIP_INVALIDCALL;
1916  } /*lint !e788*/
1917 }
1918 
1919 /** gets array with active problem variables
1920  *
1921  * @return array with active problem variables
1922  *
1923  * @pre This method can be called if @p scip is in one of the following stages:
1924  * - \ref SCIP_STAGE_PROBLEM
1925  * - \ref SCIP_STAGE_TRANSFORMED
1926  * - \ref SCIP_STAGE_INITPRESOLVE
1927  * - \ref SCIP_STAGE_PRESOLVING
1928  * - \ref SCIP_STAGE_EXITPRESOLVE
1929  * - \ref SCIP_STAGE_PRESOLVED
1930  * - \ref SCIP_STAGE_INITSOLVE
1931  * - \ref SCIP_STAGE_SOLVING
1932  * - \ref SCIP_STAGE_SOLVED
1933  * - \ref SCIP_STAGE_EXITSOLVE
1934  *
1935  * @note Variables in the array are ordered: binaries first, then integers, implicit integers and continuous last.
1936  *
1937  * @warning If your are using the methods which add or change bound of variables (e.g., SCIPchgVarType(), SCIPfixVar(),
1938  * SCIPaggregateVars(), and SCIPmultiaggregateVar()), it can happen that the internal variable array (which is
1939  * accessed via this method) gets resized and/or resorted. This can invalid the data pointer which is returned
1940  * by this method.
1941  */
1943  SCIP* scip /**< SCIP data structure */
1944  )
1945 {
1946  SCIP_CALL_ABORT( SCIPcheckStage(scip, "SCIPgetVars", FALSE, TRUE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE) );
1947 
1948  switch( scip->set->stage )
1949  {
1950  case SCIP_STAGE_PROBLEM:
1951  return scip->origprob->vars;
1952 
1955  case SCIP_STAGE_PRESOLVING:
1957  case SCIP_STAGE_PRESOLVED:
1958  case SCIP_STAGE_INITSOLVE:
1959  case SCIP_STAGE_SOLVING:
1960  case SCIP_STAGE_SOLVED:
1961  case SCIP_STAGE_EXITSOLVE:
1962  return scip->transprob->vars;
1963 
1964  default:
1965  SCIPerrorMessage("invalid SCIP stage <%d>\n", scip->set->stage);
1966  SCIPABORT();
1967  return NULL; /*lint !e527*/
1968  } /*lint !e788*/
1969 }
1970 
1971 /** gets number of active problem variables
1972  *
1973  * @return the number of active problem variables
1974  *
1975  * @pre This method can be called if @p scip is in one of the following stages:
1976  * - \ref SCIP_STAGE_PROBLEM
1977  * - \ref SCIP_STAGE_TRANSFORMED
1978  * - \ref SCIP_STAGE_INITPRESOLVE
1979  * - \ref SCIP_STAGE_PRESOLVING
1980  * - \ref SCIP_STAGE_EXITPRESOLVE
1981  * - \ref SCIP_STAGE_PRESOLVED
1982  * - \ref SCIP_STAGE_INITSOLVE
1983  * - \ref SCIP_STAGE_SOLVING
1984  * - \ref SCIP_STAGE_SOLVED
1985  * - \ref SCIP_STAGE_EXITSOLVE
1986  */
1988  SCIP* scip /**< SCIP data structure */
1989  )
1990 {
1991  SCIP_CALL_ABORT( SCIPcheckStage(scip, "SCIPgetNVars", FALSE, TRUE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE) );
1992 
1993  switch( scip->set->stage )
1994  {
1995  case SCIP_STAGE_PROBLEM:
1996  return scip->origprob->nvars;
1997 
2000  case SCIP_STAGE_PRESOLVING:
2002  case SCIP_STAGE_PRESOLVED:
2003  case SCIP_STAGE_INITSOLVE:
2004  case SCIP_STAGE_SOLVING:
2005  case SCIP_STAGE_SOLVED:
2006  case SCIP_STAGE_EXITSOLVE:
2007  return scip->transprob->nvars;
2008 
2009  default:
2010  SCIPerrorMessage("invalid SCIP stage <%d>\n", scip->set->stage);
2011  SCIPABORT();
2012  return 0; /*lint !e527*/
2013  } /*lint !e788*/
2014 }
2015 
2016 /** gets number of binary active problem variables
2017  *
2018  * @return the number of binary active problem variables
2019  *
2020  * @pre This method can be called if @p scip is in one of the following stages:
2021  * - \ref SCIP_STAGE_PROBLEM
2022  * - \ref SCIP_STAGE_TRANSFORMED
2023  * - \ref SCIP_STAGE_INITPRESOLVE
2024  * - \ref SCIP_STAGE_PRESOLVING
2025  * - \ref SCIP_STAGE_EXITPRESOLVE
2026  * - \ref SCIP_STAGE_PRESOLVED
2027  * - \ref SCIP_STAGE_INITSOLVE
2028  * - \ref SCIP_STAGE_SOLVING
2029  * - \ref SCIP_STAGE_SOLVED
2030  * - \ref SCIP_STAGE_EXITSOLVE
2031  */
2033  SCIP* scip /**< SCIP data structure */
2034  )
2035 {
2036  SCIP_CALL_ABORT( SCIPcheckStage(scip, "SCIPgetNBinVars", FALSE, TRUE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE) );
2037 
2038  switch( scip->set->stage )
2039  {
2040  case SCIP_STAGE_PROBLEM:
2041  return scip->origprob->nbinvars;
2042 
2045  case SCIP_STAGE_PRESOLVING:
2047  case SCIP_STAGE_PRESOLVED:
2048  case SCIP_STAGE_INITSOLVE:
2049  case SCIP_STAGE_SOLVING:
2050  case SCIP_STAGE_SOLVED:
2051  case SCIP_STAGE_EXITSOLVE:
2052  return scip->transprob->nbinvars;
2053 
2054  default:
2055  SCIPerrorMessage("invalid SCIP stage <%d>\n", scip->set->stage);
2056  SCIPABORT();
2057  return 0; /*lint !e527*/
2058  } /*lint !e788*/
2059 }
2060 
2061 /** gets number of integer active problem variables
2062  *
2063  * @return the number of integer active problem variables
2064  *
2065  * @pre This method can be called if @p scip is in one of the following stages:
2066  * - \ref SCIP_STAGE_PROBLEM
2067  * - \ref SCIP_STAGE_TRANSFORMED
2068  * - \ref SCIP_STAGE_INITPRESOLVE
2069  * - \ref SCIP_STAGE_PRESOLVING
2070  * - \ref SCIP_STAGE_EXITPRESOLVE
2071  * - \ref SCIP_STAGE_PRESOLVED
2072  * - \ref SCIP_STAGE_INITSOLVE
2073  * - \ref SCIP_STAGE_SOLVING
2074  * - \ref SCIP_STAGE_SOLVED
2075  * - \ref SCIP_STAGE_EXITSOLVE
2076  */
2078  SCIP* scip /**< SCIP data structure */
2079  )
2080 {
2081  SCIP_CALL_ABORT( SCIPcheckStage(scip, "SCIPgetNIntVars", FALSE, TRUE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE) );
2082 
2083  switch( scip->set->stage )
2084  {
2085  case SCIP_STAGE_PROBLEM:
2086  return scip->origprob->nintvars;
2087 
2090  case SCIP_STAGE_PRESOLVING:
2092  case SCIP_STAGE_PRESOLVED:
2093  case SCIP_STAGE_INITSOLVE:
2094  case SCIP_STAGE_SOLVING:
2095  case SCIP_STAGE_SOLVED:
2096  case SCIP_STAGE_EXITSOLVE:
2097  return scip->transprob->nintvars;
2098 
2099  default:
2100  SCIPerrorMessage("invalid SCIP stage <%d>\n", scip->set->stage);
2101  SCIPABORT();
2102  return 0; /*lint !e527*/
2103  } /*lint !e788*/
2104 }
2105 
2106 /** gets number of implicit integer active problem variables
2107  *
2108  * @return the number of implicit integer active problem variables
2109  *
2110  * @pre This method can be called if @p scip is in one of the following stages:
2111  * - \ref SCIP_STAGE_PROBLEM
2112  * - \ref SCIP_STAGE_TRANSFORMED
2113  * - \ref SCIP_STAGE_INITPRESOLVE
2114  * - \ref SCIP_STAGE_PRESOLVING
2115  * - \ref SCIP_STAGE_EXITPRESOLVE
2116  * - \ref SCIP_STAGE_PRESOLVED
2117  * - \ref SCIP_STAGE_INITSOLVE
2118  * - \ref SCIP_STAGE_SOLVING
2119  * - \ref SCIP_STAGE_SOLVED
2120  * - \ref SCIP_STAGE_EXITSOLVE
2121  */
2123  SCIP* scip /**< SCIP data structure */
2124  )
2125 {
2126  SCIP_CALL_ABORT( SCIPcheckStage(scip, "SCIPgetNImplVars", FALSE, TRUE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE) );
2127 
2128  switch( scip->set->stage )
2129  {
2130  case SCIP_STAGE_PROBLEM:
2131  return scip->origprob->nimplvars;
2132 
2135  case SCIP_STAGE_PRESOLVING:
2137  case SCIP_STAGE_PRESOLVED:
2138  case SCIP_STAGE_INITSOLVE:
2139  case SCIP_STAGE_SOLVING:
2140  case SCIP_STAGE_SOLVED:
2141  case SCIP_STAGE_EXITSOLVE:
2142  return scip->transprob->nimplvars;
2143 
2144  default:
2145  SCIPerrorMessage("invalid SCIP stage <%d>\n", scip->set->stage);
2146  SCIPABORT();
2147  return 0; /*lint !e527*/
2148  } /*lint !e788*/
2149 }
2150 
2151 /** gets number of continuous active problem variables
2152  *
2153  * @return the number of continuous active problem variables
2154  *
2155  * @pre This method can be called if @p scip is in one of the following stages:
2156  * - \ref SCIP_STAGE_PROBLEM
2157  * - \ref SCIP_STAGE_TRANSFORMED
2158  * - \ref SCIP_STAGE_INITPRESOLVE
2159  * - \ref SCIP_STAGE_PRESOLVING
2160  * - \ref SCIP_STAGE_EXITPRESOLVE
2161  * - \ref SCIP_STAGE_PRESOLVED
2162  * - \ref SCIP_STAGE_INITSOLVE
2163  * - \ref SCIP_STAGE_SOLVING
2164  * - \ref SCIP_STAGE_SOLVED
2165  * - \ref SCIP_STAGE_EXITSOLVE
2166  */
2168  SCIP* scip /**< SCIP data structure */
2169  )
2170 {
2171  SCIP_CALL_ABORT( SCIPcheckStage(scip, "SCIPgetNContVars", FALSE, TRUE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE) );
2172 
2173  switch( scip->set->stage )
2174  {
2175  case SCIP_STAGE_PROBLEM:
2176  return scip->origprob->ncontvars;
2177 
2180  case SCIP_STAGE_PRESOLVING:
2182  case SCIP_STAGE_PRESOLVED:
2183  case SCIP_STAGE_INITSOLVE:
2184  case SCIP_STAGE_SOLVING:
2185  case SCIP_STAGE_SOLVED:
2186  case SCIP_STAGE_EXITSOLVE:
2187  return scip->transprob->ncontvars;
2188 
2189  default:
2190  SCIPerrorMessage("invalid SCIP stage <%d>\n", scip->set->stage);
2191  SCIPABORT();
2192  return 0; /*lint !e527*/
2193  } /*lint !e788*/
2194 }
2195 
2196 
2197 /** gets number of active problem variables with a non-zero objective coefficient
2198  *
2199  * @note In case of the original problem the number of variables is counted. In case of the transformed problem the
2200  * number of variables is just returned since it is stored internally
2201  *
2202  * @return the number of active problem variables with a non-zero objective coefficient
2203  *
2204  * @pre This method can be called if @p scip is in one of the following stages:
2205  * - \ref SCIP_STAGE_PROBLEM
2206  * - \ref SCIP_STAGE_TRANSFORMED
2207  * - \ref SCIP_STAGE_INITPRESOLVE
2208  * - \ref SCIP_STAGE_PRESOLVING
2209  * - \ref SCIP_STAGE_EXITPRESOLVE
2210  * - \ref SCIP_STAGE_PRESOLVED
2211  * - \ref SCIP_STAGE_INITSOLVE
2212  * - \ref SCIP_STAGE_SOLVING
2213  * - \ref SCIP_STAGE_SOLVED
2214  */
2216  SCIP* scip /**< SCIP data structure */
2217  )
2218 {
2219  SCIP_CALL_ABORT( SCIPcheckStage(scip, "SCIPgetNObjVars", FALSE, TRUE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE) );
2220 
2221  switch( scip->set->stage )
2222  {
2223  case SCIP_STAGE_PROBLEM:
2224  return SCIPprobGetNObjVars(scip->origprob, scip->set);
2225 
2228  case SCIP_STAGE_PRESOLVING:
2230  case SCIP_STAGE_PRESOLVED:
2231  case SCIP_STAGE_INITSOLVE:
2232  case SCIP_STAGE_SOLVING:
2233  case SCIP_STAGE_SOLVED:
2234  return SCIPprobGetNObjVars(scip->transprob, scip->set);
2235 
2236  default:
2237  SCIPerrorMessage("invalid SCIP stage <%d>\n", scip->set->stage);
2238  SCIPABORT();
2239  return 0; /*lint !e527*/
2240  } /*lint !e788*/
2241 }
2242 
2243 
2244 /** gets array with fixed and aggregated problem variables; data may become invalid after
2245  * calls to SCIPfixVar(), SCIPaggregateVars(), and SCIPmultiaggregateVar()
2246  *
2247  * @return an array with fixed and aggregated problem variables; data may become invalid after
2248  * calls to SCIPfixVar(), SCIPaggregateVars(), and SCIPmultiaggregateVar()
2249  *
2250  * @pre This method can be called if @p scip is in one of the following stages:
2251  * - \ref SCIP_STAGE_PROBLEM
2252  * - \ref SCIP_STAGE_TRANSFORMED
2253  * - \ref SCIP_STAGE_INITPRESOLVE
2254  * - \ref SCIP_STAGE_PRESOLVING
2255  * - \ref SCIP_STAGE_EXITPRESOLVE
2256  * - \ref SCIP_STAGE_PRESOLVED
2257  * - \ref SCIP_STAGE_INITSOLVE
2258  * - \ref SCIP_STAGE_SOLVING
2259  * - \ref SCIP_STAGE_SOLVED
2260  */
2262  SCIP* scip /**< SCIP data structure */
2263  )
2264 {
2265  SCIP_CALL_ABORT( SCIPcheckStage(scip, "SCIPgetFixedVars", FALSE, TRUE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE) );
2266 
2267  switch( scip->set->stage )
2268  {
2269  case SCIP_STAGE_PROBLEM:
2270  return NULL;
2271 
2274  case SCIP_STAGE_PRESOLVING:
2276  case SCIP_STAGE_PRESOLVED:
2277  case SCIP_STAGE_INITSOLVE:
2278  case SCIP_STAGE_SOLVING:
2279  case SCIP_STAGE_SOLVED:
2280  return scip->transprob->fixedvars;
2281 
2282  default:
2283  SCIPerrorMessage("invalid SCIP stage <%d>\n", scip->set->stage);
2284  SCIPABORT();
2285  return NULL; /*lint !e527*/
2286  } /*lint !e788*/
2287 }
2288 
2289 /** gets number of fixed or aggregated problem variables
2290  *
2291  * @return the number of fixed or aggregated problem variables
2292  *
2293  * @pre This method can be called if @p scip is in one of the following stages:
2294  * - \ref SCIP_STAGE_PROBLEM
2295  * - \ref SCIP_STAGE_TRANSFORMED
2296  * - \ref SCIP_STAGE_INITPRESOLVE
2297  * - \ref SCIP_STAGE_PRESOLVING
2298  * - \ref SCIP_STAGE_EXITPRESOLVE
2299  * - \ref SCIP_STAGE_PRESOLVED
2300  * - \ref SCIP_STAGE_INITSOLVE
2301  * - \ref SCIP_STAGE_SOLVING
2302  * - \ref SCIP_STAGE_SOLVED
2303  */
2305  SCIP* scip /**< SCIP data structure */
2306  )
2307 {
2308  SCIP_CALL_ABORT( SCIPcheckStage(scip, "SCIPgetNFixedVars", FALSE, TRUE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE) );
2309 
2310  switch( scip->set->stage )
2311  {
2312  case SCIP_STAGE_PROBLEM:
2313  return 0;
2314 
2317  case SCIP_STAGE_PRESOLVING:
2319  case SCIP_STAGE_PRESOLVED:
2320  case SCIP_STAGE_INITSOLVE:
2321  case SCIP_STAGE_SOLVING:
2322  case SCIP_STAGE_SOLVED:
2323  return scip->transprob->nfixedvars;
2324 
2325  default:
2326  SCIPerrorMessage("invalid SCIP stage <%d>\n", scip->set->stage);
2327  SCIPABORT();
2328  return 0; /*lint !e527*/
2329  } /*lint !e788*/
2330 }
2331 
2332 /** gets variables of the original problem along with the numbers of different variable types; data may become invalid
2333  * after a call to SCIPchgVarType()
2334  *
2335  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
2336  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
2337  *
2338  * @pre This method can be called if @p scip is in one of the following stages:
2339  * - \ref SCIP_STAGE_PROBLEM
2340  * - \ref SCIP_STAGE_TRANSFORMING
2341  * - \ref SCIP_STAGE_TRANSFORMED
2342  * - \ref SCIP_STAGE_INITPRESOLVE
2343  * - \ref SCIP_STAGE_PRESOLVING
2344  * - \ref SCIP_STAGE_EXITPRESOLVE
2345  * - \ref SCIP_STAGE_PRESOLVED
2346  * - \ref SCIP_STAGE_INITSOLVE
2347  * - \ref SCIP_STAGE_SOLVING
2348  * - \ref SCIP_STAGE_SOLVED
2349  * - \ref SCIP_STAGE_EXITSOLVE
2350  * - \ref SCIP_STAGE_FREETRANS
2351  */
2353  SCIP* scip, /**< SCIP data structure */
2354  SCIP_VAR*** vars, /**< pointer to store variables array or NULL if not needed */
2355  int* nvars, /**< pointer to store number of variables or NULL if not needed */
2356  int* nbinvars, /**< pointer to store number of binary variables or NULL if not needed */
2357  int* nintvars, /**< pointer to store number of integer variables or NULL if not needed */
2358  int* nimplvars, /**< pointer to store number of implicit integral vars or NULL if not needed */
2359  int* ncontvars /**< pointer to store number of continuous variables or NULL if not needed */
2360  )
2361 {
2362  SCIP_CALL( SCIPcheckStage(scip, "SCIPgetOrigVarsData", FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE) );
2363 
2364  if( vars != NULL )
2365  *vars = scip->origprob->vars;
2366  if( nvars != NULL )
2367  *nvars = scip->origprob->nvars;
2368  if( nbinvars != NULL )
2369  *nbinvars = scip->origprob->nbinvars;
2370  if( nintvars != NULL )
2371  *nintvars = scip->origprob->nintvars;
2372  if( nimplvars != NULL )
2373  *nimplvars = scip->origprob->nimplvars;
2374  if( ncontvars != NULL )
2375  *ncontvars = scip->origprob->ncontvars;
2376 
2377  return SCIP_OKAY;
2378 }
2379 
2380 /** gets array with original problem variables; data may become invalid after
2381  * a call to SCIPchgVarType()
2382  *
2383  * @return an array with original problem variables; data may become invalid after
2384  * a call to SCIPchgVarType()
2385  *
2386  * @pre This method can be called if @p scip is in one of the following stages:
2387  * - \ref SCIP_STAGE_PROBLEM
2388  * - \ref SCIP_STAGE_TRANSFORMING
2389  * - \ref SCIP_STAGE_TRANSFORMED
2390  * - \ref SCIP_STAGE_INITPRESOLVE
2391  * - \ref SCIP_STAGE_PRESOLVING
2392  * - \ref SCIP_STAGE_EXITPRESOLVE
2393  * - \ref SCIP_STAGE_PRESOLVED
2394  * - \ref SCIP_STAGE_INITSOLVE
2395  * - \ref SCIP_STAGE_SOLVING
2396  * - \ref SCIP_STAGE_SOLVED
2397  * - \ref SCIP_STAGE_EXITSOLVE
2398  * - \ref SCIP_STAGE_FREETRANS
2399  */
2401  SCIP* scip /**< SCIP data structure */
2402  )
2403 {
2404  SCIP_CALL_ABORT( SCIPcheckStage(scip, "SCIPgetOrigVars", FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE) );
2405 
2406  return scip->origprob->vars;
2407 }
2408 
2409 /** gets number of original problem variables
2410  *
2411  * @return the number of original problem variables
2412  *
2413  * @pre This method can be called if @p scip is in one of the following stages:
2414  * - \ref SCIP_STAGE_PROBLEM
2415  * - \ref SCIP_STAGE_TRANSFORMING
2416  * - \ref SCIP_STAGE_TRANSFORMED
2417  * - \ref SCIP_STAGE_INITPRESOLVE
2418  * - \ref SCIP_STAGE_PRESOLVING
2419  * - \ref SCIP_STAGE_EXITPRESOLVE
2420  * - \ref SCIP_STAGE_PRESOLVED
2421  * - \ref SCIP_STAGE_INITSOLVE
2422  * - \ref SCIP_STAGE_SOLVING
2423  * - \ref SCIP_STAGE_SOLVED
2424  * - \ref SCIP_STAGE_EXITSOLVE
2425  * - \ref SCIP_STAGE_FREETRANS
2426  */
2428  SCIP* scip /**< SCIP data structure */
2429  )
2430 {
2431  SCIP_CALL_ABORT( SCIPcheckStage(scip, "SCIPgetNOrigVars", FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE) );
2432 
2433  return scip->origprob->nvars;
2434 }
2435 
2436 /** gets number of binary variables in the original problem
2437  *
2438  * @return the number of binary variables in the original problem
2439  *
2440  * @pre This method can be called if @p scip is in one of the following stages:
2441  * - \ref SCIP_STAGE_PROBLEM
2442  * - \ref SCIP_STAGE_TRANSFORMING
2443  * - \ref SCIP_STAGE_TRANSFORMED
2444  * - \ref SCIP_STAGE_INITPRESOLVE
2445  * - \ref SCIP_STAGE_PRESOLVING
2446  * - \ref SCIP_STAGE_EXITPRESOLVE
2447  * - \ref SCIP_STAGE_PRESOLVED
2448  * - \ref SCIP_STAGE_INITSOLVE
2449  * - \ref SCIP_STAGE_SOLVING
2450  * - \ref SCIP_STAGE_SOLVED
2451  * - \ref SCIP_STAGE_EXITSOLVE
2452  * - \ref SCIP_STAGE_FREETRANS
2453  */
2455  SCIP* scip /**< SCIP data structure */
2456  )
2457 {
2458  SCIP_CALL_ABORT( SCIPcheckStage(scip, "SCIPgetNOrigBinVars", FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE) );
2459 
2460  return scip->origprob->nbinvars;
2461 }
2462 
2463 /** gets the number of integer variables in the original problem
2464  *
2465  * @return the number of integer variables in the original problem
2466  *
2467  * @pre This method can be called if @p scip is in one of the following stages:
2468  * - \ref SCIP_STAGE_PROBLEM
2469  * - \ref SCIP_STAGE_TRANSFORMING
2470  * - \ref SCIP_STAGE_TRANSFORMED
2471  * - \ref SCIP_STAGE_INITPRESOLVE
2472  * - \ref SCIP_STAGE_PRESOLVING
2473  * - \ref SCIP_STAGE_EXITPRESOLVE
2474  * - \ref SCIP_STAGE_PRESOLVED
2475  * - \ref SCIP_STAGE_INITSOLVE
2476  * - \ref SCIP_STAGE_SOLVING
2477  * - \ref SCIP_STAGE_SOLVED
2478  * - \ref SCIP_STAGE_EXITSOLVE
2479  * - \ref SCIP_STAGE_FREETRANS
2480  */
2482  SCIP* scip /**< SCIP data structure */
2483  )
2484 {
2485  SCIP_CALL_ABORT( SCIPcheckStage(scip, "SCIPgetNOrigIntVars", FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE) );
2486 
2487  return scip->origprob->nintvars;
2488 }
2489 
2490 /** gets number of implicit integer variables in the original problem
2491  *
2492  * @return the number of implicit integer variables in the original problem
2493  *
2494  * @pre This method can be called if @p scip is in one of the following stages:
2495  * - \ref SCIP_STAGE_PROBLEM
2496  * - \ref SCIP_STAGE_TRANSFORMING
2497  * - \ref SCIP_STAGE_TRANSFORMED
2498  * - \ref SCIP_STAGE_INITPRESOLVE
2499  * - \ref SCIP_STAGE_PRESOLVING
2500  * - \ref SCIP_STAGE_EXITPRESOLVE
2501  * - \ref SCIP_STAGE_PRESOLVED
2502  * - \ref SCIP_STAGE_INITSOLVE
2503  * - \ref SCIP_STAGE_SOLVING
2504  * - \ref SCIP_STAGE_SOLVED
2505  * - \ref SCIP_STAGE_EXITSOLVE
2506  * - \ref SCIP_STAGE_FREETRANS
2507  */
2509  SCIP* scip /**< SCIP data structure */
2510  )
2511 {
2512  SCIP_CALL_ABORT( SCIPcheckStage(scip, "SCIPgetNOrigImplVars", FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE) );
2513 
2514  return scip->origprob->nimplvars;
2515 }
2516 
2517 /** gets number of continuous variables in the original problem
2518  *
2519  * @return the number of continuous variables in the original problem
2520  *
2521  * @pre This method can be called if @p scip is in one of the following stages:
2522  * - \ref SCIP_STAGE_PROBLEM
2523  * - \ref SCIP_STAGE_TRANSFORMING
2524  * - \ref SCIP_STAGE_TRANSFORMED
2525  * - \ref SCIP_STAGE_INITPRESOLVE
2526  * - \ref SCIP_STAGE_PRESOLVING
2527  * - \ref SCIP_STAGE_EXITPRESOLVE
2528  * - \ref SCIP_STAGE_PRESOLVED
2529  * - \ref SCIP_STAGE_INITSOLVE
2530  * - \ref SCIP_STAGE_SOLVING
2531  * - \ref SCIP_STAGE_SOLVED
2532  * - \ref SCIP_STAGE_EXITSOLVE
2533  * - \ref SCIP_STAGE_FREETRANS
2534  */
2536  SCIP* scip /**< SCIP data structure */
2537  )
2538 {
2539  SCIP_CALL_ABORT( SCIPcheckStage(scip, "SCIPgetNOrigContVars", FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE) );
2540 
2541  return scip->origprob->ncontvars;
2542 }
2543 
2544 /** gets number of all problem variables created during creation and solving of problem;
2545  * this includes also variables that were deleted in the meantime
2546  *
2547  * @return the number of all problem variables created during creation and solving of problem;
2548  * this includes also variables that were deleted in the meantime
2549  *
2550  * @pre This method can be called if @p scip is in one of the following stages:
2551  * - \ref SCIP_STAGE_PROBLEM
2552  * - \ref SCIP_STAGE_TRANSFORMING
2553  * - \ref SCIP_STAGE_TRANSFORMED
2554  * - \ref SCIP_STAGE_INITPRESOLVE
2555  * - \ref SCIP_STAGE_PRESOLVING
2556  * - \ref SCIP_STAGE_EXITPRESOLVE
2557  * - \ref SCIP_STAGE_PRESOLVED
2558  * - \ref SCIP_STAGE_INITSOLVE
2559  * - \ref SCIP_STAGE_SOLVING
2560  * - \ref SCIP_STAGE_SOLVED
2561  * - \ref SCIP_STAGE_EXITSOLVE
2562  * - \ref SCIP_STAGE_FREETRANS
2563  */
2565  SCIP* scip /**< SCIP data structure */
2566  )
2567 {
2568  SCIP_CALL_ABORT( SCIPcheckStage(scip, "SCIPgetNTotalVars", FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE) );
2569 
2570  assert(scip->stat != NULL);
2571 
2572  switch( scip->set->stage )
2573  {
2574  case SCIP_STAGE_PROBLEM:
2578  case SCIP_STAGE_PRESOLVING:
2580  case SCIP_STAGE_PRESOLVED:
2581  case SCIP_STAGE_INITSOLVE:
2582  case SCIP_STAGE_SOLVING:
2583  case SCIP_STAGE_SOLVED:
2584  case SCIP_STAGE_EXITSOLVE:
2585  case SCIP_STAGE_FREETRANS:
2586  return scip->stat->nvaridx;
2587 
2588  default:
2589  SCIPerrorMessage("invalid SCIP stage <%d>\n", scip->set->stage);
2590  SCIPABORT();
2591  return 0; /*lint !e527*/
2592  } /*lint !e788*/
2593 }
2594 
2595 
2596 /** gets variables of the original or transformed problem along with the numbers of different variable types;
2597  * the returned problem space (original or transformed) corresponds to the given solution;
2598  * data may become invalid after calls to SCIPchgVarType(), SCIPfixVar(), SCIPaggregateVars(), and
2599  * SCIPmultiaggregateVar()
2600  *
2601  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
2602  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
2603  *
2604  * @pre This method can be called if @p scip is in one of the following stages:
2605  * - \ref SCIP_STAGE_PROBLEM
2606  * - \ref SCIP_STAGE_TRANSFORMED
2607  * - \ref SCIP_STAGE_INITPRESOLVE
2608  * - \ref SCIP_STAGE_PRESOLVING
2609  * - \ref SCIP_STAGE_EXITPRESOLVE
2610  * - \ref SCIP_STAGE_PRESOLVED
2611  * - \ref SCIP_STAGE_INITSOLVE
2612  * - \ref SCIP_STAGE_SOLVING
2613  * - \ref SCIP_STAGE_SOLVED
2614  */
2616  SCIP* scip, /**< SCIP data structure */
2617  SCIP_SOL* sol, /**< primal solution that selects the problem space, NULL for current solution */
2618  SCIP_VAR*** vars, /**< pointer to store variables array or NULL if not needed */
2619  int* nvars, /**< pointer to store number of variables or NULL if not needed */
2620  int* nbinvars, /**< pointer to store number of binary variables or NULL if not needed */
2621  int* nintvars, /**< pointer to store number of integer variables or NULL if not needed */
2622  int* nimplvars, /**< pointer to store number of implicit integral vars or NULL if not needed */
2623  int* ncontvars /**< pointer to store number of continuous variables or NULL if not needed */
2624  )
2625 {
2626  SCIP_CALL( SCIPcheckStage(scip, "SCIPgetSolVarsData", FALSE, TRUE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE) );
2627 
2628  if( scip->set->stage == SCIP_STAGE_PROBLEM || (sol != NULL && SCIPsolIsOriginal(sol)) )
2629  {
2630  if( vars != NULL )
2631  *vars = scip->origprob->vars;
2632  if( nvars != NULL )
2633  *nvars = scip->origprob->nvars;
2634  if( nbinvars != NULL )
2635  *nbinvars = scip->origprob->nbinvars;
2636  if( nintvars != NULL )
2637  *nintvars = scip->origprob->nintvars;
2638  if( nimplvars != NULL )
2639  *nimplvars = scip->origprob->nimplvars;
2640  if( ncontvars != NULL )
2641  *ncontvars = scip->origprob->ncontvars;
2642  }
2643  else
2644  {
2645  if( vars != NULL )
2646  *vars = scip->transprob->vars;
2647  if( nvars != NULL )
2648  *nvars = scip->transprob->nvars;
2649  if( nbinvars != NULL )
2650  *nbinvars = scip->transprob->nbinvars;
2651  if( nintvars != NULL )
2652  *nintvars = scip->transprob->nintvars;
2653  if( nimplvars != NULL )
2654  *nimplvars = scip->transprob->nimplvars;
2655  if( ncontvars != NULL )
2656  *ncontvars = scip->transprob->ncontvars;
2657  }
2658 
2659  return SCIP_OKAY;
2660 }
2661 
2662 /** returns variable of given name in the problem, or NULL if not existing
2663  *
2664  * @return variable of given name in the problem, or NULL if not existing
2665  *
2666  * @pre This method can be called if @p scip is in one of the following stages:
2667  * - \ref SCIP_STAGE_PROBLEM
2668  * - \ref SCIP_STAGE_TRANSFORMING
2669  * - \ref SCIP_STAGE_TRANSFORMED
2670  * - \ref SCIP_STAGE_INITPRESOLVE
2671  * - \ref SCIP_STAGE_PRESOLVING
2672  * - \ref SCIP_STAGE_EXITPRESOLVE
2673  * - \ref SCIP_STAGE_PRESOLVED
2674  * - \ref SCIP_STAGE_INITSOLVE
2675  * - \ref SCIP_STAGE_SOLVING
2676  * - \ref SCIP_STAGE_SOLVED
2677  * - \ref SCIP_STAGE_EXITSOLVE
2678  * - \ref SCIP_STAGE_FREETRANS
2679  */
2681  SCIP* scip, /**< SCIP data structure */
2682  const char* name /**< name of variable to find */
2683  )
2684 {
2685  SCIP_VAR* var;
2686 
2687  assert(name != NULL);
2688 
2689  SCIP_CALL_ABORT( SCIPcheckStage(scip, "SCIPfindVar", FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE) );
2690 
2691  switch( scip->set->stage )
2692  {
2693  case SCIP_STAGE_PROBLEM:
2694  return SCIPprobFindVar(scip->origprob, name);
2695 
2699  case SCIP_STAGE_PRESOLVING:
2701  case SCIP_STAGE_PRESOLVED:
2702  case SCIP_STAGE_INITSOLVE:
2703  case SCIP_STAGE_SOLVING:
2704  case SCIP_STAGE_SOLVED:
2705  case SCIP_STAGE_EXITSOLVE:
2706  case SCIP_STAGE_FREETRANS:
2707  var = SCIPprobFindVar(scip->transprob, name);
2708  if( var == NULL )
2709  return SCIPprobFindVar(scip->origprob, name);
2710  else
2711  return var;
2712 
2713  default:
2714  SCIPerrorMessage("invalid SCIP stage <%d>\n", scip->set->stage);
2715  SCIPABORT();
2716  return NULL; /*lint !e527*/
2717  } /*lint !e788*/
2718 }
2719 
2720 /** returns TRUE iff all potential variables exist in the problem, and FALSE, if there may be additional variables,
2721  * that will be added in pricing and improve the objective value
2722  *
2723  * @return TRUE, if all potential variables exist in the problem; FALSE, otherwise
2724  *
2725  * @pre This method can be called if @p scip is in one of the following stages:
2726  * - \ref SCIP_STAGE_TRANSFORMING
2727  * - \ref SCIP_STAGE_TRANSFORMED
2728  * - \ref SCIP_STAGE_INITPRESOLVE
2729  * - \ref SCIP_STAGE_PRESOLVING
2730  * - \ref SCIP_STAGE_EXITPRESOLVE
2731  * - \ref SCIP_STAGE_PRESOLVED
2732  * - \ref SCIP_STAGE_INITSOLVE
2733  * - \ref SCIP_STAGE_SOLVING
2734  * - \ref SCIP_STAGE_SOLVED
2735  * - \ref SCIP_STAGE_EXITSOLVE
2736  * - \ref SCIP_STAGE_FREETRANS
2737  */
2739  SCIP* scip /**< SCIP data structure */
2740  )
2741 {
2742  SCIP_CALL_ABORT( SCIPcheckStage(scip, "SCIPallVarsInProb", FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE) );
2743 
2744  return (scip->set->nactivepricers == 0);
2745 }
2746 
2747 /** adds constraint to the problem; if constraint is only valid locally, it is added to the local subproblem of the
2748  * current node (and all of its subnodes); otherwise it is added to the global problem;
2749  * if a local constraint is added at the root node, it is automatically upgraded into a global constraint
2750  *
2751  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
2752  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
2753  *
2754  * @pre This method can be called if @p scip is in one of the following stages:
2755  * - \ref SCIP_STAGE_PROBLEM
2756  * - \ref SCIP_STAGE_TRANSFORMED
2757  * - \ref SCIP_STAGE_INITPRESOLVE
2758  * - \ref SCIP_STAGE_PRESOLVING
2759  * - \ref SCIP_STAGE_EXITPRESOLVE
2760  * - \ref SCIP_STAGE_PRESOLVED
2761  * - \ref SCIP_STAGE_INITSOLVE
2762  * - \ref SCIP_STAGE_SOLVING
2763  * - \ref SCIP_STAGE_EXITSOLVE
2764  */
2766  SCIP* scip, /**< SCIP data structure */
2767  SCIP_CONS* cons /**< constraint to add */
2768  )
2769 {
2770  assert(cons != NULL);
2771 
2772  SCIP_CALL( SCIPcheckStage(scip, "SCIPaddCons", FALSE, TRUE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, TRUE, FALSE, FALSE) );
2773 
2774  switch( scip->set->stage )
2775  {
2776  case SCIP_STAGE_PROBLEM:
2777  {
2778  SCIP_CALL( SCIPprobAddCons(scip->origprob, scip->set, scip->stat, cons) );
2779 
2780  if( scip->set->reopt_enable )
2781  {
2782  SCIP_CALL( SCIPreoptAddCons(scip->reopt, scip->set, scip->mem->probmem, cons) );
2783  }
2784  }
2785  return SCIP_OKAY;
2786 
2788  SCIP_CALL( SCIPprobAddCons(scip->transprob, scip->set, scip->stat, cons) );
2789  return SCIP_OKAY;
2790 
2792  case SCIP_STAGE_PRESOLVING:
2794  case SCIP_STAGE_PRESOLVED:
2795  case SCIP_STAGE_INITSOLVE:
2796  case SCIP_STAGE_SOLVING:
2797  assert( SCIPtreeGetCurrentDepth(scip->tree) >= 0 || scip->set->stage == SCIP_STAGE_PRESOLVED
2798  || scip->set->stage == SCIP_STAGE_INITSOLVE );
2800  SCIPconsSetLocal(cons, FALSE);
2801  if( SCIPconsIsGlobal(cons) )
2802  {
2803  SCIP_CALL( SCIPprobAddCons(scip->transprob, scip->set, scip->stat, cons) );
2804  }
2805  else
2806  {
2808  SCIP_CALL( SCIPnodeAddCons(SCIPtreeGetCurrentNode(scip->tree), scip->mem->probmem, scip->set, scip->stat,
2809  scip->tree, cons) );
2810  }
2811  return SCIP_OKAY;
2812 
2813  case SCIP_STAGE_EXITSOLVE:
2814  SCIP_CALL( SCIPprobAddCons(scip->transprob, scip->set, scip->stat, cons) );
2815  return SCIP_OKAY;
2816 
2817  default:
2818  SCIPerrorMessage("invalid SCIP stage <%d>\n", scip->set->stage);
2819  return SCIP_INVALIDCALL;
2820  } /*lint !e788*/
2821 }
2822 
2823 /** globally removes constraint from all subproblems; removes constraint from the constraint set change data of the
2824  * node, where it was added, or from the problem, if it was a problem constraint
2825  *
2826  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
2827  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
2828  *
2829  * @pre This method can be called if @p scip is in one of the following stages:
2830  * - \ref SCIP_STAGE_PROBLEM
2831  * - \ref SCIP_STAGE_INITPRESOLVE
2832  * - \ref SCIP_STAGE_PRESOLVING
2833  * - \ref SCIP_STAGE_EXITPRESOLVE
2834  * - \ref SCIP_STAGE_INITSOLVE
2835  * - \ref SCIP_STAGE_SOLVING
2836  * - \ref SCIP_STAGE_EXITSOLVE
2837  */
2839  SCIP* scip, /**< SCIP data structure */
2840  SCIP_CONS* cons /**< constraint to delete */
2841  )
2842 {
2843  assert(cons != NULL);
2844 
2845  SCIP_CALL( SCIPcheckStage(scip, "SCIPdelCons", FALSE, TRUE, FALSE, FALSE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, TRUE, FALSE, FALSE) );
2846 
2847  switch( scip->set->stage )
2848  {
2849  case SCIP_STAGE_PROBLEM:
2850  assert(cons->addconssetchg == NULL);
2851  SCIP_CALL( SCIPconsDelete(cons, scip->mem->probmem, scip->set, scip->stat, scip->origprob, scip->reopt) );
2852  return SCIP_OKAY;
2853 
2854  /* only added constraints can be removed in (de-)initialization process of presolving, otherwise the reduction
2855  * might be wrong
2856  */
2859  assert(SCIPconsIsAdded(cons));
2860  /*lint -fallthrough*/
2861 
2862  case SCIP_STAGE_PRESOLVING:
2863  case SCIP_STAGE_INITSOLVE:
2864  case SCIP_STAGE_SOLVING:
2865  case SCIP_STAGE_EXITSOLVE:
2866  SCIP_CALL( SCIPconsDelete(cons, scip->mem->probmem, scip->set, scip->stat, scip->transprob, scip->reopt) );
2867  return SCIP_OKAY;
2868 
2869  default:
2870  SCIPerrorMessage("invalid SCIP stage <%d>\n", scip->set->stage);
2871  return SCIP_INVALIDCALL;
2872  } /*lint !e788*/
2873 }
2874 
2875 /** returns original constraint of given name in the problem, or NULL if not existing
2876  *
2877  * @return original constraint of given name in the problem, or NULL if not existing
2878  *
2879  * @pre This method can be called if @p scip is in one of the following stages:
2880  * - \ref SCIP_STAGE_PROBLEM
2881  * - \ref SCIP_STAGE_TRANSFORMING
2882  * - \ref SCIP_STAGE_TRANSFORMED
2883  * - \ref SCIP_STAGE_INITPRESOLVE
2884  * - \ref SCIP_STAGE_PRESOLVING
2885  * - \ref SCIP_STAGE_EXITPRESOLVE
2886  * - \ref SCIP_STAGE_PRESOLVED
2887  * - \ref SCIP_STAGE_INITSOLVE
2888  * - \ref SCIP_STAGE_SOLVING
2889  * - \ref SCIP_STAGE_SOLVED
2890  * - \ref SCIP_STAGE_EXITSOLVE
2891  * - \ref SCIP_STAGE_FREETRANS
2892  */
2894  SCIP* scip, /**< SCIP data structure */
2895  const char* name /**< name of constraint to find */
2896  )
2897 {
2898  assert(name != NULL);
2899 
2900  SCIP_CALL_ABORT( SCIPcheckStage(scip, "SCIPfindOrigCons", FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE) );
2901 
2902  switch( scip->set->stage )
2903  {
2904  case SCIP_STAGE_PROBLEM:
2908  case SCIP_STAGE_PRESOLVING:
2910  case SCIP_STAGE_PRESOLVED:
2911  case SCIP_STAGE_SOLVING:
2912  case SCIP_STAGE_SOLVED:
2913  case SCIP_STAGE_EXITSOLVE:
2914  case SCIP_STAGE_FREETRANS:
2915  return SCIPprobFindCons(scip->origprob, name);
2916 
2917  default:
2918  SCIPerrorMessage("invalid SCIP stage <%d>\n", scip->set->stage);
2919  SCIPABORT();
2920  return NULL; /*lint !e527*/
2921  } /*lint !e788*/
2922 }
2923 
2924 /** returns constraint of given name in the problem, or NULL if not existing
2925  *
2926  * @return constraint of given name in the problem, or NULL if not existing
2927  *
2928  * @pre This method can be called if @p scip is in one of the following stages:
2929  * - \ref SCIP_STAGE_PROBLEM
2930  * - \ref SCIP_STAGE_TRANSFORMING
2931  * - \ref SCIP_STAGE_TRANSFORMED
2932  * - \ref SCIP_STAGE_INITPRESOLVE
2933  * - \ref SCIP_STAGE_PRESOLVING
2934  * - \ref SCIP_STAGE_EXITPRESOLVE
2935  * - \ref SCIP_STAGE_PRESOLVED
2936  * - \ref SCIP_STAGE_INITSOLVE
2937  * - \ref SCIP_STAGE_SOLVING
2938  * - \ref SCIP_STAGE_SOLVED
2939  * - \ref SCIP_STAGE_EXITSOLVE
2940  * - \ref SCIP_STAGE_FREETRANS
2941  */
2943  SCIP* scip, /**< SCIP data structure */
2944  const char* name /**< name of constraint to find */
2945  )
2946 {
2947  SCIP_CONS* cons;
2948 
2949  assert(name != NULL);
2950 
2951  SCIP_CALL_ABORT( SCIPcheckStage(scip, "SCIPfindCons", FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE) );
2952 
2953  switch( scip->set->stage )
2954  {
2955  case SCIP_STAGE_PROBLEM:
2956  return SCIPprobFindCons(scip->origprob, name);
2957 
2961  case SCIP_STAGE_PRESOLVING:
2963  case SCIP_STAGE_PRESOLVED:
2964  case SCIP_STAGE_SOLVING:
2965  case SCIP_STAGE_SOLVED:
2966  case SCIP_STAGE_EXITSOLVE:
2967  case SCIP_STAGE_FREETRANS:
2968  cons = SCIPprobFindCons(scip->transprob, name);
2969  if( cons == NULL )
2970  return SCIPprobFindCons(scip->origprob, name);
2971  else
2972  return cons;
2973 
2974  default:
2975  SCIPerrorMessage("invalid SCIP stage <%d>\n", scip->set->stage);
2976  SCIPABORT();
2977  return NULL; /*lint !e527*/
2978  } /*lint !e788*/
2979 }
2980 
2981 /** gets number of upgraded constraints
2982  *
2983  * @return number of upgraded constraints
2984  *
2985  * @pre This method can be called if @p scip is in one of the following stages:
2986  * - \ref SCIP_STAGE_PROBLEM
2987  * - \ref SCIP_STAGE_TRANSFORMED
2988  * - \ref SCIP_STAGE_INITPRESOLVE
2989  * - \ref SCIP_STAGE_PRESOLVING
2990  * - \ref SCIP_STAGE_PRESOLVED
2991  * - \ref SCIP_STAGE_EXITPRESOLVE
2992  * - \ref SCIP_STAGE_SOLVING
2993  * - \ref SCIP_STAGE_SOLVED
2994  */
2996  SCIP* scip /**< SCIP data structure */
2997  )
2998 {
2999  SCIP_CALL_ABORT( SCIPcheckStage(scip, "SCIPgetNUpgrConss", FALSE, TRUE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE) );
3000 
3001  switch( scip->set->stage )
3002  {
3003  case SCIP_STAGE_PROBLEM:
3004  return 0;
3005 
3008  case SCIP_STAGE_PRESOLVING:
3010  case SCIP_STAGE_PRESOLVED:
3011  case SCIP_STAGE_SOLVING:
3012  case SCIP_STAGE_SOLVED:
3013  return scip->stat->npresolupgdconss;
3014 
3015  default:
3016  SCIPerrorMessage("invalid SCIP stage <%d>\n", scip->set->stage);
3017  SCIPABORT();
3018  return 0; /*lint !e527*/
3019  } /*lint !e788*/
3020 }
3021 
3022 /** gets total number of globally valid constraints currently in the problem
3023  *
3024  * @return total number of globally valid constraints currently in the problem
3025  *
3026  * @pre This method can be called if @p scip is in one of the following stages:
3027  * - \ref SCIP_STAGE_PROBLEM
3028  * - \ref SCIP_STAGE_TRANSFORMED
3029  * - \ref SCIP_STAGE_INITPRESOLVE
3030  * - \ref SCIP_STAGE_PRESOLVING
3031  * - \ref SCIP_STAGE_EXITPRESOLVE
3032  * - \ref SCIP_STAGE_PRESOLVED
3033  * - \ref SCIP_STAGE_INITSOLVE
3034  * - \ref SCIP_STAGE_SOLVING
3035  * - \ref SCIP_STAGE_SOLVED
3036  */
3038  SCIP* scip /**< SCIP data structure */
3039  )
3040 {
3041  SCIP_CALL_ABORT( SCIPcheckStage(scip, "SCIPgetNConss", FALSE, TRUE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE) );
3042 
3043  switch( scip->set->stage )
3044  {
3045  case SCIP_STAGE_PROBLEM:
3046  return scip->origprob->nconss;
3047 
3050  case SCIP_STAGE_PRESOLVING:
3052  case SCIP_STAGE_PRESOLVED:
3053  case SCIP_STAGE_INITSOLVE:
3054  case SCIP_STAGE_SOLVING:
3055  case SCIP_STAGE_SOLVED:
3056  return scip->transprob->nconss;
3057 
3058  default:
3059  SCIPerrorMessage("invalid SCIP stage <%d>\n", scip->set->stage);
3060  SCIPABORT();
3061  return 0; /*lint !e527*/
3062  } /*lint !e788*/
3063 }
3064 
3065 /** gets array of globally valid constraints currently in the problem
3066  *
3067  * @return array of globally valid constraints currently in the problem
3068  *
3069  * @pre This method can be called if @p scip is in one of the following stages:
3070  * - \ref SCIP_STAGE_PROBLEM
3071  * - \ref SCIP_STAGE_TRANSFORMED
3072  * - \ref SCIP_STAGE_INITPRESOLVE
3073  * - \ref SCIP_STAGE_PRESOLVING
3074  * - \ref SCIP_STAGE_EXITPRESOLVE
3075  * - \ref SCIP_STAGE_PRESOLVED
3076  * - \ref SCIP_STAGE_INITSOLVE
3077  * - \ref SCIP_STAGE_SOLVING
3078  * - \ref SCIP_STAGE_SOLVED
3079  *
3080  * @warning If your are using the method SCIPaddCons(), it can happen that the internal constraint array (which is
3081  * accessed via this method) gets resized. This can invalid the pointer which is returned by this method.
3082  */
3084  SCIP* scip /**< SCIP data structure */
3085  )
3086 {
3087  SCIP_CALL_ABORT( SCIPcheckStage(scip, "SCIPgetConss", FALSE, TRUE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE) );
3088 
3089  switch( scip->set->stage )
3090  {
3091  case SCIP_STAGE_PROBLEM:
3092  return scip->origprob->conss;
3093 
3096  case SCIP_STAGE_PRESOLVING:
3098  case SCIP_STAGE_PRESOLVED:
3099  case SCIP_STAGE_INITSOLVE:
3100  case SCIP_STAGE_SOLVING:
3101  case SCIP_STAGE_SOLVED:
3102  return scip->transprob->conss;
3103 
3104  default:
3105  SCIPerrorMessage("invalid SCIP stage <%d>\n", scip->set->stage);
3106  SCIPABORT();
3107  return NULL; /*lint !e527*/
3108  } /*lint !e788*/
3109 }
3110 
3111 /** gets total number of constraints in the original problem
3112  *
3113  * @return total number of constraints in the original problem
3114  *
3115  * @pre This method can be called if @p scip is in one of the following stages:
3116  * - \ref SCIP_STAGE_PROBLEM
3117  * - \ref SCIP_STAGE_TRANSFORMING
3118  * - \ref SCIP_STAGE_TRANSFORMED
3119  * - \ref SCIP_STAGE_INITPRESOLVE
3120  * - \ref SCIP_STAGE_PRESOLVING
3121  * - \ref SCIP_STAGE_EXITPRESOLVE
3122  * - \ref SCIP_STAGE_PRESOLVED
3123  * - \ref SCIP_STAGE_INITSOLVE
3124  * - \ref SCIP_STAGE_SOLVING
3125  * - \ref SCIP_STAGE_SOLVED
3126  * - \ref SCIP_STAGE_EXITSOLVE
3127  * - \ref SCIP_STAGE_FREETRANS
3128  */
3130  SCIP* scip /**< SCIP data structure */
3131  )
3132 {
3133  SCIP_CALL_ABORT( SCIPcheckStage(scip, "SCIPgetNOrigConss", FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE) );
3134 
3135  return scip->origprob->nconss;
3136 }
3137 
3138 /** gets array of constraints in the original problem
3139  *
3140  * @return array of constraints in the original problem
3141  *
3142  * @pre This method can be called if @p scip is in one of the following stages:
3143  * - \ref SCIP_STAGE_PROBLEM
3144  * - \ref SCIP_STAGE_TRANSFORMING
3145  * - \ref SCIP_STAGE_TRANSFORMED
3146  * - \ref SCIP_STAGE_INITPRESOLVE
3147  * - \ref SCIP_STAGE_PRESOLVING
3148  * - \ref SCIP_STAGE_EXITPRESOLVE
3149  * - \ref SCIP_STAGE_PRESOLVED
3150  * - \ref SCIP_STAGE_INITSOLVE
3151  * - \ref SCIP_STAGE_SOLVING
3152  * - \ref SCIP_STAGE_SOLVED
3153  * - \ref SCIP_STAGE_EXITSOLVE
3154  * - \ref SCIP_STAGE_FREETRANS
3155  */
3157  SCIP* scip /**< SCIP data structure */
3158  )
3159 {
3160  SCIP_CALL_ABORT( SCIPcheckStage(scip, "SCIPgetOrigConss", FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE) );
3161 
3162  return scip->origprob->conss;
3163 }
3164 
3165 /** computes the number of check constraint in the current node (loop over all constraint handler and cumulates the
3166  * number of check constraints)
3167  *
3168  * @return returns the number of check constraints
3169  *
3170  * @pre This method can be called if @p scip is in one of the following stages:
3171  * - \ref SCIP_STAGE_TRANSFORMED
3172  * - \ref SCIP_STAGE_INITPRESOLVE
3173  * - \ref SCIP_STAGE_PRESOLVING
3174  * - \ref SCIP_STAGE_EXITPRESOLVE
3175  * - \ref SCIP_STAGE_PRESOLVED
3176  * - \ref SCIP_STAGE_INITSOLVE
3177  * - \ref SCIP_STAGE_SOLVING
3178  */
3180  SCIP* scip /**< SCIP data structure */
3181  )
3182 {
3183  SCIP_CONSHDLR** conshdlrs;
3184  int nconshdlrs;
3185  int ncheckconss;
3186  int c;
3187 
3188  SCIP_CALL_ABORT( SCIPcheckStage(scip, "SCIPgetNCheckConss", FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE) );
3189 
3190  nconshdlrs = SCIPgetNConshdlrs(scip);
3191  conshdlrs = SCIPgetConshdlrs(scip);
3192  assert(conshdlrs != NULL);
3193 
3194  ncheckconss = 0;
3195 
3196  /* loop over all constraint handler and collect the number of constraints which need to be checked */
3197  for( c = 0; c < nconshdlrs; ++c )
3198  {
3199  assert(conshdlrs[c] != NULL);
3200  ncheckconss += SCIPconshdlrGetNCheckConss(conshdlrs[c]);
3201  }
3202 
3203  return ncheckconss;
3204 }
3205 
3206 /*
3207  * local subproblem methods
3208  */
3209 
3210 /** adds a conflict to a given node or globally to the problem if @p node == NULL.
3211  *
3212  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
3213  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
3214  *
3215  * @pre this method can be called in one of the following stages of the SCIP solving process:
3216  * - \ref SCIP_STAGE_INITPRESOLVE
3217  * - \ref SCIP_STAGE_PRESOLVING
3218  * - \ref SCIP_STAGE_EXITPRESOLVE
3219  * - \ref SCIP_STAGE_SOLVING
3220  *
3221  * @note this method will release the constraint
3222  */
3224  SCIP* scip, /**< SCIP data structure */
3225  SCIP_NODE* node, /**< node to add conflict (or NULL if global) */
3226  SCIP_CONS* cons, /**< constraint representing the conflict */
3227  SCIP_NODE* validnode, /**< node at whichaddConf the constraint is valid (or NULL) */
3228  SCIP_CONFTYPE conftype, /**< type of the conflict */
3229  SCIP_Bool iscutoffinvolved /**< is a cutoff bound involved in this conflict */
3230  )
3231 {
3232  SCIP_Real primalbound;
3233 
3234  assert(scip != NULL);
3235  assert(cons != NULL);
3236  assert(scip->conflictstore != NULL);
3237  assert(conftype != SCIP_CONFTYPE_UNKNOWN);
3238  assert(conftype != SCIP_CONFTYPE_BNDEXCEEDING || iscutoffinvolved);
3239 
3240  SCIP_CALL( SCIPcheckStage(scip, "SCIPaddConflict", FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) );
3241 
3242  if( iscutoffinvolved )
3243  primalbound = SCIPgetCutoffbound(scip);
3244  else
3245  primalbound = -SCIPinfinity(scip);
3246 
3247  /* add a global conflict */
3248  if( node == NULL )
3249  {
3250  SCIP_CALL( SCIPaddCons(scip, cons) );
3251  }
3252  /* add a local conflict */
3253  else
3254  {
3255  SCIP_CALL( SCIPaddConsNode(scip, node, cons, validnode) );
3256  }
3257 
3258  if( node == NULL || SCIPnodeGetType(node) != SCIP_NODETYPE_PROBINGNODE )
3259  {
3260  /* add the conflict to the conflict store */
3261  SCIP_CALL( SCIPconflictstoreAddConflict(scip->conflictstore, scip->mem->probmem, scip->set, scip->stat, scip->tree,
3262  scip->transprob, scip->reopt, cons, conftype, iscutoffinvolved, primalbound) );
3263  }
3264 
3265  /* mark constraint to be a conflict */
3266  SCIPconsMarkConflict(cons);
3267 
3268  SCIP_CALL( SCIPreleaseCons(scip, &cons) );
3269 
3270  return SCIP_OKAY;
3271 }
3272 
3273 /** tries to remove conflicts depending on an old cutoff bound if the improvement of the new incumbent is good enough
3274  *
3275  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
3276  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
3277  *
3278  * @pre this method can be called in one of the following stages of the SCIP solving process:
3279  * - \ref SCIP_STAGE_PRESOLVING
3280  * - \ref SCIP_STAGE_SOLVING
3281  */
3283  SCIP* scip, /**< SCIP data structure */
3284  SCIP_EVENT* event /**< event data */
3285  )
3286 {
3287  assert(scip != NULL);
3288  assert(event != NULL);
3290  assert(SCIPeventGetSol(event) != NULL);
3291 
3292  SCIP_CALL( SCIPcheckStage(scip, "SCIPclearConflictStore", FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) );
3293 
3295  scip->transprob, scip->reopt, scip->primal->cutoffbound) );
3296 
3297  return SCIP_OKAY;
3298 }
3299 
3300 /** adds constraint to the given node (and all of its subnodes), even if it is a global constraint;
3301  * It is sometimes desirable to add the constraint to a more local node (i.e., a node of larger depth) even if
3302  * the constraint is also valid higher in the tree, for example, if one wants to produce a constraint which is
3303  * only active in a small part of the tree although it is valid in a larger part.
3304  * In this case, one should pass the more global node where the constraint is valid as "validnode".
3305  * Note that the same constraint cannot be added twice to the branching tree with different "validnode" parameters.
3306  * If the constraint is valid at the same node as it is inserted (the usual case), one should pass NULL as "validnode".
3307  * If the "validnode" is the root node, it is automatically upgraded into a global constraint, but still only added to
3308  * the given node. If a local constraint is added to the root node, it is added to the global problem instead.
3309  *
3310  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
3311  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
3312  *
3313  * @pre this method can be called in one of the following stages of the SCIP solving process:
3314  * - \ref SCIP_STAGE_INITPRESOLVE
3315  * - \ref SCIP_STAGE_PRESOLVING
3316  * - \ref SCIP_STAGE_EXITPRESOLVE
3317  * - \ref SCIP_STAGE_SOLVING
3318  */
3320  SCIP* scip, /**< SCIP data structure */
3321  SCIP_NODE* node, /**< node to add constraint to */
3322  SCIP_CONS* cons, /**< constraint to add */
3323  SCIP_NODE* validnode /**< node at which the constraint is valid, or NULL */
3324  )
3325 {
3326  assert(cons != NULL);
3327  assert(node != NULL);
3328 
3329  SCIP_CALL( SCIPcheckStage(scip, "SCIPaddConsNode", FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) );
3330 
3331  if( validnode != NULL )
3332  {
3333  int validdepth;
3334 
3335  validdepth = SCIPnodeGetDepth(validnode);
3336  if( validdepth > SCIPnodeGetDepth(node) )
3337  {
3338  SCIPerrorMessage("cannot add constraint <%s> valid in depth %d to a node of depth %d\n",
3339  SCIPconsGetName(cons), validdepth, SCIPnodeGetDepth(node));
3340  return SCIP_INVALIDDATA;
3341  }
3342  if( cons->validdepth != -1 && cons->validdepth != validdepth )
3343  {
3344  SCIPerrorMessage("constraint <%s> is already marked to be valid in depth %d - cannot mark it to be valid in depth %d\n",
3345  SCIPconsGetName(cons), cons->validdepth, validdepth);
3346  return SCIP_INVALIDDATA;
3347  }
3348  if( validdepth <= SCIPtreeGetEffectiveRootDepth(scip->tree) )
3349  SCIPconsSetLocal(cons, FALSE);
3350  else
3351  cons->validdepth = validdepth;
3352  }
3353 
3355  {
3356  SCIPconsSetLocal(cons, FALSE);
3357  SCIP_CALL( SCIPprobAddCons(scip->transprob, scip->set, scip->stat, cons) );
3358  }
3359  else
3360  {
3361  SCIP_CALL( SCIPnodeAddCons(node, scip->mem->probmem, scip->set, scip->stat, scip->tree, cons) );
3362  }
3363 
3364  return SCIP_OKAY;
3365 }
3366 
3367 /** adds constraint locally to the current node (and all of its subnodes), even if it is a global constraint;
3368  * It is sometimes desirable to add the constraint to a more local node (i.e., a node of larger depth) even if
3369  * the constraint is also valid higher in the tree, for example, if one wants to produce a constraint which is
3370  * only active in a small part of the tree although it is valid in a larger part.
3371  *
3372  * If the constraint is valid at the same node as it is inserted (the usual case), one should pass NULL as "validnode".
3373  * If the "validnode" is the root node, it is automatically upgraded into a global constraint, but still only added to
3374  * the given node. If a local constraint is added to the root node, it is added to the global problem instead.
3375  *
3376  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
3377  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
3378  *
3379  * @pre this method can be called in one of the following stages of the SCIP solving process:
3380  * - \ref SCIP_STAGE_INITPRESOLVE
3381  * - \ref SCIP_STAGE_PRESOLVING
3382  * - \ref SCIP_STAGE_EXITPRESOLVE
3383  * - \ref SCIP_STAGE_SOLVING
3384  *
3385  * @note The same constraint cannot be added twice to the branching tree with different "validnode" parameters. This is
3386  * the case due to internal data structures and performance issues. In such a case you should try to realize your
3387  * issue using the method SCIPdisableCons() and SCIPenableCons() and control these via the event system of SCIP.
3388  */
3390  SCIP* scip, /**< SCIP data structure */
3391  SCIP_CONS* cons, /**< constraint to add */
3392  SCIP_NODE* validnode /**< node at which the constraint is valid, or NULL */
3393  )
3394 {
3395  assert(cons != NULL);
3396 
3397  SCIP_CALL( SCIPcheckStage(scip, "SCIPaddConsLocal", FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) );
3398 
3399  SCIP_CALL( SCIPaddConsNode(scip, SCIPtreeGetCurrentNode(scip->tree), cons, validnode) );
3400 
3401  return SCIP_OKAY;
3402 }
3403 
3404 /** disables constraint's separation, enforcing, and propagation capabilities at the given node (and all subnodes);
3405  * if the method is called at the root node, the constraint is globally deleted from the problem;
3406  * the constraint deletion is being remembered at the given node, s.t. after leaving the node's subtree, the constraint
3407  * is automatically enabled again, and after entering the node's subtree, it is automatically disabled;
3408  * this may improve performance because redundant checks on this constraint are avoided, but it consumes memory;
3409  * alternatively, use SCIPdisableCons()
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  *
3414  * @pre this method can be called in one of the following stages of the SCIP solving process:
3415  * - \ref SCIP_STAGE_INITPRESOLVE
3416  * - \ref SCIP_STAGE_PRESOLVING
3417  * - \ref SCIP_STAGE_EXITPRESOLVE
3418  * - \ref SCIP_STAGE_SOLVING
3419  */
3421  SCIP* scip, /**< SCIP data structure */
3422  SCIP_NODE* node, /**< node to disable constraint in */
3423  SCIP_CONS* cons /**< constraint to locally delete */
3424  )
3425 {
3426  assert(cons != NULL);
3427 
3428  SCIP_CALL( SCIPcheckStage(scip, "SCIPdelConsNode", FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) );
3429 
3430  /* only added constraints can be removed in (de-)initialization process of presolving, otherwise the reduction
3431  * might be wrong
3432  */
3433  if( scip->set->stage == SCIP_STAGE_INITPRESOLVE || scip->set->stage == SCIP_STAGE_EXITPRESOLVE )
3434  assert(SCIPconsIsAdded(cons));
3435 
3437  {
3438  SCIP_CALL( SCIPconsDelete(cons, scip->mem->probmem, scip->set, scip->stat, scip->transprob, scip->reopt) );
3439  }
3440  else
3441  {
3442  SCIP_CALL( SCIPnodeDelCons(node, scip->mem->probmem, scip->set, scip->stat, scip->tree, cons) );
3443  }
3444 
3445  return SCIP_OKAY;
3446 }
3447 
3448 /** disables constraint's separation, enforcing, and propagation capabilities at the current node (and all subnodes);
3449  * if the method is called during problem modification or at the root node, the constraint is globally deleted from
3450  * the problem;
3451  * the constraint deletion is being remembered at the current node, s.t. after leaving the current subtree, the
3452  * constraint is automatically enabled again, and after reentering the current node's subtree, it is automatically
3453  * disabled again;
3454  * this may improve performance because redundant checks on this constraint are avoided, but it consumes memory;
3455  * alternatively, use SCIPdisableCons()
3456  *
3457  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
3458  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
3459  *
3460  * @pre this method can be called in one of the following stages of the SCIP solving process:
3461  * - \ref SCIP_STAGE_PROBLEM
3462  * - \ref SCIP_STAGE_INITPRESOLVE
3463  * - \ref SCIP_STAGE_PRESOLVING
3464  * - \ref SCIP_STAGE_EXITPRESOLVE
3465  * - \ref SCIP_STAGE_SOLVING
3466  *
3467  * @note SCIP stage does not get changed
3468  *
3469  */
3471  SCIP* scip, /**< SCIP data structure */
3472  SCIP_CONS* cons /**< constraint to locally delete */
3473  )
3474 {
3475  SCIP_NODE* node;
3476 
3477  assert(cons != NULL);
3478 
3479  SCIP_CALL( SCIPcheckStage(scip, "SCIPdelConsLocal", FALSE, TRUE, FALSE, FALSE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) );
3480 
3481  switch( scip->set->stage )
3482  {
3483  case SCIP_STAGE_PROBLEM:
3484  assert(cons->addconssetchg == NULL);
3485  SCIP_CALL( SCIPconsDelete(cons, scip->mem->probmem, scip->set, scip->stat, scip->origprob, scip->reopt) );
3486  return SCIP_OKAY;
3487 
3488  /* only added constraints can be removed in (de-)initialization process of presolving, otherwise the reduction
3489  * might be wrong
3490  */
3493  assert(SCIPconsIsAdded(cons));
3494  /*lint -fallthrough*/
3495 
3496  case SCIP_STAGE_PRESOLVING:
3497  case SCIP_STAGE_SOLVING:
3498  node = SCIPtreeGetCurrentNode(scip->tree);
3499 
3501  {
3502  SCIP_CALL( SCIPconsDelete(cons, scip->mem->probmem, scip->set, scip->stat, scip->transprob, scip->reopt) );
3503  }
3504  else
3505  {
3506  SCIP_CALL( SCIPnodeDelCons(node, scip->mem->probmem, scip->set, scip->stat, scip->tree, cons) );
3507  }
3508  return SCIP_OKAY;
3509 
3510  default:
3511  SCIPerrorMessage("invalid SCIP stage <%d>\n", scip->set->stage);
3512  return SCIP_INVALIDCALL;
3513  } /*lint !e788*/
3514 }
3515 
3516 /** gets estimate of best primal solution w.r.t. original problem contained in current subtree
3517  *
3518  * @return estimate of best primal solution w.r.t. original problem contained in current subtree
3519  *
3520  * @pre this method can be called in one of the following stages of the SCIP solving process:
3521  * - \ref SCIP_STAGE_SOLVING
3522  */
3524  SCIP* scip /**< SCIP data structure */
3525  )
3526 {
3527  SCIP_NODE* node;
3528 
3529  SCIP_CALL_ABORT( SCIPcheckStage(scip, "SCIPgetLocalOrigEstimate", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) );
3530 
3531  node = SCIPtreeGetCurrentNode(scip->tree);
3532  return node != NULL ? SCIPprobExternObjval(scip->transprob, scip->origprob, scip->set, SCIPnodeGetEstimate(node)) : SCIP_INVALID;
3533 }
3534 
3535 /** gets estimate of best primal solution w.r.t. transformed problem contained in current subtree
3536  *
3537  * @return estimate of best primal solution w.r.t. transformed problem contained in current subtree
3538  *
3539  * @pre this method can be called in one of the following stages of the SCIP solving process:
3540  * - \ref SCIP_STAGE_SOLVING
3541  */
3543  SCIP* scip /**< SCIP data structure */
3544  )
3545 {
3546  SCIP_NODE* node;
3547 
3548  SCIP_CALL_ABORT( SCIPcheckStage(scip, "SCIPgetLocalTransEstimate", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) );
3549 
3550  node = SCIPtreeGetCurrentNode(scip->tree);
3551 
3552  return node != NULL ? SCIPnodeGetEstimate(node) : SCIP_INVALID;
3553 }
3554 
3555 /** gets dual bound of current node
3556  *
3557  * @return dual bound of current node
3558  *
3559  * @pre this method can be called in one of the following stages of the SCIP solving process:
3560  * - \ref SCIP_STAGE_SOLVING
3561  */
3563  SCIP* scip /**< SCIP data structure */
3564  )
3565 {
3566  SCIP_NODE* node;
3567 
3568  SCIP_CALL_ABORT( SCIPcheckStage(scip, "SCIPgetLocalDualbound", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) );
3569 
3570  node = SCIPtreeGetCurrentNode(scip->tree);
3571  return node != NULL ? SCIPprobExternObjval(scip->transprob, scip->origprob, scip->set, SCIPnodeGetLowerbound(node)) : SCIP_INVALID;
3572 }
3573 
3574 /** gets lower bound of current node in transformed problem
3575  *
3576  * @return lower bound of current node in transformed problem
3577  *
3578  * @pre this method can be called in one of the following stages of the SCIP solving process:
3579  * - \ref SCIP_STAGE_SOLVING
3580  */
3582  SCIP* scip /**< SCIP data structure */
3583  )
3584 {
3585  SCIP_NODE* node;
3586 
3587  SCIP_CALL_ABORT( SCIPcheckStage(scip, "SCIPgetLocalLowerbound", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) );
3588 
3589  node = SCIPtreeGetCurrentNode(scip->tree);
3590 
3591  return node != NULL ? SCIPnodeGetLowerbound(node) : SCIP_INVALID;
3592 }
3593 
3594 /** gets dual bound of given node
3595  *
3596  * @return dual bound of a given node
3597  *
3598  * @pre this method can be called in one of the following stages of the SCIP solving process:
3599  * - \ref SCIP_STAGE_SOLVING
3600  */
3602  SCIP* scip, /**< SCIP data structure */
3603  SCIP_NODE* node /**< node to get dual bound for */
3604  )
3605 {
3606  SCIP_CALL_ABORT( SCIPcheckStage(scip, "SCIPgetNodeDualbound", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) );
3607 
3608  return SCIPprobExternObjval(scip->transprob, scip->origprob, scip->set, SCIPnodeGetLowerbound(node));
3609 }
3610 
3611 /** gets lower bound of given node in transformed problem
3612  *
3613  * @return lower bound of given node in transformed problem
3614  *
3615  * @pre this method can be called in one of the following stages of the SCIP solving process:
3616  * - \ref SCIP_STAGE_SOLVING
3617  */
3619  SCIP* scip, /**< SCIP data structure */
3620  SCIP_NODE* node /**< node to get dual bound for */
3621  )
3622 {
3623  SCIP_CALL_ABORT( SCIPcheckStage(scip, "SCIPgetNodeLowerbound", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) );
3624 
3625  return SCIPnodeGetLowerbound(node);
3626 }
3627 
3628 /** if given value is tighter (larger for minimization, smaller for maximization) than the current node's dual bound (in
3629  * original problem space), sets the current node's dual bound to the new value
3630  *
3631  * @note the given new bound has to be a dual bound, i.e., it has to be valid for the original problem.
3632  *
3633  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
3634  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
3635  *
3636  * @pre this method can be called in one of the following stages of the SCIP solving process:
3637  * - \ref SCIP_STAGE_PROBLEM
3638  * - \ref SCIP_STAGE_PRESOLVING
3639  * - \ref SCIP_STAGE_PRESOLVED
3640  * - \ref SCIP_STAGE_SOLVING
3641  */
3643  SCIP* scip, /**< SCIP data structure */
3644  SCIP_Real newbound /**< new dual bound for the node (if it's tighter than the old one) */
3645  )
3646 {
3647  SCIP_CALL( SCIPcheckStage(scip, "SCIPupdateLocalDualbound", FALSE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, TRUE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) );
3648 
3649  switch( scip->set->stage )
3650  {
3651  case SCIP_STAGE_PROBLEM:
3652  /* since no root node, for which we could update the dual bound, has been create yet, update the dual bound stored in
3653  * the problem data
3654  */
3655  SCIPprobUpdateDualbound(scip->origprob, newbound);
3656  break;
3657 
3658  case SCIP_STAGE_PRESOLVING:
3659  case SCIP_STAGE_PRESOLVED:
3660  /* since no root node, for which we could update the dual bound, has been create yet, update the dual bound stored in
3661  * the problem data
3662  */
3663  SCIPprobUpdateDualbound(scip->transprob, SCIPprobExternObjval(scip->transprob, scip->origprob, scip->set, newbound));
3664  break;
3665 
3666  case SCIP_STAGE_SOLVING:
3668  break;
3669 
3670  default:
3671  SCIPerrorMessage("invalid SCIP stage <%d>\n", scip->set->stage);
3672  SCIPABORT();
3673  return SCIP_INVALIDCALL; /*lint !e527*/
3674  } /*lint !e788*/
3675 
3676  return SCIP_OKAY;
3677 }
3678 
3679 /** if given value is larger than the current node's lower bound (in transformed problem), sets the current node's
3680  * lower bound to the new value
3681  *
3682  * @note the given new bound has to be a lower bound, i.e., it has to be valid for the transformed problem.
3683  *
3684  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
3685  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
3686  *
3687  * @pre this method can be called in one of the following stages of the SCIP solving process:
3688  * - \ref SCIP_STAGE_PRESOLVING
3689  * - \ref SCIP_STAGE_PRESOLVED
3690  * - \ref SCIP_STAGE_SOLVING
3691  */
3693  SCIP* scip, /**< SCIP data structure */
3694  SCIP_Real newbound /**< new lower bound for the node (if it's larger than the old one) */
3695  )
3696 {
3697  SCIP_CALL( SCIPcheckStage(scip, "SCIPupdateLocalLowerbound", FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, TRUE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) );
3698 
3699  switch( scip->set->stage )
3700  {
3701  case SCIP_STAGE_PRESOLVING:
3702  case SCIP_STAGE_PRESOLVED:
3703  /* since no root node, for which we could update the lower bound, has been created yet, update the dual bound stored
3704  * in the problem data
3705  */
3706  SCIPprobUpdateDualbound(scip->transprob, SCIPprobExternObjval(scip->transprob, scip->origprob, scip->set, newbound));
3707  break;
3708 
3709  case SCIP_STAGE_SOLVING:
3711  break;
3712 
3713  default:
3714  SCIPerrorMessage("invalid SCIP stage <%d>\n", scip->set->stage);
3715  SCIPABORT();
3716  return SCIP_INVALIDCALL; /*lint !e527*/
3717  } /*lint !e788*/
3718 
3719  return SCIP_OKAY;
3720 }
3721 
3722 /** if given value is tighter (larger for minimization, smaller for maximization) than the node's dual bound,
3723  * sets the node's dual bound to the new value
3724  *
3725  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
3726  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
3727  *
3728  * @pre this method can be called in one of the following stages of the SCIP solving process:
3729  * - \ref SCIP_STAGE_SOLVING
3730  */
3732  SCIP* scip, /**< SCIP data structure */
3733  SCIP_NODE* node, /**< node to update dual bound for */
3734  SCIP_Real newbound /**< new dual bound for the node (if it's tighter than the old one) */
3735  )
3736 {
3737  SCIP_CALL( SCIPcheckStage(scip, "SCIPupdateNodeDualbound", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) );
3738 
3739  SCIP_CALL( SCIPupdateNodeLowerbound(scip, node, SCIPprobInternObjval(scip->transprob, scip->origprob, scip->set, newbound)) );
3740 
3741  return SCIP_OKAY;
3742 }
3743 
3744 /** if given value is larger than the node's lower bound (in transformed problem), sets the node's lower bound
3745  * to the new value
3746  *
3747  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
3748  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
3749  *
3750  * @pre this method can be called in one of the following stages of the SCIP solving process:
3751  * - \ref SCIP_STAGE_SOLVING
3752  */
3754  SCIP* scip, /**< SCIP data structure */
3755  SCIP_NODE* node, /**< node to update lower bound for */
3756  SCIP_Real newbound /**< new lower bound for the node (if it's larger than the old one) */
3757  )
3758 {
3759  SCIP_CALL( SCIPcheckStage(scip, "SCIPupdateNodeLowerbound", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) );
3760 
3761  SCIPnodeUpdateLowerbound(node, scip->stat, scip->set, scip->tree, scip->transprob, scip->origprob, newbound);
3762 
3763  /* if lowerbound exceeds the cutoffbound the node will be marked to be cutoff
3764  *
3765  * If the node is an inner node (,not a child node,) we need to cutoff the node manually if we exceed the
3766  * cutoffbound. This is only relevant if a user updates the lower bound; in the main solving process of SCIP the
3767  * lowerbound is only changed before branching and the given node is always a child node. Therefore, we only check
3768  * for a cutoff here in the user function instead of in SCIPnodeUpdateLowerbound().
3769  */
3770  if( SCIPisGE(scip, newbound, scip->primal->cutoffbound) )
3771  {
3772  SCIP_CALL( SCIPnodeCutoff(node, scip->set, scip->stat, scip->tree, scip->transprob, scip->origprob, scip->reopt,
3773  scip->lp, scip->mem->probmem) );
3774  }
3775 
3776  return SCIP_OKAY;
3777 }
3778 
3779 /** change the node selection priority of the given child
3780  *
3781  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
3782  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
3783  *
3784  * @pre this method can be called in one of the following stages of the SCIP solving process:
3785  * - \ref SCIP_STAGE_SOLVING
3786  */
3788  SCIP* scip, /**< SCIP data structure */
3789  SCIP_NODE* child, /**< child to update the node selection priority */
3790  SCIP_Real priority /**< node selection priority value */
3791  )
3792 {
3793  SCIP_CALL( SCIPcheckStage(scip, "SCIPchgChildPrio", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) );
3794 
3795  if( SCIPnodeGetType(child) != SCIP_NODETYPE_CHILD )
3796  return SCIP_INVALIDDATA;
3797 
3798  SCIPchildChgNodeselPrio(scip->tree, child, priority);
3799 
3800  return SCIP_OKAY;
3801 }
enum SCIP_Result SCIP_RESULT
Definition: type_result.h:52
SCIP_Real cutoffbound
Definition: struct_primal.h:46
SCIP_STAT * stat
Definition: struct_scip.h:69
SCIP_RETCODE SCIPconsDelete(SCIP_CONS *cons, BMS_BLKMEM *blkmem, SCIP_SET *set, SCIP_STAT *stat, SCIP_PROB *prob, SCIP_REOPT *reopt)
Definition: cons.c:6343
SCIP_EXPORT const char * SCIPreaderGetName(SCIP_READER *reader)
Definition: reader.c:547
SCIP_RETCODE SCIPreoptReleaseData(SCIP_REOPT *reopt, SCIP_SET *set, BMS_BLKMEM *blkmem)
Definition: reopt.c:5113
int SCIPconshdlrGetNCheckConss(SCIP_CONSHDLR *conshdlr)
Definition: cons.c:4613
int SCIPgetNContVars(SCIP *scip)
Definition: scip_prob.c:2167
SCIP_RETCODE SCIPwriteTransProblem(SCIP *scip, const char *filename, const char *extension, SCIP_Bool genericnames)
Definition: scip_prob.c:642
SCIP_Bool SCIPisPositive(SCIP *scip, SCIP_Real val)
SCIP_RETCODE SCIPpricerDeactivate(SCIP_PRICER *pricer, SCIP_SET *set)
Definition: pricer.c:363
#define NULL
Definition: def.h:253
SCIP_READER ** readers
Definition: struct_set.h:68
SCIP_VAR * SCIPprobFindVar(SCIP_PROB *prob, const char *name)
Definition: prob.c:2118
SCIP_Bool SCIPisIntegral(SCIP *scip, SCIP_Real val)
void SCIPbendersDeactivate(SCIP_BENDERS *benders, SCIP_SET *set)
Definition: benders.c:1890
public methods for SCIP parameter handling
int random_permutationseed
Definition: struct_set.h:384
SCIP_CONS * SCIPfindOrigCons(SCIP *scip, const char *name)
Definition: scip_prob.c:2893
public methods for branch and bound tree
internal methods for branch and bound tree
void SCIPfreeRandom(SCIP *scip, SCIP_RANDNUMGEN **randnumgen)
SCIP_Bool SCIPisGE(SCIP *scip, SCIP_Real val1, SCIP_Real val2)
void SCIPprobSetData(SCIP_PROB *prob, SCIP_PROBDATA *probdata)
Definition: prob.c:694
static SCIP_RETCODE writeProblem(SCIP *scip, const char *filename, const char *extension, SCIP_Bool transformed, SCIP_Bool genericnames)
Definition: scip_prob.c:484
SCIP_PROBDATA * SCIPprobGetData(SCIP_PROB *prob)
Definition: prob.c:2291
#define SCIPdebugFreeDebugData(set)
Definition: debug.h:242
public methods for memory management
#define SCIPallocClearBufferArray(scip, ptr, num)
Definition: scip_mem.h:113
SCIP_Real SCIPgetLocalOrigEstimate(SCIP *scip)
Definition: scip_prob.c:3523
SCIP_Real SCIPgetObjlimit(SCIP *scip)
Definition: scip_prob.c:1491
#define SCIP_DECL_PROBINITSOL(x)
Definition: type_prob.h:97
SCIP_EXPORT SCIP_Bool SCIPsolIsOriginal(SCIP_SOL *sol)
Definition: sol.c:2470
#define SCIP_DECL_PROBDELORIG(x)
Definition: type_prob.h:55
SCIP_PRIMAL * origprimal
Definition: struct_scip.h:71
SCIP_RETCODE SCIPsetObjsense(SCIP *scip, SCIP_OBJSENSE objsense)
Definition: scip_prob.c:1241
int validdepth
Definition: struct_cons.h:60
SCIP_RETCODE SCIPconflictstoreCleanNewIncumbent(SCIP_CONFLICTSTORE *conflictstore, SCIP_SET *set, SCIP_STAT *stat, BMS_BLKMEM *blkmem, SCIP_PROB *transprob, SCIP_REOPT *reopt, SCIP_Real cutoffbound)
void SCIPlpRecalculateObjSqrNorm(SCIP_SET *set, SCIP_LP *lp)
Definition: lp.c:17303
internal methods for clocks and timing issues
SCIP_Real SCIPtransformObj(SCIP *scip, SCIP_Real obj)
Definition: scip_sol.c:1542
SCIP_RETCODE SCIPnodeDelCons(SCIP_NODE *node, BMS_BLKMEM *blkmem, SCIP_SET *set, SCIP_STAT *stat, SCIP_TREE *tree, SCIP_CONS *cons)
Definition: tree.c:1608
int nconcsolvers
Definition: struct_set.h:134
SCIP_EVENTQUEUE * eventqueue
Definition: struct_scip.h:78
public solving methods
SCIP_Real SCIPgetNodeLowerbound(SCIP *scip, SCIP_NODE *node)
Definition: scip_prob.c:3618
int nintvars
Definition: struct_prob.h:63
public methods for timing
SCIP_PRIMAL * primal
Definition: struct_scip.h:83
void SCIPprobAddObjoffset(SCIP_PROB *prob, SCIP_Real addval)
Definition: prob.c:1425
SCIP_Bool SCIPconsIsAdded(SCIP_CONS *cons)
Definition: cons.c:8505
SCIP_Real SCIPgetLocalDualbound(SCIP *scip)
Definition: scip_prob.c:3562
SCIP_RETCODE SCIPgetBoolParam(SCIP *scip, const char *name, SCIP_Bool *value)
Definition: scip_param.c:240
SCIP_Bool time_reading
Definition: struct_set.h:552
SCIP_RETCODE SCIPreoptAddCons(SCIP_REOPT *reopt, SCIP_SET *set, BMS_BLKMEM *blkmem, SCIP_CONS *cons)
Definition: reopt.c:8096
SCIP_Bool SCIPallVarsInProb(SCIP *scip)
Definition: scip_prob.c:2738
void SCIPconsMarkConflict(SCIP_CONS *cons)
Definition: cons.c:6984
SCIP_Real SCIPgetReadingTime(SCIP *scip)
Definition: scip_timing.c:386
#define SCIP_DECL_PROBDELTRANS(x)
Definition: type_prob.h:86
SCIP_BRANCHCAND * branchcand
Definition: struct_scip.h:79
int SCIPgetNConss(SCIP *scip)
Definition: scip_prob.c:3037
int SCIPgetNVars(SCIP *scip)
Definition: scip_prob.c:1987
datastructures for constraints and constraint handlers
#define FALSE
Definition: def.h:73
SCIP_Real objoffset
Definition: struct_prob.h:41
SCIP_EXPORT SCIP_Real SCIPvarGetObj(SCIP_VAR *var)
Definition: var.c:17200
SCIP_Real SCIPgetObjNorm(SCIP *scip)
Definition: scip_prob.c:1640
internal methods for Benders&#39; decomposition
int SCIPgetNConshdlrs(SCIP *scip)
Definition: scip_cons.c:900
SCIP_EXPORT int SCIPnodeGetDepth(SCIP_NODE *node)
Definition: tree.c:7357
SCIP_STAGE stage
Definition: struct_set.h:63
SCIP_EXPORT SCIP_VARTYPE SCIPvarGetType(SCIP_VAR *var)
Definition: var.c:16903
#define TRUE
Definition: def.h:72
void SCIPprobSetExitsol(SCIP_PROB *prob, SCIP_DECL_PROBEXITSOL((*probexitsol)))
Definition: prob.c:377
SCIP_CONS ** SCIPgetConss(SCIP *scip)
Definition: scip_prob.c:3083
enum SCIP_Retcode SCIP_RETCODE
Definition: type_retcode.h:53
SCIP_RETCODE SCIPdelConsLocal(SCIP *scip, SCIP_CONS *cons)
Definition: scip_prob.c:3470
SCIP_Real SCIPprobInternObjval(SCIP_PROB *transprob, SCIP_PROB *origprob, SCIP_SET *set, SCIP_Real objval)
Definition: prob.c:2096
int SCIPtreeGetCurrentDepth(SCIP_TREE *tree)
Definition: tree.c:8307
SCIP_PROBDATA * SCIPgetProbData(SCIP *scip)
Definition: scip_prob.c:963
SCIP_Real SCIPgetLocalLowerbound(SCIP *scip)
Definition: scip_prob.c:3581
SCIP_RETCODE SCIPreoptFree(SCIP_REOPT **reopt, SCIP_SET *set, SCIP_PRIMAL *origprimal, BMS_BLKMEM *blkmem)
Definition: reopt.c:5139
int SCIPgetNImplVars(SCIP *scip)
Definition: scip_prob.c:2122
public methods for problem variables
SCIP_VAR ** fixedvars
Definition: struct_prob.h:56
SCIP_Real SCIPgetOrigObjoffset(SCIP *scip)
Definition: scip_prob.c:1318
SCIP_RETCODE SCIPupdateLocalLowerbound(SCIP *scip, SCIP_Real newbound)
Definition: scip_prob.c:3692
SCIP_RETCODE SCIPupdateNodeDualbound(SCIP *scip, SCIP_NODE *node, SCIP_Real newbound)
Definition: scip_prob.c:3731
SCIP_EXPORT SCIP_VARSTATUS SCIPvarGetStatus(SCIP_VAR *var)
Definition: var.c:16857
int nimplvars
Definition: struct_prob.h:64
SCIP_RETCODE SCIPaddVarObj(SCIP *scip, SCIP_VAR *var, SCIP_Real addobj)
Definition: scip_var.c:4500
#define SCIPduplicateBufferArray(scip, ptr, source, num)
Definition: scip_mem.h:119
#define SCIP_DECL_PROBCOPY(x)
Definition: type_prob.h:140
SCIP_Real SCIPgetNodeDualbound(SCIP *scip, SCIP_NODE *node)
Definition: scip_prob.c:3601
SCIP_PROB * transprob
Definition: struct_scip.h:87
SCIP_EXPORT SCIP_Real SCIPnodeGetLowerbound(SCIP_NODE *node)
Definition: tree.c:7367
#define SCIPfreeBufferArray(scip, ptr)
Definition: scip_mem.h:123
public methods for SCIP variables
int nactivebenders
Definition: struct_set.h:137
#define SCIPdebugMsg
Definition: scip_message.h:69
SCIP_Real SCIPgetCutoffbound(SCIP *scip)
internal methods for LP management
SCIP_PROB * origprob
Definition: struct_scip.h:70
SCIP_Bool SCIPisTransformed(SCIP *scip)
Definition: scip_general.c:558
SCIP_RETCODE SCIPaddPricedVar(SCIP *scip, SCIP_VAR *var, SCIP_Real score)
Definition: scip_prob.c:1732
SCIP_Bool objsqrnormunreliable
Definition: struct_lp.h:340
int SCIPgetNIntVars(SCIP *scip)
Definition: scip_prob.c:2077
public methods for numerical tolerances
internal methods for collecting primal CIP solutions and primal informations
SCIP_Bool reopt_enable
Definition: struct_set.h:468
SCIP_RETCODE SCIPconflictstoreCreate(SCIP_CONFLICTSTORE **conflictstore, SCIP_SET *set)
SCIP_RETCODE SCIPcreateRandom(SCIP *scip, SCIP_RANDNUMGEN **randnumgen, unsigned int initialseed, SCIP_Bool useglobalseed)
SCIP_CONSSETCHG * addconssetchg
Definition: struct_cons.h:48
SCIP_RETCODE SCIPenableReoptimization(SCIP *scip, SCIP_Bool enable)
Definition: scip_solve.c:3026
void SCIPprobSetObjIntegral(SCIP_PROB *prob)
Definition: prob.c:1460
SCIP_RETCODE SCIPfreeProb(SCIP *scip)
Definition: scip_prob.c:688
SCIP_RETCODE SCIPdelCons(SCIP *scip, SCIP_CONS *cons)
Definition: scip_prob.c:2838
SCIP_RETCODE SCIPsetObjlimit(SCIP *scip, SCIP_Real objlimit)
Definition: scip_prob.c:1421
public methods for querying solving statistics
void SCIPclockSetTime(SCIP_CLOCK *clck, SCIP_Real sec)
Definition: clock.c:518
SCIP_PRICESTORE * pricestore
Definition: struct_scip.h:90
SCIP_RETCODE SCIPprobFree(SCIP_PROB **prob, SCIP_MESSAGEHDLR *messagehdlr, BMS_BLKMEM *blkmem, SCIP_SET *set, SCIP_STAT *stat, SCIP_EVENTQUEUE *eventqueue, SCIP_LP *lp)
Definition: prob.c:399
SCIP_RETCODE SCIPprimalUpdateObjlimit(SCIP_PRIMAL *primal, BMS_BLKMEM *blkmem, SCIP_SET *set, SCIP_STAT *stat, SCIP_EVENTQUEUE *eventqueue, SCIP_PROB *transprob, SCIP_PROB *origprob, SCIP_TREE *tree, SCIP_REOPT *reopt, SCIP_LP *lp)
Definition: primal.c:406
SCIP_RETCODE SCIPaddOrigObjoffset(SCIP *scip, SCIP_Real addval)
Definition: scip_prob.c:1289
SCIP_Real SCIPprobGetObjlim(SCIP_PROB *prob, SCIP_SET *set)
Definition: prob.c:2279
SCIP_Real SCIPgetOrigObjscale(SCIP *scip)
Definition: scip_prob.c:1343
SCIP_RETCODE SCIPnodeCutoff(SCIP_NODE *node, SCIP_SET *set, SCIP_STAT *stat, SCIP_TREE *tree, SCIP_PROB *transprob, SCIP_PROB *origprob, SCIP_REOPT *reopt, SCIP_LP *lp, BMS_BLKMEM *blkmem)
Definition: tree.c:1146
void SCIPprobSetInitsol(SCIP_PROB *prob, SCIP_DECL_PROBINITSOL((*probinitsol)))
Definition: prob.c:366
void SCIPprobSetCopy(SCIP_PROB *prob, SCIP_DECL_PROBCOPY((*probcopy)))
Definition: prob.c:388
SCIP_MEM * mem
Definition: struct_scip.h:61
public methods for managing constraints
SCIP_RETCODE SCIPprobPerformVarDeletions(SCIP_PROB *prob, BMS_BLKMEM *blkmem, SCIP_SET *set, SCIP_STAT *stat, SCIP_EVENTQUEUE *eventqueue, SCIP_CLIQUETABLE *cliquetable, SCIP_LP *lp, SCIP_BRANCHCAND *branchcand)
Definition: prob.c:1059
void SCIPnodeUpdateLowerbound(SCIP_NODE *node, SCIP_STAT *stat, SCIP_SET *set, SCIP_TREE *tree, SCIP_PROB *transprob, SCIP_PROB *origprob, SCIP_Real newbound)
Definition: tree.c:2299
void SCIPprobSetObjsense(SCIP_PROB *prob, SCIP_OBJSENSE objsense)
Definition: prob.c:1412
SCIP_RETCODE SCIPsetProbData(SCIP *scip, SCIP_PROBDATA *probdata)
Definition: scip_prob.c:1013
SCIP_Bool SCIPisObjIntegral(SCIP *scip)
Definition: scip_prob.c:1561
SCIP_EXPORT const char * SCIPvarGetName(SCIP_VAR *var)
Definition: var.c:16738
SCIP_VAR ** SCIPgetFixedVars(SCIP *scip)
Definition: scip_prob.c:2261
#define BMSfreeMemoryArray(ptr)
Definition: memory.h:137
internal methods for storing and manipulating the main problem
#define SCIPerrorMessage
Definition: pub_message.h:45
void SCIPmessagePrintVerbInfo(SCIP_MESSAGEHDLR *messagehdlr, SCIP_VERBLEVEL verblevel, SCIP_VERBLEVEL msgverblevel, const char *formatstr,...)
Definition: message.c:668
SCIP_Bool SCIPsyncstoreIsInitialized(SCIP_SYNCSTORE *syncstore)
Definition: syncstore.c:775
SCIP_EVENTFILTER * eventfilter
Definition: struct_scip.h:77
SCIP_CONS * SCIPprobFindCons(SCIP_PROB *prob, const char *name)
Definition: prob.c:2137
SCIP_RETCODE SCIPstatFree(SCIP_STAT **stat, BMS_BLKMEM *blkmem)
Definition: stat.c:111
SCIP_SYNCSTORE * syncstore
Definition: struct_scip.h:98
int SCIPgetNObjVars(SCIP *scip)
Definition: scip_prob.c:2215
SCIP_RETCODE SCIPconflictstoreFree(SCIP_CONFLICTSTORE **conflictstore, BMS_BLKMEM *blkmem, SCIP_SET *set, SCIP_STAT *stat, SCIP_REOPT *reopt)
SCIP_VAR ** SCIPgetVars(SCIP *scip)
Definition: scip_prob.c:1942
SCIP_Bool random_permutevars
Definition: struct_set.h:388
SCIP_RETCODE SCIPaddConflict(SCIP *scip, SCIP_NODE *node, SCIP_CONS *cons, SCIP_NODE *validnode, SCIP_CONFTYPE conftype, SCIP_Bool iscutoffinvolved)
Definition: scip_prob.c:3223
SCIP_RETCODE SCIPreadProb(SCIP *scip, const char *filename, const char *extension)
Definition: scip_prob.c:325
SCIP_RETCODE SCIPcheckStage(SCIP *scip, const char *method, SCIP_Bool init, SCIP_Bool problem, SCIP_Bool transforming, SCIP_Bool transformed, SCIP_Bool initpresolve, SCIP_Bool presolving, SCIP_Bool exitpresolve, SCIP_Bool presolved, SCIP_Bool initsolve, SCIP_Bool solving, SCIP_Bool solved, SCIP_Bool exitsolve, SCIP_Bool freetrans, SCIP_Bool freescip)
Definition: debug.c:2010
BMS_BLKMEM * SCIPblkmem(SCIP *scip)
Definition: scip_mem.c:47
SCIP_Bool objisintegral
Definition: struct_prob.h:78
SCIP_CONSHDLR ** conshdlrs
Definition: struct_set.h:70
SCIP_CONFLICTSTORE * conflictstore
Definition: struct_scip.h:93
SCIP_OBJSENSE objsense
Definition: struct_prob.h:77
SCIP_RETCODE SCIPreaderResetReadingTime(SCIP_READER *reader)
Definition: reader.c:618
SCIP_Bool SCIPisZero(SCIP *scip, SCIP_Real val)
SCIP_RETCODE SCIPupdateNodeLowerbound(SCIP *scip, SCIP_NODE *node, SCIP_Real newbound)
Definition: scip_prob.c:3753
SCIP_REOPT * reopt
Definition: struct_scip.h:74
void SCIPmessagePrintWarning(SCIP_MESSAGEHDLR *messagehdlr, const char *formatstr,...)
Definition: message.c:417
int SCIPprobGetNObjVars(SCIP_PROB *prob, SCIP_SET *set)
Definition: prob.c:1977
int SCIPgetNFixedVars(SCIP *scip)
Definition: scip_prob.c:2304
SCIP_OBJSENSE SCIPgetObjsense(SCIP *scip)
Definition: scip_prob.c:1224
SCIP_Real SCIPlpGetObjNorm(SCIP_LP *lp)
Definition: lp.c:17334
SCIP_RETCODE SCIPprobSetName(SCIP_PROB *prob, const char *name)
Definition: prob.c:1939
SCIP_RETCODE SCIPprintOrigProblem(SCIP *scip, FILE *file, const char *extension, SCIP_Bool genericnames)
SCIP_Bool SCIPprobIsObjIntegral(SCIP_PROB *prob)
Definition: prob.c:2255
internal methods for variable pricers
int SCIPgetNOrigConss(SCIP *scip)
Definition: scip_prob.c:3129
public methods for primal CIP solutions
internal methods for global SCIP settings
internal methods for storing conflicts
#define SCIP_CALL(x)
Definition: def.h:365
void SCIPsplitFilename(char *filename, char **path, char **name, char **extension, char **compression)
Definition: misc.c:10482
SCIP main data structure.
SCIP_EVENTTYPE SCIPeventGetType(SCIP_EVENT *event)
Definition: event.c:995
SCIP_VAR * h
Definition: circlepacking.c:59
SCIP_RETCODE SCIPreaderRead(SCIP_READER *reader, SCIP_SET *set, const char *filename, const char *extension, SCIP_RESULT *result)
Definition: reader.c:173
SCIP_RETCODE SCIPprobCreate(SCIP_PROB **prob, BMS_BLKMEM *blkmem, SCIP_SET *set, const char *name, SCIP_DECL_PROBDELORIG((*probdelorig)), SCIP_DECL_PROBTRANS((*probtrans)), SCIP_DECL_PROBDELTRANS((*probdeltrans)), SCIP_DECL_PROBINITSOL((*probinitsol)), SCIP_DECL_PROBEXITSOL((*probexitsol)), SCIP_DECL_PROBCOPY((*probcopy)), SCIP_PROBDATA *probdata, SCIP_Bool transformed)
Definition: prob.c:254
internal methods for storing priced variables
SCIP_Real SCIPgetTransObjoffset(SCIP *scip)
Definition: scip_prob.c:1366
int SCIPgetNOrigVars(SCIP *scip)
Definition: scip_prob.c:2427
#define BMSduplicateMemoryArray(ptr, source, num)
Definition: memory.h:133
public methods for constraint handler plugins and constraints
SCIP_RETCODE SCIPsetProbDelorig(SCIP *scip, SCIP_DECL_PROBDELORIG((*probdelorig)))
Definition: scip_prob.c:186
#define SCIP_DECL_PROBTRANS(x)
Definition: type_prob.h:74
SCIP_CLIQUETABLE * cliquetable
Definition: struct_scip.h:86
SCIP_RETCODE SCIPaddConsNode(SCIP *scip, SCIP_NODE *node, SCIP_CONS *cons, SCIP_NODE *validnode)
Definition: scip_prob.c:3319
data structures and methods for collecting reoptimization information
the function declarations for the synchronization store
SCIP_RETCODE SCIPwriteOrigProblem(SCIP *scip, const char *filename, const char *extension, SCIP_Bool genericnames)
Definition: scip_prob.c:595
SCIP_Real SCIPinfinity(SCIP *scip)
public data structures and miscellaneous methods
SCIP_EXPORT SCIP_VAR * SCIPvarGetNegationVar(SCIP_VAR *var)
Definition: var.c:17178
SCIP_RETCODE SCIPchgChildPrio(SCIP *scip, SCIP_NODE *child, SCIP_Real priority)
Definition: scip_prob.c:3787
SCIP_RETCODE SCIPchgReoptObjective(SCIP *scip, SCIP_OBJSENSE objsense, SCIP_VAR **vars, SCIP_Real *coefs, int nvars)
Definition: scip_prob.c:1118
int SCIPtreeGetEffectiveRootDepth(SCIP_TREE *tree)
Definition: tree.c:8346
#define SCIP_Bool
Definition: def.h:70
#define SCIP_DECL_PROBEXITSOL(x)
Definition: type_prob.h:110
SCIP_Bool SCIPprobIsPermuted(SCIP_PROB *prob)
Definition: prob.c:2225
const char * SCIPgetProbName(SCIP *scip)
Definition: scip_prob.c:1066
SCIP_CONS * SCIPfindCons(SCIP *scip, const char *name)
Definition: scip_prob.c:2942
int ncontvars
Definition: struct_prob.h:65
int nbinvars
Definition: struct_prob.h:62
enum SCIP_Objsense SCIP_OBJSENSE
Definition: type_prob.h:41
int SCIPgetNCheckConss(SCIP *scip)
Definition: scip_prob.c:3179
SCIP_RETCODE SCIPaddObjoffset(SCIP *scip, SCIP_Real addval)
Definition: scip_prob.c:1267
SCIP_CONSHDLR * conshdlr
Definition: struct_cons.h:44
SCIP_RETCODE SCIPpermuteProb(SCIP *scip, unsigned int randseed, SCIP_Bool permuteconss, SCIP_Bool permutebinvars, SCIP_Bool permuteintvars, SCIP_Bool permuteimplvars, SCIP_Bool permutecontvars)
Definition: scip_prob.c:780
int SCIPgetNOrigIntVars(SCIP *scip)
Definition: scip_prob.c:2481
SCIP_RETCODE SCIPstatCreate(SCIP_STAT **stat, BMS_BLKMEM *blkmem, SCIP_SET *set, SCIP_PROB *transprob, SCIP_PROB *origprob, SCIP_MESSAGEHDLR *messagehdlr)
Definition: stat.c:45
SCIP_Real SCIPgetTransObjscale(SCIP *scip)
Definition: scip_prob.c:1389
internal methods for input file readers
SCIP_RETCODE SCIPsetProbInitsol(SCIP *scip, SCIP_DECL_PROBINITSOL((*probinitsol)))
Definition: scip_prob.c:249
void SCIPprobSetTrans(SCIP_PROB *prob, SCIP_DECL_PROBTRANS((*probtrans)))
Definition: prob.c:344
int nreaders
Definition: struct_set.h:97
SCIP_VAR ** SCIPgetOrigVars(SCIP *scip)
Definition: scip_prob.c:2400
SCIP_EXPORT SCIP_Bool SCIPvarIsOriginal(SCIP_VAR *var)
Definition: var.c:16867
SCIP_RETCODE SCIPfreeConcurrent(SCIP *scip)
Definition: concurrent.c:142
methods for debugging
datastructures for block memory pools and memory buffers
SCIP_BENDERS ** benders
Definition: struct_set.h:92
static const unsigned int randseed
Definition: circle.c:46
SCIP_RETCODE SCIPpricestoreAddVar(SCIP_PRICESTORE *pricestore, BMS_BLKMEM *blkmem, SCIP_SET *set, SCIP_EVENTQUEUE *eventqueue, SCIP_LP *lp, SCIP_VAR *var, SCIP_Real score, SCIP_Bool root)
Definition: pricestore.c:171
SCIP_RETCODE SCIPdelConsNode(SCIP *scip, SCIP_NODE *node, SCIP_CONS *cons)
Definition: scip_prob.c:3420
int SCIPconshdlrGetNActiveConss(SCIP_CONSHDLR *conshdlr)
Definition: cons.c:4627
SCIP_EXPORT SCIP_Real SCIPnodeGetEstimate(SCIP_NODE *node)
Definition: tree.c:7377
SCIP_RETCODE SCIPcreateProb(SCIP *scip, const char *name, SCIP_DECL_PROBDELORIG((*probdelorig)), SCIP_DECL_PROBTRANS((*probtrans)), SCIP_DECL_PROBDELTRANS((*probdeltrans)), SCIP_DECL_PROBINITSOL((*probinitsol)), SCIP_DECL_PROBEXITSOL((*probexitsol)), SCIP_DECL_PROBCOPY((*probcopy)), SCIP_PROBDATA *probdata)
Definition: scip_prob.c:105
datastructures for problem statistics
SCIP_RETCODE SCIPaddVar(SCIP *scip, SCIP_VAR *var)
Definition: scip_prob.c:1667
void SCIPprobSetObjlim(SCIP_PROB *prob, SCIP_Real objlim)
Definition: prob.c:1449
SCIP_RETCODE SCIPprintTransProblem(SCIP *scip, FILE *file, const char *extension, SCIP_Bool genericnames)
int nfixedvars
Definition: struct_prob.h:68
SCIP_RETCODE SCIPsetProbTrans(SCIP *scip, SCIP_DECL_PROBTRANS((*probtrans)))
Definition: scip_prob.c:207
SCIP_VAR * SCIPfindVar(SCIP *scip, const char *name)
Definition: scip_prob.c:2680
helper functions for concurrent scip solvers
int SCIPgetNOrigImplVars(SCIP *scip)
Definition: scip_prob.c:2508
SCIP_RETCODE SCIPsetProbExitsol(SCIP *scip, SCIP_DECL_PROBEXITSOL((*probexitsol)))
Definition: scip_prob.c:271
SCIP_RETCODE SCIPsetProbCopy(SCIP *scip, SCIP_DECL_PROBCOPY((*probcopy)))
Definition: scip_prob.c:292
SCIP_RETCODE SCIPsyncstoreExit(SCIP_SYNCSTORE *syncstore)
Definition: syncstore.c:191
SCIP_Bool SCIPconsIsGlobal(SCIP_CONS *cons)
Definition: cons.c:8305
datastructures for storing and manipulating the main problem
SCIP_RETCODE SCIPsetProbName(SCIP *scip, const char *name)
Definition: scip_prob.c:1094
public methods for managing events
#define SCIP_EVENTTYPE_BESTSOLFOUND
Definition: type_event.h:88
general public methods
int SCIPgetNOrigContVars(SCIP *scip)
Definition: scip_prob.c:2535
BMS_BLKMEM * probmem
Definition: struct_mem.h:40
struct SCIP_ProbData SCIP_PROBDATA
Definition: type_prob.h:44
int SCIPgetNUpgrConss(SCIP *scip)
Definition: scip_prob.c:2995
public methods for solutions
SCIP_RETCODE SCIPchgVarObj(SCIP *scip, SCIP_VAR *var, SCIP_Real newobj)
Definition: scip_var.c:4451
public methods for random numbers
SCIP_VERBLEVEL disp_verblevel
Definition: struct_set.h:261
int nactivepricers
Definition: struct_set.h:100
SCIP_NODE * SCIPtreeGetCurrentNode(SCIP_TREE *tree)
Definition: tree.c:8290
SCIP_CLOCK * solvingtime
Definition: struct_stat.h:144
int nconss
Definition: struct_prob.h:73
SCIP_SET * set
Definition: struct_scip.h:62
SCIP_Bool misc_transsolsorig
Definition: struct_set.h:370
SCIP_CONS ** SCIPgetOrigConss(SCIP *scip)
Definition: scip_prob.c:3156
SCIP_CONS ** SCIPconshdlrGetConss(SCIP_CONSHDLR *conshdlr)
Definition: cons.c:4563
public methods for message output
SCIP_RETCODE SCIPgetVarsData(SCIP *scip, SCIP_VAR ***vars, int *nvars, int *nbinvars, int *nintvars, int *nimplvars, int *ncontvars)
Definition: scip_prob.c:1861
data structures for LP management
void SCIPprobUpdateDualbound(SCIP_PROB *prob, SCIP_Real newbound)
Definition: prob.c:1552
void SCIPprobSetDelorig(SCIP_PROB *prob, SCIP_DECL_PROBDELORIG((*probdelorig)))
Definition: prob.c:333
datastructures for problem variables
SCIP_RETCODE SCIPupdateLocalDualbound(SCIP *scip, SCIP_Real newbound)
Definition: scip_prob.c:3642
const char * SCIPconsGetName(SCIP_CONS *cons)
Definition: cons.c:8076
SCIP_RETCODE SCIPsetObjIntegral(SCIP *scip)
Definition: scip_prob.c:1518
SCIP_RETCODE SCIPdelVar(SCIP *scip, SCIP_VAR *var, SCIP_Bool *deleted)
Definition: scip_prob.c:1785
SCIP_MESSAGEHDLR * messagehdlr
Definition: struct_scip.h:65
#define SCIP_Real
Definition: def.h:164
internal methods for problem statistics
SCIP_VAR ** vars
Definition: struct_prob.h:55
SCIP_PRICER ** pricers
Definition: struct_set.h:69
enum SCIP_ConflictType SCIP_CONFTYPE
Definition: type_conflict.h:56
public methods for input file readers
SCIP_RETCODE SCIPconflictstoreAddConflict(SCIP_CONFLICTSTORE *conflictstore, BMS_BLKMEM *blkmem, SCIP_SET *set, SCIP_STAT *stat, SCIP_TREE *tree, SCIP_PROB *transprob, SCIP_REOPT *reopt, SCIP_CONS *cons, SCIP_CONFTYPE conftype, SCIP_Bool cutoffinvolved, SCIP_Real primalbound)
datastructures for collecting primal CIP solutions and primal informations
SCIP_Bool random_permuteconss
Definition: struct_set.h:387
SCIP_RETCODE SCIPsetFreeConcsolvers(SCIP_SET *set)
Definition: set.c:4396
SCIP_CONS ** conss
Definition: struct_prob.h:59
#define SCIP_INVALID
Definition: def.h:184
internal methods for constraints and constraint handlers
SCIP_RETCODE SCIPprimalUpdateObjoffset(SCIP_PRIMAL *primal, BMS_BLKMEM *blkmem, SCIP_SET *set, SCIP_STAT *stat, SCIP_EVENTQUEUE *eventqueue, SCIP_PROB *transprob, SCIP_PROB *origprob, SCIP_TREE *tree, SCIP_REOPT *reopt, SCIP_LP *lp)
Definition: primal.c:445
void SCIPprintSysError(const char *message)
Definition: misc.c:10172
SCIP_RETCODE SCIPnodeAddCons(SCIP_NODE *node, BMS_BLKMEM *blkmem, SCIP_SET *set, SCIP_STAT *stat, SCIP_TREE *tree, SCIP_CONS *cons)
Definition: tree.c:1565
const char * SCIPconshdlrGetName(SCIP_CONSHDLR *conshdlr)
Definition: cons.c:4191
SCIP_RETCODE SCIPclearConflictStore(SCIP *scip, SCIP_EVENT *event)
Definition: scip_prob.c:3282
int SCIPgetNBinVars(SCIP *scip)
Definition: scip_prob.c:2032
SCIP_TREE * tree
Definition: struct_scip.h:84
SCIP_RETCODE SCIPgetSolVarsData(SCIP *scip, SCIP_SOL *sol, SCIP_VAR ***vars, int *nvars, int *nbinvars, int *nintvars, int *nimplvars, int *ncontvars)
Definition: scip_prob.c:2615
void SCIPprobSetDeltrans(SCIP_PROB *prob, SCIP_DECL_PROBDELTRANS((*probdeltrans)))
Definition: prob.c:355
SCIP_EXPORT int SCIPvarGetProbindex(SCIP_VAR *var)
Definition: var.c:17045
SCIP_RETCODE SCIPaddCons(SCIP *scip, SCIP_CONS *cons)
Definition: scip_prob.c:2765
SCIP_Real SCIPprobExternObjval(SCIP_PROB *transprob, SCIP_PROB *origprob, SCIP_SET *set, SCIP_Real objval)
Definition: prob.c:2074
SCIP_EXPORT SCIP_NODETYPE SCIPnodeGetType(SCIP_NODE *node)
Definition: tree.c:7337
SCIP_RETCODE SCIPprobAddCons(SCIP_PROB *prob, SCIP_SET *set, SCIP_STAT *stat, SCIP_CONS *cons)
Definition: prob.c:1271
void SCIPprimalAddOrigObjoffset(SCIP_PRIMAL *primal, SCIP_SET *set, SCIP_Real addval)
Definition: primal.c:511
SCIP_RETCODE SCIPprimalCreate(SCIP_PRIMAL **primal)
Definition: primal.c:119
int nconshdlrs
Definition: struct_set.h:102
void SCIPconsSetLocal(SCIP_CONS *cons, SCIP_Bool local)
Definition: cons.c:6640
SCIP_RETCODE SCIPaddConsLocal(SCIP *scip, SCIP_CONS *cons, SCIP_NODE *validnode)
Definition: scip_prob.c:3389
SCIP_RETCODE SCIPprobDelVar(SCIP_PROB *prob, BMS_BLKMEM *blkmem, SCIP_SET *set, SCIP_EVENTQUEUE *eventqueue, SCIP_VAR *var, SCIP_Bool *deleted)
Definition: prob.c:998
int SCIPgetNOrigBinVars(SCIP *scip)
Definition: scip_prob.c:2454
SCIP_Real SCIPgetLocalTransEstimate(SCIP *scip)
Definition: scip_prob.c:3542
#define SCIP_CALL_ABORT(x)
Definition: def.h:344
SCIP_RETCODE SCIPreleaseCons(SCIP *scip, SCIP_CONS **cons)
Definition: scip_cons.c:1109
SCIP_RETCODE SCIPprimalFree(SCIP_PRIMAL **primal, BMS_BLKMEM *blkmem)
Definition: primal.c:149
SCIP_CONSHDLR ** SCIPgetConshdlrs(SCIP *scip)
Definition: scip_cons.c:889
SCIP_LP * lp
Definition: struct_scip.h:80
#define SCIPABORT()
Definition: def.h:337
public methods for global and local (sub)problems
SCIP_RETCODE SCIPsetProbDeltrans(SCIP *scip, SCIP_DECL_PROBDELTRANS((*probdeltrans)))
Definition: scip_prob.c:228
void SCIPchildChgNodeselPrio(SCIP_TREE *tree, SCIP_NODE *child, SCIP_Real priority)
Definition: tree.c:2377
int npresolupgdconss
Definition: struct_stat.h:236
const char * SCIPprobGetName(SCIP_PROB *prob)
Definition: prob.c:2301
datastructures for global SCIP settings
void SCIPprobMarkPermuted(SCIP_PROB *prob)
Definition: prob.c:2235
SCIP_RETCODE SCIPgetOrigVarsData(SCIP *scip, SCIP_VAR ***vars, int *nvars, int *nbinvars, int *nintvars, int *nimplvars, int *ncontvars)
Definition: scip_prob.c:2352
void SCIPrandomPermuteArray(SCIP_RANDNUMGEN *randnumgen, void **array, int begin, int end)
Definition: misc.c:9689
SCIP_SOL * SCIPeventGetSol(SCIP_EVENT *event)
Definition: event.c:1259
SCIP_RETCODE SCIPcreateProbBasic(SCIP *scip, const char *name)
Definition: scip_prob.c:166
SCIP_RETCODE SCIPprobAddVar(SCIP_PROB *prob, BMS_BLKMEM *blkmem, SCIP_SET *set, SCIP_LP *lp, SCIP_BRANCHCAND *branchcand, SCIP_EVENTFILTER *eventfilter, SCIP_EVENTQUEUE *eventqueue, SCIP_VAR *var)
Definition: prob.c:919
SCIP_Real objscale
Definition: struct_prob.h:42
int SCIPgetNTotalVars(SCIP *scip)
Definition: scip_prob.c:2564
SCIP_RETCODE SCIPfreeTransform(SCIP *scip)
Definition: scip_solve.c:3327
memory allocation routines