# DRl.m # written on Dez.5 , 2018 by # Russell Luke # Inst. Fuer Numerische und Angewandte Mathematik # # DESCRIPTION: User-friendly version of the Relaxed Douglas-Rachford algorithm. # For background see: # D.R.Luke, Inverse Problems 21:37-50(2005) # D.R. Luke, SIAM J. Opt. 19(2): 714--739 (2008). from .SimpleAlgortihm import SimpleAlgorithm from numpy import exp class DRl(SimpleAlgorithm): def __init__(self, config): super(DRl, self).__init__(config) for parameter_key_extension in ['_0', '_max', '_switch']: key = 'lambda'+parameter_key_extension alternative = 'beta'+parameter_key_extension try: if key not in config: config[key] = config[alternative] except KeyError: raise KeyError('config should contain %s, or %s must be given as alternative') def evaluate(self, u): iter = self.config['iter'] + 1 # add 1 to conform with matlab version (iter influences lambda and we sometimes want to compare results between # python and matlab), matlab counts starting at 1, python starts at 0 lambda0 = self.config['lambda_0'] lambda_max = self.config['lambda_max'] lambda_switch = self.config['lambda_switch'] tmp1 = 2 * self.prox2.work(u) - u tmp2 = self.prox1.work(tmp1) # update lambda1 = exp((-iter / lambda_switch) ** 3) * lambda0 + ( 1 - exp((-iter / lambda_switch) ** 3)) * lambda_max # unrelaxes as the unew = (lambda1 * (2 * tmp2 - tmp1) + (1 - lambda1) * tmp1 + u) / 2 return unew