48 #define BRANCHRULE_NAME "sdpmostinf"
49 #define BRANCHRULE_DESC "branch on the most infeasible variable of the SDP"
50 #define BRANCHRULE_PRIORITY 1000000
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 currentfrac;
96 SCIP_Real mostinfscore;
99 SCIP_VAR* mostinfvar = NULL;
102 assert( scip != NULL );
103 assert( result != NULL );
105 SCIPdebugMessage(
"Executing External Branching method of SDP-mostinf!\n");
109 SCIP_CALL( SCIPgetExternBranchCands(scip, &cands, &candssol, &candsscore, &ncands, NULL, NULL, NULL, NULL) );
111 assert( ncands > 0 );
114 printf(
"branching candidates for SDP-mostinf:\n");
115 for (i = 0; i < ncands; i++)
116 printf(
"%s, value = %f, score = %f\n", SCIPvarGetName(cands[i]), candssol[i], candsscore[i]);
125 for (i = 0; i < ncands; i++)
127 currentfrac = SCIPfeasFrac(scip, candssol[i]);
128 currentinf = (currentfrac <= 0.5) ? currentfrac : 1 - currentfrac;
133 if ( SCIPisFeasGT(scip, currentinf, mostinfinf) ||
134 (SCIPisFeasEQ(scip, currentinf, mostinfinf) && SCIPisGT(scip, candsscore[i], mostinfscore)) ||
135 (SCIPisFeasEQ(scip, currentinf, mostinfinf) && SCIPisEQ(scip, candsscore[i], mostinfscore) && REALABS(SCIPvarGetObj(cands[i])) > mostinfobj ) )
138 mostinfinf = currentinf;
139 mostinfval = candssol[i];
140 mostinfobj = REALABS(SCIPvarGetObj(cands[i]));
141 mostinfscore = candsscore[i];
142 mostinfvar = cands[i];
146 assert( mostinfvar != NULL );
147 assert( SCIPisFeasGT(scip, mostinfinf, 0.0) );
150 SCIPdebugMessage(
"branching on variable %s with value %f and score %f\n", SCIPvarGetName(mostinfvar), mostinfval, mostinfscore);
151 SCIP_CALL( SCIPbranchVarVal(scip, mostinfvar, mostinfval, NULL, NULL, NULL) );
153 *result = SCIP_BRANCHED;
167 SCIP_BRANCHRULEDATA* branchruledata;
168 SCIP_BRANCHRULE* branchrule;
171 branchruledata = NULL;
179 assert(branchrule != NULL);
182 SCIP_CALL( SCIPsetBranchruleCopy(scip, branchrule, branchCopySdpmostinf) );
183 SCIP_CALL( SCIPsetBranchruleExecExt(scip, branchrule, branchExecextSdpmostinf) );
#define BRANCHRULE_MAXBOUNDDIST
SCIP_RETCODE SCIPincludeBranchruleSdpmostinf(SCIP *scip)
most infeasible branching rule for SCIPSDP
#define BRANCHRULE_PRIORITY
static SCIP_DECL_BRANCHEXECEXT(branchExecextSdpmostinf)
#define BRANCHRULE_MAXDEPTH
static SCIP_DECL_BRANCHCOPY(branchCopySdpmostinf)