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 2002-2022 Zuse Institute Berlin */
7 /* */
8 /* Licensed under the Apache License, Version 2.0 (the "License"); */
9 /* you may not use this file except in compliance with the License. */
10 /* You may obtain a copy of the License at */
11 /* */
12 /* http://www.apache.org/licenses/LICENSE-2.0 */
13 /* */
14 /* Unless required by applicable law or agreed to in writing, software */
15 /* distributed under the License is distributed on an "AS IS" BASIS, */
16 /* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. */
17 /* See the License for the specific language governing permissions and */
18 /* limitations under the License. */
19 /* */
20 /* You should have received a copy of the Apache-2.0 license */
21 /* along with SCIP; see the file LICENSE. If not visit scipopt.org. */
22 /* */
23 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
24 
25 /**@file 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 
33 #include "blockmemshell/memory.h"
34 #include "scip/boundstore.h"
35 #include "scip/concsolver.h"
36 #include "scip/concsolver_scip.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"
45 #include "scip/scip_concurrent.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"
57 #include "scip/scip_solvingstats.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 */
71 struct 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) */
81 static
82 SCIP_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) */
101 static
102 SCIP_DECL_EVENTINIT(eventInitSync)
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) */
127 static
128 SCIP_DECL_EVENTEXIT(eventExitSync)
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 */
150 static
151 SCIP_DECL_EVENTEXEC(eventExecSync)
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 */
165 static
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 */
188 struct 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 */
195 struct 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. */
205 static
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  return SCIP_OKAY;
219 }
220 
221 /** sets the child selection rule based on the index of the concurrent solver */
222 static
224  SCIP_CONCSOLVER* concsolver /**< the concurrent solver */
225  )
226 {
227  SCIP_CONCSOLVERDATA* data;
228  static char childsel[] = { 'h', 'i', 'p', 'r', 'l', 'd', 'u' };
229 
230  assert(concsolver != NULL);
231 
232  data = SCIPconcsolverGetData(concsolver);
233  assert(data != NULL);
234 
235  SCIP_CALL( SCIPsetCharParam(data->solverscip, "nodeselection/childsel", childsel[SCIPconcsolverGetIdx(concsolver) % 7]) );
236 
237  return SCIP_OKAY;
238 }
239 
240 /** initialize the concurrent SCIP solver, i.e. setup the copy of the problem and the
241  * mapping of the variables */
242 static
244  SCIP* scip, /**< the main SCIP instance */
245  SCIP_CONCSOLVER* concsolver /**< the concurrent solver to set up */
246  )
247 {
248  int i;
249  SCIP_VAR** vars;
250  SCIP_Bool valid;
251  SCIP_HASHMAP* varmapfw;
252  SCIP_CONCSOLVERDATA* data;
253  int* varperm;
254 
255  assert(scip != NULL);
256  assert(concsolver != NULL);
257 
258  data = SCIPconcsolverGetData(concsolver);
259  assert(data != NULL);
260 
261  data->nvars = SCIPgetNVars(scip);
262  vars = SCIPgetVars(scip);
263 
264  /* create the concurrent solver's SCIP instance and set up the problem */
265  SCIP_CALL( SCIPcreate(&data->solverscip) );
266  SCIP_CALL( SCIPhashmapCreate(&varmapfw, SCIPblkmem(data->solverscip), data->nvars) );
267  SCIP_CALL( SCIPcopy(scip, data->solverscip, varmapfw, NULL, SCIPconcsolverGetName(concsolver), TRUE, FALSE, FALSE,
268  FALSE, &valid) );
269  assert(valid);
270 
271  /* allocate memory for the arrays to store the variable mapping */
272  SCIP_CALL( SCIPallocBlockMemoryArray(data->solverscip, &data->vars, data->nvars) );
273  SCIP_CALL( SCIPallocBufferArray(data->solverscip, &varperm, data->nvars) );
274 
275  /* set up the arrays for the variable mapping */
276  for( i = 0; i < data->nvars; i++ )
277  {
278  SCIP_VAR* var;
279  var = (SCIP_VAR*) SCIPhashmapGetImage(varmapfw, vars[i]);
280  assert(var != NULL);
281  varperm[SCIPvarGetIndex(var)] = i;
282  data->vars[i] = var;
283  }
284 
285  if( SCIPgetNSols(scip) != 0 )
286  {
287  SCIP_Bool stored;
288  SCIP_Real* solvals;
289  SCIP_SOL* sol = SCIPgetBestSol(scip);
290  SCIP_SOL* solversol;
291 
292  SCIP_CALL( SCIPallocBufferArray(data->solverscip, &solvals, data->nvars) );
293 
294  SCIP_CALL( SCIPgetSolVals(scip, sol, data->nvars, vars, solvals) );
295  SCIP_CALL( SCIPcreateSol(data->solverscip, &solversol, NULL) );
296  SCIP_CALL( SCIPsetSolVals(data->solverscip, solversol, data->nvars, data->vars, solvals) );
297 
298  SCIPfreeBufferArray(data->solverscip, &solvals);
299 
300  SCIP_CALL( SCIPaddSolFree(data->solverscip, &solversol, &stored) );
301 
302  assert(stored);
303  }
304 
305  /* create the concurrent data structure for the concurrent solver's SCIP */
306  /* this assert fails on check/instances/Symmetry/packorb_1-FullIns_3.cip
307  * assert(SCIPgetNOrigVars(data->solverscip) == data->nvars);
308  * also fails on check/instances/Symmetry/partorb_1-FullIns_3.cip
309  * TODO: test if this leads to any problems
310  */
311  SCIP_CALL( SCIPcreateConcurrent(data->solverscip, concsolver, varperm) );
312  SCIPfreeBufferArray(data->solverscip, &varperm);
313 
314  /* free the hashmap */
315  SCIPhashmapFree(&varmapfw);
316 
317  return SCIP_OKAY;
318 }
319 
320 /** creates an instance of a concurrent SCIP solver */
321 static
322 SCIP_DECL_CONCSOLVERCREATEINST(concsolverScipCreateInstance)
323 {
324  SCIP_CONCSOLVERDATA* data;
325  SCIP_CONCSOLVERTYPEDATA* typedata;
326  char* prefix;
327  char filename[SCIP_MAXSTRLEN];
328  SCIP_Bool changechildsel;
329 
330  assert(scip != NULL);
331  assert(concsolvertype != NULL);
332  assert(concsolver != NULL);
333 
334  typedata = SCIPconcsolverTypeGetData(concsolvertype);
335 
336  SCIP_ALLOC( BMSallocMemory(&data) );
337  SCIPconcsolverSetData(concsolver, data);
338 
339  SCIP_CALL( initConcsolver(scip, concsolver) );
340 
341  /* check if emphasis setting should be loaded */
342  if( typedata->loademphasis )
343  {
344  SCIP_PARAM** params;
345  SCIP_PARAM** fixedparams;
346  int nparams;
347  int nfixedparams;
348  int i;
349 
350  params = SCIPgetParams(data->solverscip);
351  nparams = SCIPgetNParams(data->solverscip);
352  SCIP_CALL( SCIPallocBufferArray(data->solverscip, &fixedparams, nparams) );
353  nfixedparams = 0;
354 
355  /* fix certain parameters before loading emphasis to avoid setting them to default values */
356  for( i = 0; i < nparams; ++i )
357  {
358  const char* paramname;
359 
360  paramname = SCIPparamGetName(params[i]);
361 
362  if( strncmp(paramname, "limits/", 7) == 0 ||
363  strncmp(paramname, "numerics/", 9) == 0 ||
364  strncmp(paramname, "memory/", 7) == 0 ||
365  strncmp(paramname, "concurrent/sync/", 16) == 0 ||
366  strncmp(paramname, "heuristics/sync/", 16) == 0 ||
367  strncmp(paramname, "propagating/sync/", 17) == 0 )
368  {
369  fixedparams[nfixedparams++] = params[i];
370  SCIP_CALL( SCIPfixParam(data->solverscip, paramname) );
371  }
372  }
373 
374  SCIP_CALL( SCIPsetEmphasis(data->solverscip, typedata->emphasis, TRUE) );
375 
376  for( i = 0; i < nfixedparams; ++i )
377  SCIP_CALL( SCIPunfixParam(data->solverscip, SCIPparamGetName(fixedparams[i])) );
378 
379  SCIPfreeBufferArray(data->solverscip, &fixedparams);
380  }
381 
382  /* load settings file if it exists */
383  SCIP_CALL( SCIPgetStringParam(scip, "concurrent/paramsetprefix", &prefix) );
384  (void) SCIPsnprintf(filename, SCIP_MAXSTRLEN, "%s%s.set", prefix, SCIPconcsolverGetName(concsolver));
385 
386  if( SCIPfileExists(filename) )
387  {
388  /* load settings file and print info message */
389  SCIPinfoMessage(scip, NULL, "reading parameter file <%s> for concurrent solver <%s>\n", filename, SCIPconcsolverGetName(concsolver));
390  SCIP_CALL( SCIPreadParams(data->solverscip, filename) );
391  }
392  else
393  {
394  /* print message about missing setting files only in verblevel full */
395  SCIPverbMessage(scip, SCIP_VERBLEVEL_FULL, NULL, "skipping non existent parameter file <%s> for concurrent solver <%s>\n",
396  filename, SCIPconcsolverGetName(concsolver));
397  }
398 
399  /* include eventhandler for synchronization */
400  SCIP_CALL( includeEventHdlrSync(data->solverscip) );
401 
402  /* disable output for subscip */
403  SCIP_CALL( SCIPsetIntParam(data->solverscip, "display/verblevel", 0) );
404 
405  /* use wall clock time in subscips */
406  SCIP_CALL( SCIPsetIntParam(data->solverscip, "timing/clocktype", (int)SCIP_CLOCKTYPE_WALL) );
407 
408  /* don't catch ctrlc since already caught in main SCIP */
409  SCIP_CALL( SCIPsetBoolParam(data->solverscip, "misc/catchctrlc", FALSE) );
410 
411  /* one solver can do all dual reductions and share them with the other solvers */
412  if( SCIPconcsolverGetIdx(concsolver) != 0 )
413  {
414  SCIP_CALL( disableConflictingDualReductions(data->solverscip) );
415  }
416 
417  /* set different child selection rules if corresponding parameter is TRUE */
418  SCIP_CALL( SCIPgetBoolParam(scip, "concurrent/changechildsel", &changechildsel) );
419  if( changechildsel )
420  {
421  SCIP_CALL( setChildSelRule(concsolver) );
422  }
423 
424  return SCIP_OKAY;
425 }
426 
427 /** destroys an instance of a concurrent SCIP solver */
428 static
429 SCIP_DECL_CONCSOLVERDESTROYINST(concsolverScipDestroyInstance)
430 {
431  SCIP_CONCSOLVERDATA* data;
432 
433  assert(concsolver != NULL);
434 
435  data = SCIPconcsolverGetData(concsolver);
436  assert(data != NULL);
437  assert(data->solverscip != NULL);
438 
439  /* free the array with the variable mapping */
440  SCIPfreeBlockMemoryArray(data->solverscip, &data->vars, data->nvars);
441 
442  /* free subscip */
443  SCIP_CALL( SCIPfree(&data->solverscip) );
444  BMSfreeMemory(&data);
445  SCIPconcsolverSetData(concsolver, NULL);
446 
447  return SCIP_OKAY;
448 }
449 
450 /** frees the data of a concurrent solver type */
451 static
452 SCIP_DECL_CONCSOLVERTYPEFREEDATA(concsolverTypeScipFreeData)
453 {
454  BMSfreeMemory(data);
455 }
456 
457 /** initializes the random and permutation seeds with the given one
458  * and enables permutation of constraints and variables
459  */
460 static
461 SCIP_DECL_CONCSOLVERINITSEEDS(concsolverScipInitSeeds)
462 {
463  SCIP_CONCSOLVERDATA* data;
464 
465  assert(concsolver != NULL);
466 
467  data = SCIPconcsolverGetData(concsolver);
468  assert(data != NULL);
469 
470  SCIPinfoMessage(data->solverscip, NULL, "initializing seeds to %d in concurrent solver '%s'\n", (int) seed, SCIPconcsolverGetName(concsolver));
471 
472  SCIP_CALL( SCIPsetIntParam(data->solverscip, "randomization/randomseedshift", (int) seed) );
473  SCIP_CALL( SCIPsetIntParam(data->solverscip, "randomization/permutationseed", (int) seed) );
474  SCIP_CALL( SCIPsetBoolParam(data->solverscip, "randomization/permutevars", TRUE) );
475  SCIP_CALL( SCIPsetBoolParam(data->solverscip, "randomization/permuteconss", TRUE) );
476 
477  return SCIP_OKAY;
478 }
479 
480 /** installs the solving status of this concurrent solver and the solving statistics
481  * into the given SCIP instance
482  */
483 static
484 SCIP_DECL_CONCSOLVERCOPYSOLVINGDATA(concsolverGetSolvingData)
485 {
486  SCIP_CONCSOLVERDATA* data;
487  SCIP_VAR** vars;
488  int nvars;
489  int nsols;
490  SCIP_SOL** sols;
491  SCIP_Real* solvals;
492  SCIP_HEUR* heur;
493  int i;
494 
495  assert(concsolver != NULL);
496 
497  data = SCIPconcsolverGetData(concsolver);
498  assert(data != NULL);
499  assert(data->solverscip != NULL);
500 
501  assert(scip != NULL);
502  vars = SCIPgetVars(scip);
503  nvars = SCIPgetNVars(scip);
504 
505  nsols = SCIPgetNSols(data->solverscip);
506  sols = SCIPgetSols(data->solverscip);
507 
508  assert(nvars == data->nvars);
509 
510  /* allocate buffer array used for translating the solution to the given SCIP */
511  SCIP_CALL( SCIPallocBufferArray(scip, &solvals, nvars) );
512 
513  /* add the solutions to the given SCIP */
514  for( i = 0; i < nsols; ++i )
515  {
516  SCIP_SOL* sol;
517  SCIP_Bool stored;
518  SCIP_CALL( SCIPgetSolVals(data->solverscip, sols[i], nvars, data->vars, solvals) );
519 
520  heur = SCIPsolGetHeur(sols[i]);
521 
522  if( heur != NULL )
523  heur = SCIPfindHeur(scip, SCIPheurGetName(heur));
524 
525  SCIP_CALL( SCIPcreateSol(scip, &sol, heur) );
526  SCIP_CALL( SCIPsetSolVals(scip, sol, nvars, vars, solvals) );
527 
528  SCIP_CALL( SCIPcopySolStats(sols[i], sol) );
529 
530  SCIP_CALL( SCIPaddSolFree(scip, &sol, &stored) );
531  }
532 
533  /* free the buffer array */
534  SCIPfreeBufferArray(scip, &solvals);
535 
536  /* copy solving statistics and status from the solver SCIP to the given SCIP */
537  SCIP_CALL( SCIPcopyConcurrentSolvingStats(data->solverscip, scip) );
538 
539  return SCIP_OKAY;
540 }
541 
542 /** start solving the problem until the solving reaches a limit, gets interrupted, or
543  * just finished successfully
544  */
545 static
546 SCIP_DECL_CONCSOLVEREXEC(concsolverScipExec)
547 {
548  SCIP_CONCSOLVERDATA* data;
549 
550  assert(concsolver != NULL);
551 
552  data = SCIPconcsolverGetData(concsolver);
553  assert(data != NULL);
554 
555  /* print info message that solving has started */
556  SCIPinfoMessage(data->solverscip, NULL, "starting solve in concurrent solver '%s'\n", SCIPconcsolverGetName(concsolver));
557 
558  /* solve */
559  SCIP_CALL( SCIPsolve(data->solverscip) );
560 
561  /* print info message with status */
562  SCIPinfoMessage(data->solverscip, NULL, "concurrent solver '%s' stopped with status ", SCIPconcsolverGetName(concsolver));
563  SCIP_CALL( SCIPprintStatus(data->solverscip, NULL) );
564  SCIPinfoMessage(data->solverscip, NULL, "\n");
565 
566  /* set solving statistics */
567  *solvingtime = SCIPgetSolvingTime(data->solverscip);
568  *nlpiterations = SCIPgetNLPIterations(data->solverscip);
569  *nnodes = SCIPgetNNodes(data->solverscip);
570 
571  return SCIP_OKAY;
572 }
573 
574 /** stops the concurrent solver as soon as possible */
575 static
576 SCIP_DECL_CONCSOLVERSTOP(concsolverScipStop)
577 {
578  SCIP_CONCSOLVERDATA* data;
579  assert(concsolver != NULL);
580 
581  data = SCIPconcsolverGetData(concsolver);
582  assert(data != NULL);
583 
584  SCIP_CALL( SCIPinterruptSolve(data->solverscip) );
585 
586  return SCIP_OKAY;
587 }
588 
589 /** writes new solutions and global boundchanges to the given synchronization data */
590 static
591 SCIP_DECL_CONCSOLVERSYNCWRITE(concsolverScipSyncWrite)
592 {
593  int i;
594  int nsols;
595  SCIP_SOL** sols;
596  SCIP_CONCSOLVERDATA* data;
597  SCIP_BOUNDSTORE* boundstore;
598  int concsolverid;
599  SCIP_STATUS solverstatus;
600 
601  data = SCIPconcsolverGetData(concsolver);
602  assert(data != NULL);
603  concsolverid = SCIPconcsolverGetIdx(concsolver);
604  solverstatus = SCIPgetStatus(data->solverscip);
605 
606  SCIPsyncdataSetStatus(syncdata, solverstatus, concsolverid);
607  SCIPsyncdataSetLowerbound(syncdata, SCIPgetDualbound(data->solverscip));
608  SCIPsyncdataSetUpperbound(syncdata, SCIPgetPrimalbound(data->solverscip));
609 
610  *nsolsshared = 0;
611 
612  if( SCIPsyncdataGetStatus(syncdata) != SCIP_STATUS_UNKNOWN )
613  return SCIP_OKAY;
614 
615  SCIPdebugMessage("syncing in concurrent solver %s\n", SCIPconcsolverGetName(concsolver));
616 
617  /* consider at most maxcandsols many solutions, and since the solution array is sorted, we will cosider the best
618  * solutions
619  */
620  nsols = SCIPgetNSols(data->solverscip);
621  nsols = MIN(nsols, maxcandsols);
622  sols = SCIPgetSols(data->solverscip);
623 
624  for( i = 0; i < nsols; ++i )
625  {
626  if( SCIPIsConcurrentSolNew(data->solverscip, sols[i]) )
627  {
628  SCIP_Real solobj;
629  SCIP_Real* solvals;
630 
631  solobj = SCIPgetSolOrigObj(data->solverscip, sols[i]);
632 
633  SCIPdebugMessage("adding sol in concurrent solver %s\n", SCIPconcsolverGetName(concsolver));
634  SCIPsyncdataGetSolutionBuffer(syncstore, syncdata, solobj, concsolverid, &solvals);
635 
636  /* if syncstore has no place for this solution we can stop since the next solution will have
637  * a worse objective value and thus won't be accepted either
638  */
639  if( solvals == NULL )
640  break;
641 
642  ++(*nsolsshared);
643  SCIP_CALL( SCIPgetSolVals(data->solverscip, sols[i], data->nvars, data->vars, solvals) );
644 
645  /* if we have added the maximum number of solutions we can also stop */
646  if( *nsolsshared == maxsharedsols )
647  break;
648  }
649  }
650 
651  boundstore = SCIPgetConcurrentGlobalBoundChanges(data->solverscip);
652 
653  if( boundstore != NULL )
654  SCIP_CALL( SCIPsyncdataAddBoundChanges(syncstore, syncdata, boundstore) );
655 
656  SCIPsyncdataAddMemTotal(syncdata, SCIPgetMemTotal(data->solverscip));
657 
658  return SCIP_OKAY;
659 }
660 
661 /** reads the solutions and bounds from the given synchronization data */
662 static
663 SCIP_DECL_CONCSOLVERSYNCREAD(concsolverScipSyncRead)
664 { /*lint --e{715}*/
665  int i;
666  int nsols;
667  SCIP_Real** solvals;
668  SCIP_CONCSOLVERDATA* data;
669  SCIP_BOUNDSTORE* boundstore;
670  int* concsolverids;
671  int concsolverid;
672  int nbndchgs;
673 
674  data = SCIPconcsolverGetData(concsolver);
675  assert(data != NULL);
676 
677  concsolverid = SCIPconcsolverGetIdx(concsolver);
678 
679  /* get solutions from synchronization data */
680  SCIPsyncdataGetSolutions(syncdata, &solvals, &concsolverids, &nsols);
681  *nsolsrecvd = 0;
682 
683  for( i = 0; i < nsols; ++i )
684  {
685  SCIP_SOL* newsol;
686 
687  /* do not add own solutions */
688  if( concsolverids[i] == concsolverid )
689  continue;
690 
691  /* solution is from other solver so translate to this solvers variable space and add it to SCIP */
692  ++(*nsolsrecvd);
693  SCIP_CALL( SCIPcreateOrigSol(data->solverscip, &newsol, NULL) );
694 
695  SCIP_CALL( SCIPsetSolVals(data->solverscip, newsol, data->nvars, data->vars, solvals[i]) );
696  SCIPdebugMessage("adding solution in concurrent solver %s\n", SCIPconcsolverGetName(concsolver));
697  SCIP_CALL( SCIPaddConcurrentSol(data->solverscip, newsol) );
698  }
699 
700  /* get bound changes from the synchronization data and add it to this concurrent solvers SCIP */
701  *ntighterbnds = 0;
702  *ntighterintbnds = 0;
703  boundstore = SCIPsyncdataGetBoundChgs(syncdata);
704  nbndchgs = SCIPboundstoreGetNChgs(boundstore);
705 
706  for( i = 0; i < nbndchgs; ++i )
707  {
708  SCIP_VAR* var;
709  SCIP_BOUNDTYPE boundtype;
710  SCIP_Real newbound;
711 
712  var = data->vars[SCIPboundstoreGetChgVaridx(boundstore, i)];
713  boundtype = SCIPboundstoreGetChgType(boundstore, i);
714  newbound = SCIPboundstoreGetChgVal(boundstore, i);
715 
716  SCIP_CALL( SCIPvarGetProbvarBound(&var, &newbound, &boundtype) );
717 
718  /* cannot change bounds of multi-aggregated variables so dont pass this bound-change to the propagator */
720  return SCIP_OKAY;
721 
722  /* if bound is not better than also don't pass this bound to the propagator and
723  * don't waste memory for storing this boundchange
724  */
725  if( boundtype == SCIP_BOUNDTYPE_LOWER && SCIPisGE(data->solverscip, SCIPvarGetLbGlobal(var), newbound) )
726  return SCIP_OKAY;
727 
728  if( boundtype == SCIP_BOUNDTYPE_UPPER && SCIPisLE(data->solverscip, SCIPvarGetUbGlobal(var), newbound) )
729  return SCIP_OKAY;
730 
731  /* bound is better so incremented counters for statistics and pass it to the sync propagator */
732  ++(*ntighterbnds);
733 
735  ++(*ntighterintbnds);
736 
737  SCIP_CALL( SCIPaddConcurrentBndchg(data->solverscip, var, newbound, boundtype) );
738  }
739 
740  return SCIP_OKAY;
741 }
742 
743 
744 /** creates the concurrent SCIP solver plugins and includes them in SCIP */
746  SCIP* scip /**< SCIP datastructure */
747  )
748 {
750 
751  assert(scip != NULL);
752 
753  /* Include concurrent solvers for SCIP for all emphasis settings and without an emphasis setting.
754  * For the SCIP without an emphasis setting we set the default preferred priority to 1 and for the other types to 0
755  * so that the default concurent solve will use multiple SCIP's using settings as specified by the user in the main SCIP.
756  */
757  SCIP_CALL( SCIPallocMemory(scip, &data) );
758  data->loademphasis = FALSE;
759  SCIP_CALL( SCIPincludeConcsolverType(scip, "scip", 1.0, concsolverScipCreateInstance, concsolverScipDestroyInstance, concsolverScipInitSeeds,
760  concsolverScipExec, concsolverGetSolvingData, concsolverScipStop, concsolverScipSyncWrite,
761  concsolverScipSyncRead, concsolverTypeScipFreeData, data) );
762 
763  SCIP_CALL( SCIPallocMemory(scip, &data) );
764  data->loademphasis = TRUE;
765  data->emphasis = SCIP_PARAMEMPHASIS_DEFAULT;
766  SCIP_CALL( SCIPincludeConcsolverType(scip, "scip-default", 0.0, concsolverScipCreateInstance, concsolverScipDestroyInstance, concsolverScipInitSeeds,
767  concsolverScipExec, concsolverGetSolvingData, concsolverScipStop, concsolverScipSyncWrite,
768  concsolverScipSyncRead, concsolverTypeScipFreeData, data) );
769 
770  SCIP_CALL( SCIPallocMemory(scip, &data) );
771  data->loademphasis = TRUE;
772  data->emphasis = SCIP_PARAMEMPHASIS_CPSOLVER;
773  SCIP_CALL( SCIPincludeConcsolverType(scip, "scip-cpsolver", 0.0, concsolverScipCreateInstance, concsolverScipDestroyInstance, concsolverScipInitSeeds,
774  concsolverScipExec, concsolverGetSolvingData, concsolverScipStop, concsolverScipSyncWrite,
775  concsolverScipSyncRead, concsolverTypeScipFreeData, data) );
776 
777  SCIP_CALL( SCIPallocMemory(scip, &data) );
778  data->loademphasis = TRUE;
779  data->emphasis = SCIP_PARAMEMPHASIS_EASYCIP;
780  SCIP_CALL( SCIPincludeConcsolverType(scip, "scip-easycip", 0.0, concsolverScipCreateInstance, concsolverScipDestroyInstance, concsolverScipInitSeeds,
781  concsolverScipExec, concsolverGetSolvingData, concsolverScipStop, concsolverScipSyncWrite,
782  concsolverScipSyncRead, concsolverTypeScipFreeData, data) );
783 
784  SCIP_CALL( SCIPallocMemory(scip, &data) );
785  data->loademphasis = TRUE;
786  data->emphasis = SCIP_PARAMEMPHASIS_FEASIBILITY;
787  SCIP_CALL( SCIPincludeConcsolverType(scip, "scip-feas", 0.0, concsolverScipCreateInstance, concsolverScipDestroyInstance, concsolverScipInitSeeds,
788  concsolverScipExec, concsolverGetSolvingData, concsolverScipStop, concsolverScipSyncWrite,
789  concsolverScipSyncRead, concsolverTypeScipFreeData, data) );
790 
791  SCIP_CALL( SCIPallocMemory(scip, &data) );
792  data->loademphasis = TRUE;
793  data->emphasis = SCIP_PARAMEMPHASIS_HARDLP;
794  SCIP_CALL( SCIPincludeConcsolverType(scip, "scip-hardlp", 0.0, concsolverScipCreateInstance, concsolverScipDestroyInstance, concsolverScipInitSeeds,
795  concsolverScipExec, concsolverGetSolvingData, concsolverScipStop, concsolverScipSyncWrite,
796  concsolverScipSyncRead, concsolverTypeScipFreeData, data) );
797 
798  SCIP_CALL( SCIPallocMemory(scip, &data) );
799  data->loademphasis = TRUE;
800  data->emphasis = SCIP_PARAMEMPHASIS_OPTIMALITY;
801  SCIP_CALL( SCIPincludeConcsolverType(scip, "scip-opti", 0.0, concsolverScipCreateInstance, concsolverScipDestroyInstance, concsolverScipInitSeeds,
802  concsolverScipExec, concsolverGetSolvingData, concsolverScipStop, concsolverScipSyncWrite,
803  concsolverScipSyncRead, concsolverTypeScipFreeData, data) );
804 
805  SCIP_CALL( SCIPallocMemory(scip, &data) );
806  data->loademphasis = TRUE;
807  data->emphasis = SCIP_PARAMEMPHASIS_COUNTER;
808  SCIP_CALL( SCIPincludeConcsolverType(scip, "scip-counter", 0.0, concsolverScipCreateInstance, concsolverScipDestroyInstance, concsolverScipInitSeeds,
809  concsolverScipExec, concsolverGetSolvingData, concsolverScipStop, concsolverScipSyncWrite,
810  concsolverScipSyncRead, concsolverTypeScipFreeData, data) );
811 
812  return SCIP_OKAY;
813 }
#define SCIPfreeBlockMemoryArray(scip, ptr, num)
Definition: scip_mem.h:110
enum SCIP_BoundType SCIP_BOUNDTYPE
Definition: type_lp.h:59
SCIP_PARAM ** SCIPgetParams(SCIP *scip)
Definition: scip_param.c:978
SCIP_RETCODE SCIPgetStringParam(SCIP *scip, const char *name, char **value)
Definition: scip_param.c:345
SCIP_Real SCIPgetSolvingTime(SCIP *scip)
Definition: scip_timing.c:378
struct SCIP_ConcSolverTypeData SCIP_CONCSOLVERTYPEDATA
#define SCIPallocBlockMemoryArray(scip, ptr, num)
Definition: scip_mem.h:93
static SCIP_DECL_CONCSOLVEREXEC(concsolverScipExec)
static SCIP_RETCODE includeEventHdlrSync(SCIP *scip)
public methods for SCIP parameter handling
SCIP_Longint SCIPgetNLPIterations(SCIP *scip)
static SCIP_DECL_EVENTEXIT(eventExitSync)
int SCIPboundstoreGetNChgs(SCIP_BOUNDSTORE *boundstore)
Definition: boundstore.c:197
public methods for memory management
SCIP_Real SCIPgetPrimalbound(SCIP *scip)
SCIP_Real SCIPvarGetLbGlobal(SCIP_VAR *var)
Definition: var.c:17919
static SCIP_DECL_CONCSOLVERTYPEFREEDATA(concsolverTypeScipFreeData)
#define SCIP_MAXSTRLEN
Definition: def.h:302
SCIP_STATUS SCIPsyncdataGetStatus(SCIP_SYNCDATA *syncdata)
Definition: syncstore.c:515
SCIP_RETCODE SCIPaddSolFree(SCIP *scip, SCIP_SOL **sol, SCIP_Bool *stored)
Definition: scip_sol.c:3024
SCIP_RETCODE SCIPsetEventhdlrExit(SCIP *scip, SCIP_EVENTHDLR *eventhdlr, SCIP_DECL_EVENTEXIT((*eventexit)))
Definition: scip_event.c:178
static SCIP_DECL_CONCSOLVERCOPYSOLVINGDATA(concsolverGetSolvingData)
SCIP_RETCODE SCIPcopy(SCIP *sourcescip, SCIP *targetscip, SCIP_HASHMAP *varmap, SCIP_HASHMAP *consmap, const char *suffix, SCIP_Bool global, SCIP_Bool enablepricing, SCIP_Bool threadsafe, SCIP_Bool passmessagehdlr, SCIP_Bool *valid)
Definition: scip_copy.c:2866
void SCIPsyncdataSetUpperbound(SCIP_SYNCDATA *syncdata, SCIP_Real upperbound)
Definition: syncstore.c:684
SCIP_Bool SCIPisGE(SCIP *scip, SCIP_Real val1, SCIP_Real val2)
public solving methods
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:104
public methods for timing
struct SCIP_EventhdlrData SCIP_EVENTHDLRDATA
Definition: type_event.h:155
SCIP_SOL ** SCIPgetSols(SCIP *scip)
Definition: scip_sol.c:2263
#define FALSE
Definition: def.h:96
SCIP_RETCODE SCIPhashmapCreate(SCIP_HASHMAP **hashmap, BMS_BLKMEM *blkmem, int mapsize)
Definition: misc.c:3023
const char * SCIPeventhdlrGetName(SCIP_EVENTHDLR *eventhdlr)
Definition: event.c:324
char * SCIPconcsolverGetName(SCIP_CONCSOLVER *concsolver)
Definition: concsolver.c:300
int SCIPsnprintf(char *t, int len, const char *s,...)
Definition: misc.c:10764
#define TRUE
Definition: def.h:95
void SCIPsyncdataSetLowerbound(SCIP_SYNCDATA *syncdata, SCIP_Real lowerbound)
Definition: syncstore.c:695
enum SCIP_Retcode SCIP_RETCODE
Definition: type_retcode.h:63
const char * SCIPparamGetName(SCIP_PARAM *param)
Definition: paramset.c:659
datastructures for concurrent solvers
public methods for problem variables
#define SCIPfreeBlockMemory(scip, ptr)
Definition: scip_mem.h:108
#define SCIPdebugMessage
Definition: pub_message.h:96
void * SCIPhashmapGetImage(SCIP_HASHMAP *hashmap, void *origin)
Definition: misc.c:3210
#define SCIPfreeBufferArray(scip, ptr)
Definition: scip_mem.h:136
SCIP_RETCODE SCIPcreate(SCIP **scip)
Definition: scip_general.c:292
#define BMSfreeMemory(ptr)
Definition: memory.h:147
#define SCIPallocBlockMemory(scip, ptr)
Definition: scip_mem.h:89
void SCIPinfoMessage(SCIP *scip, FILE *file, const char *formatstr,...)
Definition: scip_message.c:208
SCIP_RETCODE SCIPcreateOrigSol(SCIP *scip, SCIP_SOL **sol, SCIP_HEUR *heur)
Definition: scip_sol.c:565
void SCIPconcsolverSetData(SCIP_CONCSOLVER *concsolver, SCIP_CONCSOLVERDATA *data)
Definition: concsolver.c:289
public methods for numerical tolerances
static SCIP_DECL_CONCSOLVERSYNCWRITE(concsolverScipSyncWrite)
static SCIP_RETCODE initConcsolver(SCIP *scip, SCIP_CONCSOLVER *concsolver)
public methods for querying solving statistics
void SCIPeventhdlrSetData(SCIP_EVENTHDLR *eventhdlr, SCIP_EVENTHDLRDATA *eventhdlrdata)
Definition: event.c:344
SCIP_Bool SCIPfileExists(const char *filename)
Definition: misc.c:10967
SCIP_Real SCIPvarGetUbGlobal(SCIP_VAR *var)
Definition: var.c:17929
public methods for handling parameter settings
void SCIPsyncdataGetSolutionBuffer(SCIP_SYNCSTORE *syncstore, SCIP_SYNCDATA *syncdata, SCIP_Real solobj, int ownerid, SCIP_Real **buffer)
Definition: syncstore.c:708
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)
int SCIPboundstoreGetChgVaridx(SCIP_BOUNDSTORE *boundstore, int i)
Definition: boundstore.c:161
implementation of concurrent solver interface for SCIP
SCIP_RETCODE SCIPsolve(SCIP *scip)
Definition: scip_solve.c:2622
const char * SCIPheurGetName(SCIP_HEUR *heur)
Definition: heur.c:1450
SCIP_HEUR * SCIPfindHeur(SCIP *scip, const char *name)
Definition: scip_heur.c:258
SCIP_RETCODE SCIPaddConcurrentBndchg(SCIP *scip, SCIP_VAR *var, SCIP_Real val, SCIP_BOUNDTYPE bndtype)
Definition: concurrent.c:386
SCIP_Bool SCIPsyncstoreIsInitialized(SCIP_SYNCSTORE *syncstore)
Definition: syncstore.c:784
SCIP_RETCODE SCIPsetEventhdlrFree(SCIP *scip, SCIP_EVENTHDLR *eventhdlr, SCIP_DECL_EVENTFREE((*eventfree)))
Definition: scip_event.c:150
public methods for event handler plugins and event handlers
SCIP_RETCODE SCIPgetSolVals(SCIP *scip, SCIP_SOL *sol, int nvars, SCIP_VAR **vars, SCIP_Real *vals)
Definition: scip_sol.c:1398
SCIP_Real SCIPgetDualbound(SCIP *scip)
void SCIPsyncdataSetStatus(SCIP_SYNCDATA *syncdata, SCIP_STATUS status, int solverid)
Definition: syncstore.c:642
SCIP_RETCODE SCIPsetBoolParam(SCIP *scip, const char *name, SCIP_Bool value)
Definition: scip_param.c:429
SCIP_STATUS SCIPgetStatus(SCIP *scip)
Definition: scip_general.c:483
BMS_BLKMEM * SCIPblkmem(SCIP *scip)
Definition: scip_mem.c:57
SCIP_RETCODE SCIPsetEventhdlrInit(SCIP *scip, SCIP_EVENTHDLR *eventhdlr, SCIP_DECL_EVENTINIT((*eventinit)))
Definition: scip_event.c:164
void SCIPhashmapFree(SCIP_HASHMAP **hashmap)
Definition: misc.c:3057
SCIP_RETCODE SCIPgetBoolParam(SCIP *scip, const char *name, SCIP_Bool *value)
Definition: scip_param.c:250
#define NULL
Definition: lpi_spx1.cpp:164
SCIP_HEUR * SCIPsolGetHeur(SCIP_SOL *sol)
Definition: sol.c:2613
the interface of the boundstore structure
SCIP_RETCODE SCIPunfixParam(SCIP *scip, const char *name)
Definition: scip_param.c:385
public methods for problem copies
public methods for primal CIP solutions
#define SCIP_CALL(x)
Definition: def.h:393
SCIP_RETCODE SCIPprintStatus(SCIP *scip, FILE *file)
Definition: scip_general.c:506
SCIP_RETCODE SCIPsetEmphasis(SCIP *scip, SCIP_PARAMEMPHASIS paramemphasis, SCIP_Bool quiet)
Definition: scip_param.c:861
void SCIPverbMessage(SCIP *scip, SCIP_VERBLEVEL msgverblevel, FILE *file, const char *formatstr,...)
Definition: scip_message.c:225
SCIP_RETCODE SCIPaddConcurrentSol(SCIP *scip, SCIP_SOL *sol)
Definition: concurrent.c:371
static SCIP_DECL_CONCSOLVERSTOP(concsolverScipStop)
public methods for primal heuristic plugins and divesets
static SCIP_RETCODE disableConflictingDualReductions(SCIP *scip)
the function declarations for the synchronization store
#define SCIPallocBufferArray(scip, ptr, num)
Definition: scip_mem.h:124
static SCIP_DECL_EVENTFREE(eventFreeSync)
public data structures and miscellaneous methods
#define SCIP_Bool
Definition: def.h:93
SCIP_RETCODE SCIPcatchEvent(SCIP *scip, SCIP_EVENTTYPE eventtype, SCIP_EVENTHDLR *eventhdlr, SCIP_EVENTDATA *eventdata, int *filterpos)
Definition: scip_event.c:286
void SCIPsyncdataAddMemTotal(SCIP_SYNCDATA *syncdata, SCIP_Longint memtotal)
Definition: syncstore.c:673
static SCIP_DECL_EVENTEXEC(eventExecSync)
enum SCIP_Status SCIP_STATUS
Definition: type_stat.h:67
static const char * paramname[]
Definition: lpi_msk.c:5040
SCIP_SYNCSTORE * SCIPgetSyncstore(SCIP *scip)
static SCIP_DECL_CONCSOLVERSYNCREAD(concsolverScipSyncRead)
public methods for concurrent solving mode
SCIP_RETCODE SCIPsetIntParam(SCIP *scip, const char *name, int value)
Definition: scip_param.c:487
SCIP_RETCODE SCIPdropEvent(SCIP *scip, SCIP_EVENTTYPE eventtype, SCIP_EVENTHDLR *eventhdlr, SCIP_EVENTDATA *eventdata, int filterpos)
Definition: scip_event.c:320
int SCIPgetNSols(SCIP *scip)
Definition: scip_sol.c:2214
SCIP_RETCODE SCIPcopyConcurrentSolvingStats(SCIP *source, SCIP *target)
Definition: concurrent.c:535
SCIP_Real SCIPgetSolOrigObj(SCIP *scip, SCIP_SOL *sol)
Definition: scip_sol.c:1444
SCIP_RETCODE SCIPfixParam(SCIP *scip, const char *name)
Definition: scip_param.c:367
SCIP_CONCSOLVERDATA * SCIPconcsolverGetData(SCIP_CONCSOLVER *concsolver)
Definition: concsolver.c:279
helper functions for concurrent scip solvers
SCIP_RETCODE SCIPsetCharParam(SCIP *scip, const char *name, char value)
Definition: scip_param.c:661
SCIP_RETCODE SCIPvarGetProbvarBound(SCIP_VAR **var, SCIP_Real *bound, SCIP_BOUNDTYPE *boundtype)
Definition: var.c:12477
int SCIPgetNVars(SCIP *scip)
Definition: scip_prob.c:2000
enum SCIP_ParamEmphasis SCIP_PARAMEMPHASIS
Definition: type_paramset.h:84
static SCIP_DECL_CONCSOLVERCREATEINST(concsolverScipCreateInstance)
SCIP_RETCODE SCIPcopySolStats(SCIP_SOL *source, SCIP_SOL *target)
Definition: concurrent.c:404
int SCIPconcsolverGetIdx(SCIP_CONCSOLVER *concsolver)
Definition: concsolver.c:623
SCIP_RETCODE SCIPincludeConcurrentScipSolvers(SCIP *scip)
public methods for managing events
general public methods
SCIP_Longint SCIPgetMemTotal(SCIP *scip)
Definition: scip_mem.c:113
SCIP_SOL * SCIPgetBestSol(SCIP *scip)
Definition: scip_sol.c:2313
SCIP_Real SCIPboundstoreGetChgVal(SCIP_BOUNDSTORE *boundstore, int i)
Definition: boundstore.c:185
public methods for solutions
SCIP_BOUNDSTORE * SCIPsyncdataGetBoundChgs(SCIP_SYNCDATA *syncdata)
Definition: syncstore.c:618
SCIP_RETCODE SCIPreadParams(SCIP *scip, const char *filename)
Definition: scip_param.c:751
static SCIP_DECL_CONCSOLVERDESTROYINST(concsolverScipDestroyInstance)
public methods for message output
SCIP_VAR ** SCIPgetVars(SCIP *scip)
Definition: scip_prob.c:1955
SCIP_VARSTATUS SCIPvarGetStatus(SCIP_VAR *var)
Definition: var.c:17379
#define EVENTHDLR_NAME
#define SCIP_Real
Definition: def.h:186
public methods for message handling
#define BMSallocMemory(ptr)
Definition: memory.h:120
SCIP_Bool SCIPIsConcurrentSolNew(SCIP *scip, SCIP_SOL *sol)
Definition: concurrent.c:438
int SCIPvarGetIndex(SCIP_VAR *var)
Definition: var.c:17599
static SCIP_RETCODE setChildSelRule(SCIP_CONCSOLVER *concsolver)
SCIP_BOUNDSTORE * SCIPgetConcurrentGlobalBoundChanges(SCIP *scip)
Definition: concurrent.c:451
SCIP_VARTYPE SCIPvarGetType(SCIP_VAR *var)
Definition: var.c:17425
SCIP_RETCODE SCIPsetSolVals(SCIP *scip, SCIP_SOL *sol, int nvars, SCIP_VAR **vars, SCIP_Real *vals)
Definition: scip_sol.c:1263
#define SCIPallocMemory(scip, ptr)
Definition: scip_mem.h:60
static SCIP_DECL_EVENTINIT(eventInitSync)
SCIP_Bool SCIPisLE(SCIP *scip, SCIP_Real val1, SCIP_Real val2)
SCIP_CONCSOLVERTYPEDATA * SCIPconcsolverTypeGetData(SCIP_CONCSOLVERTYPE *concsolvertype)
Definition: concsolver.c:169
#define nnodes
Definition: gastrans.c:74
SCIP_RETCODE SCIPinterruptSolve(SCIP *scip)
Definition: scip_solve.c:3551
#define EVENTHDLR_DESC
public methods for primal heuristics
SCIP_EVENTHDLRDATA * SCIPeventhdlrGetData(SCIP_EVENTHDLR *eventhdlr)
Definition: event.c:334
#define SCIP_EVENTTYPE_SYNC
Definition: type_event.h:117
SCIP_BOUNDTYPE SCIPboundstoreGetChgType(SCIP_BOUNDSTORE *boundstore, int i)
Definition: boundstore.c:173
#define SCIP_ALLOC(x)
Definition: def.h:404
SCIP_Longint SCIPgetNNodes(SCIP *scip)
public methods for global and local (sub)problems
int SCIPgetNParams(SCIP *scip)
Definition: scip_param.c:992
static SCIP_DECL_CONCSOLVERINITSEEDS(concsolverScipInitSeeds)
SCIP_RETCODE SCIPsyncdataAddBoundChanges(SCIP_SYNCSTORE *syncstore, SCIP_SYNCDATA *syncdata, SCIP_BOUNDSTORE *boundstore)
Definition: syncstore.c:767
SCIP_RETCODE SCIPsynchronize(SCIP *scip)
Definition: concurrent.c:245
void SCIPsyncdataGetSolutions(SCIP_SYNCDATA *syncdata, SCIP_Real ***solvalues, int **solowner, int *nsols)
Definition: syncstore.c:600
struct SCIP_ConcSolverData SCIP_CONCSOLVERDATA
SCIP_RETCODE SCIPfree(SCIP **scip)
Definition: scip_general.c:324
SCIP_RETCODE SCIPcreateSol(SCIP *scip, SCIP_SOL **sol, SCIP_HEUR *heur)
Definition: scip_sol.c:328
SCIP_RETCODE SCIPcreateConcurrent(SCIP *scip, SCIP_CONCSOLVER *concsolver, int *varperm)
Definition: concurrent.c:57
memory allocation routines