Scippy

SCIP

Solving Constraint Integer Programs

concsolver_scip.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-2025 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 concsolver_scip.c
26 * @ingroup PARALLEL
27 * @brief implementation of concurrent solver interface for SCIP
28 * @author Leona Gottwald
29 */
30
31/*---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0----+----1----+----2*/
32
34#include "scip/boundstore.h"
35#include "scip/concsolver.h"
37#include "scip/concurrent.h"
38#include "scip/pub_event.h"
39#include "scip/pub_heur.h"
40#include "scip/pub_message.h"
41#include "scip/pub_misc.h"
42#include "scip/pub_paramset.h"
43#include "scip/pub_sol.h"
44#include "scip/pub_var.h"
46#include "scip/scip_copy.h"
47#include "scip/scip_event.h"
48#include "scip/scip_general.h"
49#include "scip/scip_heur.h"
50#include "scip/scip_mem.h"
51#include "scip/scip_message.h"
52#include "scip/scip_numerics.h"
53#include "scip/scip_param.h"
54#include "scip/scip_prob.h"
55#include "scip/scip_sol.h"
56#include "scip/scip_solve.h"
58#include "scip/scip_timing.h"
59#include "scip/syncstore.h"
60#include <string.h>
61
62/* event handler for synchronization */
63#define EVENTHDLR_NAME "sync"
64#define EVENTHDLR_DESC "event handler for synchronization of concurrent scip sovlers"
65
66/*
67 * Data structures
68 */
69
70/** event handler data */
71struct SCIP_EventhdlrData
72{
73 int filterpos;
74};
75
76/*
77 * Callback methods of event handler
78 */
79
80/** destructor of event handler to free user data (called when SCIP is exiting) */
81static
82SCIP_DECL_EVENTFREE(eventFreeSync)
83{ /*lint --e{715}*/
84 SCIP_EVENTHDLRDATA* eventhdlrdata;
85
86 assert(scip != NULL);
87 assert(eventhdlr != NULL);
88 assert(strcmp(SCIPeventhdlrGetName(eventhdlr), EVENTHDLR_NAME) == 0);
89
90 eventhdlrdata = SCIPeventhdlrGetData(eventhdlr);
91 assert(eventhdlrdata != NULL);
92
93 SCIPfreeBlockMemory(scip, &eventhdlrdata);
94
95 SCIPeventhdlrSetData(eventhdlr, NULL);
96
97 return SCIP_OKAY;
98}
99
100/** initialization method of event handler (called after problem was transformed) */
101static
103{ /*lint --e{715}*/
104 SCIP_EVENTHDLRDATA* eventhdlrdata;
105 SCIP_SYNCSTORE* syncstore;
106
107 assert(scip != NULL);
108 assert(eventhdlr != NULL);
109 assert(strcmp(SCIPeventhdlrGetName(eventhdlr), EVENTHDLR_NAME) == 0);
110
111 eventhdlrdata = SCIPeventhdlrGetData(eventhdlr);
112 assert(eventhdlrdata != NULL);
113
114 syncstore = SCIPgetSyncstore(scip);
115 assert(syncstore != NULL);
116
117 if( eventhdlrdata->filterpos < 0 && SCIPsyncstoreIsInitialized(syncstore) )
118 {
119 /* notify SCIP that your event handler wants to react on synchronization events */
120 SCIP_CALL( SCIPcatchEvent(scip, SCIP_EVENTTYPE_SYNC, eventhdlr, NULL, &eventhdlrdata->filterpos) );
121 }
122
123 return SCIP_OKAY;
124}
125
126/** deinitialization method of event handler (called before transformed problem is freed) */
127static
129{ /*lint --e{715}*/
130 SCIP_EVENTHDLRDATA* eventhdlrdata;
131
132 assert(scip != NULL);
133 assert(eventhdlr != NULL);
134 assert(strcmp(SCIPeventhdlrGetName(eventhdlr), EVENTHDLR_NAME) == 0);
135
136 eventhdlrdata = SCIPeventhdlrGetData(eventhdlr);
137 assert(eventhdlrdata != NULL);
138
139 /* notify SCIP that your event handler wants to drop the event type synchronization found */
140 if( eventhdlrdata->filterpos >= 0 )
141 {
142 SCIP_CALL( SCIPdropEvent(scip, SCIP_EVENTTYPE_SYNC, eventhdlr, NULL, eventhdlrdata->filterpos) );
143 eventhdlrdata->filterpos = -1;
144 }
145
146 return SCIP_OKAY;
147}
148
149/** execution method of event handler */
150static
152{ /*lint --e{715}*/
153 assert(eventhdlr != NULL);
154 assert(strcmp(SCIPeventhdlrGetName(eventhdlr), EVENTHDLR_NAME) == 0);
155 assert(event != NULL);
156 assert(scip != NULL);
157
159
160 return SCIP_OKAY;
161}
162
163
164/** includes event handler for synchronization found */
165static
167 SCIP* scip /**< SCIP data structure */
168 )
169{
170 SCIP_EVENTHDLR* eventhdlr;
171 SCIP_EVENTHDLRDATA* eventhdlrdata;
172
173 SCIP_CALL( SCIPallocBlockMemory(scip, &eventhdlrdata) );
174 eventhdlrdata->filterpos = -1;
175
176 /* create event handler for events on watched variables */
177 SCIP_CALL( SCIPincludeEventhdlrBasic(scip, &eventhdlr, EVENTHDLR_NAME, EVENTHDLR_DESC, eventExecSync, eventhdlrdata) );
178 assert(eventhdlr != NULL);
179
180 SCIP_CALL( SCIPsetEventhdlrFree(scip, eventhdlr, eventFreeSync) );
181 SCIP_CALL( SCIPsetEventhdlrInit(scip, eventhdlr, eventInitSync) );
182 SCIP_CALL( SCIPsetEventhdlrExit(scip, eventhdlr, eventExitSync) );
183
184 return SCIP_OKAY;
185}
186
187/** data for a concurrent solver type */
188struct SCIP_ConcSolverTypeData
189{
190 SCIP_Bool loademphasis; /**< should emphasis settings be loaded when creating an instance of this concurrent solver */
191 SCIP_PARAMEMPHASIS emphasis; /**< parameter emphasis that will be loaded if loademphasis is true */
192};
193
194/** data for a concurrent solver */
195struct SCIP_ConcSolverData
196{
197 SCIP* solverscip; /**< the concurrent solvers private SCIP datastructure */
198 SCIP_VAR** vars; /**< array of variables in the order of the main SCIP's variable array */
199 int nvars; /**< number of variables in the above arrays */
200};
201
202/** Disable dual reductions that might cut off optimal solutions. Although they keep at least
203 * one optimal solution intact, communicating these bounds may cut off all optimal solutions,
204 * if different optimal solutions were kept in different concurrent solvers. */
205static
207 SCIP* scip /**< SCIP datastructure */
208 )
209{
210 SCIP_Bool commvarbnds;
211
212 SCIP_CALL( SCIPgetBoolParam(scip, "concurrent/commvarbnds", &commvarbnds) );
213
214 if( !commvarbnds )
215 return SCIP_OKAY;
216
217 SCIP_CALL( SCIPsetBoolParam(scip, "misc/allowstrongdualreds", FALSE) );
218
219 return SCIP_OKAY;
220}
221
222/** sets the child selection rule based on the index of the concurrent solver */
223static
225 SCIP_CONCSOLVER* concsolver /**< the concurrent solver */
226 )
227{
229 static const char childsel[] = { 'h', 'i', 'p', 'r', 'l', 'd', 'u' };
230
231 assert(concsolver != NULL);
232
233 data = SCIPconcsolverGetData(concsolver);
234 assert(data != NULL);
235
236 SCIP_CALL( SCIPsetCharParam(data->solverscip, "nodeselection/childsel", childsel[SCIPconcsolverGetIdx(concsolver) % 7]) );
237
238 return SCIP_OKAY;
239}
240
241/** initialize the concurrent SCIP solver, i.e., setup the copy of the problem and the
242 * mapping of the variables */
243static
245 SCIP* scip, /**< the main SCIP instance */
246 SCIP_CONCSOLVER* concsolver /**< the concurrent solver to set up */
247 )
248{
249 int i;
250 SCIP_VAR** vars;
251 SCIP_Bool valid;
252 SCIP_HASHMAP* varmapfw;
254 int* varperm;
255
256 assert(scip != NULL);
257 assert(concsolver != NULL);
258
259 data = SCIPconcsolverGetData(concsolver);
260 assert(data != NULL);
261
262 data->nvars = SCIPgetNVars(scip);
263 vars = SCIPgetVars(scip);
264
265 /* we force the copying of symmetry constraints that may have been detected during a central presolving step;
266 * otherwise, the copy may become invalid */
267 if( SCIPsetBoolParam(scip, "constraints/orbitope_full/forceconscopy", TRUE) != SCIP_OKAY
268 || SCIPsetBoolParam(scip, "constraints/orbitope_pp/forceconscopy", TRUE) != SCIP_OKAY
269 || SCIPsetBoolParam(scip, "constraints/orbisack/forceconscopy", TRUE) != SCIP_OKAY
270 || SCIPsetBoolParam(scip, "constraints/symresack/forceconscopy", TRUE) != SCIP_OKAY )
271 {
272 SCIPdebugMessage("Could not force copying of symmetry constraints\n");
273 }
274
275 /* create the concurrent solver's SCIP instance and set up the problem */
276 SCIP_CALL( SCIPcreate(&data->solverscip) );
278 SCIP_CALL( SCIPhashmapCreate(&varmapfw, SCIPblkmem(data->solverscip), data->nvars) );
279 SCIP_CALL( SCIPcopyConsCompression(scip, data->solverscip, varmapfw, NULL, SCIPconcsolverGetName(concsolver),
280 NULL, NULL, 0, TRUE, FALSE, FALSE, FALSE, &valid) );
281 assert(valid);
282
283 /* allocate memory for the arrays to store the variable mapping */
284 SCIP_CALL( SCIPallocBlockMemoryArray(data->solverscip, &data->vars, data->nvars) );
285 SCIP_CALL( SCIPallocBufferArray(data->solverscip, &varperm, data->nvars) );
286
287 /* set up the arrays for the variable mapping */
288 for( i = 0; i < data->nvars; i++ )
289 {
290 SCIP_VAR* var;
291 int idx;
292
293 var = (SCIP_VAR*) SCIPhashmapGetImage(varmapfw, vars[i]);
294 assert(var != NULL);
295 idx = SCIPvarGetIndex(var);
296 assert(0 <= idx && idx < data->nvars);
297
298 /* Note that because some aggregations or fixed variables cannot be resolved by some constraint handlers (in
299 * particular cons_orbitope_pp), the copied problem may contain more variables than the original problem has
300 * active variables. These variables will be ignored in the following, since they depend on the other `active'
301 * varibles. See concurrent.c:SCIPgetConcurrentVaridx(). */
302 varperm[idx] = i;
303 data->vars[i] = var;
304 }
305
306 /* transfer solutions from original problem to concurent instances */
307 if( SCIPgetNSols(scip) != 0 )
308 {
309 SCIP_Bool stored;
310 SCIP_Real* solvals;
312 SCIP_SOL* solversol;
313 int norigvars;
314
315 SCIP_CALL( SCIPallocBufferArray(data->solverscip, &solvals, data->nvars) );
316
317 SCIP_CALL( SCIPgetSolVals(scip, sol, data->nvars, vars, solvals) );
318 SCIP_CALL( SCIPcreateSol(data->solverscip, &solversol, NULL) );
319 SCIP_CALL( SCIPsetSolVals(data->solverscip, solversol, data->nvars, data->vars, solvals) );
320 SCIPfreeBufferArray(data->solverscip, &solvals);
321
322 /* handle fixed variables */
323 norigvars = SCIPgetNOrigVars(data->solverscip);
324 if( norigvars > data->nvars )
325 {
326 SCIP_VAR** origvars;
327 int v;
328
329 origvars = SCIPgetOrigVars(data->solverscip);
330 for( v = 0; v < norigvars; ++v )
331 {
332 SCIP_VAR* var;
333 var = origvars[v];
334 if( SCIPisEQ(data->solverscip, SCIPvarGetLbGlobal(var), SCIPvarGetUbGlobal(var)) )
335 {
336 if( ! SCIPisZero(data->solverscip, SCIPvarGetLbGlobal(var)) )
337 {
338 SCIP_CALL( SCIPsetSolVal(data->solverscip, solversol, var, SCIPvarGetLbGlobal(var)) );
339 }
340 }
341 }
342 }
343
344 SCIP_CALL( SCIPaddSolFree(data->solverscip, &solversol, &stored) );
345
346 assert(stored);
347 }
348
349 /* create the concurrent data structure for the concurrent solver's SCIP */
350 /* this assert fails on check/instances/Symmetry/packorb_1-FullIns_3.cip
351 * assert(SCIPgetNOrigVars(data->solverscip) == data->nvars);
352 * also fails on check/instances/Symmetry/partorb_1-FullIns_3.cip
353 * TODO: test if this leads to any problems
354 */
355 SCIP_CALL( SCIPcreateConcurrent(data->solverscip, concsolver, varperm, data->nvars) );
356 SCIPfreeBufferArray(data->solverscip, &varperm);
357
358 /* free the hashmap */
359 SCIPhashmapFree(&varmapfw);
360
361 return SCIP_OKAY;
362}
363
364/** creates an instance of a concurrent SCIP solver */
365static
366SCIP_DECL_CONCSOLVERCREATEINST(concsolverScipCreateInstance)
367{
369 SCIP_CONCSOLVERTYPEDATA* typedata;
370 char* prefix;
371 char filename[SCIP_MAXSTRLEN];
372 SCIP_Bool changechildsel;
373
374 assert(scip != NULL);
375 assert(concsolvertype != NULL);
376 assert(concsolver != NULL);
377
378 typedata = SCIPconcsolverTypeGetData(concsolvertype);
379
380 SCIP_ALLOC( BMSallocMemory(&data) );
381 SCIPconcsolverSetData(concsolver, data);
382
383 SCIP_CALL( initConcsolver(scip, concsolver) );
384
385 /* check if emphasis setting should be loaded */
386 if( typedata->loademphasis )
387 {
388 SCIP_PARAM** params;
389 SCIP_PARAM** fixedparams;
390 int nparams;
391 int nfixedparams;
392 int i;
393
394 params = SCIPgetParams(data->solverscip);
395 nparams = SCIPgetNParams(data->solverscip);
396 SCIP_CALL( SCIPallocBufferArray(data->solverscip, &fixedparams, nparams) );
397 nfixedparams = 0;
398
399 /* fix certain parameters before loading emphasis to avoid setting them to default values */
400 for( i = 0; i < nparams; ++i )
401 {
402 const char* paramname;
403
404 paramname = SCIPparamGetName(params[i]);
405
406 if( strncmp(paramname, "limits/", 7) == 0 ||
407 strncmp(paramname, "numerics/", 9) == 0 ||
408 strncmp(paramname, "memory/", 7) == 0 ||
409 strncmp(paramname, "concurrent/sync/", 16) == 0 ||
410 strncmp(paramname, "heuristics/sync/", 16) == 0 ||
411 strncmp(paramname, "propagating/sync/", 17) == 0 )
412 {
413 fixedparams[nfixedparams++] = params[i];
414 SCIP_CALL( SCIPfixParam(data->solverscip, paramname) );
415 }
416 }
417
418 SCIP_CALL( SCIPsetEmphasis(data->solverscip, typedata->emphasis, TRUE) );
419
420 for( i = 0; i < nfixedparams; ++i )
421 SCIP_CALL( SCIPunfixParam(data->solverscip, SCIPparamGetName(fixedparams[i])) );
422
423 SCIPfreeBufferArray(data->solverscip, &fixedparams);
424 }
425
426 /* load settings file if it exists */
427 SCIP_CALL( SCIPgetStringParam(scip, "concurrent/paramsetprefix", &prefix) );
428 (void) SCIPsnprintf(filename, SCIP_MAXSTRLEN, "%s%s.set", prefix, SCIPconcsolverGetName(concsolver));
429
430 if( SCIPfileExists(filename) )
431 {
432 /* load settings file and print info message */
433 SCIPinfoMessage(scip, NULL, "reading parameter file <%s> for concurrent solver <%s>\n", filename, SCIPconcsolverGetName(concsolver));
434 SCIP_CALL( SCIPreadParams(data->solverscip, filename) );
435 }
436 else
437 {
438 /* print message about missing setting files only in verblevel full */
439 SCIPverbMessage(scip, SCIP_VERBLEVEL_FULL, NULL, "skipping non existent parameter file <%s> for concurrent solver <%s>\n",
440 filename, SCIPconcsolverGetName(concsolver));
441 }
442
443 /* include eventhandler for synchronization */
444 SCIP_CALL( includeEventHdlrSync(data->solverscip) );
445
446 /* disable output for subscip */
447 SCIP_CALL( SCIPsetIntParam(data->solverscip, "display/verblevel", 0) );
448
449 /* use wall clock time in subscips */
450 SCIP_CALL( SCIPsetIntParam(data->solverscip, "timing/clocktype", (int)SCIP_CLOCKTYPE_WALL) );
451
452 /* don't catch ctrlc since already caught in main SCIP */
453 SCIP_CALL( SCIPsetBoolParam(data->solverscip, "misc/catchctrlc", FALSE) );
454
455 /* one solver can do all dual reductions and share them with the other solvers */
456 if( SCIPconcsolverGetIdx(concsolver) != 0 )
457 {
458 SCIP_CALL( disableConflictingDualReductions(data->solverscip) );
459 }
460
461 /* set different child selection rules if corresponding parameter is TRUE */
462 SCIP_CALL( SCIPgetBoolParam(scip, "concurrent/changechildsel", &changechildsel) );
463 if( changechildsel )
464 {
465 SCIP_CALL( setChildSelRule(concsolver) );
466 }
467
468 return SCIP_OKAY;
469}
470
471/** destroys an instance of a concurrent SCIP solver */
472static
473SCIP_DECL_CONCSOLVERDESTROYINST(concsolverScipDestroyInstance)
474{
476
477 assert(concsolver != NULL);
478
479 data = SCIPconcsolverGetData(concsolver);
480 assert(data != NULL);
481 assert(data->solverscip != NULL);
482
483 /* free the array with the variable mapping */
484 SCIPfreeBlockMemoryArray(data->solverscip, &data->vars, data->nvars);
485
486 /* free subscip */
487 SCIP_CALL( SCIPfree(&data->solverscip) );
488 BMSfreeMemory(&data);
489 SCIPconcsolverSetData(concsolver, NULL);
490
491 return SCIP_OKAY;
492}
493
494/** frees the data of a concurrent solver type */
495static
496SCIP_DECL_CONCSOLVERTYPEFREEDATA(concsolverTypeScipFreeData)
497{
498 BMSfreeMemory(data);
499}
500
501/** initializes the random and permutation seeds with the given one
502 * and enables permutation of constraints and variables
503 */
504static
505SCIP_DECL_CONCSOLVERINITSEEDS(concsolverScipInitSeeds)
506{
508
509 assert(concsolver != NULL);
510
511 data = SCIPconcsolverGetData(concsolver);
512 assert(data != NULL);
513
514 SCIPinfoMessage(data->solverscip, NULL, "initializing seeds to %d in concurrent solver '%s'\n", (int) seed, SCIPconcsolverGetName(concsolver));
515
516 SCIP_CALL( SCIPsetIntParam(data->solverscip, "randomization/randomseedshift", (int) seed) );
517 SCIP_CALL( SCIPsetIntParam(data->solverscip, "randomization/permutationseed", (int) seed) );
518 SCIP_CALL( SCIPsetBoolParam(data->solverscip, "randomization/permutevars", TRUE) );
519 SCIP_CALL( SCIPsetBoolParam(data->solverscip, "randomization/permuteconss", TRUE) );
520
521 return SCIP_OKAY;
522}
523
524/** installs the solving status of this concurrent solver and the solving statistics
525 * into the given SCIP instance
526 */
527static
528SCIP_DECL_CONCSOLVERCOPYSOLVINGDATA(concsolverGetSolvingData)
529{
531 int nsols;
532
533 assert(scip != NULL);
534 assert(concsolver != NULL);
535
536 data = SCIPconcsolverGetData(concsolver);
537 assert(data != NULL);
538 assert(data->solverscip != NULL);
539
540 nsols = SCIPgetNSols(data->solverscip);
541 if( nsols > 0 )
542 {
543 SCIP_VAR** vars;
544 SCIP_SOL** sols;
545 SCIP_Real* solvals;
546 int nvars;
547 int i;
548
549 vars = SCIPgetVars(scip);
550 nvars = SCIPgetNVars(scip);
551 assert(nvars == data->nvars);
552
553 sols = SCIPgetSols(data->solverscip);
554
555 /* allocate buffer array used for translating the solution to the given SCIP */
556 SCIP_CALL( SCIPallocBufferArray(scip, &solvals, nvars) );
557
558 /* add the solutions to the given SCIP */
559 for( i = 0; i < nsols; ++i )
560 {
561 SCIP_SOL* sol;
562 SCIP_HEUR* heur;
563 SCIP_Bool stored;
564
565 SCIP_CALL( SCIPgetSolVals(data->solverscip, sols[i], nvars, data->vars, solvals) );
566
567 heur = SCIPsolGetHeur(sols[i]);
568 if( heur != NULL )
569 heur = SCIPfindHeur(scip, SCIPheurGetName(heur));
570
571 SCIP_CALL( SCIPcreateSol(scip, &sol, heur) );
572 SCIP_CALL( SCIPsetSolVals(scip, sol, nvars, vars, solvals) );
573 SCIP_CALL( SCIPcopySolStats(sols[i], sol) );
574 SCIP_CALL( SCIPaddSolFree(scip, &sol, &stored) );
575 }
576
577 /* free the buffer array */
578 SCIPfreeBufferArray(scip, &solvals);
579 }
580
581 /* copy solving statistics and status from the solver SCIP to the given SCIP */
582 SCIP_CALL( SCIPcopyConcurrentSolvingStats(data->solverscip, scip) );
583
584 return SCIP_OKAY;
585}
586
587/** start solving the problem until the solving reaches a limit, gets interrupted, or
588 * just finished successfully
589 */
590static
591SCIP_DECL_CONCSOLVEREXEC(concsolverScipExec)
592{
594
595 assert(concsolver != NULL);
596
597 data = SCIPconcsolverGetData(concsolver);
598 assert(data != NULL);
599
600 /* print info message that solving has started */
601 SCIPinfoMessage(data->solverscip, NULL, "starting solve in concurrent solver '%s'\n", SCIPconcsolverGetName(concsolver));
602
603 /* solve */
604 SCIP_CALL( SCIPsolve(data->solverscip) );
605
606 /* print info message with status */
607 SCIPinfoMessage(data->solverscip, NULL, "concurrent solver '%s' stopped with status ", SCIPconcsolverGetName(concsolver));
608 SCIP_CALL( SCIPprintStatus(data->solverscip, NULL) );
609 SCIPinfoMessage(data->solverscip, NULL, "\n");
610
611 /* set solving statistics */
612 *solvingtime = SCIPgetSolvingTime(data->solverscip);
613 *nlpiterations = SCIPgetNLPIterations(data->solverscip);
614 *nnodes = SCIPgetNNodes(data->solverscip);
615
616 return SCIP_OKAY;
617}
618
619/** stops the concurrent solver as soon as possible */
620static
621SCIP_DECL_CONCSOLVERSTOP(concsolverScipStop)
622{
624 assert(concsolver != NULL);
625
626 data = SCIPconcsolverGetData(concsolver);
627 assert(data != NULL);
628
629 SCIP_CALL( SCIPinterruptSolve(data->solverscip) );
630
631 return SCIP_OKAY;
632}
633
634/** writes new solutions and global boundchanges to the given synchronization data */
635static
636SCIP_DECL_CONCSOLVERSYNCWRITE(concsolverScipSyncWrite)
637{
638 int i;
639 int nsols;
640 SCIP_SOL** sols;
642 SCIP_BOUNDSTORE* boundstore;
643 int concsolverid;
644 SCIP_STATUS solverstatus;
645
646 data = SCIPconcsolverGetData(concsolver);
647 assert(data != NULL);
648 concsolverid = SCIPconcsolverGetIdx(concsolver);
649 solverstatus = SCIPgetStatus(data->solverscip);
650
651 SCIPsyncdataSetStatus(syncdata, solverstatus, concsolverid);
652 SCIPsyncdataSetLowerbound(syncdata, SCIPgetDualbound(data->solverscip));
653 SCIPsyncdataSetUpperbound(syncdata, SCIPgetPrimalbound(data->solverscip));
654
655 *nsolsshared = 0;
656
658 return SCIP_OKAY;
659
660 SCIPdebugMessage("syncing in concurrent solver %s\n", SCIPconcsolverGetName(concsolver));
661
662 /* consider at most maxcandsols many solutions, and since the solution array is sorted, we will cosider the best
663 * solutions
664 */
665 nsols = SCIPgetNSols(data->solverscip);
666 nsols = MIN(nsols, maxcandsols);
667 sols = SCIPgetSols(data->solverscip);
668
669 for( i = 0; i < nsols; ++i )
670 {
671 if( SCIPIsConcurrentSolNew(data->solverscip, sols[i]) )
672 {
673 SCIP_Real solobj;
674 SCIP_Real* solvals;
675
676 solobj = SCIPgetSolOrigObj(data->solverscip, sols[i]);
677
678 SCIPdebugMessage("adding sol in concurrent solver %s\n", SCIPconcsolverGetName(concsolver));
679 SCIPsyncdataGetSolutionBuffer(syncstore, syncdata, solobj, concsolverid, &solvals);
680
681 /* if syncstore has no place for this solution we can stop since the next solution will have
682 * a worse objective value and thus won't be accepted either
683 */
684 if( solvals == NULL )
685 break;
686
687 ++(*nsolsshared);
688 SCIP_CALL( SCIPgetSolVals(data->solverscip, sols[i], data->nvars, data->vars, solvals) );
689
690 /* if we have added the maximum number of solutions we can also stop */
691 if( *nsolsshared == maxsharedsols )
692 break;
693 }
694 }
695
696 boundstore = SCIPgetConcurrentGlobalBoundChanges(data->solverscip);
697
698 if( boundstore != NULL )
699 {
700 SCIP_CALL( SCIPsyncdataAddBoundChanges(syncstore, syncdata, boundstore) );
701 }
702
703 SCIPsyncdataAddMemTotal(syncdata, SCIPgetMemTotal(data->solverscip));
704
705 return SCIP_OKAY;
706}
707
708/** reads the solutions and bounds from the given synchronization data */
709static
710SCIP_DECL_CONCSOLVERSYNCREAD(concsolverScipSyncRead)
711{ /*lint --e{715}*/
712 int i;
713 int nsols;
714 SCIP_Real** solvals;
716 SCIP_BOUNDSTORE* boundstore;
717 int* concsolverids;
718 int concsolverid;
719 int nbndchgs;
720
721 data = SCIPconcsolverGetData(concsolver);
722 assert(data != NULL);
723
724 concsolverid = SCIPconcsolverGetIdx(concsolver);
725
726 /* get solutions from synchronization data */
727 SCIPsyncdataGetSolutions(syncdata, &solvals, &concsolverids, &nsols);
728 *nsolsrecvd = 0;
729
730 for( i = 0; i < nsols; ++i )
731 {
732 SCIP_SOL* newsol;
733 SCIP_VAR** origvars;
734 int norigvars;
735 int v;
736
737 /* do not add own solutions */
738 if( concsolverids[i] == concsolverid )
739 continue;
740
741 /* solution is from other solver so translate to this solvers variable space and add it to SCIP */
742 ++(*nsolsrecvd);
743 SCIP_CALL( SCIPcreateOrigSol(data->solverscip, &newsol, NULL) );
744
745 SCIP_CALL( SCIPsetSolVals(data->solverscip, newsol, data->nvars, data->vars, solvals[i]) );
746
747 /* treat possible fixed original variables */
748 norigvars = SCIPgetNOrigVars(data->solverscip);
749 if( norigvars > data->nvars )
750 {
751 origvars = SCIPgetOrigVars(data->solverscip);
752 for( v = 0; v < norigvars; ++v )
753 {
754 SCIP_VAR* var;
755 var = origvars[v];
756 if( SCIPisEQ(data->solverscip, SCIPvarGetLbGlobal(var), SCIPvarGetUbGlobal(var)) )
757 {
758 if( ! SCIPisZero(data->solverscip, SCIPvarGetLbGlobal(var)) )
759 {
760 SCIP_CALL( SCIPsetSolVal(data->solverscip, newsol, var, SCIPvarGetLbGlobal(var)) );
761 }
762 }
763 }
764 }
765
766 SCIPdebugMessage("adding solution in concurrent solver %s\n", SCIPconcsolverGetName(concsolver));
767 SCIP_CALL( SCIPaddConcurrentSol(data->solverscip, newsol) );
768 }
769
770 /* get bound changes from the synchronization data and add it to this concurrent solvers SCIP */
771 *ntighterbnds = 0;
772 *ntighterintbnds = 0;
773 boundstore = SCIPsyncdataGetBoundChgs(syncdata);
774 nbndchgs = SCIPboundstoreGetNChgs(boundstore);
775
776 for( i = 0; i < nbndchgs; ++i )
777 {
778 SCIP_VAR* var;
779 SCIP_BOUNDTYPE boundtype;
780 SCIP_Real newbound;
781 int idx;
782
783 idx = SCIPboundstoreGetChgVaridx(boundstore, i);
784 assert(0 <= idx && idx < data->nvars);
785 var = data->vars[idx];
786 boundtype = SCIPboundstoreGetChgType(boundstore, i);
787 newbound = SCIPboundstoreGetChgVal(boundstore, i);
788
789 SCIP_CALL( SCIPvarGetProbvarBound(&var, &newbound, &boundtype) );
790
791 /* cannot change bounds of multi-aggregated variables so dont pass this bound-change to the propagator */
793 return SCIP_OKAY;
794
795 /* if bound is not better than also don't pass this bound to the propagator and
796 * don't waste memory for storing this boundchange
797 */
798 if( boundtype == SCIP_BOUNDTYPE_LOWER && SCIPisGE(data->solverscip, SCIPvarGetLbGlobal(var), newbound) )
799 return SCIP_OKAY;
800
801 if( boundtype == SCIP_BOUNDTYPE_UPPER && SCIPisLE(data->solverscip, SCIPvarGetUbGlobal(var), newbound) )
802 return SCIP_OKAY;
803
804 /* bound is better so incremented counters for statistics and pass it to the sync propagator */
805 ++(*ntighterbnds);
806
808 ++(*ntighterintbnds);
809
810 SCIP_CALL( SCIPaddConcurrentBndchg(data->solverscip, var, newbound, boundtype) );
811 }
812
813 return SCIP_OKAY;
814}
815
816
817/** creates the concurrent SCIP solver plugins and includes them in SCIP */
819 SCIP* scip /**< SCIP datastructure */
820 )
821{
823
824 assert(scip != NULL);
825
826 /* Include concurrent solvers for SCIP for all emphasis settings and without an emphasis setting.
827 * For the SCIP without an emphasis setting we set the default preferred priority to 1 and for the other types to 0
828 * so that the default concurent solve will use multiple SCIP's using settings as specified by the user in the main SCIP.
829 */
830 SCIP_CALL( SCIPallocMemory(scip, &data) );
831 data->loademphasis = FALSE;
832 SCIP_CALL( SCIPincludeConcsolverType(scip, "scip", 1.0, concsolverScipCreateInstance, concsolverScipDestroyInstance, concsolverScipInitSeeds,
833 concsolverScipExec, concsolverGetSolvingData, concsolverScipStop, concsolverScipSyncWrite,
834 concsolverScipSyncRead, concsolverTypeScipFreeData, data) );
835
836 SCIP_CALL( SCIPallocMemory(scip, &data) );
837 data->loademphasis = TRUE;
838 data->emphasis = SCIP_PARAMEMPHASIS_DEFAULT;
839 SCIP_CALL( SCIPincludeConcsolverType(scip, "scip-default", 0.0, concsolverScipCreateInstance, concsolverScipDestroyInstance, concsolverScipInitSeeds,
840 concsolverScipExec, concsolverGetSolvingData, concsolverScipStop, concsolverScipSyncWrite,
841 concsolverScipSyncRead, concsolverTypeScipFreeData, data) );
842
843 SCIP_CALL( SCIPallocMemory(scip, &data) );
844 data->loademphasis = TRUE;
845 data->emphasis = SCIP_PARAMEMPHASIS_CPSOLVER;
846 SCIP_CALL( SCIPincludeConcsolverType(scip, "scip-cpsolver", 0.0, concsolverScipCreateInstance, concsolverScipDestroyInstance, concsolverScipInitSeeds,
847 concsolverScipExec, concsolverGetSolvingData, concsolverScipStop, concsolverScipSyncWrite,
848 concsolverScipSyncRead, concsolverTypeScipFreeData, data) );
849
850 SCIP_CALL( SCIPallocMemory(scip, &data) );
851 data->loademphasis = TRUE;
852 data->emphasis = SCIP_PARAMEMPHASIS_EASYCIP;
853 SCIP_CALL( SCIPincludeConcsolverType(scip, "scip-easycip", 0.0, concsolverScipCreateInstance, concsolverScipDestroyInstance, concsolverScipInitSeeds,
854 concsolverScipExec, concsolverGetSolvingData, concsolverScipStop, concsolverScipSyncWrite,
855 concsolverScipSyncRead, concsolverTypeScipFreeData, data) );
856
857 SCIP_CALL( SCIPallocMemory(scip, &data) );
858 data->loademphasis = TRUE;
859 data->emphasis = SCIP_PARAMEMPHASIS_FEASIBILITY;
860 SCIP_CALL( SCIPincludeConcsolverType(scip, "scip-feas", 0.0, concsolverScipCreateInstance, concsolverScipDestroyInstance, concsolverScipInitSeeds,
861 concsolverScipExec, concsolverGetSolvingData, concsolverScipStop, concsolverScipSyncWrite,
862 concsolverScipSyncRead, concsolverTypeScipFreeData, data) );
863
864 SCIP_CALL( SCIPallocMemory(scip, &data) );
865 data->loademphasis = TRUE;
866 data->emphasis = SCIP_PARAMEMPHASIS_HARDLP;
867 SCIP_CALL( SCIPincludeConcsolverType(scip, "scip-hardlp", 0.0, concsolverScipCreateInstance, concsolverScipDestroyInstance, concsolverScipInitSeeds,
868 concsolverScipExec, concsolverGetSolvingData, concsolverScipStop, concsolverScipSyncWrite,
869 concsolverScipSyncRead, concsolverTypeScipFreeData, data) );
870
871 SCIP_CALL( SCIPallocMemory(scip, &data) );
872 data->loademphasis = TRUE;
873 data->emphasis = SCIP_PARAMEMPHASIS_OPTIMALITY;
874 SCIP_CALL( SCIPincludeConcsolverType(scip, "scip-opti", 0.0, concsolverScipCreateInstance, concsolverScipDestroyInstance, concsolverScipInitSeeds,
875 concsolverScipExec, concsolverGetSolvingData, concsolverScipStop, concsolverScipSyncWrite,
876 concsolverScipSyncRead, concsolverTypeScipFreeData, data) );
877
878 SCIP_CALL( SCIPallocMemory(scip, &data) );
879 data->loademphasis = TRUE;
880 data->emphasis = SCIP_PARAMEMPHASIS_COUNTER;
881 SCIP_CALL( SCIPincludeConcsolverType(scip, "scip-counter", 0.0, concsolverScipCreateInstance, concsolverScipDestroyInstance, concsolverScipInitSeeds,
882 concsolverScipExec, concsolverGetSolvingData, concsolverScipStop, concsolverScipSyncWrite,
883 concsolverScipSyncRead, concsolverTypeScipFreeData, data) );
884
885 return SCIP_OKAY;
886}
SCIP_Real SCIPboundstoreGetChgVal(SCIP_BOUNDSTORE *boundstore, int i)
Definition: boundstore.c:185
SCIP_BOUNDTYPE SCIPboundstoreGetChgType(SCIP_BOUNDSTORE *boundstore, int i)
Definition: boundstore.c:173
int SCIPboundstoreGetChgVaridx(SCIP_BOUNDSTORE *boundstore, int i)
Definition: boundstore.c:161
int SCIPboundstoreGetNChgs(SCIP_BOUNDSTORE *boundstore)
Definition: boundstore.c:197
the interface of the boundstore structure
SCIP_CONCSOLVERDATA * SCIPconcsolverGetData(SCIP_CONCSOLVER *concsolver)
Definition: concsolver.c:279
void SCIPconcsolverSetData(SCIP_CONCSOLVER *concsolver, SCIP_CONCSOLVERDATA *data)
Definition: concsolver.c:289
int SCIPconcsolverGetIdx(SCIP_CONCSOLVER *concsolver)
Definition: concsolver.c:623
char * SCIPconcsolverGetName(SCIP_CONCSOLVER *concsolver)
Definition: concsolver.c:300
SCIP_CONCSOLVERTYPEDATA * SCIPconcsolverTypeGetData(SCIP_CONCSOLVERTYPE *concsolvertype)
Definition: concsolver.c:169
datastructures for concurrent solvers
static SCIP_DECL_CONCSOLVERDESTROYINST(concsolverScipDestroyInstance)
static SCIP_DECL_CONCSOLVERINITSEEDS(concsolverScipInitSeeds)
static SCIP_DECL_CONCSOLVERSYNCREAD(concsolverScipSyncRead)
static SCIP_RETCODE initConcsolver(SCIP *scip, SCIP_CONCSOLVER *concsolver)
static SCIP_DECL_EVENTEXIT(eventExitSync)
static SCIP_DECL_CONCSOLVERTYPEFREEDATA(concsolverTypeScipFreeData)
SCIP_RETCODE SCIPincludeConcurrentScipSolvers(SCIP *scip)
static SCIP_RETCODE disableConflictingDualReductions(SCIP *scip)
static SCIP_DECL_EVENTINIT(eventInitSync)
static SCIP_DECL_EVENTFREE(eventFreeSync)
static SCIP_RETCODE setChildSelRule(SCIP_CONCSOLVER *concsolver)
static SCIP_DECL_CONCSOLVERSYNCWRITE(concsolverScipSyncWrite)
static SCIP_DECL_EVENTEXEC(eventExecSync)
static SCIP_RETCODE includeEventHdlrSync(SCIP *scip)
static SCIP_DECL_CONCSOLVERSTOP(concsolverScipStop)
#define EVENTHDLR_DESC
#define EVENTHDLR_NAME
static SCIP_DECL_CONCSOLVERCREATEINST(concsolverScipCreateInstance)
static SCIP_DECL_CONCSOLVEREXEC(concsolverScipExec)
static SCIP_DECL_CONCSOLVERCOPYSOLVINGDATA(concsolverGetSolvingData)
implementation of concurrent solver interface for SCIP
SCIP_RETCODE SCIPcreateConcurrent(SCIP *scip, SCIP_CONCSOLVER *concsolver, int *varperm, int nvars)
Definition: concurrent.c:67
SCIP_RETCODE SCIPsynchronize(SCIP *scip)
Definition: concurrent.c:257
SCIP_RETCODE SCIPaddConcurrentBndchg(SCIP *scip, SCIP_VAR *var, SCIP_Real val, SCIP_BOUNDTYPE bndtype)
Definition: concurrent.c:398
SCIP_RETCODE SCIPcopySolStats(SCIP_SOL *source, SCIP_SOL *target)
Definition: concurrent.c:416
SCIP_BOUNDSTORE * SCIPgetConcurrentGlobalBoundChanges(SCIP *scip)
Definition: concurrent.c:469
SCIP_Bool SCIPIsConcurrentSolNew(SCIP *scip, SCIP_SOL *sol)
Definition: concurrent.c:456
SCIP_RETCODE SCIPcopyConcurrentSolvingStats(SCIP *source, SCIP *target)
Definition: concurrent.c:574
SCIP_RETCODE SCIPaddConcurrentSol(SCIP *scip, SCIP_SOL *sol)
Definition: concurrent.c:383
helper functions for concurrent scip solvers
#define NULL
Definition: def.h:248
#define SCIP_MAXSTRLEN
Definition: def.h:269
#define SCIP_Bool
Definition: def.h:91
#define MIN(x, y)
Definition: def.h:224
#define SCIP_ALLOC(x)
Definition: def.h:366
#define SCIP_Real
Definition: def.h:156
#define TRUE
Definition: def.h:93
#define FALSE
Definition: def.h:94
#define SCIP_CALL(x)
Definition: def.h:355
#define nnodes
Definition: gastrans.c:74
SCIP_RETCODE SCIPcopyConsCompression(SCIP *sourcescip, SCIP *targetscip, SCIP_HASHMAP *varmap, SCIP_HASHMAP *consmap, const char *suffix, SCIP_VAR **fixedvars, SCIP_Real *fixedvals, int nfixedvars, SCIP_Bool global, SCIP_Bool enablepricing, SCIP_Bool threadsafe, SCIP_Bool passmessagehdlr, SCIP_Bool *valid)
Definition: scip_copy.c:2961
SCIP_Bool SCIPfileExists(const char *filename)
Definition: misc.c:11057
SCIP_RETCODE SCIPprintStatus(SCIP *scip, FILE *file)
Definition: scip_general.c:631
SCIP_RETCODE SCIPfree(SCIP **scip)
Definition: scip_general.c:402
SCIP_RETCODE SCIPcreate(SCIP **scip)
Definition: scip_general.c:370
SCIP_STATUS SCIPgetStatus(SCIP *scip)
Definition: scip_general.c:562
SCIP_VAR ** SCIPgetOrigVars(SCIP *scip)
Definition: scip_prob.c:2811
int SCIPgetNVars(SCIP *scip)
Definition: scip_prob.c:2246
SCIP_VAR ** SCIPgetVars(SCIP *scip)
Definition: scip_prob.c:2201
int SCIPgetNOrigVars(SCIP *scip)
Definition: scip_prob.c:2838
void SCIPhashmapFree(SCIP_HASHMAP **hashmap)
Definition: misc.c:3095
void * SCIPhashmapGetImage(SCIP_HASHMAP *hashmap, void *origin)
Definition: misc.c:3284
SCIP_RETCODE SCIPhashmapCreate(SCIP_HASHMAP **hashmap, BMS_BLKMEM *blkmem, int mapsize)
Definition: misc.c:3061
void SCIPinfoMessage(SCIP *scip, FILE *file, const char *formatstr,...)
Definition: scip_message.c:208
void SCIPverbMessage(SCIP *scip, SCIP_VERBLEVEL msgverblevel, FILE *file, const char *formatstr,...)
Definition: scip_message.c:225
SCIP_MESSAGEHDLR * SCIPgetMessagehdlr(SCIP *scip)
Definition: scip_message.c:88
void SCIPsetMessagehdlrQuiet(SCIP *scip, SCIP_Bool quiet)
Definition: scip_message.c:108
SCIP_RETCODE SCIPgetBoolParam(SCIP *scip, const char *name, SCIP_Bool *value)
Definition: scip_param.c:250
int SCIPgetNParams(SCIP *scip)
Definition: scip_param.c:1019
SCIP_RETCODE SCIPsetIntParam(SCIP *scip, const char *name, int value)
Definition: scip_param.c:487
SCIP_RETCODE SCIPreadParams(SCIP *scip, const char *filename)
Definition: scip_param.c:772
SCIP_RETCODE SCIPunfixParam(SCIP *scip, const char *name)
Definition: scip_param.c:385
SCIP_RETCODE SCIPsetEmphasis(SCIP *scip, SCIP_PARAMEMPHASIS paramemphasis, SCIP_Bool quiet)
Definition: scip_param.c:882
SCIP_RETCODE SCIPsetCharParam(SCIP *scip, const char *name, char value)
Definition: scip_param.c:661
SCIP_RETCODE SCIPgetStringParam(SCIP *scip, const char *name, char **value)
Definition: scip_param.c:345
SCIP_PARAM ** SCIPgetParams(SCIP *scip)
Definition: scip_param.c:1005
SCIP_RETCODE SCIPsetBoolParam(SCIP *scip, const char *name, SCIP_Bool value)
Definition: scip_param.c:429
SCIP_RETCODE SCIPfixParam(SCIP *scip, const char *name)
Definition: scip_param.c:367
SCIP_RETCODE SCIPincludeConcsolverType(SCIP *scip, const char *name, SCIP_Real prefpriodefault, SCIP_DECL_CONCSOLVERCREATEINST((*concsolvercreateinst)), SCIP_DECL_CONCSOLVERDESTROYINST((*concsolverdestroyinst)), SCIP_DECL_CONCSOLVERINITSEEDS((*concsolverinitseeds)), SCIP_DECL_CONCSOLVEREXEC((*concsolverexec)), SCIP_DECL_CONCSOLVERCOPYSOLVINGDATA((*concsolvercopysolvdata)), SCIP_DECL_CONCSOLVERSTOP((*concsolverstop)), SCIP_DECL_CONCSOLVERSYNCWRITE((*concsolversyncwrite)), SCIP_DECL_CONCSOLVERSYNCREAD((*concsolversyncread)), SCIP_DECL_CONCSOLVERTYPEFREEDATA((*concsolvertypefreedata)), SCIP_CONCSOLVERTYPEDATA *data)
SCIP_RETCODE SCIPincludeEventhdlrBasic(SCIP *scip, SCIP_EVENTHDLR **eventhdlrptr, const char *name, const char *desc, SCIP_DECL_EVENTEXEC((*eventexec)), SCIP_EVENTHDLRDATA *eventhdlrdata)
Definition: scip_event.c:111
const char * SCIPeventhdlrGetName(SCIP_EVENTHDLR *eventhdlr)
Definition: event.c:396
SCIP_EVENTHDLRDATA * SCIPeventhdlrGetData(SCIP_EVENTHDLR *eventhdlr)
Definition: event.c:406
void SCIPeventhdlrSetData(SCIP_EVENTHDLR *eventhdlr, SCIP_EVENTHDLRDATA *eventhdlrdata)
Definition: event.c:416
SCIP_RETCODE SCIPsetEventhdlrFree(SCIP *scip, SCIP_EVENTHDLR *eventhdlr, SCIP_DECL_EVENTFREE((*eventfree)))
Definition: scip_event.c:157
SCIP_RETCODE SCIPsetEventhdlrExit(SCIP *scip, SCIP_EVENTHDLR *eventhdlr, SCIP_DECL_EVENTEXIT((*eventexit)))
Definition: scip_event.c:185
SCIP_RETCODE SCIPsetEventhdlrInit(SCIP *scip, SCIP_EVENTHDLR *eventhdlr, SCIP_DECL_EVENTINIT((*eventinit)))
Definition: scip_event.c:171
SCIP_RETCODE SCIPcatchEvent(SCIP *scip, SCIP_EVENTTYPE eventtype, SCIP_EVENTHDLR *eventhdlr, SCIP_EVENTDATA *eventdata, int *filterpos)
Definition: scip_event.c:293
SCIP_RETCODE SCIPdropEvent(SCIP *scip, SCIP_EVENTTYPE eventtype, SCIP_EVENTHDLR *eventhdlr, SCIP_EVENTDATA *eventdata, int filterpos)
Definition: scip_event.c:333
SCIP_HEUR * SCIPfindHeur(SCIP *scip, const char *name)
Definition: scip_heur.c:263
const char * SCIPheurGetName(SCIP_HEUR *heur)
Definition: heur.c:1467
#define SCIPfreeBlockMemoryArray(scip, ptr, num)
Definition: scip_mem.h:110
BMS_BLKMEM * SCIPblkmem(SCIP *scip)
Definition: scip_mem.c:57
#define SCIPallocBufferArray(scip, ptr, num)
Definition: scip_mem.h:124
#define SCIPallocMemory(scip, ptr)
Definition: scip_mem.h:60
#define SCIPfreeBufferArray(scip, ptr)
Definition: scip_mem.h:136
#define SCIPallocBlockMemoryArray(scip, ptr, num)
Definition: scip_mem.h:93
#define SCIPfreeBlockMemory(scip, ptr)
Definition: scip_mem.h:108
SCIP_Longint SCIPgetMemTotal(SCIP *scip)
Definition: scip_mem.c:113
#define SCIPallocBlockMemory(scip, ptr)
Definition: scip_mem.h:89
SCIP_SYNCSTORE * SCIPgetSyncstore(SCIP *scip)
SCIP_SOL * SCIPgetBestSol(SCIP *scip)
Definition: scip_sol.c:2981
SCIP_RETCODE SCIPcreateSol(SCIP *scip, SCIP_SOL **sol, SCIP_HEUR *heur)
Definition: scip_sol.c:516
SCIP_RETCODE SCIPaddSolFree(SCIP *scip, SCIP_SOL **sol, SCIP_Bool *stored)
Definition: scip_sol.c:3909
int SCIPgetNSols(SCIP *scip)
Definition: scip_sol.c:2882
SCIP_HEUR * SCIPsolGetHeur(SCIP_SOL *sol)
Definition: sol.c:4259
SCIP_RETCODE SCIPcreateOrigSol(SCIP *scip, SCIP_SOL **sol, SCIP_HEUR *heur)
Definition: scip_sol.c:831
SCIP_RETCODE SCIPgetSolVals(SCIP *scip, SCIP_SOL *sol, int nvars, SCIP_VAR **vars, SCIP_Real *vals)
Definition: scip_sol.c:1846
SCIP_RETCODE SCIPsetSolVals(SCIP *scip, SCIP_SOL *sol, int nvars, SCIP_VAR **vars, SCIP_Real *vals)
Definition: scip_sol.c:1662
SCIP_SOL ** SCIPgetSols(SCIP *scip)
Definition: scip_sol.c:2931
SCIP_Real SCIPgetSolOrigObj(SCIP *scip, SCIP_SOL *sol)
Definition: scip_sol.c:1892
SCIP_RETCODE SCIPsetSolVal(SCIP *scip, SCIP_SOL *sol, SCIP_VAR *var, SCIP_Real val)
Definition: scip_sol.c:1571
SCIP_RETCODE SCIPinterruptSolve(SCIP *scip)
Definition: scip_solve.c:3548
SCIP_RETCODE SCIPsolve(SCIP *scip)
Definition: scip_solve.c:2635
SCIP_Real SCIPgetPrimalbound(SCIP *scip)
SCIP_Longint SCIPgetNNodes(SCIP *scip)
SCIP_Real SCIPgetDualbound(SCIP *scip)
SCIP_Longint SCIPgetNLPIterations(SCIP *scip)
SCIP_Real SCIPgetSolvingTime(SCIP *scip)
Definition: scip_timing.c:378
SCIP_Bool SCIPisGE(SCIP *scip, SCIP_Real val1, SCIP_Real val2)
SCIP_Bool SCIPisLE(SCIP *scip, SCIP_Real val1, SCIP_Real val2)
SCIP_Bool SCIPisEQ(SCIP *scip, SCIP_Real val1, SCIP_Real val2)
SCIP_Bool SCIPisZero(SCIP *scip, SCIP_Real val)
SCIP_RETCODE SCIPvarGetProbvarBound(SCIP_VAR **var, SCIP_Real *bound, SCIP_BOUNDTYPE *boundtype)
Definition: var.c:17801
SCIP_VARSTATUS SCIPvarGetStatus(SCIP_VAR *var)
Definition: var.c:23386
SCIP_Bool SCIPvarIsNonimpliedIntegral(SCIP_VAR *var)
Definition: var.c:23506
SCIP_Real SCIPvarGetUbGlobal(SCIP_VAR *var)
Definition: var.c:24142
int SCIPvarGetIndex(SCIP_VAR *var)
Definition: var.c:23652
SCIP_Real SCIPvarGetLbGlobal(SCIP_VAR *var)
Definition: var.c:24120
int SCIPsnprintf(char *t, int len, const char *s,...)
Definition: misc.c:10827
static const char * paramname[]
Definition: lpi_msk.c:5172
memory allocation routines
#define BMSfreeMemory(ptr)
Definition: memory.h:145
#define BMSallocMemory(ptr)
Definition: memory.h:118
SCIP_Bool SCIPmessagehdlrIsQuiet(SCIP_MESSAGEHDLR *messagehdlr)
Definition: message.c:910
const char * SCIPparamGetName(SCIP_PARAM *param)
Definition: paramset.c:658
public methods for managing events
public methods for primal heuristics
public methods for message output
#define SCIPdebugMessage
Definition: pub_message.h:96
public data structures and miscellaneous methods
public methods for handling parameter settings
public methods for primal CIP solutions
public methods for problem variables
public methods for concurrent solving mode
public methods for problem copies
public methods for event handler plugins and event handlers
general public methods
public methods for primal heuristic plugins and divesets
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 solutions
public solving methods
public methods for querying solving statistics
public methods for timing
SCIP_BOUNDSTORE * SCIPsyncdataGetBoundChgs(SCIP_SYNCDATA *syncdata)
Definition: syncstore.c:624
void SCIPsyncdataSetUpperbound(SCIP_SYNCDATA *syncdata, SCIP_Real upperbound)
Definition: syncstore.c:695
SCIP_RETCODE SCIPsyncdataAddBoundChanges(SCIP_SYNCSTORE *syncstore, SCIP_SYNCDATA *syncdata, SCIP_BOUNDSTORE *boundstore)
Definition: syncstore.c:778
void SCIPsyncdataGetSolutions(SCIP_SYNCDATA *syncdata, SCIP_Real ***solvalues, int **solowner, int *nsols)
Definition: syncstore.c:606
void SCIPsyncdataSetStatus(SCIP_SYNCDATA *syncdata, SCIP_STATUS status, int solverid)
Definition: syncstore.c:648
void SCIPsyncdataSetLowerbound(SCIP_SYNCDATA *syncdata, SCIP_Real lowerbound)
Definition: syncstore.c:706
void SCIPsyncdataGetSolutionBuffer(SCIP_SYNCSTORE *syncstore, SCIP_SYNCDATA *syncdata, SCIP_Real solobj, int ownerid, SCIP_Real **buffer)
Definition: syncstore.c:719
SCIP_Bool SCIPsyncstoreIsInitialized(SCIP_SYNCSTORE *syncstore)
Definition: syncstore.c:795
void SCIPsyncdataAddMemTotal(SCIP_SYNCDATA *syncdata, SCIP_Longint memtotal)
Definition: syncstore.c:684
SCIP_STATUS SCIPsyncdataGetStatus(SCIP_SYNCDATA *syncdata)
Definition: syncstore.c:521
the function declarations for the synchronization store
@ SCIP_CLOCKTYPE_WALL
Definition: type_clock.h:45
struct SCIP_ConcSolverTypeData SCIP_CONCSOLVERTYPEDATA
struct SCIP_ConcSolverData SCIP_CONCSOLVERDATA
#define SCIP_EVENTTYPE_SYNC
Definition: type_event.h:118
struct SCIP_EventhdlrData SCIP_EVENTHDLRDATA
Definition: type_event.h:160
@ SCIP_BOUNDTYPE_UPPER
Definition: type_lp.h:58
@ SCIP_BOUNDTYPE_LOWER
Definition: type_lp.h:57
enum SCIP_BoundType SCIP_BOUNDTYPE
Definition: type_lp.h:60
@ SCIP_VERBLEVEL_FULL
Definition: type_message.h:62
@ SCIP_PARAMEMPHASIS_DEFAULT
Definition: type_paramset.h:70
@ SCIP_PARAMEMPHASIS_CPSOLVER
Definition: type_paramset.h:72
@ SCIP_PARAMEMPHASIS_HARDLP
Definition: type_paramset.h:75
@ SCIP_PARAMEMPHASIS_FEASIBILITY
Definition: type_paramset.h:74
@ SCIP_PARAMEMPHASIS_EASYCIP
Definition: type_paramset.h:73
@ SCIP_PARAMEMPHASIS_COUNTER
Definition: type_paramset.h:77
@ SCIP_PARAMEMPHASIS_OPTIMALITY
Definition: type_paramset.h:76
enum SCIP_ParamEmphasis SCIP_PARAMEMPHASIS
Definition: type_paramset.h:84
@ SCIP_OKAY
Definition: type_retcode.h:42
enum SCIP_Retcode SCIP_RETCODE
Definition: type_retcode.h:63
@ SCIP_STATUS_UNKNOWN
Definition: type_stat.h:42
enum SCIP_Status SCIP_STATUS
Definition: type_stat.h:64
@ SCIP_VARSTATUS_MULTAGGR
Definition: type_var.h:56