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

Print solver iteration and convergence param #2860

Merged
merged 2 commits into from
Aug 23, 2023
Merged
Show file tree
Hide file tree
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
8 changes: 8 additions & 0 deletions process/solver.py
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,9 @@ def solve(self) -> int:
if self.b is not None:
B = np.identity(numerics.nvar) * self.b

def _solver_callback(i: int, _x, _result, convergence_param: float):
print(f"{i+1} | Convergence Parameter: {convergence_param:.3E}", end="\r")

try:
x, _, _, res = solve(
problem,
Expand All @@ -178,6 +181,7 @@ def solve(self) -> int:
epsilon=self.tolerance,
qsp_options={"eps_rel": 1e-1, "adaptive_rho_interval": 25},
initial_B=B,
callback=_solver_callback,
)
except VMCONConvergenceException as e:
if isinstance(e, LineSearchConvergenceException):
Expand All @@ -201,6 +205,10 @@ def solve(self) -> int:
else:
self.info = 1

# print a blank line because of the carridge return
# in the callback
print()

self.x = x
self.objf = res.f
self.conf = np.hstack((res.eq, res.ie))
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,6 @@ pandas>=1.1.5
bokeh==2.4.0
mkdocstrings==0.18.0
flinter==0.3.0
PyVMCON>=2.0.0,<3.0.0
PyVMCON>=2.1.0,<3.0.0
CoolProp>=6.4
Jinja2>=3.0
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
"tables",
"SALib",
"numba>=0.55.2",
"PyVMCON>=2.0.0,<3.0.0",
"PyVMCON>=2.1.0,<3.0.0",
"CoolProp>=6.4",
],
"extras_require": {"test": ["pytest"]},
Expand Down