Preprocessor for the TrustRegionMinimizer.

1. Base class for preprocessors.
2. A preprocessor for problems that will be solved using
   the trust region minimizer.
3. Added sanity tests to the program reordering options
   for Schur type linear solvers.
4. Tests for the TrustRegionPreprocessor.

Change-Id: I88cd926f0053bbbf2bd6b11e03ec55b8bf473cf1
This commit is contained in:
Sameer Agarwal
2014-08-07 14:30:33 -07:00
parent 54893ba523
commit f7da411ef0
7 changed files with 1061 additions and 1 deletions
+25 -1
View File
@@ -313,6 +313,15 @@ bool ReorderProgramForSchurTypeLinearSolver(
ParameterBlockOrdering* parameter_block_ordering,
Program* program,
string* error) {
if (parameter_block_ordering->NumElements() != program->NumParameterBlocks()) {
*error = StringPrintf(
"The program has %d parameter blocks, but the parameter block "
"ordering has %d parameter blocks.",
program->NumParameterBlocks(),
parameter_block_ordering->NumElements());
return false;
}
if (parameter_block_ordering->NumGroups() == 1) {
// If the user supplied an parameter_block_ordering with just one
// group, it is equivalent to the user supplying NULL as an
@@ -340,7 +349,22 @@ bool ReorderProgramForSchurTypeLinearSolver(
swap(*program->mutable_parameter_blocks(), schur_ordering);
} else {
// The user provided an ordering with more than one elimination
// group. Trust the user and apply the ordering.
// group.
// Verify that the first elimination group is an independent set.
const set<double*>& first_elimination_group =
parameter_block_ordering
->group_to_elements()
.begin()
->second;
if (!program->IsParameterBlockSetIndependent(first_elimination_group)) {
*error =
StringPrintf("The first elimination group in the parameter block "
"ordering of size %zd is not an independent set",
first_elimination_group.size());
return false;
}
if (!ApplyOrdering(parameter_map,
*parameter_block_ordering,
program,