GithubHelp home page GithubHelp logo

C++ implementation question about mpcc HOT 4 CLOSED

alexliniger avatar alexliniger commented on July 18, 2024 3
C++ implementation question

from mpcc.

Comments (4)

alexliniger avatar alexliniger commented on July 18, 2024 2

There are two standard ways to solve NLPs locally, nonlinear interior point methods (NIP) and sequential quadratic programming (SQP). Both methods do linearize the optimization problem at some point, NIP methods linearize the KKT system at every step, whereas SQP methods approximate the NLP as a QP at every outer (SQP) iteration.
In the AMZ paper we use FORCES PRO which is a fast NIP method (basically IPOPT tailored for MPC), and here I use a simple SQP method.
What I did in "Optimization‐based autonomous racing of 1:43 scale RC cars" is often called real time iteration (RTI), where you do SQP but you only solve one QP instead of solving the sequence of QPs until convergence.
The advantage of RTI is that it is really quick, so in this repo (actually both matlab and C++) I use a SQP method with 2 or 3 iterations, which gives better results than RTI, but is still about twice as fast as FORCES PRO.
Best,
Alex

from mpcc.

alexliniger avatar alexliniger commented on July 18, 2024 2

Sorry for not replaying, I am happy that you found the solution yourself
I assume some of the issue come up due to how I formulated the cost here.
You can also think about it as j(x,u) = q_l e_lag(x)^2 + q_c e_cont(x) - q_theta theta + cost(u) + cost(Delta u)

Best,
Alex

from mpcc.

Chachay avatar Chachay commented on July 18, 2024 1

Hi, @alexliniger, could you elaborate on how you applied SQP?
I also think about applying MPC with parameterized reference (theta) in my project.

My question comes from the gradients of the objective function.

I refer to followings to understand SQP

  1. Sequential quadratic programming - optimization
  2. From linear to nonlinear MPC: bridging the gap via the real-time iteration

First, your formulation of Nonlinear MPC problem is following without regularization.

2020-04-08 (2)

M & P are constant matrices to express constraints.

And with applying the idea of 3.1 of [2]

2020-04-08 (4)

3.1 of [2] applies the newton method calculating delta x and delta u, but at your case directly calculating x because of x = x^{guess} + \delta x. and here normalization of the problem makes the newton method easier.
And constraints come back to the simple original form

2020-04-08 (5)

Because f() is not a simple form, the approximation of Hessian to
'Q' cannot work (I am not sure) also other parts becomes a bit complex form, but your C++ code and Matlab code handles much simpler objective function as taking care of theta^{ref} as constants.

This part made me confused. I'm sorry if this is just my basic calculus problem.

[Edit]
I figured out the Hessian and the gradient. Now I'm trying to understand the part of \Delta x -> x in the objective function.

2020-04-12 (2)

from mpcc.

LiJiangnanBit avatar LiJiangnanBit commented on July 18, 2024

Thanks for your reply! I'll take a look at the code.

from mpcc.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.