giaf / hpmpc

Library for High-Performance implementation of solvers for MPC.
GNU Lesser General Public License v2.1
53 stars 34 forks source link

Soft constraints #27

Open ggleizer opened 7 years ago

ggleizer commented 7 years ago

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.

giaf commented 7 years ago

Hey Gabriel,

indeed the solver for soft constraints has not been maintained in a while. I worked a little on it a couple of months ago but there are still major changes to be done and since then I hadn't the time to finish. At the moment I have other priorities, so I can't tell you when I will finalize that.

ggleizer commented 7 years ago

Hey Gianluca,

I'm willing to spend some time to fix the box soft constraint IP solver. Not sure if I'll be able to do so, but I'l try... Would you have any directions E.g., does it seem to be a bug or is it a fundamental issue? I have your thesis as reference.

Thanks! Gabriel.

giaf commented 7 years ago

Hey Gabriel,

thanks for your proposal of helping!

The current state is: there is a buggy version not using BLASFEO (it should be only a matter of finish to debug, I was doing that some time ago but then I moved to other work), while the version using BLASFEO is not implemented at all. You may manage to fix the non-BLASFEO version, but writing from scratch the BLASFEO version is something I would discourage.

At the moment any active development in HPMPC is in pause since we will discuss about its future direction once everyone is back after Easter holidays. I'll be back with more news at that point.

Gianluca