本文整理汇总了C++中DVector::print方法的典型用法代码示例。如果您正苦于以下问题:C++ DVector::print方法的具体用法?C++ DVector::print怎么用?C++ DVector::print使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DVector
的用法示例。
在下文中一共展示了DVector::print方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main( ){
USING_NAMESPACE_ACADO
// INTRODUCE THE VARIABLES:
// -------------------------
Parameter a, b;
// DEFINE AN OPTIMAL CONTROL PROBLEM:
// ----------------------------------
NLP nlp;
nlp.minimize ( a*a + b*b );
nlp.subjectTo( 0.08 <= a );
nlp.subjectTo( 0.1 <= a + b + 0.3*a*a );
// DEFINE AN OPTIMIZATION ALGORITHM AND SOLVE THE NLP:
// ---------------------------------------------------
OptimizationAlgorithm algorithm(nlp);
algorithm.solve();
// PRINT OPTIMAL SOLUTION:
// -----------------------
DVector results;
algorithm.getParameters( results );
results.print( "optimal solution" );
return 0;
}
示例2: main
/* >>> start tutorial code >>> */
int main( ){
USING_NAMESPACE_ACADO
// DEFINE VALRIABLES:
// ---------------------------
DMatrix A(3,3);
DVector b(3) ;
DifferentialState x("", 3, 1);
Function f ;
// DEFINE THE VECTOR AND MATRIX ENTRIES:
// -------------------------------------
A.setZero() ;
A(0,0) = 1.0; A(1,1) = 2.0; A(2,2) = 3.0;
b(0) = 1.0; b(1) = 1.0; b(2) = 1.0;
// DEFINE A TEST FUNCTION:
// -----------------------
f << A*x + b;
f << ( A*x(0) ).getRow( 1 );
f << ( A*x(0) ).getCol( 0 );
// TEST THE FUNCTION f:
// --------------------
EvaluationPoint zz(f);
DVector xx(3);
xx(0) = 1.0;
xx(1) = 2.0;
xx(2) = 3.0;
zz.setX( xx );
DVector result = f.evaluate( zz );
result.print(std::cout, "result");
return 0;
}
示例3: feedbackStep
returnValue SCPmethod::feedbackStep( const DVector& x0_,
const DVector& p_
)
{
#ifdef SIM_DEBUG
printf("START OF THE FEEDBACK STEP \n");
x0_.print("x0");
#endif
returnValue returnvalue;
if ( ( status != BS_READY ) && ( status != BS_RUNNING ) )
return ACADOERROR( RET_INITIALIZE_FIRST );
clockTotalTime.reset( );
clockTotalTime.start( );
status = BS_RUNNING;
hasPerformedStep = BT_FALSE;
if ( checkForRealTimeMode( x0_,p_ ) != SUCCESSFUL_RETURN )
return ACADOERROR( RET_NLP_STEP_FAILED );
int hessianMode;
get( HESSIAN_APPROXIMATION,hessianMode );
if ( ( isInRealTimeMode == BT_FALSE ) && ( (HessianApproximationMode)hessianMode == EXACT_HESSIAN ) )
{
returnvalue = initializeHessianProjection();
if( returnvalue != SUCCESSFUL_RETURN )
return ACADOERROR( returnvalue );
}
//bandedCP.objectiveGradient.print();
//x0_.print("x0");
if ( isInRealTimeMode == BT_TRUE )
{
if ( setupRealTimeParameters( x0_,p_ ) != SUCCESSFUL_RETURN )
return ACADOERROR( RET_NLP_STEP_FAILED );
}
int printLevel;
get( PRINTLEVEL,printLevel );
if ( (PrintLevel)printLevel >= HIGH )
cout << "--> Solving banded QP ...\n";
// iter.print();
if ( bandedCPsolver->solve( bandedCP ) != SUCCESSFUL_RETURN )
return ACADOERROR( RET_NLP_STEP_FAILED );
// bandedCP.deltaX.print();
if ( (PrintLevel)printLevel >= HIGH )
cout << "<-- Solving banded QP done.\n";
++numberOfSteps;
return SUCCESSFUL_RETURN;
}