This replaces the broken CERES_VERSION and CERES_ABI_VERSION
defines with a different set, including integer versions for
MAJOR/MINOR/etc.
This also adds the Ceres version to Solver::FullReport().
Example report from powell:
Ceres Solver v1.10.0 Solve Report
----------------------------------
Original Reduced
Parameter blocks 4 4
Parameters 4 4
Residual blocks 4 4
Residual 4 4
Minimizer TRUST_REGION
Dense linear algebra library EIGEN
Trust region strategy LEVENBERG_MARQUARDT
Given Used
Linear solver DENSE_QR DENSE_QR
Threads 1 1
Linear solver threads 1 1
Cost:
Initial 1.075000e+02
Final 1.791438e-14
Change 1.075000e+02
Minimizer iterations 14
Successful steps 14
Unsuccessful steps 0
Time (in seconds):
Preprocessor 0.001
Residual evaluation 0.000
Jacobian evaluation 0.000
Linear solver 0.000
Minimizer 0.001
Postprocessor 0.000
Total 0.003
Change-Id: I5bf0e8023693e9195276b1f1e881b13121ba1196
Termination: CONVERGENCE (Gradient tolerance reached. Gradient max norm: 3.642190e-11 <= 1.000000e-10)
Move
ParameterBlocksAreFinite
IsBoundsConstrained
IsFeasible
RemoveFixedBlocks
IsParameterBlockSetIndependent
CreateJacobianBlockSparsity
from being static methods in SolverImpl to member functions
in the Program class.
Change-Id: I80fa4a429a716ea4371ad6c67864adad438e1553
1. Merge TrustRegionLoggingCallback and LineSearchLoggingCallback
into a single callback.
2. Move the callbacks into callback.h
3. Update SolverImpl to use the new callbacks.
Change-Id: I9e82173cf2b828d023d96c57d1cba17f4832aeae
This allows checking for the availability of CAMD without depending
on a preprocessor symbol, which can be the source of subtle bugs
if the file defining that symbol was not included.
Change-Id: I6f1ef91a20baeecf68e8dd467ebe707dde8c5f79
1. Add the ability to bulk remove elements.
2. Add accessor for elements_to_group.
3. Early exit in Remove if there are no elements.
Change-Id: I3df1f00de05338a42e9907423b674469a022d3bc
Do not propagate 3d party libs through
IMPORTED_LINK_INTERFACE_LIBRARIES_[DEBUG/RELEASE] mechanism
when building shared libraries. SuiteSparse, lapack & co
are considered private. Glog still gets propagated since
it is part of the public interface. See documentation of
TARGET_LINK_LIBRARIES().
Change-Id: If0563b0c705b102876f5190e9a86694d10f79283
- Previously we passed all compile options to Ceres via add_definitions
in CMake. This was fine for private definitions (used only by Ceres)
but required additional work for public definitions to ensure they
were correctly propagated to clients via CMake using
target_compile_definitions() (>= 2.8.11) or add_definitions().
- A drawback to these approaches is that they did not work for chained
dependencies on Ceres, as in if in the users project B <- A <- Ceres,
then although the required Ceres public compile definitions would
be used when compiling A, they would not be propagated to B.
- This patch replaces the addition of compile definitions via
add_definitions() with an autogenerated config.h header which
is installed with Ceres and defines all of the enabled Ceres compile
options.
- This removes the need for the user to propagate any compile
definitions in their projects, and additionally allows post-install
inspect of the options with which Ceres was compiled.
Change-Id: Idbdb6abdad0eb31e7540370e301afe87a07f2260
Problems that do not use bounds do not have to pay the
price of storing bounds constraints.
Also replace the raw pointer access to the upper and
lower bounds arrays with accessors which hides the
lazy initialization from the user.
Change-Id: I0325a35de9c29f853559f891e32e7c777686e537
- Previously all Ceres compile definitions were private to Ceres, that
is they were not exported to users via the CMake export mechanism.
- Now that we use compile definitions in public (installed) Ceres
headers, we need to export the Ceres compile definitions.
- If we did not do this, then the client's code 'see's' a different
version of the Ceres headers to those which were in fact compiled,
or in the case of shared_ptr, may not find the required header.
- This patch makes use of the new, in CMake 2.8.11, function:
target_compile_definitions() to export all of the Ceres compile
definitions using CMake's export functionality.
- For CMake versions < 2.8.11, we have to use the blunter instrument of
calling add_definitions() in CeresConfig.cmake (invoked by a call to
find_package(Ceres)). This is messy because it ends up adding the
Ceres compile definitions to any target declared in the user's code
after the call to find_package(Ceres). Although this should do no
harm as all of our defines are prefaced with CERES_, so any
unintentional name clashes are unlikely.
Change-Id: I5dea80949190eaf4fb08ea4ac568ce28c32dd4e0
Solver::Summary::message was not being updated when the solver
terminated because of a user's iteration callback indicating
success or failure.
Thanks to Sergey Sharybin for reporting this.
Change-Id: I27e6e5eed086920ddf765461b0159417ac79d7b3
The standard sparse normal Cholesky solver assumes a fixed
sparsity pattern which is useful for a large number of problems
presented to Ceres. However, some problems are symbolically dense
but numerically sparse i.e. each residual is a function of a
large number of parameters but at any given state the residual
only depends on a sparse subset of them. For these class of
problems it is faster to re-analyse the sparsity pattern of the
jacobian at each iteration of the non-linear optimisation instead
of including all of the zero entries in the step computation.
The proposed solution adds the dynamic_sparsity option which can
be used with SPARSE_NORMAL_CHOLESKY. A
DynamicCompressedRowSparseMatrix type (which extends
CompressedRowSparseMatrix) has been introduced which allows
dynamic addition and removal of elements. A Finalize method is
provided which then consolidates the matrix so that it can be
used in place of a regular CompressedRowSparseMatrix. An
associated jacobian writer has also been provided.
Changes that were required to make this extension were adding the
SetMaxNumNonZeros method to CompressedRowSparseMatrix and adding
a JacobianFinalizer template parameter to the ProgramEvaluator.
Change-Id: Ia5a8a9523fdae8d5b027bc35e70b4611ec2a8d01
Solver::Options::linear_solver_ordering and
Solver::Options::inner_iteration_ordering
were bare pointers even though Solver::Options took ownership of these
objects.
This lead to buggy user code and the inability to copy Solver::Options
objects around.
With this change, these naked pointers have been replaced by a
shared_ptr object which will managed the lifetime of these objects. This
also leads to simplification of the lifetime handling of these objects
inside the solver.
The Android.mk and Application.mk files have also been updated
to use a newer NDK revision which ships with LLVM's libc++.
Change-Id: I25161fb3ddf737be0b3e5dfd8e7a0039b22548cd
and SchurEliminator.
Also update the comment inside generate_partitioned_matrix_view_specializations.py
Change-Id: I99a7ab4256091b1da48553da3076e5996a5757ed
- Breaking change: Problem::Options::enable_fast_parameter_block_removal
is now Problem::Options::enable_fast_removal, as it now controls
the behaviour for both parameter and residual blocks.
- Previously we did not check that the specified residual block to
remove in RemoveResidualBlock actually represented a valid residual
for the problem.
- This meant that Ceres would die unexpectedly if the user passed an
uninitialised residual_block, or more likely attempted to remove a
residual block that had already been removed automatically after
the user removed a parameter block upon on which it was dependent.
- RemoveResidualBlock now verifies the validity of the given
residual_block to remove. Either by checking against a hash set of
all residuals maintained in ProblemImpl iff enable_fast_removal
is enabled. Or by a full scan of the residual blocks if not.
Change-Id: I9ab178e2f68a74135f0a8e20905b16405c77a62b
- Previously AutoDiffLocalParameterization would internally instantiate
a functor instance whenever one was required. This prohibits the
user passing arguments to the constructor of the functor.
- Now AutoDiffLocalParameterization can take over ownership of an
allocated functor which the user created. This mimics the behaviour
of AutoDiffCostFunction.
Change-Id: I264e1face44ca5d5e71cc20c77cc7654d3f74cc0
There were a few unused variables. The Clang GoldPlugin no longer supports
the -O4 flag; it is now equivalent to -O3 -flto, which is backwards
compatible.
Change-Id: I90a8cfe88d90871de6cf3a175b2ced2806e3fd8e
Change the order in which IterationSummary objects are
added to Solver::Summary and when the convergence tests
are done.
Previously there was a bug which prevented the iteration summary
from carrying the correct cost of the current state of the
optimization problem as the convergence test triggers before
the cost can be updated.
Thanks to Thad Hughes for reporting this.
Change-Id: Iba0dbb4cb30c9ec79fbc72ec5cf4602b2a0c207b
Now that the trust region minimizer depends on the line search
minimizer, conditional compilation of the line search minimizer
will lead to build breakages, so this option is now not available.
It is not expected to have as significant impact on users as the
amount of code in the line search minimization algorithm is
rather small to begin with.
Change-Id: I2aa6b6e6e3931b6428dbda654f14faf1ac6dd130
1. Reflect the demise of the various FOO_TOLERANCE convergence
types.
2. Update the documentation for Solver::Options::gradient_tolerance.
Change-Id: I6bd11d260d6f8a3222b6a41a62dc4943ec8fcfbf
Add LineSearch::Options::is_silent which allows the user to turn
off all LOG(WARNING) logging off.
This is useful when calling LineSearch from the TrustRegionMinimizer
where the verbosity of the line search is of no use.
Change-Id: I4f1855e98f3cf3c3659d92b54586ff88d64e5ebe
The original implementation for computing the norm of the gradient was
gradient_norm = norm(gradient)
when the gradient vector lies in the same space as the parameter
vector, this value is meaningful. When there is a local parameterization
involved, interpreting this value and diagnosing convergence using it
is hard.
Further, this expression does not respect the bounds constraints
on the parmeters. Measuring the norm of the gradient only makes
sense when the optimization being performed is unconstrained.
A better solution, used by LANCELOT is the expression
gradient_norm = norm(x - P(x - gradient))
Here, P is the projection operator onto the bounds constraints.
x - gradient is computed by computing Plus(x, -gradient), thus the
actual expression becomes
gradient_norm = norm(x - P(Plus(x, -gradient)));
Which in the case where there are no bounds constraints, and there
are no local parameterizations, reduces to the usual Euclidean
expression from above, since
Plus(x, -gradient) = x - gradient
and P(x - gradient) = x - gradient.
This change implements this change. Further, the convergence
test using the gradient tolerance now uses an absolute measure
rather than a relative measure. This is a forward looking change
as we start implementing the Augmented Lagrangian solver.
Last but not the least, various "Terminating: Foo" messages
have been changed so that "Terminating: " is logged but is
not part of the Solver::Summary::message string as it is
pointless.
Change-Id: I943146f71a1da47c8c7592986039b4112781b99b
These two methods allow the user to associate upper and lower bounds
with individual parameters inside parameter blocks.
Change-Id: I68dc37f20b64408da510ba06b89a4f08df54ddad
1. Detect if the problem is bounds constrained.
2. Detect if the problem is infeasible due to
constant infeasible parameter blocks.
3. Simplify the interface to TrustRegionMinimize and
LineSearchMinimize. In the process fix a bug related
to early return and the way user state pointers
were being dealt with in parameter blocks.
Change-Id: Ie7e70862029d3e0734636882c21ea594516119d1
Add setters and getters for lower and upper bounds.
Generalize the Plus operation to include projection onto the
hypercube implied by the bounds.
Change-Id: I1e4028a9886c4064f31bbc5b7c22b0341a56c15d
If enabled, the TrustRegionMinimizer can now further improve the
quality of the step with a Armijo line search.
This is the first step towards adding support for bounds on
variables.
Change-Id: I453b42853cfa6ca4f75812900c13d286a473c2df
cholmod_lhs was not being freed before
the SolveImpl function returned if the
underlying linear solver failed.
Change-Id: Id45db4f69a2821e43dc00fc975718584d426f44d