Skip to content

Commit 7540c41

Browse files
committed
Add ZeroFPR update_direction_in_accel
1 parent 3a998bd commit 7540c41

File tree

3 files changed

+21
-1
lines changed

3 files changed

+21
-1
lines changed

src/alpaqa/include/alpaqa/implementation/inner/zerofpr.tpp

+17-1
Original file line numberDiff line numberDiff line change
@@ -338,6 +338,7 @@ auto ZeroFPRSolver<DirectionProviderT>::operator()(
338338
τ = τ_init;
339339
real_t τ_prev = -1;
340340
bool update_lbfgs_in_linesearch = params.update_direction_in_candidate;
341+
bool update_lbfgs_in_accel = params.update_direction_in_accel;
341342
bool updated_lbfgs = false;
342343
bool dir_rejected = true;
343344

@@ -389,6 +390,21 @@ auto ZeroFPRSolver<DirectionProviderT>::operator()(
389390
eval_prox_grad_step(*next);
390391
eval_cost_in_prox(*next);
391392

393+
// Update L-BFGS
394+
if (update_lbfgs_in_accel && !updated_lbfgs) {
395+
if (τ > 0 && params.update_direction_from_prox_step) {
396+
s.lbfgs_rejected += dir_rejected = not direction.update(
397+
curr->γ, next->γ, curr->x̂, next->x, prox->p, next->p,
398+
prox->grad_ψ, next->grad_ψ);
399+
} else {
400+
s.lbfgs_rejected += dir_rejected = not direction.update(
401+
curr->γ, next->γ, curr->x, next->x, curr->p, next->p,
402+
curr->grad_ψ, next->grad_ψ);
403+
}
404+
update_lbfgs_in_accel = false;
405+
updated_lbfgs = true;
406+
}
407+
392408
// Quadratic upper bound step size condition
393409
if (next->L < params.L_max && qub_violated(*next)) {
394410
next->γ /= 2;
@@ -404,7 +420,7 @@ auto ZeroFPRSolver<DirectionProviderT>::operator()(
404420

405421
// Update L-BFGS
406422
if (update_lbfgs_in_linesearch && !updated_lbfgs) {
407-
if (params.update_direction_from_prox_step) {
423+
if (τ > 0 && params.update_direction_from_prox_step) {
408424
s.lbfgs_rejected += dir_rejected = not direction.update(
409425
curr->γ, next->γ, curr->x̂, next->x, prox->p, next->p,
410426
prox->grad_ψ, next->grad_ψ);

src/alpaqa/include/alpaqa/inner/zerofpr.hpp

+3
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,9 @@ struct ZeroFPRParams {
6969
/// Use the candidate point rather than the accepted point to update the
7070
/// quasi-Newton direction.
7171
bool update_direction_in_candidate = false;
72+
/// Use the point generated by the accelerator rather than the accepted
73+
/// point to update the quasi-Newton direction.
74+
bool update_direction_in_accel = false;
7275
/// If the step size changes, the direction buffer is flushed. The current
7376
/// step will still be used to update the direction, but may still use the
7477
/// old step size. If set to true, the current step will be recomputed with

src/alpaqa/include/alpaqa/params/structs.ipp

+1
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,7 @@ PARAMS_TABLE_CONF(ZeroFPRParams, //
128128
PARAMS_MEMBER(quadratic_upperbound_tolerance_factor, ""), //
129129
PARAMS_MEMBER(linesearch_tolerance_factor, ""), //
130130
PARAMS_MEMBER(update_direction_in_candidate, ""), //
131+
PARAMS_MEMBER(update_direction_in_accel, ""), //
131132
PARAMS_MEMBER(recompute_last_prox_step_after_stepsize_change,
132133
""), //
133134
PARAMS_MEMBER(update_direction_from_prox_step, ""), //

0 commit comments

Comments
 (0)