qrecipe.cpp
Go to the documentation of this file.
00001 /*
00002  *      This file is part of qpOASES.
00003  *
00004  *      qpOASES -- An Implementation of the Online Active Set Strategy.
00005  *      Copyright (C) 2007-2011 by Hans Joachim Ferreau, Andreas Potschka,
00006  *      Christian Kirches et al. All rights reserved.
00007  *
00008  *      qpOASES is free software; you can redistribute it and/or
00009  *      modify it under the terms of the GNU Lesser General Public
00010  *      License as published by the Free Software Foundation; either
00011  *      version 2.1 of the License, or (at your option) any later version.
00012  *
00013  *      qpOASES is distributed in the hope that it will be useful,
00014  *      but WITHOUT ANY WARRANTY; without even the implied warranty of
00015  *      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
00016  *      See the GNU Lesser General Public License for more details.
00017  *
00018  *      You should have received a copy of the GNU Lesser General Public
00019  *      License along with qpOASES; if not, write to the Free Software
00020  *      Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
00021  *
00022  */
00023 
00024 
00036 #include <qpOASES.hpp>
00037 
00038 USING_NAMESPACE_QPOASES
00039 
00040 const real_t Inf = INFTY;
00041 
00042 long H_jc[] = {0, 4, 8, 12, 16, 20, 24, 28, 32, 36, 40, 44, 48, 52, 56, 60, 64,
00043         68, 72, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76,
00044         76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76,
00045         76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76,
00046         76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76,
00047         76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76,
00048         76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76,
00049         76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76,
00050         76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76,
00051         76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76};
00052 
00053 long H_ir[] = {0, 10, 20, 34, 1, 11, 21, 35, 2, 12, 22, 36, 3, 13, 23, 37, 4, 14,
00054         24, 38, 0, 10, 20, 34, 1, 11, 21, 35, 2, 12, 22, 36, 3, 13, 23, 37, 4, 14,
00055         24, 38, 0, 10, 20, 34, 1, 11, 21, 35, 2, 12, 22, 36, 3, 13, 23, 37, 4, 14,
00056         24, 38, 0, 10, 20, 34, 1, 11, 21, 35, 2, 12, 22, 36, 3, 13, 23, 37, 4, 14,
00057         24, 38};
00058 
00059 real_t H_val[] = {10, 1, 1, 1, 10, 1, 1, 1, 10, 1, 1, 1, 10, 1, 1, 1, 10, 1, 1,
00060         1, 1, 10, 1, 1, 1, 10, 1, 1, 1, 10, 1, 1, 1, 10, 1, 1, 1, 10, 1, 1, 1, 1,
00061         10, 1, 1, 1, 10, 1, 1, 1, 10, 1, 1, 1, 10, 1, 1, 1, 10, 1, 1, 1, 1, 10, 1,
00062         1, 1, 10, 1, 1, 1, 10, 1, 1, 1, 10, 1, 1, 1, 10};
00063 
00064 long A_jc[] = {0, 10,  20,  30,  40,  50,  60,  70,  80,  90, 100, 110, 120,
00065         130, 140, 150, 160, 170, 180, 190, 200, 210, 220, 230, 240, 250, 260, 270,
00066         280, 290, 300, 301, 302, 303, 304, 305, 306, 307, 308, 309, 310, 311, 312,
00067         313, 314, 318, 319, 320, 321, 322, 323, 324, 325, 326, 327, 328, 329, 331,
00068         333, 335, 337, 339, 341, 343, 345, 347, 349, 351, 353, 355, 357, 359, 361,
00069         363, 365, 367, 369, 371, 373, 383, 393, 403, 405, 408, 410, 413, 415, 418,
00070         420, 422, 424, 426, 428, 430, 432, 434, 436, 438, 440, 442, 444, 446, 448,
00071         450, 452, 454, 456, 458, 460, 462, 472, 482, 492, 494, 497, 499, 502, 504,
00072         507, 509, 511, 513, 515, 517, 519, 521, 523, 525, 527, 529, 531, 533, 535,
00073         537, 539, 541, 543, 545, 547, 549, 551, 561, 571, 581, 583, 586, 588, 591,
00074         593, 596, 597, 598, 599, 600, 601, 602, 603, 604, 605, 606, 607, 608, 609,
00075         610, 611, 612, 613, 614, 615, 616, 617, 618, 628, 638, 648, 650, 653, 655,
00076         658, 660};
00077 
00078 long A_ir[] = {0, 14, 35, 36, 71, 72, 85, 86, 87, 88, 1, 14, 35, 36, 71, 72, 85,
00079         86, 87, 88, 2, 14, 35, 36, 71, 72, 85, 86, 87, 88, 3, 14, 35, 36, 71, 72,
00080         85, 86, 87, 88, 4, 14, 35, 36, 71, 72, 85, 86, 87, 88, 5, 14, 35, 36, 71,
00081         72, 85, 86, 87, 88, 6, 14, 35, 36, 71, 72, 85, 86, 87, 88, 7, 14, 35, 36,
00082         71, 72, 85, 86, 87, 88, 8, 14, 35, 36, 71, 72, 85, 86, 87, 88, 9, 14, 35,
00083         36, 71, 72, 85, 86, 87, 88, 0, 15, 37, 38, 69, 70, 79, 80, 81, 82, 1, 15,
00084         37, 38, 69, 70, 79, 80, 81, 82, 2, 15, 37, 38, 69, 70, 79, 80, 81, 82, 3,
00085         15, 37, 38, 69, 70, 79, 80, 81, 82, 4, 15, 37, 38, 69, 70, 79, 80, 81, 82,
00086         5, 15, 37, 38, 69, 70, 79, 80, 81, 82, 6, 15, 37, 38, 69, 70, 79, 80, 81,
00087         82, 7, 15, 37, 38, 69, 70, 79, 80, 81, 82, 8, 15, 37, 38, 69, 70, 79, 80,
00088         81, 82, 9, 15, 37, 38, 69, 70, 79, 80, 81, 82, 0, 16, 39, 40, 67, 68, 73,
00089         74, 75, 76, 1, 16, 39, 40, 67, 68, 73, 74, 75, 76, 2, 16, 39, 40, 67, 68,
00090         73, 74, 75, 76, 3, 16, 39, 40, 67, 68, 73, 74, 75, 76, 4, 16, 39, 40, 67,
00091         68, 73, 74, 75, 76, 5, 16, 39, 40, 67, 68, 73, 74, 75, 76, 6, 16, 39, 40,
00092         67, 68, 73, 74, 75, 76, 7, 16, 39, 40, 67, 68, 73, 74, 75, 76, 8, 16, 39,
00093         40, 67, 68, 73, 74, 75, 76, 9, 16, 39, 40, 67, 68, 73, 74, 75, 76, 10, 11,
00094         12, 13, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 47, 48, 49, 50, 51,
00095         52, 53, 54, 55, 56, 57, 47, 58, 48, 59, 49, 60, 50, 61, 51, 62, 52, 63, 53,
00096         64, 54, 65, 55, 66, 46, 56, 45, 57, 47, 58, 48, 59, 49, 60, 50, 61, 51, 62,
00097         52, 63, 53, 64, 54, 65, 55, 66, 46, 56, 45, 57, 10, 14, 71, 72, 85, 86, 87,
00098         88, 89, 90, 11, 15, 69, 70, 79, 80, 81, 82, 83, 84, 12, 16, 67, 68, 73, 74,
00099         75, 76, 77, 78, 35, 90, 36, 89, 90, 37, 84, 38, 83, 84, 39, 78, 40, 77, 78,
00100         44, 58, 43, 59, 42, 60, 41, 61, 34, 62, 33, 63, 32, 64, 31, 65, 30, 66, 29,
00101         46, 28, 45, 44, 58, 43, 59, 42, 60, 41, 61, 34, 62, 33, 63, 32, 64, 31, 65,
00102         30, 66, 29, 46, 28, 45, 10, 14, 71, 72, 85, 86, 87, 88, 89, 90, 11, 15, 69,
00103         70, 79, 80, 81, 82, 83, 84, 12, 16, 67, 68, 73, 74, 75, 76, 77, 78, 35, 90,
00104         36, 89, 90, 37, 84, 38, 83, 84, 39, 78, 40, 77, 78, 27, 44, 26, 43, 25, 42,
00105         24, 41, 23, 34, 22, 33, 21, 32, 20, 31, 19, 30, 18, 29, 17, 28, 27, 44, 26,
00106         43, 25, 42, 24, 41, 23, 34, 22, 33, 21, 32, 20, 31, 19, 30, 18, 29, 17, 28,
00107         10, 14, 71, 72, 85, 86, 87, 88, 89, 90, 11, 15, 69, 70, 79, 80, 81, 82, 83,
00108         84, 12, 16, 67, 68, 73, 74, 75, 76, 77, 78, 35, 90, 36, 89, 90, 37, 84, 38,
00109         83, 84, 39, 78, 40, 77, 78, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17, 27,
00110         26, 25, 24, 23, 22, 21, 20, 19, 18, 17, 10, 14, 71, 72, 85, 86, 87, 88, 89,
00111         90, 11, 15, 69, 70, 79, 80, 81, 82, 83, 84, 12, 16, 67, 68, 73, 74, 75, 76,
00112         77, 78, 35, 90, 36, 89, 90, 37, 84, 38, 83, 84, 39, 78, 40, 77, 78};
00113 
00114 real_t A_val[] = {
00115 -1.0000000000000000e+00,  1.0000000000000000e+00,  8.8678200000000004e+01,
00116  9.3617050000000006e+01,  1.6000000000000000e+01,  8.1999999999999993e+00,
00117  9.9000000000000000e+01,  8.0000000000000000e+01,  1.2000000000000000e+01,
00118  9.0000000000000000e+00, -1.0000000000000000e+00,  1.0000000000000000e+00,
00119  8.0062830000000005e+01,  9.9224010000000007e+01,  1.0000000000000000e+02,
00120  2.1100000000000001e+01,  1.0000000000000000e+02,  1.0000000000000000e+02,
00121  1.1400000000000000e+02,  1.1680000000000000e+02, -1.0000000000000000e+00,
00122  1.0000000000000000e+00,  7.4697360000000003e+01,  8.3801220000000001e+01,
00123 -8.1999999999999993e+00,  2.0000000000000000e+00,  9.0000000000000000e+01,
00124  2.3999999999999999e+00, -1.2000000000000000e+01, -1.4800000000000001e+01,
00125 -1.0000000000000000e+00,  1.0000000000000000e+00,  7.9194209999999998e+01,
00126  9.0175110000000004e+01,  4.3000000000000000e+01,  8.0000000000000000e+00,
00127  1.0000000000000000e+02,  9.5000000000000000e+01,  9.0000000000000000e+00,
00128  2.0000000000000000e+00, -1.0000000000000000e+00,  1.0000000000000000e+00,
00129  7.8568219999999997e+01,  8.5996200000000002e+01, -1.2500000000000000e+01,
00130  1.0000000000000000e+00,  9.6500000000000000e+01,  4.0000000000000000e+00,
00131 -1.8000000000000000e+01, -2.1899999999999999e+01, -1.0000000000000000e+00,
00132  1.0000000000000000e+00,  8.2922240000000002e+01,  8.6963380000000001e+01,
00133  6.5000000000000000e+01,  1.2500000000000000e+01,  1.0000000000000000e+02,
00134  9.8000000000000000e+01,  4.9000000000000000e+01,  3.7000000000000000e+01,
00135 -1.0000000000000000e+00,  1.0000000000000000e+00,  8.2592740000000006e+01,
00136  9.3147599999999997e+01, -1.2000000000000000e+01,  1.0000000000000000e+00,
00137  9.6500000000000000e+01,  4.0000000000000000e+00, -1.8000000000000000e+01,
00138 -2.1899999999999999e+01, -1.0000000000000000e+00,  1.0000000000000000e+00,
00139  7.6506460000000004e+01,  7.8210250000000002e+01,  7.9000000000000000e+01,
00140  1.2000000000000000e+01,  1.0000000000000000e+02,  9.5000000000000000e+01,
00141  6.8000000000000000e+01,  6.1000000000000000e+01, -1.0000000000000000e+00,
00142  1.0000000000000000e+00,  8.8357460000000003e+01,  9.4257840000000002e+01,
00143  1.2500000000000000e+02,  6.1299999999999997e+01,  1.0000000000000000e+02,
00144  1.0000000000000000e+02,  1.4500000000000000e+02,  1.4500000000000000e+02,
00145 -1.0000000000000000e+00,  1.0000000000000000e+00,  9.0590469999999996e+01,
00146  1.0582863000000000e+02,  6.2000000000000002e+00,  6.0000000000000000e+00,
00147  9.7000000000000000e+01,  2.8500000000000000e+01,  4.0000000000000000e+00,
00148  3.6000000000000001e+00, -1.0000000000000000e+00,  1.0000000000000000e+00,
00149  8.8678200000000004e+01,  9.3617050000000006e+01,  1.6000000000000000e+01,
00150  8.1999999999999993e+00,  9.9000000000000000e+01,  8.0000000000000000e+01,
00151  1.2000000000000000e+01,  9.0000000000000000e+00, -1.0000000000000000e+00,
00152  1.0000000000000000e+00,  8.0062830000000005e+01,  9.9224010000000007e+01,
00153  1.0000000000000000e+02,  2.1100000000000001e+01,  1.0000000000000000e+02,
00154  1.0000000000000000e+02,  1.1400000000000000e+02,  1.1680000000000000e+02,
00155 -1.0000000000000000e+00,  1.0000000000000000e+00,  7.4697360000000003e+01,
00156  8.3801220000000001e+01, -8.1999999999999993e+00,  2.0000000000000000e+00,
00157  9.0000000000000000e+01,  2.3999999999999999e+00, -1.2000000000000000e+01,
00158 -1.4800000000000001e+01, -1.0000000000000000e+00,  1.0000000000000000e+00,
00159  7.9194209999999998e+01,  9.0175110000000004e+01,  4.3000000000000000e+01,
00160  8.0000000000000000e+00,  1.0000000000000000e+02,  9.5000000000000000e+01,
00161  9.0000000000000000e+00,  2.0000000000000000e+00, -1.0000000000000000e+00,
00162  1.0000000000000000e+00,  7.8568219999999997e+01,  8.5996200000000002e+01,
00163 -1.2500000000000000e+01,  1.0000000000000000e+00,  9.6500000000000000e+01,
00164  4.0000000000000000e+00, -1.8000000000000000e+01, -2.1899999999999999e+01,
00165 -1.0000000000000000e+00,  1.0000000000000000e+00,  8.2922240000000002e+01,
00166  8.6963380000000001e+01,  6.5000000000000000e+01,  1.2500000000000000e+01,
00167  1.0000000000000000e+02,  9.8000000000000000e+01,  4.9000000000000000e+01,
00168  3.7000000000000000e+01, -1.0000000000000000e+00,  1.0000000000000000e+00,
00169  8.2592740000000006e+01,  9.3147599999999997e+01, -1.2000000000000000e+01,
00170  1.0000000000000000e+00,  9.6500000000000000e+01,  4.0000000000000000e+00,
00171 -1.8000000000000000e+01, -2.1899999999999999e+01, -1.0000000000000000e+00,
00172  1.0000000000000000e+00,  7.6506460000000004e+01,  7.8210250000000002e+01,
00173  7.9000000000000000e+01,  1.2000000000000000e+01,  1.0000000000000000e+02,
00174  9.5000000000000000e+01,  6.8000000000000000e+01,  6.1000000000000000e+01,
00175 -1.0000000000000000e+00,  1.0000000000000000e+00,  8.8357460000000003e+01,
00176  9.4257840000000002e+01,  1.2500000000000000e+02,  6.1299999999999997e+01,
00177  1.0000000000000000e+02,  1.0000000000000000e+02,  1.4500000000000000e+02,
00178  1.4500000000000000e+02, -1.0000000000000000e+00,  1.0000000000000000e+00,
00179  9.0590469999999996e+01,  1.0582863000000000e+02,  6.2000000000000002e+00,
00180  6.0000000000000000e+00,  9.7000000000000000e+01,  2.8500000000000000e+01,
00181  4.0000000000000000e+00,  3.6000000000000001e+00, -1.0000000000000000e+00,
00182  1.0000000000000000e+00,  8.8678200000000004e+01,  9.3617050000000006e+01,
00183  1.6000000000000000e+01,  8.1999999999999993e+00,  9.9000000000000000e+01,
00184  8.0000000000000000e+01,  1.2000000000000000e+01,  9.0000000000000000e+00,
00185 -1.0000000000000000e+00,  1.0000000000000000e+00,  8.0062830000000005e+01,
00186  9.9224010000000007e+01,  1.0000000000000000e+02,  2.1100000000000001e+01,
00187  1.0000000000000000e+02,  1.0000000000000000e+02,  1.1400000000000000e+02,
00188  1.1680000000000000e+02, -1.0000000000000000e+00,  1.0000000000000000e+00,
00189  7.4697360000000003e+01,  8.3801220000000001e+01, -8.1999999999999993e+00,
00190  2.0000000000000000e+00,  9.0000000000000000e+01,  2.3999999999999999e+00,
00191 -1.2000000000000000e+01, -1.4800000000000001e+01, -1.0000000000000000e+00,
00192  1.0000000000000000e+00,  7.9194209999999998e+01,  9.0175110000000004e+01,
00193  4.3000000000000000e+01,  8.0000000000000000e+00,  1.0000000000000000e+02,
00194  9.5000000000000000e+01,  9.0000000000000000e+00,  2.0000000000000000e+00,
00195 -1.0000000000000000e+00,  1.0000000000000000e+00,  7.8568219999999997e+01,
00196  8.5996200000000002e+01, -1.2500000000000000e+01,  1.0000000000000000e+00,
00197  9.6500000000000000e+01,  4.0000000000000000e+00, -1.8000000000000000e+01,
00198 -2.1899999999999999e+01, -1.0000000000000000e+00,  1.0000000000000000e+00,
00199  8.2922240000000002e+01,  8.6963380000000001e+01,  6.5000000000000000e+01,
00200  1.2500000000000000e+01,  1.0000000000000000e+02,  9.8000000000000000e+01,
00201  4.9000000000000000e+01,  3.7000000000000000e+01, -1.0000000000000000e+00,
00202  1.0000000000000000e+00,  8.2592740000000006e+01,  9.3147599999999997e+01,
00203 -1.2000000000000000e+01,  1.0000000000000000e+00,  9.6500000000000000e+01,
00204  4.0000000000000000e+00, -1.8000000000000000e+01, -2.1899999999999999e+01,
00205 -1.0000000000000000e+00,  1.0000000000000000e+00,  7.6506460000000004e+01,
00206  7.8210250000000002e+01,  7.9000000000000000e+01,  1.2000000000000000e+01,
00207  1.0000000000000000e+02,  9.5000000000000000e+01,  6.8000000000000000e+01,
00208  6.1000000000000000e+01, -1.0000000000000000e+00,  1.0000000000000000e+00,
00209  8.8357460000000003e+01,  9.4257840000000002e+01,  1.2500000000000000e+02,
00210  6.1299999999999997e+01,  1.0000000000000000e+02,  1.0000000000000000e+02,
00211  1.4500000000000000e+02,  1.4500000000000000e+02, -1.0000000000000000e+00,
00212  1.0000000000000000e+00,  9.0590469999999996e+01,  1.0582863000000000e+02,
00213  6.2000000000000002e+00,  6.0000000000000000e+00,  9.7000000000000000e+01,
00214  2.8500000000000000e+01,  4.0000000000000000e+00,  3.6000000000000001e+00,
00215 -1.0000000000000000e+00, -1.0000000000000000e+00, -1.0000000000000000e+00,
00216 -1.0000000000000000e+00,  1.0000000000000000e+00,  1.0000000000000000e+00,
00217  1.0000000000000000e+00,  1.0000000000000000e+00,  1.0000000000000000e+00,
00218  1.0000000000000000e+00,  1.0000000000000000e+00,  1.0000000000000000e+00,
00219  1.0000000000000000e+00,  1.0000000000000000e+00, -1.2000000000000000e-01,
00220 -3.8000000000000000e-01, -5.0000000000000000e-01,  1.0000000000000000e+00,
00221  1.0000000000000000e+00,  1.0000000000000000e+00,  1.0000000000000000e+00,
00222  1.0000000000000000e+00,  1.0000000000000000e+00,  1.0000000000000000e+00,
00223  1.0000000000000000e+00,  1.0000000000000000e+00,  1.0000000000000000e+00,
00224  1.0000000000000000e+00,  1.0000000000000000e+00, -1.0000000000000000e+00,
00225  1.0000000000000000e+00, -1.0000000000000000e+00,  1.0000000000000000e+00,
00226 -1.0000000000000000e+00,  1.0000000000000000e+00, -1.0000000000000000e+00,
00227  1.0000000000000000e+00, -1.0000000000000000e+00,  1.0000000000000000e+00,
00228 -1.0000000000000000e+00,  1.0000000000000000e+00, -1.0000000000000000e+00,
00229  1.0000000000000000e+00, -1.0000000000000000e+00,  1.0000000000000000e+00,
00230 -1.0000000000000000e+00,  1.0000000000000000e+00,  1.0000000000000000e+00,
00231 -1.0000000000000000e+00,  1.0000000000000000e+00, -1.0000000000000000e+00,
00232 -1.0000000000000000e+00,  1.0000000000000000e+00, -1.0000000000000000e+00,
00233  1.0000000000000000e+00, -1.0000000000000000e+00,  1.0000000000000000e+00,
00234 -1.0000000000000000e+00,  1.0000000000000000e+00, -1.0000000000000000e+00,
00235  1.0000000000000000e+00, -1.0000000000000000e+00,  1.0000000000000000e+00,
00236 -1.0000000000000000e+00,  1.0000000000000000e+00, -1.0000000000000000e+00,
00237  1.0000000000000000e+00, -1.0000000000000000e+00,  1.0000000000000000e+00,
00238  1.0000000000000000e+00, -1.0000000000000000e+00,  1.0000000000000000e+00,
00239 -1.0000000000000000e+00,  1.0000000000000000e+00, -1.0000000000000000e+00,
00240 -4.7000000000000000e+01, -8.6999999999999993e+00, -9.0000000000000000e+01,
00241 -5.0000000000000000e+01, -1.0000000000000000e+01, -1.0000000000000000e+01,
00242 -9.3000000000000000e+01, -8.9000000000000000e+01,  1.0000000000000000e+00,
00243 -1.0000000000000000e+00, -4.7000000000000000e+01, -8.6999999999999993e+00,
00244 -9.0000000000000000e+01, -5.0000000000000000e+01, -1.0000000000000000e+01,
00245 -1.0000000000000000e+01, -8.9000000000000000e+01, -8.5000000000000000e+01,
00246  1.0000000000000000e+00, -1.0000000000000000e+00, -4.7000000000000000e+01,
00247 -8.6999999999999993e+00, -9.0000000000000000e+01, -5.0000000000000000e+01,
00248 -1.0000000000000000e+01, -1.0000000000000000e+01, -9.1000000000000000e+01,
00249 -8.8000000000000000e+01, -1.0000000000000000e+00,  5.0000000000000000e-01,
00250 -1.0000000000000000e+00,  1.0000000000000000e+00,  5.0000000000000000e-01,
00251 -1.0000000000000000e+00,  5.0000000000000000e-01, -1.0000000000000000e+00,
00252  1.0000000000000000e+00,  5.0000000000000000e-01, -1.0000000000000000e+00,
00253  5.0000000000000000e-01, -1.0000000000000000e+00,  1.0000000000000000e+00,
00254  5.0000000000000000e-01,  1.0000000000000000e+00, -1.0000000000000000e+00,
00255  1.0000000000000000e+00, -1.0000000000000000e+00,  1.0000000000000000e+00,
00256 -1.0000000000000000e+00,  1.0000000000000000e+00, -1.0000000000000000e+00,
00257  1.0000000000000000e+00, -1.0000000000000000e+00,  1.0000000000000000e+00,
00258 -1.0000000000000000e+00,  1.0000000000000000e+00, -1.0000000000000000e+00,
00259  1.0000000000000000e+00, -1.0000000000000000e+00,  1.0000000000000000e+00,
00260 -1.0000000000000000e+00,  1.0000000000000000e+00, -1.0000000000000000e+00,
00261  1.0000000000000000e+00, -1.0000000000000000e+00,  1.0000000000000000e+00,
00262 -1.0000000000000000e+00,  1.0000000000000000e+00, -1.0000000000000000e+00,
00263  1.0000000000000000e+00, -1.0000000000000000e+00,  1.0000000000000000e+00,
00264 -1.0000000000000000e+00,  1.0000000000000000e+00, -1.0000000000000000e+00,
00265  1.0000000000000000e+00, -1.0000000000000000e+00,  1.0000000000000000e+00,
00266 -1.0000000000000000e+00,  1.0000000000000000e+00, -1.0000000000000000e+00,
00267  1.0000000000000000e+00, -1.0000000000000000e+00,  1.0000000000000000e+00,
00268 -1.0000000000000000e+00,  1.0000000000000000e+00, -1.0000000000000000e+00,
00269  1.0000000000000000e+00, -1.0000000000000000e+00, -4.7000000000000000e+01,
00270 -8.6999999999999993e+00, -9.0000000000000000e+01, -5.0000000000000000e+01,
00271 -1.0000000000000000e+01, -1.0000000000000000e+01, -9.3000000000000000e+01,
00272 -8.9000000000000000e+01,  1.0000000000000000e+00, -1.0000000000000000e+00,
00273 -4.7000000000000000e+01, -8.6999999999999993e+00, -9.0000000000000000e+01,
00274 -5.0000000000000000e+01, -1.0000000000000000e+01, -1.0000000000000000e+01,
00275 -8.9000000000000000e+01, -8.5000000000000000e+01,  1.0000000000000000e+00,
00276 -1.0000000000000000e+00, -4.7000000000000000e+01, -8.6999999999999993e+00,
00277 -9.0000000000000000e+01, -5.0000000000000000e+01, -1.0000000000000000e+01,
00278 -1.0000000000000000e+01, -9.1000000000000000e+01, -8.8000000000000000e+01,
00279 -1.0000000000000000e+00,  5.0000000000000000e-01, -1.0000000000000000e+00,
00280  1.0000000000000000e+00,  5.0000000000000000e-01, -1.0000000000000000e+00,
00281  5.0000000000000000e-01, -1.0000000000000000e+00,  1.0000000000000000e+00,
00282  5.0000000000000000e-01, -1.0000000000000000e+00,  5.0000000000000000e-01,
00283 -1.0000000000000000e+00,  1.0000000000000000e+00,  5.0000000000000000e-01,
00284  1.0000000000000000e+00, -1.0000000000000000e+00,  1.0000000000000000e+00,
00285 -1.0000000000000000e+00,  1.0000000000000000e+00, -1.0000000000000000e+00,
00286  1.0000000000000000e+00, -1.0000000000000000e+00,  1.0000000000000000e+00,
00287 -1.0000000000000000e+00,  1.0000000000000000e+00, -1.0000000000000000e+00,
00288  1.0000000000000000e+00, -1.0000000000000000e+00,  1.0000000000000000e+00,
00289 -1.0000000000000000e+00,  1.0000000000000000e+00, -1.0000000000000000e+00,
00290  1.0000000000000000e+00, -1.0000000000000000e+00,  1.0000000000000000e+00,
00291 -1.0000000000000000e+00,  1.0000000000000000e+00, -1.0000000000000000e+00,
00292  1.0000000000000000e+00, -1.0000000000000000e+00,  1.0000000000000000e+00,
00293 -1.0000000000000000e+00,  1.0000000000000000e+00, -1.0000000000000000e+00,
00294  1.0000000000000000e+00, -1.0000000000000000e+00,  1.0000000000000000e+00,
00295 -1.0000000000000000e+00,  1.0000000000000000e+00, -1.0000000000000000e+00,
00296  1.0000000000000000e+00, -1.0000000000000000e+00,  1.0000000000000000e+00,
00297 -1.0000000000000000e+00,  1.0000000000000000e+00, -1.0000000000000000e+00,
00298  1.0000000000000000e+00, -1.0000000000000000e+00,  1.0000000000000000e+00,
00299 -1.0000000000000000e+00, -4.7000000000000000e+01, -8.6999999999999993e+00,
00300 -9.0000000000000000e+01, -5.0000000000000000e+01, -1.0000000000000000e+01,
00301 -1.0000000000000000e+01, -9.3000000000000000e+01, -8.9000000000000000e+01,
00302  1.0000000000000000e+00, -1.0000000000000000e+00, -4.7000000000000000e+01,
00303 -8.6999999999999993e+00, -9.0000000000000000e+01, -5.0000000000000000e+01,
00304 -1.0000000000000000e+01, -1.0000000000000000e+01, -8.9000000000000000e+01,
00305 -8.5000000000000000e+01,  1.0000000000000000e+00, -1.0000000000000000e+00,
00306 -4.7000000000000000e+01, -8.6999999999999993e+00, -9.0000000000000000e+01,
00307 -5.0000000000000000e+01, -1.0000000000000000e+01, -1.0000000000000000e+01,
00308 -9.1000000000000000e+01, -8.8000000000000000e+01, -1.0000000000000000e+00,
00309  5.0000000000000000e-01, -1.0000000000000000e+00,  1.0000000000000000e+00,
00310  5.0000000000000000e-01, -1.0000000000000000e+00,  5.0000000000000000e-01,
00311 -1.0000000000000000e+00,  1.0000000000000000e+00,  5.0000000000000000e-01,
00312 -1.0000000000000000e+00,  5.0000000000000000e-01, -1.0000000000000000e+00,
00313  1.0000000000000000e+00,  5.0000000000000000e-01, -1.0000000000000000e+00,
00314 -1.0000000000000000e+00, -1.0000000000000000e+00, -1.0000000000000000e+00,
00315 -1.0000000000000000e+00, -1.0000000000000000e+00, -1.0000000000000000e+00,
00316 -1.0000000000000000e+00, -1.0000000000000000e+00, -1.0000000000000000e+00,
00317 -1.0000000000000000e+00, -1.0000000000000000e+00, -1.0000000000000000e+00,
00318 -1.0000000000000000e+00, -1.0000000000000000e+00, -1.0000000000000000e+00,
00319 -1.0000000000000000e+00, -1.0000000000000000e+00, -1.0000000000000000e+00,
00320 -1.0000000000000000e+00, -1.0000000000000000e+00, -1.0000000000000000e+00,
00321  1.0000000000000000e+00, -1.0000000000000000e+00, -4.7000000000000000e+01,
00322 -8.6999999999999993e+00, -9.0000000000000000e+01, -5.0000000000000000e+01,
00323 -1.0000000000000000e+01, -1.0000000000000000e+01, -9.3000000000000000e+01,
00324 -8.9000000000000000e+01,  1.0000000000000000e+00, -1.0000000000000000e+00,
00325 -4.7000000000000000e+01, -8.6999999999999993e+00, -9.0000000000000000e+01,
00326 -5.0000000000000000e+01, -1.0000000000000000e+01, -1.0000000000000000e+01,
00327 -8.9000000000000000e+01, -8.5000000000000000e+01,  1.0000000000000000e+00,
00328 -1.0000000000000000e+00, -4.7000000000000000e+01, -8.6999999999999993e+00,
00329 -9.0000000000000000e+01, -5.0000000000000000e+01, -1.0000000000000000e+01,
00330 -1.0000000000000000e+01, -9.1000000000000000e+01, -8.8000000000000000e+01,
00331 -1.0000000000000000e+00,  5.0000000000000000e-01, -1.0000000000000000e+00,
00332  1.0000000000000000e+00,  5.0000000000000000e-01, -1.0000000000000000e+00,
00333  5.0000000000000000e-01, -1.0000000000000000e+00,  1.0000000000000000e+00,
00334  5.0000000000000000e-01, -1.0000000000000000e+00,  5.0000000000000000e-01,
00335 -1.0000000000000000e+00,  1.0000000000000000e+00,  5.0000000000000000e-01};
00336 
00337 real_t g[] = {+0e+00, +0e+00, +0e+00, +0e+00, +0e+00, +0e+00, +0e+00, +0e+00,
00338         +0e+00, +0e+00, +0e+00, +0e+00, +0e+00, +0e+00, +0e+00, +0e+00, +0e+00,
00339         +0e+00, +0e+00, +0e+00, +0e+00, +0e+00, +0e+00, +0e+00, +0e+00, +0e+00,
00340         +0e+00, +0e+00, +0e+00, +0e+00, +0e+00, +0e+00, +0e+00, +0e+00, +0e+00,
00341         +0e+00, +0e+00, +0e+00, +0e+00, +0e+00, +0e+00, +0e+00, +0e+00, +0e+00,
00342         +0e+00, +0e+00, -2e+00, -2e+00, -2e+00, -2e+00, -2e+00, -2e+00, -2e+00,
00343         -2e+00, +0e+00, -2e+00, +0e+00, +2e-03, +2e-03, +2e-03, +2e-03, +2e-03,
00344         +2e-03, +1e-03, +2e-03, +2e-03, +2e-03, +0e+00, -2e-03, -2e-03, -2e-03,
00345         -2e-03, -2e-03, -2e-03, -1e-03, -2e-03, -2e-03, -2e-03, +0e+00, +0e+00,
00346         +0e+00, +0e+00, +0e+00, +0e+00, +0e+00, +0e+00, +0e+00, +0e+00, +2e-03,
00347         +2e-03, +2e-03, +2e-03, +2e-03, +2e-03, +1e-03, +2e-03, +2e-03, +2e-03,
00348         +0e+00, -2e-03, -2e-03, -2e-03, -2e-03, -2e-03, -2e-03, -1e-03, -2e-03,
00349         -2e-03, -2e-03, +0e+00, +0e+00, +0e+00, +0e+00, +0e+00, +0e+00, +0e+00,
00350         +0e+00, +0e+00, +0e+00, +2e-03, +2e-03, +2e-03, +2e-03, +2e-03, +2e-03,
00351         +1e-03, +2e-03, +2e-03, +2e-03, +0e+00, -2e-03, -2e-03, -2e-03, -2e-03,
00352         -2e-03, -2e-03, -1e-03, -2e-03, -2e-03, -2e-03, +0e+00, +0e+00, +0e+00,
00353         +0e+00, +0e+00, +0e+00, +0e+00, +0e+00, +0e+00, +0e+00, +1e-01, +1e-01,
00354         +1e-01, +1e-01, +1e-01, +1e-01, +1e-01, +1e-01, +1e-01, +1e-01, +0e+00,
00355         -1e-01, -1e-01, -1e-01, -1e-01, -1e-01, -1e-01, -1e-01, -1e-01, -1e-01,
00356         -1e-01, +0e+00, +0e+00, +0e+00, +0e+00, +0e+00, +0e+00, +0e+00, +0e+00,
00357         +0e+00};
00358 
00359 real_t lb[] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
00360         0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
00361         0, 0, 0, -Inf, 0, -Inf, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10, 5,
00362         10, 5, 0, 10, 0, 2, 0, 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
00363         0, 0, 0, 0, 0, 10, 5, 10, 5, 0, 10, 0, 5, 0, 10, 0, 0, 0, 0, 0, 0, 0, 0, 0,
00364         0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10, 5, 10, 5, 0, 10, 0, 5, 0, 10, 0, 0,
00365         0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
00366         0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
00367 
00368 real_t ub[] = {Inf, Inf, Inf, Inf, Inf, Inf, Inf, Inf, Inf, Inf, Inf, Inf, Inf,
00369         Inf, Inf, Inf, Inf, Inf, Inf, Inf, Inf, Inf, Inf, Inf, Inf, Inf, Inf, Inf,
00370         Inf, Inf, Inf, Inf, Inf, Inf, Inf, Inf, Inf, Inf, Inf, Inf, Inf, Inf, Inf,
00371         Inf, Inf, 0, 92, 39, 87, 29, 0, 20, 0, 28, 20, 71, Inf, 130, 45, 53, 55, 75,
00372         112, 0, 73, 480, 154, 121, 50, 30, 77, 20, 0, 18, 0, 5, 20, 71, Inf, Inf,
00373         Inf, Inf, Inf, Inf, Inf, Inf, Inf, Inf, 130, 55, 93, 60, 75, 115, 0, 67,
00374         480, 154, 121, 50, 20, 37, 15, 0, 15, 0, 8, 20, 71, Inf, Inf, Inf, Inf, Inf,
00375         Inf, Inf, Inf, Inf, Inf, 130, 55, 93, 60, 75, 105, 0, 67, 4980, 154, 110,
00376         50, 20, 37, 15, 0, 25, 0, 8, 20, 71, Inf, Inf, Inf, Inf, Inf, Inf, Inf, Inf,
00377         Inf, Inf, 20, 20, 20, 20, 0, 20, 0, 20, 0, 20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
00378         0, Inf, Inf, Inf, Inf, Inf, Inf, Inf, Inf, Inf};
00379 
00380 real_t lbA[] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
00381         0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
00382         0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -Inf, -Inf,
00383         -Inf, -Inf, -Inf, -Inf, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
00384         0};
00385 
00386 real_t ubA[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
00387         0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
00388         0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
00389         0, 0, Inf, Inf, Inf, Inf, Inf, Inf, Inf, Inf, Inf, Inf, Inf, Inf, Inf, Inf,
00390         Inf, Inf, Inf, Inf};
00391 
00392 long H_nnz =  sizeof(H_val) / sizeof(real_t);
00393 long A_nnz =  sizeof(A_val) / sizeof(real_t);
00394 
00395 int main( )
00396 {
00397         long i; 
00398         int nWSR;
00399         long *H_jd;
00400         real_t err, tic, toc;
00401         real_t *x1 = new real_t[180];
00402         real_t *y1 = new real_t[271];
00403         real_t *x2 = new real_t[180];
00404         real_t *y2 = new real_t[271];
00405 
00406         /* create sparse matrices */
00407         SymSparseMat *H = new SymSparseMat(180, 180, H_ir, H_jc, H_val);
00408         SparseMatrix *A = new SparseMatrix(91, 180, A_ir, A_jc, A_val);
00409 
00410         H_jd = H->createDiagInfo();
00411 
00412         real_t* H_full = H->full();
00413         real_t* A_full = A->full();
00414 
00415         SymDenseMat *Hd = new SymDenseMat(180,180,180,H_full);
00416         DenseMatrix *Ad = new DenseMatrix(91,180,180,A_full);
00417         
00418         /* solve with dense matrices */
00419         nWSR = 1000;
00420         QProblem qrecipeD(180, 91);
00421         tic = getCPUtime();
00422         qrecipeD.init(Hd, g, Ad, lb, ub, lbA, ubA, nWSR, 0);
00423         toc = getCPUtime();
00424         qrecipeD.getPrimalSolution(x1);
00425         qrecipeD.getDualSolution(y1);
00426 
00427         fprintf(stdout, "Solved dense problem in %d iterations, %.3f seconds.\n", nWSR, toc-tic);
00428 
00429         /* solve with sparse matrices */
00430         nWSR = 1000;
00431         QProblem qrecipeS(180, 91);
00432         tic = getCPUtime();
00433         qrecipeS.init(H, g, A, lb, ub, lbA, ubA, nWSR, 0);
00434         toc = getCPUtime();
00435         qrecipeS.getPrimalSolution(x2);
00436         qrecipeS.getDualSolution(y2);
00437 
00438         fprintf(stdout, "Solved sparse problem in %d iterations, %.3f seconds.\n", nWSR, toc-tic);
00439 
00440         /* check distance of solutions */
00441         err = 0.0;
00442         for (i = 0; i < 180; i++)
00443                 if (fabs(x1[i] - x2[i]) > err)
00444                         err = fabs(x1[i] - x2[i]);
00445         fprintf(stdout, "Primal error: %9.2e\n", err);
00446         err = 0.0;
00447         for (i = 0; i < 271; i++)
00448                 if (fabs(y1[i] - y2[i]) > err)
00449                         err = fabs(y1[i] - y2[i]);
00450         fprintf(stdout, "Dual error: %9.2e\n", err);
00451         
00452         delete H;
00453         delete A;
00454         delete[] H_full;
00455         delete[] A_full;
00456         delete Hd;
00457         delete Ad;
00458         delete[] H_jd;
00459 
00460         delete[] y2;
00461         delete[] x2;
00462         delete[] y1;
00463         delete[] x1;
00464         
00465         return 0;
00466 }
00467 
00468 
00469 /*
00470  *      end of file
00471  */


acado
Author(s): Milan Vukov, Rien Quirynen
autogenerated on Thu Aug 27 2015 11:59:51