Tips
Handling Inquality Constraint
Assume we have an inequality constraint G(x)\leq 0, it can be transferred into G(x)= v with v\leq 0. Here are several methods dealing with inequality constraint:
-
Interior point method
- Barrier function, e.g., logarithmic: -\gamma\text{log}(-v), \gamma is a free parameter.
- Soft barrier function, e.g., Kreisselmeier-Steinhauser (KS) function: \beta\text{log}(1+e^{\gamma v}).
-
To equality constraint: v+d^2 = 0, d is a slack variable.
Solving the Very First OCP
In most of the cases, the very first OCP can be solved offline and its solution can be used as warm start. In solving the very first OCP offline, you can start with a mild parameter and then gradually change it to the parameter you want.
Degree of Parallelism (DoP)
DoP
is a parameter to specify the number of pieces to split the OCP along the prediction horizon for parallel computing. In general, a faster rate of convergence can be achieved by choosing a smaller DoP
. In the case of DoP=1
, a full step Newton or Gauss-Newton iteration (depending on the Hessian approximation method) is performed.
Meanwhile, when you want to generate serial code without any parallel computing, you can set DoP
to 1 and edit Timer.m
to specify your own timer function (the default is omp_get_wtime
).
Tuning
- Specify the tuning parameters such as the weighting matrices as parameters so that they can be tuned without re-generating the OCP.