48 #define BRANCHRULE_NAME "sdpmostfrac"
49 #define BRANCHRULE_DESC "branch on the most fractional variable of the SDP"
50 #define BRANCHRULE_PRIORITY 500000
51 #define BRANCHRULE_MAXDEPTH -1
52 #define BRANCHRULE_MAXBOUNDDIST 1.0
75 assert(branchrule != NULL);
76 assert(strcmp(SCIPbranchruleGetName(branchrule),
BRANCHRULE_NAME) == 0);
90 SCIP_VAR** cands = NULL;
92 SCIP_Real* candsscore;
93 SCIP_Real mostfracfrac;
94 SCIP_Real mostfracscore;
95 SCIP_Real mostfracobj;
96 SCIP_Real mostfracval;
97 SCIP_VAR* mostfracvar = NULL;
100 assert( scip != NULL );
101 assert( result != NULL );
103 SCIPdebugMessage(
"Executing External Branching method of SDP-mostfrac!\n");
107 SCIP_CALL( SCIPgetExternBranchCands(scip, &cands, &candssol, &candsscore, &ncands, NULL, NULL, NULL, NULL) );
109 assert( ncands > 0 );
112 printf(
"branching candidates for SDP-mostfrac:\n");
113 for (i = 0; i < ncands; i++)
114 printf(
"%s, value = %f, score = %f\n", SCIPvarGetName(cands[i]), candssol[i], candsscore[i]);
123 for (i = 0; i < ncands; i++)
129 if ( SCIPisFeasGT(scip, SCIPfeasFrac(scip, candssol[i]), mostfracfrac) ||
130 (SCIPisFeasEQ(scip, SCIPfeasFrac(scip, candssol[i]), mostfracfrac) && SCIPisGT(scip, candsscore[i], mostfracscore)) ||
131 (SCIPisFeasEQ(scip, SCIPfeasFrac(scip, candssol[i]), mostfracfrac) && SCIPisEQ(scip, candsscore[i], mostfracscore)
132 && REALABS(SCIPvarGetObj(cands[i])) > mostfracobj) )
135 mostfracfrac = SCIPfeasFrac(scip, candssol[i]);
136 mostfracscore = candsscore[i];
137 mostfracobj = REALABS(SCIPvarGetObj(cands[i]));
138 mostfracval = candssol[i];
139 mostfracvar = cands[i];
143 assert( mostfracvar != NULL );
144 assert( SCIPisFeasGT(scip, mostfracfrac, 0.0) );
147 SCIPdebugMessage(
"branching on variable %s with value %f and score %f\n", SCIPvarGetName(mostfracvar), mostfracval, mostfracscore);
148 SCIP_CALL( SCIPbranchVarVal(scip, mostfracvar, mostfracval, NULL, NULL, NULL) );
150 *result = SCIP_BRANCHED;
164 SCIP_BRANCHRULEDATA* branchruledata;
165 SCIP_BRANCHRULE* branchrule;
168 branchruledata = NULL;
176 assert(branchrule != NULL);
179 SCIP_CALL( SCIPsetBranchruleCopy(scip, branchrule, branchCopySdpmostfrac) );
180 SCIP_CALL( SCIPsetBranchruleExecExt(scip, branchrule, branchExecextSdpmostfrac) );
#define BRANCHRULE_MAXBOUNDDIST
most fractional branching rule for SCIPSDP
SCIP_RETCODE SCIPincludeBranchruleSdpmostfrac(SCIP *scip)
#define BRANCHRULE_PRIORITY
#define BRANCHRULE_MAXDEPTH
static SCIP_DECL_BRANCHCOPY(branchCopySdpmostfrac)
static SCIP_DECL_BRANCHEXECEXT(branchExecextSdpmostfrac)