Commit 22df3d31 authored by jansen31's avatar jansen31
Browse files

readability

parent c8cbbcb9
......@@ -11,18 +11,20 @@
from .SimpleAlgortihm import SimpleAlgorithm
from numpy import exp
class DRl(SimpleAlgorithm):
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
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)
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
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
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