Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename simple -> simplified Newton #12

Merged
merged 1 commit into from
Oct 26, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions pygradflow/newton.py
Original file line number Diff line number Diff line change
@@ -33,7 +33,7 @@ def step(self, iterate):
raise NotImplementedError()


class SimpleNewtonMethod(NewtonMethod):
class SimplifiedNewtonMethod(NewtonMethod):
"""
Computes step based on the matrix given in terms of the *initial*
iterate. Only requires a back-solve for each step.
@@ -232,8 +232,8 @@ def newton_method(

solver = step_solver(problem, params, iterate, dt, rho)

if params.newton_type == NewtonType.Simple:
return SimpleNewtonMethod(problem, iterate, dt, rho, solver)
if params.newton_type == NewtonType.Simplified:
return SimplifiedNewtonMethod(problem, iterate, dt, rho, solver)
elif params.newton_type == NewtonType.Full:
return FullNewtonMethod(problem, iterate, dt, rho, solver)
elif params.newton_type == NewtonType.ActiveSet:
4 changes: 2 additions & 2 deletions pygradflow/params.py
Original file line number Diff line number Diff line change
@@ -5,7 +5,7 @@


class NewtonType(Enum):
Simple = auto()
Simplified = auto()
Full = auto()
ActiveSet = auto()

@@ -63,7 +63,7 @@ class Params:
lamb_term: float = 1e-8
active_tol: float = 1e-8

newton_type: NewtonType = NewtonType.Simple
newton_type: NewtonType = NewtonType.Simplified
newton_tol: float = 1e-8

step_solver: object = None
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "pygradflow"
version = "0.2.0"
version = "0.2.1"
description = "PyGradFlow is a simple implementation of the sequential homotopy method to be used to solve general nonlinear programs."
authors = ["Christoph Hansknecht <[email protected]>"]
readme = "README.md"
2 changes: 1 addition & 1 deletion tests/pygradflow/test_solver.py
Original file line number Diff line number Diff line change
@@ -360,7 +360,7 @@ def test_solve_tame():

# TODO: Find out why full Newton does not converge
@pytest.mark.parametrize(
"newton_type", [NewtonType.ActiveSet, NewtonType.Simple, NewtonType.Full]
"newton_type", [NewtonType.ActiveSet, NewtonType.Simplified, NewtonType.Full]
)
def test_solve_with_newton_types(hs71_instance, newton_type):
problem, x_0, y_0 = hs71_instance