Skip to content

Commit df17de5

Browse files
committed
Added **kwargs to all functions for enhanced flexibility
1 parent 097daac commit df17de5

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

src/mmapy/mma.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ def mmasub(m: int, n: int, iter: int, xval: np.ndarray, xmin: np.ndarray, xmax:
3434
dfdx: np.ndarray, low: np.ndarray, upp: np.ndarray, a0: float, a: np.ndarray, c: np.ndarray,
3535
d: np.ndarray, move: float = 0.5, asyinit: float = 0.5, asydecr: float = 0.7, asyincr: float = 1.2,
3636
asymin: float = 0.01, asymax: float = 10, raa0: float = 0.00001,
37-
albefa: float = 0.1) -> Tuple[np.ndarray, np.ndarray, float, np.ndarray, np.ndarray, np.ndarray,
37+
albefa: float = 0.1, **kwargs) -> Tuple[np.ndarray, np.ndarray, float, np.ndarray, np.ndarray, np.ndarray,
3838
np.ndarray, float, np.ndarray, np.ndarray]:
3939

4040
"""
@@ -167,7 +167,7 @@ def mmasub(m: int, n: int, iter: int, xval: np.ndarray, xmin: np.ndarray, xmax:
167167
def gcmmasub(m: int, n: int, iter: int, epsimin: float, xval: np.ndarray, xmin: np.ndarray,
168168
xmax: np.ndarray, low: np.ndarray, upp: np.ndarray, raa0: float, raa: np.ndarray,
169169
f0val: np.ndarray, df0dx: np.ndarray, fval: np.ndarray, dfdx: np.ndarray, a0: float,
170-
a: np.ndarray, c: np.ndarray, d: np.ndarray, albefa: float = 0.1) -> Tuple[np.ndarray, np.ndarray,
170+
a: np.ndarray, c: np.ndarray, d: np.ndarray, albefa: float = 0.1, **kwargs) -> Tuple[np.ndarray, np.ndarray,
171171
float, np.ndarray, np.ndarray, np.ndarray, np.ndarray, np.ndarray, np.ndarray, float, float]:
172172

173173
"""
@@ -287,7 +287,7 @@ def gcmmasub(m: int, n: int, iter: int, epsimin: float, xval: np.ndarray, xmin:
287287

288288
def subsolv(m: int, n: int, epsimin: float, low: np.ndarray, upp: np.ndarray, alfa: np.ndarray,
289289
beta: np.ndarray, p0: np.ndarray, q0: np.ndarray, P: np.ndarray, Q: np.ndarray,
290-
a0: float, a: np.ndarray, b: np.ndarray, c: np.ndarray, d: np.ndarray) -> Tuple[np.ndarray,
290+
a0: float, a: np.ndarray, b: np.ndarray, c: np.ndarray, d: np.ndarray, **kwargs) -> Tuple[np.ndarray,
291291
np.ndarray, float, np.ndarray, np.ndarray, np.ndarray, float, np.ndarray, np.ndarray]:
292292

293293
"""
@@ -528,7 +528,7 @@ def subsolv(m: int, n: int, epsimin: float, low: np.ndarray, upp: np.ndarray, al
528528
def kktcheck(m: int, n: int, x: np.ndarray, y: np.ndarray, z: float, lam: np.ndarray, xsi: np.ndarray,
529529
eta: np.ndarray, mu: np.ndarray, zet: float, s: np.ndarray, xmin: np.ndarray, xmax: np.ndarray,
530530
df0dx: np.ndarray, fval: np.ndarray, dfdx: np.ndarray, a0: float, a: np.ndarray, c: np.ndarray,
531-
d: np.ndarray) -> Tuple[np.ndarray, float, float]:
531+
d: np.ndarray, **kwargs) -> Tuple[np.ndarray, float, float]:
532532

533533
"""
534534
Evaluate the residuals for the Karush-Kuhn-Tucker (KKT) conditions of a nonlinear programming problem.
@@ -589,7 +589,7 @@ def kktcheck(m: int, n: int, x: np.ndarray, y: np.ndarray, z: float, lam: np.nda
589589

590590
def raaupdate(xmma: np.ndarray, xval: np.ndarray, xmin: np.ndarray, xmax: np.ndarray, low: np.ndarray, upp: np.ndarray,
591591
f0valnew: np.ndarray, fvalnew: np.ndarray, f0app: np.ndarray, fapp: np.ndarray, raa0: np.ndarray,
592-
raa: np.ndarray, raa0eps: np.ndarray, raaeps: np.ndarray, epsimin: float) -> Tuple[np.ndarray, np.ndarray]:
592+
raa: np.ndarray, raa0eps: np.ndarray, raaeps: np.ndarray, epsimin: float, **kwargs) -> Tuple[np.ndarray, np.ndarray]:
593593

594594
"""
595595
Update the parameters raa0 and raa during an inner iteration.
@@ -650,7 +650,7 @@ def raaupdate(xmma: np.ndarray, xval: np.ndarray, xmin: np.ndarray, xmax: np.nda
650650
return raa0, raa
651651

652652

653-
def concheck(m: int, epsimin: np.ndarray, f0app: np.ndarray, f0valnew: np.ndarray, fapp: np.ndarray, fvalnew: np.ndarray) -> int:
653+
def concheck(m: int, epsimin: np.ndarray, f0app: np.ndarray, f0valnew: np.ndarray, fapp: np.ndarray, fvalnew: np.ndarray, **kwargs) -> int:
654654

655655
"""
656656
Check if the current approximations are conservative.
@@ -688,7 +688,7 @@ def concheck(m: int, epsimin: np.ndarray, f0app: np.ndarray, f0valnew: np.ndarra
688688
def asymp(outeriter: int, n: int,xval: np.ndarray, xold1: np.ndarray, xold2: np.ndarray, xmin: np.ndarray,
689689
xmax: np.ndarray, low: np.ndarray, upp: np.ndarray, raa0: float, raa: np.ndarray, raa0eps: float,
690690
raaeps: float, df0dx: np.ndarray, dfdx: np.ndarray, asyinit: float = 0.5, asydecr: float = 0.7,
691-
asyincr: float = 1.2, asymin: float = 0.01, asymax: float = 10) -> Tuple[np.ndarray, np.ndarray, float, np.ndarray]:
691+
asyincr: float = 1.2, asymin: float = 0.01, asymax: float = 10, **kwargs)-> Tuple[np.ndarray, np.ndarray, float, np.ndarray]:
692692

693693
"""
694694
Calculate the parameters raa0, raa, low, and upp at the beginning of each outer iteration.

0 commit comments

Comments
 (0)