Skip to content

Commit 53bea8b

Browse files
Core Solver - Add Ceres LMDER solver
"LMDER" stands for "Levenberg-Marquardt analyic DERivatives". This solver is intended to parallel the "cminpack_lmder", which has historically been the faster solver in mmSolver. We have not yet proven that "ceres_lmder" is always (or mostly) better than "cminpack_lmder", therefore the default has not been changed. This also turns off "use_nonmonotonic_steps", which I've tested and seems to produce worse results in simple cases. GitHub issue #174.
1 parent b5553ec commit 53bea8b

31 files changed

+736
-60
lines changed

INSTALL.md

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -106,17 +106,17 @@ for all users loading this module - if the module file is located on
106106
the network for multiple users changes to this file will affect all
107107
users.
108108

109-
| Name | Description |
110-
| -------------------------- | ------------------------------------------------------------------------------------------------------ |
111-
| MMSOLVER_LOAD_AT_STARTUP | Automatically load mmSolver plug-in at Maya start-up (values of '0' or '1'). |
112-
| MMSOLVER_CREATE_SHELF | Automatically create a Maya shelf at start-up (values of '0' or '1'). |
113-
| MMSOLVER_CREATE_MENU | Automatically create a Maya menu at start-up (values of '0' or '1'). |
114-
| MMSOLVER_CREATE_HOTKEY_SET | Automatically create a Maya hotkey set at start-up (values of '0' or '1'). |
115-
| MMSOLVER_VIEWPORT_MESSAGES | Enable or disable warnings and errors printed to the viewport (values of '0' or '1'). |
116-
| MMSOLVER_HELP_SOURCE | Prefer 'internet' or 'local' source of help? For users with internet restrictions set this to 'local'. |
117-
| MMSOLVER_DEFAULT_SOLVER | (Advanced) The default solver to use in mmSolver; 'cminpack_lmdif', 'cminpack_lmder' or 'ceres_lmdif'. |
118-
| MMSOLVER_DEBUG | (Advanced) Forces mmSolver to print out debug messages. Not for users, for use by developers only. |
119-
| MMSOLVER_LOCATION | Do not change this variable!!! |
109+
| Name | Description |
110+
|----------------------------|-----------------------------------------------------------------------------------------------------------------------|
111+
| MMSOLVER_LOAD_AT_STARTUP | Automatically load mmSolver plug-in at Maya start-up (values of '0' or '1'). |
112+
| MMSOLVER_CREATE_SHELF | Automatically create a Maya shelf at start-up (values of '0' or '1'). |
113+
| MMSOLVER_CREATE_MENU | Automatically create a Maya menu at start-up (values of '0' or '1'). |
114+
| MMSOLVER_CREATE_HOTKEY_SET | Automatically create a Maya hotkey set at start-up (values of '0' or '1'). |
115+
| MMSOLVER_VIEWPORT_MESSAGES | Enable or disable warnings and errors printed to the viewport (values of '0' or '1'). |
116+
| MMSOLVER_HELP_SOURCE | Prefer 'internet' or 'local' source of help? For users with internet restrictions set this to 'local'. |
117+
| MMSOLVER_DEFAULT_SOLVER | (Advanced) The default solver to use in mmSolver; 'cminpack_lmdif', 'cminpack_lmder', 'ceres_lmdif' or 'ceres_lmder'. |
118+
| MMSOLVER_DEBUG | (Advanced) Forces mmSolver to print out debug messages. Not for users, for use by developers only. |
119+
| MMSOLVER_LOCATION | Do not change this variable!!! |
120120

121121
# Install 3DEqualizer Files
122122

python/mmSolver/_api/constant.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,12 +147,14 @@
147147
SOLVER_TYPE_CMINPACK_LMDIF = 1
148148
SOLVER_TYPE_CMINPACK_LMDER = 2
149149
SOLVER_TYPE_CERES_LMDIF = 3
150+
SOLVER_TYPE_CERES_LMDER = 4
150151
SOLVER_TYPE_DEFAULT = SOLVER_TYPE_CMINPACK_LMDER
151152
SOLVER_TYPE_LIST = [
152153
# levmar is not included in this list because it is deprecated.
153154
SOLVER_TYPE_CMINPACK_LMDIF,
154155
SOLVER_TYPE_CMINPACK_LMDER,
155156
SOLVER_TYPE_CERES_LMDIF,
157+
SOLVER_TYPE_CERES_LMDER,
156158
]
157159

158160

python/mmSolver/api.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,7 @@
157157
SOLVER_TYPE_CMINPACK_LMDIF,
158158
SOLVER_TYPE_CMINPACK_LMDER,
159159
SOLVER_TYPE_CERES_LMDIF,
160+
SOLVER_TYPE_CERES_LMDER,
160161
SOLVER_TYPE_DEFAULT,
161162
SOLVER_TYPE_LIST,
162163
SCENE_GRAPH_MODE_AUTO,
@@ -308,6 +309,7 @@
308309
'SOLVER_TYPE_CMINPACK_LMDIF',
309310
'SOLVER_TYPE_CMINPACK_LMDER',
310311
'SOLVER_TYPE_CERES_LMDIF',
312+
'SOLVER_TYPE_CERES_LMDER',
311313
'SOLVER_TYPE_DEFAULT',
312314
'SOLVER_TYPE_LIST',
313315
'SCENE_GRAPH_MODE_AUTO',

python/mmSolver/tools/solver/constant.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -369,29 +369,34 @@
369369
SOLVER_TYPE_CMINPACK_LMDIF = mmapi_const.SOLVER_TYPE_CMINPACK_LMDIF
370370
SOLVER_TYPE_CMINPACK_LMDER = mmapi_const.SOLVER_TYPE_CMINPACK_LMDER
371371
SOLVER_TYPE_CERES_LMDIF = mmapi_const.SOLVER_TYPE_CERES_LMDIF
372+
SOLVER_TYPE_CERES_LMDER = mmapi_const.SOLVER_TYPE_CERES_LMDER
372373
SOLVER_TYPE_LIST = [
373374
SOLVER_TYPE_DEFAULT,
374375
SOLVER_TYPE_CMINPACK_LMDIF,
375376
SOLVER_TYPE_CMINPACK_LMDER,
376377
SOLVER_TYPE_CERES_LMDIF,
378+
SOLVER_TYPE_CERES_LMDER,
377379
]
378380

379381
SOLVER_TYPE_DEFAULT_LABEL = 'Default'
380382
SOLVER_TYPE_CMINPACK_LMDIF_LABEL = 'CMinpack LMDIF'
381383
SOLVER_TYPE_CMINPACK_LMDER_LABEL = 'CMinpack LMDER'
382384
SOLVER_TYPE_CERES_LMDIF_LABEL = 'Ceres LMDIF'
385+
SOLVER_TYPE_CERES_LMDER_LABEL = 'Ceres LMDER'
383386
SOLVER_TYPE_LABEL_LIST = [
384387
SOLVER_TYPE_DEFAULT_LABEL,
385388
SOLVER_TYPE_CMINPACK_LMDIF_LABEL,
386389
SOLVER_TYPE_CMINPACK_LMDER_LABEL,
387390
SOLVER_TYPE_CERES_LMDIF_LABEL,
391+
SOLVER_TYPE_CERES_LMDER_LABEL,
388392
]
389393

390394
SOLVER_TYPE_LABEL_VALUE_LIST = [
391395
(SOLVER_TYPE_DEFAULT_LABEL, SOLVER_TYPE_DEFAULT),
392396
(SOLVER_TYPE_CMINPACK_LMDIF_LABEL, SOLVER_TYPE_CMINPACK_LMDIF),
393397
(SOLVER_TYPE_CMINPACK_LMDER_LABEL, SOLVER_TYPE_CMINPACK_LMDER),
394398
(SOLVER_TYPE_CERES_LMDIF_LABEL, SOLVER_TYPE_CERES_LMDIF),
399+
(SOLVER_TYPE_CERES_LMDER_LABEL, SOLVER_TYPE_CERES_LMDER),
395400
]
396401

397402
# Hide the Solver Type mode in the UI.

src/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ set(CMAKE_MACOSX_RPATH 1)
2626
# Source
2727
set(SOURCE_FILES
2828
mmSolver/adjust/adjust_base.cpp
29+
mmSolver/adjust/adjust_ceres_lmder.cpp
2930
mmSolver/adjust/adjust_ceres_lmdif.cpp
3031
mmSolver/adjust/adjust_cminpack_base.cpp
3132
mmSolver/adjust/adjust_cminpack_lmder.cpp

src/mmSolver/adjust/adjust_base.cpp

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@
5656
#include <mmsolverlibs/debug.h>
5757

5858
// MM Solver
59+
#include "adjust_ceres_lmder.h"
5960
#include "adjust_ceres_lmdif.h"
6061
#include "adjust_cminpack_lmder.h"
6162
#include "adjust_cminpack_lmdif.h"
@@ -94,6 +95,10 @@ std::vector<SolverTypePair> getSolverTypes() {
9495
solverType.second = SOLVER_TYPE_CERES_LMDIF_NAME;
9596
solverTypes.push_back(solverType);
9697

98+
solverType.first = SOLVER_TYPE_CERES_LMDER;
99+
solverType.second = SOLVER_TYPE_CERES_LMDER_NAME;
100+
solverTypes.push_back(solverType);
101+
97102
return solverTypes;
98103
}
99104

@@ -125,7 +130,8 @@ SolverTypePair getSolverTypeDefault() {
125130
<< "Value may be "
126131
<< "\"" << SOLVER_TYPE_CMINPACK_LMDIF_NAME << "\", "
127132
<< "\"" << SOLVER_TYPE_CMINPACK_LMDER_NAME << "\", "
128-
<< "or \"" << SOLVER_TYPE_CERES_LMDIF_NAME << "\"; "
133+
<< "\"" << SOLVER_TYPE_CERES_LMDIF_NAME << "\", "
134+
<< "or \"" << SOLVER_TYPE_CERES_LMDER_NAME << "\"; "
129135
<< "; value=" << defaultSolver);
130136
}
131137
}
@@ -1188,6 +1194,10 @@ MStatus solveFrames(
11881194
solve_3d_ceres_lmdif(solverOptions, numberOfParameters, numberOfErrors,
11891195
out_paramList, out_errorList, paramWeightList,
11901196
userData, out_cmdResult.solverResult);
1197+
} else if (solverOptions.solverType == SOLVER_TYPE_CERES_LMDER) {
1198+
solve_3d_ceres_lmder(solverOptions, numberOfParameters, numberOfErrors,
1199+
out_paramList, out_errorList, paramWeightList,
1200+
userData, out_cmdResult.solverResult);
11911201
} else {
11921202
MMSOLVER_MAYA_ERR(
11931203
"Solver Type is invalid. solverType=" << solverOptions.solverType);

0 commit comments

Comments
 (0)