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