54 #define BRANCHRULE_NAME "sdpmostinf"
55 #define BRANCHRULE_DESC "branch on the most infeasible variable of the SDP"
56 #define BRANCHRULE_PRIORITY 1000000
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 currentfrac;
100 SCIP_Real currentinf;
101 SCIP_Real mostinfinf;
102 SCIP_Real mostinfscore;
103 SCIP_Real mostinfobj;
104 SCIP_Real mostinfval;
105 SCIP_VAR* mostinfvar = NULL;
108 assert( scip != NULL );
109 assert( result != NULL );
111 SCIPdebugMessage(
"Executing External Branching method of SDP-mostinf!\n");
115 SCIP_CALL( SCIPgetExternBranchCands(scip, &cands, &candssol, &candsscore, &ncands, NULL, NULL, NULL, NULL) );
117 assert( ncands > 0 );
120 SCIPdebugMessage(
"branching candidates for SDP-mostinf:\n");
121 for (i = 0; i < ncands; i++)
122 SCIPdebugMessage(
"%s, value = %f, score = %f\n", SCIPvarGetName(cands[i]), candssol[i], candsscore[i]);
131 for (i = 0; i < ncands; i++)
134 if ( SCIPvarGetType(cands[i]) == SCIP_VARTYPE_CONTINUOUS )
136 SCIPdebugMessage(
"skipping continuous variable %s\n", SCIPvarGetName(cands[i]));
140 currentfrac = SCIPfeasFrac(scip, candssol[i]);
141 currentinf = (currentfrac <= 0.5) ? currentfrac : 1 - currentfrac;
147 if ( SCIPisFeasGT(scip, currentinf, mostinfinf) ||
148 (SCIPisFeasEQ(scip, currentinf, mostinfinf) && SCIPisGT(scip, candsscore[i], mostinfscore)) ||
149 (SCIPisFeasEQ(scip, currentinf, mostinfinf) && SCIPisEQ(scip, candsscore[i], mostinfscore) && SCIPisGT(scip, SCIPvarGetObj(cands[i]), mostinfobj)) ||
150 (SCIPisFeasEQ(scip, currentinf, mostinfinf) && SCIPisEQ(scip, candsscore[i], mostinfscore) && SCIPisEQ(scip, SCIPvarGetObj(cands[i]), mostinfobj) &&
151 SCIPvarGetIndex(cands[i]) < SCIPvarGetIndex(mostinfvar)) )
154 mostinfinf = currentinf;
155 mostinfval = candssol[i];
156 mostinfobj = REALABS(SCIPvarGetObj(cands[i]));
157 mostinfscore = candsscore[i];
158 mostinfvar = cands[i];
163 if ( mostinfinf == -1.0 )
165 SCIPdebugMessage(
"Skipping SDP-mostinf branching rule since all branching variables are continuous\n");
166 *result = SCIP_DIDNOTFIND;
170 assert( mostinfvar != NULL );
171 assert( SCIPisFeasGT(scip, mostinfinf, 0.0) );
174 SCIPdebugMessage(
"branching on variable %s with value %f and score %f\n", SCIPvarGetName(mostinfvar), mostinfval, mostinfscore);
175 SCIP_CALL( SCIPbranchVarVal(scip, mostinfvar, mostinfval, NULL, NULL, NULL) );
177 *result = SCIP_BRANCHED;
191 SCIP_BRANCHRULEDATA* branchruledata;
192 SCIP_BRANCHRULE* branchrule;
195 branchruledata = NULL;
203 assert(branchrule != NULL);
206 SCIP_CALL( SCIPsetBranchruleCopy(scip, branchrule, branchCopySdpmostinf) );
207 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)