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