giaf / hpmpc Goto Github PK
View Code? Open in Web Editor NEWLibrary for High-Performance implementation of solvers for MPC.
License: GNU Lesser General Public License v2.1
Library for High-Performance implementation of solvers for MPC.
License: GNU Lesser General Public License v2.1
Hey,
It seems the soft constraint version of the solver hasn't been maintained since migration to use BLASFEO? I noticed it doesn't compile with BLASFEO set (several undefined functions). After I unset it, it took me some code revision to make it compile and run - I requested a pull with these fixes. (I'm not sure if this your preferred way to have contributions, please let me know if it isn't).
I noticed that the solver is not converging if the soft constraints are too tight. I'm using the same test case as your default for the hard constrained version: nx = 8, nu = 3, N = 10. I set b to zero and I'm using the following constraints:
double u_min_hard = - 0.5;
double u_max_hard = 0.5;
double x_min_hard = - 4.0;
double x_max_hard = 4.0;
double x_min_soft = - 2.0;
double x_max_soft = 2.0;
/************************************************
* cost function
************************************************/
// (other stuff kept)
double *Z; d_zeros(&Z, 2*ns_, 1); // quadratic penalty
for(ii=0; ii<2*ns_; ii++) Z[ii] = 10.0;
double *z; d_zeros(&z, 2*ns_, 1); // linear penalty
for(ii=0; ii<2*ns_; ii++) z[ii] = 0.0;
// maximum element in cost functions
double mu0 = 10.0;
I set the max iteration count to 500 and it still reaches the iteration limit count. It looks like it gets stuck with little to no change in the mu and alpha variables.
So, main questions:
Thanks a lot!
Gabriel.
Hi Gianluca,
When running the same MPC problem instances with and without BLASFEO - using test_d_ip_hard.c for without and test_d_ip_hard_libstr.c for with - I'm getting better CPU time performance with the case without BLASFEO. The one using BLASFEO is about 40%-50% slower than the one not using it.
Is that expected? If not, do you have any ideas on what could be going on?
Thanks,
Gabriel.
Example: test_qp.zip
Compile and run test_qp.c
:
gcc test_qp.c ../libhpmpc.a -lm -I../include && ./a.out
Output:
42.41390 0.00000 0.00000 0.00034
ret = 2, num_iter = 17
**** Solution ****
0: 3.686148e+03 3.240471e+03 3.323842e+03 2.046661e+03 2.925937e+03 4.659445e+03 2.397687e+03 3.480276e+03 |
1: 4.069169e+01 4.232778e+01 3.663998e+01 2.522136e-01 4.048130e+01 4.715386e+01 3.101806e+00 3.898011e+01 | -1.471729e-02 3.549509e-02 -1.433030e-03 5.829777e-11 -1.838314e-04 4.476098e-04 -1.658147e-05 -3.679237e-04 -2.817339e-04 -1.078722e-04 -9.406624e-06 -7.263682e-06 -2.618192e-06
2: 8.672327e-13 8.657697e-13 1.632042e-12 1.675816e-10 -3.677156e-04 8.950437e-04 -3.340536e-05 -2.188321e-13 -2.010634e-12 2.518672e-12 -1.881176e-05 -1.451939e-05 -5.238491e-06
Solve the same problem with CasADi
+Ipopt
:
>> solve_with_casadi
This is Ipopt version 3.12.4, running with linear solver ma86.
Number of nonzeros in equality constraint Jacobian...: 377
Number of nonzeros in inequality constraint Jacobian.: 0
Number of nonzeros in Lagrangian Hessian.............: 295
Total number of variables............................: 36
variables with only lower bounds: 0
variables with lower and upper bounds: 36
variables with only upper bounds: 0
Total number of equality constraints.................: 26
Total number of inequality constraints...............: 0
inequality constraints with only lower bounds: 0
inequality constraints with lower and upper bounds: 0
inequality constraints with only upper bounds: 0
iter objective inf_pr inf_du lg(mu) ||d|| lg(rg) alpha_du alpha_pr ls
0 -3.1437013e-06 1.05e-05 4.72e-03 -1.0 0.00e+00 - 0.00e+00 0.00e+00 0
1 -1.3718936e-04 2.26e-09 2.04e-05 -1.0 1.84e-01 - 9.90e-01 1.00e+00f 1
2 -1.2937332e-02 1.68e-08 1.97e-05 -1.0 1.62e+01 - 9.70e-01 1.00e+00f 1
3 -5.6518250e-01 1.95e-08 1.35e-03 -1.0 1.13e+03 - 2.65e-01 1.00e+00f 1
4 -1.0031278e+00 1.46e-08 1.18e-04 -1.0 8.17e+02 - 7.43e-01 1.00e+00f 1
5 -1.4737920e+00 3.89e-09 4.56e-04 -1.7 1.27e+03 - 7.18e-01 1.00e+00f 1
6 -1.7259628e+00 3.23e-09 1.53e-04 -2.5 1.38e+03 - 8.09e-01 1.00e+00f 1
7 -1.7526081e+00 3.62e-09 2.92e-13 -2.5 4.75e+02 - 1.00e+00 1.00e+00f 1
8 -1.7531840e+00 3.68e-09 5.05e-13 -3.8 8.45e+01 - 1.00e+00 1.00e+00f 1
9 -1.7531850e+00 3.68e-09 4.75e-13 -5.7 3.92e+00 - 1.00e+00 1.00e+00h 1
iter objective inf_pr inf_du lg(mu) ||d|| lg(rg) alpha_du alpha_pr ls
10 -1.7531850e+00 3.68e-09 4.13e-13 -8.6 7.94e-03 - 1.00e+00 1.00e+00h 1
Number of Iterations....: 10
(scaled) (unscaled)
Objective...............: -1.7531850443754096e+00 -1.7531850443754096e+00
Dual infeasibility......: 4.1297505193093530e-13 4.1297505193093530e-13
Constraint violation....: 3.6843180685518097e-09 3.6843180685518097e-09
Complementarity.........: 2.5135155290973441e-09 2.5135155290973441e-09
Overall NLP error.......: 3.6843180685518097e-09 3.6843180685518097e-09
Number of objective function evaluations = 11
Number of objective gradient evaluations = 11
Number of equality constraint evaluations = 11
Number of inequality constraint evaluations = 0
Number of equality constraint Jacobian evaluations = 11
Number of inequality constraint Jacobian evaluations = 0
Number of Lagrangian Hessian evaluations = 10
Total CPU secs in IPOPT (w/o function evaluations) = 0.244
Total CPU secs in NLP function evaluations = 0.024
EXIT: Optimal Solution Found.
proc wall num mean mean
time time evals proc time wall time
nlp_f 0.001 [s] 0.000 [s] 11 0.11 [ms] 0.03 [ms]
nlp_g 0.001 [s] 0.000 [s] 11 0.09 [ms] 0.02 [ms]
nlp_grad_f 0.002 [s] 0.001 [s] 12 0.15 [ms] 0.04 [ms]
nlp_jac_g 0.002 [s] 0.001 [s] 12 0.20 [ms] 0.06 [ms]
nlp_hess_l 0.017 [s] 0.005 [s] 10 1.74 [ms] 0.49 [ms]
all previous 0.024 [s] 0.007 [s]
callback_prep 0.017 [s] 0.005 [s] 11 1.59 [ms] 0.47 [ms]
solver 0.231 [s] 0.065 [s]
mainloop 0.273 [s] 0.077 [s]
sol =
f: [1x1 casadi.DM]
g: [26x1 casadi.DM]
lam_g: [26x1 casadi.DM]
lam_p: [0x0 casadi.DM]
lam_x: [42x1 casadi.DM]
x: [42x1 casadi.DM]
CasADi solution:
1.0e+03 *
Columns 1 through 18
3.6940 3.2561 3.3295 2.0254 2.9422 4.6650 2.3763 3.4867 3.6938 3.2558 3.3298 2.0259 2.9419 4.6648 2.3767 3.4869 0.0000 -0.0000
Columns 19 through 36
-0.0000 -0.0000 -0.0000 0.0000 0.0000 0.0000 -0.0000 0.0000 -0.0000 0.0000 -0.0000 0 0 0 -0.0000 0 0 0
Columns 37 through 42
0 0 0 0 0 0
The two solutions are different (look at the first numbers; the order of variables is the same). hpmpc solver returns code 2
.
Hello,
First of all, thanks for the amazing work and for making it open source.
I'm trying to compile the whole package using 'make' but compilation is failing when entering test_problems, particularly at 'test_d_ip_hard_libstr.c". The log is below. Thanks in advance.
[predix@localhost test_problems]$ make gcc -O2 -fPIC -m64 -mavx -DTARGET_X64_AVX -c -o test_d_ip_hard_libstr.o test_d_ip_hard_libstr.c test_d_ip_hard_libstr.c: In function ‘main’: test_d_ip_hard_libstr.c:289: error: storage size of ‘sA’ isn’t known test_d_ip_hard_libstr.c:294: error: storage size of ‘sx0’ isn’t known test_d_ip_hard_libstr.c:299: error: storage size of ‘sb0’ isn’t known test_d_ip_hard_libstr.c:308: error: storage size of ‘sBAbt0’ isn’t known test_d_ip_hard_libstr.c:315: error: storage size of ‘sBAbt1’ isn’t known test_d_ip_hard_libstr.c:316: error: storage size of ‘sb1’ isn’t known test_d_ip_hard_libstr.c:346: error: storage size of ‘sRSQrq0’ isn’t known test_d_ip_hard_libstr.c:347: error: storage size of ‘srq0’ isn’t known test_d_ip_hard_libstr.c:360: error: storage size of ‘sRSQrq1’ isn’t known test_d_ip_hard_libstr.c:361: error: storage size of ‘srq1’ isn’t known test_d_ip_hard_libstr.c:377: error: storage size of ‘sRSQrqN’ isn’t known test_d_ip_hard_libstr.c:378: error: storage size of ‘srqN’ isn’t known test_d_ip_hard_libstr.c:492: error: storage size of ‘sDCt0’ isn’t known test_d_ip_hard_libstr.c:496: error: storage size of ‘sd0’ isn’t known test_d_ip_hard_libstr.c:501: error: storage size of ‘sDCt1’ isn’t known test_d_ip_hard_libstr.c:505: error: storage size of ‘sd1’ isn’t known test_d_ip_hard_libstr.c:510: error: storage size of ‘sDCtN’ isn’t known test_d_ip_hard_libstr.c:514: error: storage size of ‘sdN’ isn’t known test_d_ip_hard_libstr.c:523: error: array type has incomplete element type test_d_ip_hard_libstr.c:524: error: array type has incomplete element type test_d_ip_hard_libstr.c:525: error: array type has incomplete element type test_d_ip_hard_libstr.c:526: error: array type has incomplete element type test_d_ip_hard_libstr.c:528: error: array type has incomplete element type test_d_ip_hard_libstr.c:529: error: array type has incomplete element type test_d_ip_hard_libstr.c:530: error: array type has incomplete element type test_d_ip_hard_libstr.c:531: error: array type has incomplete element type test_d_ip_hard_libstr.c:614: error: array type has incomplete element type test_d_ip_hard_libstr.c:615: error: array type has incomplete element type test_d_ip_hard_libstr.c:616: error: array type has incomplete element type test_d_ip_hard_libstr.c:617: error: array type has incomplete element type test_d_ip_hard_libstr.c:618: error: array type has incomplete element type test_d_ip_hard_libstr.c:619: error: array type has incomplete element type test_d_ip_hard_libstr.c:673: error: array type has incomplete element type test_d_ip_hard_libstr.c:674: error: array type has incomplete element type test_d_ip_hard_libstr.c:675: error: array type has incomplete element type test_d_ip_hard_libstr.c:676: error: array type has incomplete element type make: *** [test_d_ip_hard_libstr.o] Error 1
A problem that appears to be feasible could not be solved by HPMPC. The c_order_d_ip_ocp_hard_tv()
makes 0 iterations and returns -1.
The code to reproduce the problem:
test1.c.zip
Compile command:
gcc test1.c -L. libhpmpc.a -lm -o test1 && ./test1
Output:
1.061400e+03 1.100000e+00 1.100000e+00 -nan
Return code = -1
Hi Gian,
Is there any attempts to make HPMPC campatible with Windows?
I tried to compile HPMPC in Windows 10 using Cygwin. I set OS to be Windows in "Makefile.rule".
The compilation fails anyway, with or without Blasfeo. If I set OS to be Linux, the static library can be built but the dynamic one cannot be successfully built.
I notice that this library is written in Linux and tested with gcc and clang. However, since there is such a setting for choosing OS, I think HPMPC is somehow compatible with Windows.
Any ideas about compilation and installation on Windows?
Thanks,
Yutao
I was wondering, is there a fundamental reason why only static libraries are built?
Hi
I am trying to use the HPMPC solver for my MHE task. I have set the following option in ACADO codegeneration file:
mhe.set(FIX_INITIAL_STATE, NO);
Then I run the codegeration file and everything works properly.
However, when I tried to compile the final code I have got the following errors:
/home/alex/catkin_ws/src/car_mhpe_estimator/src/hpmpc_solver/acado_solver.c:1341:23: error: ‘HPMPC_RIC_MHE_IF_DP_WORK_SPACE’ undeclared (first use in this function)
static real_t qpWork[ HPMPC_RIC_MHE_IF_DP_WORK_SPACE ];
How can I solve this issue?
Please add return code constants and their descriptions.
Hi,
I noticed that the value K_MAX we set in test_param.h is not being used in the test_d_ip_hard_libstr.c file. Although it is initially printed as if it were, in line 612 there is a hard coded 10:
int k_max = 10;
This is a minor bug but it risks a wrong interpretation of the results.
Thanks,
Gabriel.
The code to reproduce the problem:
test.zip
Clang on OSX reports:
/Users/madwolf/Work/GIT/hpmpc/blas/blas_s_lib8.c:538:3: warning: implicit declaration of function
'kernel_sgemv_t_3_lib8' is invalid in C99 [-Wimplicit-function-declaration]
kernel_sgemv_t_3_lib8(m, mna, pA+j*bs, sda, x, y+j, alg);
^
1 warning generated.
The guide states that the size is 2(n b + n g )N + 2(n b + n gN )
, but what is the order?
Also, the numbers seem not to map to what a regular qp solver sees as multipliers (unlike pi).
Hi. I have much interest in this implementation. But it's better to have a wiki about HPMPC. Thanks
The QP data passed to c_order_d_ip_ocp_hard_tv()
are in the failed_qp.m file
(see
qp.zip). The following code converts the QP to CasADi
nlp and solves it in MATLAB:
clear;
failed_qp;
[nlp, b, x0] = hpmpc_to_casadi(qp);
options.ipopt.linear_solver = 'ma86';
solver = casadi.nlpsol('NLPSolver', 'ipopt', nlp, options);
sol = solver('lbx', b.lbx, 'ubx', b.ubx, 'lbg', b.lbg, 'ubg', b.ubg)
Output:
This is Ipopt version 3.12.4, running with linear solver ma86.
Number of nonzeros in equality constraint Jacobian...: 104
Number of nonzeros in inequality constraint Jacobian.: 0
Number of nonzeros in Lagrangian Hessian.............: 64
Total number of variables............................: 15
variables with only lower bounds: 0
variables with lower and upper bounds: 15
variables with only upper bounds: 0
Total number of equality constraints.................: 13
Total number of inequality constraints...............: 0
inequality constraints with only lower bounds: 0
inequality constraints with lower and upper bounds: 0
inequality constraints with only upper bounds: 0
iter objective inf_pr inf_du lg(mu) ||d|| lg(rg) alpha_du alpha_pr ls
0 -1.5718507e-06 1.05e-05 8.05e-05 -1.0 0.00e+00 - 0.00e+00 0.00e+00 0
1 -7.1895982e-05 2.26e-09 1.34e-06 -1.0 1.84e-01 - 9.90e-01 1.00e+00f 1
2 -6.4388769e-03 7.41e-10 1.97e-05 -1.0 1.62e+01 - 9.70e-01 1.00e+00f 1
3 -3.3171558e-01 1.56e-08 1.35e-03 -1.0 1.13e+03 - 2.65e-01 1.00e+00f 1
4 -5.2942863e-01 1.46e-08 1.18e-04 -1.0 6.99e+02 - 7.43e-01 1.00e+00f 1
5 -7.4800557e-01 2.26e-09 8.37e-05 -1.7 1.13e+03 - 7.48e-01 1.00e+00f 1
6 -8.6505679e-01 3.26e-09 9.71e-05 -2.5 1.17e+03 - 7.99e-01 1.00e+00f 1
7 -8.7635189e-01 3.62e-09 1.74e-16 -2.5 4.42e+02 - 1.00e+00 1.00e+00f 1
8 -8.7658396e-01 3.68e-09 2.93e-16 -3.8 7.23e+01 - 1.00e+00 1.00e+00f 1
9 -8.7658433e-01 3.68e-09 3.82e-16 -5.7 3.14e+00 - 1.00e+00 1.00e+00h 1
iter objective inf_pr inf_du lg(mu) ||d|| lg(rg) alpha_du alpha_pr ls
10 -8.7658433e-01 3.68e-09 3.30e-16 -8.6 5.19e-03 - 1.00e+00 1.00e+00h 1
Number of Iterations....: 10
(scaled) (unscaled)
Objective...............: -8.7658432596688318e-01 -8.7658432596688318e-01
Dual infeasibility......: 3.2992956828165456e-16 3.2992956828165456e-16
Constraint violation....: 3.6843180616129157e-09 3.6843180616129157e-09
Complementarity.........: 2.5105616195963237e-09 2.5105616195963237e-09
Overall NLP error.......: 3.6843180616129157e-09 3.6843180616129157e-09
Number of objective function evaluations = 11
Number of objective gradient evaluations = 11
Number of equality constraint evaluations = 11
Number of inequality constraint evaluations = 0
Number of equality constraint Jacobian evaluations = 11
Number of inequality constraint Jacobian evaluations = 0
Number of Lagrangian Hessian evaluations = 10
Total CPU secs in IPOPT (w/o function evaluations) = 0.080
Total CPU secs in NLP function evaluations = 0.012
EXIT: Optimal Solution Found.
proc wall num mean mean
time time evals proc time wall time
nlp_f 0.001 [s] 0.000 [s] 11 0.06 [ms] 0.01 [ms]
nlp_g 0.000 [s] 0.000 [s] 11 0.04 [ms] 0.01 [ms]
nlp_grad_f 0.001 [s] 0.000 [s] 12 0.08 [ms] 0.02 [ms]
nlp_jac_g 0.001 [s] 0.000 [s] 12 0.06 [ms] 0.02 [ms]
nlp_hess_l 0.006 [s] 0.002 [s] 10 0.60 [ms] 0.15 [ms]
all previous 0.009 [s] 0.002 [s]
callback_prep 0.000 [s] 0.000 [s] 11 0.04 [ms] 0.01 [ms]
solver 0.098 [s] 0.026 [s]
mainloop 0.107 [s] 0.028 [s]
sol =
f: [1x1 casadi.DM]
g: [13x1 casadi.DM]
lam_g: [13x1 casadi.DM]
lam_p: [0x0 casadi.DM]
lam_x: [21x1 casadi.DM]
x: [21x1 casadi.DM]
On the same problem c_order_d_ip_ocp_hard_tv()
returns -1
and *kk == 0
.
To my best knowledge, the problem is feasible and the data are well-formed.
The functions *_d_ip_ocp_hard_tv()
, *_d_ip_ocp_hard_tv_work_space_size_bytes()
expect their argument nu
(size of control input) to point to an array of size N+1
(N
=number of control intervals). But nu[N]
is always 0
(or are there cases when it can be non-0?).
Should it be changed so that nu
points to an array of size N
instead of N+1
?
Branch cleaning
:
$ make static_library -j 4
touch ./include/target.h
echo "#ifndef TARGET_X64_AVX" > ./include/target.h
echo "#define TARGET_X64_AVX" >> ./include/target.h
echo "#endif" >> ./include/target.h
( cd auxiliary; make obj)
make[1]: Entering directory '/home/kotlyar/software/hpmpc.giaf/auxiliary'
gcc -O2 -fPIC -m64 -mavx -DTARGET_X64_AVX -c -o d_aux_lib4.o d_aux_lib4.c
gcc -O2 -fPIC -m64 -mavx -DTARGET_X64_AVX -c -o d_aux_extern_depend_lib4.o d_aux_extern_depend_lib4.c
gcc -O2 -fPIC -m64 -mavx -DTARGET_X64_AVX -c -o i_aux.o i_aux.c
make[1]: Leaving directory '/home/kotlyar/software/hpmpc.giaf/auxiliary'
( cd kernel; make obj)
make[1]: Entering directory '/home/kotlyar/software/hpmpc.giaf/kernel'
( cd avx; make obj)
make[2]: Entering directory '/home/kotlyar/software/hpmpc.giaf/kernel/avx'
gcc -O2 -fPIC -m64 -mavx -DTARGET_X64_AVX -c -o kernel_dgemm_avx_lib4.o kernel_dgemm_avx_lib4.c
gcc -O2 -fPIC -m64 -mavx -DTARGET_X64_AVX -c -o kernel_dtrmm_avx_lib4.o kernel_dtrmm_avx_lib4.c
gcc -O2 -fPIC -m64 -mavx -DTARGET_X64_AVX -c -o kernel_dtrsm_avx_lib4.o kernel_dtrsm_avx_lib4.c
gcc -O2 -fPIC -m64 -mavx -DTARGET_X64_AVX -c -o kernel_dsyrk_avx_lib4.o kernel_dsyrk_avx_lib4.c
gcc -O2 -fPIC -m64 -mavx -DTARGET_X64_AVX -c -o kernel_dpotrf_avx_lib4.o kernel_dpotrf_avx_lib4.c
gcc -O2 -fPIC -m64 -mavx -DTARGET_X64_AVX -c -o kernel_dgemv_avx_lib4.o kernel_dgemv_avx_lib4.c
gcc -O2 -fPIC -m64 -mavx -DTARGET_X64_AVX -c -o kernel_dtrmv_avx_lib4.o kernel_dtrmv_avx_lib4.c
gcc -O2 -fPIC -m64 -mavx -DTARGET_X64_AVX -c -o kernel_dtrsv_avx_lib4.o kernel_dtrsv_avx_lib4.c
gcc -O2 -fPIC -m64 -mavx -DTARGET_X64_AVX -c -o kernel_dsymv_avx_lib4.o kernel_dsymv_avx_lib4.c
gcc -O2 -fPIC -m64 -mavx -DTARGET_X64_AVX -c -o kernel_dtran_avx_lib4.o kernel_dtran_avx_lib4.c
gcc -O2 -fPIC -m64 -mavx -DTARGET_X64_AVX -c -o kernel_dttmm_avx_lib4.o kernel_dttmm_avx_lib4.c
gcc -O2 -fPIC -m64 -mavx -DTARGET_X64_AVX -c -o kernel_dtrinv_avx_lib4.o kernel_dtrinv_avx_lib4.c
gcc -O2 -fPIC -m64 -mavx -DTARGET_X64_AVX -c -o kernel_dcopy_avx_lib4.o kernel_dcopy_avx_lib4.c
gcc -O2 -fPIC -m64 -mavx -DTARGET_X64_AVX -c -o kernel_dgetrf_avx_lib4.o kernel_dgetrf_avx_lib4.c
make[2]: Leaving directory '/home/kotlyar/software/hpmpc.giaf/kernel/avx'
( cd c99; make obj)
make[2]: Entering directory '/home/kotlyar/software/hpmpc.giaf/kernel/c99'
make[2]: Nothing to be done for 'obj'.
make[2]: Leaving directory '/home/kotlyar/software/hpmpc.giaf/kernel/c99'
make[1]: Leaving directory '/home/kotlyar/software/hpmpc.giaf/kernel'
( cd blas; make obj)
make[1]: Entering directory '/home/kotlyar/software/hpmpc.giaf/blas'
gcc -O2 -fPIC -m64 -mavx -DTARGET_X64_AVX -c -o blas_d_lib4.o blas_d_lib4.c
make[1]: Leaving directory '/home/kotlyar/software/hpmpc.giaf/blas'
( cd lqcp_solvers; make obj)
make[1]: Entering directory '/home/kotlyar/software/hpmpc.giaf/lqcp_solvers'
gcc -O2 -fPIC -m64 -mavx -DTARGET_X64_AVX -c -o d_back_ric_rec.o d_back_ric_rec.c
gcc -O2 -fPIC -m64 -mavx -DTARGET_X64_AVX -c -o d_for_schur_rec.o d_for_schur_rec.c
gcc -O2 -fPIC -m64 -mavx -DTARGET_X64_AVX -c -o d_res.o d_res.c
d_for_schur_rec.c:34:28: fatal error: blasfeo_d_blas.h: No such file or directory
compilation terminated.
<builtin>: recipe for target 'd_for_schur_rec.o' failed
make[1]: *** [d_for_schur_rec.o] Error 1
make[1]: *** Waiting for unfinished jobs....
d_back_ric_rec.c:34:28: fatal error: blasfeo_d_blas.h: No such file or directory
compilation terminated.
<builtin>: recipe for target 'd_back_ric_rec.o' failed
make[1]: *** [d_back_ric_rec.o] Error 1
make[1]: Leaving directory '/home/kotlyar/software/hpmpc.giaf/lqcp_solvers'
Makefile:107: recipe for target 'static_library' failed
make: *** [static_library] Error 2
C code to reproduce the problem: failed_qp.c.zip
test_qp.c.zip
hpmpc returns code 2
.
I added some scripts for the CMake build system. You can find them in my fork. After sudo apt-get install cmake cmake-curses-gui
you can do something like:
mkdir build
cd build
cmake ..
make
Also, you can install lib and headers with sudo make install
;)
If you want to change the target, use ccmake from the build folder: ccmake ..
and then change the HPMPC_TARGET
field.
Hi,
I may be misinterpreting the results. I was trying an instance of the default test case, setting Nx = 60, Nu = 6, N = 30 and leaving N2 = 5. When I look at the residuals, the mu variables seem to be increasing at every iteration. Is this ok or indeed there is something wrong going on? You can see the residuals below. Thanks!
sigma alpha1 mu1 alpha2 mu2
7.849190e-01 6.961859e-02 1.844895e+00 5.601648e-02 2.167802e+00
5.654612e-01 1.328394e-01 1.792615e+00 7.866040e-02 2.448698e+00
7.682224e-01 6.339107e-02 2.242664e+00 6.038227e-02 2.839373e+00
9.618473e-01 7.576270e-03 2.802794e+00 8.554261e-04 3.054789e+00
8.715104e-01 8.241846e-03 2.917911e+00 4.634073e-04 3.792977e+00
5.271292e-01 8.627719e-03 3.063980e+00 1.663392e-04 5.331655e+00
6.978703e-01 4.545693e-03 4.729192e+00 7.829801e-05 7.515975e+00
4.825211e-01 5.315192e-03 5.895094e+00 6.635004e-05 1.122146e+01
6.592392e-01 3.674644e-03 9.766310e+00 4.045442e-05 1.546057e+01
6.947633e-01 3.259677e-03 1.369318e+01 5.506575e-05 2.434838e+01
7.485869e-01 2.771082e-03 2.210806e+01 4.360596e-05 3.668885e+01
6.411685e-01 3.296154e-03 3.163672e+01 3.427805e-05 5.226426e+01
5.932249e-01 3.485857e-03 4.391483e+01 4.934937e-05 8.540819e+01
6.090260e-01 3.336631e-03 7.239548e+01 9.450187e-05 1.927688e+02
2.657179e-01 5.005872e-03 1.239301e+02 5.524357e-05 3.421472e+02
5.583801e-01 3.468656e-03 2.817450e+02 4.982150e-05 5.871007e+02
2.626648e-01 4.920257e-03 3.759932e+02 8.956585e-05 1.352799e+03
1.642487e-01 5.447489e-03 7.408564e+02 9.418711e-05 3.258711e+03
3.346302e-01 4.413347e-03 2.262391e+03 1.007219e-04 8.297329e+03
4.126821e-01 3.976474e-03 6.177463e+03 1.094285e-04 2.260963e+04
6.120308e-01 3.004893e-03 1.919631e+04 1.097758e-04 6.290721e+04
5.671838e-01 3.164283e-03 5.207249e+04 1.038749e-04 1.722915e+05
6.477912e-02 5.839482e-03 6.919514e+04 5.194832e-05 3.275165e+05
2.198542e-02 6.360731e-03 9.175112e+04 9.923402e-05 8.958630e+05
9.810750e-02 5.423588e-03 4.131829e+05 8.291455e-05 2.234202e+06
8.580352e-01 1.610499e-03 2.123037e+06 7.553621e-06 2.548766e+06
9.752381e-01 6.425942e-04 2.527552e+06 7.491724e-06 2.905491e+06
1.237583e-01 5.159832e-03 1.447919e+06 1.194430e-04 9.302579e+06
3.412657e-02 5.891526e-03 3.017409e+06 1.167184e-04 3.001309e+07
4.055767e-01 3.582832e-03 2.221613e+07 1.866320e-05 4.121939e+07
9.342653e-01 1.032096e-03 4.029567e+07 1.739464e-05 5.564849e+07
7.689753e-01 2.013766e-03 5.098286e+07 4.525524e-05 1.063938e+08
5.883531e-01 2.790436e-03 8.915158e+07 6.726142e-05 2.520852e+08
9.854898e-01 4.593099e-04 2.508600e+08 1.392541e-05 3.255729e+08
1.873928e-04 6.682632e-03 1.863085e+07 9.644201e-05 9.777064e+08
5.363688e-02 5.349607e-03 3.687197e+08 1.171189e-04 3.417786e+09
6.040128e-02 5.190790e-03 1.340994e+09 2.208503e-04 1.981372e+10
8.513496e-01 1.456549e-03 1.877884e+10 5.093455e-06 2.223956e+10
7.850259e-01 1.777361e-03 2.051576e+10 2.240263e-05 3.420313e+10
4.364960e-01 3.141172e-03 2.594533e+10 1.669035e-05 4.802335e+10
9.904976e-01 3.418189e-04 4.787075e+10 1.544826e-05 6.608615e+10
4.038175e-03 5.848694e-03 1.052379e+10 7.940779e-05 1.932000e+11
1.293530e-01 4.422954e-03 9.770858e+10 1.022425e-04 6.821841e+11
2.372257e-01 3.816985e-03 4.223010e+11 6.917454e-05 1.896100e+12
1.534078e-02 5.307973e-03 4.711331e+11 2.507819e-05 3.156616e+12
9.936808e-01 2.631017e-04 3.149953e+12 7.378018e-07 3.219132e+12
1.658967e-02 5.261728e-03 8.210155e+11 4.419749e-05 7.011674e+12
1.451622e-02 5.261789e-03 1.710434e+12 7.077501e-05 2.037746e+13
2.658239e-01 3.567448e-03 1.310232e+13 1.449700e-05 2.860312e+13
1.199203e-02 5.238178e-03 6.547028e+12 1.817339e-05 4.314054e+13
Average solution time over 100 runs: 1.98e-01 seconds (IPM)
I noticed that the number of iterations returned by HPMPC looks like garbage. I ran it with gdb
and put a watchpoint on the *kk
variable and this is what I found:
Hardware watchpoint 7: *kk
Old value = 0
New value = 1
0x0000000000c241b7 in d_ip2_res_mpc_hard_libstr ()
Hardware watchpoint 7: *kk
Old value = 1
New value = 2
0x0000000000c241b7 in d_ip2_res_mpc_hard_libstr ()
Hardware watchpoint 7: *kk
Old value = 2
New value = 3
0x0000000000c241b7 in d_ip2_res_mpc_hard_libstr ()
Hardware watchpoint 7: *kk
Old value = 3
New value = 4
0x0000000000c241b7 in d_ip2_res_mpc_hard_libstr ()
Hardware watchpoint 7: *kk
Old value = 4
New value = 5
0x0000000000c241b7 in d_ip2_res_mpc_hard_libstr ()
Hardware watchpoint 7: *kk
Old value = 5
New value = 6
0x0000000000c241b7 in d_ip2_res_mpc_hard_libstr ()
Hardware watchpoint 7: *kk
Old value = 6
New value = 7
0x0000000000c241b7 in d_ip2_res_mpc_hard_libstr ()
Hardware watchpoint 7: *kk
Old value = 7
New value = 8
0x0000000000c241b7 in d_ip2_res_mpc_hard_libstr ()
Hardware watchpoint 7: *kk
Old value = 8
New value = 9
0x0000000000c24759 in d_ip2_res_mpc_hard_libstr ()
Hardware watchpoint 7: *kk
Old value = 9
New value = 10
0x0000000000c24759 in d_ip2_res_mpc_hard_libstr ()
Hardware watchpoint 7: *kk
Old value = 10
New value = -918365010
Signature of hpmpc_d_ip_ocp_hard_tv_work_space_size_bytes
changed
Clang
issues multiple warnings like this:
warning: using integer absolute value function 'abs' when argument is of floating point type [-Wabsolute-value]
Was it an intent to use the integer version of abs()
or is it a mistake?
In a CasADi/ipopt context, I'm used to specify inf as bounds to obtain single sided inequalities or to make variables free.
It appears like using inf is prohibited for hpmpc (getting NaN). What is the recommended alternative?
I guess for the 'free variables' specification, the recommended approach is with nb
and hindxb
.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.