Planned maintenance on Wednesday, 2021-01-20, 17:00-18:00. Expect some interruptions during that time

Commit 2e48be5f authored by Jakob Knollmueller's avatar Jakob Knollmueller

renamed QuasiNewtonMinimizer to DescentMinimizer, removed position.setter from...

renamed QuasiNewtonMinimizer to DescentMinimizer, removed position.setter from energy and corrected step_length in DescentMimimizer
parent 5c5cbda2
Pipeline #12190 failed with stage
in 4 minutes and 53 seconds
......@@ -39,10 +39,6 @@ class Energy(Loggable, object):
def position(self):
return self._position
@position.setter
def position(self, position):
self._position = position
@property
def value(self):
raise NotImplementedError
......
......@@ -18,7 +18,7 @@
from line_searching import *
from conjugate_gradient import ConjugateGradient
from quasi_newton_minimizer import QuasiNewtonMinimizer
from descent_minimizer import QuasiNewtonMinimizer
from steepest_descent import SteepestDescent
from vl_bfgs import VL_BFGS
from relaxed_newton import RelaxedNewton
......@@ -26,7 +26,7 @@ from keepers import Loggable
from .line_searching import LineSearchStrongWolfe
class QuasiNewtonMinimizer(Loggable, object):
class DescentMinimizer(Loggable, object):
__metaclass__ = NiftyMeta
def __init__(self, line_searcher=LineSearchStrongWolfe(), callback=None,
......
......@@ -148,8 +148,9 @@ class LineSearchStrongWolfe(LineSearch):
# extract the full energy from the line_energy
energy_star = energy_star.energy
return alpha_star, phi_star, energy_star
length_direction = pk.norm
step_length = alpha_star * length_direction
return step_length, phi_star, energy_star
def _zoom(self, alpha_lo, alpha_hi, phi_0, phiprime_0,
phi_lo, phiprime_lo, phi_hi, c1, c2):
......
......@@ -16,11 +16,11 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
from .quasi_newton_minimizer import QuasiNewtonMinimizer
from .descent_minimizer import DescentMinimizer
from .line_searching import LineSearchStrongWolfe
class RelaxedNewton(QuasiNewtonMinimizer):
class RelaxedNewton(DescentMinimizer):
def __init__(self, line_searcher=LineSearchStrongWolfe(), callback=None,
convergence_tolerance=1E-4, convergence_level=3,
iteration_limit=None):
......@@ -38,8 +38,3 @@ class RelaxedNewton(QuasiNewtonMinimizer):
curvature = energy.curvature
descend_direction = curvature.inverse_times(gradient)
return descend_direction * -1
#norm = descend_direction.norm()
# if norm != 1:
# return descend_direction / -norm
# else:
# return descend_direction * -1
......@@ -16,10 +16,10 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
from .quasi_newton_minimizer import QuasiNewtonMinimizer
from .descent_minimizer import DescentMinimizer
class SteepestDescent(QuasiNewtonMinimizer):
class SteepestDescent(DescentMinimizer):
def _get_descend_direction(self, energy):
descend_direction = energy.gradient
norm = descend_direction.norm()
......
......@@ -18,11 +18,11 @@
import numpy as np
from .quasi_newton_minimizer import QuasiNewtonMinimizer
from .descent_minimizer import DescentMinimizer
from .line_searching import LineSearchStrongWolfe
class VL_BFGS(QuasiNewtonMinimizer):
class VL_BFGS(DescentMinimizer):
def __init__(self, line_searcher=LineSearchStrongWolfe(), callback=None,
convergence_tolerance=1E-4, convergence_level=3,
iteration_limit=None, max_history_length=10):
......
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