54 #define BRANCHRULE_NAME "sdpmostfrac"
55 #define BRANCHRULE_DESC "branch on the most fractional variable of the SDP"
56 #define BRANCHRULE_PRIORITY 500000
57 #define BRANCHRULE_MAXDEPTH -1
58 #define BRANCHRULE_MAXBOUNDDIST 1.0
81 assert(branchrule != NULL);
82 assert(strcmp(SCIPbranchruleGetName(branchrule),
BRANCHRULE_NAME) == 0);
96 SCIP_VAR** cands = NULL;
98 SCIP_Real* candsscore;
99 SCIP_Real mostfracfrac;
100 SCIP_Real mostfracscore;
101 SCIP_Real mostfracobj;
102 SCIP_Real mostfracval;
103 SCIP_VAR* mostfracvar = NULL;
106 assert( scip != NULL );
107 assert( result != NULL );
109 SCIPdebugMessage(
"Executing External Branching method of SDP-mostfrac!\n");
113 SCIP_CALL( SCIPgetExternBranchCands(scip, &cands, &candssol, &candsscore, &ncands, NULL, NULL, NULL, NULL) );
115 assert( ncands > 0 );
118 SCIPdebugMessage(
"branching candidates for SDP-mostfrac:\n");
119 for (i = 0; i < ncands; i++)
120 SCIPdebugMessage(
"%s, value = %f, score = %f\n", SCIPvarGetName(cands[i]), candssol[i], candsscore[i]);
129 for (i = 0; i < ncands; i++)
132 if ( SCIPvarGetType(cands[i]) == SCIP_VARTYPE_CONTINUOUS )
134 SCIPdebugMessage(
"skipping continuous variable %s\n", SCIPvarGetName(cands[i]));
143 if ( SCIPisFeasGT(scip, SCIPfeasFrac(scip, candssol[i]), mostfracfrac) ||
144 (SCIPisFeasEQ(scip, SCIPfeasFrac(scip, candssol[i]), mostfracfrac) && SCIPisGT(scip, candsscore[i], mostfracscore)) ||
145 (SCIPisFeasEQ(scip, SCIPfeasFrac(scip, candssol[i]), mostfracfrac) && SCIPisEQ(scip, candsscore[i], mostfracscore)
146 && SCIPisGT(scip, SCIPvarGetObj(cands[i]), mostfracobj)) ||
147 (SCIPisFeasEQ(scip, SCIPfeasFrac(scip, candssol[i]), mostfracfrac) && SCIPisEQ(scip, candsscore[i], mostfracscore)
148 && SCIPisEQ(scip, SCIPvarGetObj(cands[i]), mostfracobj) && SCIPvarGetIndex(cands[i]) < SCIPvarGetIndex(mostfracvar)) )
151 mostfracfrac = SCIPfeasFrac(scip, candssol[i]);
152 mostfracscore = candsscore[i];
153 mostfracobj = REALABS(SCIPvarGetObj(cands[i]));
154 mostfracval = candssol[i];
155 mostfracvar = cands[i];
160 if ( mostfracfrac == -1.0 )
162 SCIPdebugMessage(
"Skipping SDP-mostfrac branching rule since all branching variables are continuous\n");
163 *result = SCIP_DIDNOTFIND;
167 assert( mostfracvar != NULL );
168 assert( SCIPisFeasGT(scip, mostfracfrac, 0.0) );
171 SCIPdebugMessage(
"branching on variable %s with value %f and score %f\n", SCIPvarGetName(mostfracvar), mostfracval, mostfracscore);
172 SCIP_CALL( SCIPbranchVarVal(scip, mostfracvar, mostfracval, NULL, NULL, NULL) );
174 *result = SCIP_BRANCHED;
188 SCIP_BRANCHRULEDATA* branchruledata;
189 SCIP_BRANCHRULE* branchrule;
192 branchruledata = NULL;
200 assert(branchrule != NULL);
203 SCIP_CALL( SCIPsetBranchruleCopy(scip, branchrule, branchCopySdpmostfrac) );
204 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)