Hello everyone,
I use casadi.Opti() in matlab to solve quadratic form of MPC sum(x'Qx+u'*R*u) with input constraints in the control horizon is subject to -u_max<=u<=u_max. x is 4*1 and u is 1*1. p is the initial state of x.
I tried qpoases, nlpsol and qrqp. But simliar erros show that it cannot load shared library. I have already added casadi path to matlab. Do I need to download these solvers files?
opti=casadi.Opti();
Np=30;Nc=20;
x=opti.variable(4,Np);
u=opti.variable(1,Nc);
p=opti.parameter(4,1);
sumx=0;sumu=0;
for kp=1:Np-1
if kp<=Nc
opti.subject_to(x(:,kp+1)==AT*x(:,kp)+B2*u(1,kp)+D0);
sumu=u(1,kp)'*R*u(1,kp)+sumu;
else
opti.subject_to(x(:,kp+1)==AT*x(:,kp)+B2*u(1,Nc)+D0);
end
sumx=sumx+x(:,kp+1)'*Q*x(:,kp+1);
end
opti.subject_to(norm(u,inf)<=u_max);
sum=sumx+sumu;
opti.subject_to(x(:,1)==p);
opti.set_value(p,[ey;vy+vx*ephi;ephi;yawrate-vx*rho]);
opti.minimize(sum);
opti.solver('nlpsol');
sol=opti.solve();
CasADi - WARNING(".../casadi/core/plugin_interface.hpp:322: Assertion "handle!=nullptr" failed:
PluginInterface::load_plugin: Cannot load shared library 'libcasadi_nlpsol_nlpsol.dll':
(
Searched directories: 1. casadipath from GlobalOptions
2. CASADIPATH env var
3. PATH env var (Windows)
4. LD_LIBRARY_PATH env var (Linux)
5. DYLD_LIBRARY_PATH env var (osx)
A library may be 'not found' even if the file exists:
* library is not compatible (different compiler/bitness)
* the dependencies are not found
)
Tried 'E:\casadi-windows-matlabR2016a-v3.5.1' :
Error code (WIN32): 126
Tried '' :
Error code (WIN32): 126
Tried '.' :
Error code (WIN32): 126") [.../casadi/core/plugin_interface.hpp:171]
Error using casadi.Opti/solve (line 253)
Error in Opti::solve [OptiNode] at .../casadi/core/optistack.cpp:159:
.../casadi/core/plugin_interface.hpp:417: Plugin 'nlpsol' is not found.