Scippy

SCIP

Solving Constraint Integer Programs

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