repair primal heuristic
Definition in file heur_repair.c.
#include <assert.h>
#include <string.h>
#include "scip/heur_repair.h"
#include "scip/cons_linear.h"
#include "scip/scipdefplugins.h"
#include "scip/cons_varbound.h"
Go to the source code of this file.
Macros | |
#define | HEUR_NAME "repair" |
#define | HEUR_DESC "tries to repair a primal infeasible solution" |
#define | HEUR_DISPCHAR '!' |
#define | HEUR_PRIORITY 0 |
#define | HEUR_FREQ -1 |
#define | HEUR_FREQOFS 0 |
#define | HEUR_MAXDEPTH -1 |
#define | HEUR_TIMING SCIP_HEURTIMING_AFTERNODE |
#define | HEUR_USESSUBSCIP TRUE |
#define | DEFAULT_MINFIXINGRATE 0.3 /* minimum percentage of integer variables that have to be fixed */ |
#define | DEFAULT_NODESOFS 500 /* number of nodes added to the contingent of the total nodes */ |
#define | DEFAULT_MAXNODES 5000 /* maximum number of nodes to regard in the subproblem */ |
#define | DEFAULT_MINNODES 50 /* minimum number of nodes to regard in the subproblem */ |
#define | DEFAULT_NODESQUOT 0.1 /* subproblem nodes in relation to nodes of the original problem */ |
#define | DEFAULT_FILENAME "-" |
#define | DEFAULT_ROUNDIT TRUE |
#define | DEFAULT_USEOBJFACTOR FALSE |
#define | DEFAULT_USEVARFIX TRUE |
#define | DEFAULT_USESLACKVARS FALSE |
#define | DEFAULT_ALPHA 2.0 |
#define HEUR_NAME "repair" |
Definition at line 39 of file heur_repair.c.
#define HEUR_DESC "tries to repair a primal infeasible solution" |
Definition at line 40 of file heur_repair.c.
#define HEUR_DISPCHAR '!' |
Definition at line 41 of file heur_repair.c.
#define HEUR_PRIORITY 0 |
Definition at line 42 of file heur_repair.c.
#define HEUR_FREQ -1 |
Definition at line 43 of file heur_repair.c.
#define HEUR_FREQOFS 0 |
Definition at line 44 of file heur_repair.c.
#define HEUR_MAXDEPTH -1 |
Definition at line 45 of file heur_repair.c.
#define HEUR_TIMING SCIP_HEURTIMING_AFTERNODE |
Definition at line 46 of file heur_repair.c.
#define HEUR_USESSUBSCIP TRUE |
does the heuristic use a secondary SCIP instance?
Definition at line 47 of file heur_repair.c.
#define DEFAULT_MINFIXINGRATE 0.3 /* minimum percentage of integer variables that have to be fixed */ |
Definition at line 48 of file heur_repair.c.
#define DEFAULT_NODESOFS 500 /* number of nodes added to the contingent of the total nodes */ |
Definition at line 50 of file heur_repair.c.
#define DEFAULT_MAXNODES 5000 /* maximum number of nodes to regard in the subproblem */ |
Definition at line 51 of file heur_repair.c.
#define DEFAULT_MINNODES 50 /* minimum number of nodes to regard in the subproblem */ |
Definition at line 52 of file heur_repair.c.
#define DEFAULT_NODESQUOT 0.1 /* subproblem nodes in relation to nodes of the original problem */ |
Definition at line 53 of file heur_repair.c.
#define DEFAULT_FILENAME "-" |
file name of a solution to be used as infeasible starting point
Definition at line 55 of file heur_repair.c.
#define DEFAULT_ROUNDIT TRUE |
if it is TRUE : fractional variables which are not fractional in the given solution are rounded, if it is FALSE : solving process of this heuristic is stopped
Definition at line 56 of file heur_repair.c.
#define DEFAULT_USEOBJFACTOR FALSE |
should a scaled objective function for original variables be used in repair subproblem?
Definition at line 63 of file heur_repair.c.
#define DEFAULT_USEVARFIX TRUE |
should variable fixings be used in repair subproblem?
Definition at line 68 of file heur_repair.c.
#define DEFAULT_USESLACKVARS FALSE |
should slack variables be used in repair subproblem?
Definition at line 69 of file heur_repair.c.
#define DEFAULT_ALPHA 2.0 |
how many times the potential should be bigger than the slack?
Definition at line 70 of file heur_repair.c.
|
static |
computes a factor, so that (factor) * (original objective upper bound) <= 1.
scip | SCIP data structure |
subscip | SCIP data structure |
factor | SCIP_Real to save the factor for the old objective function |
success | SCIP_Bool: Is the factor real? |
Definition at line 125 of file heur_repair.c.
References getPotentialContributed(), SCIP_CALL, SCIP_OKAY, SCIP_Real, SCIPaddOrigObjoffset(), SCIPgetLowerbound(), SCIPgetUpperbound(), SCIPgetVarsData(), SCIPinfinity(), SCIPisGT(), SCIPisInfinity(), SCIPisZero(), SCIPvarGetLbGlobal(), SCIPvarGetObj(), SCIPvarGetUbGlobal(), and TRUE.
Referenced by applyRepair().
|
static |
returns the contributed potential for a variable
scip | SCIP data structure |
sol | infeasible solution |
var | variable, which potential should be returned |
coefficient | variables coefficient in corresponding row |
sgn | sign of the slack |
Definition at line 201 of file heur_repair.c.
References SCIP_Real, SCIPgetSolVal(), SCIPinfinity(), SCIPisInfinity(), SCIPisZero(), SCIPvarGetLbGlobal(), SCIPvarGetUbGlobal(), and tryFixVar().
Referenced by applyRepair(), getObjectiveFactor(), and tryFixVar().
|
static |
finds out if a variable can be fixed with respect to the potentials of all rows, if it is possible, the potentials of rows are adapted and TRUE is returned.
scip | SCIP data structure |
subscip | sub-SCIP data structure |
sol | solution data structure |
potential | array with all potential values |
slack | array with all slack values |
var | variable to be fixed? |
subvar | representative variable for var in the sub-SCIP |
inftycounter | counters how many variables have an infinity potential in a row |
heurdata | repairs heuristic data |
infeasible | pointer to store whether the fixing is infeasible |
fixed | pointer to store whether the fixing was performed (variable was unfixed) |
Definition at line 248 of file heur_repair.c.
References checkCands(), FALSE, getPotentialContributed(), REALABS, SCIP_Bool, SCIP_CALL, SCIP_OKAY, SCIP_Real, SCIPcolGetNLPNonz(), SCIPcolGetRows(), SCIPcolGetVals(), SCIPdebugMsg, SCIPfixVar(), SCIPgetSolVal(), SCIPisFeasGT(), SCIPisFeasLT(), SCIPisFeasZero(), SCIPisInfinity(), SCIProwGetLPPos(), SCIPvarGetCol(), SCIPvarGetLbGlobal(), SCIPvarGetName(), SCIPvarGetUbGlobal(), and TRUE.
Referenced by applyRepair(), and getPotentialContributed().
|
static |
checks if all integral variables in the given solution are integral.
scip | SCIP data structure |
sol | solution pointer to the to be checked solution |
roundit | round fractional solution values of integer variables |
success | pointer to store if all integral variables are integral or could be rounded |
Definition at line 381 of file heur_repair.c.
References createNewSol(), FALSE, REALABS, SCIP_CALL, SCIP_OKAY, SCIP_Real, SCIPceil(), SCIPdebugMsg, SCIPfloor(), SCIPgetSolVal(), SCIPgetVarsData(), SCIPisFeasIntegral(), SCIPisInfinity(), SCIPsetSolVal(), SCIPvarGetNLocksDown(), SCIPvarGetNLocksUp(), and TRUE.
Referenced by tryFixVar().
|
static |
creates a new solution for the original problem by copying the solution of the subproblem
scip | original SCIP data structure |
subscip | SCIP structure of the subproblem |
subvars | the variables of the subproblem |
heur | Repair heuristic structure |
subsol | solution of the subproblem |
success | used to store whether new solution was found or not |
Definition at line 462 of file heur_repair.c.
References applyRepair(), FALSE, nnodes, SCIP_CALL, SCIP_Longint, SCIP_OKAY, SCIP_Real, SCIPallocBufferArray, SCIPcreateSol(), SCIPfreeBufferArray, SCIPgetNOrigVars(), SCIPgetSolOrigObj(), SCIPgetSolVals(), SCIPgetVarsData(), SCIPheurGetData(), SCIPsetSolVals(), SCIPtrySolFree(), and TRUE.
Referenced by applyRepair(), and checkCands().
|
static |
tries to fix variables as an approach to repair a solution.
scip | SCIP data structure of the problem |
heur | pointer to this heuristic instance |
result | pointer to return the result status |
nnodes | nodelimit for sub-SCIP |
Definition at line 519 of file heur_repair.c.
References createNewSol(), FALSE, getObjectiveFactor(), getPotentialContributed(), MAX, nnodes, REALABS, SCIP_Bool, SCIP_CALL, SCIP_DECL_HEURFREE(), SCIP_FOUNDSOL, SCIP_MAXSTRLEN, SCIP_OKAY, SCIP_Real, SCIP_STAGE_SOLVED, SCIP_VARTYPE_BINARY, SCIP_VARTYPE_CONTINUOUS, SCIP_VARTYPE_INTEGER, SCIP_VERBLEVEL_FULL, SCIP_VERBLEVEL_NONE, SCIPABORT, SCIPaddCoefLinear(), SCIPaddCons(), SCIPaddSolFree(), SCIPaddVar(), SCIPallocBufferArray, SCIPchgVarLbGlobal(), SCIPchgVarType(), SCIPchgVarUbGlobal(), SCIPcolGetVar(), SCIPcopyParamSettings(), SCIPcreate(), SCIPcreateConsBasicLinear(), SCIPcreateConsBasicVarbound(), SCIPcreateProb(), SCIPcreateSol(), SCIPcreateVarBasic(), SCIPdebug, SCIPdebugMsg, SCIPfindBranchrule(), SCIPfree(), SCIPfreeBufferArray, SCIPfreeBufferArrayNull, SCIPfreeSol(), SCIPgetBestSol(), SCIPgetLPRows(), SCIPgetMemExternEstim(), SCIPgetMemUsed(), SCIPgetNLPIterations(), SCIPgetNLPRows(), SCIPgetNRuns(), SCIPgetNSols(), SCIPgetNTotalNodes(), SCIPgetPresolvingTime(), SCIPgetProbName(), SCIPgetRealParam(), SCIPgetRowSolActivity(), SCIPgetSolOrigObj(), SCIPgetSolVal(), SCIPgetSolvingTime(), SCIPgetStage(), SCIPgetVarsData(), SCIPheurGetData(), SCIPincludeDefaultPlugins(), SCIPisFeasEQ(), SCIPisFeasGT(), SCIPisFeasLE(), SCIPisFeasLT(), SCIPisFeasZero(), SCIPisInfinity(), SCIPisParamFixed(), SCIPisZero(), SCIPprintStatistics(), SCIPreleaseCons(), SCIPreleaseVar(), SCIProwGetCols(), SCIProwGetConstant(), SCIProwGetLhs(), SCIProwGetName(), SCIProwGetNNonz(), SCIProwGetRhs(), SCIProwGetVals(), SCIPsetIntParam(), SCIPsetLongintParam(), SCIPsetObjlimit(), SCIPsetRealParam(), SCIPsetSolVal(), SCIPsetSubscipsOff(), SCIPsnprintf(), SCIPsolve(), SCIPsortIntInt(), SCIPvarGetLbGlobal(), SCIPvarGetName(), SCIPvarGetObj(), SCIPvarGetProbindex(), SCIPvarGetType(), SCIPvarGetUbGlobal(), SCIPwarningMessage(), TRUE, and tryFixVar().
Referenced by createNewSol().
|
static |
destructor of primal heuristic to free user data (called when SCIP is exiting)
Definition at line 1029 of file heur_repair.c.
Referenced by applyRepair().
|
static |
initialization method of primal heuristic (called after problem was transformed)
Definition at line 1046 of file heur_repair.c.
|
static |
deinitialization method of primal heuristic (called before transformed problem is freed)
Definition at line 1083 of file heur_repair.c.
|
static |
execution method of primal heuristic. Repair needs an incorrect solution, in which all variables are in their bound.
Definition at line 1159 of file heur_repair.c.