Scippy

SCIP

Solving Constraint Integer Programs

scip_solve.c
Go to the documentation of this file.
1 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
2 /* */
3 /* This file is part of the program and library */
4 /* SCIP --- Solving Constraint Integer Programs */
5 /* */
6 /* Copyright (C) 2002-2022 Konrad-Zuse-Zentrum */
7 /* fuer Informationstechnik Berlin */
8 /* */
9 /* SCIP is distributed under the terms of the ZIB Academic License. */
10 /* */
11 /* You should have received a copy of the ZIB Academic License */
12 /* along with SCIP; see the file COPYING. If not visit scipopt.org. */
13 /* */
14 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
15 
16 /**@file scip_solve.c
17  * @ingroup OTHER_CFILES
18  * @brief public solving methods
19  * @author Tobias Achterberg
20  * @author Timo Berthold
21  * @author Gerald Gamrath
22  * @author Leona Gottwald
23  * @author Stefan Heinz
24  * @author Gregor Hendel
25  * @author Thorsten Koch
26  * @author Alexander Martin
27  * @author Marc Pfetsch
28  * @author Michael Winkler
29  * @author Kati Wolter
30  *
31  * @todo check all SCIP_STAGE_* switches, and include the new stages TRANSFORMED and INITSOLVE
32  */
33 
34 /*---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0----+----1----+----2*/
35 
36 #include "blockmemshell/memory.h"
37 #include "scip/branch.h"
38 #include "scip/clock.h"
39 #include "scip/compr.h"
40 #include "scip/concsolver.h"
41 #include "scip/concurrent.h"
42 #include "scip/conflict.h"
43 #include "scip/conflictstore.h"
44 #include "scip/cons.h"
45 #include "scip/cutpool.h"
46 #include "scip/dcmp.h"
47 #include "scip/debug.h"
48 #include "scip/event.h"
49 #include "scip/implics.h"
50 #include "scip/interrupt.h"
51 #include "scip/lp.h"
52 #include "scip/nlp.h"
53 #include "scip/presol.h"
54 #include "scip/pricestore.h"
55 #include "scip/primal.h"
56 #include "scip/prob.h"
57 #include "scip/prop.h"
58 #include "scip/pub_branch.h"
59 #include "scip/pub_compr.h"
60 #include "scip/pub_cons.h"
61 #include "scip/pub_heur.h"
62 #include "scip/pub_message.h"
63 #include "scip/pub_misc.h"
64 #include "scip/pub_misc_select.h"
65 #include "scip/pub_presol.h"
66 #include "scip/pub_prop.h"
67 #include "scip/pub_sol.h"
68 #include "scip/pub_var.h"
69 #include "scip/relax.h"
70 #include "scip/reopt.h"
71 #include "scip/scip_benders.h"
72 #include "scip/scip_branch.h"
73 #include "scip/scip_concurrent.h"
74 #include "scip/scip_cons.h"
75 #include "scip/scip_general.h"
76 #include "scip/scip_lp.h"
77 #include "scip/scip_mem.h"
78 #include "scip/scip_message.h"
79 #include "scip/scip_numerics.h"
80 #include "scip/scip_param.h"
81 #include "scip/scip_prob.h"
82 #include "scip/scip_randnumgen.h"
83 #include "scip/scip_sol.h"
84 #include "scip/scip_solve.h"
85 #include "scip/scip_solvingstats.h"
86 #include "scip/scip_timing.h"
87 #include "scip/scip_tree.h"
88 #include "scip/scip_var.h"
89 #include "scip/sepastore.h"
90 #include "scip/set.h"
91 #include "scip/sol.h"
92 #include "scip/solve.h"
93 #include "scip/stat.h"
94 #include "scip/struct_event.h"
95 #include "scip/struct_mem.h"
96 #include "scip/struct_primal.h"
97 #include "scip/struct_prob.h"
98 #include "scip/struct_scip.h"
99 #include "scip/struct_set.h"
100 #include "scip/struct_stat.h"
101 #include "scip/struct_tree.h"
102 #include "scip/syncstore.h"
103 #include "scip/tree.h"
104 #include "scip/var.h"
105 #include "scip/visual.h"
106 
107 /** checks solution for feasibility in original problem without adding it to the solution store; to improve the
108  * performance we use the following order when checking for violations:
109  *
110  * 1. variable bounds
111  * 2. constraint handlers with positive or zero priority that don't need constraints (e.g. integral constraint handler)
112  * 3. original constraints
113  * 4. constraint handlers with negative priority that don't need constraints (e.g. Benders' decomposition constraint handler)
114  */
115 static
117  SCIP* scip, /**< SCIP data structure */
118  SCIP_SOL* sol, /**< primal CIP solution */
119  SCIP_Bool* feasible, /**< stores whether given solution is feasible */
120  SCIP_Bool printreason, /**< Should the reason for the violation be printed? */
121  SCIP_Bool completely, /**< Should all violations be checked? */
122  SCIP_Bool checkbounds, /**< Should the bounds of the variables be checked? */
123  SCIP_Bool checkintegrality, /**< Has integrality to be checked? */
124  SCIP_Bool checklprows, /**< Do constraints represented by rows in the current LP have to be checked? */
125  SCIP_Bool checkmodifiable /**< have modifiable constraint to be checked? */
126  )
127 {
128  SCIP_RESULT result;
129  int v;
130  int c;
131  int h;
132 
133  assert(scip != NULL);
134  assert(sol != NULL);
135  assert(feasible != NULL);
136 
137  SCIP_CALL( SCIPcheckStage(scip, "checkSolOrig", FALSE, TRUE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE) );
138 
139  *feasible = TRUE;
140 
142 
143  if( !printreason )
144  completely = FALSE;
145 
146  /* check bounds */
147  if( checkbounds )
148  {
149  for( v = 0; v < scip->origprob->nvars; ++v )
150  {
151  SCIP_VAR* var;
152  SCIP_Real solval;
153  SCIP_Real lb;
154  SCIP_Real ub;
155 
156  var = scip->origprob->vars[v];
157  solval = SCIPsolGetVal(sol, scip->set, scip->stat, var);
158 
159  lb = SCIPvarGetLbOriginal(var);
160  ub = SCIPvarGetUbOriginal(var);
161 
162  SCIPupdateSolBoundViolation(scip, sol, lb - solval, SCIPrelDiff(lb, solval));
163  SCIPupdateSolBoundViolation(scip, sol, solval - ub, SCIPrelDiff(solval, ub));
164 
165  if( SCIPsetIsFeasLT(scip->set, solval, lb) || SCIPsetIsFeasGT(scip->set, solval, ub) )
166  {
167  *feasible = FALSE;
168 
169  if( printreason )
170  {
171  SCIPmessagePrintInfo(scip->messagehdlr, "solution violates original bounds of variable <%s> [%g,%g] solution value <%g>\n",
172  SCIPvarGetName(var), lb, ub, solval);
173  }
174 
175  if( !completely )
176  return SCIP_OKAY;
177  }
178  }
179  }
180 
181  /* call constraint handlers with positive or zero check priority that don't need constraints */
182  for( h = 0; h < scip->set->nconshdlrs; ++h )
183  {
184  if( SCIPconshdlrGetCheckPriority(scip->set->conshdlrs[h]) >= 0 )
185  {
186  if( !SCIPconshdlrNeedsCons(scip->set->conshdlrs[h]) )
187  {
188  SCIP_CALL( SCIPconshdlrCheck(scip->set->conshdlrs[h], scip->mem->probmem, scip->set, scip->stat, sol,
189  checkintegrality, checklprows, printreason, completely, &result) );
190 
191  if( result != SCIP_FEASIBLE )
192  {
193  *feasible = FALSE;
194 
195  if( !completely )
196  return SCIP_OKAY;
197  }
198  }
199  }
200  /* constraint handlers are sorted by priority, so we can break when reaching the first one with negative priority */
201  else
202  break;
203  }
204 
205  /* check original constraints
206  *
207  * in general modifiable constraints can not be checked, because the variables to fulfill them might be missing in
208  * the original problem; however, if the solution comes from a heuristic during presolving modifiable constraints
209  * have to be checked;
210  */
211  for( c = 0; c < scip->origprob->nconss; ++c )
212  {
213  if( SCIPconsIsChecked(scip->origprob->conss[c]) && (checkmodifiable || !SCIPconsIsModifiable(scip->origprob->conss[c])) )
214  {
215  /* check solution */
216  SCIP_CALL( SCIPconsCheck(scip->origprob->conss[c], scip->set, sol,
217  checkintegrality, checklprows, printreason, &result) );
218 
219  if( result != SCIP_FEASIBLE )
220  {
221  *feasible = FALSE;
222 
223  if( !completely )
224  return SCIP_OKAY;
225  }
226  }
227  }
228 
229  /* call constraint handlers with negative check priority that don't need constraints;
230  * continue with the first constraint handler with negative priority which caused us to break in the above loop */
231  for( ; h < scip->set->nconshdlrs; ++h )
232  {
233  assert(SCIPconshdlrGetCheckPriority(scip->set->conshdlrs[h]) < 0);
234  if( !SCIPconshdlrNeedsCons(scip->set->conshdlrs[h]) )
235  {
236  SCIP_CALL( SCIPconshdlrCheck(scip->set->conshdlrs[h], scip->mem->probmem, scip->set, scip->stat, sol,
237  checkintegrality, checklprows, printreason, completely, &result) );
238 
239  if( result != SCIP_FEASIBLE )
240  {
241  *feasible = FALSE;
242 
243  if( !completely )
244  return SCIP_OKAY;
245  }
246  }
247  }
248 
249  return SCIP_OKAY;
250 }
251 
252 /** calculates number of nonzeros in problem */
253 static
255  SCIP* scip, /**< SCIP data structure */
256  SCIP_Longint* nchecknonzeros, /**< pointer to store number of non-zeros in all check constraints */
257  SCIP_Longint* nactivenonzeros, /**< pointer to store number of non-zeros in all active constraints */
258  SCIP_Bool* approxchecknonzeros,/**< pointer to store if the number of non-zeros in all check constraints
259  * is only a lowerbound
260  */
261  SCIP_Bool* approxactivenonzeros/**< pointer to store if the number of non-zeros in all active constraints
262  * is only a lowerbound
263  */
264  )
265 {
266  SCIP_CONS** conss;
267  SCIP_Bool success;
268  SCIP_Bool ischeck;
269  int nconss;
270  int nvars;
271  int c;
272  int h;
273 
274  *nchecknonzeros = 0LL;
275  *nactivenonzeros = 0LL;
276  *approxchecknonzeros = FALSE;
277  *approxactivenonzeros = FALSE;
278 
279  /* computes number of non-zeros over all active constraints */
280  for( h = scip->set->nconshdlrs - 1; h >= 0; --h )
281  {
282  nconss = SCIPconshdlrGetNActiveConss(scip->set->conshdlrs[h]);
283 
284  if( nconss > 0 )
285  {
286  conss = SCIPconshdlrGetConss(scip->set->conshdlrs[h]);
287 
288  /* calculate all active constraints */
289  for( c = nconss - 1; c >= 0; --c )
290  {
291  SCIP_CALL( SCIPconsGetNVars(conss[c], scip->set, &nvars, &success) );
292  ischeck = SCIPconsIsChecked(conss[c]);
293 
294  if( !success )
295  {
296  *approxactivenonzeros = TRUE;
297  if( ischeck )
298  *approxchecknonzeros = TRUE;
299  }
300  else
301  {
302  *nactivenonzeros += nvars;
303  if( ischeck )
304  *nchecknonzeros += nvars;
305  }
306  }
307  }
308 
309  /* add nonzeros on inactive check constraints */
310  nconss = SCIPconshdlrGetNCheckConss(scip->set->conshdlrs[h]);
311  if( nconss > 0 )
312  {
313  conss = SCIPconshdlrGetCheckConss(scip->set->conshdlrs[h]);
314 
315  for( c = nconss - 1; c >= 0; --c )
316  {
317  if( !SCIPconsIsActive(conss[c]) )
318  {
319  SCIP_CALL( SCIPconsGetNVars(conss[c], scip->set, &nvars, &success) );
320 
321  if( !success )
322  *approxchecknonzeros = TRUE;
323  else
324  *nchecknonzeros += nvars;
325  }
326  }
327  }
328  }
329 
330  return SCIP_OKAY;
331 }
332 
333 
334 /** initializes solving data structures and transforms problem
335  *
336  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
337  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
338  *
339  * @pre This method can be called if @p scip is in one of the following stages:
340  * - \ref SCIP_STAGE_PROBLEM
341  * - \ref SCIP_STAGE_TRANSFORMED
342  * - \ref SCIP_STAGE_INITPRESOLVE
343  * - \ref SCIP_STAGE_PRESOLVING
344  * - \ref SCIP_STAGE_EXITPRESOLVE
345  * - \ref SCIP_STAGE_PRESOLVED
346  * - \ref SCIP_STAGE_INITSOLVE
347  * - \ref SCIP_STAGE_SOLVING
348  * - \ref SCIP_STAGE_SOLVED
349  * - \ref SCIP_STAGE_EXITSOLVE
350  * - \ref SCIP_STAGE_FREETRANS
351  * - \ref SCIP_STAGE_FREE
352  *
353  * @post When calling this method in the \ref SCIP_STAGE_PROBLEM stage, the \SCIP stage is changed to \ref
354  * SCIP_STAGE_TRANSFORMED; otherwise, the stage is not changed
355  *
356  * See \ref SCIP_Stage "SCIP_STAGE" for a complete list of all possible solving stages.
357  */
359  SCIP* scip /**< SCIP data structure */
360  )
361 {
362  SCIP_Longint oldnsolsfound;
363  int nfeassols;
364  int ncandsols;
365  int h;
366  int s;
367 
368  SCIP_CALL( SCIPcheckStage(scip, "SCIPtransformProb", FALSE, TRUE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE) );
369 
370  /* check, if the problem was already transformed */
371  if( scip->set->stage >= SCIP_STAGE_TRANSFORMED )
372  return SCIP_OKAY;
373 
374  assert(scip->stat->status == SCIP_STATUS_UNKNOWN);
375 
376  /* check, if a node selector exists */
377  if( SCIPsetGetNodesel(scip->set, scip->stat) == NULL )
378  {
379  SCIPerrorMessage("no node selector available\n");
380  return SCIP_PLUGINNOTFOUND;
381  }
382 
383  /* call garbage collector on original problem and parameter settings memory spaces */
386 
387  /* remember number of constraints */
389 
390  /* switch stage to TRANSFORMING */
392 
393  /* mark statistics before solving */
394  SCIPstatMark(scip->stat);
395 
396  /* init solve data structures */
400  SCIP_CALL( SCIPlpCreate(&scip->lp, scip->set, scip->messagehdlr, scip->stat, SCIPprobGetName(scip->origprob)) );
401  SCIP_CALL( SCIPprimalCreate(&scip->primal) );
402  SCIP_CALL( SCIPtreeCreate(&scip->tree, scip->mem->probmem, scip->set, SCIPsetGetNodesel(scip->set, scip->stat)) );
403  SCIP_CALL( SCIPrelaxationCreate(&scip->relaxation, scip->mem->probmem, scip->set, scip->stat, scip->primal, scip->tree) );
404  SCIP_CALL( SCIPconflictCreate(&scip->conflict, scip->mem->probmem, scip->set) );
405  SCIP_CALL( SCIPcliquetableCreate(&scip->cliquetable, scip->set, scip->mem->probmem) );
406 
407  /* copy problem in solve memory */
408  SCIP_CALL( SCIPprobTransform(scip->origprob, scip->mem->probmem, scip->set, scip->stat, scip->primal, scip->tree,
409  scip->reopt, scip->lp, scip->branchcand, scip->eventfilter, scip->eventqueue, scip->conflictstore,
410  &scip->transprob) );
411 
412  /* switch stage to TRANSFORMED */
414 
415  /* check, whether objective value is always integral by inspecting the problem, if it is the case adjust the
416  * cutoff bound if primal solution is already known
417  */
418  SCIP_CALL( SCIPprobCheckObjIntegral(scip->transprob, scip->origprob, scip->mem->probmem, scip->set, scip->stat, scip->primal,
419  scip->tree, scip->reopt, scip->lp, scip->eventfilter, scip->eventqueue) );
420 
421  /* if possible, scale objective function such that it becomes integral with gcd 1 */
422  SCIP_CALL( SCIPprobScaleObj(scip->transprob, scip->origprob, scip->mem->probmem, scip->set, scip->stat, scip->primal,
423  scip->tree, scip->reopt, scip->lp, scip->eventfilter, scip->eventqueue) );
424 
425  /* check solution of solution candidate storage */
426  nfeassols = 0;
427  ncandsols = scip->origprimal->nsols;
428  oldnsolsfound = 0;
429 
430  /* update upper bound and cutoff bound due to objective limit in primal data */
431  SCIP_CALL( SCIPprimalUpdateObjlimit(scip->primal, scip->mem->probmem, scip->set, scip->stat, scip->eventfilter,
432  scip->eventqueue, scip->transprob, scip->origprob, scip->tree, scip->reopt, scip->lp) );
433 
434  if( !scip->set->reopt_enable && scip->set->nactivebenders == 0 )
435  {
436  oldnsolsfound = scip->primal->nsolsfound;
437  for( s = scip->origprimal->nsols - 1; s >= 0; --s )
438  {
439  SCIP_Bool feasible;
440  SCIP_SOL* sol;
441 
442  sol = scip->origprimal->sols[s];
443 
444  /* recompute objective function, since the objective might have changed in the meantime */
445  SCIPsolRecomputeObj(sol, scip->set, scip->stat, scip->origprob);
446 
447  /* SCIPprimalTrySol() can only be called on transformed solutions; therefore check solutions in original problem
448  * including modifiable constraints
449  */
450  SCIP_CALL( checkSolOrig(scip, sol, &feasible,
452  FALSE, TRUE, TRUE, TRUE, TRUE) );
453 
454  if( feasible )
455  {
456  SCIP_Real abssolobj;
457 
458  abssolobj = REALABS(SCIPsolGetObj(sol, scip->set, scip->transprob, scip->origprob));
459 
460  /* we do not want to add solutions with objective value +infinity */
461  if( !SCIPisInfinity(scip, abssolobj) )
462  {
463  SCIP_SOL* bestsol = SCIPgetBestSol(scip);
464  SCIP_Bool stored;
465 
466  /* add primal solution to solution storage by copying it */
467  SCIP_CALL( SCIPprimalAddSol(scip->primal, scip->mem->probmem, scip->set, scip->messagehdlr, scip->stat, scip->origprob, scip->transprob,
468  scip->tree, scip->reopt, scip->lp, scip->eventqueue, scip->eventfilter, sol, &stored) );
469 
470  if( stored )
471  {
472  nfeassols++;
473 
474  if( bestsol != SCIPgetBestSol(scip) )
475  SCIPstoreSolutionGap(scip);
476  }
477  }
478  }
479 
480  SCIP_CALL( SCIPsolFree(&sol, scip->mem->probmem, scip->origprimal) );
481  scip->origprimal->nsols--;
482  }
483  }
484 
485  assert(scip->origprimal->nsols == 0);
486 
487  scip->stat->nexternalsolsfound += scip->primal->nsolsfound - oldnsolsfound;
488 
489  if( nfeassols > 0 )
490  {
492  "%d/%d feasible solution%s given by solution candidate storage, new primal bound %.6e\n\n",
493  nfeassols, ncandsols, (nfeassols > 1 ? "s" : ""), SCIPgetSolOrigObj(scip, SCIPgetBestSol(scip)));
494  }
495  else if( ncandsols > 0 && !scip->set->reopt_enable )
496  {
498  "all %d solutions given by solution candidate storage are infeasible\n\n", ncandsols);
499  }
500 
501  /* print transformed problem statistics */
503  "transformed problem has %d variables (%d bin, %d int, %d impl, %d cont) and %d constraints\n",
504  scip->transprob->nvars, scip->transprob->nbinvars, scip->transprob->nintvars, scip->transprob->nimplvars,
505  scip->transprob->ncontvars, scip->transprob->nconss);
506 
507  for( h = 0; h < scip->set->nconshdlrs; ++h )
508  {
509  int nactiveconss;
510 
511  nactiveconss = SCIPconshdlrGetNActiveConss(scip->set->conshdlrs[h]);
512  if( nactiveconss > 0 )
513  {
515  "%7d constraints of type <%s>\n", nactiveconss, SCIPconshdlrGetName(scip->set->conshdlrs[h]));
516  }
517  }
519 
520  {
521  SCIP_Real maxnonzeros;
522  SCIP_Longint nchecknonzeros;
523  SCIP_Longint nactivenonzeros;
524  SCIP_Bool approxchecknonzeros;
525  SCIP_Bool approxactivenonzeros;
526 
527  /* determine number of non-zeros */
528  maxnonzeros = (SCIP_Real)SCIPgetNConss(scip) * SCIPgetNVars(scip);
529  maxnonzeros = MAX(maxnonzeros, 1.0);
530  SCIP_CALL( calcNonZeros(scip, &nchecknonzeros, &nactivenonzeros, &approxchecknonzeros, &approxactivenonzeros) );
531  scip->stat->nnz = nactivenonzeros;
532  scip->stat->avgnnz = (SCIPgetNConss(scip) == 0 ? 0.0 : (SCIP_Real) nactivenonzeros / ((SCIP_Real) SCIPgetNConss(scip)));
533 
535  "original problem has %s%" SCIP_LONGINT_FORMAT " active (%g%%) nonzeros and %s%" SCIP_LONGINT_FORMAT " (%g%%) check nonzeros\n",
536  approxactivenonzeros ? "more than " : "", nactivenonzeros, nactivenonzeros/maxnonzeros * 100,
537  approxchecknonzeros ? "more than " : "", nchecknonzeros, nchecknonzeros/maxnonzeros * 100);
539  }
540 
541  /* call initialization methods of plugins */
542  SCIP_CALL( SCIPsetInitPlugins(scip->set, scip->mem->probmem, scip->stat) );
543 
544  /* in case the permutation seed is different to 0, permute the transformed problem */
545  if( scip->set->random_permutationseed > 0 )
546  {
547  SCIP_Bool permuteconss;
548  SCIP_Bool permutevars;
549  int permutationseed;
550 
551  permuteconss = scip->set->random_permuteconss;
552  permutevars = scip->set->random_permutevars;
553  permutationseed = scip->set->random_permutationseed;
554 
555  SCIP_CALL( SCIPpermuteProb(scip, (unsigned int)permutationseed, permuteconss, permutevars, permutevars, permutevars, permutevars) );
556  }
557 
558  if( scip->set->misc_estimexternmem )
559  {
560  /* the following formula was estimated empirically using linear regression */
561  scip->stat->externmemestim = (SCIP_Longint) (MAX(1, 8.5e-04 * SCIPgetNConss(scip) + 7.6e-04 * SCIPgetNVars(scip) + 3.5e-05 * scip->stat->nnz) * 1048576.0); /*lint !e666*/
562  SCIPdebugMsg(scip, "external memory usage estimated to %" SCIP_LONGINT_FORMAT " byte\n", scip->stat->externmemestim);
563  }
564 
565  return SCIP_OKAY;
566 }
567 
568 /** initializes presolving */
569 static
571  SCIP* scip /**< SCIP data structure */
572  )
573 {
574 #ifndef NDEBUG
575  size_t nusedbuffers;
576  size_t nusedcleanbuffers;
577 #endif
578 
579  assert(scip != NULL);
580  assert(scip->mem != NULL);
581  assert(scip->set != NULL);
582  assert(scip->stat != NULL);
583  assert(scip->transprob != NULL);
584  assert(scip->set->stage == SCIP_STAGE_TRANSFORMED);
585 
586  /* retransform all existing solutions to original problem space, because the transformed problem space may
587  * get modified in presolving and the solutions may become invalid for the transformed problem
588  */
589  SCIP_CALL( SCIPprimalRetransformSolutions(scip->primal, scip->mem->probmem, scip->set, scip->stat, scip->eventfilter,
590  scip->eventqueue, scip->origprob, scip->transprob, scip->tree, scip->reopt, scip->lp) );
591 
592  /* reset statistics for presolving and current branch and bound run */
593  SCIPstatResetPresolving(scip->stat, scip->set, scip->transprob, scip->origprob);
594 
595  /* increase number of branch and bound runs */
596  scip->stat->nruns++;
597 
598  /* remember problem size of previous run */
599  scip->stat->prevrunnvars = scip->transprob->nvars;
600 
601  /* switch stage to INITPRESOLVE */
603 
604  /* create temporary presolving root node */
605  SCIP_CALL( SCIPtreeCreatePresolvingRoot(scip->tree, scip->reopt, scip->mem->probmem, scip->set, scip->messagehdlr,
606  scip->stat, scip->transprob, scip->origprob, scip->primal, scip->lp, scip->branchcand, scip->conflict,
607  scip->conflictstore, scip->eventfilter, scip->eventqueue, scip->cliquetable) );
608 
609  /* GCG wants to perform presolving during the reading process of a file reader;
610  * hence the number of used buffers does not need to be zero, however, it should not
611  * change by calling SCIPsetInitprePlugins()
612  */
613 #ifndef NDEBUG
614  nusedbuffers = BMSgetNUsedBufferMemory(SCIPbuffer(scip));
615  nusedcleanbuffers = BMSgetNUsedBufferMemory(SCIPcleanbuffer(scip));
616 #endif
617 
618  /* inform plugins that the presolving is abound to begin */
619  SCIP_CALL( SCIPsetInitprePlugins(scip->set, scip->mem->probmem, scip->stat) );
620  assert(BMSgetNUsedBufferMemory(SCIPbuffer(scip)) == nusedbuffers);
621  assert(BMSgetNUsedBufferMemory(SCIPcleanbuffer(scip)) == nusedcleanbuffers);
622 
623  /* delete the variables from the problems that were marked to be deleted */
624  SCIP_CALL( SCIPprobPerformVarDeletions(scip->transprob, scip->mem->probmem, scip->set, scip->stat, scip->eventqueue, scip->cliquetable, scip->lp, scip->branchcand) );
625 
626  /* switch stage to PRESOLVING */
628 
629  return SCIP_OKAY;
630 }
631 
632 /** deinitializes presolving */
633 static
635  SCIP* scip, /**< SCIP data structure */
636  SCIP_Bool solved, /**< is problem already solved? */
637  SCIP_Bool* infeasible /**< pointer to store if the clique clean up detects an infeasibility */
638  )
639 {
640 #ifndef NDEBUG
641  size_t nusedbuffers;
642  size_t nusedcleanbuffers;
643 #endif
644 
645  assert(scip != NULL);
646  assert(scip->mem != NULL);
647  assert(scip->set != NULL);
648  assert(scip->stat != NULL);
649  assert(scip->transprob != NULL);
650  assert(scip->set->stage == SCIP_STAGE_PRESOLVING);
651  assert(infeasible != NULL);
652 
653  *infeasible = FALSE;
654 
655  /* switch stage to EXITPRESOLVE */
657 
658  if( !solved )
659  {
660  SCIP_VAR** vars;
661  int nvars;
662  int v;
663 
664  /* flatten all variables */
665  vars = SCIPgetFixedVars(scip);
666  nvars = SCIPgetNFixedVars(scip);
667  assert(nvars == 0 || vars != NULL);
668 
669  for( v = nvars - 1; v >= 0; --v )
670  {
671  SCIP_VAR* var;
672 #ifndef NDEBUG
673  SCIP_VAR** multvars;
674  int i;
675 #endif
676  var = vars[v]; /*lint !e613*/
677  assert(var != NULL);
678 
680  {
681  /* flattens aggregation graph of multi-aggregated variable in order to avoid exponential recursion later-on */
682  SCIP_CALL( SCIPvarFlattenAggregationGraph(var, scip->mem->probmem, scip->set, scip->eventqueue) );
683 
684 #ifndef NDEBUG
685  multvars = SCIPvarGetMultaggrVars(var);
686  for( i = SCIPvarGetMultaggrNVars(var) - 1; i >= 0; --i)
687  assert(SCIPvarGetStatus(multvars[i]) != SCIP_VARSTATUS_MULTAGGR);
688 #endif
689  }
690  }
691  }
692 
693  /* exitPresolve() might be called during the reading process of a file reader;
694  * hence the number of used buffers does not need to be zero, however, it should not
695  * change by calling SCIPsetExitprePlugins() or SCIPprobExitPresolve()
696  */
697 #ifndef NDEBUG
698  nusedbuffers = BMSgetNUsedBufferMemory(SCIPbuffer(scip));
699  nusedcleanbuffers = BMSgetNUsedBufferMemory(SCIPcleanbuffer(scip));
700 #endif
701 
702  /* inform plugins that the presolving is finished, and perform final modifications */
703  SCIP_CALL( SCIPsetExitprePlugins(scip->set, scip->mem->probmem, scip->stat) );
704  assert(BMSgetNUsedBufferMemory(SCIPbuffer(scip)) == nusedbuffers);
705  assert(BMSgetNUsedBufferMemory(SCIPcleanbuffer(scip)) == nusedcleanbuffers);
706 
707  /* remove empty and single variable cliques from the clique table, and convert all two variable cliques
708  * into implications
709  * delete the variables from the problems that were marked to be deleted
710  */
711  if( !solved )
712  {
713  int nlocalbdchgs = 0;
714 
715  SCIP_CALL( SCIPprobPerformVarDeletions(scip->transprob, scip->mem->probmem, scip->set, scip->stat, scip->eventqueue,
716  scip->cliquetable, scip->lp, scip->branchcand) );
717 
718  SCIP_CALL( SCIPcliquetableCleanup(scip->cliquetable, scip->mem->probmem, scip->set, scip->stat, scip->transprob,
719  scip->origprob, scip->tree, scip->reopt, scip->lp, scip->branchcand, scip->eventqueue, &nlocalbdchgs,
720  infeasible) );
721 
723  "clique table cleanup detected %d bound changes%s\n", nlocalbdchgs, *infeasible ? " and infeasibility" : "");
724  }
725 
726  /* exit presolving */
727  SCIP_CALL( SCIPprobExitPresolve(scip->transprob, scip->set) );
728  assert(BMSgetNUsedBufferMemory(SCIPbuffer(scip)) == nusedbuffers);
729  assert(BMSgetNUsedBufferMemory(SCIPcleanbuffer(scip)) == nusedcleanbuffers);
730 
731  if( !solved )
732  {
733  /* check, whether objective value is always integral by inspecting the problem, if it is the case adjust the
734  * cutoff bound if primal solution is already known
735  */
736  SCIP_CALL( SCIPprobCheckObjIntegral(scip->transprob, scip->origprob, scip->mem->probmem, scip->set, scip->stat, scip->primal,
737  scip->tree, scip->reopt, scip->lp, scip->eventfilter, scip->eventqueue) );
738 
739  /* if possible, scale objective function such that it becomes integral with gcd 1 */
740  SCIP_CALL( SCIPprobScaleObj(scip->transprob, scip->origprob, scip->mem->probmem, scip->set, scip->stat, scip->primal,
741  scip->tree, scip->reopt, scip->lp, scip->eventfilter, scip->eventqueue) );
742 
743  scip->stat->lastlowerbound = SCIPprobInternObjval(scip->transprob, scip->origprob, scip->set, scip->transprob->dualbound);
744 
745  /* we need to update the primal dual integral here to update the last{upper/dual}bound values after a restart */
746  if( scip->set->misc_calcintegral )
747  {
749  }
750  }
751 
752  /* free temporary presolving root node */
753  SCIP_CALL( SCIPtreeFreePresolvingRoot(scip->tree, scip->reopt, scip->mem->probmem, scip->set, scip->messagehdlr,
754  scip->stat, scip->transprob, scip->origprob, scip->primal, scip->lp, scip->branchcand, scip->conflict,
755  scip->conflictstore, scip->eventfilter, scip->eventqueue, scip->cliquetable) );
756 
757  /* switch stage to PRESOLVED */
758  scip->set->stage = SCIP_STAGE_PRESOLVED;
759 
760  return SCIP_OKAY;
761 }
762 
763 /** applies one round of presolving with the given presolving timing
764  *
765  * This method will always be called with presoltiming fast first. It iterates over all presolvers, propagators, and
766  * constraint handlers and calls their presolving callbacks with timing fast. If enough reductions are found, it
767  * returns and the next presolving round will be started (again with timing fast). If the fast presolving does not
768  * find enough reductions, this methods calls itself recursively with presoltiming medium. Again, it calls the
769  * presolving callbacks of all presolvers, propagators, and constraint handlers with timing medium. If enough
770  * reductions are found, it returns and the next presolving round will be started (with timing fast). Otherwise, it is
771  * called recursively with presoltiming exhaustive. In exhaustive presolving, presolvers, propagators, and constraint
772  * handlers are called w.r.t. their priority, but this time, we stop as soon as enough reductions were found and do not
773  * necessarily call all presolving methods. If we stop, we return and another presolving round is started with timing
774  * fast.
775  *
776  * @todo check if we want to do the following (currently disabled):
777  * In order to avoid calling the same expensive presolving methods again and again (which is possibly ineffective
778  * for the current instance), we continue the loop for exhaustive presolving where we stopped it the last time. The
779  * {presol/prop/cons}start pointers are used to this end: they provide the plugins to start the loop with in the
780  * current presolving round (if we reach exhaustive presolving), and are updated in this case to the next ones to be
781  * called in the next round. In case we reach the end of the loop in exhaustive presolving, we call the method again
782  * with exhaustive timing, now starting with the first presolving steps in the loop until we reach the ones we started
783  * the last call with. This way, we won't stop until all exhaustive presolvers were called without finding enough
784  * reductions (in sum).
785  */
786 static
788  SCIP* scip, /**< SCIP data structure */
789  SCIP_PRESOLTIMING* timing, /**< pointer to current presolving timing */
790  SCIP_Bool* unbounded, /**< pointer to store whether presolving detected unboundedness */
791  SCIP_Bool* infeasible, /**< pointer to store whether presolving detected infeasibility */
792  SCIP_Bool lastround, /**< is this the last presolving round due to a presolving round limit? */
793  int* presolstart, /**< pointer to get the presolver to start exhaustive presolving with in
794  * the current round and store the one to start with in the next round */
795  int presolend, /**< last presolver to treat in exhaustive presolving */
796  int* propstart, /**< pointer to get the propagator to start exhaustive presolving with in
797  * the current round and store the one to start with in the next round */
798  int propend, /**< last propagator to treat in exhaustive presolving */
799  int* consstart, /**< pointer to get the constraint handler to start exhaustive presolving with in
800  * the current round and store the one to start with in the next round */
801  int consend /**< last constraint handler to treat in exhaustive presolving */
802  )
803 {
804  SCIP_RESULT result;
805  SCIP_EVENT event;
806  SCIP_Bool aborted;
807  SCIP_Bool lastranpresol;
808 #if 0
809  int oldpresolstart = 0;
810  int oldpropstart = 0;
811  int oldconsstart = 0;
812 #endif
813  int priopresol;
814  int prioprop;
815  int i;
816  int j;
817  int k;
818 #ifndef NDEBUG
819  size_t nusedbuffers;
820  size_t nusedcleanbuffers;
821 #endif
822 
823  assert(scip != NULL);
824  assert(scip->set != NULL);
825  assert(unbounded != NULL);
826  assert(infeasible != NULL);
827  assert(presolstart != NULL);
828  assert(propstart != NULL);
829  assert(consstart != NULL);
830 
831  assert((presolend == scip->set->npresols && propend == scip->set->nprops && consend == scip->set->nconshdlrs)
832  || (*presolstart == 0 && *propstart == 0 && *consstart == 0));
833 
834  *unbounded = FALSE;
835  *infeasible = FALSE;
836  aborted = FALSE;
837 
838  assert( scip->set->propspresolsorted );
839 
840  /* GCG wants to perform presolving during the reading process of a file reader;
841  * hence the number of used buffers does not need to be zero, however, it should not
842  * change by calling the presolving callbacks
843  */
844 #ifndef NDEBUG
845  nusedbuffers = BMSgetNUsedBufferMemory(SCIPbuffer(scip));
846  nusedcleanbuffers = BMSgetNUsedBufferMemory(SCIPcleanbuffer(scip));
847 #endif
848 
849  if( *timing == SCIP_PRESOLTIMING_EXHAUSTIVE )
850  {
851  /* In exhaustive presolving, we continue the loop where we stopped last time to avoid calling the same
852  * (possibly ineffective) presolving step again and again. If we reach the end of the arrays of presolvers,
853  * propagators, and constraint handlers without having made enough reductions, we start again from the beginning
854  */
855  i = *presolstart;
856  j = *propstart;
857  k = *consstart;
858 #if 0
859  oldpresolstart = i;
860  oldpropstart = j;
861  oldconsstart = k;
862 #endif
863  if( i >= presolend && j >= propend && k >= consend )
864  return SCIP_OKAY;
865 
866  if( i == 0 && j == 0 && k == 0 )
867  ++(scip->stat->npresolroundsext);
868  }
869  else
870  {
871  /* in fast and medium presolving, we always iterate over all presolvers, propagators, and constraint handlers */
872  assert(presolend == scip->set->npresols);
873  assert(propend == scip->set->nprops);
874  assert(consend == scip->set->nconshdlrs);
875 
876  i = 0;
877  j = 0;
878  k = 0;
879 
880  if( *timing == SCIP_PRESOLTIMING_FAST )
881  ++(scip->stat->npresolroundsfast);
882  if( *timing == SCIP_PRESOLTIMING_MEDIUM )
883  ++(scip->stat->npresolroundsmed);
884  }
885 
886  SCIPdebugMsg(scip, "starting presolving round %d (%d/%d/%d), timing = %u\n",
888  scip->stat->npresolroundsext, *timing);
889 
890  /* call included presolvers with nonnegative priority */
891  while( !(*unbounded) && !(*infeasible) && !aborted && (i < presolend || j < propend) )
892  {
893  if( i < presolend )
894  priopresol = SCIPpresolGetPriority(scip->set->presols[i]);
895  else
896  priopresol = -1;
897 
898  if( j < propend )
899  prioprop = SCIPpropGetPresolPriority(scip->set->props_presol[j]);
900  else
901  prioprop = -1;
902 
903  /* call next propagator */
904  if( prioprop >= priopresol )
905  {
906  /* only presolving methods which have non-negative priority will be called before constraint handlers */
907  if( prioprop < 0 )
908  break;
909 
910  SCIPdebugMsg(scip, "executing presolving of propagator <%s>\n", SCIPpropGetName(scip->set->props_presol[j]));
911  SCIP_CALL( SCIPpropPresol(scip->set->props_presol[j], scip->set, *timing, scip->stat->npresolrounds,
913  &scip->stat->npresolchgbds, &scip->stat->npresoladdholes, &scip->stat->npresoldelconss,
914  &scip->stat->npresoladdconss, &scip->stat->npresolupgdconss, &scip->stat->npresolchgcoefs,
915  &scip->stat->npresolchgsides, &result) );
916  assert(BMSgetNUsedBufferMemory(SCIPbuffer(scip)) == nusedbuffers);
917  assert(BMSgetNUsedBufferMemory(SCIPcleanbuffer(scip)) == nusedcleanbuffers);
918 
919  lastranpresol = FALSE;
920  ++j;
921  }
922  /* call next presolver */
923  else
924  {
925  /* only presolving methods which have non-negative priority will be called before constraint handlers */
926  if( priopresol < 0 )
927  break;
928 
929  SCIPdebugMsg(scip, "executing presolver <%s>\n", SCIPpresolGetName(scip->set->presols[i]));
930  SCIP_CALL( SCIPpresolExec(scip->set->presols[i], scip->set, *timing, scip->stat->npresolrounds,
932  &scip->stat->npresolchgbds, &scip->stat->npresoladdholes, &scip->stat->npresoldelconss,
933  &scip->stat->npresoladdconss, &scip->stat->npresolupgdconss, &scip->stat->npresolchgcoefs,
934  &scip->stat->npresolchgsides, &result) );
935  assert(BMSgetNUsedBufferMemory(SCIPbuffer(scip)) == nusedbuffers);
936  assert(BMSgetNUsedBufferMemory(SCIPcleanbuffer(scip)) == nusedcleanbuffers);
937 
938  lastranpresol = TRUE;
939  ++i;
940  }
941 
942  if( result == SCIP_CUTOFF )
943  {
944  *infeasible = TRUE;
945 
946  if( lastranpresol )
948  "presolver <%s> detected infeasibility\n", SCIPpresolGetName(scip->set->presols[i-1]));
949  else
951  "propagator <%s> detected infeasibility\n", SCIPpropGetName(scip->set->props_presol[j-1]));
952  }
953  else if( result == SCIP_UNBOUNDED )
954  {
955  *unbounded = TRUE;
956 
957  if( lastranpresol )
959  "presolver <%s> detected unboundedness (or infeasibility)\n", SCIPpresolGetName(scip->set->presols[i-1]));
960  else
962  "propagator <%s> detected unboundedness (or infeasibility)\n", SCIPpropGetName(scip->set->props_presol[j-1]));
963  }
964 
965  /* delete the variables from the problems that were marked to be deleted */
966  SCIP_CALL( SCIPprobPerformVarDeletions(scip->transprob, scip->mem->probmem, scip->set, scip->stat, scip->eventqueue, scip->cliquetable, scip->lp,
967  scip->branchcand) );
968 
969  SCIPdebugMsg(scip, "presolving callback returned result <%d>\n", result);
970 
971  /* if we work off the exhaustive presolvers, we stop immediately if a reduction was found */
972  if( (*timing == SCIP_PRESOLTIMING_EXHAUSTIVE) && !lastround && !SCIPisPresolveFinished(scip) )
973  {
974  assert(*consstart == 0);
975 
976  if( lastranpresol )
977  {
978  *presolstart = i + 1;
979  *propstart = j;
980  }
981  else
982  {
983  *presolstart = i;
984  *propstart = j + 1;
985  }
986  aborted = TRUE;
987 
988  break;
989  }
990  }
991 
992  /* call presolve methods of constraint handlers */
993  while( k < consend && !(*unbounded) && !(*infeasible) && !aborted )
994  {
995  SCIPdebugMsg(scip, "executing presolve method of constraint handler <%s>\n",
996  SCIPconshdlrGetName(scip->set->conshdlrs[k]));
997  SCIP_CALL( SCIPconshdlrPresolve(scip->set->conshdlrs[k], scip->mem->probmem, scip->set, scip->stat,
998  *timing, scip->stat->npresolrounds,
1000  &scip->stat->npresolchgbds, &scip->stat->npresoladdholes, &scip->stat->npresoldelconss,
1001  &scip->stat->npresoladdconss, &scip->stat->npresolupgdconss, &scip->stat->npresolchgcoefs,
1002  &scip->stat->npresolchgsides, &result) );
1003  assert(BMSgetNUsedBufferMemory(SCIPbuffer(scip)) == nusedbuffers);
1004  assert(BMSgetNUsedBufferMemory(SCIPcleanbuffer(scip)) == nusedcleanbuffers);
1005 
1006  ++k;
1007 
1008  if( result == SCIP_CUTOFF )
1009  {
1010  *infeasible = TRUE;
1012  "constraint handler <%s> detected infeasibility\n", SCIPconshdlrGetName(scip->set->conshdlrs[k-1]));
1013  }
1014  else if( result == SCIP_UNBOUNDED )
1015  {
1016  *unbounded = TRUE;
1018  "constraint handler <%s> detected unboundedness (or infeasibility)\n",
1019  SCIPconshdlrGetName(scip->set->conshdlrs[k-1]));
1020  }
1021 
1022  /* delete the variables from the problems that were marked to be deleted */
1023  SCIP_CALL( SCIPprobPerformVarDeletions(scip->transprob, scip->mem->probmem, scip->set, scip->stat, scip->eventqueue, scip->cliquetable, scip->lp,
1024  scip->branchcand) );
1025 
1026  SCIPdebugMsg(scip, "presolving callback returned with result <%d>\n", result);
1027 
1028  /* if we work off the exhaustive presolvers, we stop immediately if a reduction was found */
1029  if( (*timing == SCIP_PRESOLTIMING_EXHAUSTIVE) && !lastround && !SCIPisPresolveFinished(scip) )
1030  {
1031  *presolstart = i;
1032  *propstart = j;
1033  *consstart = k + 1;
1034  aborted = TRUE;
1035 
1036  break;
1037  }
1038  }
1039 
1040  assert( scip->set->propspresolsorted );
1041 
1042  /* call included presolvers with negative priority */
1043  while( !(*unbounded) && !(*infeasible) && !aborted && (i < presolend || j < propend) )
1044  {
1045  if( i < scip->set->npresols )
1046  priopresol = SCIPpresolGetPriority(scip->set->presols[i]);
1047  else
1048  priopresol = -INT_MAX;
1049 
1050  if( j < scip->set->nprops )
1051  prioprop = SCIPpropGetPresolPriority(scip->set->props_presol[j]);
1052  else
1053  prioprop = -INT_MAX;
1054 
1055  /* choose presolving */
1056  if( prioprop >= priopresol )
1057  {
1058  assert(prioprop <= 0);
1059 
1060  SCIPdebugMsg(scip, "executing presolving of propagator <%s>\n", SCIPpropGetName(scip->set->props_presol[j]));
1061  SCIP_CALL( SCIPpropPresol(scip->set->props_presol[j], scip->set, *timing, scip->stat->npresolrounds,
1063  &scip->stat->npresolchgbds, &scip->stat->npresoladdholes, &scip->stat->npresoldelconss,
1064  &scip->stat->npresoladdconss, &scip->stat->npresolupgdconss, &scip->stat->npresolchgcoefs,
1065  &scip->stat->npresolchgsides, &result) );
1066  assert(BMSgetNUsedBufferMemory(SCIPbuffer(scip)) == nusedbuffers);
1067  assert(BMSgetNUsedBufferMemory(SCIPcleanbuffer(scip)) == nusedcleanbuffers);
1068 
1069  lastranpresol = FALSE;
1070  ++j;
1071  }
1072  else
1073  {
1074  assert(priopresol < 0);
1075 
1076  SCIPdebugMsg(scip, "executing presolver <%s>\n", SCIPpresolGetName(scip->set->presols[i]));
1077  SCIP_CALL( SCIPpresolExec(scip->set->presols[i], scip->set, *timing, scip->stat->npresolrounds,
1079  &scip->stat->npresolchgbds, &scip->stat->npresoladdholes, &scip->stat->npresoldelconss,
1080  &scip->stat->npresoladdconss, &scip->stat->npresolupgdconss, &scip->stat->npresolchgcoefs,
1081  &scip->stat->npresolchgsides, &result) );
1082  assert(BMSgetNUsedBufferMemory(SCIPbuffer(scip)) == nusedbuffers);
1083  assert(BMSgetNUsedBufferMemory(SCIPcleanbuffer(scip)) == nusedcleanbuffers);
1084 
1085  lastranpresol = TRUE;
1086  ++i;
1087  }
1088 
1089  if( result == SCIP_CUTOFF )
1090  {
1091  *infeasible = TRUE;
1092 
1093  if( lastranpresol )
1095  "presolver <%s> detected infeasibility\n", SCIPpresolGetName(scip->set->presols[i-1]));
1096  else
1098  "propagator <%s> detected infeasibility\n", SCIPpropGetName(scip->set->props_presol[j-1]));
1099  }
1100  else if( result == SCIP_UNBOUNDED )
1101  {
1102  *unbounded = TRUE;
1103 
1104  if( lastranpresol )
1106  "presolver <%s> detected unboundedness (or infeasibility)\n", SCIPpresolGetName(scip->set->presols[i-1]));
1107  else
1109  "propagator <%s> detected unboundedness (or infeasibility)\n", SCIPpropGetName(scip->set->props_presol[j-1]));
1110  }
1111 
1112  /* delete the variables from the problems that were marked to be deleted */
1113  SCIP_CALL( SCIPprobPerformVarDeletions(scip->transprob, scip->mem->probmem, scip->set, scip->stat, scip->eventqueue, scip->cliquetable, scip->lp,
1114  scip->branchcand) );
1115 
1116  SCIPdebugMsg(scip, "presolving callback return with result <%d>\n", result);
1117 
1118  /* if we work off the exhaustive presolvers, we stop immediately if a reduction was found */
1119  if( (*timing == SCIP_PRESOLTIMING_EXHAUSTIVE) && !lastround && !SCIPisPresolveFinished(scip) )
1120  {
1121  assert(k == consend);
1122 
1123  if( lastranpresol )
1124  {
1125  *presolstart = i + 1;
1126  *propstart = j;
1127  }
1128  else
1129  {
1130  *presolstart = i;
1131  *propstart = j + 1;
1132  }
1133  *consstart = k;
1134 
1135  break;
1136  }
1137  }
1138 
1139  /* remove empty and single variable cliques from the clique table */
1140  if( !(*unbounded) && !(*infeasible) )
1141  {
1142  int nlocalbdchgs = 0;
1143 
1144  SCIP_CALL( SCIPcliquetableCleanup(scip->cliquetable, scip->mem->probmem, scip->set, scip->stat, scip->transprob,
1145  scip->origprob, scip->tree, scip->reopt, scip->lp, scip->branchcand, scip->eventqueue, &nlocalbdchgs,
1146  infeasible) );
1147 
1148  if( nlocalbdchgs > 0 || *infeasible )
1150  "clique table cleanup detected %d bound changes%s\n", nlocalbdchgs, *infeasible ? " and infeasibility" : "");
1151 
1152  scip->stat->npresolfixedvars += nlocalbdchgs;
1153 
1154  if( !*infeasible && scip->set->nheurs > 0 )
1155  {
1156  /* call primal heuristics that are applicable during presolving */
1157  SCIP_Bool foundsol;
1158 
1159  SCIPdebugMsg(scip, "calling primal heuristics during presolving\n");
1160 
1161  /* call primal heuristics */
1162  SCIP_CALL( SCIPprimalHeuristics(scip->set, scip->stat, scip->transprob, scip->primal, NULL, NULL, NULL,
1163  SCIP_HEURTIMING_DURINGPRESOLLOOP, FALSE, &foundsol, unbounded) );
1164 
1165  /* output a message, if a solution was found */
1166  if( foundsol )
1167  {
1168  SCIP_SOL* sol;
1169 
1170  assert(SCIPgetNSols(scip) > 0);
1171  sol = SCIPgetBestSol(scip);
1172  assert(sol != NULL);
1173  assert(SCIPgetSolOrigObj(scip,sol) != SCIP_INVALID); /*lint !e777*/
1174 
1176  "feasible solution found by %s heuristic after %.1f seconds, objective value %.6e\n",
1178  }
1179  }
1180  }
1181 
1182  if( !(*unbounded) && !(*infeasible) )
1183  {
1184  /* call more expensive presolvers */
1185  if( (SCIPisPresolveFinished(scip) || lastround) )
1186  {
1187  if( *timing != SCIP_PRESOLTIMING_FINAL )
1188  {
1189  assert((*timing == SCIP_PRESOLTIMING_FAST) || (*timing == SCIP_PRESOLTIMING_MEDIUM) || (*timing == SCIP_PRESOLTIMING_EXHAUSTIVE));
1190 
1191  SCIPdebugMsg(scip, "not enough reductions in %s presolving, running %s presolving now...\n",
1192  *timing == SCIP_PRESOLTIMING_FAST ? "fast" : *timing == SCIP_PRESOLTIMING_MEDIUM ? "medium" : "exhaustive",
1193  *timing == SCIP_PRESOLTIMING_FAST ? "medium" : *timing == SCIP_PRESOLTIMING_MEDIUM ? "exhaustive" : "final");
1194 
1195  /* increase timing */
1197 
1198  /* computational experiments showed that always starting the loop of exhaustive presolvers from the beginning
1199  * performs better than continuing from the last processed presolver. Therefore, we start from 0, but keep
1200  * the mechanisms to possibly change this back later.
1201  * @todo try starting from the last processed exhaustive presolver
1202  */
1203  *presolstart = 0;
1204  *propstart = 0;
1205  *consstart = 0;
1206 
1207  SCIP_CALL( presolveRound(scip, timing, unbounded, infeasible, lastround, presolstart, presolend,
1208  propstart, propend, consstart, consend) );
1209  }
1210 #if 0
1211  /* run remaining exhaustive presolvers (if we did not start from the beginning anyway) */
1212  else if( (oldpresolstart > 0 || oldpropstart > 0 || oldconsstart > 0) && presolend == scip->set->npresols
1213  && propend == scip->set->nprops && consend == scip->set->nconshdlrs )
1214  {
1215  int newpresolstart = 0;
1216  int newpropstart = 0;
1217  int newconsstart = 0;
1218 
1219  SCIPdebugMsg(scip, "reached end of exhaustive presolving loop, starting from the beginning...\n");
1220 
1221  SCIP_CALL( presolveRound(scip, timing, unbounded, infeasible, lastround, &newpresolstart,
1222  oldpresolstart, &newpropstart, oldpropstart, &newconsstart, oldconsstart) );
1223 
1224  *presolstart = newpresolstart;
1225  *propstart = newpropstart;
1226  *consstart = newconsstart;
1227  }
1228 #endif
1229  }
1230  }
1231 
1232  /* issue PRESOLVEROUND event */
1234  SCIP_CALL( SCIPeventProcess(&event, scip->set, NULL, NULL, NULL, scip->eventfilter) );
1235 
1236  return SCIP_OKAY;
1237 }
1238 
1239 
1240 /** loops through the included presolvers and constraint's presolve methods, until changes are too few */
1241 static
1243  SCIP* scip, /**< SCIP data structure */
1244  SCIP_Bool* unbounded, /**< pointer to store whether presolving detected unboundedness */
1245  SCIP_Bool* infeasible, /**< pointer to store whether presolving detected infeasibility */
1246  SCIP_Bool* vanished /**< pointer to store whether the problem vanished in presolving */
1247  )
1248 {
1249  SCIP_PRESOLTIMING presoltiming;
1250  SCIP_Bool finished;
1251  SCIP_Bool stopped;
1252  SCIP_Bool lastround;
1253  int presolstart = 0;
1254  int propstart = 0;
1255  int consstart = 0;
1256 #ifndef NDEBUG
1257  size_t nusedbuffers;
1258  size_t nusedcleanbuffers;
1259 #endif
1260 
1261  assert(scip != NULL);
1262  assert(scip->mem != NULL);
1263  assert(scip->primal != NULL);
1264  assert(scip->set != NULL);
1265  assert(scip->stat != NULL);
1266  assert(scip->transprob != NULL);
1267  assert(scip->set->stage == SCIP_STAGE_TRANSFORMED || scip->set->stage == SCIP_STAGE_PRESOLVING);
1268  assert(unbounded != NULL);
1269  assert(infeasible != NULL);
1270 
1271  *unbounded = FALSE;
1272  *vanished = FALSE;
1273 
1274  /* GCG wants to perform presolving during the reading process of a file reader;
1275  * hence the number of used buffers does not need to be zero, however, it should
1276  * be the same again after presolve is finished
1277  */
1278 #ifndef NDEBUG
1279  nusedbuffers = BMSgetNUsedBufferMemory(SCIPbuffer(scip));
1280  nusedcleanbuffers = BMSgetNUsedBufferMemory(SCIPcleanbuffer(scip));
1281 #endif
1282 
1283  /* switch status to unknown */
1284  scip->stat->status = SCIP_STATUS_UNKNOWN;
1285 
1286  /* update upper bound and cutoff bound due to objective limit in primal data */
1287  SCIP_CALL( SCIPprimalUpdateObjlimit(scip->primal, scip->mem->probmem, scip->set, scip->stat, scip->eventfilter,
1288  scip->eventqueue, scip->transprob, scip->origprob, scip->tree, scip->reopt, scip->lp) );
1289 
1290  /* start presolving timer */
1291  SCIPclockStart(scip->stat->presolvingtime, scip->set);
1293 
1294  /* initialize presolving */
1295  if( scip->set->stage == SCIP_STAGE_TRANSFORMED )
1296  {
1297  SCIP_CALL( initPresolve(scip) );
1298  }
1299  assert(scip->set->stage == SCIP_STAGE_PRESOLVING);
1300 
1301  /* call primal heuristics that are applicable before presolving */
1302  if( scip->set->nheurs > 0 )
1303  {
1304  SCIP_Bool foundsol;
1305 
1306  SCIPdebugMsg(scip, "calling primal heuristics before presolving\n");
1307 
1308  /* call primal heuristics */
1309  SCIP_CALL( SCIPprimalHeuristics(scip->set, scip->stat, scip->transprob, scip->primal, NULL, NULL, NULL,
1310  SCIP_HEURTIMING_BEFOREPRESOL, FALSE, &foundsol, unbounded) );
1311 
1312  /* output a message, if a solution was found */
1313  if( foundsol )
1314  {
1315  SCIP_SOL* sol;
1316 
1317  assert(SCIPgetNSols(scip) > 0);
1318  sol = SCIPgetBestSol(scip);
1319  assert(sol != NULL);
1320  assert(SCIPgetSolOrigObj(scip,sol) != SCIP_INVALID); /*lint !e777*/
1321 
1323  "feasible solution found by %s heuristic after %.1f seconds, objective value %.6e\n",
1325  }
1326  }
1327 
1329 
1330  *infeasible = FALSE;
1331  *unbounded = (*unbounded) || (SCIPgetNSols(scip) > 0 && SCIPisInfinity(scip, -SCIPgetSolOrigObj(scip, SCIPgetBestSol(scip))));
1332 
1333  finished = (scip->set->presol_maxrounds != -1 && scip->stat->npresolrounds >= scip->set->presol_maxrounds)
1334  || (*unbounded) || (scip->set->reopt_enable && scip->stat->nreoptruns >= 1);
1335  stopped = SCIPsolveIsStopped(scip->set, scip->stat, TRUE);
1336 
1337  /* perform presolving rounds */
1338  while( !finished && !stopped )
1339  {
1340  /* store current number of reductions */
1342  scip->stat->lastnpresolaggrvars = scip->stat->npresolaggrvars;
1344  scip->stat->lastnpresolchgbds = scip->stat->npresolchgbds;
1345  scip->stat->lastnpresoladdholes = scip->stat->npresoladdholes;
1346  scip->stat->lastnpresoldelconss = scip->stat->npresoldelconss;
1347  scip->stat->lastnpresoladdconss = scip->stat->npresoladdconss;
1349  scip->stat->lastnpresolchgcoefs = scip->stat->npresolchgcoefs;
1350  scip->stat->lastnpresolchgsides = scip->stat->npresolchgsides;
1351 #ifdef SCIP_DISABLED_CODE
1352  scip->stat->lastnpresolimplications = scip->stat->nimplications;
1353  scip->stat->lastnpresolcliques = SCIPcliquetableGetNCliques(scip->cliquetable);
1354 #endif
1355 
1356  /* set presolving flag */
1357  scip->stat->performpresol = TRUE;
1358 
1359  /* sort propagators */
1360  SCIPsetSortPropsPresol(scip->set);
1361 
1362  /* sort presolvers by priority */
1363  SCIPsetSortPresols(scip->set);
1364 
1365  /* check if this will be the last presolving round (in that case, we want to run all presolvers) */
1366  lastround = (scip->set->presol_maxrounds == -1 ? FALSE : (scip->stat->npresolrounds + 1 >= scip->set->presol_maxrounds));
1367 
1368  presoltiming = SCIP_PRESOLTIMING_FAST;
1369 
1370  /* perform the presolving round by calling the presolvers, propagators, and constraint handlers */
1371  assert(!(*unbounded));
1372  assert(!(*infeasible));
1373  SCIP_CALL( presolveRound(scip, &presoltiming, unbounded, infeasible, lastround,
1374  &presolstart, scip->set->npresols, &propstart, scip->set->nprops, &consstart, scip->set->nconshdlrs) );
1375 
1376  /* check, if we should abort presolving due to not enough changes in the last round */
1377  finished = SCIPisPresolveFinished(scip) || presoltiming == SCIP_PRESOLTIMING_FINAL;
1378 
1379  SCIPdebugMsg(scip, "presolving round %d returned with unbounded = %u, infeasible = %u, finished = %u\n", scip->stat->npresolrounds, *unbounded, *infeasible, finished);
1380 
1381  /* check whether problem is infeasible or unbounded */
1382  finished = finished || *unbounded || *infeasible;
1383 
1384  /* increase round number */
1385  scip->stat->npresolrounds++;
1386 
1387  if( !finished )
1388  {
1389  /* print presolving statistics */
1391  "(round %d, %-11s %d del vars, %d del conss, %d add conss, %d chg bounds, %d chg sides, %d chg coeffs, %d upgd conss, %d impls, %d clqs\n",
1392  scip->stat->npresolrounds, ( presoltiming == SCIP_PRESOLTIMING_FAST ? "fast)" :
1393  (presoltiming == SCIP_PRESOLTIMING_MEDIUM ? "medium)" :
1394  (presoltiming == SCIP_PRESOLTIMING_EXHAUSTIVE ?"exhaustive)" :
1395  "final)")) ),
1396  scip->stat->npresolfixedvars + scip->stat->npresolaggrvars,
1397  scip->stat->npresoldelconss, scip->stat->npresoladdconss,
1398  scip->stat->npresolchgbds, scip->stat->npresolchgsides,
1399  scip->stat->npresolchgcoefs, scip->stat->npresolupgdconss,
1401  }
1402 
1403  /* abort if time limit was reached or user interrupted */
1404  stopped = SCIPsolveIsStopped(scip->set, scip->stat, TRUE);
1405  }
1406 
1407  /* first change status of scip, so that all plugins in their exitpre callbacks can ask SCIP for the correct status */
1408  if( *infeasible )
1409  {
1410  /* switch status to OPTIMAL */
1411  if( scip->primal->nlimsolsfound > 0 )
1412  {
1413  scip->stat->status = SCIP_STATUS_OPTIMAL;
1414  }
1415  else /* switch status to INFEASIBLE */
1417  }
1418  else if( *unbounded )
1419  {
1420  if( scip->primal->nsols >= 1 ) /* switch status to UNBOUNDED */
1422  else /* switch status to INFORUNBD */
1424  }
1425  /* if no variables and constraints are present, we try to add the empty solution (constraint handlers with needscons
1426  * flag FALSE could theoretically reject it); if no active pricers could create variables later, we conclude
1427  * optimality or infeasibility */
1428  else if( scip->transprob->nvars == 0 && scip->transprob->nconss == 0 )
1429  {
1430  SCIP_SOL* sol;
1431  SCIP_Bool stored;
1432 
1433  SCIP_CALL( SCIPcreateSol(scip, &sol, NULL) );
1434  SCIP_CALL( SCIPtrySolFree(scip, &sol, FALSE, FALSE, FALSE, FALSE, FALSE, &stored) );
1435 
1436  if( scip->set->nactivepricers == 0 )
1437  {
1438  if( scip->primal->nlimsolsfound > 0 )
1439  scip->stat->status = SCIP_STATUS_OPTIMAL;
1440  else
1442 
1443  *vanished = TRUE;
1444  }
1445  }
1446 
1447  /* deinitialize presolving */
1448  if( finished && (!stopped || *unbounded || *infeasible || *vanished) )
1449  {
1450  SCIP_Real maxnonzeros;
1451  SCIP_Longint nchecknonzeros;
1452  SCIP_Longint nactivenonzeros;
1453  SCIP_Bool approxchecknonzeros;
1454  SCIP_Bool approxactivenonzeros;
1455  SCIP_Bool infeas;
1456 
1457  SCIP_CALL( exitPresolve(scip, *unbounded || *infeasible || *vanished, &infeas) );
1458  *infeasible = *infeasible || infeas;
1459 
1460  assert(scip->set->stage == SCIP_STAGE_PRESOLVED);
1461 
1462  /* resort variables if we are not already done (unless variable permutation was explicitly activated) */
1463  if( !scip->set->random_permutevars && !(*infeasible) && !(*unbounded) && !(*vanished) )
1464  {
1465  /* (Re)Sort the variables, which appear in the four categories (binary, integer, implicit, continuous) after
1466  * presolve with respect to their original index (within their categories). Adjust the problem index afterwards
1467  * which is supposed to reflect the position in the variable array. This additional (re)sorting is supposed to
1468  * get more robust against the order presolving fixed variables. (We also reobtain a possible block structure
1469  * induced by the user model)
1470  */
1472  }
1473 
1474  /* determine number of non-zeros */
1475  maxnonzeros = (SCIP_Real)SCIPgetNConss(scip) * SCIPgetNVars(scip);
1476  maxnonzeros = MAX(maxnonzeros, 1.0);
1477  SCIP_CALL( calcNonZeros(scip, &nchecknonzeros, &nactivenonzeros, &approxchecknonzeros, &approxactivenonzeros) );
1478  scip->stat->nnz = nactivenonzeros;
1479 
1482  "presolved problem has %s%" SCIP_LONGINT_FORMAT " active (%g%%) nonzeros and %s%" SCIP_LONGINT_FORMAT " (%g%%) check nonzeros\n",
1483  approxactivenonzeros ? "more than " : "", nactivenonzeros, nactivenonzeros/maxnonzeros * 100,
1484  approxchecknonzeros ? "more than " : "", nchecknonzeros, nchecknonzeros/maxnonzeros * 100);
1486  }
1487  assert(BMSgetNUsedBufferMemory(SCIPbuffer(scip)) == nusedbuffers);
1488  assert(BMSgetNUsedBufferMemory(SCIPcleanbuffer(scip)) == nusedcleanbuffers);
1489 
1490  /* stop presolving time */
1491  SCIPclockStop(scip->stat->presolvingtime, scip->set);
1493 
1494  /* print presolving statistics */
1496  "presolving (%d rounds: %d fast, %d medium, %d exhaustive):\n", scip->stat->npresolrounds,
1499  " %d deleted vars, %d deleted constraints, %d added constraints, %d tightened bounds, %d added holes, %d changed sides, %d changed coefficients\n",
1503  " %d implications, %d cliques\n", scip->stat->nimplications, SCIPcliquetableGetNCliques(scip->cliquetable));
1504 
1505  /* remember number of constraints */
1507 
1508  return SCIP_OKAY;
1509 }
1510 
1511 /** tries to transform original solutions to the transformed problem space */
1512 static
1514  SCIP* scip /**< SCIP data structure */
1515  )
1516 {
1517  SCIP_SOL** sols;
1518  SCIP_SOL** scipsols;
1519  SCIP_SOL* sol;
1520  SCIP_Real* solvals;
1521  SCIP_Bool* solvalset;
1522  SCIP_Bool added;
1523  SCIP_Longint oldnsolsfound;
1524  int nsols;
1525  int ntransvars;
1526  int naddedsols;
1527  int s;
1528 
1529  nsols = SCIPgetNSols(scip);
1530  oldnsolsfound = scip->primal->nsolsfound;
1531 
1532  /* no solution to transform */
1533  if( nsols == 0 )
1534  return SCIP_OKAY;
1535 
1536  SCIPdebugMsg(scip, "try to transfer %d original solutions into the transformed problem space\n", nsols);
1537 
1538  ntransvars = scip->transprob->nvars;
1539  naddedsols = 0;
1540 
1541  /* It might happen, that the added transferred solution does not equal the corresponding original one, which might
1542  * result in the array of solutions being changed. Thus we temporarily copy the array and traverse it in reverse
1543  * order to ensure that the regarded solution in the copied array was not already freed when new solutions were added
1544  * and the worst solutions were freed.
1545  */
1546  scipsols = SCIPgetSols(scip);
1547  SCIP_CALL( SCIPduplicateBufferArray(scip, &sols, scipsols, nsols) );
1548  SCIP_CALL( SCIPallocBufferArray(scip, &solvals, ntransvars) );
1549  SCIP_CALL( SCIPallocBufferArray(scip, &solvalset, ntransvars) );
1550 
1551  for( s = nsols-1; s >= 0; --s )
1552  {
1553  sol = sols[s];
1554 
1555  /* it might happen that a transferred original solution has a better objective than its original counterpart
1556  * (e.g., because multi-aggregated variables get another value, but the solution is still feasible);
1557  * in this case, it might happen that the solution is not an original one and we just skip this solution
1558  */
1559  if( !SCIPsolIsOriginal(sol) )
1560  continue;
1561 
1562  SCIP_CALL( SCIPprimalTransformSol(scip->primal, sol, scip->mem->probmem, scip->set, scip->messagehdlr, scip->stat,
1563  scip->origprob, scip->transprob, scip->tree, scip->reopt, scip->lp, scip->eventqueue, scip->eventfilter, solvals,
1564  solvalset, ntransvars, &added) );
1565 
1566  if( added )
1567  ++naddedsols;
1568  }
1569 
1570  if( naddedsols > 0 )
1571  {
1573  "transformed %d/%d original solutions to the transformed problem space\n",
1574  naddedsols, nsols);
1575 
1576  scip->stat->nexternalsolsfound += scip->primal->nsolsfound - oldnsolsfound;
1577  }
1578 
1579  SCIPfreeBufferArray(scip, &solvalset);
1580  SCIPfreeBufferArray(scip, &solvals);
1581  SCIPfreeBufferArray(scip, &sols);
1582 
1583  return SCIP_OKAY;
1584 }
1585 
1586 /** initializes solution process data structures */
1587 static
1589  SCIP* scip, /**< SCIP data structure */
1590  SCIP_Bool solved /**< is problem already solved? */
1591  )
1592 {
1593  assert(scip != NULL);
1594  assert(scip->mem != NULL);
1595  assert(scip->set != NULL);
1596  assert(scip->stat != NULL);
1597  assert(scip->nlp == NULL);
1598  assert(scip->set->stage == SCIP_STAGE_PRESOLVED);
1599 
1600  /**@todo check whether other methodscan be skipped if problem has been solved */
1601  /* if problem has been solved, several time consuming tasks must not be performed */
1602  if( !solved )
1603  {
1604  /* reset statistics for current branch and bound run */
1605  SCIPstatResetCurrentRun(scip->stat, scip->set, scip->transprob, scip->origprob, solved);
1607 
1608  /* LP is empty anyway; mark empty LP to be solved and update validsollp counter */
1609  SCIP_CALL( SCIPlpReset(scip->lp, scip->mem->probmem, scip->set, scip->stat, scip->eventqueue, scip->eventfilter) );
1610 
1611  /* update upper bound and cutoff bound due to objective limit in primal data */
1612  SCIP_CALL( SCIPprimalUpdateObjlimit(scip->primal, scip->mem->probmem, scip->set, scip->stat, scip->eventfilter,
1613  scip->eventqueue, scip->transprob, scip->origprob, scip->tree, scip->reopt, scip->lp) );
1614  }
1615 
1616  /* switch stage to INITSOLVE */
1617  scip->set->stage = SCIP_STAGE_INITSOLVE;
1618 
1619  /* initialize NLP if there are nonlinearities */
1620  if( scip->transprob->nlpenabled && !scip->set->nlp_disable )
1621  {
1622  SCIPdebugMsg(scip, "constructing empty NLP\n");
1623 
1624  SCIP_CALL( SCIPnlpCreate(&scip->nlp, scip->mem->probmem, scip->set, scip->stat, SCIPprobGetName(scip->transprob), scip->transprob->nvars) );
1625  assert(scip->nlp != NULL);
1626 
1627  SCIP_CALL( SCIPnlpAddVars(scip->nlp, scip->mem->probmem, scip->set, scip->transprob->nvars, scip->transprob->vars) );
1628 
1629  /* Adjust estimation of external memory: SCIPtransformProb() estimated the memory used for the LP-solver. As a
1630  * very crude approximation just double this number. Only do this once in the first run. */
1631  if( scip->set->misc_estimexternmem && scip->stat->nruns <= 1 )
1632  {
1633  scip->stat->externmemestim *= 2;
1634  SCIPdebugMsg(scip, "external memory usage estimated to %" SCIP_LONGINT_FORMAT " byte\n", scip->stat->externmemestim);
1635  }
1636  }
1637 
1638  /* possibly create visualization output file */
1639  SCIP_CALL( SCIPvisualInit(scip->stat->visual, scip->mem->probmem, scip->set, scip->messagehdlr) );
1640 
1641  /* initialize solution process data structures */
1643  SCIP_CALL( SCIPsepastoreCreate(&scip->sepastore, scip->mem->probmem, scip->set) );
1644  SCIP_CALL( SCIPsepastoreCreate(&scip->sepastoreprobing, scip->mem->probmem, scip->set) );
1645  SCIP_CALL( SCIPcutpoolCreate(&scip->cutpool, scip->mem->probmem, scip->set, scip->set->sepa_cutagelimit, TRUE) );
1646  SCIP_CALL( SCIPcutpoolCreate(&scip->delayedcutpool, scip->mem->probmem, scip->set, scip->set->sepa_cutagelimit, FALSE) );
1647  SCIP_CALL( SCIPtreeCreateRoot(scip->tree, scip->reopt, scip->mem->probmem, scip->set, scip->stat, scip->eventfilter, scip->eventqueue,
1648  scip->lp) );
1649 
1650  /* update dual bound of the root node if a valid dual bound is at hand */
1651  if( scip->transprob->dualbound < SCIP_INVALID )
1652  {
1653  SCIP_Real internobjval = SCIPprobInternObjval(scip->transprob, scip->origprob, scip->set, scip->transprob->dualbound);
1654 
1655  scip->stat->lastlowerbound = internobjval;
1656 
1657  SCIPnodeUpdateLowerbound(SCIPtreeGetRootNode(scip->tree), scip->stat, scip->set, scip->tree, scip->transprob,
1658  scip->origprob, internobjval);
1659  }
1660 
1661  /* try to transform original solutions to the transformed problem space */
1662  if( scip->set->misc_transorigsols )
1663  {
1664  SCIP_CALL( transformSols(scip) );
1665  }
1666 
1667  /* inform the transformed problem that the branch and bound process starts now */
1668  SCIP_CALL( SCIPprobInitSolve(scip->transprob, scip->set) );
1669 
1670  /* transform the decomposition storage */
1672 
1673  /* inform plugins that the branch and bound process starts now */
1674  SCIP_CALL( SCIPsetInitsolPlugins(scip->set, scip->mem->probmem, scip->stat) );
1675 
1676  /* remember number of constraints */
1678 
1679  /* if all variables are known, calculate a trivial primal bound by setting all variables to their worst bound */
1680  if( scip->set->nactivepricers == 0 )
1681  {
1682  SCIP_VAR* var;
1683  SCIP_Real obj;
1684  SCIP_Real objbound;
1685  SCIP_Real bd;
1686  int v;
1687 
1688  objbound = 0.0;
1689  for( v = 0; v < scip->transprob->nvars && !SCIPsetIsInfinity(scip->set, objbound); ++v )
1690  {
1691  var = scip->transprob->vars[v];
1692  obj = SCIPvarGetObj(var);
1693  if( !SCIPsetIsZero(scip->set, obj) )
1694  {
1695  bd = SCIPvarGetWorstBoundGlobal(var);
1696  if( SCIPsetIsInfinity(scip->set, REALABS(bd)) )
1697  objbound = SCIPsetInfinity(scip->set);
1698  else
1699  objbound += obj * bd;
1700  }
1701  }
1702 
1703  /* adjust primal bound, such that solution with worst bound may be found */
1704  if( objbound + SCIPsetCutoffbounddelta(scip->set) != objbound ) /*lint !e777*/
1705  objbound += SCIPsetCutoffbounddelta(scip->set);
1706  /* if objbound is very large, adding the cutoffbounddelta may not change the number; in this case, we are using
1707  * SCIPnextafter to ensure that the cutoffbound is really larger than the best possible solution value
1708  */
1709  else
1710  objbound = SCIPnextafter(objbound, SCIP_REAL_MAX);
1711 
1712  /* update cutoff bound */
1713  if( !SCIPsetIsInfinity(scip->set, objbound) && SCIPsetIsLT(scip->set, objbound, scip->primal->cutoffbound) )
1714  {
1715  /* adjust cutoff bound */
1716  SCIP_CALL( SCIPprimalSetCutoffbound(scip->primal, scip->mem->probmem, scip->set, scip->stat, scip->eventfilter,
1717  scip->eventqueue, scip->transprob, scip->origprob, scip->tree, scip->reopt, scip->lp, objbound, FALSE) );
1718  }
1719  }
1720 
1721  /* switch stage to SOLVING */
1722  scip->set->stage = SCIP_STAGE_SOLVING;
1723 
1724  return SCIP_OKAY;
1725 }
1726 
1727 /** frees solution process data structures */
1728 static
1730  SCIP* scip, /**< SCIP data structure */
1731  SCIP_Bool restart /**< was this free solve call triggered by a restart? */
1732  )
1733 {
1734  assert(scip != NULL);
1735  assert(scip->mem != NULL);
1736  assert(scip->set != NULL);
1737  assert(scip->stat != NULL);
1738  assert(scip->set->stage == SCIP_STAGE_SOLVING || scip->set->stage == SCIP_STAGE_SOLVED);
1739 
1740  /* mark that we are currently restarting */
1741  if( restart )
1742  {
1743  scip->stat->inrestart = TRUE;
1744 
1745  /* copy the current dual bound into the problem data structure such that it can be used initialize the new search
1746  * tree
1747  */
1749  }
1750 
1751  /* remove focus from the current focus node */
1752  if( SCIPtreeGetFocusNode(scip->tree) != NULL )
1753  {
1754  SCIP_NODE* node = NULL;
1755  SCIP_Bool cutoff;
1756 
1757  SCIP_CALL( SCIPnodeFocus(&node, scip->mem->probmem, scip->set, scip->messagehdlr, scip->stat, scip->transprob,
1758  scip->origprob, scip->primal, scip->tree, scip->reopt, scip->lp, scip->branchcand, scip->conflict,
1759  scip->conflictstore, scip->eventfilter, scip->eventqueue, scip->cliquetable, &cutoff, FALSE, TRUE) );
1760  assert(!cutoff);
1761  }
1762 
1763  /* switch stage to EXITSOLVE */
1764  scip->set->stage = SCIP_STAGE_EXITSOLVE;
1765 
1766  /* cleanup the conflict storage */
1767  SCIP_CALL( SCIPconflictstoreClean(scip->conflictstore, scip->mem->probmem, scip->set, scip->stat, scip->transprob, scip->reopt) );
1768 
1769  /* inform plugins that the branch and bound process is finished */
1770  SCIP_CALL( SCIPsetExitsolPlugins(scip->set, scip->mem->probmem, scip->stat, restart) );
1771 
1772  /* free the NLP, if there is one, and reset the flags indicating nonlinearity */
1773  if( scip->nlp != NULL )
1774  {
1775  SCIP_CALL( SCIPnlpFree(&scip->nlp, scip->mem->probmem, scip->set, scip->stat, scip->eventqueue, scip->lp) );
1776  }
1777  scip->transprob->nlpenabled = FALSE;
1778 
1779  /* clear the LP, and flush the changes to clear the LP of the solver */
1780  SCIP_CALL( SCIPlpReset(scip->lp, scip->mem->probmem, scip->set, scip->stat, scip->eventqueue, scip->eventfilter) );
1782 
1783  /* resets the debug environment */
1784  SCIP_CALL( SCIPdebugReset(scip->set) ); /*lint !e506 !e774*/
1785 
1786  /* clear all row references in internal data structures */
1787  SCIP_CALL( SCIPcutpoolClear(scip->cutpool, scip->mem->probmem, scip->set, scip->lp) );
1788  SCIP_CALL( SCIPcutpoolClear(scip->delayedcutpool, scip->mem->probmem, scip->set, scip->lp) );
1789 
1790  /* we have to clear the tree prior to the problem deinitialization, because the rows stored in the forks and
1791  * subroots have to be released
1792  */
1793  SCIP_CALL( SCIPtreeClear(scip->tree, scip->mem->probmem, scip->set, scip->stat, scip->eventfilter, scip->eventqueue, scip->lp) );
1794 
1796 
1797  /* deinitialize transformed problem */
1798  SCIP_CALL( SCIPprobExitSolve(scip->transprob, scip->mem->probmem, scip->set, scip->eventqueue, scip->lp, restart) );
1799 
1800  /* free solution process data structures */
1801  SCIP_CALL( SCIPcutpoolFree(&scip->cutpool, scip->mem->probmem, scip->set, scip->lp) );
1802  SCIP_CALL( SCIPcutpoolFree(&scip->delayedcutpool, scip->mem->probmem, scip->set, scip->lp) );
1804  SCIP_CALL( SCIPsepastoreFree(&scip->sepastore, scip->mem->probmem) );
1806 
1807  /* possibly close visualization output file */
1808  SCIPvisualExit(scip->stat->visual, scip->set, scip->messagehdlr);
1809 
1810  /* reset statistics for current branch and bound run */
1812  SCIPstatResetCurrentRun(scip->stat, scip->set, scip->transprob, scip->origprob, TRUE);
1813  else
1814  SCIPstatResetCurrentRun(scip->stat, scip->set, scip->transprob, scip->origprob, FALSE);
1815 
1816  /* switch stage to TRANSFORMED */
1817  scip->set->stage = SCIP_STAGE_TRANSFORMED;
1818 
1819  /* restart finished */
1820  assert( ! restart || scip->stat->inrestart );
1821  scip->stat->inrestart = FALSE;
1822 
1823  return SCIP_OKAY;
1824 }
1825 
1826 /** frees solution process data structures when reoptimization is used
1827  *
1828  * in contrast to a freeSolve() this method will preserve the transformed problem such that another presolving round
1829  * after changing the problem (modifying the objective function) is not necessary.
1830  */
1831 static
1833  SCIP* scip /**< SCIP data structure */
1834  )
1835 {
1836  assert(scip != NULL);
1837  assert(scip->mem != NULL);
1838  assert(scip->set != NULL);
1839  assert(scip->stat != NULL);
1840  assert(scip->set->stage == SCIP_STAGE_SOLVING || scip->set->stage == SCIP_STAGE_SOLVED);
1841 
1842  /* remove focus from the current focus node */
1843  if( SCIPtreeGetFocusNode(scip->tree) != NULL )
1844  {
1845  SCIP_NODE* node = NULL;
1846  SCIP_Bool cutoff;
1847 
1848  SCIP_CALL( SCIPnodeFocus(&node, scip->mem->probmem, scip->set, scip->messagehdlr, scip->stat, scip->transprob,
1849  scip->origprob, scip->primal, scip->tree, scip->reopt, scip->lp, scip->branchcand, scip->conflict,
1850  scip->conflictstore, scip->eventfilter, scip->eventqueue, scip->cliquetable, &cutoff, FALSE, TRUE) );
1851  assert(!cutoff);
1852  }
1853 
1854  /* mark current stats, such that new solve begins with the var/col/row indices from the previous run */
1855  SCIPstatMark(scip->stat);
1856 
1857  /* switch stage to EXITSOLVE */
1858  scip->set->stage = SCIP_STAGE_EXITSOLVE;
1859 
1860  /* deinitialize conflict store */
1861  SCIP_CALL( SCIPconflictstoreClear(scip->conflictstore, scip->mem->probmem, scip->set, scip->stat, scip->reopt) );
1862 
1863  /* invalidate the dual bound */
1865 
1866  /* inform plugins that the branch and bound process is finished */
1867  SCIP_CALL( SCIPsetExitsolPlugins(scip->set, scip->mem->probmem, scip->stat, FALSE) );
1868 
1869  /* call exit methods of plugins */
1870  SCIP_CALL( SCIPsetExitPlugins(scip->set, scip->mem->probmem, scip->stat) );
1871 
1872  /* free the NLP, if there is one, and reset the flags indicating nonlinearity */
1873  if( scip->nlp != NULL )
1874  {
1875  SCIP_CALL( SCIPnlpFree(&scip->nlp, scip->mem->probmem, scip->set, scip->stat, scip->eventqueue, scip->lp) );
1876  }
1877  scip->transprob->nlpenabled = FALSE;
1878 
1879  /* clear the LP, and flush the changes to clear the LP of the solver */
1880  SCIP_CALL( SCIPlpReset(scip->lp, scip->mem->probmem, scip->set, scip->stat, scip->eventqueue, scip->eventfilter) );
1882 
1883  /* resets the debug environment */
1884  SCIP_CALL( SCIPdebugReset(scip->set) ); /*lint !e506 !e774*/
1885 
1886  /* clear all row references in internal data structures */
1887  SCIP_CALL( SCIPcutpoolClear(scip->cutpool, scip->mem->probmem, scip->set, scip->lp) );
1888  SCIP_CALL( SCIPcutpoolClear(scip->delayedcutpool, scip->mem->probmem, scip->set, scip->lp) );
1889 
1890  /* we have to clear the tree prior to the problem deinitialization, because the rows stored in the forks and
1891  * subroots have to be released
1892  */
1893  SCIP_CALL( SCIPtreeClear(scip->tree, scip->mem->probmem, scip->set, scip->stat, scip->eventfilter, scip->eventqueue, scip->lp) );
1894 
1895  /* deinitialize transformed problem */
1896  SCIP_CALL( SCIPprobExitSolve(scip->transprob, scip->mem->probmem, scip->set, scip->eventqueue, scip->lp, FALSE) );
1897 
1898  /* free solution process data structures */
1900 
1901  SCIP_CALL( SCIPcutpoolFree(&scip->cutpool, scip->mem->probmem, scip->set, scip->lp) );
1902  SCIP_CALL( SCIPcutpoolFree(&scip->delayedcutpool, scip->mem->probmem, scip->set, scip->lp) );
1904  SCIP_CALL( SCIPsepastoreFree(&scip->sepastore, scip->mem->probmem) );
1906 
1907  /* possibly close visualization output file */
1908  SCIPvisualExit(scip->stat->visual, scip->set, scip->messagehdlr);
1909 
1910  /* reset statistics for current branch and bound run */
1911  SCIPstatResetCurrentRun(scip->stat, scip->set, scip->transprob, scip->origprob, FALSE);
1912 
1913  /* switch stage to PRESOLVED */
1914  scip->set->stage = SCIP_STAGE_PRESOLVED;
1915 
1916  /* restart finished */
1917  scip->stat->inrestart = FALSE;
1918 
1919  /* reset solving specific paramters */
1920  if( scip->set->reopt_enable )
1921  {
1922  assert(scip->reopt != NULL);
1923  SCIP_CALL( SCIPreoptReset(scip->reopt, scip->set, scip->mem->probmem) );
1924  }
1925 
1926  /* free the debug solution which might live in transformed primal data structure */
1927  SCIP_CALL( SCIPprimalClear(&scip->primal, scip->mem->probmem) );
1928 
1929  if( scip->set->misc_resetstat )
1930  {
1931  /* reset statistics to the point before the problem was transformed */
1932  SCIPstatReset(scip->stat, scip->set, scip->transprob, scip->origprob);
1933  }
1934  else
1935  {
1936  /* even if statistics are not completely reset, a partial reset of the primal-dual integral is necessary */
1938  }
1939 
1940  /* reset objective limit */
1942 
1943  return SCIP_OKAY;
1944 }
1945 
1946 /** free transformed problem */
1947 static
1949  SCIP* scip /**< SCIP data structure */
1950  )
1951 {
1952  SCIP_Bool reducedfree;
1953 
1954  assert(scip != NULL);
1955  assert(scip->mem != NULL);
1956  assert(scip->stat != NULL);
1957  assert(scip->set->stage == SCIP_STAGE_TRANSFORMED || scip->set->stage == SCIP_STAGE_PRESOLVING ||
1958  (scip->set->stage == SCIP_STAGE_PRESOLVED && scip->set->reopt_enable));
1959 
1960  /* If the following evaluates to true, SCIPfreeReoptSolve() has already called the exit-callbacks of the plugins.
1961  * We can skip calling some of the following methods. This can happen if a new objective function was
1962  * installed but the solve was not started.
1963  */
1964  reducedfree = (scip->set->stage == SCIP_STAGE_PRESOLVED && scip->set->reopt_enable);
1965 
1966  if( !reducedfree )
1967  {
1968  /* call exit methods of plugins */
1969  SCIP_CALL( SCIPsetExitPlugins(scip->set, scip->mem->probmem, scip->stat) );
1970  }
1971 
1972  /* copy best primal solutions to original solution candidate list */
1973  if( !scip->set->reopt_enable && scip->set->limit_maxorigsol > 0 && scip->set->misc_transsolsorig && scip->set->nactivebenders == 0 )
1974  {
1975  SCIP_Bool stored;
1976  SCIP_Bool hasinfval;
1977  int maxsols;
1978  int nsols;
1979  int s;
1980 
1981  assert(scip->origprimal->nsols == 0);
1982 
1983  nsols = scip->primal->nsols;
1984  maxsols = scip->set->limit_maxorigsol;
1985  stored = TRUE;
1986  s = 0;
1987 
1988  /* iterate over all solutions as long as the original solution candidate store size limit is not reached */
1989  while( s < nsols && scip->origprimal->nsols < maxsols )
1990  {
1991  SCIP_SOL* sol;
1992 
1993  sol = scip->primal->sols[s];
1994  assert(sol != NULL);
1995 
1996  if( !SCIPsolIsOriginal(sol) )
1997  {
1998  /* retransform solution into the original problem space */
1999  SCIP_CALL( SCIPsolRetransform(sol, scip->set, scip->stat, scip->origprob, scip->transprob, &hasinfval) );
2000  }
2001  else
2002  hasinfval = FALSE;
2003 
2004  /* removing infinite fixings is turned off by the corresponding parameter */
2005  if( !scip->set->misc_finitesolstore )
2006  hasinfval = FALSE;
2007 
2008  if( !hasinfval )
2009  {
2010  /* add solution to original candidate solution storage */
2011  SCIP_CALL( SCIPprimalAddOrigSol(scip->origprimal, scip->mem->probmem, scip->set, scip->stat, scip->origprob, sol, &stored) );
2012  }
2013  else
2014  {
2015  SCIP_SOL* newsol;
2016  SCIP_Bool success;
2017 
2018  SCIP_CALL( SCIPcreateFiniteSolCopy(scip, &newsol, sol, &success) );
2019 
2020  /* infinite fixing could be removed */
2021  if( newsol != NULL )
2022  {
2023  /* add solution to original candidate solution storage; we must not use SCIPprimalAddOrigSolFree()
2024  * because we want to create a copy of the solution in the origprimal solution store, but newsol was
2025  * created in the (transformed) primal
2026  */
2027  SCIP_CALL( SCIPprimalAddOrigSol(scip->origprimal, scip->mem->probmem, scip->set, scip->stat, scip->origprob, newsol, &stored) );
2028 
2029  /* free solution in (transformed) primal where it was created */
2030  SCIP_CALL( SCIPsolFree(&newsol, scip->mem->probmem, scip->primal) );
2031  }
2032  }
2033  ++s;
2034  }
2035 
2036  if( scip->origprimal->nsols > 1 )
2037  {
2039  "stored the %d best primal solutions in the original solution candidate list\n", scip->origprimal->nsols);
2040  }
2041  else if( scip->origprimal->nsols == 1 )
2042  {
2044  "stored the best primal solution in the original solution candidate list\n");
2045  }
2046  }
2047 
2048  /* switch stage to FREETRANS */
2049  scip->set->stage = SCIP_STAGE_FREETRANS;
2050 
2051  /* reset solving specific paramters */
2052  assert(!scip->set->reopt_enable || scip->reopt != NULL);
2053  if( scip->set->reopt_enable && scip->reopt != NULL )
2054  {
2055  SCIP_CALL( SCIPreoptReset(scip->reopt, scip->set, scip->mem->probmem) );
2056  }
2057 
2058  if( !reducedfree )
2059  {
2060  /* clear the conflict store
2061  *
2062  * since the conflict store can contain transformed constraints we need to remove them. the store will be finally
2063  * freed in SCIPfreeProb().
2064  */
2065  SCIP_CALL( SCIPconflictstoreClear(scip->conflictstore, scip->mem->probmem, scip->set, scip->stat, scip->reopt) );
2066  }
2067 
2068  /* free transformed problem data structures */
2069  SCIP_CALL( SCIPprobFree(&scip->transprob, scip->messagehdlr, scip->mem->probmem, scip->set, scip->stat, scip->eventqueue, scip->lp) );
2071  SCIP_CALL( SCIPconflictFree(&scip->conflict, scip->mem->probmem) );
2072 
2073  if( !reducedfree )
2074  {
2076  }
2077  SCIP_CALL( SCIPtreeFree(&scip->tree, scip->mem->probmem, scip->set, scip->stat, scip->eventfilter, scip->eventqueue, scip->lp) );
2078 
2079  /* free the debug solution which might live in transformed primal data structure */
2080  SCIP_CALL( SCIPdebugFreeSol(scip->set) ); /*lint !e506 !e774*/
2081  SCIP_CALL( SCIPprimalFree(&scip->primal, scip->mem->probmem) );
2082 
2083  SCIP_CALL( SCIPlpFree(&scip->lp, scip->mem->probmem, scip->set, scip->eventqueue, scip->eventfilter) );
2085  SCIP_CALL( SCIPeventfilterFree(&scip->eventfilter, scip->mem->probmem, scip->set) );
2087 
2088  if( scip->set->misc_resetstat && !reducedfree )
2089  {
2090  /* reset statistics to the point before the problem was transformed */
2091  SCIPstatReset(scip->stat, scip->set, scip->transprob, scip->origprob);
2092  }
2093  else
2094  {
2095  /* even if statistics are not completely reset, a partial reset of the primal-dual integral is necessary */
2097  }
2098 
2099  /* switch stage to PROBLEM */
2100  scip->set->stage = SCIP_STAGE_PROBLEM;
2101 
2102  /* reset objective limit */
2104 
2105  /* reset original variable's local and global bounds to their original values */
2106  SCIP_CALL( SCIPprobResetBounds(scip->origprob, scip->mem->probmem, scip->set, scip->stat) );
2107 
2108  return SCIP_OKAY;
2109 }
2110 
2111 /** free transformed problem in case an error occurs during transformation and return to SCIP_STAGE_PROBLEM */
2112 static
2114  SCIP* scip /**< SCIP data structure */
2115  )
2116 {
2117 
2118  assert(scip != NULL);
2119  assert(scip->mem != NULL);
2120  assert(scip->stat != NULL);
2121  assert(scip->set->stage == SCIP_STAGE_TRANSFORMING);
2122 
2123  /* switch stage to FREETRANS */
2124  scip->set->stage = SCIP_STAGE_FREETRANS;
2125 
2126  /* free transformed problem data structures */
2127  SCIP_CALL( SCIPprobFree(&scip->transprob, scip->messagehdlr, scip->mem->probmem, scip->set, scip->stat, scip->eventqueue, scip->lp) );
2129  SCIP_CALL( SCIPconflictFree(&scip->conflict, scip->mem->probmem) );
2131  SCIP_CALL( SCIPtreeFree(&scip->tree, scip->mem->probmem, scip->set, scip->stat, scip->eventfilter, scip->eventqueue, scip->lp) );
2132 
2133  /* free the debug solution which might live in transformed primal data structure */
2134  SCIP_CALL( SCIPdebugFreeSol(scip->set) ); /*lint !e506 !e774*/
2135  SCIP_CALL( SCIPprimalFree(&scip->primal, scip->mem->probmem) );
2136 
2137  SCIP_CALL( SCIPlpFree(&scip->lp, scip->mem->probmem, scip->set, scip->eventqueue, scip->eventfilter) );
2139  SCIP_CALL( SCIPeventfilterFree(&scip->eventfilter, scip->mem->probmem, scip->set) );
2141 
2142  if( scip->set->misc_resetstat )
2143  {
2144  /* reset statistics to the point before the problem was transformed */
2145  SCIPstatReset(scip->stat, scip->set, scip->transprob, scip->origprob);
2146  }
2147  else
2148  {
2149  /* even if statistics are not completely reset, a partial reset of the primal-dual integral is necessary */
2151  }
2152 
2153  /* switch stage to PROBLEM */
2154  scip->set->stage = SCIP_STAGE_PROBLEM;
2155 
2156  return SCIP_OKAY;
2157 }
2158 
2159 /** displays most relevant statistics after problem was solved */
2160 static
2162  SCIP* scip /**< SCIP data structure */
2163  )
2164 {
2165  assert(scip != NULL);
2166 
2167  /* display most relevant statistics */
2169  {
2170  SCIP_Bool objlimitreached = FALSE;
2171 
2172  /* We output that the objective limit has been reached if the problem has been solved, no solution respecting the
2173  * objective limit has been found (nlimsolsfound == 0) and the primal bound is finite. Note that it still might be
2174  * that the original problem is infeasible, even without the objective limit, i.e., we cannot be sure that we
2175  * actually reached the objective limit. */
2176  if( SCIPgetStage(scip) == SCIP_STAGE_SOLVED && scip->primal->nlimsolsfound == 0 && ! SCIPisInfinity(scip, SCIPgetPrimalbound(scip)) )
2177  objlimitreached = TRUE;
2178 
2179  SCIPmessagePrintInfo(scip->messagehdlr, "\n");
2180  SCIPmessagePrintInfo(scip->messagehdlr, "SCIP Status : ");
2181  SCIP_CALL( SCIPprintStage(scip, NULL) );
2182  SCIPmessagePrintInfo(scip->messagehdlr, "\n");
2183  if( scip->set->reopt_enable )
2184  SCIPmessagePrintInfo(scip->messagehdlr, "Solving Time (sec) : %.2f (over %d runs: %.2f)\n", SCIPclockGetTime(scip->stat->solvingtime), scip->stat->nreoptruns, SCIPclockGetTime(scip->stat->solvingtimeoverall));
2185  else
2186  SCIPmessagePrintInfo(scip->messagehdlr, "Solving Time (sec) : %.2f\n", SCIPclockGetTime(scip->stat->solvingtime));
2187  if( scip->stat->nruns > 1 )
2188  SCIPmessagePrintInfo(scip->messagehdlr, "Solving Nodes : %" SCIP_LONGINT_FORMAT " (total of %" SCIP_LONGINT_FORMAT " nodes in %d runs)\n",
2189  scip->stat->nnodes, scip->stat->ntotalnodes, scip->stat->nruns);
2190  else if( scip->set->reopt_enable )
2191  {
2192  SCIP_BRANCHRULE* branchrule;
2193 
2194  branchrule = SCIPfindBranchrule(scip, "nodereopt");
2195  assert(branchrule != NULL);
2196 
2197  SCIPmessagePrintInfo(scip->messagehdlr, "Solving Nodes : %" SCIP_LONGINT_FORMAT " (%" SCIP_LONGINT_FORMAT " reactivated)\n", scip->stat->nnodes, SCIPbranchruleGetNChildren(branchrule));
2198  }
2199  else
2200  SCIPmessagePrintInfo(scip->messagehdlr, "Solving Nodes : %" SCIP_LONGINT_FORMAT "\n", scip->stat->nnodes);
2201  if( scip->set->stage >= SCIP_STAGE_TRANSFORMED && scip->set->stage <= SCIP_STAGE_EXITSOLVE )
2202  {
2203  if( objlimitreached )
2204  {
2205  SCIPmessagePrintInfo(scip->messagehdlr, "Primal Bound : %+.14e (objective limit, %" SCIP_LONGINT_FORMAT " solutions",
2206  SCIPgetPrimalbound(scip), scip->primal->nsolsfound);
2207  if( scip->primal->nsolsfound > 0 )
2208  {
2209  SCIPmessagePrintInfo(scip->messagehdlr, ", best solution %+.14e", SCIPgetSolOrigObj(scip, SCIPgetBestSol(scip)));
2210  }
2211  SCIPmessagePrintInfo(scip->messagehdlr, ")\n");
2212  }
2213  else
2214  {
2215  char limsolstring[SCIP_MAXSTRLEN];
2216  if( scip->primal->nsolsfound != scip->primal->nlimsolsfound )
2217  (void) SCIPsnprintf(limsolstring, SCIP_MAXSTRLEN, ", %" SCIP_LONGINT_FORMAT " respecting the objective limit", scip->primal->nlimsolsfound);
2218  else
2219  (void) SCIPsnprintf(limsolstring, SCIP_MAXSTRLEN,"");
2220 
2221  SCIPmessagePrintInfo(scip->messagehdlr, "Primal Bound : %+.14e (%" SCIP_LONGINT_FORMAT " solutions%s)\n",
2222  SCIPgetPrimalbound(scip), scip->primal->nsolsfound, limsolstring);
2223  }
2224  }
2225  if( scip->set->stage >= SCIP_STAGE_SOLVING && scip->set->stage <= SCIP_STAGE_SOLVED )
2226  {
2227  SCIPmessagePrintInfo(scip->messagehdlr, "Dual Bound : %+.14e\n", SCIPgetDualbound(scip));
2228 
2229  SCIPmessagePrintInfo(scip->messagehdlr, "Gap : ");
2230  if( SCIPsetIsInfinity(scip->set, SCIPgetGap(scip)) )
2231  SCIPmessagePrintInfo(scip->messagehdlr, "infinite\n");
2232  else
2233  SCIPmessagePrintInfo(scip->messagehdlr, "%.2f %%\n", 100.0*SCIPgetGap(scip));
2234  }
2235 
2236  /* check solution for feasibility in original problem */
2237  if( scip->set->stage >= SCIP_STAGE_TRANSFORMED )
2238  {
2239  SCIP_SOL* sol;
2240 
2241  sol = SCIPgetBestSol(scip);
2242  if( sol != NULL )
2243  {
2244  SCIP_Real checkfeastolfac;
2245  SCIP_Real oldfeastol;
2246  SCIP_Bool dispallviols;
2247  SCIP_Bool feasible;
2248 
2249  oldfeastol = SCIPfeastol(scip);
2250  SCIP_CALL( SCIPgetRealParam(scip, "numerics/checkfeastolfac", &checkfeastolfac) );
2251  SCIP_CALL( SCIPgetBoolParam(scip, "display/allviols", &dispallviols) );
2252 
2253  /* scale feasibility tolerance by set->num_checkfeastolfac */
2254  if( !SCIPisEQ(scip, checkfeastolfac, 1.0) )
2255  {
2256  SCIP_CALL( SCIPchgFeastol(scip, oldfeastol * checkfeastolfac) );
2257  }
2258 
2259  SCIP_CALL( SCIPcheckSolOrig(scip, sol, &feasible, TRUE, dispallviols) );
2260 
2261  /* restore old feasibilty tolerance */
2262  if( !SCIPisEQ(scip, checkfeastolfac, 1.0) )
2263  {
2264  SCIP_CALL( SCIPchgFeastol(scip, oldfeastol) );
2265  }
2266 
2267  if( !feasible )
2268  {
2269  SCIPmessagePrintInfo(scip->messagehdlr, "best solution is not feasible in original problem\n");
2270  }
2271  }
2272  }
2273  }
2274 
2275  return SCIP_OKAY;
2276 }
2277 
2278 /** calls compression based on the reoptimization structure after the presolving */
2279 static
2281  SCIP* scip /**< global SCIP settings */
2282  )
2283 {
2284  SCIP_RESULT result;
2285  int c;
2286  int noldnodes;
2287  int nnewnodes;
2288 
2289  result = SCIP_DIDNOTFIND;
2290 
2291  noldnodes = SCIPreoptGetNNodes(scip->reopt, scip->tree->root);
2292 
2293  /* do not run if there exists only the root node */
2294  if( noldnodes <= 1 )
2295  return SCIP_OKAY;
2296 
2297  /* do not run a tree compression if the problem contains (implicit) integer variables */
2298  if( scip->transprob->nintvars > 0 || scip->transprob->nimplvars > 0 )
2299  return SCIP_OKAY;
2300 
2302  "tree compression:\n");
2304  " given tree has %d nodes.\n", noldnodes);
2305 
2306  /* sort compressions by priority */
2307  SCIPsetSortComprs(scip->set);
2308 
2309  for(c = 0; c < scip->set->ncomprs; c++)
2310  {
2311  assert(result == SCIP_DIDNOTFIND || result == SCIP_DIDNOTRUN);
2312 
2313  /* call tree compression technique */
2314  SCIP_CALL( SCIPcomprExec(scip->set->comprs[c], scip->set, scip->reopt, &result) );
2315 
2316  if( result == SCIP_SUCCESS )
2317  {
2318  nnewnodes = SCIPreoptGetNNodes(scip->reopt, scip->tree->root);
2320  " <%s> compressed the search tree to %d nodes (rate %g).\n", SCIPcomprGetName(scip->set->comprs[c]),
2321  nnewnodes, ((SCIP_Real)nnewnodes)/noldnodes);
2322 
2323  break;
2324  }
2325  }
2326 
2327  if( result != SCIP_SUCCESS )
2328  {
2329  assert(result == SCIP_DIDNOTFIND || result == SCIP_DIDNOTRUN);
2331  " search tree could not be compressed.\n");
2332  }
2333 
2334  return SCIP_OKAY;
2335 }
2336 
2337 /* prepare all plugins and data structures for a reoptimization run */
2338 static
2340  SCIP* scip /**< SCIP data structure */
2341  )
2342 {
2343  SCIP_Bool reoptrestart;
2344 
2345  assert(scip != NULL);
2346  assert(scip->set->reopt_enable);
2347 
2348  /* @ todo: we could check if the problem is feasible, eg, by backtracking */
2349 
2350  /* increase number of reopt_runs */
2351  ++scip->stat->nreoptruns;
2352 
2353  /* inform the reoptimization plugin that a new iteration starts */
2354  SCIP_CALL( SCIPreoptAddRun(scip->reopt, scip->set, scip->mem->probmem, scip->origprob->vars,
2355  scip->origprob->nvars, scip->set->limit_maxsol) );
2356 
2357  /* check whether we need to add globally valid constraints */
2358  if( scip->set->reopt_sepaglbinfsubtrees || scip->set->reopt_sepabestsol )
2359  {
2360  SCIP_CALL( SCIPreoptApplyGlbConss(scip, scip->reopt, scip->set, scip->stat, scip->mem->probmem) );
2361  }
2362 
2363  /* after presolving the problem the first time we remember all global bounds and active constraints. bounds and
2364  * constraints will be restored within SCIPreoptInstallBounds() and SCIPreoptResetActiveConss().
2365  */
2366  if( scip->stat->nreoptruns == 1 )
2367  {
2368  assert(scip->set->stage == SCIP_STAGE_PRESOLVED || scip->set->stage == SCIP_STAGE_SOLVED);
2369 
2370  SCIP_CALL( SCIPreoptSaveGlobalBounds(scip->reopt, scip->transprob, scip->mem->probmem) );
2371 
2372  SCIP_CALL( SCIPreoptSaveActiveConss(scip->reopt, scip->set, scip->transprob, scip->mem->probmem) );
2373  }
2374  /* we are at least in the second run */
2375  else
2376  {
2377  assert(scip->transprob != NULL);
2378 
2379  SCIP_CALL( SCIPreoptMergeVarHistory(scip->reopt, scip->set, scip->stat, scip->origprob->vars, scip->origprob->nvars) );
2380 
2381  SCIP_CALL( SCIPrelaxationCreate(&scip->relaxation, scip->mem->probmem, scip->set, scip->stat, scip->primal,
2382  scip->tree) );
2383 
2384  /* mark statistics before solving */
2385  SCIPstatMark(scip->stat);
2386 
2388 
2389  SCIP_CALL( SCIPreoptResetActiveConss(scip->reopt, scip->set, scip->stat) );
2390 
2391  /* check whether we want to restart the tree search */
2392  SCIP_CALL( SCIPreoptCheckRestart(scip->reopt, scip->set, scip->mem->probmem, NULL, scip->transprob->vars,
2393  scip->transprob->nvars, &reoptrestart) );
2394 
2395  /* call initialization methods of plugins */
2396  SCIP_CALL( SCIPsetInitPlugins(scip->set, scip->mem->probmem, scip->stat) );
2397 
2398  /* install globally valid lower and upper bounds */
2399  SCIP_CALL( SCIPreoptInstallBounds(scip->reopt, scip->set, scip->stat, scip->transprob, scip->lp, scip->branchcand,
2400  scip->eventqueue, scip->cliquetable, scip->mem->probmem) );
2401 
2402  /* check, whether objective value is always integral by inspecting the problem, if it is the case adjust the
2403  * cutoff bound if primal solution is already known
2404  */
2405  SCIP_CALL( SCIPprobCheckObjIntegral(scip->transprob, scip->origprob, scip->mem->probmem, scip->set, scip->stat,
2406  scip->primal, scip->tree, scip->reopt, scip->lp, scip->eventfilter, scip->eventqueue) );
2407 
2408  /* if possible, scale objective function such that it becomes integral with gcd 1 */
2409  SCIP_CALL( SCIPprobScaleObj(scip->transprob, scip->origprob, scip->mem->probmem, scip->set, scip->stat, scip->primal,
2410  scip->tree, scip->reopt, scip->lp, scip->eventfilter, scip->eventqueue) );
2411 
2413  }
2414 
2415  /* try to compress the search tree */
2416  if( scip->set->compr_enable )
2417  {
2418  SCIP_CALL( compressReoptTree(scip) );
2419  }
2420 
2421  return SCIP_OKAY;
2422 }
2423 
2424 /** transforms and presolves problem
2425  *
2426  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
2427  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
2428  *
2429  * @pre This method can be called if @p scip is in one of the following stages:
2430  * - \ref SCIP_STAGE_PROBLEM
2431  * - \ref SCIP_STAGE_TRANSFORMED
2432  * - \ref SCIP_STAGE_PRESOLVING
2433  * - \ref SCIP_STAGE_PRESOLVED
2434  * - \ref SCIP_STAGE_SOLVED
2435  *
2436  * @post After calling this method \SCIP reaches one of the following stages:
2437  * - \ref SCIP_STAGE_PRESOLVING if the presolving process was interrupted
2438  * - \ref SCIP_STAGE_PRESOLVED if the presolving process was finished and did not solve the problem
2439  * - \ref SCIP_STAGE_SOLVED if the problem was solved during presolving
2440  *
2441  * See \ref SCIP_Stage "SCIP_STAGE" for a complete list of all possible solving stages.
2442  */
2444  SCIP* scip /**< SCIP data structure */
2445  )
2446 {
2447  SCIP_Bool unbounded;
2448  SCIP_Bool infeasible;
2449  SCIP_Bool vanished;
2450  SCIP_RETCODE retcode;
2451 
2452  SCIP_CALL( SCIPcheckStage(scip, "SCIPpresolve", FALSE, TRUE, FALSE, TRUE, FALSE, TRUE, FALSE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE) );
2453 
2454  /* start solving timer */
2455  SCIPclockStart(scip->stat->solvingtime, scip->set);
2456  SCIPclockStart(scip->stat->solvingtimeoverall, scip->set);
2457 
2458  /* capture the CTRL-C interrupt */
2459  if( scip->set->misc_catchctrlc )
2461 
2462  /* reset the user interrupt flag */
2463  scip->stat->userinterrupt = FALSE;
2464  SCIP_CALL( SCIPinterruptLP(scip, FALSE) );
2465 
2466  switch( scip->set->stage )
2467  {
2468  case SCIP_STAGE_PROBLEM:
2469  /* initialize solving data structures and transform problem */
2470  retcode = SCIPtransformProb(scip);
2471  if( retcode != SCIP_OKAY )
2472  {
2473  SCIP_CALL( SCIPfreeTransform(scip) );
2474  return retcode;
2475  }
2476 
2477  assert(scip->set->stage == SCIP_STAGE_TRANSFORMED);
2478 
2479  /*lint -fallthrough*/
2480 
2482  case SCIP_STAGE_PRESOLVING:
2483  /* presolve problem */
2484  SCIP_CALL( presolve(scip, &unbounded, &infeasible, &vanished) );
2485  assert(scip->set->stage == SCIP_STAGE_PRESOLVED || scip->set->stage == SCIP_STAGE_PRESOLVING);
2486 
2487  if( infeasible || unbounded || vanished )
2488  {
2489  assert(scip->set->stage == SCIP_STAGE_PRESOLVED);
2490 
2491  /* initialize solving process data structures to be able to switch to SOLVED stage */
2492  SCIP_CALL( initSolve(scip, TRUE) );
2493 
2494  /* switch stage to SOLVED */
2495  scip->set->stage = SCIP_STAGE_SOLVED;
2496 
2497  /* print solution message */
2498  switch( scip->stat->status )/*lint --e{788}*/
2499  {
2500  case SCIP_STATUS_OPTIMAL:
2501  /* remove the root node from the tree, s.t. the lower bound is set to +infinity ???????????? (see initSolve())*/
2502  SCIP_CALL( SCIPtreeClear(scip->tree, scip->mem->probmem, scip->set, scip->stat, scip->eventfilter, scip->eventqueue, scip->lp) );
2503  break;
2504 
2507  "presolving detected infeasibility\n");
2508  break;
2509 
2510  case SCIP_STATUS_UNBOUNDED:
2512  "presolving detected unboundedness\n");
2513  break;
2514 
2515  case SCIP_STATUS_INFORUNBD:
2517  "presolving detected unboundedness (or infeasibility)\n");
2518  break;
2519 
2520  default:
2521  /* note that this is in an internal SCIP error since the status is corrupted */
2522  SCIPerrorMessage("invalid SCIP status <%d>\n", scip->stat->status);
2523  SCIPABORT();
2524  return SCIP_ERROR; /*lint !e527*/
2525  }
2526  }
2527  else if( scip->set->stage == SCIP_STAGE_PRESOLVED )
2528  {
2529  int h;
2530 
2531  /* print presolved problem statistics */
2533  "presolved problem has %d variables (%d bin, %d int, %d impl, %d cont) and %d constraints\n",
2534  scip->transprob->nvars, scip->transprob->nbinvars, scip->transprob->nintvars, scip->transprob->nimplvars,
2535  scip->transprob->ncontvars, scip->transprob->nconss);
2536 
2537  for( h = 0; h < scip->set->nconshdlrs; ++h )
2538  {
2539  int nactiveconss;
2540 
2541  nactiveconss = SCIPconshdlrGetNActiveConss(scip->set->conshdlrs[h]);
2542  if( nactiveconss > 0 )
2543  {
2545  "%7d constraints of type <%s>\n", nactiveconss, SCIPconshdlrGetName(scip->set->conshdlrs[h]));
2546  }
2547  }
2548 
2549  if( SCIPprobIsObjIntegral(scip->transprob) )
2550  {
2552  "transformed objective value is always integral (scale: %.15g)\n", scip->transprob->objscale);
2553  }
2554  }
2555  else
2556  {
2557  assert(scip->set->stage == SCIP_STAGE_PRESOLVING);
2558  SCIPmessagePrintVerbInfo(scip->messagehdlr, scip->set->disp_verblevel, SCIP_VERBLEVEL_HIGH, "presolving was interrupted.\n");
2559  }
2560 
2561  /* display timing statistics */
2563  "Presolving Time: %.2f\n", SCIPclockGetTime(scip->stat->presolvingtime));
2564  break;
2565 
2566  case SCIP_STAGE_PRESOLVED:
2567  case SCIP_STAGE_SOLVED:
2568  break;
2569 
2570  default:
2571  SCIPerrorMessage("invalid SCIP stage <%d>\n", scip->set->stage);
2572  return SCIP_INVALIDCALL;
2573  } /*lint !e788*/
2574 
2575  /* release the CTRL-C interrupt */
2576  if( scip->set->misc_catchctrlc )
2578 
2579  /* stop solving timer */
2580  SCIPclockStop(scip->stat->solvingtime, scip->set);
2581  SCIPclockStop(scip->stat->solvingtimeoverall, scip->set);
2582 
2583  if( scip->set->stage == SCIP_STAGE_SOLVED )
2584  {
2585  /* display most relevant statistics */
2587  }
2588 
2589  return SCIP_OKAY;
2590 }
2591 
2592 /** transforms, presolves, and solves problem
2593  *
2594  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
2595  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
2596  *
2597  * @pre This method can be called if @p scip is in one of the following stages:
2598  * - \ref SCIP_STAGE_PROBLEM
2599  * - \ref SCIP_STAGE_TRANSFORMED
2600  * - \ref SCIP_STAGE_PRESOLVING
2601  * - \ref SCIP_STAGE_PRESOLVED
2602  * - \ref SCIP_STAGE_SOLVING
2603  * - \ref SCIP_STAGE_SOLVED
2604  *
2605  * @post After calling this method \SCIP reaches one of the following stages depending on if and when the solution
2606  * process was interrupted:
2607  * - \ref SCIP_STAGE_PRESOLVING if the solution process was interrupted during presolving
2608  * - \ref SCIP_STAGE_SOLVING if the solution process was interrupted during the tree search
2609  * - \ref SCIP_STAGE_SOLVED if the solving process was not interrupted
2610  *
2611  * See \ref SCIP_Stage "SCIP_STAGE" for a complete list of all possible solving stages.
2612  */
2614  SCIP* scip /**< SCIP data structure */
2615  )
2616 {
2617  SCIP_Bool statsprinted = FALSE;
2618  SCIP_Bool restart;
2619 
2620  SCIP_CALL( SCIPcheckStage(scip, "SCIPsolve", FALSE, TRUE, FALSE, TRUE, FALSE, TRUE, FALSE, TRUE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE) );
2621 
2622  /* if the stage is already SCIP_STAGE_SOLVED do nothing */
2623  if( scip->set->stage == SCIP_STAGE_SOLVED )
2624  return SCIP_OKAY;
2625 
2627  {
2628  SCIPwarningMessage(scip, "SCIPsolve() was called, but problem is already solved\n");
2629  return SCIP_OKAY;
2630  }
2631 
2632  /* check, if a node selector exists */
2633  if( SCIPsetGetNodesel(scip->set, scip->stat) == NULL )
2634  {
2635  SCIPerrorMessage("no node selector available\n");
2636  return SCIP_PLUGINNOTFOUND;
2637  }
2638 
2639  /* check, if an integrality constraint handler exists if there are integral variables */
2640  if( (SCIPgetNBinVars(scip) >= 0 || SCIPgetNIntVars(scip) >= 0) && SCIPfindConshdlr(scip, "integral") == NULL )
2641  {
2642  SCIPwarningMessage(scip, "integrality constraint handler not available\n");
2643  }
2644 
2645  /* initialize presolving flag (may be modified in SCIPpresolve()) */
2646  scip->stat->performpresol = FALSE;
2647 
2648  /* if a decomposition exists and Benders' decomposition has been enabled, then a decomposition is performed */
2650  && scip->set->decomp_applybenders && SCIPgetNActiveBenders(scip) == 0 )
2651  {
2652  int decompindex = 0;
2653 
2654  /* applying the Benders' decomposition */
2655  SCIP_CALL( SCIPapplyBendersDecomposition(scip, decompindex) );
2656  }
2657 
2658  /* start solving timer */
2659  SCIPclockStart(scip->stat->solvingtime, scip->set);
2660  SCIPclockStart(scip->stat->solvingtimeoverall, scip->set);
2661 
2662  /* capture the CTRL-C interrupt */
2663  if( scip->set->misc_catchctrlc )
2665 
2666  /* reset the user interrupt flag */
2667  scip->stat->userinterrupt = FALSE;
2668  SCIP_CALL( SCIPinterruptLP(scip, FALSE) );
2669 
2670  /* automatic restarting loop */
2671  restart = scip->stat->userrestart;
2672 
2673  do
2674  {
2675  if( restart )
2676  {
2677  /* free the solving process data in order to restart */
2678  assert(scip->set->stage == SCIP_STAGE_SOLVING);
2679  if( scip->stat->userrestart )
2681  "(run %d, node %" SCIP_LONGINT_FORMAT ") performing user restart\n",
2682  scip->stat->nruns, scip->stat->nnodes);
2683  else
2685  "(run %d, node %" SCIP_LONGINT_FORMAT ") restarting after %d global fixings of integer variables\n",
2686  scip->stat->nruns, scip->stat->nnodes, scip->stat->nrootintfixingsrun);
2687  /* an extra blank line should be printed separately since the buffer message handler only handles up to one line
2688  * correctly */
2690  /* reset relaxation solution, so that the objective value is recomputed from scratch next time, using the new
2691  * fixings which may be produced during the presolving after the restart */
2693 
2694  SCIP_CALL( freeSolve(scip, TRUE) );
2695  assert(scip->set->stage == SCIP_STAGE_TRANSFORMED);
2696  }
2697  restart = FALSE;
2698  scip->stat->userrestart = FALSE;
2699 
2700  switch( scip->set->stage )
2701  {
2702  case SCIP_STAGE_PROBLEM:
2704  case SCIP_STAGE_PRESOLVING:
2705  /* initialize solving data structures, transform and problem */
2706 
2707  SCIP_CALL( SCIPpresolve(scip) );
2708  /* remember that we already printed the relevant statistics */
2709  if( scip->set->stage == SCIP_STAGE_SOLVED )
2710  statsprinted = TRUE;
2711 
2712  if( scip->set->stage == SCIP_STAGE_SOLVED || scip->set->stage == SCIP_STAGE_PRESOLVING )
2713  {
2714  if ( scip->set->reopt_enable )
2715  {
2717  }
2718  break;
2719  }
2720  assert(scip->set->stage == SCIP_STAGE_PRESOLVED);
2721 
2722  if( SCIPsolveIsStopped(scip->set, scip->stat, FALSE) )
2723  break;
2724  /*lint -fallthrough*/
2725 
2726  case SCIP_STAGE_PRESOLVED:
2727  /* check if reoptimization is enabled and global constraints are saved */
2728  if( scip->set->reopt_enable )
2729  {
2731  }
2732 
2733  /* initialize solving process data structures */
2734  SCIP_CALL( initSolve(scip, FALSE) );
2735  assert(scip->set->stage == SCIP_STAGE_SOLVING);
2737 
2738  /*lint -fallthrough*/
2739 
2740  case SCIP_STAGE_SOLVING:
2741  /* reset display */
2742  SCIPstatResetDisplay(scip->stat);
2743 
2744  /* continue solution process */
2745  SCIP_CALL( SCIPsolveCIP(scip->mem->probmem, scip->set, scip->messagehdlr, scip->stat, scip->mem, scip->origprob, scip->transprob,
2746  scip->primal, scip->tree, scip->reopt, scip->lp, scip->relaxation, scip->pricestore, scip->sepastore,
2747  scip->cutpool, scip->delayedcutpool, scip->branchcand, scip->conflict, scip->conflictstore,
2748  scip->eventfilter, scip->eventqueue, scip->cliquetable, &restart) );
2749 
2750  /* detect, whether problem is solved */
2751  if( SCIPtreeGetNNodes(scip->tree) == 0 && SCIPtreeGetCurrentNode(scip->tree) == NULL )
2752  {
2753  assert(scip->stat->status == SCIP_STATUS_OPTIMAL
2754  || scip->stat->status == SCIP_STATUS_INFEASIBLE
2755  || scip->stat->status == SCIP_STATUS_UNBOUNDED
2756  || scip->stat->status == SCIP_STATUS_INFORUNBD);
2757  assert(!restart);
2758 
2759  /* tree is empty, and no current node exists -> problem is solved */
2760  scip->set->stage = SCIP_STAGE_SOLVED;
2761  }
2762  break;
2763 
2764  case SCIP_STAGE_SOLVED:
2765  assert(scip->stat->status == SCIP_STATUS_OPTIMAL
2766  || scip->stat->status == SCIP_STATUS_INFEASIBLE
2767  || scip->stat->status == SCIP_STATUS_UNBOUNDED
2768  || scip->stat->status == SCIP_STATUS_INFORUNBD);
2769 
2770  break;
2771 
2772  default:
2773  SCIPerrorMessage("invalid SCIP stage <%d>\n", scip->set->stage);
2774  return SCIP_INVALIDCALL;
2775  } /*lint !e788*/
2776  }
2777  while( restart && !SCIPsolveIsStopped(scip->set, scip->stat, TRUE) );
2778 
2779  /* we have to store all unprocessed nodes if reoptimization is enabled */
2780  if( scip->set->reopt_enable && scip->set->stage != SCIP_STAGE_PRESOLVING
2781  && SCIPsolveIsStopped(scip->set, scip->stat, TRUE) )
2782  {
2783  /* save unprocessed nodes */
2784  if( SCIPgetNNodesLeft(scip) > 0 )
2785  {
2786  SCIP_NODE** leaves;
2787  SCIP_NODE** children;
2788  SCIP_NODE** siblings;
2789  int nleaves;
2790  int nchildren;
2791  int nsiblings;
2792 
2793  /* get all open leave nodes */
2794  SCIP_CALL( SCIPgetLeaves(scip, &leaves, &nleaves) );
2795 
2796  /* get all open children nodes */
2797  SCIP_CALL( SCIPgetChildren(scip, &children, &nchildren) );
2798 
2799  /* get all open sibling nodes */
2800  SCIP_CALL( SCIPgetSiblings(scip, &siblings, &nsiblings) );
2801 
2802  /* add all open node to the reoptimization tree */
2803  SCIP_CALL( SCIPreoptSaveOpenNodes(scip->reopt, scip->set, scip->lp, scip->mem->probmem, leaves, nleaves,
2804  children, nchildren, siblings, nsiblings) );
2805  }
2806  }
2807 
2808  /* release the CTRL-C interrupt */
2809  if( scip->set->misc_catchctrlc )
2811 
2812  if( scip->set->reopt_enable )
2813  {
2814  /* save found solutions */
2815  int nsols;
2816  int s;
2817 
2818  nsols = scip->set->reopt_savesols == -1 ? INT_MAX : MAX(scip->set->reopt_savesols, 1);
2819  nsols = MIN(scip->primal->nsols, nsols);
2820 
2821  for( s = 0; s < nsols; s++ )
2822  {
2823  SCIP_SOL* sol;
2824  SCIP_Bool added;
2825 
2826  sol = scip->primal->sols[s];
2827  assert(sol != NULL);
2828 
2829  if( !SCIPsolIsOriginal(sol) )
2830  {
2831  SCIP_Bool hasinfval;
2832 
2833  /* retransform solution into the original problem space */
2834  SCIP_CALL( SCIPsolRetransform(sol, scip->set, scip->stat, scip->origprob, scip->transprob, &hasinfval) );
2835  }
2836 
2837  if( SCIPsolGetNodenum(sol) > 0 || SCIPsolGetHeur(sol) != NULL || (s == 0 && scip->set->reopt_sepabestsol) )
2838  {
2839  /* if the best solution should be separated, we must not store it in the solution tree */
2840  if( s == 0 && scip->set->reopt_sepabestsol )
2841  {
2842  SCIP_CALL( SCIPreoptAddOptSol(scip->reopt, sol, scip->mem->probmem, scip->set, scip->stat, scip->origprimal,
2843  scip->origprob->vars, scip->origprob->nvars) );
2844  }
2845  /* add solution to solution tree */
2846  else
2847  {
2848  SCIPdebugMsg(scip, "try to add solution to the solution tree:\n");
2849  SCIPdebug( SCIP_CALL( SCIPsolPrint(sol, scip->set, scip->messagehdlr, scip->stat, scip->origprob, \
2850  scip->transprob, NULL, FALSE, FALSE) ); );
2851 
2852  SCIP_CALL( SCIPreoptAddSol(scip->reopt, scip->set, scip->stat, scip->origprimal, scip->mem->probmem,
2853  sol, s == 0, &added, scip->origprob->vars, scip->origprob->nvars, scip->stat->nreoptruns) );
2854  }
2855  }
2856  }
2857 
2858  SCIPdebugMsg(scip, "-> saved %d solution.\n", nsols);
2859 
2860  /* store variable history */
2861  if( scip->set->reopt_storevarhistory )
2862  {
2863  SCIP_CALL( SCIPreoptUpdateVarHistory(scip->reopt, scip->set, scip->stat, scip->mem->probmem,
2864  scip->origprob->vars, scip->origprob->nvars) );
2865  }
2866  }
2867 
2868  /* stop solving timer */
2869  SCIPclockStop(scip->stat->solvingtime, scip->set);
2870  SCIPclockStop(scip->stat->solvingtimeoverall, scip->set);
2871 
2872  /* decrease time limit during reoptimization */
2873  if( scip->set->reopt_enable && scip->set->reopt_commontimelimit )
2874  {
2875  SCIP_Real timelimit;
2876  SCIP_Real usedtime;
2877 
2878  SCIP_CALL( SCIPgetRealParam(scip, "limits/time", &timelimit) );
2879  usedtime = SCIPgetSolvingTime(scip);
2880  timelimit = timelimit - usedtime;
2881  timelimit = MAX(0, timelimit);
2882 
2883  SCIP_CALL( SCIPsetRealParam(scip, "limits/time", timelimit) );
2884  }
2885 
2886  if( !statsprinted )
2887  {
2888  /* display most relevant statistics */
2890  }
2891 
2892  return SCIP_OKAY;
2893 }
2894 
2895 /** transforms, presolves, and solves problem using the configured concurrent solvers
2896  *
2897  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
2898  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
2899  *
2900  * @pre This method can be called if @p scip is in one of the following stages:
2901  * - \ref SCIP_STAGE_PROBLEM
2902  * - \ref SCIP_STAGE_TRANSFORMED
2903  * - \ref SCIP_STAGE_PRESOLVING
2904  * - \ref SCIP_STAGE_PRESOLVED
2905  * - \ref SCIP_STAGE_SOLVING
2906  * - \ref SCIP_STAGE_SOLVED
2907  *
2908  * @post After calling this method \SCIP reaches one of the following stages depending on if and when the solution
2909  * process was interrupted:
2910  * - \ref SCIP_STAGE_PRESOLVING if the solution process was interrupted during presolving
2911  * - \ref SCIP_STAGE_SOLVING if the solution process was interrupted during the tree search
2912  * - \ref SCIP_STAGE_SOLVED if the solving process was not interrupted
2913  *
2914  * See \ref SCIP_Stage "SCIP_STAGE" for a complete list of all possible solving stages.
2915  *
2916  * @deprecated Please use SCIPsolveConcurrent() instead.
2917  */
2919  SCIP* scip /**< SCIP data structure */
2920  )
2921 {
2922  SCIP_CALL( SCIPcheckStage(scip, "SCIPsolveParallel", FALSE, TRUE, FALSE, TRUE, FALSE, TRUE, FALSE, TRUE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE) );
2923 
2924  return SCIPsolveConcurrent(scip);
2925 }
2926 
2927 /** transforms, presolves, and solves problem using the configured concurrent solvers
2928  *
2929  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
2930  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
2931  *
2932  * @pre This method can be called if @p scip is in one of the following stages:
2933  * - \ref SCIP_STAGE_PROBLEM
2934  * - \ref SCIP_STAGE_TRANSFORMED
2935  * - \ref SCIP_STAGE_PRESOLVING
2936  * - \ref SCIP_STAGE_PRESOLVED
2937  * - \ref SCIP_STAGE_SOLVING
2938  * - \ref SCIP_STAGE_SOLVED
2939  *
2940  * @post After calling this method \SCIP reaches one of the following stages depending on if and when the solution
2941  * process was interrupted:
2942  * - \ref SCIP_STAGE_PRESOLVING if the solution process was interrupted during presolving
2943  * - \ref SCIP_STAGE_SOLVING if the solution process was interrupted during the tree search
2944  * - \ref SCIP_STAGE_SOLVED if the solving process was not interrupted
2945  *
2946  * See \ref SCIP_Stage "SCIP_STAGE" for a complete list of all possible solving stages.
2947  */
2949  SCIP* scip /**< SCIP data structure */
2950  )
2951 {
2952 #ifdef TPI_NONE
2953  SCIPinfoMessage(scip, NULL, "SCIP was compiled without task processing interface. Parallel solve not possible\n");
2954  return SCIP_OKAY;
2955 #else
2956  SCIP_RETCODE retcode;
2957  int i;
2958  SCIP_RANDNUMGEN* rndgen;
2959  int minnthreads;
2960  int maxnthreads;
2961 
2962  SCIP_CALL( SCIPcheckStage(scip, "SCIPsolveConcurrent", FALSE, TRUE, FALSE, TRUE, FALSE, TRUE, FALSE, TRUE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE) );
2963 
2964  SCIP_CALL( SCIPsetIntParam(scip, "timing/clocktype", SCIP_CLOCKTYPE_WALL) );
2965 
2966  minnthreads = scip->set->parallel_minnthreads;
2967  maxnthreads = scip->set->parallel_maxnthreads;
2968 
2969  if( minnthreads > maxnthreads )
2970  {
2971  SCIPerrorMessage("minimum number of threads greater than maximum number of threads\n");
2972  return SCIP_INVALIDDATA;
2973  }
2974  if( scip->concurrent == NULL )
2975  {
2976  int nconcsolvertypes;
2977  SCIP_CONCSOLVERTYPE** concsolvertypes;
2978  SCIP_Longint nthreads;
2979  SCIP_Real memorylimit;
2980  int* solvertypes;
2981  SCIP_Longint* weights;
2982  SCIP_Real* prios;
2983  int ncandsolvertypes;
2984  SCIP_Real prefpriosum;
2985 
2986  /* check if concurrent solve is configured to presolve the problem
2987  * before setting up the concurrent solvers
2988  */
2989  if( scip->set->concurrent_presolvebefore )
2990  {
2991  /* if yes, then presolve the problem */
2992  SCIP_CALL( SCIPpresolve(scip) );
2993  if( SCIPgetStatus(scip) >= SCIP_STATUS_OPTIMAL )
2994  return SCIP_OKAY;
2995  }
2996  else
2997  {
2998  SCIP_Bool infeas;
2999 
3000  /* if not, transform the problem and switch stage to presolved */
3001  SCIP_CALL( SCIPtransformProb(scip) );
3002  SCIP_CALL( initPresolve(scip) );
3003  SCIP_CALL( exitPresolve(scip, TRUE, &infeas) );
3004  assert(!infeas);
3005  }
3006 
3007  /* the presolving must have run into a limit, so we stop here */
3008  if( scip->set->stage < SCIP_STAGE_PRESOLVED )
3009  {
3011  return SCIP_OKAY;
3012  }
3013 
3014  nthreads = INT_MAX;
3015  /* substract the memory already used by the main SCIP and the estimated memory usage of external software */
3016  memorylimit = scip->set->limit_memory;
3017  if( memorylimit < SCIP_MEM_NOLIMIT )
3018  {
3019  memorylimit -= SCIPgetMemUsed(scip)/1048576.0;
3020  memorylimit -= SCIPgetMemExternEstim(scip)/1048576.0;
3021  /* estimate maximum number of copies that be created based on memory limit */
3022  if( !scip->set->misc_avoidmemout )
3023  {
3024  nthreads = MAX(1, memorylimit / (4.0*SCIPgetMemExternEstim(scip)/1048576.0));
3025  SCIPverbMessage(scip, SCIP_VERBLEVEL_FULL, NULL, "estimated a maximum of %lli threads based on memory limit\n", nthreads);
3026  }
3027  else
3028  {
3029  nthreads = minnthreads;
3030  SCIPverbMessage(scip, SCIP_VERBLEVEL_FULL, NULL, "ignoring memory limit; all threads can be created\n");
3031  }
3032  }
3033  nconcsolvertypes = SCIPgetNConcsolverTypes(scip);
3034  concsolvertypes = SCIPgetConcsolverTypes(scip);
3035 
3036  if( minnthreads > nthreads )
3037  {
3038  SCIP_CALL( initSolve(scip, TRUE) );
3039  scip->stat->status = SCIP_STATUS_MEMLIMIT;
3041  SCIPwarningMessage(scip, "requested minimum number of threads could not be satisfied with given memory limit\n");
3043  return SCIP_OKAY;
3044  }
3045 
3046  if( nthreads == 1 )
3047  {
3048  SCIPwarningMessage(scip, "can only use 1 thread, doing sequential solve instead\n");
3049  SCIP_CALL( SCIPfreeConcurrent(scip) );
3050  return SCIPsolve(scip);
3051  }
3052  nthreads = MIN(nthreads, maxnthreads);
3053  SCIPverbMessage(scip, SCIP_VERBLEVEL_FULL, NULL, "using %lli threads for concurrent solve\n", nthreads);
3054 
3055  /* now set up nthreads many concurrent solvers that will be used for the concurrent solve
3056  * using the preferred priorities of each concurrent solver
3057  */
3058  prefpriosum = 0.0;
3059  for( i = 0; i < nconcsolvertypes; ++i )
3060  prefpriosum += SCIPconcsolverTypeGetPrefPrio(concsolvertypes[i]);
3061 
3062  ncandsolvertypes = 0;
3063  SCIP_CALL( SCIPallocBufferArray(scip, &solvertypes, nthreads + nconcsolvertypes) );
3064  SCIP_CALL( SCIPallocBufferArray(scip, &weights, nthreads + nconcsolvertypes) );
3065  SCIP_CALL( SCIPallocBufferArray(scip, &prios, nthreads + nconcsolvertypes) );
3066  for( i = 0; i < nconcsolvertypes; ++i )
3067  {
3068  int j;
3069  SCIP_Real prio;
3070  prio = nthreads * SCIPconcsolverTypeGetPrefPrio(concsolvertypes[i]) / prefpriosum;
3071  while( prio > 0.0 )
3072  {
3073  j = ncandsolvertypes++;
3074  assert(j < 2*nthreads);
3075  weights[j] = 1;
3076  solvertypes[j] = i;
3077  prios[j] = MIN(1.0, prio);
3078  prio = prio - 1.0;
3079  }
3080  }
3081  /* select nthreads many concurrent solver types to create instances
3082  * according to the preferred prioriteis the user has set
3083  * This basically corresponds to a knapsack problem
3084  * with unit weights and capacity nthreads, where the profits are
3085  * the unrounded fraction of the total number of threads to be used.
3086  */
3087  SCIPselectDownRealInt(prios, solvertypes, nthreads, ncandsolvertypes);
3088 
3089  SCIP_CALL( SCIPcreateRandom(scip, &rndgen, (unsigned) scip->set->concurrent_initseed, TRUE) );
3090  for( i = 0; i < nthreads; ++i )
3091  {
3092  SCIP_CONCSOLVER* concsolver;
3093 
3094  SCIP_CALL( SCIPconcsolverCreateInstance(scip->set, concsolvertypes[solvertypes[i]], &concsolver) );
3095  if( scip->set->concurrent_changeseeds && SCIPgetNConcurrentSolvers(scip) > 1 )
3096  SCIP_CALL( SCIPconcsolverInitSeeds(concsolver, SCIPrandomGetInt(rndgen, 0, INT_MAX)) );
3097  }
3098  SCIPfreeRandom(scip, &rndgen);
3099  SCIPfreeBufferArray(scip, &prios);
3100  SCIPfreeBufferArray(scip, &weights);
3101  SCIPfreeBufferArray(scip, &solvertypes);
3102 
3103  assert(SCIPgetNConcurrentSolvers(scip) == nthreads);
3104 
3105  SCIP_CALL( SCIPsyncstoreInit(scip) );
3106  }
3107 
3108  if( SCIPgetStage(scip) == SCIP_STAGE_PRESOLVED )
3109  {
3110  /* switch stage to solving */
3111  SCIP_CALL( initSolve(scip, TRUE) );
3112  }
3113 
3114  SCIPclockStart(scip->stat->solvingtime, scip->set);
3115  retcode = SCIPconcurrentSolve(scip);
3116  SCIPclockStop(scip->stat->solvingtime, scip->set);
3118 
3119  return retcode;
3120 #endif
3121 }
3122 
3123 /** include specific heuristics and branching rules for reoptimization
3124  *
3125  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
3126  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
3127  *
3128  * @pre This method can be called if @p scip is in one of the following stages:
3129  * - \ref SCIP_STAGE_PROBLEM
3130  */
3132  SCIP* scip, /**< SCIP data structure */
3133  SCIP_Bool enable /**< enable reoptimization (TRUE) or disable it (FALSE) */
3134  )
3135 {
3136  assert(scip != NULL);
3137 
3138  /* we want to skip if nothing has changed */
3139  if( (enable && scip->set->reopt_enable && scip->reopt != NULL)
3140  || (!enable && !scip->set->reopt_enable && scip->reopt == NULL) )
3141  return SCIP_OKAY;
3142 
3143  /* check stage and throw an error if we try to disable reoptimization during the solving process.
3144  *
3145  * @note the case that we will disable the reoptimization and have already performed presolving can only happen if
3146  * we are try to solve a general MIP
3147  *
3148  * @note this fix is only for the bugfix release 3.2.1, in the next major release reoptimization can be used for
3149  * general MIPs, too.
3150  */
3151  if( scip->set->stage > SCIP_STAGE_PROBLEM && !(!enable && scip->set->stage == SCIP_STAGE_PRESOLVED) )
3152  {
3153  SCIPerrorMessage("Reoptimization cannot be %s after starting the (pre)solving process.\n", enable ? "enabled" : "disabled");
3154  return SCIP_INVALIDCALL;
3155  }
3156 
3157  /* if the current stage is SCIP_STAGE_PROBLEM we have to include the heuristics and branching rule */
3158  if( scip->set->stage == SCIP_STAGE_PROBLEM || (!enable && scip->set->stage == SCIP_STAGE_PRESOLVED) )
3159  {
3160  /* initialize all reoptimization data structures */
3161  if( enable && scip->reopt == NULL )
3162  {
3163  /* set enable flag */
3164  scip->set->reopt_enable = enable;
3165 
3166  SCIP_CALL( SCIPreoptCreate(&scip->reopt, scip->set, scip->mem->probmem) );
3168  }
3169  /* disable all reoptimization plugins and free the structure if necessary */
3170  else if( (!enable && scip->reopt != NULL) || (!enable && scip->set->reopt_enable && scip->reopt == NULL) )
3171  {
3172  /* set enable flag */
3173  scip->set->reopt_enable = enable;
3174 
3175  if( scip->reopt != NULL )
3176  {
3177  SCIP_CALL( SCIPreoptFree(&(scip->reopt), scip->set, scip->origprimal, scip->mem->probmem) );
3178  assert(scip->reopt == NULL);
3179  }
3181  }
3182  }
3183  else
3184  {
3185  /* set enable flag */
3186  scip->set->reopt_enable = enable;
3187  }
3188 
3189  return SCIP_OKAY;
3190 }
3191 
3192 /** save bound change based on dual information in the reoptimization tree
3193  *
3194  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
3195  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
3196  *
3197  * @pre This method can be called if @p scip is in one of the following stages:
3198  * - \ref SCIP_STAGE_SOLVING
3199  * - \ref SCIP_STAGE_SOLVED
3200  */
3202  SCIP* scip, /**< SCIP data structure */
3203  SCIP_NODE* node, /**< node of the search tree */
3204  SCIP_VAR* var, /**< variable whose bound changed */
3205  SCIP_Real newbound, /**< new bound of the variable */
3206  SCIP_Real oldbound /**< old bound of the variable */
3207  )
3208 {
3209  SCIP_CALL( SCIPcheckStage(scip, "SCIPaddReoptDualBndchg", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE) );
3210 
3211  assert(SCIPsetIsFeasLT(scip->set, newbound, oldbound) || SCIPsetIsFeasGT(scip->set, newbound, oldbound));
3212 
3213  SCIP_CALL( SCIPreoptAddDualBndchg(scip->reopt, scip->set, scip->mem->probmem, node, var, newbound, oldbound) );
3214 
3215  return SCIP_OKAY;
3216 }
3217 
3218 /** returns the optimal solution of the last iteration or NULL of none exists */
3220  SCIP* scip /**< SCIP data structure */
3221  )
3222 {
3223  SCIP_SOL* sol;
3224 
3225  assert(scip != NULL);
3226 
3227  sol = NULL;
3228 
3229  if( scip->set->reopt_enable && scip->stat->nreoptruns > 1 )
3230  {
3231  sol = SCIPreoptGetLastBestSol(scip->reopt);
3232  }
3233 
3234  return sol;
3235 }
3236 
3237 /** returns the objective coefficent of a given variable in a previous iteration
3238  *
3239  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
3240  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
3241  *
3242  * @pre This method can be called if @p scip is in one of the following stages:
3243  * - \ref SCIP_STAGE_PRESOLVING
3244  * - \ref SCIP_STAGE_SOLVING
3245  */
3247  SCIP* scip, /**< SCIP data structure */
3248  SCIP_VAR* var, /**< variable */
3249  int run, /**< number of the run */
3250  SCIP_Real* objcoef /**< pointer to store the objective coefficient */
3251  )
3252 {
3253  assert(scip != NULL);
3254  assert(var != NULL);
3255  assert(0 < run && run <= scip->stat->nreoptruns);
3256 
3257  SCIP_CALL( SCIPcheckStage(scip, "SCIPgetReoptOldObjCoef", FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) );
3258 
3259  if( SCIPvarIsOriginal(var) )
3260  *objcoef = SCIPreoptGetOldObjCoef(scip->reopt, run, SCIPvarGetIndex(var));
3261  else
3262  {
3263  SCIP_VAR* origvar;
3264  SCIP_Real constant;
3265  SCIP_Real scalar;
3266 
3267  assert(SCIPvarIsActive(var));
3268 
3269  origvar = var;
3270  constant = 0.0;
3271  scalar = 1.0;
3272 
3273  SCIP_CALL( SCIPvarGetOrigvarSum(&origvar, &scalar, &constant) );
3274  assert(origvar != NULL);
3275  assert(SCIPvarIsOriginal(origvar));
3276 
3277  *objcoef = SCIPreoptGetOldObjCoef(scip->reopt, run, SCIPvarGetIndex(origvar));
3278  }
3279  return SCIP_OKAY;
3280 }
3281 
3282 /** frees branch and bound tree and all solution process data; statistics, presolving data and transformed problem is
3283  * preserved
3284  *
3285  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
3286  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
3287  *
3288  * @pre This method can be called if @p scip is in one of the following stages:
3289  * - \ref SCIP_STAGE_INIT
3290  * - \ref SCIP_STAGE_PROBLEM
3291  * - \ref SCIP_STAGE_TRANSFORMED
3292  * - \ref SCIP_STAGE_PRESOLVING
3293  * - \ref SCIP_STAGE_PRESOLVED
3294  * - \ref SCIP_STAGE_SOLVING
3295  * - \ref SCIP_STAGE_SOLVED
3296  *
3297  * @post If this method is called in \SCIP stage \ref SCIP_STAGE_INIT or \ref SCIP_STAGE_PROBLEM, the stage of
3298  * \SCIP is not changed; otherwise, the \SCIP stage is changed to \ref SCIP_STAGE_TRANSFORMED
3299  *
3300  * See \ref SCIP_Stage "SCIP_STAGE" for a complete list of all possible solving stages.
3301  */
3303  SCIP* scip, /**< SCIP data structure */
3304  SCIP_Bool restart /**< should certain data be preserved for improved restarting? */
3305  )
3306 {
3307  SCIP_CALL( SCIPcheckStage(scip, "SCIPfreeSolve", TRUE, TRUE, FALSE, TRUE, FALSE, TRUE, FALSE, TRUE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE) );
3308 
3309  switch( scip->set->stage )
3310  {
3311  case SCIP_STAGE_INIT:
3313  case SCIP_STAGE_PROBLEM:
3314  return SCIP_OKAY;
3315 
3316  case SCIP_STAGE_PRESOLVING:
3317  {
3318  SCIP_Bool infeasible;
3319 
3320  assert(scip->stat->status != SCIP_STATUS_INFEASIBLE);
3321  assert(scip->stat->status != SCIP_STATUS_INFORUNBD);
3322  assert(scip->stat->status != SCIP_STATUS_UNBOUNDED);
3323  assert(scip->stat->status != SCIP_STATUS_OPTIMAL);
3324 
3325  /* exit presolving */
3326  SCIP_CALL( exitPresolve(scip, FALSE, &infeasible) );
3327  assert(scip->set->stage == SCIP_STAGE_PRESOLVED);
3328  }
3329 
3330  /*lint -fallthrough*/
3331  case SCIP_STAGE_PRESOLVED:
3332  /* switch stage to TRANSFORMED */
3333  scip->set->stage = SCIP_STAGE_TRANSFORMED;
3334  return SCIP_OKAY;
3335 
3336  case SCIP_STAGE_SOLVING:
3337  case SCIP_STAGE_SOLVED:
3338  /* free solution process data structures */
3339  SCIP_CALL( freeSolve(scip, restart) );
3340  assert(scip->set->stage == SCIP_STAGE_TRANSFORMED);
3341  return SCIP_OKAY;
3342 
3343  default:
3344  SCIPerrorMessage("invalid SCIP stage <%d>\n", scip->set->stage);
3345  return SCIP_INVALIDCALL;
3346  } /*lint !e788*/
3347 }
3348 
3349 /** frees branch and bound tree and all solution process data; statistics, presolving data and transformed problem is
3350  * preserved
3351  *
3352  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
3353  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
3354  *
3355  * @pre This method can be called if @p scip is in one of the following stages:
3356  * - \ref SCIP_STAGE_INIT
3357  * - \ref SCIP_STAGE_PROBLEM
3358  * - \ref SCIP_STAGE_TRANSFORMED
3359  * - \ref SCIP_STAGE_PRESOLVING
3360  * - \ref SCIP_STAGE_PRESOLVED
3361  * - \ref SCIP_STAGE_SOLVING
3362  * - \ref SCIP_STAGE_SOLVED
3363  *
3364  * @post If this method is called in \SCIP stage \ref SCIP_STAGE_INIT, \ref SCIP_STAGE_TRANSFORMED or \ref SCIP_STAGE_PROBLEM,
3365  * the stage of \SCIP is not changed; otherwise, the \SCIP stage is changed to \ref SCIP_STAGE_PRESOLVED.
3366  *
3367  * See \ref SCIP_Stage "SCIP_STAGE" for a complete list of all possible solving stages.
3368  */
3370  SCIP* scip /**< SCIP data structure */
3371  )
3372 {
3373  SCIP_CALL( SCIPcheckStage(scip, "SCIPfreeReoptSolve", TRUE, TRUE, FALSE, TRUE, FALSE, TRUE, FALSE, TRUE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE) );
3374 
3375  switch( scip->set->stage )
3376  {
3377  case SCIP_STAGE_INIT:
3379  case SCIP_STAGE_PRESOLVED:
3380  case SCIP_STAGE_PROBLEM:
3381  return SCIP_OKAY;
3382 
3383  case SCIP_STAGE_PRESOLVING:
3384  {
3385  SCIP_Bool infeasible;
3386 
3387  assert(scip->stat->status != SCIP_STATUS_INFEASIBLE);
3388  assert(scip->stat->status != SCIP_STATUS_INFORUNBD);
3389  assert(scip->stat->status != SCIP_STATUS_UNBOUNDED);
3390  assert(scip->stat->status != SCIP_STATUS_OPTIMAL);
3391 
3392  /* exit presolving */
3393  SCIP_CALL( exitPresolve(scip, FALSE, &infeasible) );
3394  assert(scip->set->stage == SCIP_STAGE_PRESOLVED);
3395 
3396  return SCIP_OKAY;
3397  }
3398 
3399  case SCIP_STAGE_SOLVING:
3400  case SCIP_STAGE_SOLVED:
3401  /* free solution process data structures */
3402  SCIP_CALL( freeReoptSolve(scip) );
3403  assert(scip->set->stage == SCIP_STAGE_PRESOLVED);
3404  return SCIP_OKAY;
3405 
3406  default:
3407  SCIPerrorMessage("invalid SCIP stage <%d>\n", scip->set->stage);
3408  return SCIP_INVALIDCALL;
3409  } /*lint !e788*/
3410 }
3411 
3412 /** frees all solution process data including presolving and transformed problem, only original problem is kept
3413  *
3414  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
3415  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
3416  *
3417  * @pre This method can be called if @p scip is in one of the following stages:
3418  * - \ref SCIP_STAGE_INIT
3419  * - \ref SCIP_STAGE_PROBLEM
3420  * - \ref SCIP_STAGE_TRANSFORMED
3421  * - \ref SCIP_STAGE_PRESOLVING
3422  * - \ref SCIP_STAGE_PRESOLVED
3423  * - \ref SCIP_STAGE_SOLVING
3424  * - \ref SCIP_STAGE_SOLVED
3425  *
3426  * @post After calling this method \SCIP reaches one of the following stages:
3427  * - \ref SCIP_STAGE_INIT if the method was called from \SCIP stage \ref SCIP_STAGE_INIT
3428  * - \ref SCIP_STAGE_PROBLEM if the method was called from any other of the allowed stages
3429  *
3430  * See \ref SCIP_Stage "SCIP_STAGE" for a complete list of all possible solving stages.
3431  */
3433  SCIP* scip /**< SCIP data structure */
3434  )
3435 {
3436  SCIP_CALL( SCIPcheckStage(scip, "SCIPfreeTransform", TRUE, TRUE, TRUE, TRUE, FALSE, TRUE, FALSE, TRUE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE) );
3437 
3438  /* release variables and constraints captured by reoptimization */
3439  if( scip->reopt != NULL )
3440  {
3441  SCIP_CALL( SCIPreoptReleaseData(scip->reopt, scip->set, scip->mem->probmem) );
3442  }
3443 
3444  switch( scip->set->stage )
3445  {
3446  case SCIP_STAGE_INIT:
3447  case SCIP_STAGE_PROBLEM:
3448  return SCIP_OKAY;
3449 
3450  case SCIP_STAGE_PRESOLVING:
3451  {
3452  SCIP_Bool infeasible;
3453 
3454  assert(scip->stat->status != SCIP_STATUS_INFEASIBLE);
3455  assert(scip->stat->status != SCIP_STATUS_INFORUNBD);
3456  assert(scip->stat->status != SCIP_STATUS_UNBOUNDED);
3457  assert(scip->stat->status != SCIP_STATUS_OPTIMAL);
3458 
3459  /* exit presolving */
3460  SCIP_CALL( exitPresolve(scip, FALSE, &infeasible) );
3461  assert(scip->set->stage == SCIP_STAGE_PRESOLVED);
3462  }
3463 
3464  /*lint -fallthrough*/
3465  case SCIP_STAGE_PRESOLVED:
3466  case SCIP_STAGE_SOLVING:
3467  case SCIP_STAGE_SOLVED:
3468  /* the solve was already freed, we directly go to freeTransform() */
3469  if( !scip->set->reopt_enable || scip->set->stage != SCIP_STAGE_PRESOLVED )
3470  {
3471  /* free solution process data */
3472  SCIP_CALL( SCIPfreeSolve(scip, FALSE) );
3473  assert(scip->set->stage == SCIP_STAGE_TRANSFORMED);
3474  }
3475  /*lint -fallthrough*/
3476 
3478  /* free transformed problem data structures */
3479  SCIP_CALL( freeTransform(scip) );
3480  assert(scip->set->stage == SCIP_STAGE_PROBLEM);
3481  return SCIP_OKAY;
3482 
3484  assert(scip->set->stage == SCIP_STAGE_TRANSFORMING);
3485  SCIP_CALL( freeTransforming(scip) );
3486  assert(scip->set->stage == SCIP_STAGE_PROBLEM);
3487  return SCIP_OKAY;
3488 
3489  default:
3490  SCIPerrorMessage("invalid SCIP stage <%d>\n", scip->set->stage);
3491  return SCIP_INVALIDCALL;
3492  } /*lint !e788*/
3493 }
3494 
3495 /** informs \SCIP that the solving process should be interrupted as soon as possible (e.g., after the current node has
3496  * been solved)
3497  *
3498  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
3499  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
3500  *
3501  * @pre This method can be called if @p scip is in one of the following stages:
3502  * - \ref SCIP_STAGE_PROBLEM
3503  * - \ref SCIP_STAGE_TRANSFORMING
3504  * - \ref SCIP_STAGE_TRANSFORMED
3505  * - \ref SCIP_STAGE_INITPRESOLVE
3506  * - \ref SCIP_STAGE_PRESOLVING
3507  * - \ref SCIP_STAGE_EXITPRESOLVE
3508  * - \ref SCIP_STAGE_PRESOLVED
3509  * - \ref SCIP_STAGE_SOLVING
3510  * - \ref SCIP_STAGE_SOLVED
3511  * - \ref SCIP_STAGE_EXITSOLVE
3512  * - \ref SCIP_STAGE_FREETRANS
3513  *
3514  * @note the \SCIP stage does not get changed
3515  */
3517  SCIP* scip /**< SCIP data structure */
3518  )
3519 {
3520  SCIP_CALL( SCIPcheckStage(scip, "SCIPinterruptSolve", FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, TRUE, TRUE, TRUE, TRUE, FALSE) );
3521 
3522  /* set the userinterrupt flag */
3523  scip->stat->userinterrupt = TRUE;
3524 
3525  return SCIP_OKAY;
3526 }
3527 
3528 /** indicates whether \SCIP has been informed that the solving process should be interrupted as soon as possible
3529  *
3530  * This function returns whether SCIPinterruptSolve() has been called, which is different from SCIPinterrupted(),
3531  * which returns whether a SIGINT signal has been received by the SCIP signal handler.
3532  *
3533  * @pre This method can be called if @p scip is in one of the following stages:
3534  * - \ref SCIP_STAGE_PROBLEM
3535  * - \ref SCIP_STAGE_TRANSFORMING
3536  * - \ref SCIP_STAGE_TRANSFORMED
3537  * - \ref SCIP_STAGE_INITPRESOLVE
3538  * - \ref SCIP_STAGE_PRESOLVING
3539  * - \ref SCIP_STAGE_EXITPRESOLVE
3540  * - \ref SCIP_STAGE_PRESOLVED
3541  * - \ref SCIP_STAGE_SOLVING
3542  * - \ref SCIP_STAGE_SOLVED
3543  * - \ref SCIP_STAGE_EXITSOLVE
3544  * - \ref SCIP_STAGE_FREETRANS
3545  *
3546  * @note the \SCIP stage does not get changed
3547  */
3549  SCIP* scip /**< SCIP data structure */
3550  )
3551 {
3552  SCIP_CALL_ABORT( SCIPcheckStage(scip, "SCIPisSolveInterrupted", FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, TRUE, TRUE, TRUE, TRUE, FALSE) );
3553 
3554  return scip->stat->userinterrupt;
3555 }
3556 
3557 /** informs SCIP that the solving process should be restarted as soon as possible (e.g., after the current node has
3558  * been solved)
3559  *
3560  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
3561  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
3562  *
3563  * @pre This method can be called if @p scip is in one of the following stages:
3564  * - \ref SCIP_STAGE_INITPRESOLVE
3565  * - \ref SCIP_STAGE_PRESOLVING
3566  * - \ref SCIP_STAGE_EXITPRESOLVE
3567  * - \ref SCIP_STAGE_SOLVING
3568  *
3569  * @note the \SCIP stage does not get changed
3570  */
3572  SCIP* scip /**< SCIP data structure */
3573  )
3574 {
3575  SCIP_CALL( SCIPcheckStage(scip, "SCIPrestartSolve", FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) );
3576 
3577  /* set the userrestart flag */
3578  scip->stat->userrestart = TRUE;
3579 
3580  return SCIP_OKAY;
3581 }
3582 
3583 /** returns whether reoptimization is enabled or not */
3585  SCIP* scip /**< SCIP data structure */
3586  )
3587 {
3588  assert(scip != NULL);
3589 
3590  return scip->set->reopt_enable;
3591 }
3592 
3593 /** returns the stored solutions corresponding to a given run */
3595  SCIP* scip, /**< SCIP data structure */
3596  int run, /**< number of the run */
3597  SCIP_SOL** sols, /**< array to store solutions */
3598  int solssize, /**< size of the array */
3599  int* nsols /**< pointer to store number of solutions */
3600  )
3601 {
3602  assert(scip != NULL);
3603  assert(sols != NULL);
3604  assert(solssize > 0);
3605 
3606  if( scip->set->reopt_enable )
3607  {
3608  assert(run > 0 && run <= scip->stat->nreoptruns);
3609  SCIP_CALL( SCIPreoptGetSolsRun(scip->reopt, run, sols, solssize, nsols) );
3610  }
3611  else
3612  {
3613  *nsols = 0;
3614  }
3615 
3616  return SCIP_OKAY;
3617 }
3618 
3619 /** mark all stored solutions as not updated */
3621  SCIP* scip /**< SCIP data structure */
3622  )
3623 {
3624  assert(scip != NULL);
3625  assert(scip->set->reopt_enable);
3626  assert(scip->reopt != NULL);
3627 
3628  if( scip->set->reopt_enable )
3629  {
3630  assert(scip->reopt != NULL);
3632  }
3633 }
3634 
3635 /** check if the reoptimization process should be restarted
3636  *
3637  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
3638  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
3639  *
3640  * @pre This method can be called if @p scip is in one of the following stages:
3641  * - \ref SCIP_STAGE_TRANSFORMED
3642  * - \ref SCIP_STAGE_SOLVING
3643  */
3645  SCIP* scip, /**< SCIP data structure */
3646  SCIP_NODE* node, /**< current node of the branch and bound tree (or NULL) */
3647  SCIP_Bool* restart /**< pointer to store of the reoptimitation process should be restarted */
3648  )
3649 {
3650  assert(scip != NULL);
3651  assert(scip->set->reopt_enable);
3652  assert(scip->reopt != NULL);
3653 
3654  SCIP_CALL( SCIPcheckStage(scip, "SCIPcheckReoptRestart", FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) );
3655 
3656  SCIP_CALL( SCIPreoptCheckRestart(scip->reopt, scip->set, scip->mem->probmem, node, scip->transprob->vars,
3657  scip->transprob->nvars, restart) );
3658 
3659  return SCIP_OKAY;
3660 }
3661 
3662 /** returns whether we are in the restarting phase
3663  *
3664  * @return TRUE, if we are in the restarting phase; FALSE, otherwise
3665  *
3666  * @pre This method can be called if @p scip is in one of the following stages:
3667  * - \ref SCIP_STAGE_INITPRESOLVE
3668  * - \ref SCIP_STAGE_PRESOLVING
3669  * - \ref SCIP_STAGE_EXITPRESOLVE
3670  * - \ref SCIP_STAGE_PRESOLVED
3671  * - \ref SCIP_STAGE_INITSOLVE
3672  * - \ref SCIP_STAGE_SOLVING
3673  * - \ref SCIP_STAGE_SOLVED
3674  * - \ref SCIP_STAGE_EXITSOLVE
3675  * - \ref SCIP_STAGE_FREETRANS
3676  */
3678  SCIP* scip /**< SCIP data structure */
3679  )
3680 {
3681  SCIP_CALL_ABORT( SCIPcheckStage(scip, "SCIPisInRestart", FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE) );
3682 
3683  /* return the restart status */
3684  return scip->stat->inrestart;
3685 }
enum SCIP_Result SCIP_RESULT
Definition: type_result.h:52
SCIP_Real cutoffbound
Definition: struct_primal.h:46
SCIP_Bool SCIPsolIsOriginal(SCIP_SOL *sol)
Definition: sol.c:2521
SCIP_RETCODE SCIPsetInitprePlugins(SCIP_SET *set, BMS_BLKMEM *blkmem, SCIP_STAT *stat)
Definition: set.c:5493
void SCIPfreeRandom(SCIP *scip, SCIP_RANDNUMGEN **randnumgen)
SCIP_RETCODE SCIPprobCheckObjIntegral(SCIP_PROB *transprob, SCIP_PROB *origprob, BMS_BLKMEM *blkmem, SCIP_SET *set, SCIP_STAT *stat, SCIP_PRIMAL *primal, SCIP_TREE *tree, SCIP_REOPT *reopt, SCIP_LP *lp, SCIP_EVENTFILTER *eventfilter, SCIP_EVENTQUEUE *eventqueue)
Definition: prob.c:1478
SCIP_RETCODE SCIPsetExitsolPlugins(SCIP_SET *set, BMS_BLKMEM *blkmem, SCIP_STAT *stat, SCIP_Bool restart)
Definition: set.c:5678
SCIP_STAT * stat
Definition: struct_scip.h:70
SCIP_RETCODE SCIPenableReoptimization(SCIP *scip, SCIP_Bool enable)
Definition: scip_solve.c:3131
SCIP_RETCODE SCIPeventfilterCreate(SCIP_EVENTFILTER **eventfilter, BMS_BLKMEM *blkmem)
Definition: event.c:1812
int SCIPgetNIntVars(SCIP *scip)
Definition: scip_prob.c:2081
static SCIP_RETCODE prepareReoptimization(SCIP *scip)
Definition: scip_solve.c:2339
static SCIP_RETCODE compressReoptTree(SCIP *scip)
Definition: scip_solve.c:2280
SCIP_RETCODE SCIPreoptReleaseData(SCIP_REOPT *reopt, SCIP_SET *set, BMS_BLKMEM *blkmem)
Definition: reopt.c:5158
SCIP_RETCODE SCIPtreeCreatePresolvingRoot(SCIP_TREE *tree, SCIP_REOPT *reopt, BMS_BLKMEM *blkmem, SCIP_SET *set, SCIP_MESSAGEHDLR *messagehdlr, SCIP_STAT *stat, SCIP_PROB *transprob, SCIP_PROB *origprob, SCIP_PRIMAL *primal, SCIP_LP *lp, SCIP_BRANCHCAND *branchcand, SCIP_CONFLICT *conflict, SCIP_CONFLICTSTORE *conflictstore, SCIP_EVENTFILTER *eventfilter, SCIP_EVENTQUEUE *eventqueue, SCIP_CLIQUETABLE *cliquetable)
Definition: tree.c:5003
void SCIPlpInvalidateRootObjval(SCIP_LP *lp)
Definition: lp.c:13169
SCIP_RETCODE SCIPreoptApplyGlbConss(SCIP *scip, SCIP_REOPT *reopt, SCIP_SET *set, SCIP_STAT *stat, BMS_BLKMEM *blkmem)
Definition: reopt.c:7660
SCIP_Bool SCIPsolveIsStopped(SCIP_SET *set, SCIP_STAT *stat, SCIP_Bool checknodelimits)
Definition: solve.c:93
int npresoladdconss
Definition: struct_stat.h:243
SCIP_Bool SCIPsetIsInfinity(SCIP_SET *set, SCIP_Real val)
Definition: set.c:6200
SCIP_RETCODE SCIPprimalClear(SCIP_PRIMAL **primal, BMS_BLKMEM *blkmem)
Definition: primal.c:194
SCIP_RETCODE SCIPreoptAddDualBndchg(SCIP_REOPT *reopt, SCIP_SET *set, BMS_BLKMEM *blkmem, SCIP_NODE *node, SCIP_VAR *var, SCIP_Real newval, SCIP_Real oldval)
Definition: reopt.c:6292
SCIP_Real SCIPgetSolvingTime(SCIP *scip)
Definition: scip_timing.c:369
int npresolroundsfast
Definition: struct_stat.h:234
internal methods for managing events
SCIP_Real SCIPfeastol(SCIP *scip)
void SCIPinterruptCapture(SCIP_INTERRUPT *interrupt)
Definition: interrupt.c:105
internal methods for storing primal CIP solutions
SCIP_Bool misc_estimexternmem
Definition: struct_set.h:391
SCIP_STATUS status
Definition: struct_stat.h:177
SCIP_Bool compr_enable
Definition: struct_set.h:591
public methods for SCIP parameter handling
int sepa_cutagelimit
Definition: struct_set.h:556
int random_permutationseed
Definition: struct_set.h:410
SCIP_STAGE SCIPgetStage(SCIP *scip)
Definition: scip_general.c:356
SCIP_Longint externmemestim
Definition: struct_stat.h:116
internal methods for branch and bound tree
SCIP_CONFLICT * conflict
Definition: struct_scip.h:87
SCIP_RETCODE SCIPcheckReoptRestart(SCIP *scip, SCIP_NODE *node, SCIP_Bool *restart)
Definition: scip_solve.c:3644
int SCIPdecompstoreGetNOrigDecomps(SCIP_DECOMPSTORE *decompstore)
Definition: dcmp.c:630
SCIP_RETCODE SCIPclearRelaxSolVals(SCIP *scip, SCIP_RELAX *relax)
Definition: scip_var.c:2361
int SCIPgetNConcurrentSolvers(SCIP *scip)
Definition: concurrent.c:107
SCIP_Bool misc_finitesolstore
Definition: struct_set.h:397
public methods for memory management
SCIP_CONSHDLR * SCIPfindConshdlr(SCIP *scip, const char *name)
Definition: scip_cons.c:877
SCIP_RETCODE SCIPgetReoptSolsRun(SCIP *scip, int run, SCIP_SOL **sols, int solssize, int *nsols)
Definition: scip_solve.c:3594
SCIP_Real SCIPgetPrimalbound(SCIP *scip)
SCIP_Real SCIPvarGetWorstBoundGlobal(SCIP_VAR *var)
Definition: var.c:17953
methods for implications, variable bounds, and cliques
SCIP_Longint SCIPbranchruleGetNChildren(SCIP_BRANCHRULE *branchrule)
Definition: branch.c:2154
int presol_maxrounds
Definition: struct_set.h:441
SCIP_RETCODE SCIPgetRealParam(SCIP *scip, const char *name, SCIP_Real *value)
Definition: scip_param.c:298
#define SCIP_MAXSTRLEN
Definition: def.h:293
SCIP_RETCODE SCIPconflictstoreClean(SCIP_CONFLICTSTORE *conflictstore, BMS_BLKMEM *blkmem, SCIP_SET *set, SCIP_STAT *stat, SCIP_PROB *transprob, SCIP_REOPT *reopt)
SCIP_RETCODE SCIPgetLeaves(SCIP *scip, SCIP_NODE ***leaves, int *nleaves)
Definition: scip_tree.c:239
int concurrent_initseed
Definition: struct_set.h:570
SCIP_RETCODE SCIPeventChgType(SCIP_EVENT *event, SCIP_EVENTTYPE eventtype)
Definition: event.c:1031
SCIP_Real SCIPconcsolverTypeGetPrefPrio(SCIP_CONCSOLVERTYPE *concsolvertype)
Definition: concsolver.c:191
SCIP_PRIMAL * origprimal
Definition: struct_scip.h:72
internal methods for clocks and timing issues
SCIP_Longint ntotalnodes
Definition: struct_stat.h:78
int npresolaggrvars
Definition: struct_stat.h:238
SCIP_VAR ** SCIPvarGetMultaggrVars(SCIP_VAR *var)
Definition: var.c:17690
SCIP_RETCODE SCIPpropPresol(SCIP_PROP *prop, SCIP_SET *set, SCIP_PRESOLTIMING timing, int nrounds, int *nfixedvars, int *naggrvars, int *nchgvartypes, int *nchgbds, int *naddholes, int *ndelconss, int *naddconss, int *nupgdconss, int *nchgcoefs, int *nchgsides, SCIP_RESULT *result)
Definition: prop.c:510
static SCIP_RETCODE calcNonZeros(SCIP *scip, SCIP_Longint *nchecknonzeros, SCIP_Longint *nactivenonzeros, SCIP_Bool *approxchecknonzeros, SCIP_Bool *approxactivenonzeros)
Definition: scip_solve.c:254
SCIP_Bool concurrent_changeseeds
Definition: struct_set.h:566
int nprops
Definition: struct_set.h:123
SCIP_RETCODE SCIPprobScaleObj(SCIP_PROB *transprob, SCIP_PROB *origprob, BMS_BLKMEM *blkmem, SCIP_SET *set, SCIP_STAT *stat, SCIP_PRIMAL *primal, SCIP_TREE *tree, SCIP_REOPT *reopt, SCIP_LP *lp, SCIP_EVENTFILTER *eventfilter, SCIP_EVENTQUEUE *eventqueue)
Definition: prob.c:1596
SCIP_EVENTQUEUE * eventqueue
Definition: struct_scip.h:80
public solving methods
SCIP_RETCODE SCIPtreeCreate(SCIP_TREE **tree, BMS_BLKMEM *blkmem, SCIP_SET *set, SCIP_NODESEL *nodesel)
Definition: tree.c:4766
int nintvars
Definition: struct_prob.h:63
int npresolfixedvars
Definition: struct_stat.h:237
public methods for timing
SCIP_RETCODE SCIPbranchcandCreate(SCIP_BRANCHCAND **branchcand)
Definition: branch.c:134
SCIP_PRIMAL * primal
Definition: struct_scip.h:85
SCIP_CUTPOOL * delayedcutpool
Definition: struct_scip.h:97
SCIP_RETCODE SCIPreoptAddSol(SCIP_REOPT *reopt, SCIP_SET *set, SCIP_STAT *stat, SCIP_PRIMAL *origprimal, BMS_BLKMEM *blkmem, SCIP_SOL *sol, SCIP_Bool bestsol, SCIP_Bool *added, SCIP_VAR **vars, int nvars, int run)
Definition: reopt.c:5328
SCIP_RETCODE SCIPreoptAddOptSol(SCIP_REOPT *reopt, SCIP_SOL *sol, BMS_BLKMEM *blkmem, SCIP_SET *set, SCIP_STAT *stat, SCIP_PRIMAL *origprimal, SCIP_VAR **vars, int nvars)
Definition: reopt.c:5381
SCIP_Real SCIPsetInfinity(SCIP_SET *set)
Definition: set.c:6065
SCIP_CONCURRENT * concurrent
Definition: struct_scip.h:101
SCIP_RETCODE SCIPprimalAddOrigSol(SCIP_PRIMAL *primal, BMS_BLKMEM *blkmem, SCIP_SET *set, SCIP_STAT *stat, SCIP_PROB *prob, SCIP_SOL *sol, SCIP_Bool *stored)
Definition: primal.c:1310
int nreoptruns
Definition: struct_stat.h:265
SCIP_SOL ** sols
Definition: struct_primal.h:48
int npresoldelconss
Definition: struct_stat.h:242
SCIP_BRANCHCAND * branchcand
Definition: struct_scip.h:81
int lastnpresolchgvartypes
Definition: struct_stat.h:249
void SCIPclockStop(SCIP_CLOCK *clck, SCIP_SET *set)
Definition: clock.c:351
SCIP_CONS ** SCIPconshdlrGetConss(SCIP_CONSHDLR *conshdlr)
Definition: cons.c:4547
SCIP_SOL ** SCIPgetSols(SCIP *scip)
Definition: scip_sol.c:2254
#define FALSE
Definition: def.h:87
void SCIPselectDownRealInt(SCIP_Real *realarray, int *intarray, int k, int len)
SCIP_RETCODE SCIPeventProcess(SCIP_EVENT *event, SCIP_SET *set, SCIP_PRIMAL *primal, SCIP_LP *lp, SCIP_BRANCHCAND *branchcand, SCIP_EVENTFILTER *eventfilter)
Definition: event.c:1565
datastructures for managing events
SCIP_NODESEL * SCIPsetGetNodesel(SCIP_SET *set, SCIP_STAT *stat)
Definition: set.c:4838
SCIP_Real SCIPrelDiff(SCIP_Real val1, SCIP_Real val2)
Definition: misc.c:11063
void SCIPclockStart(SCIP_CLOCK *clck, SCIP_SET *set)
Definition: clock.c:281
int limit_maxorigsol
Definition: struct_set.h:310
SCIP_RETCODE SCIPtransformDecompstore(SCIP *scip)
Definition: dcmp.c:639
int parallel_maxnthreads
Definition: struct_set.h:563
int SCIPsnprintf(char *t, int len, const char *s,...)
Definition: misc.c:10755
SCIP_Bool SCIPsetIsZero(SCIP_SET *set, SCIP_Real val)
Definition: set.c:6312
SCIP_STAGE stage
Definition: struct_set.h:65
#define TRUE
Definition: def.h:86
#define SCIPdebug(x)
Definition: pub_message.h:84
void SCIPprobMarkNConss(SCIP_PROB *prob)
Definition: prob.c:1405
enum SCIP_Retcode SCIP_RETCODE
Definition: type_retcode.h:54
SCIP_RETCODE SCIPnlpCreate(SCIP_NLP **nlp, BMS_BLKMEM *blkmem, SCIP_SET *set, SCIP_STAT *stat, const char *name, int nvars_estimate)
Definition: nlp.c:3442
SCIP_RETCODE SCIPcliquetableCreate(SCIP_CLIQUETABLE **cliquetable, SCIP_SET *set, BMS_BLKMEM *blkmem)
Definition: implics.c:1777
#define SCIP_PRESOLTIMING_EXHAUSTIVE
Definition: type_timing.h:45
#define SCIP_MEM_NOLIMIT
Definition: def.h:314
SCIP_Real SCIPprobInternObjval(SCIP_PROB *transprob, SCIP_PROB *origprob, SCIP_SET *set, SCIP_Real objval)
Definition: prob.c:2129
SCIP_BRANCHRULE * SCIPfindBranchrule(SCIP *scip, const char *name)
Definition: scip_branch.c:288
internal methods for branching rules and branching candidate storage
SCIP_RETCODE SCIPpricestoreCreate(SCIP_PRICESTORE **pricestore)
Definition: pricestore.c:98
SCIP_RETCODE SCIPcliquetableCleanup(SCIP_CLIQUETABLE *cliquetable, BMS_BLKMEM *blkmem, SCIP_SET *set, SCIP_STAT *stat, SCIP_PROB *transprob, SCIP_PROB *origprob, SCIP_TREE *tree, SCIP_REOPT *reopt, SCIP_LP *lp, SCIP_BRANCHCAND *branchcand, SCIP_EVENTQUEUE *eventqueue, int *nchgbds, SCIP_Bool *infeasible)
Definition: implics.c:2908
SCIP_RETCODE SCIPreoptFree(SCIP_REOPT **reopt, SCIP_SET *set, SCIP_PRIMAL *origprimal, BMS_BLKMEM *blkmem)
Definition: reopt.c:5186
SCIP_Real SCIPsetCutoffbounddelta(SCIP_SET *set)
Definition: set.c:6165
datastructures for concurrent solvers
void SCIPreoptResetSolMarks(SCIP_REOPT *reopt)
Definition: reopt.c:5792
SCIP_RETCODE SCIPprobInitSolve(SCIP_PROB *prob, SCIP_SET *set)
Definition: prob.c:1862
SCIP_NODE * SCIPtreeGetFocusNode(SCIP_TREE *tree)
Definition: tree.c:8300
int SCIPgetNNodesLeft(SCIP *scip)
Definition: scip_tree.c:635
public methods for problem variables
SCIP_RETCODE SCIPeventqueueFree(SCIP_EVENTQUEUE **eventqueue)
Definition: event.c:2191
SCIP_Longint nsolsfound
Definition: struct_primal.h:39
int nheurs
Definition: struct_set.h:125
SCIP_Real SCIPreoptGetOldObjCoef(SCIP_REOPT *reopt, int run, int idx)
Definition: reopt.c:5728
SCIP_RETCODE SCIPcliquetableFree(SCIP_CLIQUETABLE **cliquetable, BMS_BLKMEM *blkmem)
Definition: implics.c:1813
SCIP_RETCODE SCIPconflictFree(SCIP_CONFLICT **conflict, BMS_BLKMEM *blkmem)
Definition: conflict.c:3981
int SCIPrandomGetInt(SCIP_RANDNUMGEN *randnumgen, int minrandval, int maxrandval)
Definition: misc.c:10003
public methods for branching rules
int nimplvars
Definition: struct_prob.h:64
#define SCIPduplicateBufferArray(scip, ptr, source, num)
Definition: scip_mem.h:123
int limit_maxsol
Definition: struct_set.h:309
SCIP_RETCODE SCIPcomprExec(SCIP_COMPR *compr, SCIP_SET *set, SCIP_REOPT *reopt, SCIP_RESULT *result)
Definition: compr.c:290
SCIP_PROB * transprob
Definition: struct_scip.h:89
int npresolroundsext
Definition: struct_stat.h:236
SCIP_Bool SCIPisEQ(SCIP *scip, SCIP_Real val1, SCIP_Real val2)
SCIP_PRESOL ** presols
Definition: struct_set.h:77
methods for creating output for visualization tools (VBC, BAK)
SCIP_RETCODE SCIPprimalSetCutoffbound(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, SCIP_Real cutoffbound, SCIP_Bool useforobjlimit)
Definition: primal.c:298
#define SCIPfreeBufferArray(scip, ptr)
Definition: scip_mem.h:127
static SCIP_RETCODE displayRelevantStats(SCIP *scip)
Definition: scip_solve.c:2161
SCIP_RETCODE SCIPconcsolverCreateInstance(SCIP_SET *set, SCIP_CONCSOLVERTYPE *concsolvertype, SCIP_CONCSOLVER **concsolver)
Definition: concsolver.c:201
SCIP_RETCODE SCIPcutpoolFree(SCIP_CUTPOOL **cutpool, BMS_BLKMEM *blkmem, SCIP_SET *set, SCIP_LP *lp)
Definition: cutpool.c:457
public methods for SCIP variables
int nactivebenders
Definition: struct_set.h:150
void SCIPvisualExit(SCIP_VISUAL *visual, SCIP_SET *set, SCIP_MESSAGEHDLR *messagehdlr)
Definition: visual.c:180
SCIP_RETCODE SCIPsetRealParam(SCIP *scip, const char *name, SCIP_Real value)
Definition: scip_param.c:594
void SCIPwarningMessage(SCIP *scip, const char *formatstr,...)
Definition: scip_message.c:111
#define SCIPdebugMsg
Definition: scip_message.h:69
SCIP_VISUAL * visual
Definition: struct_stat.h:175
int lastnpresoladdconss
Definition: struct_stat.h:253
SCIP_RETCODE SCIPconcurrentSolve(SCIP *scip)
Definition: concurrent.c:474
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:439
internal methods for LP management
SCIP_Bool SCIPconsIsActive(SCIP_CONS *cons)
Definition: cons.c:8146
Definition: heur_padm.c:123
SCIP_PROB * origprob
Definition: struct_scip.h:71
void SCIPinfoMessage(SCIP *scip, FILE *file, const char *formatstr,...)
Definition: scip_message.c:199
SCIP_Longint nexternalsolsfound
Definition: struct_stat.h:100
void SCIPstatEnforceLPUpdates(SCIP_STAT *stat)
Definition: stat.c:678
#define SCIP_PRESOLTIMING_FAST
Definition: type_timing.h:43
SCIP_RETCODE SCIPgetSiblings(SCIP *scip, SCIP_NODE ***siblings, int *nsiblings)
Definition: scip_tree.c:197
public methods for numerical tolerances
internal methods for collecting primal CIP solutions and primal informations
SCIP_Real SCIPsolGetVal(SCIP_SOL *sol, SCIP_SET *set, SCIP_STAT *stat, SCIP_VAR *var)
Definition: sol.c:1338
int SCIPgetNActiveBenders(SCIP *scip)
Definition: scip_benders.c:523
SCIP_Bool reopt_enable
Definition: struct_set.h:503
SCIP_RETCODE SCIPreoptResetActiveConss(SCIP_REOPT *reopt, SCIP_SET *set, SCIP_STAT *stat)
Definition: reopt.c:8329
void SCIPupdateSolBoundViolation(SCIP *scip, SCIP_SOL *sol, SCIP_Real absviol, SCIP_Real relviol)
Definition: scip_sol.c:240
public methods for querying solving statistics
internal methods for propagators
int SCIPreoptGetNNodes(SCIP_REOPT *reopt, SCIP_NODE *node)
Definition: reopt.c:5813
SCIP_Bool reopt_storevarhistory
Definition: struct_set.h:514
SCIP_Bool SCIPisReoptEnabled(SCIP *scip)
Definition: scip_solve.c:3584
SCIP_Real dualbound
Definition: struct_prob.h:45
SCIP_PRICESTORE * pricestore
Definition: struct_scip.h:92
public methods for the branch-and-bound tree
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:400
void SCIPresetReoptSolMarks(SCIP *scip)
Definition: scip_solve.c:3620
int SCIPgetNFixedVars(SCIP *scip)
Definition: scip_prob.c:2308
SCIP_RETCODE SCIPsetInitPlugins(SCIP_SET *set, BMS_BLKMEM *blkmem, SCIP_STAT *stat)
Definition: set.c:5260
SCIP_VAR ** SCIPgetFixedVars(SCIP *scip)
Definition: scip_prob.c:2265
SCIP_Real avgnnz
Definition: struct_stat.h:120
int SCIPconshdlrGetCheckPriority(SCIP_CONSHDLR *conshdlr)
Definition: cons.c:5074
SCIP_RETCODE SCIPsolveCIP(BMS_BLKMEM *blkmem, SCIP_SET *set, SCIP_MESSAGEHDLR *messagehdlr, SCIP_STAT *stat, SCIP_MEM *mem, SCIP_PROB *origprob, SCIP_PROB *transprob, SCIP_PRIMAL *primal, SCIP_TREE *tree, SCIP_REOPT *reopt, SCIP_LP *lp, SCIP_RELAXATION *relaxation, SCIP_PRICESTORE *pricestore, SCIP_SEPASTORE *sepastore, SCIP_CUTPOOL *cutpool, SCIP_CUTPOOL *delayedcutpool, SCIP_BRANCHCAND *branchcand, SCIP_CONFLICT *conflict, SCIP_CONFLICTSTORE *conflictstore, SCIP_EVENTFILTER *eventfilter, SCIP_EVENTQUEUE *eventqueue, SCIP_CLIQUETABLE *cliquetable, SCIP_Bool *restart)
Definition: solve.c:4817
SCIP_Bool SCIPsetIsLT(SCIP_SET *set, SCIP_Real val1, SCIP_Real val2)
Definition: set.c:6240
static SCIP_RETCODE checkSolOrig(SCIP *scip, SCIP_SOL *sol, SCIP_Bool *feasible, SCIP_Bool printreason, SCIP_Bool completely, SCIP_Bool checkbounds, SCIP_Bool checkintegrality, SCIP_Bool checklprows, SCIP_Bool checkmodifiable)
Definition: scip_solve.c:116
int SCIPcliquetableGetNCliques(SCIP_CLIQUETABLE *cliquetable)
Definition: implics.c:3494
int npresolchgcoefs
Definition: struct_stat.h:245
int npresolchgvartypes
Definition: struct_stat.h:239
SCIP_RETCODE SCIPreoptGetSolsRun(SCIP_REOPT *reopt, int run, SCIP_SOL **sols, int solssize, int *nsols)
Definition: reopt.c:5525
SCIP_MEM * mem
Definition: struct_scip.h:62
public methods for managing constraints
SCIP_RETCODE SCIPprobPerformVarDeletions(SCIP_PROB *prob, BMS_BLKMEM *blkmem, SCIP_SET *set, SCIP_STAT *stat, SCIP_EVENTQUEUE *eventqueue, SCIP_CLIQUETABLE *cliquetable, SCIP_LP *lp, SCIP_BRANCHCAND *branchcand)
Definition: prob.c:1062
BMS_BUFMEM * SCIPbuffer(SCIP *scip)
Definition: scip_mem.c:63
SCIP_Bool SCIPisPresolveFinished(SCIP *scip)
Definition: scip_general.c:603
int lastnpresolfixedvars
Definition: struct_stat.h:247
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:2356
SCIP_RETCODE SCIPnlpAddVars(SCIP_NLP *nlp, BMS_BLKMEM *blkmem, SCIP_SET *set, int nvars, SCIP_VAR **vars)
Definition: nlp.c:3733
SCIP_Real SCIPsolGetObj(SCIP_SOL *sol, SCIP_SET *set, SCIP_PROB *transprob, SCIP_PROB *origprob)
Definition: sol.c:1537
#define SCIP_PRESOLTIMING_MEDIUM
Definition: type_timing.h:44
SCIP_RETCODE SCIPsolve(SCIP *scip)
Definition: scip_solve.c:2613
SCIP_RETCODE SCIPconflictstoreClear(SCIP_CONFLICTSTORE *conflictstore, BMS_BLKMEM *blkmem, SCIP_SET *set, SCIP_STAT *stat, SCIP_REOPT *reopt)
const char * SCIPheurGetName(SCIP_HEUR *heur)
Definition: heur.c:1441
int npresolroundsmed
Definition: struct_stat.h:235
int lastnpresoladdholes
Definition: struct_stat.h:251
int prevrunnvars
Definition: struct_stat.h:217
SCIP_SOL * SCIPgetReoptLastOptSol(SCIP *scip)
Definition: scip_solve.c:3219
public methods for Benders decomposition
internal methods for storing and manipulating the main problem
#define SCIPerrorMessage
Definition: pub_message.h:55
static SCIP_RETCODE freeTransforming(SCIP *scip)
Definition: scip_solve.c:2113
const char * SCIPconshdlrGetName(SCIP_CONSHDLR *conshdlr)
Definition: cons.c:4175
void SCIPmessagePrintVerbInfo(SCIP_MESSAGEHDLR *messagehdlr, SCIP_VERBLEVEL verblevel, SCIP_VERBLEVEL msgverblevel, const char *formatstr,...)
Definition: message.c:669
void SCIPstatResetCurrentRun(SCIP_STAT *stat, SCIP_SET *set, SCIP_PROB *transprob, SCIP_PROB *origprob, SCIP_Bool solved)
Definition: stat.c:606
SCIP_Real SCIPvarGetLbOriginal(SCIP_VAR *var)
Definition: var.c:17856
SCIP_EVENTFILTER * eventfilter
Definition: struct_scip.h:79
void SCIPstoreSolutionGap(SCIP *scip)
SCIP_RETCODE SCIPpresolExec(SCIP_PRESOL *presol, SCIP_SET *set, SCIP_PRESOLTIMING timing, int nrounds, int *nfixedvars, int *naggrvars, int *nchgvartypes, int *nchgbds, int *naddholes, int *ndelconss, int *naddconss, int *nupgdconss, int *nchgcoefs, int *nchgsides, SCIP_RESULT *result)
Definition: presol.c:379
SCIP_RETCODE SCIPprobExitSolve(SCIP_PROB *prob, BMS_BLKMEM *blkmem, SCIP_SET *set, SCIP_EVENTQUEUE *eventqueue, SCIP_LP *lp, SCIP_Bool restart)
Definition: prob.c:1897
SCIP_INTERRUPT * interrupt
Definition: struct_scip.h:64
SCIP_Bool misc_resetstat
Definition: struct_set.h:385
SCIP_Bool misc_printreason
Definition: struct_set.h:390
SCIP_RETCODE SCIPnodeFocus(SCIP_NODE **node, BMS_BLKMEM *blkmem, SCIP_SET *set, SCIP_MESSAGEHDLR *messagehdlr, SCIP_STAT *stat, SCIP_PROB *transprob, SCIP_PROB *origprob, SCIP_PRIMAL *primal, SCIP_TREE *tree, SCIP_REOPT *reopt, SCIP_LP *lp, SCIP_BRANCHCAND *branchcand, SCIP_CONFLICT *conflict, SCIP_CONFLICTSTORE *conflictstore, SCIP_EVENTFILTER *eventfilter, SCIP_EVENTQUEUE *eventqueue, SCIP_CLIQUETABLE *cliquetable, SCIP_Bool *cutoff, SCIP_Bool postponed, SCIP_Bool exitsolve)
Definition: tree.c:4299
SCIP_Bool propspresolsorted
Definition: struct_set.h:168
SCIP_RETCODE SCIPtreeCreateRoot(SCIP_TREE *tree, SCIP_REOPT *reopt, BMS_BLKMEM *blkmem, SCIP_SET *set, SCIP_STAT *stat, SCIP_EVENTFILTER *eventfilter, SCIP_EVENTQUEUE *eventqueue, SCIP_LP *lp)
Definition: tree.c:4957
SCIP_RETCODE SCIPsepastoreCreate(SCIP_SEPASTORE **sepastore, BMS_BLKMEM *blkmem, SCIP_SET *set)
Definition: sepastore.c:78
SCIP_RETCODE SCIPeventqueueCreate(SCIP_EVENTQUEUE **eventqueue)
Definition: event.c:2175
int npresolchgsides
Definition: struct_stat.h:246
SCIP_RETCODE SCIPgetChildren(SCIP *scip, SCIP_NODE ***children, int *nchildren)
Definition: scip_tree.c:155
void SCIPstatReset(SCIP_STAT *stat, SCIP_SET *set, SCIP_PROB *transprob, SCIP_PROB *origprob)
Definition: stat.c:179
SCIP_Real SCIPvarGetUbOriginal(SCIP_VAR *var)
Definition: var.c:17876
static SCIP_RETCODE freeTransform(SCIP *scip)
Definition: scip_solve.c:1948
SCIP_Real SCIPgetDualbound(SCIP *scip)
SCIP_Bool random_permutevars
Definition: struct_set.h:414
void SCIPinterruptRelease(SCIP_INTERRUPT *interrupt)
Definition: interrupt.c:135
int lastnpresolchgbds
Definition: struct_stat.h:250
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:2177
SCIP_STATUS SCIPgetStatus(SCIP *scip)
Definition: scip_general.c:474
SCIP_RETCODE SCIPpresolve(SCIP *scip)
Definition: scip_solve.c:2443
SCIP_CONSHDLR ** conshdlrs
Definition: struct_set.h:72
internal methods for presolvers
SCIP_CONFLICTSTORE * conflictstore
Definition: struct_scip.h:95
SCIP_CLOCK * solvingtimeoverall
Definition: struct_stat.h:152
void SCIPsetSortComprs(SCIP_SET *set)
Definition: set.c:4714
SCIP_RETCODE SCIPsetInitsolPlugins(SCIP_SET *set, BMS_BLKMEM *blkmem, SCIP_STAT *stat)
Definition: set.c:5569
SCIP_RETCODE SCIPcheckSolOrig(SCIP *scip, SCIP_SOL *sol, SCIP_Bool *feasible, SCIP_Bool printreason, SCIP_Bool completely)
Definition: scip_sol.c:3497
SCIP_RETCODE SCIPprintStage(SCIP *scip, FILE *file)
Definition: scip_general.c:378
SCIP_RETCODE SCIPreoptCreate(SCIP_REOPT **reopt, SCIP_SET *set, BMS_BLKMEM *blkmem)
Definition: reopt.c:5076
const char * SCIPvarGetName(SCIP_VAR *var)
Definition: var.c:17251
static SCIP_RETCODE presolve(SCIP *scip, SCIP_Bool *unbounded, SCIP_Bool *infeasible, SCIP_Bool *vanished)
Definition: scip_solve.c:1242
SCIP_Real SCIPclockGetTime(SCIP_CLOCK *clck)
Definition: clock.c:429
SCIP_REOPT * reopt
Definition: struct_scip.h:76
internal methods for NLP management
SCIP_RETCODE SCIPgetBoolParam(SCIP *scip, const char *name, SCIP_Bool *value)
Definition: scip_param.c:241
#define NULL
Definition: lpi_spx1.cpp:155
SCIP_HEUR * SCIPsolGetHeur(SCIP_SOL *sol)
Definition: sol.c:2604
int SCIPpresolGetPriority(SCIP_PRESOL *presol)
Definition: presol.c:610
SCIP_RETCODE SCIPconcsolverInitSeeds(SCIP_CONCSOLVER *concsolver, unsigned int seed)
Definition: concsolver.c:301
data structures for branch and bound tree
SCIP_Bool userinterrupt
Definition: struct_stat.h:269
#define REALABS(x)
Definition: def.h:201
SCIP_Bool SCIPprobIsObjIntegral(SCIP_PROB *prob)
Definition: prob.c:2288
public methods for primal CIP solutions
int npresolchgbds
Definition: struct_stat.h:240
SCIP_Bool misc_avoidmemout
Definition: struct_set.h:392
internal methods for global SCIP settings
internal methods for storing conflicts
#define SCIP_CALL(x)
Definition: def.h:384
int npresoladdholes
Definition: struct_stat.h:241
SCIP_Real SCIPgetLowerbound(SCIP *scip)
SCIP_RETCODE SCIPsetSetReoptimizationParams(SCIP_SET *set, SCIP_MESSAGEHDLR *messagehdlr)
Definition: set.c:805
unsigned int SCIP_PRESOLTIMING
Definition: type_timing.h:52
#define SCIP_HEURTIMING_DURINGPRESOLLOOP
Definition: type_timing.h:87
SCIP main data structure.
SCIP_RETCODE SCIPprobResetBounds(SCIP_PROB *prob, BMS_BLKMEM *blkmem, SCIP_SET *set, SCIP_STAT *stat)
Definition: prob.c:619
BMS_BLKMEM * setmem
Definition: struct_mem.h:39
SCIP_RETCODE SCIPrelaxationCreate(SCIP_RELAXATION **relaxation, BMS_BLKMEM *blkmem, SCIP_SET *set, SCIP_STAT *stat, SCIP_PRIMAL *primal, SCIP_TREE *tree)
Definition: relax.c:719
SCIP_VAR * h
Definition: circlepacking.c:59
void SCIPmessagePrintInfo(SCIP_MESSAGEHDLR *messagehdlr, const char *formatstr,...)
Definition: message.c:585
SCIP_RETCODE SCIPcutpoolClear(SCIP_CUTPOOL *cutpool, BMS_BLKMEM *blkmem, SCIP_SET *set, SCIP_LP *lp)
Definition: cutpool.c:483
BMS_BUFMEM * SCIPcleanbuffer(SCIP *scip)
Definition: scip_mem.c:77
void SCIPverbMessage(SCIP *scip, SCIP_VERBLEVEL msgverblevel, FILE *file, const char *formatstr,...)
Definition: scip_message.c:216
#define SCIP_HEURTIMING_BEFOREPRESOL
Definition: type_timing.h:86
internal methods for storing priced variables
internal methods for relaxators
static SCIP_RETCODE freeReoptSolve(SCIP *scip)
Definition: scip_solve.c:1832
static SCIP_RETCODE freeSolve(SCIP *scip, SCIP_Bool restart)
Definition: scip_solve.c:1729
void SCIPprobResortVars(SCIP_PROB *prob)
Definition: prob.c:645
internal methods for storing separated cuts
int lastnpresoldelconss
Definition: struct_stat.h:252
void SCIPstatResetDisplay(SCIP_STAT *stat)
Definition: stat.c:667
void SCIPsetSortPropsPresol(SCIP_SET *set)
Definition: set.c:4435
SCIP_DECOMPSTORE * decompstore
Definition: struct_scip.h:73
SCIP_Bool SCIPconshdlrNeedsCons(SCIP_CONSHDLR *conshdlr)
Definition: cons.c:5114
SCIP_CLOCK * presolvingtimeoverall
Definition: struct_stat.h:154
public methods for constraint handler plugins and constraints
void SCIPsolRecomputeObj(SCIP_SOL *sol, SCIP_SET *set, SCIP_STAT *stat, SCIP_PROB *origprob)
Definition: sol.c:1986
SCIP_RETCODE SCIPpricestoreFree(SCIP_PRICESTORE **pricestore)
Definition: pricestore.c:127
SCIP_CUTPOOL * cutpool
Definition: struct_scip.h:96
methods for catching the user CTRL-C interrupt
SCIP_CLIQUETABLE * cliquetable
Definition: struct_scip.h:88
SCIP_RETCODE SCIPcreateRandom(SCIP *scip, SCIP_RANDNUMGEN **randnumgen, unsigned int initialseed, SCIP_Bool useglobalseed)
internal methods for problem variables
data structures and methods for collecting reoptimization information
the function declarations for the synchronization store
SCIP_Bool SCIPvarIsOriginal(SCIP_VAR *var)
Definition: var.c:17380
static SCIP_RETCODE initPresolve(SCIP *scip)
Definition: scip_solve.c:570
SCIP_RETCODE SCIPreoptInstallBounds(SCIP_REOPT *reopt, SCIP_SET *set, SCIP_STAT *stat, SCIP_PROB *transprob, SCIP_LP *lp, SCIP_BRANCHCAND *branchcand, SCIP_EVENTQUEUE *eventqueue, SCIP_CLIQUETABLE *cliquetable, BMS_BLKMEM *blkmem)
Definition: reopt.c:8279
SCIP_RETCODE SCIPreoptSaveOpenNodes(SCIP_REOPT *reopt, SCIP_SET *set, SCIP_LP *lp, BMS_BLKMEM *blkmem, SCIP_NODE **leaves, int nleaves, SCIP_NODE **childs, int nchilds, SCIP_NODE **siblings, int nsiblings)
Definition: reopt.c:6519
#define SCIPallocBufferArray(scip, ptr, num)
Definition: scip_mem.h:115
SCIP_Bool userrestart
Definition: struct_stat.h:270
SCIP_SEPASTORE * sepastore
Definition: struct_scip.h:93
public data structures and miscellaneous methods
SCIP_Bool reopt_sepabestsol
Definition: struct_set.h:513
SCIP_RETCODE SCIPconsGetNVars(SCIP_CONS *cons, SCIP_SET *set, int *nvars, SCIP_Bool *success)
Definition: cons.c:6318
SCIP_RETCODE SCIPfreeTransform(SCIP *scip)
Definition: scip_solve.c:3432
SCIP_RETCODE SCIPrelaxationFree(SCIP_RELAXATION **relaxation)
Definition: relax.c:747
SCIP_RETCODE SCIPpermuteProb(SCIP *scip, unsigned int randseed, SCIP_Bool permuteconss, SCIP_Bool permutebinvars, SCIP_Bool permuteintvars, SCIP_Bool permuteimplvars, SCIP_Bool permutecontvars)
Definition: scip_prob.c:780
SCIP_SOL * SCIPreoptGetLastBestSol(SCIP_REOPT *reopt)
Definition: reopt.c:5700
SCIP_RETCODE SCIPnlpFree(SCIP_NLP **nlp, BMS_BLKMEM *blkmem, SCIP_SET *set, SCIP_STAT *stat, SCIP_EVENTQUEUE *eventqueue, SCIP_LP *lp)
Definition: nlp.c:3562
SCIP_RETCODE SCIPconshdlrPresolve(SCIP_CONSHDLR *conshdlr, BMS_BLKMEM *blkmem, SCIP_SET *set, SCIP_STAT *stat, SCIP_PRESOLTIMING timing, int nrounds, int *nfixedvars, int *naggrvars, int *nchgvartypes, int *nchgbds, int *naddholes, int *ndelconss, int *naddconss, int *nupgdconss, int *nchgcoefs, int *nchgsides, SCIP_RESULT *result)
Definition: cons.c:3971
#define SCIP_Bool
Definition: def.h:84
void SCIPlpRecomputeLocalAndGlobalPseudoObjval(SCIP_LP *lp, SCIP_SET *set, SCIP_PROB *prob)
Definition: lp.c:13180
SCIP_CLOCK * presolvingtime
Definition: struct_stat.h:153
static SCIP_RETCODE presolveRound(SCIP *scip, SCIP_PRESOLTIMING *timing, SCIP_Bool *unbounded, SCIP_Bool *infeasible, SCIP_Bool lastround, int *presolstart, int presolend, int *propstart, int propend, int *consstart, int consend)
Definition: scip_solve.c:787
SCIP_Longint SCIPsolGetNodenum(SCIP_SOL *sol)
Definition: sol.c:2584
int ncontvars
Definition: struct_prob.h:65
SCIP_RETCODE SCIPreoptCheckRestart(SCIP_REOPT *reopt, SCIP_SET *set, BMS_BLKMEM *blkmem, SCIP_NODE *node, SCIP_VAR **transvars, int ntransvars, SCIP_Bool *restart)
Definition: reopt.c:5594
int nbinvars
Definition: struct_prob.h:62
SCIP_RETCODE SCIPlpFree(SCIP_LP **lp, BMS_BLKMEM *blkmem, SCIP_SET *set, SCIP_EVENTQUEUE *eventqueue, SCIP_EVENTFILTER *eventfilter)
Definition: lp.c:9362
int npresolrounds
Definition: struct_stat.h:233
SCIP_RETCODE SCIPsetObjlimit(SCIP *scip, SCIP_Real objlimit)
Definition: scip_prob.c:1421
SCIP_RETCODE SCIPaddReoptDualBndchg(SCIP *scip, SCIP_NODE *node, SCIP_VAR *var, SCIP_Real newbound, SCIP_Real oldbound)
Definition: scip_solve.c:3201
SCIP_RETCODE SCIPtreeFree(SCIP_TREE **tree, BMS_BLKMEM *blkmem, SCIP_SET *set, SCIP_STAT *stat, SCIP_EVENTFILTER *eventfilter, SCIP_EVENTQUEUE *eventqueue, SCIP_LP *lp)
Definition: tree.c:4847
SCIP_SYNCSTORE * SCIPgetSyncstore(SCIP *scip)
SCIP_Real lastlowerbound
Definition: struct_stat.h:144
SCIP_RETCODE SCIPsyncstoreInit(SCIP *scip)
Definition: syncstore.c:127
public methods for concurrent solving mode
SCIP_Real SCIPgetGap(SCIP *scip)
SCIP_RETCODE SCIPapplyBendersDecomposition(SCIP *scip, int decompindex)
void SCIPsolResetViolations(SCIP_SOL *sol)
Definition: sol.c:2334
#define MAX(x, y)
Definition: tclique_def.h:83
SCIP_RETCODE SCIPsolRetransform(SCIP_SOL *sol, SCIP_SET *set, SCIP_STAT *stat, SCIP_PROB *origprob, SCIP_PROB *transprob, SCIP_Bool *hasinfval)
Definition: sol.c:1859
#define BMSgarbagecollectBlockMemory(mem)
Definition: memory.h:465
SCIP_RETCODE SCIPtrySolFree(SCIP *scip, SCIP_SOL **sol, SCIP_Bool printreason, SCIP_Bool completely, SCIP_Bool checkbounds, SCIP_Bool checkintegrality, SCIP_Bool checklprows, SCIP_Bool *stored)
Definition: scip_sol.c:3231
SCIP_RETCODE SCIPsolPrint(SCIP_SOL *sol, SCIP_SET *set, SCIP_MESSAGEHDLR *messagehdlr, SCIP_STAT *stat, SCIP_PROB *prob, SCIP_PROB *transprob, FILE *file, SCIP_Bool mipstart, SCIP_Bool printzeros)
Definition: sol.c:2086
SCIP_RETCODE SCIPfreeConcurrent(SCIP *scip)
Definition: concurrent.c:142
methods for debugging
SCIP_RETCODE SCIPsetIntParam(SCIP *scip, const char *name, int value)
Definition: scip_param.c:478
const char * SCIPpresolGetName(SCIP_PRESOL *presol)
Definition: presol.c:590
int lastnpresolchgcoefs
Definition: struct_stat.h:255
datastructures for block memory pools and memory buffers
SCIP_Real SCIPnextafter(SCIP_Real from, SCIP_Real to)
Definition: misc.c:9265
SCIP_RETCODE SCIPtreeClear(SCIP_TREE *tree, BMS_BLKMEM *blkmem, SCIP_SET *set, SCIP_STAT *stat, SCIP_EVENTFILTER *eventfilter, SCIP_EVENTQUEUE *eventqueue, SCIP_LP *lp)
Definition: tree.c:4896
SCIP_Bool SCIPconsIsChecked(SCIP_CONS *cons)
Definition: cons.c:8284
SCIP_Real SCIPvarGetObj(SCIP_VAR *var)
Definition: var.c:17758
int parallel_minnthreads
Definition: struct_set.h:562
SCIP_RETCODE SCIPcutpoolCreate(SCIP_CUTPOOL **cutpool, BMS_BLKMEM *blkmem, SCIP_SET *set, int agelimit, SCIP_Bool globalcutpool)
Definition: cutpool.c:418
SCIP_RETCODE SCIPvarFlattenAggregationGraph(SCIP_VAR *var, BMS_BLKMEM *blkmem, SCIP_SET *set, SCIP_EVENTQUEUE *eventqueue)
Definition: var.c:4408
int SCIPgetNSols(SCIP *scip)
Definition: scip_sol.c:2205
SCIP_Real limit_memory
Definition: struct_set.h:298
SCIP_RETCODE SCIPlpCreate(SCIP_LP **lp, SCIP_SET *set, SCIP_MESSAGEHDLR *messagehdlr, SCIP_STAT *stat, const char *name)
Definition: lp.c:9070
SCIP_RETCODE SCIPprobTransform(SCIP_PROB *source, BMS_BLKMEM *blkmem, SCIP_SET *set, SCIP_STAT *stat, SCIP_PRIMAL *primal, SCIP_TREE *tree, SCIP_REOPT *reopt, SCIP_LP *lp, SCIP_BRANCHCAND *branchcand, SCIP_EVENTFILTER *eventfilter, SCIP_EVENTQUEUE *eventqueue, SCIP_CONFLICTSTORE *conflictstore, SCIP_PROB **target)
Definition: prob.c:518
SCIP_Real SCIPgetSolOrigObj(SCIP *scip, SCIP_SOL *sol)
Definition: scip_sol.c:1435
internal methods for storing cuts in a cut pool
SCIP_RETCODE SCIPchgFeastol(SCIP *scip, SCIP_Real feastol)
datastructures for problem statistics
int SCIPvarGetMultaggrNVars(SCIP_VAR *var)
Definition: var.c:17678
SCIP_Bool SCIPisInfinity(SCIP *scip, SCIP_Real val)
int reopt_savesols
Definition: struct_set.h:499
static SCIP_RETCODE initSolve(SCIP *scip, SCIP_Bool solved)
Definition: scip_solve.c:1588
SCIP_RETCODE SCIPvarGetOrigvarSum(SCIP_VAR **var, SCIP_Real *scalar, SCIP_Real *constant)
Definition: var.c:12773
SCIP_Bool SCIPsetIsFeasLT(SCIP_SET *set, SCIP_Real val1, SCIP_Real val2)
Definition: set.c:6620
void SCIPbranchcandInvalidate(SCIP_BRANCHCAND *branchcand)
Definition: branch.c:193
void SCIPexitSolveDecompstore(SCIP *scip)
Definition: dcmp.c:533
int SCIPgetNConcsolverTypes(SCIP *scip)
int SCIPgetNBinVars(SCIP *scip)
Definition: scip_prob.c:2036
int SCIPconshdlrGetNActiveConss(SCIP_CONSHDLR *conshdlr)
Definition: cons.c:4624
SCIP_Longint nnz
Definition: struct_stat.h:180
helper functions for concurrent scip solvers
public methods for the LP relaxation, rows and columns
const char * SCIPpropGetName(SCIP_PROP *prop)
Definition: prop.c:932
SCIP_RETCODE SCIPbranchcandFree(SCIP_BRANCHCAND **branchcand)
Definition: branch.c:174
SCIP_CONCSOLVERTYPE ** SCIPgetConcsolverTypes(SCIP *scip)
int SCIPgetNVars(SCIP *scip)
Definition: scip_prob.c:1991
void SCIPstatResetPrimalDualIntegrals(SCIP_STAT *stat, SCIP_SET *set, SCIP_Bool partialreset)
Definition: stat.c:382
SCIP_RETCODE SCIPlpReset(SCIP_LP *lp, BMS_BLKMEM *blkmem, SCIP_SET *set, SCIP_STAT *stat, SCIP_EVENTQUEUE *eventqueue, SCIP_EVENTFILTER *eventfilter)
Definition: lp.c:9407
#define SCIP_REAL_MAX
Definition: def.h:178
SCIP_Bool reopt_sepaglbinfsubtrees
Definition: struct_set.h:512
SCIP_COMPR ** comprs
Definition: struct_set.h:84
datastructures for storing and manipulating the main problem
internal methods for decompositions and the decomposition store
void SCIPstatUpdatePrimalDualIntegrals(SCIP_STAT *stat, SCIP_SET *set, SCIP_PROB *transprob, SCIP_PROB *origprob, SCIP_Real upperbound, SCIP_Real lowerbound)
Definition: stat.c:450
#define SCIPdebugReset(set)
Definition: debug.h:262
public methods for branching rule plugins and branching
int SCIPpropGetPresolPriority(SCIP_PROP *prop)
Definition: prop.c:962
SCIP_RETCODE SCIPprimalHeuristics(SCIP_SET *set, SCIP_STAT *stat, SCIP_PROB *prob, SCIP_PRIMAL *primal, SCIP_TREE *tree, SCIP_LP *lp, SCIP_NODE *nextnode, SCIP_HEURTIMING heurtiming, SCIP_Bool nodeinfeasible, SCIP_Bool *foundsol, SCIP_Bool *unbounded)
Definition: solve.c:205
public methods for presolvers
const char * SCIPcomprGetName(SCIP_COMPR *compr)
Definition: compr.c:447
SCIP_RETCODE SCIPconflictCreate(SCIP_CONFLICT **conflict, BMS_BLKMEM *blkmem, SCIP_SET *set)
Definition: conflict.c:3891
general public methods
SCIP_Bool disp_relevantstats
Definition: struct_set.h:286
BMS_BLKMEM * probmem
Definition: struct_mem.h:40
SCIP_RETCODE SCIPinterruptLP(SCIP *scip, SCIP_Bool interrupt)
Definition: scip_lp.c:865
SCIP_SOL * SCIPgetBestSol(SCIP *scip)
Definition: scip_sol.c:2304
void SCIPstatResetPresolving(SCIP_STAT *stat, SCIP_SET *set, SCIP_PROB *transprob, SCIP_PROB *origprob)
Definition: stat.c:354
SCIP_Bool nlpenabled
Definition: struct_prob.h:80
SCIP_Bool misc_catchctrlc
Definition: struct_set.h:380
SCIP_RETCODE SCIPsolveConcurrent(SCIP *scip)
Definition: scip_solve.c:2948
public methods for solutions
internal methods for conflict analysis
SCIP_Longint SCIPgetMemUsed(SCIP *scip)
Definition: scip_mem.c:91
void SCIPsetSortPresols(SCIP_SET *set)
Definition: set.c:4137
SCIP_NODE * SCIPtreeGetRootNode(SCIP_TREE *tree)
Definition: tree.c:8442
internal methods for tree compressions
public methods for random numbers
internal methods for main solving loop and node processing
size_t BMSgetNUsedBufferMemory(BMS_BUFMEM *buffer)
Definition: memory.c:3113
SCIP_CONS ** SCIPconshdlrGetCheckConss(SCIP_CONSHDLR *conshdlr)
Definition: cons.c:4567
SCIP_VERBLEVEL disp_verblevel
Definition: struct_set.h:280
SCIP_RETCODE SCIPrestartSolve(SCIP *scip)
Definition: scip_solve.c:3571
int nactivepricers
Definition: struct_set.h:109
#define SCIP_PRESOLTIMING_FINAL
Definition: type_timing.h:46
SCIP_RETCODE SCIPeventfilterFree(SCIP_EVENTFILTER **eventfilter, BMS_BLKMEM *blkmem, SCIP_SET *set)
Definition: event.c:1837
int SCIPgetNConss(SCIP *scip)
Definition: scip_prob.c:3041
SCIP_NODE * SCIPtreeGetCurrentNode(SCIP_TREE *tree)
Definition: tree.c:8375
SCIP_CLOCK * solvingtime
Definition: struct_stat.h:151
public methods for tree compressions
SCIP_RETCODE SCIPreoptUpdateVarHistory(SCIP_REOPT *reopt, SCIP_SET *set, SCIP_STAT *stat, BMS_BLKMEM *blkmem, SCIP_VAR **vars, int nvars)
Definition: reopt.c:6666
int nconss
Definition: struct_prob.h:73
SCIP_SET * set
Definition: struct_scip.h:63
void SCIPsyncstoreSetSolveIsStopped(SCIP_SYNCSTORE *syncstore, SCIP_Bool stopped)
Definition: syncstore.c:246
SCIP_Bool misc_transsolsorig
Definition: struct_set.h:394
public methods for message output
void SCIPprobUpdateDualbound(SCIP_PROB *prob, SCIP_Real newbound)
Definition: prob.c:1559
int ncomprs
Definition: struct_set.h:127
SCIP_Longint SCIPgetMemExternEstim(SCIP *scip)
Definition: scip_mem.c:117
static SCIP_RETCODE exitPresolve(SCIP *scip, SCIP_Bool solved, SCIP_Bool *infeasible)
Definition: scip_solve.c:634
SCIP_RETCODE SCIPprimalAddSol(SCIP_PRIMAL *primal, BMS_BLKMEM *blkmem, SCIP_SET *set, SCIP_MESSAGEHDLR *messagehdlr, SCIP_STAT *stat, SCIP_PROB *origprob, SCIP_PROB *transprob, SCIP_TREE *tree, SCIP_REOPT *reopt, SCIP_LP *lp, SCIP_EVENTQUEUE *eventqueue, SCIP_EVENTFILTER *eventfilter, SCIP_SOL *sol, SCIP_Bool *stored)
Definition: primal.c:1187
SCIP_VARSTATUS SCIPvarGetStatus(SCIP_VAR *var)
Definition: var.c:17370
SCIP_Bool misc_transorigsols
Definition: struct_set.h:393
SCIP_MESSAGEHDLR * messagehdlr
Definition: struct_scip.h:66
SCIP_RETCODE SCIPtreeFreePresolvingRoot(SCIP_TREE *tree, SCIP_REOPT *reopt, BMS_BLKMEM *blkmem, SCIP_SET *set, SCIP_MESSAGEHDLR *messagehdlr, SCIP_STAT *stat, SCIP_PROB *transprob, SCIP_PROB *origprob, SCIP_PRIMAL *primal, SCIP_LP *lp, SCIP_BRANCHCAND *branchcand, SCIP_CONFLICT *conflict, SCIP_CONFLICTSTORE *conflictstore, SCIP_EVENTFILTER *eventfilter, SCIP_EVENTQUEUE *eventqueue, SCIP_CLIQUETABLE *cliquetable)
Definition: tree.c:5044
#define SCIP_Real
Definition: def.h:177
SCIP_Bool SCIPconsIsModifiable(SCIP_CONS *cons)
Definition: cons.c:8334
internal methods for problem statistics
SCIP_VAR ** vars
Definition: struct_prob.h:55
SCIP_RETCODE SCIPsolveParallel(SCIP *scip)
Definition: scip_solve.c:2918
SCIP_Bool reopt_commontimelimit
Definition: struct_set.h:502
SCIP_NLP * nlp
Definition: struct_scip.h:83
int SCIPconshdlrGetNCheckConss(SCIP_CONSHDLR *conshdlr)
Definition: cons.c:4610
datastructures for collecting primal CIP solutions and primal informations
public methods for message handling
SCIP_Bool random_permuteconss
Definition: struct_set.h:413
SCIP_CONS ** conss
Definition: struct_prob.h:59
#define SCIP_INVALID
Definition: def.h:197
internal methods for constraints and constraint handlers
SCIP_RETCODE SCIPreoptSaveActiveConss(SCIP_REOPT *reopt, SCIP_SET *set, SCIP_PROB *transprob, BMS_BLKMEM *blkmem)
Definition: reopt.c:8238
#define SCIP_Longint
Definition: def.h:162
int SCIPvarGetIndex(SCIP_VAR *var)
Definition: var.c:17590
static SCIP_RETCODE transformSols(SCIP *scip)
Definition: scip_solve.c:1513
SCIP_Bool SCIPsetIsFeasGT(SCIP_SET *set, SCIP_Real val1, SCIP_Real val2)
Definition: set.c:6664
SCIP_TREE * tree
Definition: struct_scip.h:86
void SCIPprobInvalidateDualbound(SCIP_PROB *prob)
Definition: prob.c:1586
SCIP_RELAXATION * relaxation
Definition: struct_scip.h:84
SCIP_RETCODE SCIPprimalTransformSol(SCIP_PRIMAL *primal, SCIP_SOL *sol, BMS_BLKMEM *blkmem, SCIP_SET *set, SCIP_MESSAGEHDLR *messagehdlr, SCIP_STAT *stat, SCIP_PROB *origprob, SCIP_PROB *transprob, SCIP_TREE *tree, SCIP_REOPT *reopt, SCIP_LP *lp, SCIP_EVENTQUEUE *eventqueue, SCIP_EVENTFILTER *eventfilter, SCIP_Real *solvals, SCIP_Bool *solvalset, int solvalssize, SCIP_Bool *added)
Definition: primal.c:1782
SCIP_RETCODE SCIPtransformProb(SCIP *scip)
Definition: scip_solve.c:358
SCIP_RETCODE SCIPgetReoptOldObjCoef(SCIP *scip, SCIP_VAR *var, int run, SCIP_Real *objcoef)
Definition: scip_solve.c:3246
SCIP_Bool performpresol
Definition: struct_stat.h:273
SCIP_Bool decomp_applybenders
Definition: struct_set.h:467
SCIP_RETCODE SCIPreoptReset(SCIP_REOPT *reopt, SCIP_SET *set, BMS_BLKMEM *blkmem)
Definition: reopt.c:5756
SCIP_RETCODE SCIPprimalCreate(SCIP_PRIMAL **primal)
Definition: primal.c:121
int nconshdlrs
Definition: struct_set.h:111
SCIP_Bool concurrent_presolvebefore
Definition: struct_set.h:569
SCIP_Bool inrestart
Definition: struct_stat.h:271
SCIP_RETCODE SCIPprimalRetransformSolutions(SCIP_PRIMAL *primal, BMS_BLKMEM *blkmem, SCIP_SET *set, SCIP_STAT *stat, SCIP_EVENTFILTER *eventfilter, SCIP_EVENTQUEUE *eventqueue, SCIP_PROB *origprob, SCIP_PROB *transprob, SCIP_TREE *tree, SCIP_REOPT *reopt, SCIP_LP *lp)
Definition: primal.c:1733
SCIP_RETCODE SCIPinterruptSolve(SCIP *scip)
Definition: scip_solve.c:3516
SCIP_Real SCIPgetUpperbound(SCIP *scip)
public methods for primal heuristics
SCIP_Longint nnodes
Definition: struct_stat.h:73
SCIP_RETCODE SCIPreoptSaveGlobalBounds(SCIP_REOPT *reopt, SCIP_PROB *transprob, BMS_BLKMEM *blkmem)
Definition: reopt.c:8200
SCIP_RETCODE SCIPprobExitPresolve(SCIP_PROB *prob, SCIP_SET *set)
Definition: prob.c:1853
SCIP_RETCODE SCIPfreeReoptSolve(SCIP *scip)
Definition: scip_solve.c:3369
SCIP_Bool misc_calcintegral
Definition: struct_set.h:395
int nrootintfixingsrun
Definition: struct_stat.h:216
SCIP_RETCODE SCIPconshdlrCheck(SCIP_CONSHDLR *conshdlr, BMS_BLKMEM *blkmem, SCIP_SET *set, SCIP_STAT *stat, SCIP_SOL *sol, SCIP_Bool checkintegrality, SCIP_Bool checklprows, SCIP_Bool printreason, SCIP_Bool completely, SCIP_RESULT *result)
Definition: cons.c:3738
SCIP_NODE * root
Definition: struct_tree.h:177
#define SCIP_CALL_ABORT(x)
Definition: def.h:363
SCIP_RETCODE SCIPprimalFree(SCIP_PRIMAL **primal, BMS_BLKMEM *blkmem)
Definition: primal.c:151
SCIP_RETCODE SCIPsetExitPlugins(SCIP_SET *set, BMS_BLKMEM *blkmem, SCIP_STAT *stat)
Definition: set.c:5381
SCIP_RETCODE SCIPfreeSolve(SCIP *scip, SCIP_Bool restart)
Definition: scip_solve.c:3302
SCIP_RETCODE SCIPsetExitprePlugins(SCIP_SET *set, BMS_BLKMEM *blkmem, SCIP_STAT *stat)
Definition: set.c:5531
int npresols
Definition: struct_set.h:115
SCIP_LP * lp
Definition: struct_scip.h:82
SCIP_Bool nlp_disable
Definition: struct_set.h:367
int lastnpresolchgsides
Definition: struct_stat.h:256
SCIP_SEPASTORE * sepastoreprobing
Definition: struct_scip.h:94
int SCIPtreeGetNNodes(SCIP_TREE *tree)
Definition: tree.c:8247
#define SCIPABORT()
Definition: def.h:356
public methods for global and local (sub)problems
#define SCIP_EVENTTYPE_PRESOLVEROUND
Definition: type_event.h:80
SCIP_Longint nlimsolsfound
Definition: struct_primal.h:40
int npresolupgdconss
Definition: struct_stat.h:244
const char * SCIPprobGetName(SCIP_PROB *prob)
Definition: prob.c:2334
void SCIPstatMark(SCIP_STAT *stat)
Definition: stat.c:167
SCIP_Bool SCIPisInRestart(SCIP *scip)
Definition: scip_solve.c:3677
datastructures for global SCIP settings
#define SCIPdebugFreeSol(set)
Definition: debug.h:261
int lastnpresolaggrvars
Definition: struct_stat.h:248
SCIP_RETCODE SCIPreoptMergeVarHistory(SCIP_REOPT *reopt, SCIP_SET *set, SCIP_STAT *stat, SCIP_VAR **vars, int nvars)
Definition: reopt.c:6571
int lastnpresolupgdconss
Definition: struct_stat.h:254
SCIP_RETCODE SCIPsepastoreFree(SCIP_SEPASTORE **sepastore, BMS_BLKMEM *blkmem)
Definition: sepastore.c:104
SCIP_RETCODE SCIPvisualInit(SCIP_VISUAL *visual, BMS_BLKMEM *blkmem, SCIP_SET *set, SCIP_MESSAGEHDLR *messagehdlr)
Definition: visual.c:111
SCIP_RETCODE SCIPconsCheck(SCIP_CONS *cons, SCIP_SET *set, SCIP_SOL *sol, SCIP_Bool checkintegrality, SCIP_Bool checklprows, SCIP_Bool printreason, SCIP_RESULT *result)
Definition: cons.c:7295
SCIP_Bool SCIPvarIsActive(SCIP_VAR *var)
Definition: var.c:17580
SCIP_Real objscale
Definition: struct_prob.h:42
public methods for propagators
SCIP_PROP ** props_presol
Definition: struct_set.h:82
SCIP_RETCODE SCIPcreateFiniteSolCopy(SCIP *scip, SCIP_SOL **sol, SCIP_SOL *sourcesol, SCIP_Bool *success)
Definition: scip_sol.c:840
SCIP_RETCODE SCIPsolFree(SCIP_SOL **sol, BMS_BLKMEM *blkmem, SCIP_PRIMAL *primal)
Definition: sol.c:792
methods for selecting (weighted) k-medians
SCIP_RETCODE SCIPcreateSol(SCIP *scip, SCIP_SOL **sol, SCIP_HEUR *heur)
Definition: scip_sol.c:319
int nimplications
Definition: struct_stat.h:232
SCIP_Bool SCIPisSolveInterrupted(SCIP *scip)
Definition: scip_solve.c:3548
SCIP_RETCODE SCIPreoptAddRun(SCIP_REOPT *reopt, SCIP_SET *set, BMS_BLKMEM *blkmem, SCIP_VAR **origvars, int norigvars, int size)
Definition: reopt.c:5416
memory allocation routines