56 #ifdef __CODE_GENERATION__ 67 if ( ( _nV <= 0 ) || ( _nV >
NVMAX ) )
74 if ( ( _nC < 0 ) || ( _nC >
NCMAX ) )
84 _THIS->
H = &(_THIS->
HH);
86 for( i=0; i<_nV; ++i ) _THIS->
g[i] = 0.0;
87 for( i=0; i<_nV; ++i ) _THIS->
lb[i] = 0.0;
88 for( i=0; i<_nV; ++i ) _THIS->
ub[i] = 0.0;
90 for( i=0; i<_nV; ++i ) _THIS->
x[i] = 0.0;
91 for( i=0; i<_nV+_nC; ++i ) _THIS->
y[i] = 0.0;
115 _THIS->
A = &(_THIS->
AA);
117 for( i=0; i<_nC; ++i ) _THIS->
lbA[i] = 0.0;
118 for( i=0; i<_nC; ++i ) _THIS->
ubA[i] = 0.0;
152 memcpy( TO->
x,FROM->
x,_nV*
sizeof(
real_t) );
180 memcpy( TO->
y,FROM->
y,(_nV+_nC)*
sizeof(
real_t) );
243 for( i=0; i<NVMAX*NVMAX; ++i )
328 const char*
const lb_file,
const char*
const ub_file,
329 const char*
const lbA_file,
const char*
const ubA_file,
379 if ( guessedBounds != 0 )
381 for( i=0; i<nV; ++i )
388 if ( guessedConstraints != 0 )
390 for( i=0; i<nC; ++i )
396 if ( ( xOpt == 0 ) && ( yOpt != 0 ) && ( ( guessedBounds != 0 ) || ( guessedConstraints != 0 ) ) )
399 if ( ( _R != 0 ) && ( ( xOpt != 0 ) || ( yOpt != 0 ) || ( guessedBounds != 0 ) || ( guessedConstraints != 0 ) ) )
437 if ( guessedBounds != 0 )
439 for( i=0; i<nV; ++i )
446 if ( guessedConstraints != 0 )
448 for( i=0; i<nC; ++i )
454 if ( ( xOpt == 0 ) && ( yOpt != 0 ) && ( ( guessedBounds != 0 ) || ( guessedConstraints != 0 ) ) )
457 if ( ( _R != 0 ) && ( ( xOpt != 0 ) || ( yOpt != 0 ) || ( guessedBounds != 0 ) || ( guessedConstraints != 0 ) ) )
473 const char*
const lb_file,
const char*
const ub_file,
474 const char*
const lbA_file,
const char*
const ubA_file,
478 const char*
const R_file
496 if ( guessedBounds != 0 )
498 for( i=0; i<nV; ++i )
505 if ( guessedConstraints != 0 )
507 for( i=0; i<nC; ++i )
513 if ( ( xOpt == 0 ) && ( yOpt != 0 ) && ( ( guessedBounds != 0 ) || ( guessedConstraints != 0 ) ) )
516 if ( ( R_file != 0 ) && ( ( xOpt != 0 ) || ( yOpt != 0 ) || ( guessedBounds != 0 ) || ( guessedConstraints != 0 ) ) )
590 int nWSR_max = *
nWSR;
591 int nWSR_performed = 0;
594 real_t cputime_needed = 0.0;
646 for (i = 0; i < nV; i++)
647 if ((ub_new[i] <
QPOASES_INFTY) && (ub_new[i] > farbound)) farbound = ub_new[i];
649 for (i = 0; i < nV; i++)
650 if ((lb_new[i] > -
QPOASES_INFTY) && (lb_new[i] < -farbound)) farbound = -lb_new[i];
652 for (i = 0; i < nC; i++)
653 if ((ubA_new[i] <
QPOASES_INFTY) && (ubA_new[i] > farbound)) farbound = ubA_new[i];
655 for (i = 0; i < nC; i++)
656 if ((lbA_new[i] > -
QPOASES_INFTY) && (lbA_new[i] < -farbound)) farbound = -lbA_new[i];
659 lb_new,lb_new_far, ub_new,ub_new_far,
660 lbA_new,lbA_new_far, ubA_new,ubA_new_far
668 cputime_remaining = *cputime - cputime_needed;
669 pcputime_rem = &cputime_remaining;
676 nWSR,pcputime_rem,nWSR_performed,
680 nWSR_performed = *
nWSR;
681 cputime_needed += cputime_remaining;
697 lb_new,lb_new_far, ub_new,ub_new_far,
698 lbA_new,lbA_new_far, ubA_new,ubA_new_far
705 for ( i=0; i<nV; ++i )
707 if ( ( ( lb_new == 0 ) || ( lb_new_far[i] > lb_new[i] ) ) && (
qpOASES_getAbs ( lb_new_far[i] - _THIS->
x[i] ) < tol ) )
709 if ( ( ( ub_new == 0 ) || ( ub_new_far[i] < ub_new[i] ) ) && (
qpOASES_getAbs ( ub_new_far[i] - _THIS->
x[i] ) < tol ) )
712 for ( i=0; i<nC; ++i )
714 if ( ( ( lbA_new == 0 ) || ( lbA_new_far[i] > lbA_new[i] ) ) && (
qpOASES_getAbs ( lbA_new_far[i] - _THIS->
Ax[i] ) < tol ) )
716 if ( ( ( ubA_new == 0 ) || ( ubA_new_far[i] < ubA_new[i] ) ) && (
qpOASES_getAbs ( ubA_new_far[i] - _THIS->
Ax[i] ) < tol ) )
720 if ( nActiveFar == 0 )
733 lb_new,lb_new_far, ub_new,ub_new_far,
734 lbA_new,lbA_new_far, ubA_new,ubA_new_far
749 *cputime = cputime_needed;
760 const char*
const lb_file,
const char*
const ub_file,
761 const char*
const lbA_file,
const char*
const ubA_file,
786 g_new,lb_new,ub_new,lbA_new,ubA_new
792 returnvalue =
QProblem_hotstart( _THIS,g_new,lb_new,ub_new,lbA_new,ubA_new, nWSR,cputime );
813 Bounds* actualGuessedBounds;
828 if ( ( guessedBounds != 0 ) || ( guessedConstraints != 0 ) )
833 actualGuessedBounds = ( guessedBounds != 0 ) ? guessedBounds : &(_THIS->
bounds);
834 actualGuessedConstraints = ( guessedConstraints != 0 ) ? guessedConstraints : &(_THIS->
constraints);
851 returnvalue =
QProblem_hotstart( _THIS,g_new,lb_new,ub_new,lbA_new,ubA_new, nWSR,cputime );
865 const char*
const lb_file,
const char*
const ub_file,
866 const char*
const lbA_file,
const char*
const ubA_file,
891 g_new,lb_new,ub_new,lbA_new,ubA_new
899 returnvalue =
QProblem_hotstartW( _THIS,g_new,lb_new,ub_new,lbA_new,ubA_new, nWSR,cputime,
900 guessedBounds,guessedConstraints
939 if ( ( x_out == 0 ) || ( y_out == 0 ) )
946 for ( ii = 0 ; ii < (nV+nC)*n_rhs; ++ii )
949 for ( ii = 0 ; ii < n_rhs; ++ii )
953 delta_xFX, delta_xFR, delta_yAC, delta_yFX );
955 for ( jj = 0; jj < nFX; ++jj )
956 x_out[FX_idx[jj]] = delta_xFX[jj];
957 for ( jj = 0; jj < nFR; ++jj )
958 x_out[FR_idx[jj]] = delta_xFR[jj];
959 for ( jj = 0; jj < nFX; ++jj )
960 y_out[FX_idx[jj]] = delta_yFX[jj];
961 for ( jj = 0; jj < nAC; ++jj )
962 y_out[nV+AC_idx[jj]] = delta_yAC[jj];
985 if ( workingSet == 0 )
1007 for (i = 0; i < nV; i++) {
1009 case ST_LOWER: workingSetB[i] = -1.0;
break;
1010 case ST_UPPER: workingSetB[i] = +1.0;
break;
1011 default: workingSetB[i] = 0.0;
break;
1027 if ( workingSetC == 0 )
1030 for ( i=0; i<nC; ++i )
1034 case ST_LOWER: workingSetC[i] = -1.0;
break;
1035 case ST_UPPER: workingSetC[i] = +1.0;
break;
1036 default: workingSetC[i] = 0.0;
break;
1063 yOpt[i] = _THIS->
y[i];
1130 for( i=0; i<nV; ++i )
1131 objVal += _x[i]*_THIS->
g[i];
1139 for( i=0; i<nV; ++i )
1140 objVal += 0.5*_x[i]*_x[i];
1145 for( i=0; i<nV; ++i )
1146 objVal += 0.5*_x[i]*Hx[i];
1157 for( i=0; i<nV; ++i )
1158 objVal += 0.5*_x[i]*_THIS->
regVal*_x[i];
1179 xOpt[i] = _THIS->
x[i];
1195 #ifndef __SUPPRESSANYOUTPUT__ 1251 #ifndef __SUPPRESSANYOUTPUT__ 1259 qpOASES_myPrintf(
"\n################# qpOASES -- QP PROPERTIES #################\n" );
1309 qpOASES_myPrintf(
"Hessian is zero matrix (i.e. actually an LP is solved).\n" );
1321 qpOASES_myPrintf(
"Hessian matrix is positive definite on null space of active constraints.\n" );
1354 qpOASES_myPrintf(
"Status of QP object: freshly instantiated or reset.\n" );
1358 qpOASES_myPrintf(
"Status of QP object: an auxiliary QP is currently setup.\n" );
1366 qpOASES_myPrintf(
"Status of QP object: a homotopy step is performed.\n" );
1370 qpOASES_myPrintf(
"Status of QP object: an intermediate QP along the homotopy path was solved.\n" );
1374 qpOASES_myPrintf(
"Status of QP object: solution of the actual QP was found.\n" );
1381 qpOASES_myPrintf(
"Print level of QP object is set to display a tabular output for debugging.\n" );
1385 qpOASES_myPrintf(
"Print level of QP object is set to display a tabular output.\n" );
1389 qpOASES_myPrintf(
"Print level of QP object is low, i.e. only error are printed.\n" );
1393 qpOASES_myPrintf(
"Print level of QP object is medium, i.e. error and warnings are printed.\n" );
1397 qpOASES_myPrintf(
"Print level of QP object is high, i.e. all available output is printed.\n" );
1450 if ( _THIS->
H != 0 )
1459 if ( _THIS->
H == 0 )
1481 for ( i=0; i<nV; ++i )
1534 unsigned long _nFR = (
unsigned long)nFR, _nV =
NVMAX;
1548 for( i=0; i<nV; ++i )
1559 for( i=0; i<nV; ++i )
1569 for ( j=0; j<nFR; ++j )
1573 POTRF(
"U", &_nFR, _THIS->
R, &_nV, &info );
1577 if ( _THIS->
R[0] < 0.0 )
1590 for (i=0;i<nFR-1;++i)
1613 if ( ( auxiliaryBounds == 0 ) || ( auxiliaryBounds == guessedBounds ) )
1617 if ( guessedBounds != 0 )
1621 for( i=0; i<nV; ++i )
1623 #ifdef __ALWAYS_INITIALISE_WITH_ALL_EQUALITIES__ 1639 if ( ( xOpt != 0 ) && ( yOpt == 0 ) )
1642 for( i=0; i<nV; ++i )
1659 #ifdef __ALWAYS_INITIALISE_WITH_ALL_EQUALITIES__ 1674 if ( ( xOpt == 0 ) && ( yOpt != 0 ) )
1677 for( i=0; i<nV; ++i )
1694 #ifdef __ALWAYS_INITIALISE_WITH_ALL_EQUALITIES__ 1712 if ( ( xOpt == 0 ) && ( yOpt == 0 ) )
1714 for( i=0; i<nV; ++i )
1724 #ifdef __ALWAYS_INITIALISE_WITH_ALL_EQUALITIES__ 1771 if ( removingBound ==
BT_TRUE )
1783 for( i=(nR-1); i>=0; --i )
1786 for( j=(i+1); j<nR; ++j )
1787 sum -=
RR(i,j) * a[j];
1790 a[i] = sum /
RR(i,i);
1798 for( i=0; i<nR; ++i )
1801 for( j=0; j<i; ++j )
1802 sum -=
RR(j,i) * a[j];
1805 a[i] = sum /
RR(i,i);
1832 for( i=0; i<nV; ++i )
1833 delta_g[i] = g_new[i] - _THIS->
g[i];
1837 for( i=0; i<nV; ++i )
1838 delta_lb[i] = lb_new[i] - _THIS->
lb[i];
1843 for( i=0; i<nV; ++i )
1849 for( i=0; i<nV; ++i )
1850 delta_ub[i] = ub_new[i] - _THIS->
ub[i];
1855 for( i=0; i<nV; ++i )
1862 for ( i=0; i<nFX; ++i )
1920 const char*
const lb_file,
const char*
const ub_file
1962 for( i=0; i<nV; ++i )
1976 for( i=0; i<nV; ++i )
1997 if ( ( g_file != 0 ) && ( g_new != 0 ) )
2069 real_t elapsedTime, timePerIteration;
2080 timePerIteration = elapsedTime / ((
real_t) nWSR);
2084 if ( ( elapsedTime + timePerIteration*1.25 ) <= ( *cputime ) )
2135 const int*
const idxList,
2149 for( i=0; i<nIdx; ++i )
2159 *t = num[i] / den[i];
2168 *t = num[i] / den[i];
2192 for (i = 0; i < nV; i++)
2195 if (s < 1.0) s = 1.0;
2197 if (d > len) len = d;
2203 for (i = 0; i < nV; i++)
2206 if (s < 1.0) s = 1.0;
2208 if (d > len) len = d;
2215 for (i = 0; i < nV; i++)
2218 if (s < 1.0) s = 1.0;
2220 if (d > len) len = d;
2334 if ( _R == _THIS->
R )
2339 else if ( ( xOpt == 0 ) && ( yOpt == 0 ) && ( guessedBounds == 0 ) && ( guessedConstraints == 0 ) )
2341 for( i=0; i<nV; ++i )
2342 for( j=i; j<nV; ++j )
2343 RR(i,j) = _R[i*nV+j];
2354 for( i=0; i<nV; ++i )
2355 g_original[i] = _THIS->
g[i];
2356 for( i=0; i<nV; ++i )
2357 lb_original[i] = _THIS->
lb[i];
2358 for( i=0; i<nV; ++i )
2359 ub_original[i] = _THIS->
ub[i];
2361 for( i=0; i<nC; ++i )
2362 lbA_original[i] = _THIS->
lbA[i];
2363 for( i=0; i<nC; ++i )
2364 ubA_original[i] = _THIS->
ubA[i];
2387 returnvalue =
QProblem_hotstart( _THIS,g_original,lb_original,ub_original,lbA_original,ubA_original, nWSR,cputime );
2418 int*
nWSR,
real_t*
const cputime,
int nWSRperformed,
2448 #ifndef __SUPPRESSANYOUTPUT__ 2482 for( iter=nWSRperformed; iter<*
nWSR; ++iter )
2499 #ifndef __SUPPRESSANYOUTPUT__ 2510 delta_g,delta_lbA,delta_ubA,delta_lb,delta_ub,
2511 &Delta_bC_isZero,&Delta_bB_isZero
2526 Delta_bC_isZero, Delta_bB_isZero,
2527 delta_xFX,delta_xFR,delta_yAC,delta_yFX
2543 delta_xFX,delta_xFR,delta_yAC,delta_yFX,
2544 &BC_idx,&BC_status,&BC_isBound
2561 if ( homotopyLength <= _THIS->
options.terminationTolerance )
2638 #ifndef __SUPPRESSANYOUTPUT__ 2659 int*
nWSR,
real_t*
const cputime,
int nWSRperformed,
2668 int nWSR_max = *
nWSR;
2669 int nWSR_total = nWSRperformed;
2671 real_t cputime_total = 0.0;
2672 real_t cputime_cur = 0.0;
2678 return QProblem_solveQP( _THIS,g_new,lb_new,ub_new,lbA_new,ubA_new, nWSR,cputime,nWSRperformed,isFirstCall );
2684 returnvalue =
QProblem_solveQP( _THIS,g_new,lb_new,ub_new,lbA_new,ubA_new, nWSR,0,nWSRperformed,isFirstCall );
2688 cputime_cur = *cputime;
2689 returnvalue =
QProblem_solveQP( _THIS,g_new,lb_new,ub_new,lbA_new,ubA_new, nWSR,&cputime_cur,nWSRperformed,isFirstCall );
2692 cputime_total += cputime_cur;
2699 *cputime = cputime_total;
2713 for( i=0; i<nV; ++i )
2714 gMod[i] = g_new[i] - _THIS->
regVal*_THIS->
x[i];
2723 returnvalue =
QProblem_solveQP( _THIS,gMod,lb_new,ub_new,lbA_new,ubA_new, nWSR,0,nWSR_total,isFirstCall );
2727 cputime_cur = *cputime - cputime_total;
2728 returnvalue =
QProblem_solveQP( _THIS,gMod,lb_new,ub_new,lbA_new,ubA_new, nWSR,&cputime_cur,nWSR_total,isFirstCall );
2732 cputime_total += cputime_cur;
2738 *cputime = cputime_total;
2747 for( i=0; i<nV; ++i )
2748 _THIS->
g[i] = g_new[i];
2751 *cputime = cputime_total;
2784 for( i=0; i<nV; ++i )
2798 for( i=0; i<nV; ++i )
2809 if ( ( lb_new != 0 ) && ( ub_new != 0 ) )
2811 for( i=0; i<nV; ++i )
2831 if ( ( lb_new == 0 ) && ( ub_new == 0 ) )
2833 for( i=0; i<nV; ++i )
2838 for( i=0; i<nV; ++i )
2849 for( i=0; i<nC; ++i )
2863 for( i=0; i<nC; ++i )
2874 if ( ( lbA_new != 0 ) && ( ubA_new != 0 ) )
2876 for( i=0; i<nC; ++i )
2898 if ( ( lbA_new == 0 ) && ( ubA_new == 0 ) )
2900 for( i=0; i<nC; ++i )
2905 for( i=0; i<nC; ++i )
2924 int *FR_idx, *AC_idx;
2927 unsigned long _nZ = (
unsigned long)nZ, _nV =
NVMAX;
2970 for ( j=0; j < nZ; ++j ) {
2971 for ( i=0; i < nV; ++i )
2973 QQ(FR_idx[j],j) = 1.0;
2976 for ( j=0; j < nFR; ++j )
2985 POTRF(
"U", &_nZ, _THIS->
R, &_nV, &info );
2989 if ( _THIS->
R[0] < 0.0 )
3001 for (i=0;i<nZ-1;++i)
3023 for( i=0; i<nFR; ++i )
3054 if ( ( auxiliaryBounds == 0 ) || ( auxiliaryBounds == guessedBounds ) )
3057 if ( ( auxiliaryConstraints == 0 ) || ( auxiliaryConstraints == guessedConstraints ) )
3065 if ( guessedConstraints != 0 )
3069 for( i=0; i<nC; ++i )
3074 #ifdef __ALWAYS_INITIALISE_WITH_ALL_EQUALITIES__ 3091 if ( ( xOpt != 0 ) && ( yOpt == 0 ) )
3093 for( i=0; i<nC; ++i )
3110 #ifdef __ALWAYS_INITIALISE_WITH_ALL_EQUALITIES__ 3126 if ( ( xOpt == 0 ) && ( yOpt != 0 ) )
3128 for( i=0; i<nC; ++i )
3145 #ifdef __ALWAYS_INITIALISE_WITH_ALL_EQUALITIES__ 3163 if ( ( xOpt == 0 ) && ( yOpt == 0 ) )
3165 for( i=0; i<nC; ++i )
3168 #ifdef __ALWAYS_INITIALISE_WITH_ALL_EQUALITIES__ 3193 Bounds*
const auxiliaryBounds,
3208 if ( auxiliaryBounds != 0 )
3210 for( i=0; i<nV; ++i )
3219 if ( auxiliaryConstraints != 0 )
3221 for( i=0; i<nC; ++i )
3231 for (i = 0; i < nV; i++)
3237 for (i = 0; i < nC; i++)
3249 for (i = 0; i < nV; i++)
3273 for( i=0; i<nC; ++i )
3286 for( i=0; i<nV; ++i )
3302 for( i=0; i<nV; ++i )
3318 for( i=0; i<nC; ++i )
3344 for( i=0; i<nV; ++i )
3359 for( i=0; i<nC; ++i )
3400 if ( xOpt != _THIS->
x )
3401 for( i=0; i<nV; ++i )
3402 _THIS->
x[i] = xOpt[i];
3406 for ( j=0; j<nC; ++j )
3408 _THIS->
Ax_l[j] = _THIS->
Ax[j];
3409 _THIS->
Ax_u[j] = _THIS->
Ax[j];
3414 for( i=0; i<nV; ++i )
3417 for ( j=0; j<nC; ++j )
3420 _THIS->
Ax_l[j] = 0.0;
3421 _THIS->
Ax_u[j] = 0.0;
3427 if ( yOpt != _THIS->
y )
3428 for( i=0; i<nV+nC; ++i )
3429 _THIS->
y[i] = yOpt[i];
3433 for( i=0; i<nV+nC; ++i )
3457 for ( i=0; i<nV; ++i )
3458 _THIS->
g[i] = _THIS->
y[i];
3460 for ( i=0; i<nV; ++i )
3461 _THIS->
g[i] = _THIS->
y[i] - _THIS->
regVal*_THIS->
x[i];
3465 for ( i=0; i<nV; ++i )
3466 _THIS->
g[i] = _THIS->
y[i] - _THIS->
x[i];
3471 for ( i=0; i<nV; ++i )
3472 _THIS->
g[i] = _THIS->
y[i];
3490 Bounds*
const auxiliaryBounds,
3501 for ( i=0; i<nV; ++i )
3506 if ( useRelaxation ==
BT_TRUE )
3510 _THIS->
lb[i] = _THIS->
x[i];
3511 _THIS->
ub[i] = _THIS->
x[i];
3519 _THIS->
lb[i] = _THIS->
x[i];
3524 _THIS->
ub[i] = _THIS->
x[i];
3532 _THIS->
lb[i] = _THIS->
x[i];
3535 _THIS->
ub[i] = _THIS->
x[i];
3539 if ( useRelaxation ==
BT_TRUE )
3545 _THIS->
ub[i] = _THIS->
x[i];
3548 _THIS->
lb[i] = _THIS->
x[i];
3552 if ( useRelaxation ==
BT_TRUE )
3566 for ( i=0; i<nC; ++i )
3571 if ( useRelaxation ==
BT_TRUE )
3575 _THIS->
lbA[i] = _THIS->
Ax_l[i];
3576 _THIS->
ubA[i] = _THIS->
Ax_u[i];
3584 _THIS->
lbA[i] = _THIS->
Ax_l[i];
3589 _THIS->
ubA[i] = _THIS->
Ax_u[i];
3597 _THIS->
lbA[i] = _THIS->
Ax_l[i];
3600 _THIS->
ubA[i] = _THIS->
Ax_l[i];
3604 if ( useRelaxation ==
BT_TRUE )
3610 _THIS->
ubA[i] = _THIS->
Ax_u[i];
3613 _THIS->
lbA[i] = _THIS->
Ax_u[i];
3617 if ( useRelaxation ==
BT_TRUE )
3649 int nFR, nAC, nZ, tcol;
3681 switch ( ensureLIreturnvalue )
3708 tcol = _THIS->
sizeT - nAC;
3712 for( i=0; i<nZ; ++i )
3721 for( i=0; i<nFR; ++i )
3724 for( j=0; j<nZ; ++j )
3725 wZ[j] += aFR[i] *
QQ(ii,j);
3731 for( j=0; j<nAC; ++j )
3732 TT(nAC,tcol+j) = 0.0;
3733 for( i=0; i<nFR; ++i )
3736 for( j=0; j<nAC; ++j )
3737 TT(nAC,tcol+j) += aFR[i] *
QQ(ii,nZ+j);
3746 for( j=0; j<nZ-1; ++j )
3751 for( i=0; i<nFR; ++i )
3754 QProblemB_applyGivens( c,s,nu,
QQ(ii,1+j),
QQ(ii,j), &
QQ(ii,1+j),&
QQ(ii,j) );
3757 if ( ( updateCholesky ==
BT_TRUE ) &&
3760 for( i=0; i<=j+1; ++i )
3761 QProblemB_applyGivens( c,s,nu,
RR(i,1+j),
RR(i,j), &
RR(i,1+j),&
RR(i,j) );
3765 TT(nAC,tcol-1) = wZ[nZ-1];
3768 if ( ( updateCholesky ==
BT_TRUE ) &&
3773 for( i=0; i<nZ-1; ++i )
3778 for( j=(1+i); j<(nZ-1); ++j )
3779 QProblemB_applyGivens( c,s,nu,
RR(i,j),
RR(1+i,j), &
RR(i,j),&
RR(1+i,j) );
3782 for( i=0; i<nZ; ++i )
3816 int *FX_idx, *AC_idx, *IAC_idx, *FR_idx;
3846 dim = (nC>nV)?nC:nV;
3847 for (ii = 0; ii < dim; ++ii)
3855 delta_xFX, delta_xFR, delta_yAC, delta_yFX);
3858 for (ii = 0; ii < nAC; ++ii)
3861 if (weight < a) weight = a;
3863 for (ii = 0; ii < nFX; ++ii)
3866 if (weight < a) weight = a;
3870 for (ii = 0; ii < nFX; ++ii)
3873 if (zero < a) zero = a;
3875 for (ii = 0; ii < nFR; ++ii)
3878 if (zero < a) zero = a;
3897 for (i = 0; i < nFR; i++)
3898 l2 += Arow[i]*Arow[i];
3900 for( j=0; j<nZ; ++j )
3903 for( i=0; i<nFR; ++i )
3906 sum += Arow[i] *
QQ(ii,j);
3928 #ifndef __SUPPRESSANYOUTPUT__ 3938 int *FR_idx, *FX_idx, *AC_idx;
3949 int y_min_number = -1;
3950 int y_min_number_bound = -1;
3977 for( i=0; i<nAC; ++i )
3980 for( j=0; j<nFR; ++j )
3983 xiC_TMP[i] +=
QQ(jj,nZ+i) * Arow[j];
4003 for( i=0; i<nAC; ++i )
4006 num[i] = _THIS->
y[nV+ii];
4012 for( i=0; i<nFX; ++i )
4015 num[i] = _THIS->
y[ii];
4020 if ( y_min_number_bound >= 0 )
4022 y_min_number = y_min_number_bound;
4028 if ( y_min_number >= 0 )
4031 for( i=0; i<nAC; ++i )
4034 _THIS->
y[nV+ii] -= y_min * xiC[i];
4036 for( i=0; i<nFX; ++i )
4039 _THIS->
y[ii] -= y_min * xiB[i];
4044 _THIS->
y[nV+number] = y_min;
4046 _THIS->
y[nV+number] = -y_min;
4049 if ( y_min_isBound ==
BT_TRUE )
4051 #ifndef __SUPPRESSANYOUTPUT__ 4063 _THIS->
y[y_min_number] = 0.0;
4067 #ifndef __SUPPRESSANYOUTPUT__ 4079 _THIS->
y[nV+y_min_number] = 0.0;
4115 int nFR, nAC, nZ, tcol, lastfreenumber;
4146 switch ( ensureLIreturnvalue )
4173 tcol = _THIS->
sizeT - nAC;
4179 if ( lastfreenumber != number )
4188 for( i=0; i<nFR; ++i )
4189 w[i] =
QQ(FR_idx[nFR-1],i);
4194 for( j=0; j<nZ-1; ++j )
4199 for( i=0; i<nFR; ++i )
4202 QProblemB_applyGivens( c,s,nu,
QQ(ii,1+j),
QQ(ii,j), &
QQ(ii,1+j),&
QQ(ii,j) );
4205 if ( ( updateCholesky ==
BT_TRUE ) &&
4208 for( i=0; i<=j+1; ++i )
4209 QProblemB_applyGivens( c,s,nu,
RR(i,1+j),
RR(i,j), &
RR(i,1+j),&
RR(i,j) );
4217 for( i=0; i<nAC; ++i )
4226 for( i=0; i<nFR; ++i )
4229 QProblemB_applyGivens( c,s,nu,
QQ(ii,1+j),
QQ(ii,j), &
QQ(ii,1+j),&
QQ(ii,j) );
4235 for( j=nZ; j<nFR-1; ++j )
4240 for( i=0; i<nFR; ++i )
4243 QProblemB_applyGivens( c,s,nu,
QQ(ii,1+j),
QQ(ii,j), &
QQ(ii,1+j),&
QQ(ii,j) );
4246 for( i=(nFR-2-j); i<nAC; ++i )
4252 if ( ( updateCholesky ==
BT_TRUE ) &&
4257 for( i=0; i<nZ-1; ++i )
4262 for( j=(1+i); j<nZ-1; ++j )
4263 QProblemB_applyGivens( c,s,nu,
RR(i,j),
RR(1+i,j), &
RR(i,j),&
RR(1+i,j) );
4266 for( i=0; i<nZ; ++i )
4320 for (ii = 0; ii < nV; ++ii)
4322 delta_g[number] = 1.0;
4324 dim = (nC>nV)?nC:nV;
4325 for (ii = 0; ii < dim; ++ii)
4330 delta_xFX, delta_xFR, delta_yAC, delta_yFX);
4332 returnvalue = dsdReturnValue;
4335 for (ii = 0; ii < nAC; ++ii)
4338 if (weight < a) weight = a;
4340 for (ii = 0; ii < nFX; ++ii)
4343 if (weight < a) weight = a;
4347 for (ii = 0; ii < nFX; ++ii)
4350 if (zero < a) zero = a;
4352 for (ii = 0; ii < nFR; ++ii)
4355 if (zero < a) zero = a;
4373 for( i=0; i<nZ; ++i )
4391 #ifndef __SUPPRESSANYOUTPUT__ 4400 int *FR_idx, *FX_idx, *AC_idx;
4408 int y_min_number = -1;
4409 int y_min_number_bound = -1;
4439 for( i=0; i<nAC; ++i )
4440 xiC_TMP[i] =
QQ(number,nZ+i);
4444 for( i=0; i<nAC; ++i )
4445 xiC_TMP[i] = -
QQ(number,nZ+i);
4462 for( i=0; i<nAC; ++i )
4465 num[i] = _THIS->
y[nV+ii];
4471 for( i=0; i<nFX; ++i )
4474 num[i] = _THIS->
y[ii];
4479 if ( y_min_number_bound >= 0 )
4481 y_min_number = y_min_number_bound;
4486 if ( y_min_number >= 0 )
4489 for( i=0; i<nAC; ++i )
4492 _THIS->
y[nV+ii] -= y_min * xiC[i];
4494 for( i=0; i<nFX; ++i )
4497 _THIS->
y[ii] -= y_min * xiB[i];
4502 _THIS->
y[number] = y_min;
4504 _THIS->
y[number] = -y_min;
4507 if ( y_min_isBound ==
BT_TRUE )
4509 #ifndef __SUPPRESSANYOUTPUT__ 4521 _THIS->
y[y_min_number] = 0.0;
4525 #ifndef __SUPPRESSANYOUTPUT__ 4537 _THIS->
y[nV+y_min_number] = 0.0;
4580 int tcol = _THIS->
sizeT - nAC;
4612 if ( ( number_idx < 0 ) || ( number_idx >= nAC ) )
4635 if ( number_idx < nAC-1 )
4637 for( i=(number_idx+1); i<nAC; ++i )
4638 for( j=(nAC-i-1); j<nAC; ++j )
4639 TT(i-1,tcol+j) =
TT(i,tcol+j);
4641 for( j=0; j<nAC; ++j )
4642 TT(nAC-1,tcol+j) = 0.0;
4649 for( j=(nAC-2-number_idx); j>=0; --j )
4654 for( i=(nAC-j-1); i<(nAC-1); ++i )
4655 QProblemB_applyGivens( c,s,nu,
TT(i,tcol+1+j),
TT(i,tcol+j), &
TT(i,tcol+1+j),&
TT(i,tcol+j) );
4657 for( i=0; i<nFR; ++i )
4660 QProblemB_applyGivens( c,s,nu,
QQ(ii,nZ+1+j),
QQ(ii,nZ+j), &
QQ(ii,nZ+1+j),&
QQ(ii,nZ+j) );
4667 for( j=0; j<nAC; ++j )
4668 TT(nAC-1,tcol+j) = 0.0;
4672 if ( ( updateCholesky ==
BT_TRUE ) &&
4681 for( j=0; j<nFR; ++j )
4682 z[j] =
QQ(FR_idx[j],nZ);
4683 DenseMatrix_subTimes(_THIS->
H,
Bounds_getFree( &(_THIS->
bounds) ),
Bounds_getFree( &(_THIS->
bounds) ), 1, 1.0, z, nFR, 0.0, Hz, nFR,
BT_TRUE);
4687 for ( i=0; i<nZ; ++i )
4691 for( j=0; j<nFR; ++j )
4695 for( i=0; i<nZ; ++i )
4696 ZHz[i] +=
QQ(jj,i) * Hz[j];
4705 for( i=0; i<nZ; ++i )
4713 for( j=0; j<nFR; ++j )
4714 rho2 +=
QQ(FR_idx[j],nZ) * Hz[j];
4732 _THIS->
lbA[number] = _THIS->
ubA[number]; _THIS->
Ax_l[number] = -_THIS->
Ax_u[number];
break;
4734 _THIS->
ubA[number] = _THIS->
lbA[number]; _THIS->
Ax_u[number] = -_THIS->
Ax_l[number];
break;
4742 else if ( exchangeHappened ==
BT_FALSE )
4770 if (exchangeHappened ==
BT_TRUE)
4777 if ( addBoundNotConstraint )
4814 int tcol = _THIS->
sizeT - nAC;
4816 int *FR_idx, *AC_idx;
4864 nnFRp1 = FR_idx[nFR];
4865 for( i=0; i<nFR; ++i )
4871 QQ(nnFRp1,nFR) = 1.0;
4884 for( j=(nAC-1); j>=0; --j )
4889 for( i=(nAC-j); i<nAC; ++i )
4892 for( i=0; i<=nFR; ++i )
4896 QProblemB_applyGivens( c,s,nu,
QQ(ii,nZ+1+j),
QQ(ii,nZ+j), &
QQ(ii,nZ+1+j),&
QQ(ii,nZ+j) );
4902 if ( ( updateCholesky ==
BT_TRUE ) &&
4916 for( j=0; j<nFR; ++j )
4917 z[j] =
QQ(FR_idx[j],nZ);
4919 DenseMatrix_subTimes(_THIS->
H,
Bounds_getFree( &(_THIS->
bounds) ),
Bounds_getFree( &(_THIS->
bounds) ), 1, 1.0, z, nFR+1, 0.0, Hz, nFR+1,
BT_TRUE);
4925 for( i=0; i<nZ; ++i )
4929 for( j=0; j<nFR; ++j )
4932 for( i=0; i<nZ; ++i )
4934 rhs[i] +=
QQ(jj,i) * ( Hz[j] + z2 * z[j] );
4944 for( i=0; i<nZ; ++i )
4951 for( j=0; j<nFR; ++j )
4955 rho2 +=
QQ(jj,nZ) * ( Hz[j] + 2.0*z2*z[j] );
4977 _THIS->
lb[number] = _THIS->
ub[number];
4980 _THIS->
ub[number] = _THIS->
lb[number];
4987 else if ( exchangeHappened ==
BT_FALSE )
5009 if ( addBoundNotConstraint )
5029 const int*
const idxList,
5039 for (i = 0; i < nIdx; i++)
5040 if ( (num[i] > epsNum) && (den[i] > epsDen) && ((*t) * den[i] > num[i]) )
5042 *t = num[i] / den[i];
5043 *BC_idx = idxList[i];
5060 int addLBndIdx = -1, addLCnstrIdx = -1, addUBndIdx = -1, addUCnstrIdx = -1;
5061 int *FX_idx, *AC_idx, *IAC_idx, *FR_idx;
5085 real_t sigmaLBnd, sigmaLCnstr, sigmaUBnd, sigmaUCnstr, sigma;
5096 *addBoundNotConstraint =
BT_TRUE;
5100 if (removeBoundNotConstraint)
5102 dim = nV < nC ? nC : nV;
5103 for (ii = 0; ii < dim; ++ii)
5105 for (ii = 0; ii < nV; ++ii)
5111 delta_xFX, delta_xFR, delta_yAC, delta_yFX
5116 for (ii = 0; ii < nV; ++ii)
5118 for (ii = 0; ii < nC; ++ii)
5125 delta_xFX, delta_xFR, delta_yAC, delta_yFX
5130 for (ii = 0; ii < nAC; ++ii)
5133 if (normXi < a) normXi = a;
5135 for (ii = 0; ii < nFX; ++ii)
5138 if (normXi < a) normXi = a;
5142 for (ii = 0; ii < nFX; ++ii)
5145 if (normS < a) normS = a;
5147 for (ii = 0; ii < nFR; ++ii)
5150 if (normS < a) normS = a;
5154 if (normXi < _THIS->
options.epsNZCTests * normS)
5161 for (i = 0; i < nFR; i++)
5164 x_W[i] = _THIS->
ub[ii] - _THIS->
x[ii];
5174 x_W[0] = _THIS->
ub[remIdx] - _THIS->
x[remIdx];
5179 for (i = 0; i < nFR; i++)
5182 x_W[i] = _THIS->
x[ii] - _THIS->
lb[ii];
5184 for (i = 0; i < nFR; i++)
5185 delta_xFR[i] = -delta_xFR[i];
5194 x_W[0] = _THIS->
x[remIdx] - _THIS->
lb[remIdx];
5197 for (i = 0; i < nFR; i++)
5198 delta_xFR[i] = -delta_xFR[i];
5203 DenseMatrix_subTimes(_THIS->
A,
Constraints_getInactive(&(_THIS->
constraints)),
Bounds_getFixed( &(_THIS->
bounds) ), 1, 1.0, delta_xFX, nFX, 0.0, As, nIAC,
BT_TRUE);
5204 DenseMatrix_subTimes(_THIS->
A,
Constraints_getInactive(&(_THIS->
constraints)),
Bounds_getFree( &(_THIS->
bounds) ), 1, 1.0, delta_xFR, nFR, 1.0, As, nIAC,
BT_TRUE);
5207 for (i = 0; i < nIAC; i++)
5210 Ax_W[i] = _THIS->
Ax_u[ii];
5224 for (i = 0; i < nIAC; i++)
5227 Ax_W[i] = _THIS->
Ax_l[ii];
5229 for (i = 0; i < nIAC; i++)
5244 if (sigmaUCnstr < sigma) { sigma = sigmaUCnstr; *addStatus =
ST_UPPER; *addBoundNotConstraint =
BT_FALSE; *addIdx = addUCnstrIdx; }
5245 if (sigmaLCnstr < sigma) { sigma = sigmaLCnstr; *addStatus =
ST_LOWER; *addBoundNotConstraint =
BT_FALSE; *addIdx = addLCnstrIdx; }
5246 if (sigmaUBnd < sigma) { sigma = sigmaUBnd; *addStatus =
ST_UPPER; *addBoundNotConstraint =
BT_TRUE; *addIdx = addUBndIdx; }
5247 if (sigmaLBnd < sigma) { sigma = sigmaLBnd; *addStatus =
ST_LOWER; *addBoundNotConstraint =
BT_TRUE; *addIdx = addLBndIdx; }
5256 for (i = 0; i < nFR; i++)
5257 _THIS->
x[FR_idx[i]] += sigma * delta_xFR[i];
5259 for (i = 0; i < nFX; i++)
5260 _THIS->
x[FX_idx[i]] += sigma * delta_xFX[i];
5264 for (i = 0; i < nC; i++) _THIS->
Ax_u[i] = _THIS->
ubA[i] - _THIS->
Ax[i];
5265 for (i = 0; i < nC; i++) _THIS->
Ax_l[i] = _THIS->
Ax[i] - _THIS->
lbA[i];
5284 int tcol = _THIS->
sizeT - nT;
5297 for( i=0; i<nT; ++i )
5300 for( j=0; j<i; ++j )
5301 sum -=
TT(i,_THIS->
sizeT-1-j) * a[nT-1-j];
5304 a[nT-1-i] = sum /
TT(i,_THIS->
sizeT-1-i);
5312 for( i=0; i<nT; ++i )
5315 for( j=0; j<i; ++j )
5316 sum -=
TT(nT-1-j,tcol+i) * a[nT-1-j];
5319 a[nT-1-i] = sum /
TT(nT-1-i,tcol+i);
5352 delta_g,delta_lb,delta_ub,
5358 for( i=0; i<nC; ++i )
5362 delta_lbA[i] = lbA_new[i] - _THIS->
lbA[i];
5367 for( i=0; i<nC; ++i )
5371 delta_ubA[i] = ubA_new[i] - _THIS->
ubA[i];
5379 for ( i=0; i<nAC; ++i )
5398 const real_t*
const delta_lb,
const real_t*
const delta_ub,
5404 int i, j, ii, jj, r;
5424 for( i=0; i<nFX; ++i )
5429 delta_xFX[i] = delta_lb[ii];
5431 delta_xFX[i] = delta_ub[ii];
5436 for( i=0; i<nFX; ++i )
5443 for ( i=0; i<nFR; ++i )
5446 _THIS->
tempA[i] = delta_g[ii];
5449 for ( i=0; i<nAC; ++i )
5453 for ( i=0; i<nAC; ++i )
5457 _THIS->
tempB[i] = delta_lbA[ii];
5459 _THIS->
tempB[i] = delta_ubA[ii];
5464 for ( i=0; i<nAC; ++i )
5465 _THIS->
tempB[i] = 0.0;
5474 for( i=0; i<nFR; ++i )
5480 if ( ( Delta_bC_isZero ==
BT_TRUE ) && ( Delta_bB_isZero ==
BT_TRUE ) )
5482 for( i=0; i<nAC; ++i )
5489 if ( ( Delta_bB_isZero ==
BT_FALSE ) && ( r == 0 ) )
5490 DenseMatrix_subTimes(_THIS->
A,
Constraints_getActive( &(_THIS->
constraints)),
Bounds_getFixed( &(_THIS->
bounds) ), 1, -1.0, delta_xFX, nFX, 1.0, _THIS->
tempB, nAC,
BT_TRUE);
5495 for( i=0; i<nFR; ++i )
5498 for( j=0; j<nAC; ++j )
5506 for( i=0; i<nZ; ++i )
5512 for( j=0; j<nFR; ++j )
5515 for( i=0; i<nZ; ++i )
5523 for( i=0; i<nZ; ++i )
5537 if ( ( Delta_bB_isZero ==
BT_FALSE ) && ( r == 0 ) )
5538 DenseMatrix_subTimes(_THIS->
H,
Bounds_getFree( &(_THIS->
bounds) ),
Bounds_getFixed( &(_THIS->
bounds) ), 1, 1.0, delta_xFX, nFX, 1.0, _THIS->
tempA, nFR,
BT_TRUE);
5541 if ( ( nAC > 0 ) && ( ( Delta_bC_isZero ==
BT_FALSE ) || ( Delta_bB_isZero ==
BT_FALSE ) ) )
5542 DenseMatrix_subTimes(_THIS->
H,
Bounds_getFree( &(_THIS->
bounds) ),
Bounds_getFree( &(_THIS->
bounds) ), 1, 1.0, _THIS->
delta_xFR_TMP, nFR, 1.0, _THIS->
tempA, nFR,
BT_TRUE);
5547 for( j=0; j<nFR; ++j )
5550 for( i=0; i<nZ; ++i )
5565 for( i=0; i<nFR; ++i )
5570 for( j=0; j<nZ; ++j )
5591 for( j=0; j<nAC; ++j )
5598 for( j=0; j<nAC; ++j )
5603 for( j=0; j<nAC; ++j )
5604 _THIS->
tempB[j] = 0.0;
5608 for( j=0; j<nAC; ++j )
5610 for( i=0; i<nFR; ++i )
5622 DenseMatrix_subTimes(_THIS->
H,
Bounds_getFree( &(_THIS->
bounds) ),
Bounds_getFree( &(_THIS->
bounds) ), 1, 1.0, _THIS->
ZFR_delta_xFRz, nFR, 1.0, _THIS->
tempA, nFR,
BT_TRUE);
5624 for( i=0; i<nAC; ++i)
5626 _THIS->
tempB[i] = 0.0;
5627 for( j=0; j<nFR; ++j )
5640 for ( i=0; i<nFR; ++i )
5642 for ( i=0; i<nAC; ++i )
5648 for ( i=0; i<nFR; ++i )
5651 _THIS->
tempA[i] = delta_g[ii];
5658 for ( i=0; i<nFR; ++i )
5663 for ( i=0; i<nFR; ++i )
5664 _THIS->
tempA[i] += delta_xFR[i];
5668 DenseMatrix_subTimes(_THIS->
H,
Bounds_getFree( &(_THIS->
bounds) ),
Bounds_getFree( &(_THIS->
bounds) ), 1, 1.0, delta_xFR, nFR, 1.0, _THIS->
tempA, nFR,
BT_TRUE);
5669 DenseMatrix_subTimes(_THIS->
H,
Bounds_getFree( &(_THIS->
bounds) ),
Bounds_getFixed( &(_THIS->
bounds) ), 1, 1.0, delta_xFX, nFX, 1.0, _THIS->
tempA, nFR,
BT_TRUE);
5675 for ( i=0; i<nFR; ++i )
5679 if (!Delta_bC_isZero)
5681 for ( i=0; i<nAC; ++i )
5685 _THIS->
tempB[i] = delta_lbA[ii];
5687 _THIS->
tempB[i] = delta_ubA[ii];
5692 for ( i=0; i<nAC; ++i )
5693 _THIS->
tempB[i] = 0.0;
5695 DenseMatrix_subTimes(_THIS->
A,
Constraints_getActive( &(_THIS->
constraints)),
Bounds_getFree( &(_THIS->
bounds) ), 1, -1.0, delta_xFR, nFR, 1.0, _THIS->
tempB, nAC,
BT_TRUE);
5696 DenseMatrix_subTimes(_THIS->
A,
Constraints_getActive( &(_THIS->
constraints)),
Bounds_getFixed( &(_THIS->
bounds) ), 1, -1.0, delta_xFX, nFX, 1.0, _THIS->
tempB, nAC,
BT_TRUE);
5697 for ( i=0; i<nAC; ++i )
5702 if ( rnrm < _THIS->
options.epsIterRef )
5711 for( i=0; i<nFX; ++i )
5712 delta_yFX[i] = delta_g[FX_idx[i]];
5719 for( i=0; i<nFX; ++i )
5720 delta_yFX[i] += _THIS->
regVal*delta_xFX[i];
5724 for( i=0; i<nFX; ++i )
5725 delta_yFX[i] += delta_xFX[i];
5729 DenseMatrix_subTimes(_THIS->
H,
Bounds_getFixed( &(_THIS->
bounds) ),
Bounds_getFree( &(_THIS->
bounds) ), 1, 1.0, delta_xFR, nFR, 1.0, delta_yFX, nFX,
BT_TRUE);
5730 DenseMatrix_subTimes(_THIS->
H,
Bounds_getFixed( &(_THIS->
bounds) ),
Bounds_getFixed( &(_THIS->
bounds) ), 1, 1.0, delta_xFX, nFX, 1.0, delta_yFX, nFX,
BT_TRUE);
5742 const real_t*
const delta_lbA,
const real_t*
const delta_ubA,
5743 const real_t*
const delta_lb,
const real_t*
const delta_ub,
5744 const real_t*
const delta_xFX,
const real_t*
const delta_xFR,
5745 const real_t*
const delta_yAC,
const real_t*
const delta_yFX,
5750 #ifndef __SUPPRESSANYOUTPUT__ 5766 int BC_idx_tmp = -1;
5789 for( j=0; j<nFR; ++j )
5792 delta_x[jj] = delta_xFR[j];
5794 for( j=0; j<nFX; ++j )
5797 delta_x[jj] = delta_xFX[j];
5804 for( i=0; i<nAC; ++i )
5808 num[i] = _THIS->
y[nV+ii];
5809 den[i] = -delta_yAC[i];
5814 if ( BC_idx_tmp >= 0 )
5816 *BC_idx = BC_idx_tmp;
5824 for( i=0; i<nFX; ++i )
5827 num[i] = _THIS->
y[ii];
5828 den[i] = -delta_yFX[i];
5833 if ( BC_idx_tmp >= 0 )
5835 *BC_idx = BC_idx_tmp;
5847 DenseMatrix_subTimes(_THIS->
A,
Constraints_getInactive(&(_THIS->
constraints)), 0, 1, 1.0, delta_x, nV, 0.0, delta_Ax, nC,
BT_FALSE);
5851 for( i=0; i<nIAC; ++i )
5865 for( i=0; i<nIAC; ++i )
5869 den[i] = delta_lbA[ii] - delta_Ax[ii];
5874 if ( BC_idx_tmp >= 0 )
5876 *BC_idx = BC_idx_tmp;
5884 for( i=0; i<nIAC; ++i )
5888 den[i] = delta_Ax[ii] - delta_ubA[ii];
5893 if ( BC_idx_tmp >= 0 )
5895 *BC_idx = BC_idx_tmp;
5902 for( i=0; i<nIAC; ++i )
5908 delta_Ax_l[ii] = delta_Ax[ii] - delta_lbA[ii];
5909 delta_Ax_u[ii] = delta_ubA[ii] - delta_Ax[ii];
5919 for( i=0; i<nFR; ++i )
5923 den[i] = delta_lb[ii] - delta_xFR[i];
5928 if ( BC_idx_tmp >= 0 )
5930 *BC_idx = BC_idx_tmp;
5939 for( i=0; i<nFR; ++i )
5943 den[i] = delta_xFR[i] - delta_ub[ii];
5948 if ( BC_idx_tmp >= 0 )
5950 *BC_idx = BC_idx_tmp;
5957 #ifndef __SUPPRESSANYOUTPUT__ 5961 snprintf( messageString,
QPOASES_MAX_STRING_LENGTH,
"Stepsize is %.15e! (idx = %d, isBound = %d, status = %d)",_THIS->
tau,*BC_idx,*BC_isBound,*BC_status );
5971 for( i=0; i<nFR; ++i )
5974 _THIS->
x[ii] += _THIS->
tau * delta_xFR[i];
5977 for( i=0; i<nFX; ++i )
5980 _THIS->
x[ii] += _THIS->
tau * delta_xFX[i];
5981 _THIS->
y[ii] += _THIS->
tau * delta_yFX[i];
5984 for( i=0; i<nAC; ++i )
5987 _THIS->
y[nV+ii] += _THIS->
tau * delta_yAC[i];
5991 for( i=0; i<nV; ++i )
5993 _THIS->
g[i] += _THIS->
tau * delta_g[i];
5994 _THIS->
lb[i] += _THIS->
tau * delta_lb[i];
5995 _THIS->
ub[i] += _THIS->
tau * delta_ub[i];
5998 for( i=0; i<nC; ++i )
6000 _THIS->
lbA[i] += _THIS->
tau * delta_lbA[i];
6001 _THIS->
ubA[i] += _THIS->
tau * delta_ubA[i];
6007 DenseMatrix_subTimes( _THIS->
A,
Constraints_getActive( &(_THIS->
constraints)),0, 1, 1.0, _THIS->
x, nV, 0.0, _THIS->
Ax, nC,
BT_FALSE );
6011 for( i=0; i<nAC; ++i )
6020 for( i=0; i<nAC; ++i )
6023 _THIS->
Ax_u[ii] = _THIS->
ubA[ii] - _THIS->
Ax[ii];
6024 _THIS->
Ax_l[ii] = _THIS->
Ax[ii] - _THIS->
lbA[ii];
6026 for( i=0; i<nIAC; ++i )
6031 _THIS->
Ax[ii] += _THIS->
tau * delta_Ax[ii];
6032 _THIS->
Ax_l[ii] += _THIS->
tau * delta_Ax_l[ii];
6033 _THIS->
Ax_u[ii] += _THIS->
tau * delta_Ax_u[ii];
6040 #ifndef __SUPPRESSANYOUTPUT__ 6063 switch ( BC_status )
6073 #ifndef __SUPPRESSANYOUTPUT__ 6081 _THIS->
y[BC_idx] = 0.0;
6085 #ifndef __SUPPRESSANYOUTPUT__ 6093 _THIS->
y[nV+BC_idx] = 0.0;
6102 #ifndef __SUPPRESSANYOUTPUT__ 6118 #ifndef __SUPPRESSANYOUTPUT__ 6157 for (i = 0; i < nC; i++)
6160 if (s < 1.0) s = 1.0;
6162 if (d > len) len = d;
6169 for (i = 0; i < nC; i++)
6172 if (s < 1.0) s = 1.0;
6174 if (d > len) len = d;
6186 real_t curFarBound,
int nRamp,
6199 lb_new,lb_new_far, ub_new,ub_new_far
6206 for ( i=0; i<nC; ++i )
6209 rampVal = curFarBound * (1.0 + (1.0-t)*_THIS->
ramp0 + t*_THIS->
ramp1);
6212 lbA_new_far[i] = -rampVal;
6217 ubA_new_far[i] = rampVal;
6224 for ( i=0; i<nC; ++i )
6227 lbA_new_far[i] = -curFarBound;
6232 ubA_new_far[i] = curFarBound;
6246 real_t curFarBound,
int nRamp,
6257 for ( i=0; i<nV; ++i )
6260 rampVal = curFarBound * (1.0 + (1.0-t)*_THIS->
ramp0 + t*_THIS->
ramp1);
6263 lb_new_far[i] = -rampVal;
6268 ub_new_far[i] = rampVal;
6275 for ( i=0; i<nV; ++i )
6278 lb_new_far[i] = -curFarBound;
6283 ub_new_far[i] = curFarBound;
6299 real_t tP, rampValP, tD, rampValD, sca;
6302 nRamp = nV + nC + nC + nV;
6305 for (i = 0; i < nV; i++)
6310 _THIS->
lb[i] = _THIS->
x[i]; _THIS->
ub[i] = _THIS->
x[i];
6315 rampValP = (1.0-tP) * _THIS->
ramp0 + tP * _THIS->
ramp1;
6317 rampValD = (1.0-tD) * _THIS->
ramp0 + tD * _THIS->
ramp1;
6321 if (bstat ==
ST_LOWER) { _THIS->
lb[i] = _THIS->
x[i]; _THIS->
y[i] = +rampValD; }
6322 if (bstat ==
ST_UPPER) { _THIS->
ub[i] = _THIS->
x[i]; _THIS->
y[i] = -rampValD; }
6334 for (i = 0; i < nC; i++)
6339 _THIS->
lbA[i] = _THIS->
Ax[i]; _THIS->
ubA[i] = _THIS->
Ax[i];
6344 rampValP = (1.0-tP) * _THIS->
ramp0 + tP * _THIS->
ramp1;
6346 rampValD = (1.0-tD) * _THIS->
ramp0 + tD * _THIS->
ramp1;
6350 if (cstat ==
ST_LOWER) { _THIS->
lbA[i] = _THIS->
Ax[i]; _THIS->
y[nV+i] = +rampValD; }
6351 if (cstat ==
ST_UPPER) { _THIS->
ubA[i] = _THIS->
Ax[i]; _THIS->
y[nV+i] = -rampValD; }
6354 _THIS->
Ax_l[i] = _THIS->
Ax[i] - _THIS->
lbA[i];
6355 _THIS->
Ax_u[i] = _THIS->
ubA[i] - _THIS->
Ax[i];
6381 const int*
const idxList,
6395 for( i=0; i<nIdx; ++i )
6405 *t = num[i] / den[i];
6414 *t = num[i] / den[i];
6435 for ( i=0; i<nV; ++i )
6443 _THIS->
lb[i] = _THIS->
x[i];
6449 _THIS->
ub[i] = _THIS->
x[i];
6464 _THIS->
lb[i] = _THIS->
x[i];
6465 _THIS->
ub[i] = _THIS->
x[i];
6474 for ( i=0; i<nC; ++i )
6482 _THIS->
lbA[i] = _THIS->
Ax[i];
6483 _THIS->
Ax_l[i] = 0.0;
6485 _THIS->
Ax_u[i] = _THIS->
ubA[i] - _THIS->
Ax[i];
6490 _THIS->
Ax_l[i] = _THIS->
Ax[i] - _THIS->
lbA[i];
6491 _THIS->
ubA[i] = _THIS->
Ax[i];
6492 _THIS->
Ax_u[i] = 0.0;
6497 _THIS->
Ax_l[i] = _THIS->
Ax[i] - _THIS->
lbA[i];
6499 _THIS->
Ax_u[i] = _THIS->
ubA[i] - _THIS->
Ax[i];
6500 _THIS->
y[i+nV] = 0.0;
6509 _THIS->
lbA[i] = _THIS->
Ax[i];
6510 _THIS->
Ax_l[i] = 0.0;
6511 _THIS->
ubA[i] = _THIS->
Ax[i];
6512 _THIS->
Ax_u[i] = 0.0;
6535 if ( ( guessedBounds == 0 ) || ( guessedConstraints == 0 ) )
6539 if ( ( guessedBounds == &(_THIS->
bounds) ) && ( guessedConstraints == &(_THIS->
constraints) ) )
6586 for ( i=0; i<nV; ++i )
6590 for ( i=0; i<nC; ++i )
6592 _THIS->
y[nV+i] = 0.0;
6599 for ( j=0; j<nC; ++j )
6601 _THIS->
Ax_l[j] = _THIS->
Ax[j];
6602 _THIS->
Ax_u[j] = _THIS->
Ax[j];
6618 Bounds*
const guessedBounds,
6626 int differenceNumberBounds = 0;
6627 int differenceNumberConstraints = 0;
6635 for( i=0; i<nV; ++i )
6637 ++differenceNumberBounds;
6641 for( i=0; i<nC; ++i )
6643 ++differenceNumberConstraints;
6694 if ( ( nC > 0 ) && ( _A == 0 ) )
6719 const char*
const H_file,
const char*
const g_file,
const char*
const A_file,
6720 const char*
const lb_file,
const char*
const ub_file,
6721 const char*
const lbA_file,
const char*
const ubA_file
6737 if ( ( nC > 0 ) && ( A_file == 0 ) )
6743 if ( lbA_file != 0 )
6752 for( i=0; i<nC; ++i )
6757 if ( ubA_file != 0 )
6766 for( i=0; i<nC; ++i )
6786 const char*
const g_file,
const char*
const lb_file,
const char*
const ub_file,
6787 const char*
const lbA_file,
const char*
const ubA_file,
6805 if ( lbA_file != 0 )
6821 if ( ubA_file != 0 )
6851 #ifndef __SUPPRESSANYOUTPUT__ 6858 real_t stat, bfeas, cfeas, bcmpl, ccmpl, Tmaxomin;
6866 const char excStr[] =
" ef";
6875 stat = bfeas = cfeas = bcmpl = ccmpl = Tmaxomin = 0.0;
6878 for (i = 0; i < nV; i++) grad[i] = _THIS->
g[i] - _THIS->
y[i];
6883 for( i=0; i<nV; ++i )
6884 grad[i] += _THIS->
regVal * _THIS->
x[i];
6888 for( i=0; i<nV; ++i )
6889 grad[i] += 1.0 * _THIS->
x[i];
6898 for (i = 0; i < nV; i++) if (qpOASES_getAbs(grad[i]) > stat) stat =
qpOASES_getAbs(grad[i]);
6901 for (i = 0; i < nV; i++)
if (_THIS->
lb[i] - _THIS->
x[i] > bfeas) bfeas = _THIS->
lb[i] - _THIS->
x[i];
6902 for (i = 0; i < nV; i++)
if (_THIS->
x[i] - _THIS->
ub[i] > bfeas) bfeas = _THIS->
x[i] - _THIS->
ub[i];
6904 for (i = 0; i < nC; i++)
if (_THIS->
lbA[i] - AX[i] > cfeas) cfeas = _THIS->
lbA[i] - AX[i];
6905 for (i = 0; i < nC; i++)
if (AX[i] - _THIS->
ubA[i] > cfeas) cfeas = AX[i] - _THIS->
ubA[i];
6913 Tmin = 1.0e16; Tmax = 0.0;
6914 for (i = 0; i < nAC; i++)
6919 Tmaxomin = Tmax/Tmin;
6921 if ( ( iter % 10 == 0 ) && ( isFirstCall ==
BT_TRUE ) )
6924 "iter",
"addB",
"remB",
"addC",
"remC",
"hom len",
"tau",
"stat",
6925 "bfeas",
"cfeas",
"bcmpl",
"ccmpl",
"Tmin");
6973 homotopyLength, _THIS->
tau, stat, bfeas, cfeas, bcmpl, ccmpl, Tmin);
6978 if ( ( iter % 10 == 0 ) && ( isFirstCall ==
BT_TRUE ) )
6981 "iter",
"addB",
"remB",
"addC",
"remC",
"hom len",
"tau" );
7036 if ( ( iter == 0 ) && ( isFirstCall ==
BT_TRUE ) )
7042 qpOASES_myPrintf(
" ----------+------------------+------------------+---------+--------- \n" );
7049 snprintf( info,3,
"LP" );
7051 snprintf( info,3,
"QP" );
7062 snprintf( info,5,
"REM " );
7064 snprintf( info,5,
"ADD " );
7067 snprintf( &(info[4]),4,
"BND" );
7069 snprintf( &(info[4]),4,
"CON" );
7097 if (lb_new && ub_new) {
7105 if (lbA_new && ubA_new) {
7131 int y_min_number = -1;
7133 int y_min_priority = blockingPriority;
7135 int *AC_idx, *FX_idx;
7143 for ( i = 0; i < nAC; ++i )
7147 y_min_number = AC_idx[i];
7157 for ( i = 0; i < nAC; ++i )
7161 y_min_number = AC_idx[i];
7171 for ( i = 0; i < nFX; ++i )
7174 y_min_number = FX_idx[i];
7181 if (y_min_number >= 0) {
7184 if (y_min_isBound) {
returnValue Bounds_setupBound(Bounds *_THIS, int number, SubjectToStatus _status)
returnValue QProblem_performRatioTestB(QProblem *_THIS, int nIdx, const int *const idxList, Bounds *const subjectTo, const real_t *const num, const real_t *const den, real_t epsNum, real_t epsDen, real_t *t, int *BC_idx)
returnValue QProblem_loadQPvectorsFromFile(QProblem *_THIS, const char *const g_file, const char *const lb_file, const char *const ub_file, const char *const lbA_file, const char *const ubA_file, real_t *const g_new, real_t *const lb_new, real_t *const ub_new, real_t *const lbA_new, real_t *const ubA_new)
BooleanType QProblem_isCPUtimeLimitExceeded(QProblem *_THIS, const real_t *const cputime, real_t starttime, int nWSR)
real_t DenseMatrix_getNorm(DenseMatrix *_THIS, int type)
static int QProblem_getNIAC(QProblem *_THIS)
real_t QProblemBCPY_getRelativeHomotopyLength(QProblem *_THIS, const real_t *const g_new, const real_t *const lb_new, const real_t *const ub_new)
static int Constraints_getNC(Constraints *_THIS)
static Indexlist * Bounds_getFree(Bounds *_THIS)
returnValue QProblem_dropInfeasibles(QProblem *_THIS, int BC_number, SubjectToStatus BC_status, BooleanType BC_isBound, real_t *xiB, real_t *xiC)
returnValue DenseMatrix_subTimes(DenseMatrix *_THIS, const Indexlist *const irows, const Indexlist *const icols, int xN, real_t alpha, const real_t *x, int xLD, real_t beta, real_t *y, int yLD, BooleanType yCompr)
real_t DenseMatrix_diag(DenseMatrix *_THIS, int i)
returnValue QProblemBCPY_setupQPdataFromFile(QProblem *_THIS, const char *const H_file, const char *const g_file, const char *const lb_file, const char *const ub_file)
Interface for specifying user-defined evaluations of constraint products.
Manages working sets of constraints.
static int Constraints_getNUC(Constraints *_THIS)
returnValue QProblem_hotstartF(QProblem *_THIS, const char *const g_file, const char *const lb_file, const char *const ub_file, const char *const lbA_file, const char *const ubA_file, int *nWSR, real_t *const cputime)
static BooleanType Bounds_hasNoLower(Bounds *_THIS)
returnValue QProblem_hotstartW(QProblem *_THIS, 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, Bounds *const guessedBounds, Constraints *const guessedConstraints)
returnValue QProblem_setupSubjectToType(QProblem *_THIS)
returnValue QProblemBCPY_updateFarBounds(QProblem *_THIS, real_t curFarBound, int nRamp, const real_t *const lb_new, real_t *const lb_new_far, const real_t *const ub_new, real_t *const ub_new_far)
returnValue QProblem_removeBound(QProblem *_THIS, int number, BooleanType updateCholesky, BooleanType allowFlipping, BooleanType ensureNZC)
returnValue QProblem_printOptions(QProblem *_THIS)
static int Indexlist_getLastNumber(Indexlist *_THIS)
static void Bounds_setNoUpper(Bounds *_THIS, BooleanType _status)
returnValue QProblem_setupInitialCholesky(QProblem *_THIS)
returnValue QProblem_updateFarBounds(QProblem *_THIS, real_t curFarBound, int nRamp, const real_t *const lb_new, real_t *const lb_new_far, const real_t *const ub_new, real_t *const ub_new_far, const real_t *const lbA_new, real_t *const lbA_new_far, const real_t *const ubA_new, real_t *const ubA_new_far)
returnValue DenseMatrix_addToDiag(DenseMatrix *_THIS, real_t alpha)
BooleanType isZero(real_t x, real_t TOL=ZERO)
returnValue QProblem_determineStepDirection(QProblem *_THIS, const real_t *const delta_g, const real_t *const delta_lbA, const real_t *const delta_ubA, const real_t *const delta_lb, const real_t *const delta_ub, BooleanType Delta_bC_isZero, BooleanType Delta_bB_isZero, real_t *const delta_xFX, real_t *const delta_xFR, real_t *const delta_yAC, real_t *const delta_yFX)
returnValue QProblem_setupAuxiliaryQPsolution(QProblem *_THIS, const real_t *const xOpt, const real_t *const yOpt)
int Indexlist_getIndex(Indexlist *_THIS, int givennumber)
returnValue Bounds_setupAllFree(Bounds *_THIS)
BooleanType enableFarBounds
returnValue DenseMatrix_bilinear(DenseMatrix *_THIS, const Indexlist *const icols, int xN, const real_t *x, int xLD, real_t *y, int yLD)
static SubjectToStatus Constraints_getStatus(Constraints *_THIS, int i)
static SubjectToStatus Bounds_getStatus(Bounds *_THIS, int i)
returnValue DenseMatrix_getCol(DenseMatrix *_THIS, int cNum, const Indexlist *const irows, real_t alpha, real_t *col)
static Indexlist * Constraints_getInactive(Constraints *_THIS)
returnValue QProblem_performRatioTestC(QProblem *_THIS, int nIdx, const int *const idxList, Constraints *const subjectTo, const real_t *const num, const real_t *const den, real_t epsNum, real_t epsDen, real_t *t, int *BC_idx)
ConstraintProduct * constraintProduct
static real_t qpOASES_getMin(real_t x, real_t y)
returnValue QProblem_setupAuxiliaryQPgradient(QProblem *_THIS)
static void Constraints_setNoUpper(Constraints *_THIS, BooleanType _status)
returnValue QProblem_addConstraint_checkLI(QProblem *_THIS, int number)
#define THROWINFO(retval)
#define ST_INFEASIBLE_UPPER
returnValue QProblem_initM(QProblem *_THIS, DenseMatrix *_H, const real_t *const _g, DenseMatrix *_A, const real_t *const _lb, const real_t *const _ub, const real_t *const _lbA, const real_t *const _ubA, int *nWSR, real_t *const cputime)
returnValue QProblem_backsolveT(QProblem *_THIS, const real_t *const b, BooleanType transposed, real_t *const a)
Allows to pass back messages to the calling function.
returnValue QProblem_areBoundsConsistent(QProblem *_THIS, const real_t *const lb_new, const real_t *const ub_new, const real_t *const lbA_new, const real_t *const ubA_new)
returnValue QProblem_solveRegularisedQP(QProblem *_THIS, 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, int nWSRperformed, BooleanType isFirstCall)
returnValue DenseMatrix_getRow(DenseMatrix *_THIS, int rNum, const Indexlist *const icols, real_t alpha, real_t *row)
static void Constraints_setNoLower(Constraints *_THIS, BooleanType _status)
returnValue QProblem_setupAuxiliaryQPbounds(QProblem *_THIS, Bounds *const auxiliaryBounds, Constraints *const auxiliaryConstraints, BooleanType useRelaxation)
static int QProblem_getNFR(QProblem *_THIS)
returnValue Options_setToFast(Options *_THIS)
returnValue DenseMatrix_transTimes(DenseMatrix *_THIS, int xN, real_t alpha, const real_t *x, int xLD, real_t beta, real_t *y, int yLD)
returnValue QProblemBCPY_setupQPdata(QProblem *_THIS, real_t *const _H, const real_t *const _g, const real_t *const _lb, const real_t *const _ub)
static BooleanType Bounds_hasNoUpper(Bounds *_THIS)
returnValue QProblem_setConstraintProduct(QProblem *_THIS, ConstraintProduct _constraintProduct)
#define THROWERROR(retval)
returnValue MessageHandling_throwWarning(MessageHandling *_THIS, returnValue Wnumber, const char *additionaltext, const char *functionname, const char *filename, const unsigned long linenumber, VisibilityStatus localVisibilityStatus)
returnValue QProblem_solveCurrentEQP(QProblem *_THIS, const int n_rhs, const real_t *g_in, const real_t *lb_in, const real_t *ub_in, const real_t *lbA_in, const real_t *ubA_in, real_t *x_out, real_t *y_out)
BooleanType enableFullLITests
int QProblem_getNZ(QProblem *_THIS)
returnValue QProblem_computeProjectedCholesky(QProblem *_THIS)
BooleanType enableEqualities
returnValue Constraints_setupConstraint(Constraints *_THIS, int number, SubjectToStatus _status)
returnValue QProblem_addConstraint(QProblem *_THIS, int number, SubjectToStatus C_status, BooleanType updateCholesky, BooleanType ensureLI)
#define ST_INFEASIBLE_LOWER
static BooleanType QProblem_isInfeasible(QProblem *_THIS)
static int QProblem_getNAC(QProblem *_THIS)
BooleanType enableRamping
returnValue QProblemBCPY_determineDataShift(QProblem *_THIS, const real_t *const g_new, const real_t *const lb_new, const real_t *const ub_new, real_t *const delta_g, real_t *const delta_lb, real_t *const delta_ub, BooleanType *Delta_bB_isZero)
returnValue QProblem_solveInitialQP(QProblem *_THIS, const real_t *const xOpt, const real_t *const yOpt, Bounds *const guessedBounds, Constraints *const guessedConstraints, const real_t *const _R, int *nWSR, real_t *const cputime)
static const real_t QPOASES_ZERO
returnValue Flipper_set(Flipper *_THIS, const Bounds *const _bounds, const real_t *const _R, const Constraints *const _constraints, const real_t *const _Q, const real_t *const _T)
returnValue Bounds_moveFreeToFixed(Bounds *_THIS, int number, SubjectToStatus _status)
BooleanType DenseMatrix_isDiag(DenseMatrix *_THIS)
returnValue MessageHandling_throwInfo(MessageHandling *_THIS, returnValue Inumber, const char *additionaltext, const char *functionname, const char *filename, const unsigned long linenumber, VisibilityStatus localVisibilityStatus)
real_t qpOASES_getCPUtime()
returnValue qpOASES_readFromFileV(real_t *data, int n, const char *datafilename)
returnValue QProblemBCPY_computeCholesky(QProblem *_THIS)
returnValue Flipper_get(Flipper *_THIS, Bounds *const _bounds, real_t *const R, Constraints *const _constraints, real_t *const _Q, real_t *const _T)
returnValue QProblem_determineDataShift(QProblem *_THIS, const real_t *const g_new, const real_t *const lbA_new, const real_t *const ubA_new, const real_t *const lb_new, const real_t *const ub_new, real_t *const delta_g, real_t *const delta_lbA, real_t *const delta_ubA, real_t *const delta_lb, real_t *const delta_ub, BooleanType *Delta_bC_isZero, BooleanType *Delta_bB_isZero)
static void Bounds_setNoLower(Bounds *_THIS, BooleanType _status)
returnValue MessageHandling_reset(MessageHandling *_THIS)
returnValue QProblem_setupTQfactorisation(QProblem *_THIS)
returnValue QProblemBCPY_setupQPdataM(QProblem *_THIS, DenseMatrix *_H, const real_t *const _g, const real_t *const _lb, const real_t *const _ub)
returnValue QProblem_setupSubjectToTypeNew(QProblem *_THIS, const real_t *const lb_new, const real_t *const ub_new, const real_t *const lbA_new, const real_t *const ubA_new)
returnValue QProblem_addBound_checkLI(QProblem *_THIS, int number)
returnValue Constraints_moveInactiveToActive(Constraints *_THIS, int number, SubjectToStatus _status)
returnValue QProblem_getWorkingSetBounds(QProblem *_THIS, real_t *workingSetB)
BooleanType enableFlippingBounds
static int QProblem_getNV(QProblem *_THIS)
returnValue DenseMatrix_subTransTimes(DenseMatrix *_THIS, const Indexlist *const irows, const Indexlist *const icols, int xN, real_t alpha, const real_t *x, int xLD, real_t beta, real_t *y, int yLD)
returnValue QProblem_printProperties(QProblem *_THIS)
static returnValue QProblem_setUBA(QProblem *_THIS, const real_t *const ubA_new)
returnValue QProblem_ensureNonzeroCurvature(QProblem *_THIS, BooleanType removeBoundNotConstraint, int remIdx, BooleanType *exchangeHappened, BooleanType *addBoundNotConstraint, int *addIdx, SubjectToStatus *addStatus)
returnValue QProblem_removeConstraint(QProblem *_THIS, int number, BooleanType updateCholesky, BooleanType allowFlipping, BooleanType ensureNZC)
static BooleanType QProblem_isInitialised(QProblem *_THIS)
returnValue qpOASES_readFromFileM(real_t *data, int nrow, int ncol, const char *datafilename)
returnValue Bounds_init(Bounds *_THIS, int _n)
static returnValue Bounds_setType(Bounds *_THIS, int i, SubjectToType value)
void DenseMatrixCON(DenseMatrix *_THIS, int m, int n, int lD, real_t *v)
returnValue Options_print(Options *_THIS)
static void MessageHandling_setInfoVisibilityStatus(MessageHandling *_THIS, VisibilityStatus _infoVisibility)
void ConstraintsCPY(Constraints *FROM, Constraints *TO)
Interfaces matrix-vector operations tailored to general dense matrices.
static real_t qpOASES_getAbs(real_t x)
returnValue QProblem_initF(QProblem *_THIS, const char *const H_file, const char *const g_file, const char *const A_file, const char *const lb_file, const char *const ub_file, const char *const lbA_file, const char *const ubA_file, int *nWSR, real_t *const cputime)
returnValue QProblem_getDualSolution(QProblem *_THIS, real_t *const yOpt)
static int qpOASES_getMinI(int x, int y)
static Indexlist * Constraints_getActive(Constraints *_THIS)
returnValue QProblemBCPY_obtainAuxiliaryWorkingSet(QProblem *_THIS, const real_t *const xOpt, const real_t *const yOpt, Bounds *const guessedBounds, Bounds *auxiliaryBounds)
static SubjectToType Constraints_getType(Constraints *_THIS, int i)
static returnValue QProblem_setG(QProblem *_THIS, const real_t *const g_new)
static real_t qpOASES_getMax(real_t x, real_t y)
returnValue QProblem_setInfeasibilityFlag(QProblem *_THIS, returnValue returnvalue, BooleanType doThrowError)
static int Bounds_getNFX(Bounds *_THIS)
returnValue QProblem_addBound(QProblem *_THIS, int number, SubjectToStatus B_status, BooleanType updateCholesky, BooleanType ensureLI)
real_t A[NCMAX_ALLOC *NVMAX]
static void QProblemB_applyGivens(real_t c, real_t s, real_t nu, real_t xold, real_t yold, real_t *xnew, real_t *ynew)
static int Indexlist_getLength(Indexlist *_THIS)
BEGIN_NAMESPACE_QPOASES void QProblemCON(QProblem *_THIS, int _nV, int _nC, HessianType _hessianType)
int_t dropIneqConPriority
returnValue QProblem_getWorkingSet(QProblem *_THIS, real_t *workingSet)
returnValue qpOASES_myPrintf(const char *s)
int enableDriftCorrection
static int Bounds_getNUV(Bounds *_THIS)
TabularOutput tabularOutput
returnValue QProblem_reset(QProblem *_THIS)
static int QProblem_getNFX(QProblem *_THIS)
returnValue QProblem_backsolveRrem(QProblem *_THIS, const real_t *const b, BooleanType transposed, BooleanType removingBound, real_t *const a)
returnValue QProblem_hotstart(QProblem *_THIS, 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)
static real_t qpOASES_getSqrt(real_t x)
real_t qpOASES_getNorm(const real_t *const v, int n, int type)
static int QProblem_getNFV(QProblem *_THIS)
static returnValue QProblem_setH(QProblem *_THIS, real_t *const H_new)
BooleanType enableRegularisation
returnValue Constraints_moveActiveToInactive(Constraints *_THIS, int number)
returnValue QProblemBCPY_loadQPvectorsFromFile(QProblem *_THIS, const char *const g_file, const char *const lb_file, const char *const ub_file, real_t *const g_new, real_t *const lb_new, real_t *const ub_new)
returnValue QProblem_printIteration(QProblem *_THIS, int iter, int BC_idx, SubjectToStatus BC_status, BooleanType BC_isBound, real_t homotopyLength, BooleanType isFirstCall)
static const real_t QPOASES_INFTY
static QProblemStatus QProblem_getStatus(QProblem *_THIS)
static void MessageHandling_setErrorVisibilityStatus(MessageHandling *_THIS, VisibilityStatus _errorVisibility)
void rhs(const real_t *x, real_t *f)
static void MessageHandling_setWarningVisibilityStatus(MessageHandling *_THIS, VisibilityStatus _warningVisibility)
returnValue QProblem_setupAuxiliaryQP(QProblem *_THIS, Bounds *const guessedBounds, Constraints *const guessedConstraints)
#define END_NAMESPACE_QPOASES
returnValue QProblem_obtainAuxiliaryWorkingSet(QProblem *_THIS, const real_t *const xOpt, const real_t *const yOpt, Bounds *const guessedBounds, Constraints *const guessedConstraints, Bounds *auxiliaryBounds, Constraints *auxiliaryConstraints)
returnValue Constraints_init(Constraints *_THIS, int _n)
returnValue Bounds_moveFixedToFree(Bounds *_THIS, int number)
returnValue QProblem_changeActiveSet(QProblem *_THIS, int BC_idx, SubjectToStatus BC_status, BooleanType BC_isBound)
void OptionsCPY(Options *FROM, Options *TO)
static returnValue QProblem_setLB(QProblem *_THIS, const real_t *const lb_new)
returnValue QProblem_getWorkingSetConstraints(QProblem *_THIS, real_t *workingSetC)
returnValue QProblem_initFW(QProblem *_THIS, const char *const H_file, const char *const g_file, const char *const A_file, const char *const lb_file, const char *const ub_file, const char *const lbA_file, const char *const ubA_file, int *nWSR, real_t *const cputime, const real_t *const xOpt, const real_t *const yOpt, Bounds *const guessedBounds, Constraints *const guessedConstraints, const char *const R_file)
real_t QProblem_getRelativeHomotopyLength(QProblem *_THIS, 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)
BooleanType QProblem_shallRefactorise(QProblem *_THIS, Bounds *const guessedBounds, Constraints *const guessedConstraints)
#define HST_POSDEF_NULLSPACE
static int QProblem_getNC(QProblem *_THIS)
MessageHandling * qpOASES_getGlobalMessageHandler()
returnValue Bounds_flipFixed(Bounds *_THIS, int number)
returnValue QProblem_setupQPdataFromFile(QProblem *_THIS, const char *const H_file, const char *const g_file, const char *const A_file, const char *const lb_file, const char *const ub_file, const char *const lbA_file, const char *const ubA_file)
static returnValue QProblem_setLBA(QProblem *_THIS, const real_t *const lbA_new)
static real_t * DenseMatrix_getVal(DenseMatrix *_THIS)
returnValue Options_setToDefault(Options *_THIS)
static returnValue Constraints_setStatus(Constraints *_THIS, int i, SubjectToStatus value)
real_t delta_xFR_TMP[NVMAX]
int numRegularisationSteps
static BooleanType QProblem_isBlocking(QProblem *_THIS, real_t num, real_t den, real_t epsNum, real_t epsDen, real_t *t)
returnValue QProblem_hotstartFW(QProblem *_THIS, const char *const g_file, const char *const lb_file, const char *const ub_file, const char *const lbA_file, const char *const ubA_file, int *nWSR, real_t *const cputime, Bounds *const guessedBounds, Constraints *const guessedConstraints)
#define THROWWARNING(retval)
returnValue Constraints_flipFixed(Constraints *_THIS, int number)
returnValue QProblem_regulariseHessian(QProblem *_THIS)
int enableCholeskyRefactorisation
static const real_t QPOASES_EPS
returnValue QProblem_backsolveR(QProblem *_THIS, const real_t *const b, BooleanType transposed, real_t *const a)
returnValue QProblem_addConstraint_ensureLI(QProblem *_THIS, int number, SubjectToStatus C_status)
static BooleanType Constraints_hasNoLower(Constraints *_THIS)
returnValue QProblem_initW(QProblem *_THIS, real_t *const _H, const real_t *const _g, 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, real_t *const cputime, const real_t *const xOpt, const real_t *const yOpt, Bounds *const guessedBounds, Constraints *const guessedConstraints, const real_t *const _R)
returnValue Indexlist_getNumberArray(Indexlist *_THIS, int **const numberarray)
BooleanType enableNZCTests
returnValue QProblem_addBound_ensureLI(QProblem *_THIS, int number, SubjectToStatus B_status)
#define QPOASES_MAX_STRING_LENGTH
returnValue QProblem_setupQPdataM(QProblem *_THIS, DenseMatrix *_H, const real_t *const _g, DenseMatrix *_A, const real_t *const _lb, const real_t *const _ub, const real_t *const _lbA, const real_t *const _ubA)
returnValue QProblem_performDriftCorrection(QProblem *_THIS)
static returnValue Constraints_setType(Constraints *_THIS, int i, SubjectToType value)
Manages working sets of bounds (= box constraints).
returnValue QProblem_solveQP(QProblem *_THIS, 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, int nWSRperformed, BooleanType isFirstCall)
#define BEGIN_NAMESPACE_QPOASES
returnValue QProblem_initMW(QProblem *_THIS, DenseMatrix *_H, const real_t *const _g, DenseMatrix *_A, const real_t *const _lb, const real_t *const _ub, const real_t *const _lbA, const real_t *const _ubA, int *nWSR, real_t *const cputime, const real_t *const xOpt, const real_t *const yOpt, Bounds *const guessedBounds, Constraints *const guessedConstraints, const real_t *const _R)
returnValue DenseMatrix_times(DenseMatrix *_THIS, int xN, real_t alpha, const real_t *x, int xLD, real_t beta, real_t *y, int yLD)
returnValue QProblem_determineHessianType(QProblem *_THIS)
returnValue QProblem_performPlainRatioTest(QProblem *_THIS, int nIdx, const int *const idxList, const real_t *const num, const real_t *const den, real_t epsNum, real_t epsDen, real_t *t, int *BC_idx)
real_t QProblem_getObjValX(QProblem *_THIS, const real_t *const _x)
static BooleanType QProblem_usingRegularisation(QProblem *_THIS)
returnValue QProblem_getPrimalSolution(QProblem *_THIS, real_t *const xOpt)
Implements the online active set strategy for QPs with general constraints.
static void QProblemB_computeGivens(real_t xold, real_t yold, real_t *xnew, real_t *ynew, real_t *c, real_t *s)
static returnValue QProblem_setUB(QProblem *_THIS, const real_t *const ub_new)
returnValue qpOASES_printCopyrightNotice()
static SubjectToType Bounds_getType(Bounds *_THIS, int i)
void QProblemCPY(QProblem *FROM, QProblem *TO)
returnValue Bounds_swapFree(Bounds *_THIS, int number1, int number2)
static returnValue Bounds_setStatus(Bounds *_THIS, int i, SubjectToStatus value)
returnValue QProblem_performStep(QProblem *_THIS, const real_t *const delta_g, const real_t *const delta_lbA, const real_t *const delta_ubA, const real_t *const delta_lb, const real_t *const delta_ub, const real_t *const delta_xFX, const real_t *const delta_xFR, const real_t *const delta_yAC, const real_t *const delta_yFX, int *BC_idx, SubjectToStatus *BC_status, BooleanType *BC_isBound)
returnValue QProblem_setupQPdata(QProblem *_THIS, real_t *const _H, const real_t *const _g, real_t *const _A, const real_t *const _lb, const real_t *const _ub, const real_t *const _lbA, const real_t *const _ubA)
static BooleanType Constraints_hasNoUpper(Constraints *_THIS)
returnValue QProblem_init(QProblem *_THIS, real_t *const _H, const real_t *const _g, 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, real_t *const cputime)
static returnValue QProblem_setA(QProblem *_THIS, real_t *const A_new)
void ConstraintsCON(Constraints *_THIS, int _n)
SubjectToStatus initialStatusBounds
static Indexlist * Bounds_getFixed(Bounds *_THIS)
static int QProblem_getNEC(QProblem *_THIS)
real_t QProblem_getObjVal(QProblem *_THIS)
returnValue QProblem_setPrintLevel(QProblem *_THIS, PrintLevel _printLevel)
BooleanType enableDropInfeasibles
returnValue QProblem_setupAuxiliaryWorkingSet(QProblem *_THIS, Bounds *const auxiliaryBounds, Constraints *const auxiliaryConstraints, BooleanType setupAfresh)
returnValue QProblem_performRamping(QProblem *_THIS)
void BoundsCON(Bounds *_THIS, int _n)
static int Constraints_getNAC(Constraints *_THIS)
returnValue Constraints_setupAllInactive(Constraints *_THIS)
static BooleanType QProblem_isUnbounded(QProblem *_THIS)