Commit d04b5f3f authored by Carsten Gräser's avatar Carsten Gräser
Browse files

Hard wire preliminary quadratic solve

This is needed, since the fastQuadratic option of the bisection will be
removed
parent e6145647
......@@ -35,7 +35,6 @@ class BlockNonlinearGSProblem
bisection = Bisection(0.0,
config.get("smoother.gs_acceptance", 1.0),
config.get("smoother.gs_tol", 1e-15),
config.get("smoother.fast_quadratic_minimize", true),
config.get("smoother.safety", 1e-14));
};
......@@ -177,7 +176,10 @@ class BlockNonlinearGSProblem<ConvexProblemTypeTEMPLATE>::IterateObject
if (problem_.am != 0.0)
local_J.A += problem_.am*(problem_.lowRankFactor_[0][i].diagonal(j))*(problem_.lowRankFactor_[0][i].diagonal(j));
ui[j] = bisection.minimize(local_J, ui[j], ui[j], bisectionsteps);
// Use bisection if quadratic minimization fails
ui[j] = local_J.domain().projectIn(local_J.b/local_J.A);
if (not local_J.subDifferential(ui[j]).containsZero(1e-14))
ui[j] = bisection.minimize(local_J, ui[j], ui[j], bisectionsteps);
// we need to update the intermediate local values ...
problem_.phi.updateEntry(i, ui[j], j);
......
......@@ -181,7 +181,6 @@ class BlockNonlinearTNNMGProblem
bisection_ = Bisection(0.0,
config.get("smoother.gs_acceptance", 1.0),
config.get("smoother.gs_tol", 1e-15),
config.get("smoother.fast_quadratic_minimize", true),
config.get("smoother.safety", 1e-14));
// postprocessing
......@@ -527,8 +526,16 @@ class BlockNonlinearTNNMGProblem
if (not(linesearch.try_one_flag) or (energy > oldEnergy))
{
int bisectionsteps = 0;
Bisection bisection(0.0, linesearch.acceptance, linesearch.tol, linesearch.fast_quadratic_minimize_flag);
alpha = bisection.minimize(psi, scalingFactor, 0.0, bisectionsteps);
Bisection bisection(0.0, linesearch.acceptance, linesearch.tol);
if (linesearch.fast_quadratic_minimize_flag)
{
// Use bisection if quadratic minimization fails
alpha = psi.domain().projectIn(psi.b/psi.A);
if (not psi.subDifferential(alpha).containsZero(1e-14))
alpha = bisection.minimize(psi, scalingFactor, 0.0, bisectionsteps);
}
else
alpha = bisection.minimize(psi, scalingFactor, 0.0, bisectionsteps);
}
}
......
......@@ -33,7 +33,6 @@ class SimplexConstrainedGSProblem
bisection = Bisection(0.0,
config.get("smoother.gs_acceptance", 1.0),
config.get("smoother.gs_tol", 1e-15),
config.get("smoother.fast_quadratic_minimize", true),
config.get("smoother.safety", 1e-14));
localGSLoops_ = config.get("smoother.local_gs_loops", 1);
};
......@@ -150,7 +149,10 @@ class SimplexConstrainedGSProblem<ConvexProblemTypeTEMPLATE>::IterateObject
local_J.ui[j2] = ui[j2];
// compute minimizer for correction
alpha = bisection.minimize(local_J, 0, 0, bisectionsteps);
// Use bisection if quadratic minimization fails
alpha = local_J.domain().projectIn(local_J.b/local_J.A);
if (not local_J.subDifferential(alpha).containsZero(1e-14))
alpha = bisection.minimize(local_J, 0, 0, bisectionsteps);
// apply correction
ui[j1] += alpha;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment