本文整理匯總了C++中ACADOERROR函數的典型用法代碼示例。如果您正苦於以下問題:C++ ACADOERROR函數的具體用法?C++ ACADOERROR怎麽用?C++ ACADOERROR使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了ACADOERROR函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C++代碼示例。
示例1: ACADOERROR
uint ModelData::addOutput( const std::string& output, const std::string& diffs_output, const uint dim,
const Grid& grid, const std::string& colInd, const std::string& rowPtr ){
DVector colIndV, rowPtrV;
colIndV.read( colInd.c_str() );
rowPtrV.read( rowPtr.c_str() );
if( rowPtrV.getDim() != (dim+1) ) {
return ACADOERROR( RET_INVALID_OPTION );
}
colInd_outputs.push_back( colIndV );
rowPtr_outputs.push_back( rowPtrV );
return addOutput( output, diffs_output, dim, grid );
}
示例2: find
returnValue LogRecord::setLast( uint _name,
LogRecordItemType _type,
const Matrix& value,
double time
)
{
LogRecordItem* item = find( _name,_type );
// checks if item exists
if ( ( item != 0 ) && ( item->isWriteProtected( ) == BT_FALSE ) )
{
if ( item->setValue( frequency,value,time ) != SUCCESSFUL_RETURN )
return ACADOERROR( RET_LOG_RECORD_CORRUPTED );
}
return SUCCESSFUL_RETURN;
}
示例3: ACADOERROR
returnValue QPsolver_qpOASES::solve( double* H,
double* A,
double* g,
double* lb,
double* ub,
double* lbA,
double* ubA,
uint maxIter
)
{
if ( qp == 0 )
return ACADOERROR( RET_INITIALIZE_FIRST );
/* call to qpOASES, using hotstart if possible and desired */
numberOfSteps = maxIter;
qpOASES::returnValue returnvalue;
qpStatus = QPS_SOLVING;
//printf( "nV: %d, nC: %d \n",qp->getNV(),qp->getNC() );
if ( (bool)qp->isInitialised( ) == false )
{
returnvalue = qp->init( H,g,A,lb,ub,lbA,ubA,numberOfSteps,0 );
}
else
{
int performHotstart = 0;
get( HOTSTART_QP,performHotstart );
if ( (bool)performHotstart == true )
{
returnvalue = qp->hotstart( H,g,A,lb,ub,lbA,ubA,numberOfSteps,0 );
}
else
{
/* if no hotstart is desired, reset QP and use cold start */
qp->reset( );
returnvalue = qp->init( H,g,A,lb,ub,lbA,ubA,numberOfSteps,0 );
}
}
setLast( LOG_NUM_QP_ITERATIONS, numberOfSteps );
/* update QP status and determine return value */
return updateQPstatus( returnvalue );
}
示例4: ACADOERROR
returnValue ModelData::setMeasurements( const Vector& numberMeasurements ){
int i;
if( outputExpressions.size() != numberMeasurements.getDim() && outputNames.size() != numberMeasurements.getDim() ) {
return ACADOERROR( RET_INVALID_OPTION );
}
outputGrids.clear();
num_meas.clear();
for( i = 0; i < (int)numberMeasurements.getDim(); i++ ) {
Grid nextGrid( 0.0, 1.0, (int)numberMeasurements(i) + 1 );
outputGrids.push_back( nextGrid );
uint numOuts = (int) ceil((double)outputGrids[i].getNumIntervals()/((double) N) - 10.0*EPS);
num_meas.push_back( numOuts );
}
return SUCCESSFUL_RETURN;
}
示例5: integrate
returnValue Integrator::integrate( const Grid &t_,
double *x0,
double *xa,
double *p ,
double *u ,
double *w ){
if( rhs == 0 ) return ACADOERROR( RET_TRIVIAL_RHS );
Vector components = rhs->getDifferentialStateComponents();
Vector tmpX ( components.getDim(), x0 );
Vector tmpXA( rhs->getNXA() , xa );
Vector tmpP ( rhs->getNP () , p );
Vector tmpU ( rhs->getNU () , u );
Vector tmpW ( rhs->getNW () , w );
return integrate( t_, tmpX, tmpXA, tmpP, tmpU, tmpW );
}
示例6: ACADOERROR
returnValue Actuator::init( double _startTime,
const Vector& _startValueU,
const Vector& _startValueP
)
{
Vector tmp;
if ( _startValueU.isEmpty( ) == BT_FALSE )
tmp.append( _startValueU );
if ( _startValueP.isEmpty( ) == BT_FALSE )
tmp.append( _startValueP );
if ( TransferDevice::init( _startTime,tmp ) != SUCCESSFUL_RETURN )
return ACADOERROR( RET_ACTUATOR_INIT_FAILED );
return SUCCESSFUL_RETURN;
}
示例7: ceil
uint ModelData::addOutput( const std::string& output, const std::string& diffs_output, const uint dim, const Grid& grid ){
if( outputExpressions.size() == 0 && differentialEquation.getNumDynamicEquations() == 0 ) {
outputNames.push_back( output );
diffs_outputNames.push_back( diffs_output );
dim_outputs.push_back( dim );
outputGrids.push_back( grid );
uint numOuts = (int) ceil((double)grid.getNumIntervals());
num_meas.push_back( numOuts );
}
else {
return ACADOERROR( RET_INVALID_OPTION );
}
return dim_outputs.size();
}
示例8: ACADOERROR
returnValue Sensor::setOutputNoise( const Noise& _noise,
double _noiseSamplingTime
)
{
if ( _noise.getDim( ) != getNY( ) )
return ACADOERROR( RET_INVALID_ARGUMENTS );
for( uint i=0; i<getNY( ); ++i )
{
if ( additiveNoise[i] != 0 )
delete additiveNoise[i];
additiveNoise[i] = _noise.clone( i );
}
noiseSamplingTimes.setAll( _noiseSamplingTime );
return SUCCESSFUL_RETURN;
}
示例9: ASSERT
returnValue Integrator::diffTransitionForward( Vector &DX,
const Vector &DP,
const Vector &DU,
const Vector &DW,
const int &order ){
ASSERT( transition != 0 );
EvaluationPoint z( *transition, DX.getDim(), 0, DP.getDim(), DU.getDim(), DW.getDim() );
z.setX ( DX );
z.setP ( DP );
z.setU ( DU );
z.setW ( DW );
if( order == 1 ) DX = transition->AD_forward( z );
if( order != 1 ) return ACADOERROR( RET_NOT_IMPLEMENTED_YET );
return SUCCESSFUL_RETURN;
}
示例10: switch
returnValue PlotWindow::getDataGrids( const VariablesGrid* const variablesGrid,
VariableType& _type,
VariablesGrid& _dataGrid,
Grid& _discretizationGrid
)
{
_dataGrid.init();
_discretizationGrid.init( );
_type = variablesGrid->getType( );
InterpolationMode mode = IM_LINEAR;
if ( ( _type == VT_CONTROL ) || ( _type == VT_PARAMETER ) )
mode = IM_CONSTANT;
switch ( mode )
{
case IM_CONSTANT:
_discretizationGrid.addTime( 0.0 );
for( uint i=0; i<variablesGrid->getNumPoints( )-1; ++i )
{
_dataGrid.addVector( variablesGrid->getVector(i),variablesGrid->getTime(i) );
_dataGrid.addVector( variablesGrid->getVector(i),variablesGrid->getTime(i+1) );
_discretizationGrid.addTime( (double)_dataGrid.getNumPoints() );
}
_dataGrid.addVector( variablesGrid->getLastVector(),variablesGrid->getLastTime() );
_discretizationGrid.addTime( (double)_dataGrid.getNumPoints() );
break;
case IM_LINEAR:
_dataGrid = *variablesGrid;
break;
default:
return ACADOERROR( RET_NOT_YET_IMPLEMENTED );
}
_dataGrid.setType( _type );
return SUCCESSFUL_RETURN;
}
示例11: ASSERT
VariablesGrid VariablesGrid::operator()( const uint rowIdx
) const
{
ASSERT( values != 0 );
if ( rowIdx >= getNumRows( ) )
{
ACADOERROR( RET_INDEX_OUT_OF_BOUNDS );
return VariablesGrid();
}
Grid tmpGrid;
getGrid( tmpGrid );
VariablesGrid rowGrid( 1,tmpGrid,getType( ) );
for( uint run1 = 0; run1 < getNumPoints(); run1++ )
rowGrid( run1,0 ) = values[run1]->operator()( rowIdx,0 );
return rowGrid;
}
示例12: ACADOERROR
returnValue SCPmethod::getAnySensitivities( BlockMatrix& _sens,
uint idx
) const
{
if ( idx > 4 )
return ACADOERROR( RET_INVALID_ARGUMENTS );
uint N = bandedCP.dynGradient.getNumRows();
Matrix tmp;
_sens.init( N,1 );
for( uint i=0; i<N; ++i )
{
bandedCP.dynGradient.getSubBlock( i,idx,tmp );
_sens.setDense( i,0,tmp );
}
return SUCCESSFUL_RETURN;
}
示例13: ASSERT
returnValue CFunction::AD_backward( int number, double *seed, double *df ){
uint run1;
ASSERT( number < (int) maxAlloc );
if( cFcnDBackward != NULL ){
double *f = new double[dim];
cFcnDBackward( number, xStore[number], seed, f, df, user_data );
for( run1 = 0; run1 < nn; run1++ )
seedStore[number][run1] = seed[run1];
delete[] f;
return SUCCESSFUL_RETURN;
}
return ACADOERROR(RET_INVALID_USE_OF_FUNCTION);
}
示例14: ACADOERROR
returnValue Objective::evaluateSensitivitiesGN( BlockMatrix &hessian ){
returnValue returnvalue;
uint run1;
hessian.setZero();
if( nMayer != 0 )
return ACADOERROR(RET_GAUSS_NEWTON_APPROXIMATION_NOT_SUPPORTED);
for( run1 = 0; run1 < nLSQ; run1++ ){
returnvalue = lsqTerm[run1]->evaluateSensitivitiesGN( &hessian );
if( returnvalue != SUCCESSFUL_RETURN ) return returnvalue;
}
for( run1 = 0; run1 < nEndLSQ; run1++ ){
returnvalue = lsqEndTerm[run1]->evaluateSensitivitiesGN( &hessian );
if( returnvalue != SUCCESSFUL_RETURN ) return returnvalue;
}
return SUCCESSFUL_RETURN;
}
示例15: fopen
returnValue VectorspaceElement::printToFile( const char* const filename,
const char* const name,
const char* const startString,
const char* const endString,
uint width,
uint precision,
const char* const colSeparator,
const char* const rowSeparator
) const
{
FILE* file = fopen( filename,"w+" );
if ( file == 0 )
return ACADOERROR( RET_FILE_CAN_NOT_BE_OPENED );
printToFile( file, name,startString,endString,width,precision,colSeparator,rowSeparator );
fclose( file );
return SUCCESSFUL_RETURN;
}