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