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