本文整理汇总了C++中SymmetricMatrix::doFreeMemory方法的典型用法代码示例。如果您正苦于以下问题:C++ SymmetricMatrix::doFreeMemory方法的具体用法?C++ SymmetricMatrix::doFreeMemory怎么用?C++ SymmetricMatrix::doFreeMemory使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SymmetricMatrix
的用法示例。
在下文中一共展示了SymmetricMatrix::doFreeMemory方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: solveOqpBenchmark
/*
* s o l v e O q p B e n c h m a r k
*/
returnValue solveOqpBenchmark( int_t nQP, int_t nV,
const real_t* const _H, const real_t* const g,
const real_t* const lb, const real_t* const ub,
BooleanType isSparse, BooleanType useHotstarts,
const Options& options, int_t maxAllowedNWSR,
real_t& maxNWSR, real_t& avgNWSR, real_t& maxCPUtime, real_t& avgCPUtime,
real_t& maxStationarity, real_t& maxFeasibility, real_t& maxComplementarity
)
{
int_t k;
/* I) SETUP AUXILIARY VARIABLES: */
/* 1) Keep nWSR and store current and maximum number of
* working set recalculations in temporary variables */
int_t nWSRcur;
real_t CPUtimeLimit = maxCPUtime;
real_t CPUtimeCur = CPUtimeLimit;
real_t stat, feas, cmpl;
maxNWSR = 0;
avgNWSR = 0;
maxCPUtime = 0.0;
avgCPUtime = 0.0;
maxStationarity = 0.0;
maxFeasibility = 0.0;
maxComplementarity = 0.0;
/* 2) Pointers to data of current QP ... */
const real_t* gCur;
const real_t* lbCur;
const real_t* ubCur;
/* 3) Vectors for solution obtained by qpOASES. */
real_t* x = new real_t[nV];
real_t* y = new real_t[nV];
//real_t obj;
/* 4) Prepare matrix objects */
SymmetricMatrix *H;
real_t* H_cpy = new real_t[nV*nV];
memcpy( H_cpy,_H, ((uint_t)(nV*nV))*sizeof(real_t) );
if ( isSparse == BT_TRUE )
{
SymSparseMat *Hs;
H = Hs = new SymSparseMat(nV, nV, nV, H_cpy);
Hs->createDiagInfo();
delete[] H_cpy;
}
else
{
H = new SymDenseMat(nV, nV, nV, const_cast<real_t *>(H_cpy));
}
H->doFreeMemory( );
/* II) SETUP QPROBLEM OBJECT */
QProblemB qp( nV );
qp.setOptions( options );
//qp.setPrintLevel( PL_LOW );
/* III) RUN BENCHMARK SEQUENCE: */
returnValue returnvalue;
for( k=0; k<nQP; ++k )
{
//if ( k%50 == 0 )
// printf( "%d\n",k );
/* 1) Update pointers to current QP data. */
gCur = &( g[k*nV] );
lbCur = &( lb[k*nV] );
ubCur = &( ub[k*nV] );
/* 2) Set nWSR and maximum CPU time. */
nWSRcur = maxAllowedNWSR;
CPUtimeCur = CPUtimeLimit;
/* 3) Solve current QP. */
if ( ( k == 0 ) || ( useHotstarts == BT_FALSE ) )
{
/* initialise */
returnvalue = qp.init( H,gCur,lbCur,ubCur, nWSRcur,&CPUtimeCur );
if ( ( returnvalue != SUCCESSFUL_RETURN ) && ( returnvalue != RET_MAX_NWSR_REACHED ) )
{
delete H; delete[] y; delete[] x;
return THROWERROR( returnvalue );
}
}
else
{
/* hotstart */
returnvalue = qp.hotstart( gCur,lbCur,ubCur, nWSRcur,&CPUtimeCur );
if ( ( returnvalue != SUCCESSFUL_RETURN ) && ( returnvalue != RET_MAX_NWSR_REACHED ) )
{
delete H; delete[] y; delete[] x;
//.........这里部分代码省略.........