qpOASES-3.2.0/src/OQPinterface.cpp
Go to the documentation of this file.
1 /*
2  * This file is part of qpOASES.
3  *
4  * qpOASES -- An Implementation of the Online Active Set Strategy.
5  * Copyright (C) 2007-2015 by Hans Joachim Ferreau, Andreas Potschka,
6  * Christian Kirches et al. All rights reserved.
7  *
8  * qpOASES is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU Lesser General Public
10  * License as published by the Free Software Foundation; either
11  * version 2.1 of the License, or (at your option) any later version.
12  *
13  * qpOASES is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
16  * See the GNU Lesser General Public License for more details.
17  *
18  * You should have received a copy of the GNU Lesser General Public
19  * License along with qpOASES; if not, write to the Free Software
20  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21  *
22  */
23 
24 
39 #include <qpOASES/extras/OQPinterface.hpp>
40 #include <qpOASES/QProblem.hpp>
41 
42 
44 
45 
46 /*
47  * r e a d O q p D i m e n s i o n s
48  */
49 returnValue readOqpDimensions( const char* path,
50  int_t& nQP, int_t& nV, int_t& nC, int_t& nEC
51  )
52 {
53  /* 1) Setup file name where dimensions are stored. */
54  char filename[MAX_STRING_LENGTH];
55  snprintf( filename,MAX_STRING_LENGTH,"%sdims.oqp",path );
56 
57  /* 2) Load dimensions from file. */
58  int_t dims[4];
59  if ( readFromFile( dims,4,filename ) != SUCCESSFUL_RETURN )
61 
62  nQP = dims[0];
63  nV = dims[1];
64  nC = dims[2];
65  nEC = dims[3];
66 
67 
68  /* consistency check */
69  if ( ( nQP <= 0 ) || ( nV <= 0 ) || ( nC < 0 ) || ( nEC < 0 ) )
71 
72  return SUCCESSFUL_RETURN;
73 }
74 
75 
76 /*
77  * r e a d O q p D a t a
78  */
79 returnValue readOqpData( const char* path,
80  int_t& nQP, int_t& nV, int_t& nC, int_t& nEC,
81  real_t** H, real_t** g, real_t** A, real_t** lb, real_t** ub, real_t** lbA, real_t** ubA,
82  real_t** xOpt, real_t** yOpt, real_t** objOpt
83  )
84 {
85  char filename[MAX_STRING_LENGTH];
86 
87  /* consistency check */
88  if ( ( H == 0 ) || ( g == 0 ) || ( lb == 0 ) || ( ub == 0 ) )
90 
91 
92  /* 1) Obtain OQP dimensions. */
93  if ( readOqpDimensions( path, nQP,nV,nC,nEC ) != SUCCESSFUL_RETURN )
95 
96 
97  /* another consistency check */
98  if ( ( nC > 0 ) && ( ( A == 0 ) || ( lbA == 0 ) || ( ubA == 0 ) ) )
100 
101 
102  /* 2) Allocate memory and load OQP data: */
103  /* Hessian matrix */
104  *H = new real_t[nV*nV];
105  snprintf( filename,MAX_STRING_LENGTH,"%sH.oqp",path );
106  if ( readFromFile( *H,nV,nV,filename ) != SUCCESSFUL_RETURN )
107  {
108  delete[] *H;
110  }
111 
112  /* gradient vector sequence */
113  *g = new real_t[nQP*nV];
114  snprintf( filename,MAX_STRING_LENGTH,"%sg.oqp",path );
115  if ( readFromFile( *g,nQP,nV,filename ) != SUCCESSFUL_RETURN )
116  {
117  delete[] *g; delete[] *H;
119  }
120 
121  /* lower bound vector sequence */
122  *lb = new real_t[nQP*nV];
123  snprintf( filename,MAX_STRING_LENGTH,"%slb.oqp",path );
124  if ( readFromFile( *lb,nQP,nV,filename ) != SUCCESSFUL_RETURN )
125  {
126  delete[] *lb; delete[] *g; delete[] *H;
128  }
129 
130  /* upper bound vector sequence */
131  *ub = new real_t[nQP*nV];
132  snprintf( filename,MAX_STRING_LENGTH,"%sub.oqp",path );
133  if ( readFromFile( *ub,nQP,nV,filename ) != SUCCESSFUL_RETURN )
134  {
135  delete[] *ub; delete[] *lb; delete[] *g; delete[] *H;
137  }
138 
139  if ( nC > 0 )
140  {
141  /* Constraint matrix */
142  *A = new real_t[nC*nV];
143  snprintf( filename,MAX_STRING_LENGTH,"%sA.oqp",path );
144  if ( readFromFile( *A,nC,nV,filename ) != SUCCESSFUL_RETURN )
145  {
146  delete[] *A;
147  delete[] *ub; delete[] *lb; delete[] *g; delete[] *H;
149  }
150 
151  /* lower constraints' bound vector sequence */
152  *lbA = new real_t[nQP*nC];
153  snprintf( filename,MAX_STRING_LENGTH,"%slbA.oqp",path );
154  if ( readFromFile( *lbA,nQP,nC,filename ) != SUCCESSFUL_RETURN )
155  {
156  delete[] *lbA; delete[] *A;
157  delete[] *ub; delete[] *lb; delete[] *g; delete[] *H;
159  }
160 
161  /* upper constraints' bound vector sequence */
162  *ubA = new real_t[nQP*nC];
163  snprintf( filename,MAX_STRING_LENGTH,"%subA.oqp",path );
164  if ( readFromFile( *ubA,nQP,nC,filename ) != SUCCESSFUL_RETURN )
165  {
166  delete[] *ubA; delete[] *lbA; delete[] *A;
167  delete[] *ub; delete[] *lb; delete[] *g; delete[] *H;
169  }
170  }
171  else
172  {
173  *A = 0;
174  *lbA = 0;
175  *ubA = 0;
176  }
177 
178  if ( xOpt != 0 )
179  {
180  /* primal solution vector sequence */
181  *xOpt = new real_t[nQP*nV];
182  snprintf( filename,MAX_STRING_LENGTH,"%sx_opt.oqp",path );
183  if ( readFromFile( *xOpt,nQP,nV,filename ) != SUCCESSFUL_RETURN )
184  {
185  delete[] xOpt;
186  if ( nC > 0 ) { delete[] *ubA; delete[] *lbA; delete[] *A; };
187  delete[] *ub; delete[] *lb; delete[] *g; delete[] *H;
189  }
190  }
191 
192  if ( yOpt != 0 )
193  {
194  /* dual solution vector sequence */
195  *yOpt = new real_t[nQP*(nV+nC)];
196  snprintf( filename,MAX_STRING_LENGTH,"%sy_opt.oqp",path );
197  if ( readFromFile( *yOpt,nQP,nV+nC,filename ) != SUCCESSFUL_RETURN )
198  {
199  delete[] yOpt;
200  if ( xOpt != 0 ) { delete[] xOpt; };
201  if ( nC > 0 ) { delete[] *ubA; delete[] *lbA; delete[] *A; };
202  delete[] *ub; delete[] *lb; delete[] *g; delete[] *H;
204  }
205  }
206 
207  if ( objOpt != 0 )
208  {
209  /* dual solution vector sequence */
210  *objOpt = new real_t[nQP];
211  snprintf( filename,MAX_STRING_LENGTH,"%sobj_opt.oqp",path );
212  if ( readFromFile( *objOpt,nQP,1,filename ) != SUCCESSFUL_RETURN )
213  {
214  delete[] objOpt;
215  if ( yOpt != 0 ) { delete[] yOpt; };
216  if ( xOpt != 0 ) { delete[] xOpt; };
217  if ( nC > 0 ) { delete[] *ubA; delete[] *lbA; delete[] *A; };
218  delete[] *ub; delete[] *lb; delete[] *g; delete[] *H;
220  }
221  }
222 
223  return SUCCESSFUL_RETURN;
224 }
225 
226 
227 /*
228  * s o l v e O q p B e n c h m a r k
229  */
231  const real_t* const _H, const real_t* const g, const real_t* const _A,
232  const real_t* const lb, const real_t* const ub,
233  const real_t* const lbA, const real_t* const ubA,
234  BooleanType isSparse,
235  const Options& options, int_t& nWSR, real_t& maxCPUtime,
236  real_t& maxStationarity, real_t& maxFeasibility, real_t& maxComplementarity
237  )
238 {
239  real_t maxNWSR = 0.0;
240  real_t avgNWSR = 0.0;
241  real_t avgCPUtime = 0.0;
242 
243  returnValue returnvalue = solveOqpBenchmark( nQP,nV,nC,nEC,
244  _H,g,_A,lb,ub,lbA,ubA,
245  isSparse,BT_TRUE,
246  options,nWSR,
247  maxNWSR,avgNWSR,maxCPUtime,avgCPUtime,
248  maxStationarity,maxFeasibility,maxComplementarity
249  );
250  nWSR = (int_t)maxNWSR;
251 
252  return returnvalue;
253 }
254 
255 
256 
257 /*
258  * s o l v e O q p B e n c h m a r k
259  */
261  const real_t* const _H, const real_t* const g, const real_t* const _A,
262  const real_t* const lb, const real_t* const ub,
263  const real_t* const lbA, const real_t* const ubA,
264  BooleanType isSparse, BooleanType useHotstarts,
265  const Options& options, int_t maxAllowedNWSR,
266  real_t& maxNWSR, real_t& avgNWSR, real_t& maxCPUtime, real_t& avgCPUtime,
267  real_t& maxStationarity, real_t& maxFeasibility, real_t& maxComplementarity
268  )
269 {
270  int_t k;
271 
272  /* I) SETUP AUXILIARY VARIABLES: */
273  /* 1) Keep nWSR and store current and maximum number of
274  * working set recalculations in temporary variables */
275  int_t nWSRcur;
276 
277  real_t CPUtimeLimit = maxCPUtime;
278  real_t CPUtimeCur = CPUtimeLimit;
279  maxNWSR = 0.0;
280  avgNWSR = 0.0;
281  maxCPUtime = 0.0;
282  avgCPUtime = 0.0;
283  maxStationarity = 0.0;
284  maxFeasibility = 0.0;
285  maxComplementarity = 0.0;
286  real_t stat, feas, cmpl;
287 
288  /* 2) Pointers to data of current QP ... */
289  const real_t* gCur;
290  const real_t* lbCur;
291  const real_t* ubCur;
292  const real_t* lbACur;
293  const real_t* ubACur;
294 
295  /* 3) Vectors for solution obtained by qpOASES. */
296  real_t* x = new real_t[nV];
297  real_t* y = new real_t[nV+nC];
298  //real_t obj;
299 
300  /* 4) Prepare matrix objects */
301  SymmetricMatrix *H;
302  Matrix *A;
303 
304  real_t* H_cpy = new real_t[nV*nV];
305  memcpy( H_cpy,_H, ((uint_t)(nV*nV))*sizeof(real_t) );
306  real_t* A_cpy = new real_t[nC*nV];
307  memcpy( A_cpy,_A, ((uint_t)(nC*nV))*sizeof(real_t) );
308 
309  if ( isSparse == BT_TRUE )
310  {
311  SymSparseMat *Hs;
312  H = Hs = new SymSparseMat(nV, nV, nV, H_cpy);
313  A = new SparseMatrixRow(nC, nV, nV, A_cpy);
314  Hs->createDiagInfo();
315  delete[] A_cpy; delete[] H_cpy;
316  }
317  else
318  {
319  H = new SymDenseMat(nV, nV, nV, const_cast<real_t *>(H_cpy));
320  A = new DenseMatrix(nC, nV, nV, const_cast<real_t *>(A_cpy));
321  }
322 
323  H->doFreeMemory( );
324  A->doFreeMemory( );
325 
326  /* II) SETUP QPROBLEM OBJECT */
327  QProblem qp( nV,nC );
328  qp.setOptions( options );
329  //qp.setPrintLevel( PL_LOW );
330 
331  //qp.printOptions();
332 
333  /* III) RUN BENCHMARK SEQUENCE: */
334  returnValue returnvalue;
335 
336  for( k=0; k<nQP; ++k )
337  {
338  //if ( k%50 == 0 )
339  // printf( "%d\n",k );
340 
341  /* 1) Update pointers to current QP data. */
342  gCur = &( g[k*nV] );
343  lbCur = &( lb[k*nV] );
344  ubCur = &( ub[k*nV] );
345  lbACur = &( lbA[k*nC] );
346  ubACur = &( ubA[k*nC] );
347 
348  /* 2) Set nWSR and maximum CPU time. */
349  nWSRcur = maxAllowedNWSR;
350  CPUtimeCur = CPUtimeLimit;
351 
352  /* 3) Solve current QP. */
353  if ( ( k == 0 ) || ( useHotstarts == BT_FALSE ) )
354  {
355  /* initialise */
356  returnvalue = qp.init( H,gCur,A,lbCur,ubCur,lbACur,ubACur, nWSRcur,&CPUtimeCur );
357  if ( ( returnvalue != SUCCESSFUL_RETURN ) && ( returnvalue != RET_MAX_NWSR_REACHED ) )
358  {
359  delete A; delete H; delete[] y; delete[] x;
360  return THROWERROR( returnvalue );
361  }
362  }
363  else
364  {
365  /* hotstart */
366  returnvalue = qp.hotstart( gCur,lbCur,ubCur,lbACur,ubACur, nWSRcur,&CPUtimeCur );
367  if ( ( returnvalue != SUCCESSFUL_RETURN ) && ( returnvalue != RET_MAX_NWSR_REACHED ) )
368  {
369  delete A; delete H; delete[] y; delete[] x;
370  return THROWERROR( returnvalue );
371  }
372  }
373 
374  /* 4) Obtain solution vectors and objective function value */
375  qp.getPrimalSolution( x );
376  qp.getDualSolution( y );
377  //obj = qp.getObjVal( );
378 
379  /* 5) Compute KKT residuals */
380  getKktViolation( nV,nC, _H,gCur,_A,lbCur,ubCur,lbACur,ubACur, x,y, stat,feas,cmpl );
381 
382  /* 6) Update maximum and average values. */
383  if ( ((double)nWSRcur) > maxNWSR )
384  maxNWSR = ((double)nWSRcur);
385  if (stat > maxStationarity) maxStationarity = stat;
386  if (feas > maxFeasibility) maxFeasibility = feas;
387  if (cmpl > maxComplementarity) maxComplementarity = cmpl;
388 
389  if ( CPUtimeCur > maxCPUtime )
390  maxCPUtime = CPUtimeCur;
391 
392  avgNWSR += ((double)nWSRcur);
393  avgCPUtime += CPUtimeCur;
394  }
395  avgNWSR /= ((double)nQP);
396  avgCPUtime /= ((double)nQP);
397 
398  delete A; delete H; delete[] y; delete[] x;
399 
400  return SUCCESSFUL_RETURN;
401 }
402 
403 
404 /*
405  * s o l v e O q p B e n c h m a r k
406  */
408  const real_t* const _H, const real_t* const g,
409  const real_t* const lb, const real_t* const ub,
410  BooleanType isSparse,
411  const Options& options, int_t& nWSR, real_t& maxCPUtime,
412  real_t& maxStationarity, real_t& maxFeasibility, real_t& maxComplementarity
413  )
414 {
415  real_t maxNWSR = 0.0;
416  real_t avgNWSR = 0.0;
417  real_t avgCPUtime = 0.0;
418 
419  returnValue returnvalue = solveOqpBenchmark( nQP,nV,
420  _H,g,lb,ub,
421  isSparse,BT_TRUE,
422  options,nWSR,
423  maxNWSR,avgNWSR,maxCPUtime,avgCPUtime,
424  maxStationarity,maxFeasibility,maxComplementarity
425  );
426  nWSR = (int_t)maxNWSR;
427 
428  return returnvalue;
429 }
430 
431 
432 /*
433  * s o l v e O q p B e n c h m a r k
434  */
436  const real_t* const _H, const real_t* const g,
437  const real_t* const lb, const real_t* const ub,
438  BooleanType isSparse, BooleanType useHotstarts,
439  const Options& options, int_t maxAllowedNWSR,
440  real_t& maxNWSR, real_t& avgNWSR, real_t& maxCPUtime, real_t& avgCPUtime,
441  real_t& maxStationarity, real_t& maxFeasibility, real_t& maxComplementarity
442  )
443 {
444  int_t k;
445 
446  /* I) SETUP AUXILIARY VARIABLES: */
447  /* 1) Keep nWSR and store current and maximum number of
448  * working set recalculations in temporary variables */
449  int_t nWSRcur;
450 
451  real_t CPUtimeLimit = maxCPUtime;
452  real_t CPUtimeCur = CPUtimeLimit;
453  real_t stat, feas, cmpl;
454  maxNWSR = 0;
455  avgNWSR = 0;
456  maxCPUtime = 0.0;
457  avgCPUtime = 0.0;
458  maxStationarity = 0.0;
459  maxFeasibility = 0.0;
460  maxComplementarity = 0.0;
461 
462  /* 2) Pointers to data of current QP ... */
463  const real_t* gCur;
464  const real_t* lbCur;
465  const real_t* ubCur;
466 
467  /* 3) Vectors for solution obtained by qpOASES. */
468  real_t* x = new real_t[nV];
469  real_t* y = new real_t[nV];
470  //real_t obj;
471 
472  /* 4) Prepare matrix objects */
473  SymmetricMatrix *H;
474  real_t* H_cpy = new real_t[nV*nV];
475  memcpy( H_cpy,_H, ((uint_t)(nV*nV))*sizeof(real_t) );
476 
477  if ( isSparse == BT_TRUE )
478  {
479  SymSparseMat *Hs;
480  H = Hs = new SymSparseMat(nV, nV, nV, H_cpy);
481  Hs->createDiagInfo();
482  delete[] H_cpy;
483  }
484  else
485  {
486  H = new SymDenseMat(nV, nV, nV, const_cast<real_t *>(H_cpy));
487  }
488 
489  H->doFreeMemory( );
490 
491  /* II) SETUP QPROBLEM OBJECT */
492  QProblemB qp( nV );
493  qp.setOptions( options );
494  //qp.setPrintLevel( PL_LOW );
495 
496 
497  /* III) RUN BENCHMARK SEQUENCE: */
498  returnValue returnvalue;
499 
500  for( k=0; k<nQP; ++k )
501  {
502  //if ( k%50 == 0 )
503  // printf( "%d\n",k );
504 
505  /* 1) Update pointers to current QP data. */
506  gCur = &( g[k*nV] );
507  lbCur = &( lb[k*nV] );
508  ubCur = &( ub[k*nV] );
509 
510  /* 2) Set nWSR and maximum CPU time. */
511  nWSRcur = maxAllowedNWSR;
512  CPUtimeCur = CPUtimeLimit;
513 
514  /* 3) Solve current QP. */
515  if ( ( k == 0 ) || ( useHotstarts == BT_FALSE ) )
516  {
517  /* initialise */
518  returnvalue = qp.init( H,gCur,lbCur,ubCur, nWSRcur,&CPUtimeCur );
519  if ( ( returnvalue != SUCCESSFUL_RETURN ) && ( returnvalue != RET_MAX_NWSR_REACHED ) )
520  {
521  delete H; delete[] y; delete[] x;
522  return THROWERROR( returnvalue );
523  }
524  }
525  else
526  {
527  /* hotstart */
528  returnvalue = qp.hotstart( gCur,lbCur,ubCur, nWSRcur,&CPUtimeCur );
529  if ( ( returnvalue != SUCCESSFUL_RETURN ) && ( returnvalue != RET_MAX_NWSR_REACHED ) )
530  {
531  delete H; delete[] y; delete[] x;
532  return THROWERROR( returnvalue );
533  }
534  }
535 
536  /* 4) Obtain solution vectors and objective function value ... */
537  qp.getPrimalSolution( x );
538  qp.getDualSolution( y );
539  //obj = qp.getObjVal( );
540 
541  /* 5) Compute KKT residuals */
542  getKktViolation( nV, _H,gCur,lbCur,ubCur, x,y, stat,feas,cmpl );
543 
544  /* 6) update maximum values. */
545  if ( nWSRcur > maxNWSR )
546  maxNWSR = nWSRcur;
547  if (stat > maxStationarity) maxStationarity = stat;
548  if (feas > maxFeasibility) maxFeasibility = feas;
549  if (cmpl > maxComplementarity) maxComplementarity = cmpl;
550 
551  if ( CPUtimeCur > maxCPUtime )
552  maxCPUtime = CPUtimeCur;
553 
554  avgNWSR += nWSRcur;
555  avgCPUtime += CPUtimeCur;
556  }
557  avgNWSR /= nQP;
558  avgCPUtime /= ((double)nQP);
559 
560  delete H; delete[] y; delete[] x;
561 
562  return SUCCESSFUL_RETURN;
563 }
564 
565 
566 /*
567  * r u n O q p B e n c h m a r k
568  */
569 returnValue runOqpBenchmark( const char* path, BooleanType isSparse, const Options& options,
570  int_t& nWSR, real_t& maxCPUtime,
571  real_t& maxStationarity, real_t& maxFeasibility, real_t& maxComplementarity
572  )
573 {
574  real_t maxNWSR = 0.0;
575  real_t avgNWSR = 0.0;
576  real_t avgCPUtime = 0.0;
577 
578  returnValue returnvalue = runOqpBenchmark( path,isSparse,BT_TRUE,
579  options,nWSR,
580  maxNWSR,avgNWSR,maxCPUtime,avgCPUtime,
581  maxStationarity,maxFeasibility,maxComplementarity
582  );
583  nWSR = (int_t)maxNWSR;
584 
585  return returnvalue;
586 }
587 
588 
589 /*
590  * r u n O q p B e n c h m a r k
591  */
592 returnValue runOqpBenchmark( const char* path, BooleanType isSparse, BooleanType useHotstarts,
593  const Options& options, int_t maxAllowedNWSR,
594  real_t& maxNWSR, real_t& avgNWSR, real_t& maxCPUtime, real_t& avgCPUtime,
595  real_t& maxStationarity, real_t& maxFeasibility, real_t& maxComplementarity
596  )
597 {
598  int_t nQP=0, nV=0, nC=0, nEC=0;
599 
600  real_t *H=0, *g=0, *A=0, *lb=0, *ub=0, *lbA=0, *ubA=0;
601 
602 
603  returnValue returnvalue;
604 
605  /* I) SETUP BENCHMARK: */
606  /* 1) Obtain QP sequence dimensions. */
607  if ( readOqpDimensions( path, nQP,nV,nC,nEC ) != SUCCESSFUL_RETURN )
609 
610  /* 2) Read OQP benchmark data. */
611  if ( readOqpData( path,
612  nQP,nV,nC,nEC,
613  &H,&g,&A,&lb,&ub,&lbA,&ubA,
614  0,0,0
615  ) != SUCCESSFUL_RETURN )
616  {
618  }
619 
620  // normaliseConstraints( nV,nC,A,lbA,ubA ); //only works when nP==1
621 
622  /* II) SOLVE BENCHMARK */
623  if ( nC > 0 )
624  {
625  returnvalue = solveOqpBenchmark( nQP,nV,nC,nEC,
626  H,g,A,lb,ub,lbA,ubA,
627  isSparse,useHotstarts,
628  options,maxAllowedNWSR,
629  maxNWSR,avgNWSR,maxCPUtime,avgCPUtime,
630  maxStationarity,maxFeasibility,maxComplementarity
631  );
632 
633  if ( returnvalue != SUCCESSFUL_RETURN )
634  {
635  if ( H != 0 ) delete[] H;
636  if ( g != 0 ) delete[] g;
637  if ( A != 0 ) delete[] A;
638  if ( lb != 0 ) delete[] lb;
639  if ( ub != 0 ) delete[] ub;
640  if ( lbA != 0 ) delete[] lbA;
641  if ( ubA != 0 ) delete[] ubA;
642  return THROWERROR( returnvalue );
643  }
644  }
645  else
646  {
647  returnvalue = solveOqpBenchmark( nQP,nV,
648  H,g,lb,ub,
649  isSparse,useHotstarts,
650  options,maxAllowedNWSR,
651  maxNWSR,avgNWSR,maxCPUtime,avgCPUtime,
652  maxStationarity,maxFeasibility,maxComplementarity
653  );
654 
655  if ( returnvalue != SUCCESSFUL_RETURN )
656  {
657  if ( H != 0 ) delete[] H;
658  if ( g != 0 ) delete[] g;
659  if ( A != 0 ) delete[] A;
660  if ( lb != 0 ) delete[] lb;
661  if ( ub != 0 ) delete[] ub;
662  return THROWERROR( returnvalue );
663  }
664  }
665 
666  if ( H != 0 ) delete[] H;
667  if ( g != 0 ) delete[] g;
668  if ( A != 0 ) delete[] A;
669  if ( lb != 0 ) delete[] lb;
670  if ( ub != 0 ) delete[] ub;
671  if ( lbA != 0 ) delete[] lbA;
672  if ( ubA != 0 ) delete[] ubA;
673 
674  return SUCCESSFUL_RETURN;
675 }
676 
677 
679 
680 
681 /*
682  * end of file
683  */
BEGIN_NAMESPACE_QPOASES returnValue readOqpDimensions(const char *path, int_t &nQP, int_t &nV, int_t &nC, int_t &nEC)
Interfaces matrix-vector operations tailored to symmetric sparse matrices.
returnValue init(const real_t *const _H, const real_t *const _g, const real_t *const _A, const real_t *const _lb, const real_t *const _ub, const real_t *const _lbA, const real_t *const _ubA, int &nWSR, const real_t *const yOpt=0, real_t *const cputime=0)
Implements the online active set strategy for box-constrained QPs.
returnValue getKktViolation(int_t nV, int_t nC, const real_t *const H, const real_t *const g, const real_t *const A, const real_t *const lb, const real_t *const ub, const real_t *const lbA, const real_t *const ubA, const real_t *const x, const real_t *const y, real_t &stat, real_t &feas, real_t &cmpl, const real_t *const workingSetB=0, const real_t *const workingSetC=0, BooleanType hasIdentityHessian=BT_FALSE)
Allows to pass back messages to the calling function.
Interfaces matrix-vector operations tailored to symmetric dense matrices.
returnValue init(const real_t *const _H, const real_t *const _g, const real_t *const _lb, const real_t *const _ub, int &nWSR, const real_t *const yOpt=0, real_t *const cputime=0)
returnValue hotstart(const real_t *const g_new, const real_t *const lb_new, const real_t *const ub_new, const real_t *const lbA_new, const real_t *const ubA_new, int &nWSR, real_t *const cputime)
returnValue readFromFile(real_t *data, int nrow, int ncol, const char *datafilename)
Interfaces matrix-vector operations tailored to general sparse matrices.
returnValue setOptions(const Options &_options)
returnValue hotstart(const real_t *const g_new, const real_t *const lb_new, const real_t *const ub_new, int &nWSR, real_t *const cputime)
Interfaces matrix-vector operations tailored to general dense matrices.
Provides a generic way to set and pass user-specified options.
Definition: options.hpp:65
Abstract base class for interfacing tailored matrix-vector operations.
returnValue runOqpBenchmark(const char *path, BooleanType isSparse, const Options &options, int_t &nWSR, real_t &maxCPUtime, real_t &maxStationarity, real_t &maxFeasibility, real_t &maxComplementarity)
#define BT_TRUE
Definition: acado_types.hpp:47
returnValue solveOqpBenchmark(int_t nQP, int_t nV, int_t nC, int_t nEC, const real_t *const _H, const real_t *const g, const real_t *const _A, const real_t *const lb, const real_t *const ub, const real_t *const lbA, const real_t *const ubA, BooleanType isSparse, const Options &options, int_t &nWSR, real_t &maxCPUtime, real_t &maxStationarity, real_t &maxFeasibility, real_t &maxComplementarity)
#define BT_FALSE
Definition: acado_types.hpp:49
double real_t
Definition: AD_test.c:10
Implements the online active set strategy for QPs with general constraints.
returnValue readOqpData(const char *path, int_t &nQP, int_t &nV, int_t &nC, int_t &nEC, real_t **H, real_t **g, real_t **A, real_t **lb, real_t **ub, real_t **lbA, real_t **ubA, real_t **xOpt, real_t **yOpt, real_t **objOpt)
Abstract base class for interfacing matrix-vector operations tailored to symmetric matrices...


acado
Author(s): Milan Vukov, Rien Quirynen
autogenerated on Mon Jun 10 2019 12:34:55