Scippy

    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-2025 Zuse Institute Berlin (ZIB) */
    7/* */
    8/* Licensed under the Apache License, Version 2.0 (the "License"); */
    9/* you may not use this file except in compliance with the License. */
    10/* You may obtain a copy of the License at */
    11/* */
    12/* http://www.apache.org/licenses/LICENSE-2.0 */
    13/* */
    14/* Unless required by applicable law or agreed to in writing, software */
    15/* distributed under the License is distributed on an "AS IS" BASIS, */
    16/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. */
    17/* See the License for the specific language governing permissions and */
    18/* limitations under the License. */
    19/* */
    20/* You should have received a copy of the Apache-2.0 license */
    21/* along with SCIP; see the file LICENSE. If not visit scipopt.org. */
    22/* */
    23/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
    24
    25/**@file 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#include <string.h>
    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 assert(strcmp(SCIPheurGetName(heur), HEUR_NAME) == 0);
    263
    264 /* call inclusion method of primal heuristic */
    266
    267 return SCIP_OKAY;
    268}
    269
    270/** destructor of primal heuristic to free user data (called when SCIP is exiting) */
    271static
    272SCIP_DECL_HEURFREE(heurFreeFarkasdiving)
    273{ /*lint --e{715}*/
    274 SCIP_HEURDATA* heurdata;
    275
    276 assert(heur != NULL);
    277 assert(strcmp(SCIPheurGetName(heur), HEUR_NAME) == 0);
    278 assert(scip != NULL);
    279
    280 /* free heuristic data */
    281 heurdata = SCIPheurGetData(heur);
    282 assert(heurdata != NULL);
    283
    284 SCIPfreeBlockMemory(scip, &heurdata);
    285 SCIPheurSetData(heur, NULL);
    286
    287 return SCIP_OKAY;
    288}
    289
    290
    291/** initialization method of primal heuristic (called after problem was transformed) */
    292static
    293SCIP_DECL_HEURINIT(heurInitFarkasdiving)
    294{ /*lint --e{715}*/
    295 SCIP_HEURDATA* heurdata;
    296
    297 assert(heur != NULL);
    298 assert(strcmp(SCIPheurGetName(heur), HEUR_NAME) == 0);
    299
    300 /* get heuristic data */
    301 heurdata = SCIPheurGetData(heur);
    302 assert(heurdata != NULL);
    303
    304 /* create working solution */
    305 SCIP_CALL( SCIPcreateSol(scip, &heurdata->sol, heur) );
    306
    307 heurdata->disabled = FALSE;
    308 heurdata->glbchecked = FALSE;
    309
    310 return SCIP_OKAY;
    311}
    312
    313
    314/** deinitialization method of primal heuristic (called before transformed problem is freed) */
    315static
    316SCIP_DECL_HEUREXIT(heurExitFarkasdiving)
    317{ /*lint --e{715}*/
    318 SCIP_HEURDATA* heurdata;
    319
    320 assert(heur != NULL);
    321 assert(strcmp(SCIPheurGetName(heur), HEUR_NAME) == 0);
    322
    323 /* get heuristic data */
    324 heurdata = SCIPheurGetData(heur);
    325 assert(heurdata != NULL);
    326
    327 /* free working solution */
    328 SCIP_CALL( SCIPfreeSol(scip, &heurdata->sol) );
    329
    330 return SCIP_OKAY;
    331}
    332
    333/** solving process initialization method of primal heuristic (called when branch and bound process is about to begin) */
    334static
    335SCIP_DECL_HEURINITSOL(heurInitsolFarkasdiving)
    336{ /*lint --e{715}*/
    337 SCIP_HEURDATA* heurdata;
    338
    339 assert(heur != NULL);
    340 assert(strcmp(SCIPheurGetName(heur), HEUR_NAME) == 0);
    341
    342 /* get heuristic data */
    343 heurdata = SCIPheurGetData(heur);
    344 assert(heurdata != NULL);
    345
    346 heurdata->glbchecked = FALSE;
    347 heurdata->disabled = FALSE;
    348 heurdata->foundrootsol = FALSE;
    349
    350 return SCIP_OKAY;
    351}
    352
    353/** execution method of primal heuristic */
    354static
    355SCIP_DECL_HEUREXEC(heurExecFarkasdiving)
    356{ /*lint --e{715}*/
    357 SCIP_HEURDATA* heurdata;
    358 SCIP_DIVESET* diveset;
    359 SCIP_Bool success;
    360
    361 assert(scip != NULL);
    362 assert(heur != NULL);
    363 assert(result != NULL);
    364
    365 *result = SCIP_DIDNOTRUN;
    366
    367 heurdata = SCIPheurGetData(heur);
    368 assert(heurdata != NULL);
    369
    370 /* terminate if the heuristic has been disabled */
    371 if( heurdata->disabled )
    372 return SCIP_OKAY;
    373
    374 /* check some simple global properties that are needed to run this heuristic */
    375 success = !heurdata->rootsuccess || heurdata->foundrootsol || SCIPgetDepth(scip) < 1;
    376 if( success && !heurdata->glbchecked )
    377 {
    380 heurdata->glbchecked = TRUE;
    381 }
    382
    383 /* disable heuristic if requirements missing */
    384 if( !success )
    385 {
    386 heurdata->disabled = TRUE;
    387 return SCIP_OKAY;
    388 }
    389
    390 /* check diving candidates in detail */
    391 if( heurdata->checkcands )
    392 {
    393 SCIP_VAR** divecandvars;
    394 int ndivecands;
    395
    396 /* we can only access the branching candidates if the LP is solved to optimality */
    398 {
    399 SCIP_CALL( SCIPgetLPBranchCands(scip, &divecandvars, NULL, NULL, &ndivecands, NULL, NULL) );
    400
    401 SCIP_CALL( checkDivingCandidates(scip, heurdata, divecandvars, ndivecands, &success) );
    402 }
    403 else
    404 {
    405 success = FALSE;
    406 }
    407 }
    408
    409 if( success )
    410 {
    411 assert(SCIPheurGetDivesets(heur) != NULL);
    412 assert(SCIPheurGetNDivesets(heur) >= 1);
    413 diveset = SCIPheurGetDivesets(heur)[0];
    414 assert(diveset != NULL);
    415
    416 SCIP_CALL( SCIPperformGenericDivingAlgorithm(scip, diveset, heurdata->sol, heur, result, nodeinfeasible, -1L, -1, -1.0, SCIP_DIVECONTEXT_SINGLE) );
    417
    418 if( heurdata->rootsuccess && SCIPgetDepth(scip) == 0 && SCIPdivesetGetNSols(diveset, SCIP_DIVECONTEXT_SINGLE) > 0 )
    419 heurdata->foundrootsol = TRUE;
    420 }
    421
    422 return SCIP_OKAY;
    423}
    424
    425#define MIN_RAND 1e-06
    426#define MAX_RAND 1e-05
    427
    428/** calculate score and preferred rounding direction for the candidate variable */
    429static
    430SCIP_DECL_DIVESETGETSCORE(divesetGetScoreFarkasdiving)
    431{ /*lint --e{715}*/
    432 SCIP_HEUR* heur;
    433 SCIP_HEURDATA* heurdata;
    434 SCIP_RANDNUMGEN* randnumgen;
    435 SCIP_Real obj;
    436
    437 heur = SCIPdivesetGetHeur(diveset);
    438 assert(heur != NULL);
    439
    440 heurdata = SCIPheurGetData(heur);
    441 assert(heurdata != NULL);
    442
    443 randnumgen = SCIPdivesetGetRandnumgen(diveset);
    444 assert(randnumgen != NULL);
    445
    446 obj = SCIPvarGetObj(cand);
    447
    448 /* dive towards the pseudosolution, at the same time approximate the contribution to
    449 * a potentially Farkas-proof (infeasibility proof) by y^TA_i = c_i.
    450 */
    451 if( SCIPisNegative(scip, obj) )
    452 {
    453 *roundup = TRUE;
    454 }
    455 else if( SCIPisPositive(scip, obj) )
    456 {
    457 *roundup = FALSE;
    458 }
    459 else
    460 {
    461 if( SCIPisEQ(scip, candsfrac, 0.5) )
    462 *roundup = !SCIPrandomGetInt(randnumgen, 0, 1);
    463 else
    464 *roundup = (candsfrac > 0.5);
    465 }
    466
    467 /* larger score is better */
    468 *score = REALABS(obj) + SCIPrandomGetReal(randnumgen, MIN_RAND, MAX_RAND);
    469
    470 if( heurdata->scalescore )
    471 {
    472 if( heurdata->scaletype == 'f' )
    473 {
    474 if( *roundup )
    475 *score *= (1.0 - candsfrac);
    476 else
    477 *score *= candsfrac;
    478 }
    479 else
    480 {
    481 assert(heurdata->scaletype == 'i');
    482
    483 if( *roundup )
    484 *score *= (SCIPceil(scip, candsol) - SCIPvarGetLbLocal(cand));
    485 else
    486 *score *= (SCIPvarGetUbLocal(cand) - SCIPfloor(scip, candsol));
    487 }
    488 }
    489
    490 /* prefer decisions on binary variables */
    492 *score = -1.0 / *score;
    493
    494 return SCIP_OKAY;
    495}
    496
    497/*
    498 * heuristic specific interface methods
    499 */
    500#define divesetAvailableFarkasdiving NULL
    501
    502/** creates the farkasdiving heuristic and includes it in SCIP */
    504 SCIP* scip /**< SCIP data structure */
    505 )
    506{
    507 SCIP_HEURDATA* heurdata;
    508 SCIP_HEUR* heur;
    509
    510 /* create Farkasdiving primal heuristic data */
    511 SCIP_CALL( SCIPallocBlockMemory(scip, &heurdata) );
    512
    513 /* include primal heuristic */
    516 HEUR_MAXDEPTH, HEUR_TIMING, HEUR_USESSUBSCIP, heurExecFarkasdiving, heurdata) );
    517
    518 assert(heur != NULL);
    519
    520 /* primal heuristic is safe to use in exact solving mode */
    521 SCIPheurMarkExact(heur);
    522
    523 /* set non-NULL pointers to callback methods */
    524 SCIP_CALL( SCIPsetHeurCopy(scip, heur, heurCopyFarkasdiving) );
    525 SCIP_CALL( SCIPsetHeurFree(scip, heur, heurFreeFarkasdiving) );
    526 SCIP_CALL( SCIPsetHeurInit(scip, heur, heurInitFarkasdiving) );
    527 SCIP_CALL( SCIPsetHeurExit(scip, heur, heurExitFarkasdiving) );
    528 SCIP_CALL( SCIPsetHeurInitsol(scip, heur, heurInitsolFarkasdiving) );
    529
    530 /* farkasdiving heuristic parameters */
    531 /* create a diveset (this will automatically install some additional parameters for the heuristic) */
    535 divesetGetScoreFarkasdiving, divesetAvailableFarkasdiving) );
    536
    537 SCIP_CALL( SCIPaddBoolParam(scip, "heuristics/" HEUR_NAME "/checkcands",
    538 "should diving candidates be checked before running?",
    539 &heurdata->checkcands, TRUE, DEFAULT_CHECKCANDS, NULL, NULL) );
    540
    541 SCIP_CALL( SCIPaddBoolParam(scip, "heuristics/" HEUR_NAME "/scalescore",
    542 "should the score be scaled?",
    543 &heurdata->scalescore, TRUE, DEFAULT_SCALESCORE, NULL, NULL) );
    544
    545 SCIP_CALL( SCIPaddBoolParam(scip, "heuristics/" HEUR_NAME "/rootsuccess",
    546 "should the heuristic only run within the tree if at least one solution was found at the root node?",
    547 &heurdata->rootsuccess, TRUE, DEFAULT_ROOTSUCCESS, NULL, NULL) );
    548
    549 SCIP_CALL( SCIPaddRealParam(scip, "heuristics/" HEUR_NAME "/maxobjocc",
    550 "maximal occurance factor of an objective coefficient",
    551 &heurdata->maxobjocc, TRUE, DEFAULT_MAXOBJOCC, 0.0, 1.0, NULL, NULL) );
    552
    553 SCIP_CALL( SCIPaddRealParam(scip, "heuristics/" HEUR_NAME "/objdynamism",
    554 "minimal objective dynamism (log) to run",
    555 &heurdata->objdynamism, TRUE, DEFAULT_OBJDYN, 0.0, SCIPinfinity(scip), NULL, NULL) );
    556
    557 SCIP_CALL( SCIPaddCharParam(scip, "heuristics/" HEUR_NAME "/scaletype",
    558 "scale score by [f]ractionality or [i]mpact on farkasproof",
    559 &heurdata->scaletype, TRUE, DEFAULT_SCALETYPE, "fi", NULL, NULL) );
    560
    561 return SCIP_OKAY;
    562}
    #define NULL
    Definition: def.h:248
    #define SCIP_Bool
    Definition: def.h:91
    #define SCIP_Real
    Definition: def.h:156
    #define TRUE
    Definition: def.h:93
    #define FALSE
    Definition: def.h:94
    #define REALABS(x)
    Definition: def.h:182
    #define SCIP_CALL(x)
    Definition: def.h:355
    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:8483
    SCIP_RETCODE SCIPcreateSol(SCIP *scip, SCIP_SOL **sol, SCIP_HEUR *heur)
    Definition: scip_sol.c:516
    SCIP_RETCODE SCIPfreeSol(SCIP *scip, SCIP_SOL **sol)
    Definition: scip_sol.c:1252
    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:23498
    SCIP_Real SCIPvarGetUbLocal(SCIP_VAR *var)
    Definition: var.c:24268
    SCIP_Real SCIPvarGetObj(SCIP_VAR *var)
    Definition: var.c:23900
    SCIP_VARTYPE SCIPvarGetType(SCIP_VAR *var)
    Definition: var.c:23453
    SCIP_Real SCIPvarGetLbLocal(SCIP_VAR *var)
    Definition: var.c:24234
    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
    enum SCIP_Retcode SCIP_RETCODE
    Definition: type_retcode.h:63
    @ SCIP_VARTYPE_BINARY
    Definition: type_var.h:64