Scippy

    SCIP

    Solving Constraint Integer Programs

    Detailed Description

    constraint handler for ensuring that primal solution is exact

    Author
    Antonia Chmiela
    Leon Eifler

    Definition in file cons_exactsol.c.

    #include <assert.h>
    #include "scip/def.h"
    #include "scip/cons_exactlinear.h"
    #include "scip/cons_exactsol.h"
    #include "scip/pub_cons.h"
    #include "scip/pub_heur.h"
    #include "scip/pub_lp.h"
    #include "scip/pub_lpexact.h"
    #include "scip/pub_message.h"
    #include "scip/pub_misc.h"
    #include "scip/pub_sol.h"
    #include "scip/pub_var.h"
    #include "scip/rational.h"
    #include "scip/scip_certificate.h"
    #include "scip/scip_cons.h"
    #include "scip/scip_exact.h"
    #include "scip/scip_general.h"
    #include "scip/scip_lp.h"
    #include "scip/scip_lpexact.h"
    #include "scip/scip_mem.h"
    #include "scip/scip_message.h"
    #include "scip/scip_numerics.h"
    #include "scip/scip_param.h"
    #include "scip/scip_prob.h"
    #include "scip/scip_solvingstats.h"
    #include "scip/scip_tree.h"
    #include "scip/set.h"

    Go to the source code of this file.

    Data Structures

    struct  SolIntAssignment
     

    Macros

    #define CONSHDLR_NAME   "exactsol"
     
    #define CONSHDLR_DESC   "constraint handler for repairing floating-point primal solutions to satisfy exact feasibility"
     
    #define CONSHDLR_ENFOPRIORITY   -9999999
     
    #define CONSHDLR_CHECKPRIORITY   -999999
     
    #define CONSHDLR_EAGERFREQ   100
     
    #define CONSHDLR_NEEDSCONS   FALSE
     
    #define DEFAULT_CHECKFPFEASIBILITY   TRUE
     
    #define DEFAULT_CHECKCONTIMPLINT   TRUE
     
    #define DEFAULT_ABORTFRAC   1e-9
     
    #define DEFAULT_UNFIXFRAC   0.0
     
    #define DEFAULT_MAXSTALLS   1000
     
    #define DEFAULT_SOLBUFSIZE   10
     
    #define DEFAULT_MINIMPROVE   0.2
     

    Typedefs

    typedef struct SolIntAssignment SOLINTASSIGNMENT
     

    Functions

    static SCIP_DECL_HASHGETKEY (hashGetKeyAssignment)
     
    static SCIP_DECL_HASHKEYEQ (hashKeyEqAssignment)
     
    static SCIP_DECL_HASHKEYVAL (hashKeyValAssignment)
     
    static SCIP_RETCODE bufferSolution (SCIP *scip, SCIP_SOL *sol, SCIP_CONSHDLRDATA *conshdlrdata)
     
    static void clearSoluBuffer (SCIP *scip, SCIP_CONSHDLRDATA *conshdlrdata)
     
    static SCIP_RETCODE solCreateSolAssignment (SCIP *scip, SCIP_SOL *sol, SCIP_Bool checkcontimplint, SOLINTASSIGNMENT **assignment)
     
    static void solFreeAssignment (SCIP *scip, SOLINTASSIGNMENT **assignment)
     
    static void checkProbHasContEqs (SCIP *scip, SCIP_CONSHDLRDATA *conshdlrdata)
     
    static SCIP_DECL_CONSENFOLP (consEnfolpExactSol)
     
    static SCIP_DECL_CONSENFORELAX (consEnforelaxExactSol)
     
    static SCIP_DECL_CONSENFOPS (consEnfopsExactSol)
     
    static SCIP_DECL_CONSCHECK (consCheckExactSol)
     
    static SCIP_DECL_CONSLOCK (consLockExactSol)
     
    static SCIP_DECL_CONSFREE (consFreeExactSol)
     
    static SCIP_DECL_CONSINIT (consInitExactSol)
     
    static SCIP_DECL_CONSEXIT (consExitExactSol)
     
    static SCIP_DECL_CONSHDLRCOPY (conshdlrCopyExactSol)
     
    SCIP_RETCODE SCIPincludeConshdlrExactSol (SCIP *scip)
     

    Macro Definition Documentation

    ◆ CONSHDLR_NAME

    #define CONSHDLR_NAME   "exactsol"

    Definition at line 65 of file cons_exactsol.c.

    ◆ CONSHDLR_DESC

    #define CONSHDLR_DESC   "constraint handler for repairing floating-point primal solutions to satisfy exact feasibility"

    Definition at line 66 of file cons_exactsol.c.

    ◆ CONSHDLR_ENFOPRIORITY

    #define CONSHDLR_ENFOPRIORITY   -9999999

    priority of the constraint handler for constraint enforcing

    Definition at line 67 of file cons_exactsol.c.

    ◆ CONSHDLR_CHECKPRIORITY

    #define CONSHDLR_CHECKPRIORITY   -999999

    priority of the constraint handler for checking feasibility

    Definition at line 68 of file cons_exactsol.c.

    ◆ CONSHDLR_EAGERFREQ

    #define CONSHDLR_EAGERFREQ   100

    frequency for using all instead of only the useful constraints in separation, propagation and enforcement, -1 for no eager evaluations, 0 for first only

    Definition at line 70 of file cons_exactsol.c.

    ◆ CONSHDLR_NEEDSCONS

    #define CONSHDLR_NEEDSCONS   FALSE

    should the constraint handler be skipped, if no constraints are available?

    Definition at line 71 of file cons_exactsol.c.

    ◆ DEFAULT_CHECKFPFEASIBILITY

    #define DEFAULT_CHECKFPFEASIBILITY   TRUE

    should a solution be checked in floating-point arithmetic prior to being processed?

    Definition at line 73 of file cons_exactsol.c.

    ◆ DEFAULT_CHECKCONTIMPLINT

    #define DEFAULT_CHECKCONTIMPLINT   TRUE

    should integrality of continuous implied integral variables be ensured?

    Definition at line 75 of file cons_exactsol.c.

    ◆ DEFAULT_ABORTFRAC

    #define DEFAULT_ABORTFRAC   1e-9

    fractionality of enforced integral value above which reparation is aborted

    Definition at line 77 of file cons_exactsol.c.

    ◆ DEFAULT_UNFIXFRAC

    #define DEFAULT_UNFIXFRAC   0.0

    fractionality of weakly implied value up to which reparation fixes variable

    Definition at line 79 of file cons_exactsol.c.

    ◆ DEFAULT_MAXSTALLS

    #define DEFAULT_MAXSTALLS   1000

    maximal number of consecutive repair calls without success

    Definition at line 80 of file cons_exactsol.c.

    ◆ DEFAULT_SOLBUFSIZE

    #define DEFAULT_SOLBUFSIZE   10

    size of solution buffer

    Definition at line 81 of file cons_exactsol.c.

    ◆ DEFAULT_MINIMPROVE

    #define DEFAULT_MINIMPROVE   0.2

    minimal percentage of primal improvement to trigger solution processing

    Definition at line 82 of file cons_exactsol.c.

    Typedef Documentation

    ◆ SOLINTASSIGNMENT

    Definition at line 91 of file cons_exactsol.c.

    Function Documentation

    ◆ SCIP_DECL_HASHGETKEY()

    static SCIP_DECL_HASHGETKEY ( hashGetKeyAssignment  )
    static

    gets the key of the given element

    Definition at line 115 of file cons_exactsol.c.

    ◆ SCIP_DECL_HASHKEYEQ()

    static SCIP_DECL_HASHKEYEQ ( hashKeyEqAssignment  )
    static

    returns TRUE iff both keys are equal

    Definition at line 123 of file cons_exactsol.c.

    References FALSE, SolIntAssignment::idx, SolIntAssignment::len, NULL, TRUE, and SolIntAssignment::vals.

    ◆ SCIP_DECL_HASHKEYVAL()

    static SCIP_DECL_HASHKEYVAL ( hashKeyValAssignment  )
    static

    returns the hash value of the key

    Definition at line 149 of file cons_exactsol.c.

    References SolIntAssignment::idx, SolIntAssignment::len, SCIPhashSignature64, and SolIntAssignment::vals.

    ◆ bufferSolution()

    static SCIP_RETCODE bufferSolution ( SCIP scip,
    SCIP_SOL sol,
    SCIP_CONSHDLRDATA conshdlrdata 
    )
    static

    unlinks and copies a solution and adds it to the solution buffer

    Parameters
    scipSCIP data structure
    solsolution to add
    conshdlrdataexactsol constraint handler data

    Definition at line 165 of file cons_exactsol.c.

    References SCIP_CALL, SCIP_OKAY, SCIPcreateSolCopy(), SCIPdebugMessage, SCIPheurGetName(), SCIPreallocBlockMemoryArray, SCIPsolGetHeur(), and SCIPunlinkSol().

    Referenced by SCIP_DECL_CONSCHECK().

    ◆ clearSoluBuffer()

    static void clearSoluBuffer ( SCIP scip,
    SCIP_CONSHDLRDATA conshdlrdata 
    )
    static

    frees all remaining solutions in buffer

    Parameters
    scipSCIP data structure
    conshdlrdataexactsol constraint handler data

    Definition at line 195 of file cons_exactsol.c.

    References SCIP_CALL_ABORT, and SCIPfreeSol().

    Referenced by SCIP_DECL_CONSCHECK().

    ◆ solCreateSolAssignment()

    static SCIP_RETCODE solCreateSolAssignment ( SCIP scip,
    SCIP_SOL sol,
    SCIP_Bool  checkcontimplint,
    SOLINTASSIGNMENT **  assignment 
    )
    static

    creates assignment from integer variable-values in solution

    Parameters
    scipSCIP data structure
    solsolution to create assignment for
    checkcontimplintwhether continuous implied integral variables should be included
    assignmentaddress of assignment

    Definition at line 212 of file cons_exactsol.c.

    References NULL, SCIP_CALL, SCIP_Longint, SCIP_OKAY, SCIPallocBlockMemory, SCIPallocClearBlockMemoryArray, SCIPgetSolVal(), SCIPgetSolVarsData(), SCIPround(), SCIPvarGetIndex(), and SCIPvarIsIntegral().

    Referenced by SCIP_DECL_CONSCHECK().

    ◆ solFreeAssignment()

    static void solFreeAssignment ( SCIP scip,
    SOLINTASSIGNMENT **  assignment 
    )
    static

    creates assignment from integer variable-values in solution

    Parameters
    scipSCIP data structure
    assignmentaddress of assignment

    Definition at line 263 of file cons_exactsol.c.

    References NULL, SCIPfreeBlockMemory, and SCIPfreeBlockMemoryArray.

    Referenced by SCIP_DECL_CONSCHECK().

    ◆ checkProbHasContEqs()

    static void checkProbHasContEqs ( SCIP scip,
    SCIP_CONSHDLRDATA conshdlrdata 
    )
    static

    checks whether equation constraints with non-integral variables are present

    Parameters
    scipSCIP data structure
    conshdlrdataexactsol constraint handler data

    Definition at line 278 of file cons_exactsol.c.

    References NULL, SCIP_Bool, SCIPABORT, SCIPconsGetHdlr(), SCIPconsGetLhsExact(), SCIPconsGetRhsExact(), SCIPconshdlrGetName(), SCIPerrorMessage, SCIPfindConshdlr(), SCIPgetConss(), SCIPgetNConss(), SCIPgetNVarsExactLinear(), SCIPgetVarsExactLinear(), SCIPrationalIsEQ(), SCIPvarIsIntegral(), and TRUE.

    Referenced by SCIP_DECL_CONSCHECK().

    ◆ SCIP_DECL_CONSENFOLP()

    static SCIP_DECL_CONSENFOLP ( consEnfolpExactSol  )
    static

    constraint enforcing method of constraint handler for LP solutions

    Definition at line 339 of file cons_exactsol.c.

    References NULL, SCIP_FEASIBLE, SCIP_OKAY, and SCIPisExact().

    ◆ SCIP_DECL_CONSENFORELAX()

    static SCIP_DECL_CONSENFORELAX ( consEnforelaxExactSol  )
    static

    constraint enforcing method of constraint handler for LP solutions

    Definition at line 352 of file cons_exactsol.c.

    References NULL, SCIP_FEASIBLE, SCIP_OKAY, and SCIPisExact().

    ◆ SCIP_DECL_CONSENFOPS()

    static SCIP_DECL_CONSENFOPS ( consEnfopsExactSol  )
    static

    constraint enforcing method of constraint handler for pseudo solutions

    Definition at line 365 of file cons_exactsol.c.

    References NULL, SCIP_FEASIBLE, SCIP_OKAY, and SCIPisExact().

    ◆ SCIP_DECL_CONSCHECK()

    static SCIP_DECL_CONSCHECK ( consCheckExactSol  )
    static

    feasibility check method of constraint handler for integral solutions

    Definition at line 378 of file cons_exactsol.c.

    References bufferSolution(), checkProbHasContEqs(), clearSoluBuffer(), DEFAULT_SOLBUFSIZE, EPSISINT, FALSE, NULL, SCIP_Bool, SCIP_CALL, SCIP_FEASIBLE, SCIP_IMPLINTTYPE_WEAK, SCIP_INFEASIBLE, SCIP_LPSOLSTAT_OPTIMAL, SCIP_NODETYPE_FOCUSNODE, SCIP_OKAY, SCIP_R_ROUND_NEAREST, SCIP_Real, SCIP_SOLTYPE_HEUR, SCIP_STAGE_SOLVING, SCIP_VARSTATUS_COLUMN, SCIP_VARTYPE_CONTINUOUS, SCIPbuffer(), SCIPchgVarLbDive(), SCIPchgVarLbExactDive(), SCIPchgVarUbDive(), SCIPchgVarUbExactDive(), SCIPconsGetRow(), SCIPconshdlrGetData(), SCIPconstructLP(), SCIPcreateLPSolExact(), SCIPdebug, SCIPdebugMessage, SCIPendExactDive(), SCIPflushLP(), SCIPfreeSol(), SCIPgetConss(), SCIPgetCurrentNode(), SCIPgetLPExactSolstat(), SCIPgetNConss(), SCIPgetNContImplVars(), SCIPgetNContVars(), SCIPgetNVars(), SCIPgetRowSolActivity(), SCIPgetSolTransObj(), SCIPgetSolVal(), SCIPgetStage(), SCIPgetUpperbound(), SCIPgetVars(), SCIPhasCurrentNodeLP(), SCIPhashtableExists(), SCIPhashtableInsert(), SCIPheurGetName(), SCIPinDive(), SCIPinExactDive(), SCIPisExact(), SCIPisExactDivePossible(), SCIPisFeasGT(), SCIPisFeasLT(), SCIPisLPConstructed(), SCIPisLT(), SCIPnodeGetType(), SCIPoverwriteFPsol(), SCIPprintSol(), SCIPrationalCreateBuffer(), SCIPrationalFreeBuffer(), SCIPrationalIsLE(), SCIPrationalRoundInteger(), SCIPrationalSetReal(), SCIPreallocBlockMemoryArray, SCIPround(), SCIProwGetLhs(), SCIProwGetRhs(), SCIPsolGetHeur(), SCIPsolGetType(), SCIPsolIsExact(), SCIPsolSetHeur(), SCIPsolveExactDiveLP(), SCIPsortPtr(), SCIPstartExactDive(), SCIPtrySolFreeExact(), SCIPvarGetImplType(), SCIPvarGetLbGlobal(), SCIPvarGetLbGlobalExact(), SCIPvarGetLbLocalExact(), SCIPvarGetStatusExact(), SCIPvarGetType(), SCIPvarGetUbGlobal(), SCIPvarGetUbGlobalExact(), SCIPvarGetUbLocalExact(), SCIPvarIsIntegral(), SCIPwarningMessage(), solCreateSolAssignment(), solFreeAssignment(), and TRUE.

    ◆ SCIP_DECL_CONSLOCK()

    static SCIP_DECL_CONSLOCK ( consLockExactSol  )
    static

    variable rounding lock method of constraint handler

    Definition at line 730 of file cons_exactsol.c.

    References SCIP_OKAY.

    ◆ SCIP_DECL_CONSFREE()

    static SCIP_DECL_CONSFREE ( consFreeExactSol  )
    static

    destructor of constraint handler to free constraint handler data (called when SCIP is exiting)

    Definition at line 738 of file cons_exactsol.c.

    References NULL, SCIP_OKAY, SCIPconshdlrGetData(), SCIPconshdlrSetData(), and SCIPfreeBlockMemory.

    ◆ SCIP_DECL_CONSINIT()

    static SCIP_DECL_CONSINIT ( consInitExactSol  )
    static

    initialization method of constraint handler (called after problem was transformed)

    Definition at line 755 of file cons_exactsol.c.

    References DEFAULT_SOLBUFSIZE, NULL, SCIP_CALL, SCIP_OKAY, SCIPallocBlockMemoryArray, SCIPblkmem(), SCIPconshdlrGetData(), SCIPconshdlrSetNeedsCons(), SCIPhashtableCreate(), SCIPisExact(), and TRUE.

    ◆ SCIP_DECL_CONSEXIT()

    static SCIP_DECL_CONSEXIT ( consExitExactSol  )
    static

    deinitialization method of constraint handler (called before transformed problem is freed)

    Definition at line 792 of file cons_exactsol.c.

    References FALSE, NULL, SCIP_CALL, SCIP_OKAY, SCIPconshdlrGetData(), SCIPconshdlrNeedsCons(), SCIPconshdlrSetNeedsCons(), SCIPfreeBlockMemory, SCIPfreeBlockMemoryArray, SCIPfreeSol(), SCIPhashtableFree(), SCIPhashtableRemoveAll(), and SCIPisExact().

    ◆ SCIP_DECL_CONSHDLRCOPY()

    static SCIP_DECL_CONSHDLRCOPY ( conshdlrCopyExactSol  )
    static

    copy method for constraint handler plugins (called when SCIP copies plugins)

    Definition at line 836 of file cons_exactsol.c.

    References CONSHDLR_NAME, NULL, SCIP_CALL, SCIP_OKAY, SCIPconshdlrGetName(), SCIPincludeConshdlrExactSol(), and TRUE.