@bchretien bchretien released this Jan 7, 2016 · 210 commits to master since this release

Summary

  • */!\ API breaking change /!* Problem and Solver are now only templated on the matrix type. See the migration guide in the next section. Impact on end-user code is limited, the biggest changes happen in plugin codes.
  • latex/dvips are no longer required for building the documentation. A minimal MathJax will be bundled instead. This explains the larger tarballs.
  • Minor fixes:
    • Fix NumericQuadraticFunction hessian,
    • Fix some alignment issues for 32-bit systems,
    • Fix updateSparseBlock helper function,
    • Fix CachedFunction.
  • Clarify usage of Lagrange multipliers vector λ in Result structure.
  • Add new SolverCallback class to be used with the Multiplexer.
  • Improve printing for several functions.
  • Add jacobian(x) and constraintsOutputSize() methods to Problem.
  • Add support for precompiled templates of matrix types (Dense/Sparse).

Migration from 3.1 to 3.2

  • Problem and Solver were templated on the cost function and constraints types, for instance:
// Specify the solver type that will be used
typedef Solver<DifferentiableFunction, boost::mpl::vector<LinearFunction, DifferentiableFunction> > solver_t;
// Deduce the problem type, which is Problem<DifferentiableFunction, boost::mpl::vector<LinearFunction, DifferentiableFunction> >
typedef solver_t::problem_t problem_t;

Now, this is handled at runtime, and all that remains is the matrix type used:

// Specify the solver type that will be used
typedef Solver<EigenMatrixDense> solver_t;
// Deduce the problem type, which is Problem<EigenMatrixDense>
typedef solver_t::problem_t problem_t;
  • The following Problem constructor is now deprecated:
// Instantiate the cost function
CostFunction cost (param);

// Create problem
solver_t::problem_t pb (cost);

Instead, use the boost::shared_ptr version:

// Instantiate the cost function
boost::shared_ptr<CostFunction> f (new CostFunction (param));

// Create problem
solver_t::problem_t pb (cost);
  • Flags are now used to identify a function's "true" type at runtime. For instance:
// f is a (shared) pointer to a function, and we want to cast it to a LinearFunction
// if that is possible
LinearFunction* g = 0;
if (f->asType<LinearFunction> ())
{
  g = f->castInto<LinearFunction> ();
}

The implementation thus relies on a cheap static_cast rather than an expensive dynamic_cast. Note that castInto accepts a boolean parameter to enable the asType check internally, and throws if the cast is invalid.

Assets 6