10000 Reintroduced stopping condition in driver to stop at a maximum · PythonOptimizers/NLP.py@7320c18 · GitHub
[go: up one dir, main page]

Skip to content

Commit 7320c18

Browse files
Andrew Lambedpo
authored andcommitted
Reintroduced stopping condition in driver to stop at a maximum
number of iterations. Updated some documentation as well.
1 parent b8d4364 commit 7320c18

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

nlp/drivers/nlp_auglag.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ def auglag_stats(auglag):
3737
auglag_logger = config_logger("nlp.auglag",
3838
"%(name)-8s %(levelname)-5s %(message)s",
3939
level=logging.WARN if nprobs > 1 else logging.INFO)
40+
4041
# Create TRON logger.
4142
tron_logger = config_logger("nlp.tron",
4243
"%(name)-8s %(levelname)-5s %(message)s",
@@ -50,7 +51,7 @@ def auglag_stats(auglag):
5051
for problem in sys.argv[1:]:
5152
model = PySparseAmplModel(problem)
5253
model.compute_scaling_obj()
53-
auglag = Auglag(model, TRON, maxtime=900)
54+
auglag = Auglag(model, TRON, maxupdate=100)
5455
try:
5556
auglag.solve()
5657
status = auglag.status

nlp/optimize/auglag.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,8 @@ def __init__(self, model, bc_solver, **kwargs):
5555
:reltol: relative stopping tolerance (1.0e-5)
5656
:abstol: absolute stopping tolerance (1.0e-12)
5757
:maxiter: maximum number of iterations (max(1000, 10n))
58+
:maxupdate: maximum number of penalty or multiplier
59+
updates (100)
5860
:ny: apply Nocedal/Yuan linesearch (False)
5961
:nbk: max number of backtracking steps in Nocedal/Yuan
6062
linesearch (5)
@@ -69,7 +71,9 @@ def __init__(self, model, bc_solver, **kwargs):
6971
:Exit codes:
7072
:opt: Optimal solution found
7173
:iter: Maximum iteration reached
72-
:stal: Not making sufficient progress
74+
:feas: Feasible, but not optimal, solution found
75+
:fail: Cannot make further progress from current point
76+
:stal: Problem converged to an infeasible point
7377
:time: Time limit exceeded
7478
"""
7579
self.model = AugmentedLagrangian(model, **kwargs)
@@ -106,6 +110,8 @@ def __init__(self, model, bc_solver, **kwargs):
106110
self.maxiter = kwargs.get("maxiter",
107111
100 * self.model.model.original_n)
108112

113+
self.maxupdate = kwargs.get("maxupdate",100)
114+
109115
# Maximum run time
110116
self.maxtime = kwargs.get("maxtime", 1800.)
111117

@@ -401,7 +407,7 @@ def solve(self, **kwargs):
401407
except UserExitRequest:
402408
self.status = "usr"
403409

404-
exitIter = self.niter_total > self.maxiter
410+
exitIter = self.niter_total > self.maxiter or self.iter > self.maxupdate
405411

406412
exitTime = (cputime() - tick) > self.maxtime
407413

0 commit comments

Comments
 (0)
0