Summary
- */!\ API breaking change /!*
ProblemandSolverare 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/dvipsare no longer required for building the documentation. A minimal MathJax will be bundled instead. This explains the larger tarballs.- Minor fixes:
- Fix
NumericQuadraticFunctionhessian, - Fix some alignment issues for 32-bit systems,
- Fix
updateSparseBlockhelper function, - Fix
CachedFunction.
- Fix
- Clarify usage of Lagrange multipliers vector λ in
Resultstructure. - Add new
SolverCallbackclass to be used with theMultiplexer. - Improve printing for several functions.
- Add
jacobian(x)andconstraintsOutputSize()methods toProblem. - Add support for precompiled templates of matrix types (Dense/Sparse).
Migration from 3.1 to 3.2
ProblemandSolverwere 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
Problemconstructor 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.