52 #define BRANCHRULE_NAME "sdpmostfrac"
53 #define BRANCHRULE_DESC "branch on the most fractional variable of the SDP"
54 #define BRANCHRULE_PRIORITY 500000
55 #define BRANCHRULE_MAXDEPTH -1
56 #define BRANCHRULE_MAXBOUNDDIST 1.0
79 assert(branchrule != NULL);
80 assert(strcmp(SCIPbranchruleGetName(branchrule),
BRANCHRULE_NAME) == 0);
94 SCIP_VAR** cands = NULL;
96 SCIP_Real* candsscore;
97 SCIP_Real mostfracfrac;
98 SCIP_Real mostfracscore;
99 SCIP_Real mostfracobj;
100 SCIP_Real mostfracval;
101 SCIP_VAR* mostfracvar = NULL;
104 assert( scip != NULL );
105 assert( result != NULL );
107 SCIPdebugMessage(
"Executing External Branching method of SDP-mostfrac!\n");
111 SCIP_CALL( SCIPgetExternBranchCands(scip, &cands, &candssol, &candsscore, &ncands, NULL, NULL, NULL, NULL) );
113 assert( ncands > 0 );
116 SCIPdebugMessage(
"branching candidates for SDP-mostfrac:\n");
117 for (i = 0; i < ncands; i++)
118 SCIPdebugMessage(
"%s, value = %f, score = %f\n", SCIPvarGetName(cands[i]), candssol[i], candsscore[i]);
127 for (i = 0; i < ncands; i++)
134 if ( SCIPisFeasGT(scip, SCIPfeasFrac(scip, candssol[i]), mostfracfrac) ||
135 (SCIPisFeasEQ(scip, SCIPfeasFrac(scip, candssol[i]), mostfracfrac) && SCIPisGT(scip, candsscore[i], mostfracscore)) ||
136 (SCIPisFeasEQ(scip, SCIPfeasFrac(scip, candssol[i]), mostfracfrac) && SCIPisEQ(scip, candsscore[i], mostfracscore)
137 && SCIPisGT(scip, SCIPvarGetObj(cands[i]), mostfracobj)) ||
138 (SCIPisFeasEQ(scip, SCIPfeasFrac(scip, candssol[i]), mostfracfrac) && SCIPisEQ(scip, candsscore[i], mostfracscore)
139 && SCIPisEQ(scip, SCIPvarGetObj(cands[i]), mostfracobj) && SCIPvarGetIndex(cands[i]) < SCIPvarGetIndex(mostfracvar)) )
142 mostfracfrac = SCIPfeasFrac(scip, candssol[i]);
143 mostfracscore = candsscore[i];
144 mostfracobj = REALABS(SCIPvarGetObj(cands[i]));
145 mostfracval = candssol[i];
146 mostfracvar = cands[i];
150 assert( mostfracvar != NULL );
151 assert( SCIPisFeasGT(scip, mostfracfrac, 0.0) );
154 SCIPdebugMessage(
"branching on variable %s with value %f and score %f\n", SCIPvarGetName(mostfracvar), mostfracval, mostfracscore);
155 SCIP_CALL( SCIPbranchVarVal(scip, mostfracvar, mostfracval, NULL, NULL, NULL) );
157 *result = SCIP_BRANCHED;
171 SCIP_BRANCHRULEDATA* branchruledata;
172 SCIP_BRANCHRULE* branchrule;
175 branchruledata = NULL;
183 assert(branchrule != NULL);
186 SCIP_CALL( SCIPsetBranchruleCopy(scip, branchrule, branchCopySdpmostfrac) );
187 SCIP_CALL( SCIPsetBranchruleExecExt(scip, branchrule, branchExecextSdpmostfrac) );
#define BRANCHRULE_MAXBOUNDDIST
most fractional branching rule for SCIP-SDP
SCIP_RETCODE SCIPincludeBranchruleSdpmostfrac(SCIP *scip)
#define BRANCHRULE_PRIORITY
#define BRANCHRULE_MAXDEPTH
static SCIP_DECL_BRANCHCOPY(branchCopySdpmostfrac)
static SCIP_DECL_BRANCHEXECEXT(branchExecextSdpmostfrac)