本文整理汇总了C++中SCIPvarGetName函数的典型用法代码示例。如果您正苦于以下问题:C++ SCIPvarGetName函数的具体用法?C++ SCIPvarGetName怎么用?C++ SCIPvarGetName使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了SCIPvarGetName函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SCIPdebugCheckUbGlobal
/** checks whether given global upper bound is valid for the debugging solution */
SCIP_RETCODE SCIPdebugCheckUbGlobal(
SCIP_SET* set, /**< global SCIP settings */
SCIP_VAR* var, /**< problem variable */
SCIP_Real ub /**< upper bound */
)
{
SCIP_Real varsol;
assert(set != NULL);
assert(var != NULL);
/* check if we are in the original problem and not in a sub MIP */
if( !isSolutionInMip(set) )
return SCIP_OKAY;
/* check if the incumbent solution is at least as good as the debug solution, so we can stop to check the debug solution */
if( debugSolIsAchieved(set) )
return SCIP_OKAY;
/* get solution value of variable */
SCIP_CALL( getSolutionValue(set, var, &varsol) );
SCIPdebugMessage("debugging solution on upper bound of <%s>[%g] <= %g\n", SCIPvarGetName(var), varsol, ub);
/* check validity of debugging solution */
if( varsol != SCIP_UNKNOWN && SCIPsetIsFeasGT(set, varsol, ub) ) /*lint !e777*/
{
SCIPerrorMessage("invalid global upper bound: <%s>[%.15g] <= %.15g\n", SCIPvarGetName(var), varsol, ub);
SCIPABORT();
}
return SCIP_OKAY;
}
示例2: SCIPdebugCheckImplic
/** checks whether given implication is valid for the debugging solution */
SCIP_RETCODE SCIPdebugCheckImplic(
SCIP_SET* set, /**< global SCIP settings */
SCIP_VAR* var, /**< problem variable */
SCIP_Bool varfixing, /**< FALSE if y should be added in implications for x == 0, TRUE for x == 1 */
SCIP_VAR* implvar, /**< variable y in implication y <= b or y >= b */
SCIP_BOUNDTYPE impltype, /**< type of implication y <= b (SCIP_BOUNDTYPE_UPPER) or y >= b (SCIP_BOUNDTYPE_LOWER) */
SCIP_Real implbound /**< bound b in implication y <= b or y >= b */
)
{
SCIP_Real solval;
assert(set != NULL);
assert(var != NULL);
assert(SCIPvarGetType(var) == SCIP_VARTYPE_BINARY);
/* check if we are in the original problem and not in a sub MIP */
if( !isSolutionInMip(set) )
return SCIP_OKAY;
/* check if the incumbent solution is at least as good as the debug solution, so we can stop to check the debug solution */
if( debugSolIsAchieved(set) )
return SCIP_OKAY;
/* get solution value of variable */
SCIP_CALL( getSolutionValue(set, var, &solval) );
if( solval == SCIP_UNKNOWN ) /*lint !e777*/
return SCIP_OKAY;
assert(SCIPsetIsFeasEQ(set, solval, 0.0) || SCIPsetIsFeasEQ(set, solval, 1.0));
/* check, whether the implication applies for the debugging solution */
if( (solval > 0.5) != varfixing )
return SCIP_OKAY;
/* get solution value of implied variable */
SCIP_CALL( getSolutionValue(set, implvar, &solval) );
if( solval == SCIP_UNKNOWN ) /*lint !e777*/
return SCIP_OKAY;
if( impltype == SCIP_BOUNDTYPE_LOWER )
{
if( SCIPsetIsFeasLT(set, solval, implbound) )
{
SCIPerrorMessage("invalid implication <%s> == %d -> <%s> >= %.15g (variable has value %.15g in solution)\n",
SCIPvarGetName(var), varfixing, SCIPvarGetName(implvar), implbound, solval);
SCIPABORT();
}
}
else
{
if( SCIPsetIsFeasGT(set, solval, implbound) )
{
SCIPerrorMessage("invalid implication <%s> == %d -> <%s> <= %.15g (variable has value %.15g in solution)\n",
SCIPvarGetName(var), varfixing, SCIPvarGetName(implvar), implbound, solval);
SCIPABORT();
}
}
return SCIP_OKAY;
}
示例3: SCIPvbcNewChild
/** creates a new node entry in the VBC output file */
SCIP_RETCODE SCIPvbcNewChild(
SCIP_VBC* vbc, /**< VBC information */
SCIP_STAT* stat, /**< problem statistics */
SCIP_NODE* node /**< new node, that was created */
)
{
SCIP_VAR* branchvar;
SCIP_BOUNDTYPE branchtype;
SCIP_Real branchbound;
size_t parentnodenum;
size_t nodenum;
assert(vbc != NULL);
assert(stat != NULL);
assert(node != NULL);
/* check, if VBC output should be created */
if( vbc->file == NULL )
return SCIP_OKAY;
/* vbc is disabled on probing nodes */
if( SCIPnodeGetType(node) == SCIP_NODETYPE_PROBINGNODE )
return SCIP_OKAY;
/* insert mapping node -> nodenum into hash map */
if( stat->ncreatednodesrun >= (SCIP_Longint)INT_MAX )
{
SCIPerrorMessage("too many nodes to store in the VBC file\n");
return SCIP_INVALIDDATA;
}
nodenum = (size_t)stat->ncreatednodesrun;
assert(nodenum > 0);
SCIP_CALL( SCIPhashmapInsert(vbc->nodenum, node, (void*)nodenum) );
/* get nodenum of parent node from hash map */
parentnodenum = (node->parent != NULL ? (size_t)SCIPhashmapGetImage(vbc->nodenum, node->parent) : 0);
assert(node->parent == NULL || parentnodenum > 0);
/* get branching information */
getBranchInfo(node, &branchvar, &branchtype, &branchbound);
printTime(vbc, stat);
SCIPmessageFPrintInfo(vbc->messagehdlr, vbc->file, "N %d %d %d\n", (int)parentnodenum, (int)nodenum, SCIP_VBCCOLOR_UNSOLVED);
printTime(vbc, stat);
if( branchvar != NULL )
{
SCIPmessageFPrintInfo(vbc->messagehdlr, vbc->file, "I %d \\inode:\\t%d (%p)\\idepth:\\t%d\\nvar:\\t%s [%g,%g] %s %f\\nbound:\\t%f\n",
(int)nodenum, (int)nodenum, node, SCIPnodeGetDepth(node),
SCIPvarGetName(branchvar), SCIPvarGetLbLocal(branchvar), SCIPvarGetUbLocal(branchvar),
branchtype == SCIP_BOUNDTYPE_LOWER ? ">=" : "<=", branchbound, SCIPnodeGetLowerbound(node));
}
else
{
SCIPmessageFPrintInfo(vbc->messagehdlr, vbc->file, "I %d \\inode:\\t%d (%p)\\idepth:\\t%d\\nvar:\\t-\\nbound:\\t%f\n",
(int)nodenum, (int)nodenum, node, SCIPnodeGetDepth(node), SCIPnodeGetLowerbound(node));
}
return SCIP_OKAY;
}
示例4: SCIP_DECL_BRANCHEXECPS
/** branching execution method for not completely fixed pseudo solutions */
static
SCIP_DECL_BRANCHEXECPS(branchExecpsRandom)
{ /*lint --e{715}*/
SCIP_BRANCHRULEDATA* branchruledata;
SCIP_VAR** pseudocands;
int npseudocands;
int bestcand;
assert(branchrule != NULL);
assert(strcmp(SCIPbranchruleGetName(branchrule), BRANCHRULE_NAME) == 0);
assert(scip != NULL);
assert(result != NULL);
SCIPdebugMessage("Execps method of random branching\n");
branchruledata = SCIPbranchruleGetData(branchrule);
assert(branchruledata != NULL);
/* get branching candidates */
SCIP_CALL( SCIPgetPseudoBranchCands(scip, &pseudocands, NULL, &npseudocands) );
assert(npseudocands > 0);
/* get random branching candidate */
bestcand = SCIPgetRandomInt(0, npseudocands-1, &branchruledata->seed);
assert(bestcand >= 0);
SCIPdebugMessage(" -> %d candidates, selected candidate %d: variable <%s>\n",
npseudocands, bestcand, SCIPvarGetName(pseudocands[bestcand]));
/* perform the branching */
SCIP_CALL( SCIPbranchVar(scip, pseudocands[bestcand], NULL, NULL, NULL) );
*result = SCIP_BRANCHED;
return SCIP_OKAY;
}
示例5: SCIP_DECL_BRANCHEXECLP
/** branching execution method for fractional LP solutions */
static
SCIP_DECL_BRANCHEXECLP(branchExeclpLeastinf)
{ /*lint --e{715}*/
SCIP_VAR** lpcands;
SCIP_Real* lpcandsfrac;
int nlpcands;
SCIP_Real infeasibility;
SCIP_Real score;
SCIP_Real obj;
SCIP_Real bestscore;
SCIP_Real bestobj;
int bestcand;
int i;
assert(branchrule != NULL);
assert(strcmp(SCIPbranchruleGetName(branchrule), BRANCHRULE_NAME) == 0);
assert(scip != NULL);
assert(result != NULL);
SCIPdebugMessage("Execlp method of leastinf branching\n");
/* get branching candidates */
SCIP_CALL( SCIPgetLPBranchCands(scip, &lpcands, NULL, &lpcandsfrac, NULL, &nlpcands, NULL) );
assert(nlpcands > 0);
/* search the least infeasible candidate */
bestscore = SCIP_REAL_MIN;
bestobj = 0.0;
bestcand = -1;
for( i = 0; i < nlpcands; ++i )
{
assert(lpcands[i] != NULL);
infeasibility = lpcandsfrac[i];
infeasibility = MIN(infeasibility, 1.0-infeasibility);
score = 1.0 - infeasibility;
score *= SCIPvarGetBranchFactor(lpcands[i]);
obj = SCIPvarGetObj(lpcands[i]);
obj = REALABS(obj);
if( SCIPisGT(scip, score, bestscore)
|| (SCIPisGE(scip, score, bestscore) && obj > bestobj) )
{
bestscore = score;
bestobj = obj;
bestcand = i;
}
}
assert(bestcand >= 0);
SCIPdebugMessage(" -> %d candidates, selected candidate %d: variable <%s> (frac=%g, obj=%g, factor=%g, score=%g)\n",
nlpcands, bestcand, SCIPvarGetName(lpcands[bestcand]), lpcandsfrac[bestcand], bestobj,
SCIPvarGetBranchFactor(lpcands[bestcand]), bestscore);
/* perform the branching */
SCIP_CALL( SCIPbranchVar(scip, lpcands[bestcand], NULL, NULL, NULL) );
*result = SCIP_BRANCHED;
return SCIP_OKAY;
}
示例6: SCIPvisualSolvedNode
/** marks node as solved in visualization output file */
void SCIPvisualSolvedNode(
SCIP_VISUAL* visual, /**< visualization information */
SCIP_SET* set, /**< global SCIP settings */
SCIP_STAT* stat, /**< problem statistics */
SCIP_NODE* node /**< node, that was solved */
)
{
SCIP_VAR* branchvar;
SCIP_BOUNDTYPE branchtype;
SCIP_Real branchbound;
SCIP_Real lowerbound;
size_t nodenum;
assert( visual != NULL );
assert( stat != NULL );
assert( node != NULL );
/* check whether output should be created */
if ( visual->vbcfile == NULL && visual->bakfile == NULL )
return;
/* visualization is disabled on probing nodes */
if( SCIPnodeGetType(node) == SCIP_NODETYPE_PROBINGNODE )
return;
/* get node num from hash map */
nodenum = (size_t)SCIPhashmapGetImage(visual->nodenum, node);
assert(nodenum > 0);
/* get branching information */
getBranchInfo(node, &branchvar, &branchtype, &branchbound);
/* determine lower bound */
if ( set->visual_objextern )
lowerbound = SCIPretransformObj(set->scip, SCIPnodeGetLowerbound(node));
else
lowerbound = SCIPnodeGetLowerbound(node);
if ( visual->vbcfile != NULL )
{
printTime(visual, stat, TRUE);
if( branchvar != NULL )
{
SCIPmessageFPrintInfo(visual->messagehdlr, visual->vbcfile, "I %d \\inode:\\t%d (%p)\\idepth:\\t%d\\nvar:\\t%s [%g,%g] %s %f\\nbound:\\t%f\\nnr:\\t%" SCIP_LONGINT_FORMAT "\n",
(int)nodenum, (int)nodenum, node, SCIPnodeGetDepth(node),
SCIPvarGetName(branchvar), SCIPvarGetLbLocal(branchvar), SCIPvarGetUbLocal(branchvar),
branchtype == SCIP_BOUNDTYPE_LOWER ? ">=" : "<=", branchbound, lowerbound, stat->nnodes);
}
else
{
SCIPmessageFPrintInfo(visual->messagehdlr, visual->vbcfile, "I %d \\inode:\\t%d (%p)\\idepth:\\t%d\\nvar:\\t-\\nbound:\\t%f\\nnr:\\t%" SCIP_LONGINT_FORMAT "\n",
(int)nodenum, (int)nodenum, node, SCIPnodeGetDepth(node), lowerbound, stat->nnodes);
}
vbcSetColor(visual, stat, node, SCIP_VBCCOLOR_SOLVED);
}
/* do nothing for BAK */
}
示例7: addBoundViolated
/** adds given problem variable to pricing storage, if zero is not best bound w.r.t. objective function */
static
SCIP_RETCODE addBoundViolated(
SCIP_PRICESTORE* pricestore, /**< pricing storage */
BMS_BLKMEM* blkmem, /**< block memory buffers */
SCIP_SET* set, /**< global SCIP settings */
SCIP_STAT* stat, /**< dynamic problem statistics */
SCIP_TREE* tree, /**< branch and bound tree */
SCIP_LP* lp, /**< LP data */
SCIP_BRANCHCAND* branchcand, /**< branching candidate storage */
SCIP_EVENTQUEUE* eventqueue, /**< event queue */
SCIP_VAR* var, /**< problem variable */
SCIP_Bool* added /**< pointer to store whether variable was added to pricing storage */
)
{
assert(tree != NULL);
assert(added != NULL);
*added = FALSE;
/* add variable, if zero is not feasible within the bounds */
if( SCIPsetIsPositive(set, SCIPvarGetLbLocal(var)) || SCIPsetIsNegative(set, SCIPvarGetUbLocal(var)) )
{
SCIPdebugMessage(" -> zero violates bounds of <%s> [%g,%g]\n",
SCIPvarGetName(var), SCIPvarGetLbLocal(var), SCIPvarGetUbLocal(var));
SCIP_CALL( SCIPpricestoreAddBdviolvar(pricestore, blkmem, set, stat, lp, branchcand, eventqueue, var) );
*added = TRUE;
}
else
{
SCIP_Real bestbound;
/* add variable, if zero is not best bound w.r.t. objective function */
bestbound = SCIPvarGetBestBoundLocal(var);
if( !SCIPsetIsZero(set, bestbound) )
{
SCIPdebugMessage(" -> best bound of <%s> [%g,%g] is not zero but %g\n",
SCIPvarGetName(var), SCIPvarGetLbLocal(var), SCIPvarGetUbLocal(var), bestbound);
SCIP_CALL( SCIPpricestoreAddVar(pricestore, blkmem, set, eventqueue, lp, var,
-SCIPvarGetObj(var) * bestbound, (SCIPtreeGetCurrentDepth(tree) == 0)) );
*added = TRUE;
}
}
return SCIP_OKAY;
}
示例8: SCIPdebugCheckVbound
/** checks whether given variable bound is valid for the debugging solution */
SCIP_RETCODE SCIPdebugCheckVbound(
SCIP_SET* set, /**< global SCIP settings */
SCIP_VAR* var, /**< problem variable x in x <= b*z + d or x >= b*z + d */
SCIP_BOUNDTYPE vbtype, /**< type of variable bound (LOWER or UPPER) */
SCIP_VAR* vbvar, /**< variable z in x <= b*z + d or x >= b*z + d */
SCIP_Real vbcoef, /**< coefficient b in x <= b*z + d or x >= b*z + d */
SCIP_Real vbconstant /**< constant d in x <= b*z + d or x >= b*z + d */
)
{
SCIP_Real varsol;
SCIP_Real vbvarsol;
SCIP_Real vb;
assert(set != NULL);
assert(var != NULL);
/* check if we are in the original problem and not in a sub MIP */
if( !isSolutionInMip(set) )
return SCIP_OKAY;
/* check if the incumbent solution is at least as good as the debug solution, so we can stop to check the debug solution */
if( debugSolIsAchieved(set) )
return SCIP_OKAY;
/* get solution value of variables */
SCIP_CALL( getSolutionValue(set, var, &varsol) );
SCIP_CALL( getSolutionValue(set, vbvar, &vbvarsol) );
/* check validity of debugging solution */
if( varsol != SCIP_UNKNOWN && vbvarsol != SCIP_UNKNOWN ) /*lint !e777*/
{
vb = vbcoef * vbvarsol + vbconstant;
if( (vbtype == SCIP_BOUNDTYPE_LOWER && SCIPsetIsFeasLT(set, varsol, vb))
|| (vbtype == SCIP_BOUNDTYPE_UPPER && SCIPsetIsFeasGT(set, varsol, vb)) )
{
SCIPerrorMessage("invalid variable bound: <%s>[%.15g] %s %.15g<%s>[%.15g] %+.15g\n",
SCIPvarGetName(var), varsol, vbtype == SCIP_BOUNDTYPE_LOWER ? ">=" : "<=", vbcoef,
SCIPvarGetName(vbvar), vbvarsol, vbconstant);
SCIPABORT();
}
}
return SCIP_OKAY;
}
示例9: SCIP_DECL_EVENTEXEC
/** execution method of objective change event handler */
static
SCIP_DECL_EVENTEXEC(eventExecIntobj)
{ /*lint --e{715}*/
SCIP_EVENTHDLRDATA* eventhdlrdata;
SCIP_SEPADATA* sepadata;
SCIP_VAR* var;
SCIP_Real objdelta;
eventhdlrdata = SCIPeventhdlrGetData(eventhdlr);
sepadata = (SCIP_SEPADATA*)eventhdlrdata;
assert(sepadata != NULL);
/* we don't have anything to do, if the objective value inequality doesn't yet exist */
if( sepadata->objrow == NULL )
return SCIP_OKAY;
var = SCIPeventGetVar(event);
switch( SCIPeventGetType(event) )
{
case SCIP_EVENTTYPE_VARADDED:
SCIPdebugMessage("variable <%s> with obj=%g was added to the problem\n", SCIPvarGetName(var), SCIPvarGetObj(var));
objdelta = SCIPvarGetObj(var);
if( !SCIPisZero(scip, objdelta) )
{
SCIP_CALL( SCIPaddVarToRow(scip, sepadata->objrow, var, SCIPvarGetObj(var)) );
}
break;
case SCIP_EVENTTYPE_OBJCHANGED:
SCIPdebugMessage("variable <%s> changed objective value from %g to %g\n",
SCIPvarGetName(var), SCIPeventGetOldobj(event), SCIPeventGetNewobj(event));
objdelta = SCIPeventGetNewobj(event) - SCIPeventGetOldobj(event);
SCIP_CALL( SCIPaddVarToRow(scip, sepadata->objrow, var, objdelta) );
break;
default:
SCIPerrorMessage("invalid event type %x\n", SCIPeventGetType(event));
return SCIP_INVALIDDATA;
}
return SCIP_OKAY;
}
示例10: SCIP_DECL_BRANCHEXECLP
/** branching execution method for fractional LP solutions */
static
SCIP_DECL_BRANCHEXECLP(branchExeclpPscost)
{ /*lint --e{715}*/
SCIP_VAR** lpcands;
SCIP_Real* lpcandssol;
SCIP_Real bestscore;
SCIP_Real bestrootdiff;
int nlpcands;
int bestcand;
int c;
assert(branchrule != NULL);
assert(strcmp(SCIPbranchruleGetName(branchrule), BRANCHRULE_NAME) == 0);
assert(scip != NULL);
assert(result != NULL);
SCIPdebugMessage("Execlp method of pscost branching\n");
/* get branching candidates */
SCIP_CALL( SCIPgetLPBranchCands(scip, &lpcands, &lpcandssol, NULL, NULL, &nlpcands, NULL) );
assert(nlpcands > 0);
bestcand = -1;
bestscore = -SCIPinfinity(scip);
bestrootdiff = 0.0;
for( c = 0; c < nlpcands; ++c )
{
SCIP_Real score;
SCIP_Real rootsolval;
SCIP_Real rootdiff;
score = SCIPgetVarPseudocostScore(scip, lpcands[c], lpcandssol[c]);
rootsolval = SCIPvarGetRootSol(lpcands[c]);
rootdiff = REALABS(lpcandssol[c] - rootsolval);
if( SCIPisSumGT(scip, score, bestscore) || (SCIPisSumEQ(scip, score, bestscore) && rootdiff > bestrootdiff) )
{
bestcand = c;
bestscore = score;
bestrootdiff = rootdiff;
}
}
assert(0 <= bestcand && bestcand < nlpcands);
assert(!SCIPisFeasIntegral(scip, lpcandssol[bestcand]));
/* perform the branching */
SCIPdebugMessage(" -> %d cands, selected cand %d: variable <%s> (solval=%g, score=%g)\n",
nlpcands, bestcand, SCIPvarGetName(lpcands[bestcand]), lpcandssol[bestcand], bestscore);
/* perform the branching */
SCIP_CALL( SCIPbranchVar(scip, lpcands[bestcand], NULL, NULL, NULL) );
*result = SCIP_BRANCHED;
return SCIP_OKAY;
}
示例11: SCIPpricestoreAddBdviolvar
/** adds variable where zero violates the bounds to pricing storage, capture it */
SCIP_RETCODE SCIPpricestoreAddBdviolvar(
SCIP_PRICESTORE* pricestore, /**< pricing storage */
BMS_BLKMEM* blkmem, /**< block memory */
SCIP_SET* set, /**< global SCIP settings */
SCIP_STAT* stat, /**< problem statistics */
SCIP_LP* lp, /**< LP data */
SCIP_BRANCHCAND* branchcand, /**< branching candidate storage */
SCIP_EVENTQUEUE* eventqueue, /**< event queue */
SCIP_VAR* var /**< variable, where zero violates the bounds */
)
{
assert(pricestore != NULL);
assert(set != NULL);
assert(var != NULL);
assert(SCIPsetIsPositive(set, SCIPvarGetLbLocal(var)) || SCIPsetIsNegative(set, SCIPvarGetUbLocal(var)));
assert(pricestore->naddedbdviolvars <= pricestore->nbdviolvars);
SCIPdebugMessage("zero violates bounds of <%s> (lb=%g, ub=%g)\n",
SCIPvarGetName(var), SCIPvarGetLbLocal(var), SCIPvarGetUbLocal(var));
if( !pricestore->initiallp )
pricestore->nvarsfound++;
/* get enough memory to store additional variable */
SCIP_CALL( pricestoreEnsureBdviolvarsMem(pricestore, set, pricestore->nbdviolvars+1) );
assert(pricestore->nbdviolvars <= pricestore->bdviolvarssize);
/* capture variable */
SCIPvarCapture(var);
/* insert variable in bdviolvars arrays */
pricestore->bdviolvars[pricestore->nbdviolvars] = var;
pricestore->bdviolvarslb[pricestore->nbdviolvars] = SCIPvarGetLbLocal(var);
pricestore->bdviolvarsub[pricestore->nbdviolvars] = SCIPvarGetUbLocal(var);
pricestore->nbdviolvars++;
/* Temporarily set bounds, such that zero is feasible, because we don't want to destroy
* dual feasibility (by adding columns) and primal feasibility (by introducing violated bounds)
* at the same time.
* The correct bounds must be reset with a call to SCIPpricestoreResetBounds().
* The inference information is unimportant for this temporary bound change.
*/
if( SCIPsetIsPositive(set, SCIPvarGetLbLocal(var)) )
{
SCIP_CALL( SCIPvarChgLbLocal(var, blkmem, set, stat, lp, branchcand, eventqueue, 0.0) );
}
else
{
SCIP_CALL( SCIPvarChgUbLocal(var, blkmem, set, stat, lp, branchcand, eventqueue, 0.0) );
}
return SCIP_OKAY;
}
示例12: SCIPvbcSolvedNode
/** changes the color of the node to the color of solved nodes */
void SCIPvbcSolvedNode(
SCIP_VBC* vbc, /**< VBC information */
SCIP_STAT* stat, /**< problem statistics */
SCIP_NODE* node /**< node, that was solved */
)
{
SCIP_VAR* branchvar;
SCIP_BOUNDTYPE branchtype;
SCIP_Real branchbound;
size_t nodenum;
assert(vbc != NULL);
assert(stat != NULL);
assert(node != NULL);
/* check, if VBC output should be created */
if( vbc->file == NULL )
return;
/* vbc is disabled on probing nodes */
if( SCIPnodeGetType(node) == SCIP_NODETYPE_PROBINGNODE )
return;
/* get node num from hash map */
nodenum = (size_t)SCIPhashmapGetImage(vbc->nodenum, node);
assert(nodenum > 0);
/* get branching information */
getBranchInfo(node, &branchvar, &branchtype, &branchbound);
printTime(vbc, stat);
if( branchvar != NULL )
{
SCIPmessageFPrintInfo(vbc->messagehdlr, vbc->file, "I %d \\inode:\\t%d (%p)\\idepth:\\t%d\\nvar:\\t%s [%g,%g] %s %f\\nbound:\\t%f\\nnr:\\t%"SCIP_LONGINT_FORMAT"\n",
(int)nodenum, (int)nodenum, node, SCIPnodeGetDepth(node),
SCIPvarGetName(branchvar), SCIPvarGetLbLocal(branchvar), SCIPvarGetUbLocal(branchvar),
branchtype == SCIP_BOUNDTYPE_LOWER ? ">=" : "<=", branchbound, SCIPnodeGetLowerbound(node), stat->nnodes);
}
else
{
SCIPmessageFPrintInfo(vbc->messagehdlr, vbc->file, "I %d \\inode:\\t%d (%p)\\idepth:\\t%d\\nvar:\\t-\\nbound:\\t%f\\nnr:\\t%"SCIP_LONGINT_FORMAT"\n",
(int)nodenum, (int)nodenum, node, SCIPnodeGetDepth(node), SCIPnodeGetLowerbound(node), stat->nnodes);
}
vbcSetColor(vbc, stat, node, SCIP_VBCCOLOR_SOLVED);
}
示例13: resetVarname
/* reset the variable name to the given one */
static
void resetVarname(
SCIP_VAR* var, /**< variable */
const char* name /**< variable name */
)
{
const char * oldname;
assert( var != NULL );
assert( name != NULL );
/* get pointer to temporary generic name and free the memory */
oldname = SCIPvarGetName(var);
BMSfreeMemory(&oldname);
/* reset name */
SCIPvarSetNamePointer(var, name);
}
示例14: SCIP_DECL_EVENTEXEC
/** execution method of event handler */
static
SCIP_DECL_EVENTEXEC(eventExecProbdatavardeleted)
{
SCIP_VAR* var;
SCIP_PROBDATA* probdata;
int idx;
assert(SCIPeventGetType(event) == SCIP_EVENTTYPE_VARDELETED);
var = SCIPeventGetVar(event);
probdata = (SCIP_PROBDATA*) eventdata;
assert(probdata != NULL);
assert(var != NULL);
/* get index of variable in stablesets array */
idx = (int)(size_t) SCIPvarGetData(var);
SCIPdebugMessage("remove variable %s [%d] from list of stable sets\n", SCIPvarGetName(var), idx);
assert(probdata->stablesetvars[idx] == var);
/* remove variable from stablesets array and release it */
SCIPfreeBlockMemoryArray(scip, &(probdata->stablesets[idx]), probdata->stablesetlengths[idx]); /*lint !e866*/
SCIP_CALL( SCIPreleaseVar(scip, &(probdata->stablesetvars[idx])) );
/* move all subsequent variables to the front */
for( ; idx < probdata->nstablesets - 1; idx++)
{
probdata->stablesets[idx] = probdata->stablesets[idx + 1];
probdata->stablesetlengths[idx] = probdata->stablesetlengths[idx + 1];
probdata->stablesetvars[idx] = probdata->stablesetvars[idx + 1];
SCIPvarSetData(probdata->stablesetvars[idx], (SCIP_VARDATA*) (size_t) idx); /*lint !e571*/
}
probdata->nstablesets--;
return SCIP_OKAY;
}/*lint !e715*/
示例15: sepastoreApplyUb
/** applies an upper bound change */
static
SCIP_RETCODE sepastoreApplyUb(
SCIP_SEPASTORE* sepastore, /**< separation storage */
BMS_BLKMEM* blkmem, /**< block memory */
SCIP_SET* set, /**< global SCIP settings */
SCIP_STAT* stat, /**< problem statistics */
SCIP_TREE* tree, /**< branch and bound tree */
SCIP_LP* lp, /**< LP data */
SCIP_BRANCHCAND* branchcand, /**< branching candidate storage */
SCIP_EVENTQUEUE* eventqueue, /**< event queue */
SCIP_VAR* var, /**< problem variable */
SCIP_Real bound, /**< new upper bound of variable */
SCIP_Bool* cutoff /**< pointer to store TRUE, if an infeasibility has been detected */
)
{
assert(sepastore != NULL);
assert(cutoff != NULL);
if( SCIPsetIsLT(set, bound, SCIPvarGetUbLocal(var)) )
{
SCIPdebugMessage(" -> applying bound change: <%s>: [%g,%g] -> [%g,%g]\n",
SCIPvarGetName(var), SCIPvarGetLbLocal(var), SCIPvarGetUbLocal(var), SCIPvarGetLbLocal(var), bound);
if( SCIPsetIsFeasGE(set, bound, SCIPvarGetLbLocal(var)) )
{
SCIP_CALL( SCIPnodeAddBoundchg(SCIPtreeGetCurrentNode(tree), blkmem, set, stat, tree, lp, branchcand, eventqueue,
var, bound, SCIP_BOUNDTYPE_UPPER, FALSE) );
}
else
*cutoff = TRUE;
if( !sepastore->initiallp )
sepastore->ncutsapplied++;
}
return SCIP_OKAY;
}