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