52 #define BRANCHRULE_NAME "sdpmostinf"
53 #define BRANCHRULE_DESC "branch on the most infeasible variable of the SDP"
54 #define BRANCHRULE_PRIORITY 1000000
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 currentfrac;
100 SCIP_Real mostinfscore;
101 SCIP_Real mostinfobj;
102 SCIP_Real mostinfval;
103 SCIP_VAR* mostinfvar = NULL;
106 assert( scip != NULL );
107 assert( result != NULL );
109 SCIPdebugMessage(
"Executing External Branching method of SDP-mostinf!\n");
113 SCIP_CALL( SCIPgetExternBranchCands(scip, &cands, &candssol, &candsscore, &ncands, NULL, NULL, NULL, NULL) );
115 assert( ncands > 0 );
118 SCIPdebugMessage(
"branching candidates for SDP-mostinf:\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++)
131 currentfrac = SCIPfeasFrac(scip, candssol[i]);
132 currentinf = (currentfrac <= 0.5) ? currentfrac : 1 - currentfrac;
138 if ( SCIPisFeasGT(scip, currentinf, mostinfinf) ||
139 (SCIPisFeasEQ(scip, currentinf, mostinfinf) && SCIPisGT(scip, candsscore[i], mostinfscore)) ||
140 (SCIPisFeasEQ(scip, currentinf, mostinfinf) && SCIPisEQ(scip, candsscore[i], mostinfscore) && SCIPisGT(scip, SCIPvarGetObj(cands[i]), mostinfobj)) ||
141 (SCIPisFeasEQ(scip, currentinf, mostinfinf) && SCIPisEQ(scip, candsscore[i], mostinfscore) && SCIPisEQ(scip, SCIPvarGetObj(cands[i]), mostinfobj) &&
142 SCIPvarGetIndex(cands[i]) < SCIPvarGetIndex(mostinfvar)) )
145 mostinfinf = currentinf;
146 mostinfval = candssol[i];
147 mostinfobj = REALABS(SCIPvarGetObj(cands[i]));
148 mostinfscore = candsscore[i];
149 mostinfvar = cands[i];
153 assert( mostinfvar != NULL );
154 assert( SCIPisFeasGT(scip, mostinfinf, 0.0) );
157 SCIPdebugMessage(
"branching on variable %s with value %f and score %f\n", SCIPvarGetName(mostinfvar), mostinfval, mostinfscore);
158 SCIP_CALL( SCIPbranchVarVal(scip, mostinfvar, mostinfval, NULL, NULL, NULL) );
160 *result = SCIP_BRANCHED;
174 SCIP_BRANCHRULEDATA* branchruledata;
175 SCIP_BRANCHRULE* branchrule;
178 branchruledata = NULL;
186 assert(branchrule != NULL);
189 SCIP_CALL( SCIPsetBranchruleCopy(scip, branchrule, branchCopySdpmostinf) );
190 SCIP_CALL( SCIPsetBranchruleExecExt(scip, branchrule, branchExecextSdpmostinf) );
#define BRANCHRULE_MAXBOUNDDIST
SCIP_RETCODE SCIPincludeBranchruleSdpmostinf(SCIP *scip)
most infeasible branching rule for SCIP-SDP
#define BRANCHRULE_PRIORITY
static SCIP_DECL_BRANCHEXECEXT(branchExecextSdpmostinf)
#define BRANCHRULE_MAXDEPTH
static SCIP_DECL_BRANCHCOPY(branchCopySdpmostinf)