• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ ACADOERROR函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中ACADOERROR函数的典型用法代码示例。如果您正苦于以下问题:C++ ACADOERROR函数的具体用法?C++ ACADOERROR怎么用?C++ ACADOERROR使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了ACADOERROR函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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 );
}
开发者ID:RobotXiaoFeng,项目名称:acado,代码行数:17,代码来源:model_data.cpp


示例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;
}
开发者ID:drewm1980,项目名称:acado,代码行数:17,代码来源:log_record.cpp


示例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 );
}
开发者ID:ferreau,项目名称:acado,代码行数:45,代码来源:qp_solver_qpoases.cpp


示例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;
}
开发者ID:francesco-romano,项目名称:acado,代码行数:18,代码来源:model_data.cpp


示例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 );
}
开发者ID:drewm1980,项目名称:acado,代码行数:18,代码来源:integrator.cpp


示例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;
}
开发者ID:ThomasBesselmann,项目名称:acado,代码行数:18,代码来源:actuator.cpp


示例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();
}
开发者ID:RobotXiaoFeng,项目名称:acado,代码行数:18,代码来源:model_data.cpp


示例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;
}
开发者ID:ThomasBesselmann,项目名称:acado,代码行数:19,代码来源:sensor.cpp


示例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;
}
开发者ID:drewm1980,项目名称:acado,代码行数:19,代码来源:integrator.cpp


示例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;
}
开发者ID:OspreyX,项目名称:acado,代码行数:42,代码来源:plot_window.cpp


示例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;
}
开发者ID:rtkg,项目名称:acado,代码行数:20,代码来源:variables_grid.cpp


示例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;
}
开发者ID:drewm1980,项目名称:acado,代码行数:20,代码来源:scp_method.cpp


示例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);
}
开发者ID:OspreyX,项目名称:acado,代码行数:20,代码来源:c_function.cpp


示例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;
}
开发者ID:rtkg,项目名称:acado,代码行数:20,代码来源:objective.cpp


示例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;
}
开发者ID:rtkg,项目名称:acado,代码行数:20,代码来源:vectorspace_element.cpp


示例16: ASSERT

returnValue DenseQPsolver::solveCP( DenseCP *cp )
{
    ASSERT( cp != 0 );

    if( cp->isQP() == BT_FALSE )
        return ACADOERROR( RET_QP_SOLVER_CAN_ONLY_SOLVE_QP );


    // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

    // QUICK HACK: SOLVE CALL SHOULD AVOID PASSING THE MAX-ITER ARGUMENT !!!


    const uint maxIter = 1000;

    // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!


    returnValue returnvalue;
    returnvalue = solve( &cp->H, &cp->A, &cp->g, &cp->lb, &cp->ub, &cp->lbA, &cp->ubA, maxIter );

    if( returnvalue != SUCCESSFUL_RETURN )
        return returnvalue;



    // GET THE PRIMAL AND DUAL SOLUTION FROM THE QP SOLVER AND
    // STORE THEM IN THE RIGHT FORMAT:
    // -------------------------------------------------------
    Vector xOpt, yOpt;

    getPrimalSolution( xOpt );
    getDualSolution  ( yOpt );
// 	printf( "DeltaU0 = [ %e, %e ]\n", xOpt(4+0),xOpt(4+1) );

// 	cp->lb.print("lb");

    cp->setQPsolution( xOpt, yOpt );
	
    return SUCCESSFUL_RETURN;
}
开发者ID:rtkg,项目名称:acado,代码行数:41,代码来源:dense_qp_solver.cpp


示例17: acadoPrintf

returnValue SCPmethod::getFirstControl( Vector& u0_  ) const
{
	#ifdef SIM_DEBUG
	acadoPrintf( "SCPmethod::getFirstControl\n" );
	#endif
	
    if( iter.u == 0 )
		return ACADOERROR( RET_MEMBER_NOT_INITIALISED );

    u0_ = iter.u->getVector( 0 );
	
	if ( hasPerformedStep == BT_FALSE )
	{
		Vector deltaU0( getNU() );
		bandedCPsolver->getFirstControl( deltaU0 );
		
		u0_ += deltaU0;
	}

    return SUCCESSFUL_RETURN;
}
开发者ID:drewm1980,项目名称:acado,代码行数:21,代码来源:scp_method.cpp


示例18: switch

returnValue OCP::subjectTo( const TimeHorizonElement index_, const ConstraintComponent& component ){

    uint i;

    switch( index_ ){

        case AT_START:
             for( i = 0; i < component.getDim(); i++ )
                 ACADO_TRY( constraint.add( 0,component(i) ) );
             return SUCCESSFUL_RETURN;

        case AT_END:
             for( i = 0; i < component.getDim(); i++ )
                 ACADO_TRY( constraint.add( grid.getLastIndex(),component(i) ) );
             return SUCCESSFUL_RETURN;

        default:
             return ACADOERROR(RET_UNKNOWN_BUG);
    }
    return SUCCESSFUL_RETURN;
}
开发者ID:rtkg,项目名称:acado,代码行数:21,代码来源:ocp.cpp


示例19: times

OCP::OCP( const double &tStart_, const double &tEnd_, const Vector& _numSteps )
    :MultiObjectiveFunctionality(){

        if( _numSteps.getDim() <= 0 ) ACADOERROR( RET_INVALID_ARGUMENTS );
      
	Vector times( _numSteps.getDim()+1 );
	times(0) = tStart_;
	
	double totalSteps = 0;
	uint i;
	for( i = 0; i < _numSteps.getDim(); i++ ) {
		totalSteps += _numSteps(i);
	}
	double h = (tEnd_ - tStart_)/totalSteps;
	for( i = 0; i < _numSteps.getDim(); i++ ) {
		times(i+1) = times(i) + h*_numSteps(i);
	}
	
    setupGrid( times );
    modelData.setIntegrationGrid(grid, totalSteps);
}
开发者ID:drewm1980,项目名称:acado,代码行数:21,代码来源:ocp.cpp


示例20: ACADOERROR

returnValue PointConstraint::add( const double lb_, const Expression& arg, const double ub_  ){

    if( fcn == 0 )
        return ACADOERROR(RET_MEMBER_NOT_INITIALISED);

    // CHECK FOR A SIMPLE BOUND:
    // -------------------------

    VariableType varType   = arg.getVariableType( );
    int          component = arg.getComponent   (0);

    if( arg.isVariable() == BT_TRUE ){
        if( varType != VT_INTERMEDIATE_STATE ){

             nb++;
             var   = (VariableType*)realloc(var  , nb*sizeof(VariableType));
             index = (int*         )realloc(index, nb*sizeof(int         ));
             blb   = (double*      )realloc(blb  , nb*sizeof(double      ));
             bub   = (double*      )realloc(bub  , nb*sizeof(double      ));

             var  [nb-1] = varType  ;
             index[nb-1] = component;
             blb  [nb-1] = lb_      ;
             bub  [nb-1] = ub_      ;
        }
    }

    // ADD THE ARGUMENT TO THE FUNCTION TO BE EVALUATED:
    // -------------------------------------------------

    fcn[0] << arg;

    lb[0] = (double*)realloc(lb[0],fcn[0].getDim()*sizeof(double));
    ub[0] = (double*)realloc(ub[0],fcn[0].getDim()*sizeof(double));

    ub[0][fcn[0].getDim()-1] = ub_;
    lb[0][fcn[0].getDim()-1] = lb_;

    return SUCCESSFUL_RETURN;
}
开发者ID:OspreyX,项目名称:acado,代码行数:40,代码来源:point_constraint.cpp



注:本文中的ACADOERROR函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ ACCESS函数代码示例发布时间:2022-05-30
下一篇:
C++ ABTS_STR_EQUAL函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap