Scippy

SCIP

Solving Constraint Integer Programs

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