本文整理汇总了C++中SCIPheurGetData函数的典型用法代码示例。如果您正苦于以下问题:C++ SCIPheurGetData函数的具体用法?C++ SCIPheurGetData怎么用?C++ SCIPheurGetData使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了SCIPheurGetData函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SCIP_DECL_HEUREXEC
/** execution method of primal heuristic */
static
SCIP_DECL_HEUREXEC(heurExecRandrounding) /*lint --e{715}*/
{ /*lint --e{715}*/
SCIP_HEURDATA* heurdata;
SCIP_Bool propagate;
assert(strcmp(SCIPheurGetName(heur), HEUR_NAME) == 0);
assert(result != NULL);
assert(SCIPhasCurrentNodeLP(scip));
*result = SCIP_DIDNOTRUN;
/* only call heuristic, if an optimal LP solution is at hand or if relaxation solution is available */
if( SCIPgetLPSolstat(scip) != SCIP_LPSOLSTAT_OPTIMAL && ! SCIPisRelaxSolValid(scip) )
return SCIP_OKAY;
/* only call heuristic, if the LP objective value is smaller than the cutoff bound */
if( SCIPisGE(scip, SCIPgetLPObjval(scip), SCIPgetCutoffbound(scip)) )
return SCIP_OKAY;
/* get heuristic data */
heurdata = SCIPheurGetData(heur);
assert(heurdata != NULL);
/* don't call heuristic, if we have already processed the current LP solution but no relaxation solution is available */
if ( SCIPgetNLPs(scip) == heurdata->lastlp && ! SCIPisRelaxSolValid(scip) )
return SCIP_OKAY;
propagate = (!heurdata->propagateonlyroot || SCIPgetDepth(scip) == 0);
/* try to round LP solution */
SCIP_CALL( performLPRandRounding(scip, heurdata, heurtiming, propagate, result) );
return SCIP_OKAY;
}
示例2: SCIP_DECL_HEUREXIT
/** deinitialization method of primal heuristic (called before transformed problem is freed) */
static
SCIP_DECL_HEUREXIT(heurExitCrossover)
{ /*lint --e{715}*/
SCIP_HEURDATA* heurdata;
SOLTUPLE* soltuple;
assert(heur != NULL);
assert(scip != NULL);
/* get heuristic data */
heurdata = SCIPheurGetData(heur);
assert(heurdata != NULL);
soltuple = heurdata->lasttuple;
/* free all soltuples iteratively */
while( soltuple != NULL )
{
SOLTUPLE* tmp;
tmp = soltuple->prev;
SCIPfreeBlockMemoryArray(scip,&soltuple->indices,soltuple->size);
SCIPfreeBlockMemory(scip,&soltuple);
soltuple = tmp;
}
/* free hash table */
assert(heurdata->hashtable != NULL );
SCIPhashtableFree(&heurdata->hashtable);
return SCIP_OKAY;
}
示例3: SCIP_DECL_HEURINIT
/** initialization method of primal heuristic (called after problem was transformed) */
static
SCIP_DECL_HEURINIT(heurInitCrossover)
{ /*lint --e{715}*/
SCIP_HEURDATA* heurdata;
assert(heur != NULL);
assert(scip != NULL);
/* get heuristic's data */
heurdata = SCIPheurGetData(heur);
assert(heurdata != NULL);
/* initialize data */
heurdata->usednodes = 0;
heurdata->prevlastsol = NULL;
heurdata->prevbestsol = NULL;
heurdata->randseed = 0;
heurdata->lasttuple = NULL;
heurdata->nfailures = 0;
heurdata->prevnsols = 0;
heurdata->nextnodenumber = 0;
/* initialize hash table */
SCIP_CALL( SCIPhashtableCreate(&heurdata->hashtable, SCIPblkmem(scip), HASHSIZE_SOLS,
hashGetKeySols, hashKeyEqSols, hashKeyValSols, NULL) );
assert(heurdata->hashtable != NULL );
return SCIP_OKAY;
}
示例4: SCIPgetObjHeur
/** returns the heur object for the given primal heuristic */
scip::ObjHeur* SCIPgetObjHeur(
SCIP* scip, /**< SCIP data structure */
SCIP_HEUR* heur /**< primal heuristic */
)
{
SCIP_HEURDATA* heurdata;
heurdata = SCIPheurGetData(heur);
assert(heurdata != NULL);
return heurdata->objheur;
}
示例5: SCIP_DECL_HEURINITSOL
/** solving process initialization method of primal heuristic (called when branch and bound process is about to begin) */
static
SCIP_DECL_HEURINITSOL(heurInitsolSimplerounding)
{
SCIP_HEURDATA* heurdata;
assert(strcmp(SCIPheurGetName(heur), HEUR_NAME) == 0);
heurdata = SCIPheurGetData(heur);
assert(heurdata != NULL);
heurdata->lastlp = -1;
return SCIP_OKAY;
}
示例6: SCIP_DECL_HEURFREE
/** destructor of primal heuristic to free user data (called when SCIP is exiting) */
static
SCIP_DECL_HEURFREE(heurFreeFixandinfer) /*lint --e{715}*/
{ /*lint --e{715}*/
SCIP_HEURDATA* heurdata;
/* free heuristic data */
heurdata = SCIPheurGetData(heur);
assert(heurdata != NULL);
SCIPfreeMemory(scip, &heurdata);
SCIPheurSetData(heur, NULL);
return SCIP_OKAY;
}
示例7: SCIP_DECL_HEUREXEC
/** execution method of primal heuristic */
static
SCIP_DECL_HEUREXEC(heurExecObj)
{ /*lint --e{715}*/
SCIP_HEURDATA* heurdata;
heurdata = SCIPheurGetData(heur);
assert(heurdata != NULL);
assert(heurdata->objheur != NULL);
/* call virtual method of heur object */
SCIP_CALL( heurdata->objheur->scip_exec(scip, heur, heurtiming, result) );
return SCIP_OKAY;
}
示例8: SCIP_DECL_HEUREXIT
/** deinitialization method of primal heuristic (called before transformed problem is freed) */
static
SCIP_DECL_HEUREXIT(heurExitRandrounding) /*lint --e{715}*/
{ /*lint --e{715}*/
SCIP_HEURDATA* heurdata;
assert(strcmp(SCIPheurGetName(heur), HEUR_NAME) == 0);
/* free heuristic data */
heurdata = SCIPheurGetData(heur);
assert(heurdata != NULL);
SCIP_CALL( SCIPfreeSol(scip, &heurdata->sol) );
return SCIP_OKAY;
}
示例9: SCIP_DECL_HEUREXITSOL
/** solving process deinitialization method of primal heuristic (called before branch and bound process data is freed) */
static
SCIP_DECL_HEUREXITSOL(heurExitsolObj)
{ /*lint --e{715}*/
SCIP_HEURDATA* heurdata;
heurdata = SCIPheurGetData(heur);
assert(heurdata != NULL);
assert(heurdata->objheur != NULL);
/* call virtual method of heur object */
SCIP_CALL( heurdata->objheur->scip_exitsol(scip, heur) );
return SCIP_OKAY;
}
示例10: SCIP_DECL_HEURINIT
/* initialize the heuristic */
static SCIP_DECL_HEURINIT(heurInitReoptsols)
{
SCIP_HEURDATA* heurdata;
assert(scip != NULL );
assert(heur != NULL );
heurdata = SCIPheurGetData(heur);
assert(heurdata != NULL );
heurdata->ncheckedsols = 0;
heurdata->nimprovingsols = 0;
return SCIP_OKAY;
}
示例11: SCIP_DECL_HEURINIT
/** initialization method of primal heuristic (called after problem was transformed) */
static
SCIP_DECL_HEURINIT(heurInitObj)
{ /*lint --e{715}*/
SCIP_HEURDATA* heurdata;
heurdata = SCIPheurGetData(heur);
assert(heurdata != NULL);
assert(heurdata->objheur != NULL);
assert(heurdata->objheur->scip_ == scip);
/* call virtual method of heur object */
SCIP_CALL( heurdata->objheur->scip_init(scip, heur) );
return SCIP_OKAY;
}
示例12: SCIP_DECL_HEURINIT
/** initialization method of primal heuristic (called after problem was transformed) */
static
SCIP_DECL_HEURINIT(heurInitZirounding)
{ /*lint --e{715}*/
SCIP_HEURDATA* heurdata;
assert(strcmp(SCIPheurGetName(heur), HEUR_NAME) == 0);
heurdata = SCIPheurGetData(heur);
assert(heurdata != NULL);
/* create working solution */
SCIP_CALL( SCIPcreateSol(scip, &heurdata->sol, heur) );
return SCIP_OKAY;
}
示例13: SCIP_DECL_HEUREXEC
/** execution method of primal heuristic */
static
SCIP_DECL_HEUREXEC(heurExecZeroobj)
{ /*lint --e{715}*/
SCIP_HEURDATA* heurdata; /* heuristic's data */
SCIP_Longint nnodes; /* number of stalling nodes for the subproblem */
assert( heur != NULL );
assert( scip != NULL );
assert( result != NULL );
/* get heuristic data */
heurdata = SCIPheurGetData(heur);
assert( heurdata != NULL );
/* calculate the maximal number of branching nodes until heuristic is aborted */
nnodes = (SCIP_Longint)(heurdata->nodesquot * SCIPgetNNodes(scip));
/* reward zeroobj if it succeeded often */
nnodes = (SCIP_Longint)(nnodes * 3.0 * (SCIPheurGetNBestSolsFound(heur)+1.0)/(SCIPheurGetNCalls(heur) + 1.0));
nnodes -= 100 * SCIPheurGetNCalls(heur); /* count the setup costs for the sub-SCIP as 100 nodes */
nnodes += heurdata->nodesofs;
/* determine the node limit for the current process */
nnodes -= heurdata->usednodes;
nnodes = MIN(nnodes, heurdata->maxnodes);
/* check whether we have enough nodes left to call subproblem solving */
if( nnodes < heurdata->minnodes )
{
SCIPdebugMessage("skipping zeroobj: nnodes=%"SCIP_LONGINT_FORMAT", minnodes=%"SCIP_LONGINT_FORMAT"\n", nnodes, heurdata->minnodes);
return SCIP_OKAY;
}
/* do not run zeroobj, if the problem does not have an objective function anyway */
if( SCIPgetNObjVars(scip) == 0 )
{
SCIPdebugMessage("skipping zeroobj: pure feasibility problem anyway\n");
return SCIP_OKAY;
}
if( SCIPisStopped(scip) )
return SCIP_OKAY;
SCIP_CALL( SCIPapplyZeroobj(scip, heur, result, heurdata->minimprove, nnodes) );
return SCIP_OKAY;
}
示例14: SCIP_DECL_HEURINIT
/** initialization method of primal heuristic (called after problem was transformed) */
static
SCIP_DECL_HEURINIT(heurInitRandrounding) /*lint --e{715}*/
{ /*lint --e{715}*/
SCIP_HEURDATA* heurdata;
assert(strcmp(SCIPheurGetName(heur), HEUR_NAME) == 0);
heurdata = SCIPheurGetData(heur);
assert(heurdata != NULL);
/* create heuristic data */
SCIP_CALL( SCIPcreateSol(scip, &heurdata->sol, heur) );
heurdata->lastlp = -1;
heurdata->randseed = DEFAULT_RANDSEED;
return SCIP_OKAY;
}
示例15: SCIP_DECL_HEURFREE
/* free data of the heuristic */
static
SCIP_DECL_HEURFREE(heurFreeReoptsols)
{
SCIP_HEURDATA* heurdata;
assert(scip != NULL );
assert(heur != NULL );
heurdata = SCIPheurGetData(heur);
assert(heurdata != NULL );
SCIPfreeMemory(scip, &heurdata);
SCIPheurSetData(heur, NULL);
return SCIP_OKAY;
}