Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
ift
NIFTy
Commits
edf79d19
Commit
edf79d19
authored
May 11, 2017
by
Theo Steininger
Browse files
Merge branch 'now_DescentMinimizer_and_bugfix' into 'master'
Now descent minimizer and bugfix See merge request
!97
parents
54f203dd
3150ff53
Pipeline
#12270
passed with stages
in 13 minutes and 13 seconds
Changes
7
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
nifty/energies/energy.py
View file @
edf79d19
...
...
@@ -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
...
...
nifty/minimization/__init__.py
View file @
edf79d19
...
...
@@ -18,7 +18,7 @@
from
line_searching
import
*
from
conjugate_gradient
import
ConjugateGradient
from
quasi_newton
_minimizer
import
QuasiNewton
Minimizer
from
descent
_minimizer
import
Descent
Minimizer
from
steepest_descent
import
SteepestDescent
from
vl_bfgs
import
VL_BFGS
from
relaxed_newton
import
RelaxedNewton
nifty/minimization/
quasi_newton
_minimizer.py
→
nifty/minimization/
descent
_minimizer.py
View file @
edf79d19
...
...
@@ -26,7 +26,7 @@ from keepers import Loggable
from
.line_searching
import
LineSearchStrongWolfe
class
QuasiNewton
Minimizer
(
Loggable
,
object
):
class
Descent
Minimizer
(
Loggable
,
object
):
__metaclass__
=
NiftyMeta
def
__init__
(
self
,
line_searcher
=
LineSearchStrongWolfe
(),
callback
=
None
,
...
...
nifty/minimization/line_searching/line_search_strong_wolfe.py
View file @
edf79d19
...
...
@@ -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
direction_length
=
pk
.
norm
()
step_length
=
alpha_star
*
direction_length
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
):
...
...
nifty/minimization/relaxed_newton.py
View file @
edf79d19
...
...
@@ -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
QuasiNewton
Minimizer
from
.
descent
_minimizer
import
Descent
Minimizer
from
.line_searching
import
LineSearchStrongWolfe
class
RelaxedNewton
(
QuasiNewton
Minimizer
):
class
RelaxedNewton
(
Descent
Minimizer
):
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
nifty/minimization/steepest_descent.py
View file @
edf79d19
...
...
@@ -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
QuasiNewton
Minimizer
from
.
descent
_minimizer
import
Descent
Minimizer
class
SteepestDescent
(
QuasiNewton
Minimizer
):
class
SteepestDescent
(
Descent
Minimizer
):
def
_get_descend_direction
(
self
,
energy
):
descend_direction
=
energy
.
gradient
norm
=
descend_direction
.
norm
()
...
...
nifty/minimization/vl_bfgs.py
View file @
edf79d19
...
...
@@ -18,11 +18,11 @@
import
numpy
as
np
from
.
quasi_newton
_minimizer
import
QuasiNewton
Minimizer
from
.
descent
_minimizer
import
Descent
Minimizer
from
.line_searching
import
LineSearchStrongWolfe
class
VL_BFGS
(
QuasiNewton
Minimizer
):
class
VL_BFGS
(
Descent
Minimizer
):
def
__init__
(
self
,
line_searcher
=
LineSearchStrongWolfe
(),
callback
=
None
,
convergence_tolerance
=
1E-4
,
convergence_level
=
3
,
iteration_limit
=
None
,
max_history_length
=
10
):
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment