SCIP

    Solving Constraint Integer Programs

    heur_farkasdiving.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 heur_farkasdiving.c
    26 * @ingroup DEFPLUGINS_HEUR
    27 * @brief LP diving heuristic that tries to construct a Farkas-proof
    28 * @author Jakob Witzig
    29 *
    30 * The heuristic dives into the direction of the pseudosolution, i.e., variables get rounded
    31 * towards their best bound w.r.t there objective coefficient. This strategy is twofold, if
    32 * a feasible solution is found the solution has potentially a very good objective value; on the other
    33 * hand, the left-hand side of a potential Farkas-proof \f$y^Tb - y^TA{l',u'} > 0\f$ (i.e., infeasibility proof)
    34 * gets increased, where \f$l',u'\f$ are the local bounds. The contribution of each variable \f$x_i\f$ to the
    35 * Farkas-proof can be approximated by \f$c_i = y^TA_i\f$ because we only dive on basic variables with
    36 * reduced costs \f$c_i - y^TA_i = 0\f$.
    37 */
    38
    39/*---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0----+----1----+----2*/
    40
    43#include "scip/heuristics.h"
    44#include "scip/pub_heur.h"
    45#include "scip/pub_message.h"
    46#include "scip/pub_misc.h"
    47#include "scip/pub_misc_sort.h"
    48#include "scip/pub_tree.h"
    49#include "scip/pub_var.h"
    50#include "scip/scip_branch.h"
    51#include "scip/scip_heur.h"
    52#include "scip/scip_lp.h"
    53#include "scip/scip_mem.h"
    54#include "scip/scip_message.h"
    55#include "scip/scip_numerics.h"
    56#include "scip/scip_param.h"
    57#include "scip/scip_prob.h"
    58#include "scip/scip_sol.h"
    59#include "scip/scip_tree.h"
    60
    61
    62#define HEUR_NAME "farkasdiving"
    63#define HEUR_DESC "LP diving heuristic that tries to construct a Farkas-proof"
    64#define HEUR_DISPCHAR SCIP_HEURDISPCHAR_DIVING
    65#define HEUR_PRIORITY -900000
    66#define HEUR_FREQ 10
    67#define HEUR_FREQOFS 0
    68#define HEUR_MAXDEPTH -1
    69#define HEUR_TIMING SCIP_HEURTIMING_AFTERLPPLUNGE
    70#define HEUR_USESSUBSCIP FALSE /**< does the heuristic use a secondary SCIP instance? */
    71#define DIVESET_DIVETYPES SCIP_DIVETYPE_INTEGRALITY | SCIP_DIVETYPE_SOS1VARIABLE /**< bit mask that represents all supported dive types */
    72#define DIVESET_ISPUBLIC FALSE /**< is this dive set publicly available (ie., can be used by other primal heuristics?) */
    73
    74
    75/*
    76 * Default parameter settings
    77 */
    78
    79#define DEFAULT_MINRELDEPTH 0.0 /**< minimal relative depth to start diving */
    80#define DEFAULT_MAXRELDEPTH 1.0 /**< maximal relative depth to start diving */
    81#define DEFAULT_MAXLPITERQUOT 0.05 /**< maximal fraction of diving LP iterations compared to node LP iterations */
    82#define DEFAULT_MAXLPITEROFS 1000 /**< additional number of allowed LP iterations */
    83#define DEFAULT_MAXDIVEUBQUOT 0.8 /**< maximal quotient (curlowerbound - lowerbound)/(cutoffbound - lowerbound)
    84 * where diving is performed (0.0: no limit) */
    85#define DEFAULT_MAXDIVEAVGQUOT 0.0 /**< maximal quotient (curlowerbound - lowerbound)/(avglowerbound - lowerbound)
    86 * where diving is performed (0.0: no limit) */
    87#define DEFAULT_MAXDIVEUBQUOTNOSOL 0.1 /**< maximal UBQUOT when no solution was found yet (0.0: no limit) */
    88#define DEFAULT_MAXDIVEAVGQUOTNOSOL 0.0 /**< maximal AVGQUOT when no solution was found yet (0.0: no limit) */
    89#define DEFAULT_BACKTRACK TRUE /**< use one level of backtracking if infeasibility is encountered? */
    90#define DEFAULT_LPRESOLVEDOMCHGQUOT 0.15 /**< percentage of immediate domain changes during probing to trigger LP resolve */
    91#define DEFAULT_LPSOLVEFREQ 1 /**< LP solve frequency for diving heuristics */
    92#define DEFAULT_ONLYLPBRANCHCANDS FALSE /**< should only LP branching candidates be considered instead of the slower but
    93 * more general constraint handler diving variable selection? */
    94#define DEFAULT_RANDSEED 151 /**< initial seed for random number generation */
    95
    96#define DEFAULT_MAXOBJOCC 1.0 /**< maximal occurance factor of an objective coefficient */
    97#define DEFAULT_OBJDYN 0.0001 /**< minimal objective dynamism (log) */
    98#define DEFAULT_CHECKCANDS FALSE /**< should diving candidates be checked before running? */
    99#define DEFAULT_SCALESCORE TRUE /**< should the score be scaled? */
    100#define DEFAULT_ROOTSUCCESS TRUE /**< should the heuristic only run within the tree if at least one solution
    101 * was found at the root node? */
    102#define DEFAULT_SCALETYPE 'i' /**< scale score by [f]ractionality or [i]mpact on farkasproof */
    103
    104/* locally defined heuristic data */
    105struct SCIP_HeurData
    106{
    107 SCIP_SOL* sol; /**< working solution */
    108 SCIP_Real maxobjocc; /**< maximal occurance factor of an objective coefficient */
    109 SCIP_Real objdynamism; /**< minimal objective dynamism (log) */
    110 SCIP_Bool disabled; /**< remember if the heuristic should not run at all */
    111 SCIP_Bool glbchecked; /**< remember whether one global check was performed */
    112 SCIP_Bool checkcands; /**< should diving candidates be checked before running? */
    113 SCIP_Bool scalescore; /**< should score be scaled by fractionality */
    114 SCIP_Bool rootsuccess; /**< run if successfull at root */
    115 SCIP_Bool foundrootsol; /**< was a solution found at the root node? */
    116 char scaletype; /**< scale score by [f]ractionality or [i]mpact on farkasproof */
    117};
    118
    119
    120/** check whether the diving candidates fulfill requirements */
    121static
    123 SCIP* scip, /**< SCIP data structure */
    124 SCIP_HEURDATA* heurdata, /**< heuristic data */
    125 SCIP_VAR** divecandvars, /**< diving candidates to check */
    126 int ndivecands, /**< number of diving candidates */
    127 SCIP_Bool* success /**< pointer to store whether the check was successfull */
    128 )
    129{
    130 SCIP_Real* objcoefs;
    131 SCIP_Real lastobjcoef;
    132 SCIP_Real objdynamism;
    133 int maxfreq;
    134 int nnzobjcoefs;
    135#ifdef SCIP_DEBUG
    136 int ndiffnnzobjs;
    137#endif
    138 int i;
    139
    140 assert(scip != NULL);
    141 assert(heurdata != NULL);
    142 assert(divecandvars != NULL);
    143 assert(ndivecands >= 0);
    144 assert(success != NULL);
    145
    146 *success = FALSE;
    147
    148 /* terminate without candidates */
    149 if( ndivecands == 0 )
    150 return SCIP_OKAY;
    151
    152 /* terminate without objective */
    153 if( SCIPgetNObjVars(scip) == 0 )
    154 return SCIP_OKAY;
    155
    156 SCIP_CALL( SCIPallocBufferArray(scip, &objcoefs, ndivecands) );
    157
    158 /* collect and count all non-zero absolute values of objective coefficients for diving candidates */
    159 nnzobjcoefs = 0;
    160 for( i = 0; i < ndivecands; ++i )
    161 {
    162 SCIP_Real obj = SCIPvarGetObj(divecandvars[i]);
    163
    164 if( SCIPisZero(scip, obj) )
    165 continue;
    166
    167 objcoefs[nnzobjcoefs] = REALABS(obj);
    168 ++nnzobjcoefs;
    169 }
    170
    171 /* terminate without objcands */
    172 if( nnzobjcoefs == 0 )
    173 goto TERMINATE;
    174 assert(nnzobjcoefs >= 1);
    175
    176 *success = TRUE;
    177
    178 /* skip here if we are cheching the global properties and want to check the local candidates, too */
    179 if( !heurdata->glbchecked && heurdata->checkcands )
    180 goto TERMINATE;
    181
    182 /* sort in increasing order */
    183 SCIPsortReal(objcoefs, nnzobjcoefs);
    184 assert(!SCIPisZero(scip, objcoefs[0]));
    185
    186 lastobjcoef = objcoefs[0];
    187#ifdef SCIP_DEBUG
    188 ndiffnnzobjs = 1;
    189#endif
    190
    191 objdynamism = log10(objcoefs[nnzobjcoefs-1] / objcoefs[0]);
    192
    193 SCIPdebugMsg(scip, "minabscoef: %g, maxabscoef: %g, objdym: %g\n", objcoefs[0], objcoefs[nnzobjcoefs-1], objdynamism);
    194
    195 /* CHECK#2: check objective dynamism */
    196 if( objdynamism < heurdata->objdynamism )
    197 {
    198 SCIPdebugMsg(scip, " ---> disable farkasdiving at node %lld\n", SCIPnodeGetNumber(SCIPgetCurrentNode(scip)));
    199
    200 *success = FALSE;
    201 goto TERMINATE;
    202 }
    203
    204 /* CHECK#4: the check would be always fulfilled for heurdata->maxobjocc = 1.0 */
    205 if( heurdata->maxobjocc < 1.0 )
    206 {
    207 int tmpmaxfreq;
    208
    209 tmpmaxfreq = 0;
    210 maxfreq = 0;
    211
    212 /* count number of different absolute objective values */
    213 for( i = 1; i < nnzobjcoefs; i++ )
    214 {
    215 if( SCIPisGT(scip, objcoefs[i], lastobjcoef) )
    216 {
    217 if( tmpmaxfreq > maxfreq )
    218 maxfreq = tmpmaxfreq;
    219 tmpmaxfreq = 0;
    220
    221 lastobjcoef = objcoefs[i];
    222#ifdef SCIP_DEBUG
    223 ++ndiffnnzobjs;
    224#endif
    225 }
    226 else
    227 {
    228 ++tmpmaxfreq;
    229 }
    230 }
    231
    232#ifdef SCIP_DEBUG
    233 SCIPdebugMsg(scip, "%d divecands; %d nnzobjs; %d diffnnzobjs; %d maxfreq\n", ndivecands, nnzobjcoefs, ndiffnnzobjs,
    234 maxfreq);
    235#endif
    236
    237 if( maxfreq > heurdata->maxobjocc * nnzobjcoefs )
    238 {
    239 SCIPdebugMsg(scip, " ---> disable farkasdiving at node %lld\n", SCIPnodeGetNumber(SCIPgetCurrentNode(scip)));
    240
    241 *success = FALSE;
    242 }
    243 }
    244
    245 TERMINATE:
    246 SCIPfreeBufferArray(scip, &objcoefs);
    247
    248 return SCIP_OKAY;
    249}
    250
    251
    252/*
    253 * Callback methods
    254 */
    255
    256/** copy method for primal heuristic plugins (called when SCIP copies plugins) */
    257static
    258SCIP_DECL_HEURCOPY(heurCopyFarkasdiving)
    259{ /*lint --e{715}*/
    260 assert(scip != NULL);
    261 assert(heur != NULL);
    262
    264
    265 /* call inclusion method of primal heuristic */
    267
    268 return SCIP_OKAY;
    269}
    270
    271/** destructor of primal heuristic to free user data (called when SCIP is exiting) */
    272static
    273SCIP_DECL_HEURFREE(heurFreeFarkasdiving)
    274{ /*lint --e{715}*/
    275 SCIP_HEURDATA* heurdata;
    276
    277 assert(heur != NULL);
    278 assert(scip != NULL);
    279
    281
    282 /* free heuristic data */
    283 heurdata = SCIPheurGetData(heur);
    284 assert(heurdata != NULL);
    285
    286 SCIPfreeBlockMemory(scip, &heurdata);
    287 SCIPheurSetData(heur, NULL);
    288
    289 return SCIP_OKAY;
    290}
    291
    292
    293/** initialization method of primal heuristic (called after problem was transformed) */
    294static
    295SCIP_DECL_HEURINIT(heurInitFarkasdiving)
    296{ /*lint --e{715}*/
    297 SCIP_HEURDATA* heurdata;
    298
    299 assert(heur != NULL);
    300
    302
    303 /* get heuristic data */
    304 heurdata = SCIPheurGetData(heur);
    305 assert(heurdata != NULL);
    306
    307 /* create working solution */
    308 SCIP_CALL( SCIPcreateSol(scip, &heurdata->sol, heur) );
    309
    310 heurdata->disabled = FALSE;
    311 heurdata->glbchecked = FALSE;
    312
    313 return SCIP_OKAY;
    314}
    315
    316
    317/** deinitialization method of primal heuristic (called before transformed problem is freed) */
    318static
    319SCIP_DECL_HEUREXIT(heurExitFarkasdiving)
    320{ /*lint --e{715}*/
    321 SCIP_HEURDATA* heurdata;
    322
    323 assert(heur != NULL);
    324
    326
    327 /* get heuristic data */
    328 heurdata = SCIPheurGetData(heur);
    329 assert(heurdata != NULL);
    330
    331 /* free working solution */
    332 SCIP_CALL( SCIPfreeSol(scip, &heurdata->sol) );
    333
    334 return SCIP_OKAY;
    335}
    336
    337/** solving process initialization method of primal heuristic (called when branch and bound process is about to begin) */
    338static
    339SCIP_DECL_HEURINITSOL(heurInitsolFarkasdiving)
    340{ /*lint --e{715}*/
    341 SCIP_HEURDATA* heurdata;
    342
    343 assert(heur != NULL);
    344
    346
    347 /* get heuristic data */
    348 heurdata = SCIPheurGetData(heur);
    349 assert(heurdata != NULL);
    350
    351 heurdata->glbchecked = FALSE;
    352 heurdata->disabled = FALSE;
    353 heurdata->foundrootsol = FALSE;
    354
    355 return SCIP_OKAY;
    356}
    357
    358/** execution method of primal heuristic */
    359static
    360SCIP_DECL_HEUREXEC(heurExecFarkasdiving)
    361{ /*lint --e{715}*/
    362 SCIP_HEURDATA* heurdata;
    363 SCIP_DIVESET* diveset;
    364 SCIP_Bool success;
    365
    366 assert(scip != NULL);
    367 assert(heur != NULL);
    368 assert(result != NULL);
    369
    370 *result = SCIP_DIDNOTRUN;
    371
    372 heurdata = SCIPheurGetData(heur);
    373 assert(heurdata != NULL);
    374
    375 /* terminate if the heuristic has been disabled */
    376 if( heurdata->disabled )
    377 return SCIP_OKAY;
    378
    379 /* check some simple global properties that are needed to run this heuristic */
    380 success = !heurdata->rootsuccess || heurdata->foundrootsol || SCIPgetDepth(scip) < 1;
    381 if( success && !heurdata->glbchecked )
    382 {
    385 heurdata->glbchecked = TRUE;
    386 }
    387
    388 /* disable heuristic if requirements missing */
    389 if( !success )
    390 {
    391 heurdata->disabled = TRUE;
    392 return SCIP_OKAY;
    393 }
    394
    395 /* check diving candidates in detail */
    396 if( heurdata->checkcands )
    397 {
    398 SCIP_VAR** divecandvars;
    399 int ndivecands;
    400
    401 /* we can only access the branching candidates if the LP is solved to optimality */
    403 {
    404 SCIP_CALL( SCIPgetLPBranchCands(scip, &divecandvars, NULL, NULL, &ndivecands, NULL, NULL) );
    405
    406 SCIP_CALL( checkDivingCandidates(scip, heurdata, divecandvars, ndivecands, &success) );
    407 }
    408 else
    409 {
    410 success = FALSE;
    411 }
    412 }
    413
    414 if( success )
    415 {
    416 assert(SCIPheurGetDivesets(heur) != NULL);
    417 assert(SCIPheurGetNDivesets(heur) >= 1);
    418 diveset = SCIPheurGetDivesets(heur)[0];
    419 assert(diveset != NULL);
    420
    421 SCIP_CALL( SCIPperformGenericDivingAlgorithm(scip, diveset, heurdata->sol, heur, result, nodeinfeasible, -1L, -1, -1.0, SCIP_DIVECONTEXT_SINGLE) );
    422
    423 if( heurdata->rootsuccess && SCIPgetDepth(scip) == 0 && SCIPdivesetGetNSols(diveset, SCIP_DIVECONTEXT_SINGLE) > 0 )
    424 heurdata->foundrootsol = TRUE;
    425 }
    426
    427 return SCIP_OKAY;
    428}
    429
    430#define MIN_RAND 1e-06
    431#define MAX_RAND 1e-05
    432
    433/** calculate score and preferred rounding direction for the candidate variable */
    434static
    435SCIP_DECL_DIVESETGETSCORE(divesetGetScoreFarkasdiving)
    436{ /*lint --e{715}*/
    437 SCIP_HEUR* heur;
    438 SCIP_HEURDATA* heurdata;
    439 SCIP_RANDNUMGEN* randnumgen;
    440 SCIP_Real obj;
    441
    442 heur = SCIPdivesetGetHeur(diveset);
    443 assert(heur != NULL);
    444
    445 heurdata = SCIPheurGetData(heur);
    446 assert(heurdata != NULL);
    447
    448 randnumgen = SCIPdivesetGetRandnumgen(diveset);
    449 assert(randnumgen != NULL);
    450
    451 obj = SCIPvarGetObj(cand);
    452
    453 /* dive towards the pseudosolution, at the same time approximate the contribution to
    454 * a potentially Farkas-proof (infeasibility proof) by y^TA_i = c_i.
    455 */
    456 if( SCIPisNegative(scip, obj) )
    457 {
    458 *roundup = TRUE;
    459 }
    460 else if( SCIPisPositive(scip, obj) )
    461 {
    462 *roundup = FALSE;
    463 }
    464 else
    465 {
    466 if( SCIPisEQ(scip, candsfrac, 0.5) )
    467 *roundup = !SCIPrandomGetInt(randnumgen, 0, 1);
    468 else
    469 *roundup = (candsfrac > 0.5);
    470 }
    471
    472 /* larger score is better */
    473 *score = REALABS(obj) + SCIPrandomGetReal(randnumgen, MIN_RAND, MAX_RAND);
    474
    475 if( heurdata->scalescore )
    476 {
    477 if( heurdata->scaletype == 'f' )
    478 {
    479 if( *roundup )
    480 *score *= (1.0 - candsfrac);
    481 else
    482 *score *= candsfrac;
    483 }
    484 else
    485 {
    486 assert(heurdata->scaletype == 'i');
    487
    488 if( *roundup )
    489 *score *= (SCIPceil(scip, candsol) - SCIPvarGetLbLocal(cand));
    490 else
    491 *score *= (SCIPvarGetUbLocal(cand) - SCIPfloor(scip, candsol));
    492 }
    493 }
    494
    495 /* prefer decisions on binary variables */
    497 *score = -1.0 / *score;
    498
    499 return SCIP_OKAY;
    500}
    501
    502/*
    503 * heuristic specific interface methods
    504 */
    505#define divesetAvailableFarkasdiving NULL
    506
    507/** creates the farkasdiving heuristic and includes it in SCIP */
    509 SCIP* scip /**< SCIP data structure */
    510 )
    511{
    512 SCIP_HEURDATA* heurdata;
    513 SCIP_HEUR* heur;
    514
    515 /* create Farkasdiving primal heuristic data */
    516 SCIP_CALL( SCIPallocBlockMemory(scip, &heurdata) );
    517
    518 /* include primal heuristic */
    521 HEUR_MAXDEPTH, HEUR_TIMING, HEUR_USESSUBSCIP, heurExecFarkasdiving, heurdata) );
    522
    523 assert(heur != NULL);
    524
    525 /* primal heuristic is safe to use in exact solving mode */
    526 SCIPheurMarkExact(heur);
    527
    528 /* set non-NULL pointers to callback methods */
    529 SCIP_CALL( SCIPsetHeurCopy(scip, heur, heurCopyFarkasdiving) );
    530 SCIP_CALL( SCIPsetHeurFree(scip, heur, heurFreeFarkasdiving) );
    531 SCIP_CALL( SCIPsetHeurInit(scip, heur, heurInitFarkasdiving) );
    532 SCIP_CALL( SCIPsetHeurExit(scip, heur, heurExitFarkasdiving) );
    533 SCIP_CALL( SCIPsetHeurInitsol(scip, heur, heurInitsolFarkasdiving) );
    534
    535 /* farkasdiving heuristic parameters */
    536 /* create a diveset (this will automatically install some additional parameters for the heuristic) */
    540 divesetGetScoreFarkasdiving, divesetAvailableFarkasdiving) );
    541
    542 SCIP_CALL( SCIPaddBoolParam(scip, "heuristics/" HEUR_NAME "/checkcands",
    543 "should diving candidates be checked before running?",
    544 &heurdata->checkcands, TRUE, DEFAULT_CHECKCANDS, NULL, NULL) );
    545
    546 SCIP_CALL( SCIPaddBoolParam(scip, "heuristics/" HEUR_NAME "/scalescore",
    547 "should the score be scaled?",
    548 &heurdata->scalescore, TRUE, DEFAULT_SCALESCORE, NULL, NULL) );
    549
    550 SCIP_CALL( SCIPaddBoolParam(scip, "heuristics/" HEUR_NAME "/rootsuccess",
    551 "should the heuristic only run within the tree if at least one solution was found at the root node?",
    552 &heurdata->rootsuccess, TRUE, DEFAULT_ROOTSUCCESS, NULL, NULL) );
    553
    554 SCIP_CALL( SCIPaddRealParam(scip, "heuristics/" HEUR_NAME "/maxobjocc",
    555 "maximal occurance factor of an objective coefficient",
    556 &heurdata->maxobjocc, TRUE, DEFAULT_MAXOBJOCC, 0.0, 1.0, NULL, NULL) );
    557
    558 SCIP_CALL( SCIPaddRealParam(scip, "heuristics/" HEUR_NAME "/objdynamism",
    559 "minimal objective dynamism (log) to run",
    560 &heurdata->objdynamism, TRUE, DEFAULT_OBJDYN, 0.0, SCIPinfinity(scip), NULL, NULL) );
    561
    562 SCIP_CALL( SCIPaddCharParam(scip, "heuristics/" HEUR_NAME "/scaletype",
    563 "scale score by [f]ractionality or [i]mpact on farkasproof",
    564 &heurdata->scaletype, TRUE, DEFAULT_SCALETYPE, "fi", NULL, NULL) );
    565
    566 return SCIP_OKAY;
    567}
    #define NULL
    Definition: def.h:257
    #define SCIP_Bool
    Definition: def.h:100
    #define SCIP_STRINGEQ(name, reference, retcode)
    Definition: def.h:454
    #define SCIP_Real
    Definition: def.h:165
    #define TRUE
    Definition: def.h:102
    #define FALSE
    Definition: def.h:103
    #define REALABS(x)
    Definition: def.h:191
    #define SCIP_CALL(x)
    Definition: def.h:364
    int SCIPgetNObjVars(SCIP *scip)
    Definition: scip_prob.c:2616
    int SCIPgetNContVars(SCIP *scip)
    Definition: scip_prob.c:2569
    int SCIPgetNVars(SCIP *scip)
    Definition: scip_prob.c:2246
    SCIP_VAR ** SCIPgetVars(SCIP *scip)
    Definition: scip_prob.c:2201
    int SCIPgetNContImplVars(SCIP *scip)
    Definition: scip_prob.c:2522
    #define SCIPdebugMsg
    Definition: scip_message.h:78
    SCIP_RETCODE SCIPaddCharParam(SCIP *scip, const char *name, const char *desc, char *valueptr, SCIP_Bool isadvanced, char defaultvalue, const char *allowedvalues, SCIP_DECL_PARAMCHGD((*paramchgd)), SCIP_PARAMDATA *paramdata)
    Definition: scip_param.c:167
    SCIP_RETCODE SCIPaddRealParam(SCIP *scip, const char *name, const char *desc, SCIP_Real *valueptr, SCIP_Bool isadvanced, SCIP_Real defaultvalue, SCIP_Real minvalue, SCIP_Real maxvalue, SCIP_DECL_PARAMCHGD((*paramchgd)), SCIP_PARAMDATA *paramdata)
    Definition: scip_param.c:139
    SCIP_RETCODE SCIPaddBoolParam(SCIP *scip, const char *name, const char *desc, SCIP_Bool *valueptr, SCIP_Bool isadvanced, SCIP_Bool defaultvalue, SCIP_DECL_PARAMCHGD((*paramchgd)), SCIP_PARAMDATA *paramdata)
    Definition: scip_param.c:57
    SCIP_RETCODE SCIPincludeHeurFarkasdiving(SCIP *scip)
    SCIP_RETCODE SCIPgetLPBranchCands(SCIP *scip, SCIP_VAR ***lpcands, SCIP_Real **lpcandssol, SCIP_Real **lpcandsfrac, int *nlpcands, int *npriolpcands, int *nfracimplvars)
    Definition: scip_branch.c:402
    SCIP_RETCODE SCIPcreateDiveset(SCIP *scip, SCIP_DIVESET **diveset, SCIP_HEUR *heur, const char *name, SCIP_Real minreldepth, SCIP_Real maxreldepth, SCIP_Real maxlpiterquot, SCIP_Real maxdiveubquot, SCIP_Real maxdiveavgquot, SCIP_Real maxdiveubquotnosol, SCIP_Real maxdiveavgquotnosol, SCIP_Real lpresolvedomchgquot, int lpsolvefreq, int maxlpiterofs, unsigned int initialseed, SCIP_Bool backtrack, SCIP_Bool onlylpbranchcands, SCIP_Bool ispublic, SCIP_Bool specificsos1score, SCIP_DECL_DIVESETGETSCORE((*divesetgetscore)), SCIP_DECL_DIVESETAVAILABLE((*divesetavailable)))
    Definition: scip_heur.c:323
    SCIP_Longint SCIPdivesetGetNSols(SCIP_DIVESET *diveset, SCIP_DIVECONTEXT divecontext)
    Definition: heur.c:641
    SCIP_RANDNUMGEN * SCIPdivesetGetRandnumgen(SCIP_DIVESET *diveset)
    Definition: heur.c:720
    SCIP_RETCODE SCIPsetHeurCopy(SCIP *scip, SCIP_HEUR *heur, SCIP_DECL_HEURCOPY((*heurcopy)))
    Definition: scip_heur.c:167
    SCIP_HEURDATA * SCIPheurGetData(SCIP_HEUR *heur)
    Definition: heur.c:1368
    SCIP_RETCODE SCIPincludeHeurBasic(SCIP *scip, SCIP_HEUR **heur, const char *name, const char *desc, char dispchar, int priority, int freq, int freqofs, int maxdepth, SCIP_HEURTIMING timingmask, SCIP_Bool usessubscip, SCIP_DECL_HEUREXEC((*heurexec)), SCIP_HEURDATA *heurdata)
    Definition: scip_heur.c:122
    SCIP_RETCODE SCIPsetHeurFree(SCIP *scip, SCIP_HEUR *heur, SCIP_DECL_HEURFREE((*heurfree)))
    Definition: scip_heur.c:183
    SCIP_RETCODE SCIPsetHeurExit(SCIP *scip, SCIP_HEUR *heur, SCIP_DECL_HEUREXIT((*heurexit)))
    Definition: scip_heur.c:215
    SCIP_RETCODE SCIPsetHeurInitsol(SCIP *scip, SCIP_HEUR *heur, SCIP_DECL_HEURINITSOL((*heurinitsol)))
    Definition: scip_heur.c:231
    int SCIPheurGetNDivesets(SCIP_HEUR *heur)
    Definition: heur.c:1675
    void SCIPheurMarkExact(SCIP_HEUR *heur)
    Definition: heur.c:1457
    SCIP_RETCODE SCIPsetHeurInit(SCIP *scip, SCIP_HEUR *heur, SCIP_DECL_HEURINIT((*heurinit)))
    Definition: scip_heur.c:199
    const char * SCIPheurGetName(SCIP_HEUR *heur)
    Definition: heur.c:1467
    SCIP_DIVESET ** SCIPheurGetDivesets(SCIP_HEUR *heur)
    Definition: heur.c:1665
    void SCIPheurSetData(SCIP_HEUR *heur, SCIP_HEURDATA *heurdata)
    Definition: heur.c:1378
    SCIP_LPSOLSTAT SCIPgetLPSolstat(SCIP *scip)
    Definition: scip_lp.c:174
    #define SCIPallocBufferArray(scip, ptr, num)
    Definition: scip_mem.h:124
    #define SCIPfreeBufferArray(scip, ptr)
    Definition: scip_mem.h:136
    #define SCIPfreeBlockMemory(scip, ptr)
    Definition: scip_mem.h:108
    #define SCIPallocBlockMemory(scip, ptr)
    Definition: scip_mem.h:89
    SCIP_Longint SCIPnodeGetNumber(SCIP_NODE *node)
    Definition: tree.c:8513
    SCIP_RETCODE SCIPcreateSol(SCIP *scip, SCIP_SOL **sol, SCIP_HEUR *heur)
    Definition: scip_sol.c:514
    SCIP_RETCODE SCIPfreeSol(SCIP *scip, SCIP_SOL **sol)
    Definition: scip_sol.c:1250
    SCIP_RETCODE SCIPperformGenericDivingAlgorithm(SCIP *scip, SCIP_DIVESET *diveset, SCIP_SOL *worksol, SCIP_HEUR *heur, SCIP_RESULT *result, SCIP_Bool nodeinfeasible, SCIP_Longint iterlim, int nodelimit, SCIP_Real lpresolvedomchgquot, SCIP_DIVECONTEXT divecontext)
    Definition: heuristics.c:221
    SCIP_Real SCIPinfinity(SCIP *scip)
    SCIP_Bool SCIPisPositive(SCIP *scip, SCIP_Real val)
    SCIP_Real SCIPfloor(SCIP *scip, SCIP_Real val)
    SCIP_Bool SCIPisGT(SCIP *scip, SCIP_Real val1, SCIP_Real val2)
    SCIP_Bool SCIPisNegative(SCIP *scip, SCIP_Real val)
    SCIP_Real SCIPceil(SCIP *scip, SCIP_Real val)
    SCIP_Bool SCIPisEQ(SCIP *scip, SCIP_Real val1, SCIP_Real val2)
    SCIP_Bool SCIPisZero(SCIP *scip, SCIP_Real val)
    int SCIPgetDepth(SCIP *scip)
    Definition: scip_tree.c:672
    SCIP_NODE * SCIPgetCurrentNode(SCIP *scip)
    Definition: scip_tree.c:91
    SCIP_Bool SCIPvarIsImpliedIntegral(SCIP_VAR *var)
    Definition: var.c:23530
    SCIP_Real SCIPvarGetUbLocal(SCIP_VAR *var)
    Definition: var.c:24300
    SCIP_Real SCIPvarGetObj(SCIP_VAR *var)
    Definition: var.c:23932
    SCIP_VARTYPE SCIPvarGetType(SCIP_VAR *var)
    Definition: var.c:23485
    SCIP_Real SCIPvarGetLbLocal(SCIP_VAR *var)
    Definition: var.c:24266
    SCIP_Real SCIPrandomGetReal(SCIP_RANDNUMGEN *randnumgen, SCIP_Real minrandval, SCIP_Real maxrandval)
    Definition: misc.c:10245
    int SCIPrandomGetInt(SCIP_RANDNUMGEN *randnumgen, int minrandval, int maxrandval)
    Definition: misc.c:10223
    void SCIPsortReal(SCIP_Real *realarray, int len)
    SCIP_HEUR * SCIPdivesetGetHeur(SCIP_DIVESET *diveset)
    Definition: heur.c:416
    #define DEFAULT_ONLYLPBRANCHCANDS
    #define DEFAULT_MAXDIVEUBQUOT
    static SCIP_DECL_HEURINITSOL(heurInitsolFarkasdiving)
    #define DEFAULT_LPRESOLVEDOMCHGQUOT
    #define HEUR_TIMING
    static SCIP_DECL_HEUREXIT(heurExitFarkasdiving)
    #define DEFAULT_MAXLPITERQUOT
    #define HEUR_FREQOFS
    #define HEUR_DESC
    static SCIP_DECL_HEUREXEC(heurExecFarkasdiving)
    #define DEFAULT_SCALESCORE
    #define DEFAULT_MAXDIVEAVGQUOT
    #define DEFAULT_LPSOLVEFREQ
    #define DEFAULT_BACKTRACK
    #define DEFAULT_MAXDIVEUBQUOTNOSOL
    #define HEUR_DISPCHAR
    #define HEUR_MAXDEPTH
    #define HEUR_PRIORITY
    #define DEFAULT_MAXRELDEPTH
    #define DEFAULT_MAXLPITEROFS
    #define DEFAULT_MAXDIVEAVGQUOTNOSOL
    #define DEFAULT_SCALETYPE
    #define HEUR_NAME
    #define DEFAULT_ROOTSUCCESS
    #define divesetAvailableFarkasdiving
    #define MAX_RAND
    #define DEFAULT_CHECKCANDS
    static SCIP_DECL_HEURINIT(heurInitFarkasdiving)
    #define DEFAULT_RANDSEED
    static SCIP_DECL_HEURCOPY(heurCopyFarkasdiving)
    #define DIVESET_DIVETYPES
    static SCIP_RETCODE checkDivingCandidates(SCIP *scip, SCIP_HEURDATA *heurdata, SCIP_VAR **divecandvars, int ndivecands, SCIP_Bool *success)
    static SCIP_DECL_HEURFREE(heurFreeFarkasdiving)
    static SCIP_DECL_DIVESETGETSCORE(divesetGetScoreFarkasdiving)
    #define DIVESET_ISPUBLIC
    #define DEFAULT_MAXOBJOCC
    #define HEUR_FREQ
    #define MIN_RAND
    #define DEFAULT_MINRELDEPTH
    #define HEUR_USESSUBSCIP
    #define DEFAULT_OBJDYN
    LP diving heuristic that tries to construct a Farkas-proof.
    methods commonly used by primal heuristics
    memory allocation routines
    public methods for primal heuristics
    public methods for message output
    public data structures and miscellaneous methods
    methods for sorting joint arrays of various types
    public methods for branch and bound tree
    public methods for problem variables
    public methods for branching rule plugins and branching
    public methods for primal heuristic plugins and divesets
    public methods for the LP relaxation, rows and columns
    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 methods for the branch-and-bound tree
    SCIP_SOL * sol
    Definition: struct_heur.h:71
    struct SCIP_HeurData SCIP_HEURDATA
    Definition: type_heur.h:77
    @ SCIP_DIVECONTEXT_SINGLE
    Definition: type_heur.h:69
    @ SCIP_LPSOLSTAT_OPTIMAL
    Definition: type_lp.h:44
    @ SCIP_DIDNOTRUN
    Definition: type_result.h:42
    @ SCIP_OKAY
    Definition: type_retcode.h:42
    @ SCIP_INVALIDCALL
    Definition: type_retcode.h:51
    enum SCIP_Retcode SCIP_RETCODE
    Definition: type_retcode.h:63
    @ SCIP_VARTYPE_BINARY
    Definition: type_var.h:64