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