32 #define BRANCHRULE_NAME "random" 33 #define BRANCHRULE_DESC "random variable branching" 34 #define BRANCHRULE_PRIORITY -100000 35 #define BRANCHRULE_MAXDEPTH -1 36 #define BRANCHRULE_MAXBOUNDDIST 1.0 38 #define DEFAULT_INITSEED 41 41 struct SCIP_BranchruleData
67 assert(cands != NULL);
69 assert(bestcand != NULL);
70 assert(bestcandsol != NULL);
86 SCIPdebugMsg(scip,
"Warning: all branching candidates seem to be fixed\n");
103 bestcand, bestcandsol);
107 assert(idx >= 0 && idx < ncands);
109 *bestcand = cands[idx];
110 assert(*bestcand != NULL);
112 if( candssol != NULL )
113 *bestcandsol = candssol[idx];
124 assert(
scip != NULL);
125 assert(branchrule != NULL);
143 assert(branchruledata != NULL);
161 assert(branchruledata != NULL);
162 assert(branchruledata->initseed >= 0);
166 (
unsigned int)branchruledata->initseed) );
179 assert(branchruledata != NULL);
196 assert(branchrule != NULL);
198 assert(
scip != NULL);
199 assert(result != NULL);
204 assert(branchruledata != NULL);
208 assert(nlpcands > 0);
212 assert(bestcand >= 0);
214 SCIPdebugMsg(
scip,
" -> %d candidates, selected candidate %d: variable <%s>\n",
232 int nprioexterncands;
240 assert(branchrule != NULL);
242 assert(
scip != NULL);
243 assert(result != NULL);
248 assert(branchruledata != NULL);
255 assert(nprioexterncands > 0);
262 getRandomVariable(
scip, branchruledata, externcands, externcandssol, nprioexterncands, &bestcand, &bestcandsol);
264 if( bestcand == NULL )
266 SCIPerrorMessage(
"branchExecrelRandom failed to select a branching variable from %d candidates\n", nprioexterncands);
273 SCIPdebugMsg(
scip,
" -> %d candidates, selected variable <%s> with solution value %g, branching point=%g\n",
274 nprioexterncands,
SCIPvarGetName(bestcand), bestcandsol, brpoint);
278 if( downchild != NULL || eqchild != NULL || upchild != NULL )
301 assert(branchrule != NULL);
303 assert(
scip != NULL);
304 assert(result != NULL);
309 assert(branchruledata != NULL);
313 assert(npseudocands > 0);
317 assert(bestcand >= 0);
319 SCIPdebugMsg(
scip,
" -> %d candidates, selected candidate %d: variable <%s>\n",
349 assert(branchrule != NULL);
SCIP_RETCODE SCIPgetLPBranchCands(SCIP *scip, SCIP_VAR ***lpcands, SCIP_Real **lpcandssol, SCIP_Real **lpcandsfrac, int *nlpcands, int *npriolpcands, int *nfracimplvars)
void SCIPfreeRandom(SCIP *scip, SCIP_RANDNUMGEN **randnumgen)
static SCIP_DECL_BRANCHFREE(branchFreeRandom)
SCIP_BRANCHRULEDATA * SCIPbranchruleGetData(SCIP_BRANCHRULE *branchrule)
#define BRANCHRULE_MAXDEPTH
SCIP_RETCODE SCIPsetBranchruleExecPs(SCIP *scip, SCIP_BRANCHRULE *branchrule, SCIP_DECL_BRANCHEXECPS((*branchexecps)))
SCIP_RETCODE SCIPcreateRandom(SCIP *scip, SCIP_RANDNUMGEN **randnumgen, unsigned int initialseed)
SCIP_VAR ** SCIPvarGetMultaggrVars(SCIP_VAR *var)
SCIP_Real SCIPvarGetLbLocal(SCIP_VAR *var)
struct SCIP_BranchruleData SCIP_BRANCHRULEDATA
static SCIP_DECL_BRANCHEXECEXT(branchExecextRandom)
random variable branching rule
SCIP_Real SCIPgetBranchingPoint(SCIP *scip, SCIP_VAR *var, SCIP_Real suggestion)
SCIP_RETCODE SCIPsetBranchruleExit(SCIP *scip, SCIP_BRANCHRULE *branchrule, SCIP_DECL_BRANCHEXIT((*branchexit)))
static SCIP_DECL_BRANCHEXECLP(branchExeclpRandom)
SCIP_RETCODE SCIPsetBranchruleFree(SCIP *scip, SCIP_BRANCHRULE *branchrule, SCIP_DECL_BRANCHFREE((*branchfree)))
static SCIP_DECL_BRANCHINIT(branchInitRandom)
SCIP_RETCODE SCIPsetBranchruleCopy(SCIP *scip, SCIP_BRANCHRULE *branchrule, SCIP_DECL_BRANCHCOPY((*branchcopy)))
enum SCIP_Retcode SCIP_RETCODE
static SCIP_DECL_BRANCHEXECPS(branchExecpsRandom)
#define SCIPfreeBlockMemory(scip, ptr)
#define BRANCHRULE_MAXBOUNDDIST
int SCIPrandomGetInt(SCIP_RANDNUMGEN *randnumgen, int minrandval, int maxrandval)
SCIP_RETCODE SCIPincludeBranchruleBasic(SCIP *scip, SCIP_BRANCHRULE **branchruleptr, const char *name, const char *desc, int priority, int maxdepth, SCIP_Real maxbounddist, SCIP_BRANCHRULEDATA *branchruledata)
SCIP_Bool SCIPisEQ(SCIP *scip, SCIP_Real val1, SCIP_Real val2)
SCIP_RETCODE SCIPgetExternBranchCands(SCIP *scip, SCIP_VAR ***externcands, SCIP_Real **externcandssol, SCIP_Real **externcandsscore, int *nexterncands, int *nprioexterncands, int *nprioexternbins, int *nprioexternints, int *nprioexternimpls)
#define SCIPallocBlockMemory(scip, ptr)
SCIP_RETCODE SCIPaddIntParam(SCIP *scip, const char *name, const char *desc, int *valueptr, SCIP_Bool isadvanced, int defaultvalue, int minvalue, int maxvalue, SCIP_DECL_PARAMCHGD((*paramchgd)), SCIP_PARAMDATA *paramdata)
SCIP_RETCODE SCIPsetBranchruleExecLp(SCIP *scip, SCIP_BRANCHRULE *branchrule, SCIP_DECL_BRANCHEXECLP((*branchexeclp)))
SCIP_VAR * SCIPvarGetProbvar(SCIP_VAR *var)
static SCIP_DECL_BRANCHEXIT(branchExitRandom)
SCIP_RETCODE SCIPbranchVar(SCIP *scip, SCIP_VAR *var, SCIP_NODE **downchild, SCIP_NODE **eqchild, SCIP_NODE **upchild)
#define BRANCHRULE_PRIORITY
SCIP_RETCODE SCIPincludeBranchruleRandom(SCIP *scip)
const char * SCIPvarGetName(SCIP_VAR *var)
SCIP_RETCODE SCIPbranchVarVal(SCIP *scip, SCIP_VAR *var, SCIP_Real val, SCIP_NODE **downchild, SCIP_NODE **eqchild, SCIP_NODE **upchild)
SCIP_RETCODE SCIPgetPseudoBranchCands(SCIP *scip, SCIP_VAR ***pseudocands, int *npseudocands, int *npriopseudocands)
public data structures and miscellaneous methods
int SCIPgetDepth(SCIP *scip)
void SCIPbranchruleSetData(SCIP_BRANCHRULE *branchrule, SCIP_BRANCHRULEDATA *branchruledata)
SCIP_RETCODE SCIPsetBranchruleExecExt(SCIP *scip, SCIP_BRANCHRULE *branchrule, SCIP_DECL_BRANCHEXECEXT((*branchexecext)))
int SCIPvarGetMultaggrNVars(SCIP_VAR *var)
static void getRandomVariable(SCIP *scip, SCIP_BRANCHRULEDATA *branchruledata, SCIP_VAR **cands, SCIP_Real *candssol, int ncands, SCIP_VAR **bestcand, SCIP_Real *bestcandsol)
SCIP_VARSTATUS SCIPvarGetStatus(SCIP_VAR *var)
const char * SCIPbranchruleGetName(SCIP_BRANCHRULE *branchrule)
SCIP_RETCODE SCIPsetBranchruleInit(SCIP *scip, SCIP_BRANCHRULE *branchrule, SCIP_DECL_BRANCHINIT((*branchinit)))
static SCIP_DECL_BRANCHCOPY(branchCopyRandom)
SCIP_Real SCIPvarGetUbLocal(SCIP_VAR *var)
SCIP_Bool SCIPvarIsActive(SCIP_VAR *var)