Commit Graph

168 Commits

Author SHA1 Message Date
Sameer Agarwal 3e8d192f28 Add a rough implementation of LBFGS.
Change-Id: I2bc816adfe0c02773a23035ea31de3cddc1322a4
2012-11-28 18:26:41 -08:00
Sameer Agarwal f4d0164607 Add a line search based minimizer.
1. Add a line search based minimization loop.
2. Currently this loop supports steepest descent and three
   kinds of non-linear conjugate gradient algorithms.
3. Update SolverImpl to talk to LineSearchMinimizer.
4. Update IterationCallback to carry information about
   line search.
5. Update LineSearch to take the initial point as input,
   saving on one function evaluation.
6. Updates to the external API.

Change-Id: I901a0e89fc948451ab34c743e70f3dec57c9405e
2012-11-28 16:18:01 -08:00
Sameer Agarwal 0b5df70e33 Bug fix in solver_impl_test.
One of the tests CreateLinearSolverNoSuiteSparse, fails
when no sparse backend is present. This was a failure
in running tests with all possible sparse backend settings.

Thanks to Sebastian Fabbro for reporting this.

Change-Id: I0ab98632ae7dd33f18d67cb9f490e74c034ce03d
2012-11-28 15:53:07 -08:00
Sameer Agarwal 86f6ea68b8 Fix a variadic evaluation bug in AutoDiff.
Thanks to Julien Michot for reporting.

Change-Id: I322cd177e85c18ba3fbee56149696d4140f79c68
2012-11-28 15:13:21 -08:00
Sameer Agarwal 9895a4f50c Update comment in trust_region_minimizer.h.
Update comment to better reflect the Minimizer API.

Change-Id: Icca1d41fdea1f8dacde2e1af3239486820ef2b7f
2012-11-26 16:48:32 -08:00
Sameer Agarwal 1d11be9d38 Armijo line search.
An interface for line search and an initial implementation of
Armijo line search with and without interpolation.

Change-Id: I234da141be36172819a6df87ce5625aa8b58ed47
2012-11-26 12:14:22 -08:00
Sameer Agarwal 31432aeec4 Fix an initialization bug in ProgramEvaluator.
The buffers used to store the per thread value of the gradient
were not set to zero at the beginning of each call to evaluate.

Change-Id: I9c8afea54a4e2e0b805164025da3023166a309af
2012-11-25 18:36:04 -08:00
Sameer Agarwal e7295c246b Add polynomial interpolation and minimization.
1. polynomial_solver* -> polynomial*.
2. Added support for differentiating polynomials.
2. Added support for interpolating polynomials from function
   values and gradients.
3. Added support for minimizing polynomials by solving
   for the roots of their derivatives in an interval.
4. Added support for finding the minimum of a polynomial
   that interpolates function values and gradients in
   an interval.

Change-Id: Id7e6764ad4db09c3edd60f1378c7f50f20dd08dc
2012-11-25 16:53:05 -08:00
Sameer Agarwal 747845fc82 Add the GradientChecker.
The GradientChecker is a utility class written by
William Rucklidge that can be used to check that the
derivatives returned by a cost function match those
returned by numerically differentiating the residuals
returned by the same cost function.

This is useful when developing CostFunction objects
and testing them before plugging them into an optimization
problem.

Change-Id: Ic60f859b48b6246406448555d25556784e097b81
2012-11-08 10:40:18 -08:00
Sameer Agarwal bdabc29d90 Change LOG(ERROR) to LOG(WARNING) in schur_complement_solver.cc
Change-Id: Ie248989b230ec2357a00a15ef35087e85682315c
2012-11-07 11:26:32 -08:00
Sameer Agarwal d779b04eb4 Sort filenames in internal/CMakeList.txt
Change-Id: Id86f998ae0a1261e62d940e8e664102ff7526ec3
2012-11-02 11:05:42 -07:00
Sameer Agarwal 3dadfb78b7 static cast to force Eigen::Index to long conversion.
Change-Id: I11945c455eb3fef9bfb952f5a30d657542fbccae
2012-10-30 17:41:50 -07:00
Fisher 12626e8cba Add support for up to 10 parameters in Problem
Following the last commit, which extends the number of parameters blocks autodiff can accept, the interface of Problem::AddResidualBlock is extended to accept up to 10 parameter blocks.

Change-Id: I162c3d1b1868fdda32c1522d57e9a211a9c02f90
2012-10-21 14:26:30 -04:00
Keir Mierle f1e67cc90b Add support for up to 10 parameters in autodiff.
Supporting only 6 parameters in autodiff was enough for most
cases, but 6 was not always sufficient. This extends the
current implementation to work with up to 10 parameters.
This also increases the number of parameters supported in
SizedCostFunction to 10.

Change-Id: Ic783602f93e6ddf4af24fa34eff37c0a4b775dc1
2012-10-19 11:00:46 -07:00
Sameer Agarwal a45046a4e2 Remove verbose logging from DenseQRSolver
Change-Id: I37999657443697440afc6908ed3c05911419314d
2012-10-15 17:59:23 -07:00
Keir Mierle 27dd0d3307 Fix the Ceres Android NDK build.
The NDK build of Ceres was broken; this fixes it and also
disables a useless warning that shows up in NDK 8b.

Change-Id: I54cfb3de7ccea4a0864385f7ffdb55d8f3431f34
2012-10-15 13:54:10 -07:00
Sameer Agarwal 67a107b2f4 SolverImpl refactoring.
Improve the logic with which various corner cases like
constant program, failures to evaluate initial and final
cost etc are handled.

Change-Id: Id43d45ebe46b65918909d47201d6fb7b89ebbd57
2012-10-11 17:44:23 -07:00
Sameer Agarwal 66fcc7d5da Fix a memory leak in trust_region_minimizer_test.cc
Change-Id: I46dff90485a8106c154cbd72493acda64971e94a
2012-10-08 09:54:16 -07:00
Sameer Agarwal 76e8bb532c Add a missing OpenMP ifdef to coordinate_descent_minimizer.cc
Change-Id: I4eb74ab0cba86eee65a0ccfa2373c8e108f53758
2012-10-08 09:12:52 -07:00
Sameer Agarwal 68b32a941c ordering -> linear_solver_ordering.
Change-Id: If4af72da90725db2a2d4f397f4cb671c2e863a98
2012-10-06 23:16:04 -07:00
Sameer Agarwal c1ffad6009 Schur ordering was operating on the original program.
Thanks to Ricardo Martin for reporting this.

Change-Id: Iacf44f672287e4d76633878c7051694a39b3056f
2012-10-05 16:58:32 -07:00
Sameer Agarwal e3c5570b05 Petter's MSVC fixes
Change-Id: I13a2f6e1046136ce240c22dadd1b7547f56d4493
2012-10-05 14:08:42 -07:00
Sameer Agarwal 5bfa7e4e8f Improve the performance of DenseQRSolver
1. Reduce amount of reallocations.

Change-Id: I91b17c781ae94ed12014d647f0162cfce4f6ed7b
2012-10-05 13:59:51 -07:00
Sameer Agarwal ba8d967f8c Generalization of the inner iterations algorithm.
Add automatic recursive independent set decomposition.
Clean up the naming and the API for inner iterations.

Change-Id: I3d7d6babb9756842d7367e14b7279d2df98fb724
2012-10-05 08:35:53 -07:00
Sameer Agarwal 2c94eed50f Move from Ordering to ParameterBlockOrdering.
Change-Id: I9320afff13ee62be407c725f42f41a18f537bcc1
2012-10-01 16:47:26 -07:00
Sameer Agarwal b6da9c794e OrderedGroups implementation.
This generalizes the Ordering object and paves the path for a more
general inner iteration API.

Change-Id: I6efce5f999c2bfab5f90a8a18e21140581f207cd
2012-10-01 15:23:28 -07:00
Sameer Agarwal a693c8bfd5 Remove redundant broken test.
Change-Id: Ibf8dbd477842b1bc11d2294d8edad67140893602
2012-09-26 16:42:00 -07:00
Sameer Agarwal 9123e2f624 An implementation of Ruhe & Wedin's Algorithm II.
A non-linear generalization of Ruhe & Wedin's algorithm
for separable non-linear least squares problem. It is implemented
as coordinate descent on an independent subset of the parameter
blocks at the end of every successful Newton step. The resulting
algorithm has much improved convergence at the cost of some
execution time.

Change-Id: I8fdc5edbd0ba1e702c9658b98041b2c2ae705402
2012-09-25 11:13:39 -07:00
Sameer Agarwal b23fd4e667 Add IterationSummary::step_is_nonmonotonic.
So that IterationCallback objects know the kind of step that they
are dealing with.

Change-Id: I7782b211af882bd7b67307c3c23d8021cb56e8ab
2012-09-25 10:14:08 -07:00
Sameer Agarwal d3ace02d13 Fix a bunch of compiler warnings.
Change-Id: Iacc3beff295d4f4f6334ef598b10c73de509b3c0
2012-09-23 18:19:49 -07:00
Sameer Agarwal 1dc544adb0 Remove ParameterBlock::state_offset as it is not used.
Change-Id: I3d6fbe333dde73ceb4c6c5e01460aa997883889f
2012-09-19 12:11:55 -07:00
Petter Strandmark dd1a276561 Fix of compilation errors in solver_impl.cc
They appear is SuiteSparse is disabled.

Change-Id: I2c2e9dac49afe81ddb810b546135621b325c2c97
2012-09-19 13:01:02 +02:00
Keir Mierle 97ca0fbbea Compile with warnings on Unix.
The warnings got disabled at some point; this re-enables some of them, and
fixes some of the warnings.

Change-Id: I290a4fdfad18cea85e9177ba57744d97b6856bb2
2012-09-18 17:07:18 -07:00
Sameer Agarwal c014997cdb Replace EXPECT/ASSERT_DEATH with EXPECT_DEATH_IF_SUPPORTED.
This allows us to remove all the WIN32/MSVC ifdefs in the
various tests.

http://code.google.com/p/ceres-solver/issues/detail?id=55

Change-Id: Ida053e44ea84b6915758318403f3db05325f1226
2012-09-18 13:55:18 -07:00
Sameer Agarwal 65625f7782 Solver::Options::ordering* are dead.
Remove the old ordering API, and modify solver_impl.cc
to use the new API everywhere.

In the process also clean up the linear solver instantion
logic in solver_impl.cc a bit too.

Change-Id: Ia66898abc7f622070b184b21fce8cc6140c4cebf
2012-09-17 15:41:10 -07:00
Sameer Agarwal 0c52f1e29b LinearSolver::Options::num_eliminate_blocks is dead.
Replaced with LinearSolver::Options::elimination_groups.

Change-Id: I7c07542ec19279a35ddf6da498d417a79395c77f
2012-09-17 11:40:03 -07:00
Sameer Agarwal 91c9bfee33 Start of the new ordering API.
Change-Id: I37b0f39011f590d54962ad3e1da1f42712008f82
2012-09-17 11:21:22 -07:00
Petter Strandmark 76533b3c46 Adding high-precision timer using OpenMP
(fixes issue #41)

Change-Id: Ieffe5f789a591c1e766ae619b75f0d7f6cd890f4
2012-09-13 18:10:57 -07:00
Sameer Agarwal fba3844b43 Fix two segaults in test code.
Thanks to Sergey Popov for reporting this.

Change-Id: Ib5124a90fc42ae9d7295c04d51a5dd8d16250504
2012-09-10 09:28:12 -07:00
Petter Strandmark ab8e2dc453 EigenSolver takes a bool
Change-Id: Ie197b4530adf23cee799b369ab96b0afafb9ead3
2012-09-10 08:46:22 -07:00
Petter Strandmark eb38e74267 Inclusion guard fix
Change-Id: Idf6245bb76c86817e332aca4393c9db86a1e2059
2012-09-08 13:53:24 -07:00
Sameer Agarwal 14ee795aea Add ability to query available linear algebra backend.
Change-Id: Ide349a04a69b1a377ea789b355e00b210ec792ba
2012-09-06 11:09:04 -07:00
Sameer Agarwal 08f0d4dee0 Stricter checking of Solver::Option::num_eliminate_blocks.
Change-Id: Ic8e61cedbe0eb028a32c89f77dc6b838d3a8caa4
2012-09-05 14:06:22 -07:00
Sameer Agarwal b329e58537 Numerically robust computation of model_cost_change.
Change-Id: I421df17bab3bfdf782d95285cf352ed37675d835
2012-09-05 11:14:09 -07:00
Sameer Agarwal cbae856193 Various cleanups to nist.cc.
More flexible testing.
Read and parse the certified cost value from the data file.
Remove the ugly hack for computing the certified cost.
Refactored the flags parsing logic

Change-Id: I8f2e6be183b758b2453302fcdc6696bfa0db5eb8
2012-09-04 15:39:18 -07:00
Sameer Agarwal a406b17d66 Fix the jacobian scaling bug.
If the norm of a column in the jacobian is near zero.
The jacobian scaling could in trying to avoid division
by zero actually make things much worse. It made it
appear that the column actually had mass when in fact
it did not.

This leads to inflated values for the parameters for
that column when we get some numerical garbage back
from the linear solver.

This should also address the case where users are setting
some columns to zero to hold some parameter constant.

The fix is a bit delicate, and frankly I am not
completely sure that it fixes the issue. But right now
I am quite certain that the current implementation is
better than what we had earlier. Whether this is the
best fix is not entirely certain.

To test the fix, I converted Arnaud Gelas' original
code which triggered this bug into a test case.

Change-Id: Idbbd8177269bdc06338e0f54410f93ddc127c8ca
2012-09-04 10:35:23 -07:00
Sameer Agarwal 552f9f85bb Various minor bug fixes to the solver logic.
1. CostFunction returning false is handled better.
If only the cost is being evaluated, it is possible to
use the false value as an infinite value signal/outside
a region of validity. This allows a weak form of constraint
handling. Useful for example in handling infinities.

2. Changed the way how the slop around zero when model_cost
is larger than the current cost. Relative instead of absolute
tolerances are used. The same logic is propagated how the
corresponding clamping of the model_cost is done.

3. Fixed a minor indexing bug in nist.cc.

4. Some minor logging fixes to nist.cc to make it more
compatible with the rest of ceres.

Together these changes, take the successful solve count from
41/54 to 46/54 and eliminate all NUMERICAL_FAILURE problems.

Change-Id: If94170ea4731af5b243805c0200963dd31aa94a7
2012-08-31 12:24:28 -07:00
Petter Strandmark 2d7176ad7c max_consecutive_nonmonotonic_steps should be int
Found via Visual Studio warning.

Change-Id: Id2cd7de562dfc8cd35df5d5f5220dd2d7350eb2c
2012-08-30 19:51:24 -07:00
Sameer Agarwal ea11704857 Basic harness for testing NIST problems.
Change-Id: I5baaa24dbf0506ceedf4a9be4ed17c84974d71a1
2012-08-30 13:48:40 -07:00
Sameer Agarwal 98bf14d2b9 Miscellaneous fixes.
Change-Id: I521e11f2d20bf24960bbc6b5dab4ec8bb1503d23
2012-08-30 10:26:44 -07:00