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/forceconscopy", TRUE) != SCIP_OKAY
268 || SCIPsetBoolParam(scip, "constraints/orbisack/forceconscopy", TRUE) != SCIP_OKAY
269 || SCIPsetBoolParam(scip, "constraints/symresack/forceconscopy", TRUE) != SCIP_OKAY )
270 {
271 SCIPdebugMessage("Could not force copying of symmetry constraints\n");
272 }
273
274 /* create the concurrent solver's SCIP instance and set up the problem */
275 SCIP_CALL( SCIPcreate(&data->solverscip) );
277 SCIP_CALL( SCIPhashmapCreate(&varmapfw, SCIPblkmem(data->solverscip), data->nvars) );
278 SCIP_CALL( SCIPcopyConsCompression(scip, data->solverscip, varmapfw, NULL, SCIPconcsolverGetName(concsolver),
279 NULL, NULL, 0, TRUE, FALSE, FALSE, FALSE, &valid) );
280 assert(valid);
281
282 /* allocate memory for the arrays to store the variable mapping */
283 SCIP_CALL( SCIPallocBlockMemoryArray(data->solverscip, &data->vars, data->nvars) );
284 SCIP_CALL( SCIPallocBufferArray(data->solverscip, &varperm, data->nvars) );
285
286 /* set up the arrays for the variable mapping */
287 for( i = 0; i < data->nvars; i++ )
288 {
289 SCIP_VAR* var;
290 int idx;
291
292 var = (SCIP_VAR*) SCIPhashmapGetImage(varmapfw, vars[i]);
293 assert(var != NULL);
294 idx = SCIPvarGetIndex(var);
295 assert(0 <= idx && idx < data->nvars);
296
297 /* Note that because some aggregations or fixed variables cannot be resolved by some constraint handlers (in
298 * particular cons_orbitope_pp), the copied problem may contain more variables than the original problem has
299 * active variables. These variables will be ignored in the following, since they depend on the other `active'
300 * varibles. See concurrent.c:SCIPgetConcurrentVaridx(). */
301 varperm[idx] = i;
302 data->vars[i] = var;
303 }
304
305 /* transfer solutions from original problem to concurent instances */
306 if( SCIPgetNSols(scip) != 0 )
307 {
308 SCIP_Bool stored;
309 SCIP_Real* solvals;
311 SCIP_SOL* solversol;
312 int norigvars;
313
314 SCIP_CALL( SCIPallocBufferArray(data->solverscip, &solvals, data->nvars) );
315
316 SCIP_CALL( SCIPgetSolVals(scip, sol, data->nvars, vars, solvals) );
317 SCIP_CALL( SCIPcreateSol(data->solverscip, &solversol, NULL) );
318 SCIP_CALL( SCIPsetSolVals(data->solverscip, solversol, data->nvars, data->vars, solvals) );
319 SCIPfreeBufferArray(data->solverscip, &solvals);
320
321 /* handle fixed variables */
322 norigvars = SCIPgetNOrigVars(data->solverscip);
323 if( norigvars > data->nvars )
324 {
325 SCIP_VAR** origvars;
326 int v;
327
328 origvars = SCIPgetOrigVars(data->solverscip);
329 for( v = 0; v < norigvars; ++v )
330 {
331 SCIP_VAR* var;
332 var = origvars[v];
333 if( SCIPisEQ(data->solverscip, SCIPvarGetLbGlobal(var), SCIPvarGetUbGlobal(var)) )
334 {
335 if( ! SCIPisZero(data->solverscip, SCIPvarGetLbGlobal(var)) )
336 {
337 SCIP_CALL( SCIPsetSolVal(data->solverscip, solversol, var, SCIPvarGetLbGlobal(var)) );
338 }
339 }
340 }
341 }
342
343 SCIP_CALL( SCIPaddSolFree(data->solverscip, &solversol, &stored) );
344
345 assert(stored);
346 }
347
348 /* create the concurrent data structure for the concurrent solver's SCIP */
349 /* this assert fails on check/instances/Symmetry/packorb_1-FullIns_3.cip
350 * assert(SCIPgetNOrigVars(data->solverscip) == data->nvars);
351 * also fails on check/instances/Symmetry/partorb_1-FullIns_3.cip
352 * TODO: test if this leads to any problems
353 */
354 SCIP_CALL( SCIPcreateConcurrent(data->solverscip, concsolver, varperm, data->nvars) );
355 SCIPfreeBufferArray(data->solverscip, &varperm);
356
357 /* free the hashmap */
358 SCIPhashmapFree(&varmapfw);
359
360 return SCIP_OKAY;
361}
362
363/** creates an instance of a concurrent SCIP solver */
364static
365SCIP_DECL_CONCSOLVERCREATEINST(concsolverScipCreateInstance)
366{
368 SCIP_CONCSOLVERTYPEDATA* typedata;
369 char* prefix;
370 char filename[SCIP_MAXSTRLEN];
371 SCIP_Bool changechildsel;
372
373 assert(scip != NULL);
374 assert(concsolvertype != NULL);
375 assert(concsolver != NULL);
376
377 typedata = SCIPconcsolverTypeGetData(concsolvertype);
378
379 SCIP_ALLOC( BMSallocMemory(&data) );
380 SCIPconcsolverSetData(concsolver, data);
381
382 SCIP_CALL( initConcsolver(scip, concsolver) );
383
384 /* check if emphasis setting should be loaded */
385 if( typedata->loademphasis )
386 {
387 SCIP_PARAM** params;
388 SCIP_PARAM** fixedparams;
389 int nparams;
390 int nfixedparams;
391 int i;
392
393 params = SCIPgetParams(data->solverscip);
394 nparams = SCIPgetNParams(data->solverscip);
395 SCIP_CALL( SCIPallocBufferArray(data->solverscip, &fixedparams, nparams) );
396 nfixedparams = 0;
397
398 /* fix certain parameters before loading emphasis to avoid setting them to default values */
399 for( i = 0; i < nparams; ++i )
400 {
401 const char* paramname;
402
403 paramname = SCIPparamGetName(params[i]);
404
405 if( strncmp(paramname, "limits/", 7) == 0 ||
406 strncmp(paramname, "numerics/", 9) == 0 ||
407 strncmp(paramname, "memory/", 7) == 0 ||
408 strncmp(paramname, "concurrent/sync/", 16) == 0 ||
409 strncmp(paramname, "heuristics/sync/", 16) == 0 ||
410 strncmp(paramname, "propagating/sync/", 17) == 0 )
411 {
412 fixedparams[nfixedparams++] = params[i];
413 SCIP_CALL( SCIPfixParam(data->solverscip, paramname) );
414 }
415 }
416
417 SCIP_CALL( SCIPsetEmphasis(data->solverscip, typedata->emphasis, TRUE) );
418
419 for( i = 0; i < nfixedparams; ++i )
420 SCIP_CALL( SCIPunfixParam(data->solverscip, SCIPparamGetName(fixedparams[i])) );
421
422 SCIPfreeBufferArray(data->solverscip, &fixedparams);
423 }
424
425 /* load settings file if it exists */
426 SCIP_CALL( SCIPgetStringParam(scip, "concurrent/paramsetprefix", &prefix) );
427 (void) SCIPsnprintf(filename, SCIP_MAXSTRLEN, "%s%s.set", prefix, SCIPconcsolverGetName(concsolver));
428
429 if( SCIPfileExists(filename) )
430 {
431 /* load settings file and print info message */
432 SCIPinfoMessage(scip, NULL, "reading parameter file <%s> for concurrent solver <%s>\n", filename, SCIPconcsolverGetName(concsolver));
433 SCIP_CALL( SCIPreadParams(data->solverscip, filename) );
434 }
435 else
436 {
437 /* print message about missing setting files only in verblevel full */
438 SCIPverbMessage(scip, SCIP_VERBLEVEL_FULL, NULL, "skipping non existent parameter file <%s> for concurrent solver <%s>\n",
439 filename, SCIPconcsolverGetName(concsolver));
440 }
441
442 /* include eventhandler for synchronization */
443 SCIP_CALL( includeEventHdlrSync(data->solverscip) );
444
445 /* disable output for subscip */
446 SCIP_CALL( SCIPsetIntParam(data->solverscip, "display/verblevel", 0) );
447
448 /* use wall clock time in subscips */
449 SCIP_CALL( SCIPsetIntParam(data->solverscip, "timing/clocktype", (int)SCIP_CLOCKTYPE_WALL) );
450
451 /* don't catch ctrlc since already caught in main SCIP */
452 SCIP_CALL( SCIPsetBoolParam(data->solverscip, "misc/catchctrlc", FALSE) );
453
454 /* one solver can do all dual reductions and share them with the other solvers */
455 if( SCIPconcsolverGetIdx(concsolver) != 0 )
456 {
457 SCIP_CALL( disableConflictingDualReductions(data->solverscip) );
458 }
459
460 /* set different child selection rules if corresponding parameter is TRUE */
461 SCIP_CALL( SCIPgetBoolParam(scip, "concurrent/changechildsel", &changechildsel) );
462 if( changechildsel )
463 {
464 SCIP_CALL( setChildSelRule(concsolver) );
465 }
466
467 return SCIP_OKAY;
468}
469
470/** destroys an instance of a concurrent SCIP solver */
471static
472SCIP_DECL_CONCSOLVERDESTROYINST(concsolverScipDestroyInstance)
473{
475
476 assert(concsolver != NULL);
477
478 data = SCIPconcsolverGetData(concsolver);
479 assert(data != NULL);
480 assert(data->solverscip != NULL);
481
482 /* free the array with the variable mapping */
483 SCIPfreeBlockMemoryArray(data->solverscip, &data->vars, data->nvars);
484
485 /* free subscip */
486 SCIP_CALL( SCIPfree(&data->solverscip) );
487 BMSfreeMemory(&data);
488 SCIPconcsolverSetData(concsolver, NULL);
489
490 return SCIP_OKAY;
491}
492
493/** frees the data of a concurrent solver type */
494static
495SCIP_DECL_CONCSOLVERTYPEFREEDATA(concsolverTypeScipFreeData)
496{
497 BMSfreeMemory(data);
498}
499
500/** initializes the random and permutation seeds with the given one
501 * and enables permutation of constraints and variables
502 */
503static
504SCIP_DECL_CONCSOLVERINITSEEDS(concsolverScipInitSeeds)
505{
507
508 assert(concsolver != NULL);
509
510 data = SCIPconcsolverGetData(concsolver);
511 assert(data != NULL);
512
513 SCIPinfoMessage(data->solverscip, NULL, "initializing seeds to %d in concurrent solver '%s'\n", (int) seed, SCIPconcsolverGetName(concsolver));
514
515 SCIP_CALL( SCIPsetIntParam(data->solverscip, "randomization/randomseedshift", (int) seed) );
516 SCIP_CALL( SCIPsetIntParam(data->solverscip, "randomization/permutationseed", (int) seed) );
517 SCIP_CALL( SCIPsetBoolParam(data->solverscip, "randomization/permutevars", TRUE) );
518 SCIP_CALL( SCIPsetBoolParam(data->solverscip, "randomization/permuteconss", TRUE) );
519
520 return SCIP_OKAY;
521}
522
523/** installs the solving status of this concurrent solver and the solving statistics
524 * into the given SCIP instance
525 */
526static
527SCIP_DECL_CONCSOLVERCOPYSOLVINGDATA(concsolverGetSolvingData)
528{
530 int nsols;
531
532 assert(scip != NULL);
533 assert(concsolver != NULL);
534
535 data = SCIPconcsolverGetData(concsolver);
536 assert(data != NULL);
537 assert(data->solverscip != NULL);
538
539 nsols = SCIPgetNSols(data->solverscip);
540 if( nsols > 0 )
541 {
542 SCIP_VAR** vars;
543 SCIP_SOL** sols;
544 SCIP_Real* solvals;
545 int nvars;
546 int i;
547
548 vars = SCIPgetVars(scip);
549 nvars = SCIPgetNVars(scip);
550 assert(nvars == data->nvars);
551
552 sols = SCIPgetSols(data->solverscip);
553
554 /* allocate buffer array used for translating the solution to the given SCIP */
555 SCIP_CALL( SCIPallocBufferArray(scip, &solvals, nvars) );
556
557 /* add the solutions to the given SCIP */
558 for( i = 0; i < nsols; ++i )
559 {
560 SCIP_SOL* sol;
561 SCIP_HEUR* heur;
562 SCIP_Bool stored;
563
564 SCIP_CALL( SCIPgetSolVals(data->solverscip, sols[i], nvars, data->vars, solvals) );
565
566 heur = SCIPsolGetHeur(sols[i]);
567 if( heur != NULL )
568 heur = SCIPfindHeur(scip, SCIPheurGetName(heur));
569
570 SCIP_CALL( SCIPcreateSol(scip, &sol, heur) );
571 SCIP_CALL( SCIPsetSolVals(scip, sol, nvars, vars, solvals) );
572 SCIP_CALL( SCIPcopySolStats(sols[i], sol) );
573 SCIP_CALL( SCIPaddSolFree(scip, &sol, &stored) );
574 }
575
576 /* free the buffer array */
577 SCIPfreeBufferArray(scip, &solvals);
578 }
579
580 /* copy solving statistics and status from the solver SCIP to the given SCIP */
581 SCIP_CALL( SCIPcopyConcurrentSolvingStats(data->solverscip, scip) );
582
583 return SCIP_OKAY;
584}
585
586/** start solving the problem until the solving reaches a limit, gets interrupted, or
587 * just finished successfully
588 */
589static
590SCIP_DECL_CONCSOLVEREXEC(concsolverScipExec)
591{
593
594 assert(concsolver != NULL);
595
596 data = SCIPconcsolverGetData(concsolver);
597 assert(data != NULL);
598
599 /* print info message that solving has started */
600 SCIPinfoMessage(data->solverscip, NULL, "starting solve in concurrent solver '%s'\n", SCIPconcsolverGetName(concsolver));
601
602 /* solve */
603 SCIP_CALL( SCIPsolve(data->solverscip) );
604
605 /* print info message with status */
606 SCIPinfoMessage(data->solverscip, NULL, "concurrent solver '%s' stopped with status ", SCIPconcsolverGetName(concsolver));
607 SCIP_CALL( SCIPprintStatus(data->solverscip, NULL) );
608 SCIPinfoMessage(data->solverscip, NULL, "\n");
609
610 /* set solving statistics */
611 *solvingtime = SCIPgetSolvingTime(data->solverscip);
612 *nlpiterations = SCIPgetNLPIterations(data->solverscip);
613 *nnodes = SCIPgetNNodes(data->solverscip);
614
615 return SCIP_OKAY;
616}
617
618/** stops the concurrent solver as soon as possible */
619static
620SCIP_DECL_CONCSOLVERSTOP(concsolverScipStop)
621{
623 assert(concsolver != NULL);
624
625 data = SCIPconcsolverGetData(concsolver);
626 assert(data != NULL);
627
628 SCIP_CALL( SCIPinterruptSolve(data->solverscip) );
629
630 return SCIP_OKAY;
631}
632
633/** writes new solutions and global boundchanges to the given synchronization data */
634static
635SCIP_DECL_CONCSOLVERSYNCWRITE(concsolverScipSyncWrite)
636{
637 int i;
638 int nsols;
639 SCIP_SOL** sols;
641 SCIP_BOUNDSTORE* boundstore;
642 int concsolverid;
643 SCIP_STATUS solverstatus;
644
645 data = SCIPconcsolverGetData(concsolver);
646 assert(data != NULL);
647 concsolverid = SCIPconcsolverGetIdx(concsolver);
648 solverstatus = SCIPgetStatus(data->solverscip);
649
650 SCIPsyncdataSetStatus(syncdata, solverstatus, concsolverid);
651 SCIPsyncdataSetLowerbound(syncdata, SCIPgetDualbound(data->solverscip));
652 SCIPsyncdataSetUpperbound(syncdata, SCIPgetPrimalbound(data->solverscip));
653
654 *nsolsshared = 0;
655
657 return SCIP_OKAY;
658
659 SCIPdebugMessage("syncing in concurrent solver %s\n", SCIPconcsolverGetName(concsolver));
660
661 /* consider at most maxcandsols many solutions, and since the solution array is sorted, we will cosider the best
662 * solutions
663 */
664 nsols = SCIPgetNSols(data->solverscip);
665 nsols = MIN(nsols, maxcandsols);
666 sols = SCIPgetSols(data->solverscip);
667
668 for( i = 0; i < nsols; ++i )
669 {
670 if( SCIPIsConcurrentSolNew(data->solverscip, sols[i]) )
671 {
672 SCIP_Real solobj;
673 SCIP_Real* solvals;
674
675 solobj = SCIPgetSolOrigObj(data->solverscip, sols[i]);
676
677 SCIPdebugMessage("adding sol in concurrent solver %s\n", SCIPconcsolverGetName(concsolver));
678 SCIPsyncdataGetSolutionBuffer(syncstore, syncdata, solobj, concsolverid, &solvals);
679
680 /* if syncstore has no place for this solution we can stop since the next solution will have
681 * a worse objective value and thus won't be accepted either
682 */
683 if( solvals == NULL )
684 break;
685
686 ++(*nsolsshared);
687 SCIP_CALL( SCIPgetSolVals(data->solverscip, sols[i], data->nvars, data->vars, solvals) );
688
689 /* if we have added the maximum number of solutions we can also stop */
690 if( *nsolsshared == maxsharedsols )
691 break;
692 }
693 }
694
695 boundstore = SCIPgetConcurrentGlobalBoundChanges(data->solverscip);
696
697 if( boundstore != NULL )
698 {
699 SCIP_CALL( SCIPsyncdataAddBoundChanges(syncstore, syncdata, boundstore) );
700 }
701
702 SCIPsyncdataAddMemTotal(syncdata, SCIPgetMemTotal(data->solverscip));
703
704 return SCIP_OKAY;
705}
706
707/** reads the solutions and bounds from the given synchronization data */
708static
709SCIP_DECL_CONCSOLVERSYNCREAD(concsolverScipSyncRead)
710{ /*lint --e{715}*/
711 int i;
712 int nsols;
713 SCIP_Real** solvals;
715 SCIP_BOUNDSTORE* boundstore;
716 int* concsolverids;
717 int concsolverid;
718 int nbndchgs;
719
720 data = SCIPconcsolverGetData(concsolver);
721 assert(data != NULL);
722
723 concsolverid = SCIPconcsolverGetIdx(concsolver);
724
725 /* get solutions from synchronization data */
726 SCIPsyncdataGetSolutions(syncdata, &solvals, &concsolverids, &nsols);
727 *nsolsrecvd = 0;
728
729 for( i = 0; i < nsols; ++i )
730 {
731 SCIP_SOL* newsol;
732 SCIP_VAR** origvars;
733 int norigvars;
734 int v;
735
736 /* do not add own solutions */
737 if( concsolverids[i] == concsolverid )
738 continue;
739
740 /* solution is from other solver so translate to this solvers variable space and add it to SCIP */
741 ++(*nsolsrecvd);
742 SCIP_CALL( SCIPcreateOrigSol(data->solverscip, &newsol, NULL) );
743
744 SCIP_CALL( SCIPsetSolVals(data->solverscip, newsol, data->nvars, data->vars, solvals[i]) );
745
746 /* treat possible fixed original variables */
747 norigvars = SCIPgetNOrigVars(data->solverscip);
748 if( norigvars > data->nvars )
749 {
750 origvars = SCIPgetOrigVars(data->solverscip);
751 for( v = 0; v < norigvars; ++v )
752 {
753 SCIP_VAR* var;
754 var = origvars[v];
755 if( SCIPisEQ(data->solverscip, SCIPvarGetLbGlobal(var), SCIPvarGetUbGlobal(var)) )
756 {
757 if( ! SCIPisZero(data->solverscip, SCIPvarGetLbGlobal(var)) )
758 {
759 SCIP_CALL( SCIPsetSolVal(data->solverscip, newsol, var, SCIPvarGetLbGlobal(var)) );
760 }
761 }
762 }
763 }
764
765 SCIPdebugMessage("adding solution in concurrent solver %s\n", SCIPconcsolverGetName(concsolver));
766 SCIP_CALL( SCIPaddConcurrentSol(data->solverscip, newsol) );
767 }
768
769 /* get bound changes from the synchronization data and add it to this concurrent solvers SCIP */
770 *ntighterbnds = 0;
771 *ntighterintbnds = 0;
772 boundstore = SCIPsyncdataGetBoundChgs(syncdata);
773 nbndchgs = SCIPboundstoreGetNChgs(boundstore);
774
775 for( i = 0; i < nbndchgs; ++i )
776 {
777 SCIP_VAR* var;
778 SCIP_BOUNDTYPE boundtype;
779 SCIP_Real newbound;
780 int idx;
781
782 idx = SCIPboundstoreGetChgVaridx(boundstore, i);
783 assert(0 <= idx && idx < data->nvars);
784 var = data->vars[idx];
785 boundtype = SCIPboundstoreGetChgType(boundstore, i);
786 newbound = SCIPboundstoreGetChgVal(boundstore, i);
787
788 SCIP_CALL( SCIPvarGetProbvarBound(&var, &newbound, &boundtype) );
789
790 /* cannot change bounds of multi-aggregated variables so dont pass this bound-change to the propagator */
792 return SCIP_OKAY;
793
794 /* if bound is not better than also don't pass this bound to the propagator and
795 * don't waste memory for storing this boundchange
796 */
797 if( boundtype == SCIP_BOUNDTYPE_LOWER && SCIPisGE(data->solverscip, SCIPvarGetLbGlobal(var), newbound) )
798 return SCIP_OKAY;
799
800 if( boundtype == SCIP_BOUNDTYPE_UPPER && SCIPisLE(data->solverscip, SCIPvarGetUbGlobal(var), newbound) )
801 return SCIP_OKAY;
802
803 /* bound is better so incremented counters for statistics and pass it to the sync propagator */
804 ++(*ntighterbnds);
805
807 ++(*ntighterintbnds);
808
809 SCIP_CALL( SCIPaddConcurrentBndchg(data->solverscip, var, newbound, boundtype) );
810 }
811
812 return SCIP_OKAY;
813}
814
815
816/** creates the concurrent SCIP solver plugins and includes them in SCIP */
818 SCIP* scip /**< SCIP datastructure */
819 )
820{
822
823 assert(scip != NULL);
824
825 /* Include concurrent solvers for SCIP for all emphasis settings and without an emphasis setting.
826 * For the SCIP without an emphasis setting we set the default preferred priority to 1 and for the other types to 0
827 * so that the default concurent solve will use multiple SCIP's using settings as specified by the user in the main SCIP.
828 */
829 SCIP_CALL( SCIPallocMemory(scip, &data) );
830 data->loademphasis = FALSE;
831 SCIP_CALL( SCIPincludeConcsolverType(scip, "scip", 1.0, concsolverScipCreateInstance, concsolverScipDestroyInstance, concsolverScipInitSeeds,
832 concsolverScipExec, concsolverGetSolvingData, concsolverScipStop, concsolverScipSyncWrite,
833 concsolverScipSyncRead, concsolverTypeScipFreeData, data) );
834
835 SCIP_CALL( SCIPallocMemory(scip, &data) );
836 data->loademphasis = TRUE;
837 data->emphasis = SCIP_PARAMEMPHASIS_DEFAULT;
838 SCIP_CALL( SCIPincludeConcsolverType(scip, "scip-default", 0.0, concsolverScipCreateInstance, concsolverScipDestroyInstance, concsolverScipInitSeeds,
839 concsolverScipExec, concsolverGetSolvingData, concsolverScipStop, concsolverScipSyncWrite,
840 concsolverScipSyncRead, concsolverTypeScipFreeData, data) );
841
842 SCIP_CALL( SCIPallocMemory(scip, &data) );
843 data->loademphasis = TRUE;
844 data->emphasis = SCIP_PARAMEMPHASIS_CPSOLVER;
845 SCIP_CALL( SCIPincludeConcsolverType(scip, "scip-cpsolver", 0.0, concsolverScipCreateInstance, concsolverScipDestroyInstance, concsolverScipInitSeeds,
846 concsolverScipExec, concsolverGetSolvingData, concsolverScipStop, concsolverScipSyncWrite,
847 concsolverScipSyncRead, concsolverTypeScipFreeData, data) );
848
849 SCIP_CALL( SCIPallocMemory(scip, &data) );
850 data->loademphasis = TRUE;
851 data->emphasis = SCIP_PARAMEMPHASIS_EASYCIP;
852 SCIP_CALL( SCIPincludeConcsolverType(scip, "scip-easycip", 0.0, concsolverScipCreateInstance, concsolverScipDestroyInstance, concsolverScipInitSeeds,
853 concsolverScipExec, concsolverGetSolvingData, concsolverScipStop, concsolverScipSyncWrite,
854 concsolverScipSyncRead, concsolverTypeScipFreeData, data) );
855
856 SCIP_CALL( SCIPallocMemory(scip, &data) );
857 data->loademphasis = TRUE;
858 data->emphasis = SCIP_PARAMEMPHASIS_FEASIBILITY;
859 SCIP_CALL( SCIPincludeConcsolverType(scip, "scip-feas", 0.0, concsolverScipCreateInstance, concsolverScipDestroyInstance, concsolverScipInitSeeds,
860 concsolverScipExec, concsolverGetSolvingData, concsolverScipStop, concsolverScipSyncWrite,
861 concsolverScipSyncRead, concsolverTypeScipFreeData, data) );
862
863 SCIP_CALL( SCIPallocMemory(scip, &data) );
864 data->loademphasis = TRUE;
865 data->emphasis = SCIP_PARAMEMPHASIS_HARDLP;
866 SCIP_CALL( SCIPincludeConcsolverType(scip, "scip-hardlp", 0.0, concsolverScipCreateInstance, concsolverScipDestroyInstance, concsolverScipInitSeeds,
867 concsolverScipExec, concsolverGetSolvingData, concsolverScipStop, concsolverScipSyncWrite,
868 concsolverScipSyncRead, concsolverTypeScipFreeData, data) );
869
870 SCIP_CALL( SCIPallocMemory(scip, &data) );
871 data->loademphasis = TRUE;
872 data->emphasis = SCIP_PARAMEMPHASIS_OPTIMALITY;
873 SCIP_CALL( SCIPincludeConcsolverType(scip, "scip-opti", 0.0, concsolverScipCreateInstance, concsolverScipDestroyInstance, concsolverScipInitSeeds,
874 concsolverScipExec, concsolverGetSolvingData, concsolverScipStop, concsolverScipSyncWrite,
875 concsolverScipSyncRead, concsolverTypeScipFreeData, data) );
876
877 SCIP_CALL( SCIPallocMemory(scip, &data) );
878 data->loademphasis = TRUE;
879 data->emphasis = SCIP_PARAMEMPHASIS_COUNTER;
880 SCIP_CALL( SCIPincludeConcsolverType(scip, "scip-counter", 0.0, concsolverScipCreateInstance, concsolverScipDestroyInstance, concsolverScipInitSeeds,
881 concsolverScipExec, concsolverGetSolvingData, concsolverScipStop, concsolverScipSyncWrite,
882 concsolverScipSyncRead, concsolverTypeScipFreeData, data) );
883
884 return SCIP_OKAY;
885}
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:262
#define SCIP_MAXSTRLEN
Definition: def.h:283
#define SCIP_Bool
Definition: def.h:91
#define MIN(x, y)
Definition: def.h:238
#define SCIP_ALLOC(x)
Definition: def.h:380
#define SCIP_Real
Definition: def.h:172
#define TRUE
Definition: def.h:93
#define FALSE
Definition: def.h:94
#define SCIP_CALL(x)
Definition: def.h:369
#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:2971
SCIP_Bool SCIPfileExists(const char *filename)
Definition: misc.c:11108
SCIP_RETCODE SCIPprintStatus(SCIP *scip, FILE *file)
Definition: scip_general.c:531
SCIP_RETCODE SCIPfree(SCIP **scip)
Definition: scip_general.c:349
SCIP_RETCODE SCIPcreate(SCIP **scip)
Definition: scip_general.c:317
SCIP_STATUS SCIPgetStatus(SCIP *scip)
Definition: scip_general.c:508
SCIP_VAR ** SCIPgetOrigVars(SCIP *scip)
Definition: scip_prob.c:2405
int SCIPgetNVars(SCIP *scip)
Definition: scip_prob.c:1992
SCIP_VAR ** SCIPgetVars(SCIP *scip)
Definition: scip_prob.c:1947
int SCIPgetNOrigVars(SCIP *scip)
Definition: scip_prob.c:2432
void SCIPhashmapFree(SCIP_HASHMAP **hashmap)
Definition: misc.c:3110
void * SCIPhashmapGetImage(SCIP_HASHMAP *hashmap, void *origin)
Definition: misc.c:3263
SCIP_RETCODE SCIPhashmapCreate(SCIP_HASHMAP **hashmap, BMS_BLKMEM *blkmem, int mapsize)
Definition: misc.c:3076
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:324
SCIP_EVENTHDLRDATA * SCIPeventhdlrGetData(SCIP_EVENTHDLR *eventhdlr)
Definition: event.c:334
void SCIPeventhdlrSetData(SCIP_EVENTHDLR *eventhdlr, SCIP_EVENTHDLRDATA *eventhdlrdata)
Definition: event.c:344
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:327
SCIP_HEUR * SCIPfindHeur(SCIP *scip, const char *name)
Definition: scip_heur.c:263
const char * SCIPheurGetName(SCIP_HEUR *heur)
Definition: heur.c:1453
#define SCIPfreeBlockMemoryArray(scip, ptr, num)
Definition: scip_mem.h:110
#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:2165
SCIP_RETCODE SCIPcreateSol(SCIP *scip, SCIP_SOL **sol, SCIP_HEUR *heur)
Definition: scip_sol.c:180
SCIP_RETCODE SCIPaddSolFree(SCIP *scip, SCIP_SOL **sol, SCIP_Bool *stored)
Definition: scip_sol.c:2851
int SCIPgetNSols(SCIP *scip)
Definition: scip_sol.c:2066
SCIP_HEUR * SCIPsolGetHeur(SCIP_SOL *sol)
Definition: sol.c:2804
SCIP_RETCODE SCIPcreateOrigSol(SCIP *scip, SCIP_SOL **sol, SCIP_HEUR *heur)
Definition: scip_sol.c:417
SCIP_RETCODE SCIPgetSolVals(SCIP *scip, SCIP_SOL *sol, int nvars, SCIP_VAR **vars, SCIP_Real *vals)
Definition: scip_sol.c:1250
SCIP_RETCODE SCIPsetSolVals(SCIP *scip, SCIP_SOL *sol, int nvars, SCIP_VAR **vars, SCIP_Real *vals)
Definition: scip_sol.c:1115
SCIP_SOL ** SCIPgetSols(SCIP *scip)
Definition: scip_sol.c:2115
SCIP_Real SCIPgetSolOrigObj(SCIP *scip, SCIP_SOL *sol)
Definition: scip_sol.c:1296
SCIP_RETCODE SCIPsetSolVal(SCIP *scip, SCIP_SOL *sol, SCIP_VAR *var, SCIP_Real val)
Definition: scip_sol.c:1073
SCIP_RETCODE SCIPinterruptSolve(SCIP *scip)
Definition: scip_solve.c:3425
SCIP_RETCODE SCIPsolve(SCIP *scip)
Definition: scip_solve.c:2491
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:12487
SCIP_VARSTATUS SCIPvarGetStatus(SCIP_VAR *var)
Definition: var.c:17556
SCIP_VARTYPE SCIPvarGetType(SCIP_VAR *var)
Definition: var.c:17602
SCIP_Real SCIPvarGetUbGlobal(SCIP_VAR *var)
Definition: var.c:18106
int SCIPvarGetIndex(SCIP_VAR *var)
Definition: var.c:17776
SCIP_Real SCIPvarGetLbGlobal(SCIP_VAR *var)
Definition: var.c:18096
int SCIPsnprintf(char *t, int len, const char *s,...)
Definition: misc.c:10878
static const char * paramname[]
Definition: lpi_msk.c:5171
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
BMS_BLKMEM * SCIPblkmem(SCIP *scip)
Definition: scip_mem.c:57
const char * SCIPparamGetName(SCIP_PARAM *param)
Definition: paramset.c:659
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:117
struct SCIP_EventhdlrData SCIP_EVENTHDLRDATA
Definition: type_event.h:155
@ SCIP_BOUNDTYPE_UPPER
Definition: type_lp.h:57
@ SCIP_BOUNDTYPE_LOWER
Definition: type_lp.h:56
enum SCIP_BoundType SCIP_BOUNDTYPE
Definition: type_lp.h:59
@ 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:67
@ SCIP_VARTYPE_INTEGER
Definition: type_var.h:63
@ SCIP_VARSTATUS_MULTAGGR
Definition: type_var.h:54