Commit 47b5e1c5 authored by robin.requadt's avatar robin.requadt
Browse files

Upload New File

parent 073c6852
"""
% DRAP.m
% written on Aug 18, 2017 by
% Russell Luke
% Inst. Fuer Numerische und Angewandte Mathematik
% Universitaet Goettingen
%
% DESCRIPTION: user-friendly version of the Relaxed Averaged Alternating Reflection algorithm as
% proposed by Nguyen Thao (PhD Thesis, Uni. Göttingen, 2017)
%
%
% INPUT: u, an array, and method_input, a data structure
%
% OUTPUT: method_input, the appended data structure with
% unew = the algorithm image
%
% USAGE: [method_output, method_input] = DRAP(method_input,u)
%
% Nonstandard Matlab function calls: method_input.Prox1 and .Prox2
"""
from .SimpleAlgortihm import SimpleAlgorithm
import numpy as np
from numpy import exp
from proxtoolbox import ProxOperators
from .proxoperators import ProxOperator
class DRAP(SimpleAlgorithm):
def __init__(self,config):
"""
Parameters
----------
config : dict
Dictionary containing the problem configuration.
It must contain the following mappings:
proxoperators: ProxOperators
list of ProxOperators (the class, no instance)
beta0: number
Starting relaxation parmater
beta_max: number
Maximum relaxation parameter
beta_switch: int
Iteration at which beta moves from beta_0 -> beta_max
iter : int
"""
self.prox1 = config['proxoperators'][0](config)
self.prox2 = config['proxoperators'][1](config)
self.beta0 = config['beta0']
self.beta_max = config['beta_max']
self.beta_switch = config['beta_switch']
self.iter = config['iter']
def evaluate(self, u):
beta0 = self.beta0
beta_max = self.beta_max
beta_switch = self.beta_switch
iter = self.iter
beta = exp((-iter/beta_switch)**3)*beta0+(1-exp((-iter/beta_switch)**3))*beta_max # unrelaxes as the
tmp1 = self.prox2.work(u)
tmp2= beta*(tmp1-u) # feval(Prox1,method_input,tmp1)
tmp_3 = self.prox1.work(tmp1+tmp2) # (beta*(2*tmp3-tmp1) + (1-beta)*tmp1 + u)/2
unew = tmp_3-tmp2
return unew
Supports Markdown
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