Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00037 #include <qpOASES.hpp>
00038
00039
00041 int main( )
00042 {
00043 USING_NAMESPACE_QPOASES
00044
00045
00046 real_t H[2*2] = { 1.0, 0.0, 0.0, 0.5 };
00047 real_t A[1*2] = { 1.0, 1.0 };
00048 real_t g[2] = { 1.5, 1.0 };
00049 real_t lb[2] = { 0.5, -2.0 };
00050 real_t ub[2] = { 5.0, 2.0 };
00051 real_t lbA[1] = { -1.0 };
00052 real_t ubA[1] = { 2.0 };
00053
00054
00055 real_t H_new[2*2] = { 1.0, 0.5, 0.5, 0.5 };
00056 real_t A_new[1*2] = { 1.0, 5.0 };
00057 real_t g_new[2] = { 1.0, 1.5 };
00058 real_t lb_new[2] = { 0.0, -1.0 };
00059 real_t ub_new[2] = { 5.0, -0.5 };
00060 real_t lbA_new[1] = { -2.0 };
00061 real_t ubA_new[1] = { 1.0 };
00062
00063
00064
00065 SQProblem example( 2,1 );
00066 SolutionAnalysis analyser;
00067
00068
00069 int nWSR = 10;
00070 example.init( H,g,A,lb,ub,lbA,ubA, nWSR,0 );
00071
00072
00073 real_t maxKKTviolation;
00074 analyser.getMaxKKTviolation( &example, maxKKTviolation );
00075 printf( "maxKKTviolation: %e\n", maxKKTviolation );
00076
00077
00078 nWSR = 10;
00079 example.hotstart( H_new,g_new,A_new,lb_new,ub_new,lbA_new,ubA_new, nWSR,0 );
00080
00081
00082 analyser.getMaxKKTviolation( &example, maxKKTviolation );
00083 printf( "maxKKTviolation: %e\n", maxKKTviolation );
00084
00085
00086
00087
00088 real_t *Var = new real_t[5*5];
00089 real_t *Primal_Dual_Var = new real_t[5*5];
00090
00091 int run1, run2;
00092 for( run1 = 0; run1 < 5*5; run1++ )
00093 Var[run1] = 0.0;
00094
00095 Var[0] = 1.0;
00096 Var[6] = 1.0;
00097
00098
00099
00100
00101
00102
00103
00104
00105 analyser.getVarianceCovariance( &example, Var,Primal_Dual_Var );
00106
00107 printf("\nPrimal_Dual_VAR = \n");
00108 for( run1 = 0; run1 < 5; run1++ ){
00109 for( run2 = 0; run2 < 5; run2++ ){
00110 printf(" %10f", Primal_Dual_Var[run1*5+run2]);
00111 }
00112 printf("\n");
00113 }
00114
00115 delete[] Primal_Dual_Var;
00116 delete[] Var;
00117
00118 return 0;
00119 }
00120
00121
00122
00123
00124