Scippy

SCIP

Solving Constraint Integer Programs

heur_mutation.c File Reference

Detailed Description

LNS heuristic that tries to randomly mutate the incumbent solution.

Author
Timo Berthold

Definition in file heur_mutation.c.

#include <assert.h>
#include <string.h>
#include "scip/scip.h"
#include "scip/scipdefplugins.h"
#include "scip/cons_linear.h"
#include "scip/heur_mutation.h"
#include "scip/pub_misc.h"

Go to the source code of this file.

Macros

#define HEUR_NAME   "mutation"
 
#define HEUR_DESC   "mutation heuristic randomly fixing variables"
 
#define HEUR_DISPCHAR   'M'
 
#define HEUR_PRIORITY   -1103000
 
#define HEUR_FREQ   -1
 
#define HEUR_FREQOFS   8
 
#define HEUR_MAXDEPTH   -1
 
#define HEUR_TIMING   SCIP_HEURTIMING_AFTERNODE
 
#define HEUR_USESSUBSCIP   TRUE
 
#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_MINIMPROVE   0.01 /* factor by which Mutation should at least improve the incumbent */
 
#define DEFAULT_MINNODES   500 /* minimum number of nodes to regard in the subproblem */
 
#define DEFAULT_MINFIXINGRATE   0.8 /* minimum percentage of integer variables that have to be fixed */
 
#define DEFAULT_NODESQUOT   0.1 /* subproblem nodes in relation to nodes of the original problem */
 
#define DEFAULT_NWAITINGNODES   200 /* number of nodes without incumbent change that heuristic should wait */
 
#define DEFAULT_USELPROWS
 
#define DEFAULT_COPYCUTS
 

Functions

static SCIP_RETCODE createSubproblem (SCIP *scip, SCIP *subscip, SCIP_VAR **subvars, SCIP_Real minfixingrate, unsigned int *randseed, SCIP_Bool uselprows, SCIP_Bool *success)
 
static SCIP_RETCODE createNewSol (SCIP *scip, SCIP *subscip, SCIP_VAR **subvars, SCIP_HEUR *heur, SCIP_SOL *subsol, SCIP_Bool *success)
 
static SCIP_DECL_HEURCOPY (heurCopyMutation)
 
static SCIP_DECL_HEURFREE (heurFreeMutation)
 
static SCIP_DECL_HEURINIT (heurInitMutation)
 
static SCIP_DECL_HEUREXEC (heurExecMutation)
 
SCIP_RETCODE SCIPincludeHeurMutation (SCIP *scip)
 

Macro Definition Documentation

#define HEUR_NAME   "mutation"

Definition at line 31 of file heur_mutation.c.

Referenced by SCIP_DECL_HEURCOPY(), and SCIPincludeHeurMutation().

#define HEUR_DESC   "mutation heuristic randomly fixing variables"

Definition at line 32 of file heur_mutation.c.

Referenced by SCIPincludeHeurMutation().

#define HEUR_DISPCHAR   'M'

Definition at line 33 of file heur_mutation.c.

Referenced by SCIPincludeHeurMutation().

#define HEUR_PRIORITY   -1103000

Definition at line 34 of file heur_mutation.c.

Referenced by SCIPincludeHeurMutation().

#define HEUR_FREQ   -1

Definition at line 35 of file heur_mutation.c.

Referenced by SCIPincludeHeurMutation().

#define HEUR_FREQOFS   8

Definition at line 36 of file heur_mutation.c.

Referenced by SCIPincludeHeurMutation().

#define HEUR_MAXDEPTH   -1

Definition at line 37 of file heur_mutation.c.

Referenced by SCIPincludeHeurMutation().

#define HEUR_TIMING   SCIP_HEURTIMING_AFTERNODE

Definition at line 38 of file heur_mutation.c.

Referenced by SCIPincludeHeurMutation().

#define HEUR_USESSUBSCIP   TRUE

does the heuristic use a secondary SCIP instance?

Definition at line 39 of file heur_mutation.c.

Referenced by SCIPincludeHeurMutation().

#define DEFAULT_NODESOFS   500 /* number of nodes added to the contingent of the total nodes */

Definition at line 41 of file heur_mutation.c.

Referenced by SCIPincludeHeurMutation().

#define DEFAULT_MAXNODES   5000 /* maximum number of nodes to regard in the subproblem */

Definition at line 42 of file heur_mutation.c.

Referenced by SCIPincludeHeurMutation().

#define DEFAULT_MINIMPROVE   0.01 /* factor by which Mutation should at least improve the incumbent */

Definition at line 43 of file heur_mutation.c.

Referenced by SCIPincludeHeurMutation().

#define DEFAULT_MINNODES   500 /* minimum number of nodes to regard in the subproblem */

Definition at line 44 of file heur_mutation.c.

Referenced by SCIPincludeHeurMutation().

#define DEFAULT_MINFIXINGRATE   0.8 /* minimum percentage of integer variables that have to be fixed */

Definition at line 45 of file heur_mutation.c.

Referenced by SCIPincludeHeurMutation().

#define DEFAULT_NODESQUOT   0.1 /* subproblem nodes in relation to nodes of the original problem */

Definition at line 46 of file heur_mutation.c.

Referenced by SCIPincludeHeurMutation().

#define DEFAULT_NWAITINGNODES   200 /* number of nodes without incumbent change that heuristic should wait */

Definition at line 47 of file heur_mutation.c.

Referenced by SCIPincludeHeurMutation().

#define DEFAULT_USELPROWS
Value:
FALSE /* should subproblem be created out of the rows in the LP rows,
* otherwise, the copy constructors of the constraints handlers are used */
#define FALSE
Definition: def.h:56

Definition at line 48 of file heur_mutation.c.

Referenced by SCIPincludeHeurMutation().

#define DEFAULT_COPYCUTS
Value:
TRUE /* if DEFAULT_USELPROWS is FALSE, then should all active cuts from the
* cutpool of the original scip be copied to constraints of the subscip */
#define TRUE
Definition: def.h:55

Definition at line 50 of file heur_mutation.c.

Referenced by SCIPincludeHeurMutation().

Function Documentation

static SCIP_RETCODE createSubproblem ( SCIP scip,
SCIP subscip,
SCIP_VAR **  subvars,
SCIP_Real  minfixingrate,
unsigned int *  randseed,
SCIP_Bool  uselprows,
SCIP_Bool success 
)
static

creates a subproblem for subscip by fixing a number of variables

Parameters
sciporiginal SCIP data structure
subscipSCIP data structure for the subproblem
subvarsthe variables of the subproblem
minfixingratepercentage of integer variables that have to be fixed
randseeda seed value for the random number generator
uselprowsshould subproblem be created out of the rows in the LP rows?
successused to store whether the creation of the subproblem worked

Definition at line 83 of file heur_mutation.c.

References BMSclearMemoryArray, FALSE, NULL, SCIP_Bool, SCIP_CALL, SCIP_OKAY, SCIP_Real, SCIPaddCons(), SCIPallocBufferArray, SCIPceil(), SCIPchgVarLbGlobal(), SCIPchgVarUbGlobal(), SCIPcolGetVar(), SCIPcreateConsLinear(), SCIPfloor(), SCIPfreeBufferArray, SCIPgetBestSol(), SCIPgetLPRowsData(), SCIPgetRandomInt(), SCIPgetSolVal(), SCIPgetVarsData(), SCIPisGT(), SCIPisInfinity(), SCIPisLE(), SCIPisLT(), SCIPreleaseCons(), SCIProwGetCols(), SCIProwGetConstant(), SCIProwGetLhs(), SCIProwGetName(), SCIProwGetNNonz(), SCIProwGetRhs(), SCIProwGetVals(), SCIProwIsLocal(), SCIPvarGetLbGlobal(), SCIPvarGetProbindex(), SCIPvarGetUbGlobal(), and TRUE.

Referenced by SCIP_DECL_HEUREXEC().

static SCIP_RETCODE createNewSol ( SCIP scip,
SCIP subscip,
SCIP_VAR **  subvars,
SCIP_HEUR heur,
SCIP_SOL subsol,
SCIP_Bool success 
)
static

creates a new solution for the original problem by copying the solution of the subproblem

Parameters
sciporiginal SCIP data structure
subscipSCIP structure of the subproblem
subvarsthe variables of the subproblem
heurmutation heuristic structure
subsolsolution of the subproblem
successused to store whether new solution was found or not

Definition at line 246 of file heur_mutation.c.

References FALSE, NULL, SCIP_CALL, SCIP_OKAY, SCIP_Real, SCIPallocBufferArray, SCIPcreateSol(), SCIPfreeBufferArray, SCIPgetNOrigVars(), SCIPgetSolVals(), SCIPgetVarsData(), SCIPsetSolVals(), SCIPtrySolFree(), and TRUE.

Referenced by SCIP_DECL_HEUREXEC().

static SCIP_DECL_HEURCOPY ( heurCopyMutation  )
static

copy method for primal heuristic plugins (called when SCIP copies plugins)

Definition at line 296 of file heur_mutation.c.

References HEUR_NAME, NULL, SCIP_CALL, SCIP_OKAY, SCIPheurGetName(), and SCIPincludeHeurMutation().

static SCIP_DECL_HEURFREE ( heurFreeMutation  )
static

destructor of primal heuristic to free user data (called when SCIP is exiting)

Definition at line 310 of file heur_mutation.c.

References NULL, SCIP_OKAY, SCIPfreeMemory, SCIPheurGetData(), and SCIPheurSetData().

static SCIP_DECL_HEURINIT ( heurInitMutation  )
static

initialization method of primal heuristic (called after problem was transformed)

Definition at line 330 of file heur_mutation.c.

References NULL, SCIP_OKAY, and SCIPheurGetData().