Changes v1.8.0 to v1.9.0

Joel Andersson edited this page Apr 2, 2014 · 1 revision

New interfaces

  • An interface to SNOPT was created
  • The interface to OOQP has been rewritten and should now handle equality constraints much more efficiently.
  • The Worhp interface was updated to version 1.6.1

Updated documentation

  • The user guide as undergone a major update.
  • The API docs come in two flavors now public and internal and should be much easier to read and search.

Major syntax changes to CasADi (#554, #983, #982,#994,#380,#995,#1024,#1036)

CasADi has undergone a major update when it comes to syntax. While we know that this is not unproblematic for existing users, we believe that it is necessary for future maintainability of the project and making CasADi more accessible to new users. The most important of these changes is a transition from row-major to column-major storage of all sparse matrices of CasADi. While this probably has a limited impact on existing user code, it affects almost every core class of CasADi. Concrete changes that can affect user code include:

  • CasADi::CRSSparsity, which holds the reference-counted sparsity patterns, has been replaced by the class CasADi::Sparsity with a similar, but not entirely equivalent syntax.
  • Element access (i.e. A[i]) is now column-major
  • Reshape now works as in Matlab, consistent with the column major order, i.e. old_reshape(A,n,m) = new_reshape(A.T,m,n).T
  • LinearSolver now solves mul(A,x) = B or mul(A.T,x) = B instead of the weird old mul(x,A) = B or mul(x,A.T) = B
  • vec(X) is now the same as reshape(X,n,1) and not vec(X.T,n,1). flatten(X) has been removed.
  • The "natural" way to represent a symmetric matrix is to store the upper triangular part, not the lower triangular part as earlier.
  • The fast way of building up a matrix element-by-element is to add them column-by-column, not row-by-row as earlier.
  • The class used to be called SX corresponding to a symbolic scalar has been renamed SXElement. It is mainly intended to be an internal class. The class which used to be called SXMatrix is now called SX.
  • The way to create symbolic primitives is via the static function "sym", e.g. SX::sym("x"), MX::sym("x") in C++ and SX.sym("x"), MX.sym("x") in Python, replacing ssym("x"), msym("x").
  • The default constructor of MX, i.e. MX(), now returns a 0-by-0 matrix just like e.g. has done SX() since earlier. MX can no longer be "null".
  • To create a sparse matrix from vectors in sparse triplet form, use SX.triplet(rows,columns,nonzeros).
  • Use MATLAB/OCTAVE like syntax for creating new matrices, e.g. MX.sparse(nrow,ncol) instead of MX(nrow,ncol) and MX.zeros(nrow,ncol) instead of MX(nrow,ncol,0).
  • Sparsity patterns are created via static creator functions, e.g. Sparsity.dense(nrow,ncol) instead of sp_dense(nrow,ncol).
  • All the queries for checking if a matrix has a particular property are now prefixed with "is" e.g. my_matrix.isDense() instead of my_matrix.dense(), my_matrix.isVector() instead of my_matrix.vector() etc.
  • Transposing is now done using transpose(A) or A.T in Python and transpose(A) or A.T() in C++.
  • FX::call and FX::callDerivative have received the extra boolean arguments "always_inline" and "never_inline". Both are false by default. To achieve the old FX::eval (now deprecated), you can set the always_inline argument to true. SX arguments are always inlined since function calls are not supported in the graph so the "always_inline" argument is ignored. This syntax will also allow future versions of CasADi to decide when to inline functions and when not.
  • Evaluation with directional derivatives is now handled by the separate function FX::callDerivative
  • Parallel evaluation (still experimental) is handled by the separate function FX::callParallel
  • The output of the Simulator class has been transposed. It is now number of states-by-number of time points. The output of ControlSimulator, as wel as its control input has been transposed.
  • tools.structure repeated and matrix_repeated have been transposed.
  • The functions var, der, highest and binding used in connection with the SymbolicOCP (Modelica) framework now return an SX instance instead of a vector of symbolic scalars (now SXElement).
  • Non-zero access and assignment for matrices is now done using the syntax A.nz[i] instead of A[i] in Python and A{i} instead of A(i) in Octave. The syntax remains unchanged in C++, A[i]. As before, element access and assignment is done using the syntax A[i,j] in Python, A(i,j) in Octave and A(i,j) C++.
  • The SymbolicOCP class, which can be used to import optimal control problems from Modelica, has been refactored grounds up.
  • making a matrix dense is now done by dense instead of full or makeDense, making a matrix sparse is now done by sparse instead makeSparse.
  • The FX class, which is a base class for function objects in CasADi, has been renamed Function. Note that this affects the paths for the derived classes, e.g. the Integrator class is now located in "symbolic/function/integrator_internal.hpp" instead of "symbolic/fx/integrator_internal.hpp".