From 83f4ba546317da867d097abc3404cbd54b66a6ae Mon Sep 17 00:00:00 2001 From: cmhamel Date: Tue, 7 Jan 2025 21:55:30 +0000 Subject: [PATCH] deploy: 82ed0087a6dc7156ac81750c34ae6a3f45a08242 --- .buildinfo | 4 +- _modules/index.html | 4 +- _modules/optimism/AlSolver.html | 26 +- .../optimism/BoundConstrainedObjective.html | 40 +- _modules/optimism/BoundConstrainedSolver.html | 14 +- _modules/optimism/ConstrainedObjective.html | 90 ++-- _modules/optimism/EquationSolver.html | 60 +-- _modules/optimism/EquationSolverSubspace.html | 30 +- _modules/optimism/FunctionSpace.html | 104 ++-- _modules/optimism/Interpolants.html | 48 +- _modules/optimism/J2PlasticPhaseField.html | 52 +- _modules/optimism/JaxConfig.html | 22 +- _modules/optimism/LU.html | 26 +- _modules/optimism/LinAlg.html | 40 +- _modules/optimism/Math.html | 26 +- _modules/optimism/Mechanics.html | 150 +++--- _modules/optimism/Mesh.html | 54 +- _modules/optimism/MeshPlot.html | 12 +- _modules/optimism/MinimizeScalar.html | 34 +- _modules/optimism/NewtonSolver.html | 22 +- _modules/optimism/Objective.html | 90 ++-- _modules/optimism/QuadratureRule.html | 42 +- _modules/optimism/ReadExodusMesh.html | 38 +- _modules/optimism/ReadMesh.html | 12 +- _modules/optimism/ScalarRootFind.html | 24 +- _modules/optimism/SmoothFunctions.html | 18 +- _modules/optimism/SparseCholesky.html | 36 +- _modules/optimism/SparseMatrixAssembler.html | 12 +- _modules/optimism/Surface.html | 26 +- _modules/optimism/TensorMath.html | 90 ++-- _modules/optimism/Timer.html | 26 +- _modules/optimism/TrustRegionSPG.html | 48 +- _modules/optimism/VTKWriter.html | 52 +- _modules/optimism/WarmStart.html | 20 +- _modules/optimism/contact/Contact.html | 58 +-- _modules/optimism/contact/EdgeCpp.html | 28 +- .../optimism/contact/EdgeIntersection.html | 18 +- _modules/optimism/contact/Friction.html | 10 +- _modules/optimism/contact/Levelset.html | 14 +- .../optimism/contact/LevelsetConstraint.html | 28 +- _modules/optimism/contact/MortarContact.html | 54 +- _modules/optimism/contact/PenaltyContact.html | 26 +- _modules/optimism/contact/Search.html | 20 +- .../optimism/contact/test/test_Contact.html | 30 +- _modules/optimism/contact/test/test_Cpp.html | 42 +- .../contact/test/test_EdgeIntersection.html | 42 +- .../contact/test/test_LevelsetConstraint.html | 48 +- .../contact/test/test_MortarGeom.html | 46 +- .../test/test_NewtonGlobalization.html | 66 +-- .../optimism/contact/test/test_Search.html | 38 +- .../contact/test/test_TwoBodyContact.html | 44 +- .../test/test_TwoBodyMortarContact.html | 30 +- _modules/optimism/material/Gent.html | 20 +- _modules/optimism/material/Hardening.html | 30 +- .../optimism/material/HyperViscoelastic.html | 40 +- _modules/optimism/material/J2Plastic.html | 60 +-- _modules/optimism/material/LinearElastic.html | 28 +- .../material/MaterialUniaxialSimulator.html | 24 +- .../MultiBranchHyperViscoelastic.html | 46 +- _modules/optimism/material/Neohookean.html | 24 +- .../optimism/material/test/test_Gent.html | 30 +- .../material/test/test_Hardening.html | 36 +- .../material/test/test_HyperVisco.html | 32 +- .../material/test/test_J2Plastic.html | 68 +-- .../material/test/test_LinearElastic.html | 26 +- .../test/test_MaterialUniaxialSimulator.html | 20 +- .../test/test_MultiBranchHyperVisco.html | 32 +- .../material/test/test_RateSensitivity.html | 24 +- .../phasefield/MaterialPointSimulator.html | 34 +- _modules/optimism/phasefield/PhaseField.html | 60 +-- .../phasefield/PhaseFieldLorentzPlastic.html | 74 +-- .../phasefield/PhaseFieldThreshold.html | 46 +- .../PhaseFieldThresholdPlastic.html | 60 +-- .../test/plotPhaseFieldThresholdModel.html | 22 +- .../test/test_PhaseFieldLorentzPlastic.html | 44 +- .../test_PhaseFieldLorentzPlasticPatch.html | 66 +-- .../test/test_PhaseFieldThreshold.html | 38 +- .../test/test_PhaseFieldThresholdPatch.html | 64 +-- .../test/test_PhaseFieldThresholdPlastic.html | 46 +- .../test/test_PhaseFieldUniaxial.html | 24 +- _modules/optimism/test/ConvexityPlot.html | 10 +- _modules/optimism/test/MeshFixture.html | 44 +- _modules/optimism/test/TestFixture.html | 18 +- .../optimism/test/test_AxisymmPatchTest.html | 28 +- _modules/optimism/test/test_DofManager.html | 22 +- .../optimism/test/test_EquationSolver.html | 28 +- .../optimism/test/test_FunctionSpace.html | 74 +-- _modules/optimism/test/test_Interpolants.html | 58 +-- _modules/optimism/test/test_JaxConfig.html | 22 +- _modules/optimism/test/test_LinAlg.html | 60 +-- _modules/optimism/test/test_Math.html | 40 +- _modules/optimism/test/test_Mechanics.html | 30 +- _modules/optimism/test/test_Mesh.html | 30 +- .../optimism/test/test_MinimizeScalar.html | 32 +- _modules/optimism/test/test_Newmark.html | 70 +-- _modules/optimism/test/test_Objective.html | 26 +- _modules/optimism/test/test_PatchTest.html | 64 +-- _modules/optimism/test/test_PatchTestPou.html | 54 +- .../optimism/test/test_QuadratureRule.html | 42 +- .../optimism/test/test_ReadExodusMesh.html | 58 +-- _modules/optimism/test/test_ReadMesh.html | 56 +-- .../optimism/test/test_ScalarRootFinder.html | 48 +- .../optimism/test/test_SmoothFunctions.html | 20 +- _modules/optimism/test/test_SparseMatrix.html | 36 +- .../test/test_SparsePreconditioner.html | 34 +- _modules/optimism/test/test_Surface.html | 28 +- _modules/optimism/test/test_TensorMath.html | 90 ++-- _modules/optimism/test/test_Traction.html | 34 +- .../optimism/test/test_TrustRegionSPG.html | 84 ++-- _modules/optimism/test/test_VTKWriter.html | 44 +- .../optimism/test/test_VolumeAverageJ.html | 36 +- _static/basic.css | 15 +- _static/doctools.js | 7 + _static/language_data.js | 7 + _static/pygments.css | 36 +- _static/searchtools.js | 38 +- genindex.html | 324 +----------- index.html | 4 +- modules.html | 4 +- objects.inv | Bin 13825 -> 13009 bytes optimism.contact.html | 24 +- optimism.contact.test.html | 104 +--- optimism.html | 98 +--- optimism.material.html | 34 +- optimism.material.test.html | 154 +----- optimism.phasefield.html | 18 +- optimism.phasefield.test.html | 74 +-- optimism.test.html | 464 +----------------- py-modindex.html | 4 +- search.html | 4 +- searchindex.js | 2 +- 131 files changed, 2324 insertions(+), 3563 deletions(-) diff --git a/.buildinfo b/.buildinfo index 453a8788..ff8eaee3 100644 --- a/.buildinfo +++ b/.buildinfo @@ -1,4 +1,4 @@ # Sphinx build info version 1 -# This file records the configuration used when building these files. When it is not found, a full rebuild will be done. -config: bd59fd941387a83e9ca6b1b57e0d3ce7 +# This file hashes the configuration used when building these files. When it is not found, a full rebuild will be done. +config: f13c020c2ae2af9bc5aaffac8229bba5 tags: 645f666f9bcd5a90fca523b33c5a78b7 diff --git a/_modules/index.html b/_modules/index.html index 4e0dbff0..7883bcdf 100644 --- a/_modules/index.html +++ b/_modules/index.html @@ -6,7 +6,7 @@ Overview: module code — optimism 0.1.0 documentation - + @@ -14,7 +14,7 @@ - + diff --git a/_modules/optimism/AlSolver.html b/_modules/optimism/AlSolver.html index 79c6cf38..a021648c 100644 --- a/_modules/optimism/AlSolver.html +++ b/_modules/optimism/AlSolver.html @@ -6,7 +6,7 @@ optimism.AlSolver — optimism 0.1.0 documentation - + @@ -14,7 +14,7 @@ - + @@ -73,11 +73,11 @@

Source code for optimism.AlSolver

-from optimism.JaxConfig import *
-import optimism.EquationSolver as EqSolver
-from optimism.NewtonSolver import globalized_newton_step
-from optimism.NewtonSolver import newton_step
-from optimism import WarmStart
+from optimism.JaxConfig import *
+import optimism.EquationSolver as EqSolver
+from optimism.NewtonSolver import globalized_newton_step
+from optimism.NewtonSolver import newton_step
+from optimism import WarmStart
 
 Settings = namedtuple('Settings',
                       ['penalty_scaling',
@@ -93,7 +93,7 @@ 

Source code for optimism.AlSolver

 
 
[docs] -def get_settings(penalty_scaling=4., +def get_settings(penalty_scaling=4., target_constraint_decrease_factor=0.75, relative_gmres_tol=2e-2, max_gmres_iters=100, @@ -121,7 +121,7 @@

Source code for optimism.AlSolver

 
 
[docs] -def solve_sub_step(alObjective, x, ncpErrorOld, alSettings, subSettings, sub_problem_solver, sub_problem_callback=None): +def solve_sub_step(alObjective, x, ncpErrorOld, alSettings, subSettings, sub_problem_solver, sub_problem_callback=None): x, solverSuccess = sub_problem_solver(alObjective, x, subSettings, sub_problem_callback) c = alObjective.constraint(x) @@ -142,16 +142,16 @@

Source code for optimism.AlSolver

 
 
[docs] -def linear_update(alObjective, x, rhs_func, alSettings): +def linear_update(alObjective, x, rhs_func, alSettings): xl = np.hstack((x, alObjective.lam)) xsize = x.size - def residual_jac_vec(vxl): + def residual_jac_vec(vxl): return alObjective.constrained_jacobian_vec(xl, vxl) - def precond(vl): + def precond(vl): xR = vl[:xsize] lR = vl[xsize:] D = alObjective.ncp_hessian(x) @@ -175,7 +175,7 @@

Source code for optimism.AlSolver

 
 
[docs] -def augmented_lagrange_solve(alObjective, x, p, alSettings, subSettings, +def augmented_lagrange_solve(alObjective, x, p, alSettings, subSettings, callback=None, sub_problem_callback=None, sub_problem_solver=EqSolver.trust_region_minimize, diff --git a/_modules/optimism/BoundConstrainedObjective.html b/_modules/optimism/BoundConstrainedObjective.html index e1ace445..411cce04 100644 --- a/_modules/optimism/BoundConstrainedObjective.html +++ b/_modules/optimism/BoundConstrainedObjective.html @@ -6,7 +6,7 @@ optimism.BoundConstrainedObjective — optimism 0.1.0 documentation - + @@ -14,7 +14,7 @@ - + @@ -73,19 +73,19 @@

Source code for optimism.BoundConstrainedObjective

-from scipy.sparse import csc_matrix
-from scipy.sparse import diags as sparse_diags
-import numpy as onp
+from scipy.sparse import csc_matrix
+from scipy.sparse import diags as sparse_diags
+import numpy as onp
 
-from optimism import ConstrainedObjective
-from optimism.JaxConfig import *
+from optimism import ConstrainedObjective
+from optimism.JaxConfig import *
 
 
 
[docs] -class ScaledPrecondStrategy(ConstrainedObjective.PrecondStrategy): +class ScaledPrecondStrategy(ConstrainedObjective.PrecondStrategy): - def __init__(self, + def __init__(self, precondStrategy, scaled_constraint_hessian, dofScaling, @@ -98,7 +98,7 @@

Source code for optimism.BoundConstrainedObjective

[docs] - def initialize(self, x, p, lam, kappa): + def initialize(self, x, p, lam, kappa): self.ps.initialize(self.diagScaling*x, p) self.constraintHessian = self.constraint_hessian(x, p, lam, kappa)
@@ -106,7 +106,7 @@

Source code for optimism.BoundConstrainedObjective

[docs] - def precond_at_attempt(self, attempt): + def precond_at_attempt(self, attempt): K = self.ps.precond_at_attempt(attempt) K2 = csc_matrix( self.diagScaling.T * K * self.diagScaling ) + self.constraintHessian @@ -126,9 +126,9 @@

Source code for optimism.BoundConstrainedObjective

[docs] -class BoundConstrainedObjective(ConstrainedObjective.ConstrainedObjective): +class BoundConstrainedObjective(ConstrainedObjective.ConstrainedObjective): - def __init__(self, + def __init__(self, objective_func, x0, p, @@ -146,7 +146,7 @@

Source code for optimism.BoundConstrainedObjective

invScaling = 1.0/scaling - def scaled_constraint_hessian(xBar, p, lam, kappa): + def scaled_constraint_hessian(xBar, p, lam, kappa): c = xBar[constrainedIndices] phasePenaltyStiffness = np.where(lam >= c*kappa, kappa, 0.0) d = np.zeros_like(xBar).at[constrainedIndices].set(phasePenaltyStiffness) @@ -166,12 +166,12 @@

Source code for optimism.BoundConstrainedObjective

kappa0 = 0.25 * np.ones_like(lam0) - def scaled_objective(xBar, p): + def scaled_objective(xBar, p): x = invScaling * xBar return objective_func(x, p) - def scaled_constraint_func(xBar, p): + def scaled_constraint_func(xBar, p): return xBar[constrainedIndices] @@ -190,28 +190,28 @@

Source code for optimism.BoundConstrainedObjective

[docs] - def get_multipliers(self): + def get_multipliers(self): return self.lam * self.scaling[self.constrainedIndices]
[docs] - def get_value(self, x): + def get_value(self, x): return self.value(self.scaling * x)
[docs] - def get_residual(self, x): + def get_residual(self, x): return self.gradient(self.scaling * x)
[docs] - def get_total_residual(self, x): + def get_total_residual(self, x): return self.total_residual(self.scaling * x)
diff --git a/_modules/optimism/BoundConstrainedSolver.html b/_modules/optimism/BoundConstrainedSolver.html index b9205222..5204fa64 100644 --- a/_modules/optimism/BoundConstrainedSolver.html +++ b/_modules/optimism/BoundConstrainedSolver.html @@ -6,7 +6,7 @@ optimism.BoundConstrainedSolver — optimism 0.1.0 documentation - + @@ -14,7 +14,7 @@ - + @@ -73,17 +73,17 @@

Source code for optimism.BoundConstrainedSolver

-from optimism.JaxConfig import *
+from optimism.JaxConfig import *
 #from optimism import Objective
 #from optimism import ConstrainedObjective
-from optimism import AlSolver
-from optimism import WarmStart
-from optimism import EquationSolver
+from optimism import AlSolver
+from optimism import WarmStart
+from optimism import EquationSolver
 
     
 
[docs] -def bound_constrained_solve(boundConstrainedObjective, +def bound_constrained_solve(boundConstrainedObjective, x0, p, alSettings, subSettings, callback=None, diff --git a/_modules/optimism/ConstrainedObjective.html b/_modules/optimism/ConstrainedObjective.html index e4c684e8..eab48870 100644 --- a/_modules/optimism/ConstrainedObjective.html +++ b/_modules/optimism/ConstrainedObjective.html @@ -6,7 +6,7 @@ optimism.ConstrainedObjective — optimism 0.1.0 documentation - + @@ -14,7 +14,7 @@ - + @@ -73,19 +73,19 @@

Source code for optimism.ConstrainedObjective

-from optimism.JaxConfig import *
-import optimism.EquationSolver as EquationSolver
-from optimism.Objective import Objective
-from optimism.Objective import param_index_update
-from optimism.SparseCholesky import SparseCholesky
-import numpy as onp
-from scipy.sparse import csc_matrix
-from scipy.sparse import diags as sparse_diags
+from optimism.JaxConfig import *
+import optimism.EquationSolver as EquationSolver
+from optimism.Objective import Objective
+from optimism.Objective import param_index_update
+from optimism.SparseCholesky import SparseCholesky
+import numpy as onp
+from scipy.sparse import csc_matrix
+from scipy.sparse import diags as sparse_diags
 
 
 
[docs] -def fischer_burmeister(c, l, k): +def fischer_burmeister(c, l, k): ck = c*k return np.sqrt(ck**2 + l**2) - ck - l
@@ -93,7 +93,7 @@

Source code for optimism.ConstrainedObjective

[docs] -def fischer_burmeister_jac_l(c, l, k): +def fischer_burmeister_jac_l(c, l, k): t = np.sqrt((c*k)**2 + l**2) return (l - t) / t
@@ -101,16 +101,16 @@

Source code for optimism.ConstrainedObjective

[docs] -class PrecondStrategy: +class PrecondStrategy: - def __init__(self, objective_precond, constraint_precond): + def __init__(self, objective_precond, constraint_precond): self.objective_precond = objective_precond self.constraint_precond = constraint_precond
[docs] - def initialize(self, x, p, lam, kappa): + def initialize(self, x, p, lam, kappa): self.K = self.objective_precond(x, p) if self.constraint_precond: self.K += self.constraint_precond(x, p, lam, kappa)
@@ -119,7 +119,7 @@

Source code for optimism.ConstrainedObjective

[docs] - def precond_at_attempt(self, attempt): + def precond_at_attempt(self, attempt): if attempt==0: return self.K else: @@ -132,9 +132,9 @@

Source code for optimism.ConstrainedObjective

[docs] -class ConstrainedObjective(Objective): +class ConstrainedObjective(Objective): - def __init__(self, + def __init__(self, objective_func, constraint_func, x, p, lam, kappa, precondStrategy=None): @@ -173,19 +173,19 @@

Source code for optimism.ConstrainedObjective

self.jit_constraint_func = jit(constraint_func) - def ncp_func(x, p, l): + def ncp_func(x, p, l): c = constraint_func(x, p) return vmap(fischer_burmeister)(c, l, self.constraintKappa) self.jit_ncp_func = jit(ncp_func) - def ncp_hess(x, p, l): + def ncp_hess(x, p, l): c = constraint_func(x, p) return vmap(fischer_burmeister_jac_l)(c, l, self.constraintKappa) self.jit_ncp_hess = jit(ncp_hess) - def hres_all_args(x, p, l, k): + def hres_all_args(x, p, l, k): return np.hstack( (grad_x(x,p,l,k), ncp_func(x,p,l) ) ) @@ -204,8 +204,8 @@

Source code for optimism.ConstrainedObjective

[docs] - def create_augmented_lagrangian(self, objective_func, constraint_func): - def f(x, p, l, k): + def create_augmented_lagrangian(self, objective_func, constraint_func): + def f(x, p, l, k): c = constraint_func(x, p) penalty = np.where( l >= k*c, -c*l + 0.5*k*c*c, @@ -217,77 +217,77 @@

Source code for optimism.ConstrainedObjective

[docs] - def value(self, x): + def value(self, x): return self.jit_objective(x, self.p, self.lam, self.kappa)
[docs] - def gradient(self, x): + def gradient(self, x): return self.jit_grad_x(x, self.p, self.lam, self.kappa)
[docs] - def gradient_p(self, x): + def gradient_p(self, x): return self.jit_grad_p(x, self.p, self.lam, self.kappa)
[docs] - def gradient_l(self, x): + def gradient_l(self, x): return self.jit_grad_l(x, self.p, self.lam, self.kappa)
[docs] - def hessian(self, x): + def hessian(self, x): return self.jit_hess(x, self.p, self.lam, self.kappa)
[docs] - def hessian_vec(self, x, vx): + def hessian_vec(self, x, vx): return self.jit_hess_vec(x, self.p, self.lam, self.kappa, vx)
[docs] - def jacobian_p_vec(self, x, vp): + def jacobian_p_vec(self, x, vp): return self.jit_jac_xp_vec(x, self.p, self.lam, self.kappa, vp)
[docs] - def jacobian_l_vec(self, x, vl): + def jacobian_l_vec(self, x, vl): return self.jit_jac_xl_vec(x, self.p, self.lam, self.kappa, vl)
[docs] - def constraint(self, x): + def constraint(self, x): return self.jit_constraint_func(x, self.p)
[docs] - def ncp(self, x): + def ncp(self, x): return self.jit_ncp_func(x, self.p, self.lam)
[docs] - def ncp_hessian(self, x): + def ncp_hessian(self, x): return self.jit_ncp_hess(x, self.p, self.lam)
@@ -295,41 +295,41 @@

Source code for optimism.ConstrainedObjective

[docs] - def constrained_residual(self, xl): + def constrained_residual(self, xl): return self.jit_hres(xl, self.p, self.kappa)
[docs] - def constrained_jacobian_vec(self, xl, vxl): + def constrained_jacobian_vec(self, xl, vxl): return self.jit_hres_jac_vec(xl, self.p, self.kappa, vxl)
[docs] - def constrained_jacobian_p_vec(self, xl, vp): + def constrained_jacobian_p_vec(self, xl, vp): return self.jit_hres_jac_p_vec(xl, self.p, self.kappa, vp)
[docs] - def total_residual(self, x): + def total_residual(self, x): return self.constrained_residual(np.hstack((x,self.lam)))
[docs] - def update_precond(self, x): + def update_precond(self, x): if self.precondStrategy==None: print('Updating with dense preconditioner in ConstrainedObjective.') K = csc_matrix(self.hessian(x)) d = np.array(K.diagonal()) - def stiffness_at_attempt(attempt): + def stiffness_at_attempt(attempt): if attempt==0: return K else: @@ -346,7 +346,7 @@

Source code for optimism.ConstrainedObjective

[docs] - def reset_kappa(self): + def reset_kappa(self): self.kappa = np.array(self.constraintKappa)
@@ -354,12 +354,12 @@

Source code for optimism.ConstrainedObjective

[docs] -class ConstrainedQuasiObjective(ConstrainedObjective): +class ConstrainedQuasiObjective(ConstrainedObjective):
[docs] - def create_augmented_lagrangian(self, objective_func, constraint_func): - def f(x, p, l, k): + def create_augmented_lagrangian(self, objective_func, constraint_func): + def f(x, p, l, k): c = constraint_func(x, p) penalty = np.where( l > k*c, -c*l + 0.5*k*c*c, @@ -369,7 +369,7 @@

Source code for optimism.ConstrainedObjective

def __init__(self, + def __init__(self, objective_func, constraint_func, x, p, lam, kappa, precondStrategy=None): diff --git a/_modules/optimism/EquationSolver.html b/_modules/optimism/EquationSolver.html index a639e1c5..718e46fa 100644 --- a/_modules/optimism/EquationSolver.html +++ b/_modules/optimism/EquationSolver.html @@ -6,7 +6,7 @@ optimism.EquationSolver — optimism 0.1.0 documentation - + @@ -14,7 +14,7 @@ - + @@ -73,12 +73,12 @@

Source code for optimism.EquationSolver

-from optimism.JaxConfig import *
-import optimism.LU as LU
-from optimism.Timer import Timer
-from optimism import WarmStart
-from scipy.sparse import save_npz
-from scipy.sparse.linalg import LinearOperator, gmres
+from optimism.JaxConfig import *
+import optimism.LU as LU
+from optimism.Timer import Timer
+from optimism import WarmStart
+from scipy.sparse import save_npz
+from scipy.sparse.linalg import LinearOperator, gmres
 
 
 Settings = namedtuple('Settings', ['t1','t2','eta1','eta2','eta3','max_trust_iters','tol','max_cg_iters','max_cumulative_cg_iters','cg_tol','cg_inexact_solve_ratio','tr_size','min_tr_size','check_stability','use_preconditioned_inner_product_for_cg','use_incremental_objective','debug_info','over_iters'])
@@ -87,7 +87,7 @@ 

Source code for optimism.EquationSolver

 # consider changing to 0.5, 1.75, 1e-9, 0.1, 0.75
 
[docs] -def get_settings(t1=0.25, t2=1.75, eta1=1e-10, eta2=0.1, eta3=0.5, +def get_settings(t1=0.25, t2=1.75, eta1=1e-10, eta2=0.1, eta3=0.5, max_trust_iters=100, tol=1e-8, max_cg_iters=50, @@ -123,7 +123,7 @@

Source code for optimism.EquationSolver

 
 
[docs] -def settings_with_new_tol(oldSettings, newTol): +def settings_with_new_tol(oldSettings, newTol): newSettings = Settings(t1=oldSettings.t1, t2=oldSettings.t2, eta1=oldSettings.eta1, @@ -155,14 +155,14 @@

Source code for optimism.EquationSolver

 
 
[docs] -def is_on_boundary(stepType): +def is_on_boundary(stepType): return stepType==boundaryString or stepType==negCurveString
[docs] -def project_to_boundary(z, d, trSize, zz): +def project_to_boundary(z, d, trSize, zz): # find tau s.t. (z + tau*d)^2 = trSize^2 dd = np.dot(d,d) zd = np.dot(z,d) @@ -174,7 +174,7 @@

Source code for optimism.EquationSolver

 
 
[docs] -def preconditioned_project_to_boundary(z, d, trSize, zz, mult_by_approx_hessian): +def preconditioned_project_to_boundary(z, d, trSize, zz, mult_by_approx_hessian): # find tau s.t. (z + tau*d)^2 = trSize^2 Pd = mult_by_approx_hessian(d) dd = np.dot(d,Pd) @@ -187,7 +187,7 @@

Source code for optimism.EquationSolver

 
 
[docs] -def project_to_boundary_with_coefs(z, d, trSize, zz, zd, dd): +def project_to_boundary_with_coefs(z, d, trSize, zz, zd, dd): # find tau s.t. (z + tau*d)^2 = trSize^2 tau = (np.sqrt( (trSize**2-zz)*dd + zd**2 ) - zd)/dd return z + tau*d
@@ -196,14 +196,14 @@

Source code for optimism.EquationSolver

 
 
[docs] -def update_step_length_squared(alpha, zz, zd, dd): +def update_step_length_squared(alpha, zz, zd, dd): return zz + 2*alpha*zd + alpha*alpha*dd
[docs] -def cg_inner_products_preconditioned(alpha, beta, zd, dd, rPr, z, d): +def cg_inner_products_preconditioned(alpha, beta, zd, dd, rPr, z, d): # recurrence formulas from Gould et al. doi:10.1137/S1052623497322735 zd = beta * ( zd + alpha*dd ) dd = rPr + beta*beta*dd @@ -213,7 +213,7 @@

Source code for optimism.EquationSolver

 
 
[docs] -def cg_inner_products_unpreconditioned(alpha, beta, zd, dd, rPr, z, d): +def cg_inner_products_unpreconditioned(alpha, beta, zd, dd, rPr, z, d): zd = z @ d dd = d @ d return zd, dd
@@ -223,7 +223,7 @@

Source code for optimism.EquationSolver

 # returns increment of solution and True if the entire system is solved
 
[docs] -def solve_trust_region_equality_constraint(x, g, J, trSize, settings): +def solve_trust_region_equality_constraint(x, g, J, trSize, settings): # minimuze 0.5*(J*z+g)^2 r = J.multiply_by_transpose( J.solve_transpose(J.solve(g)) ) @@ -266,7 +266,7 @@

Source code for optimism.EquationSolver

 
 
[docs] -def solve_trust_region_minimization(x, r, hess_vec_func, precond, trSize, settings): +def solve_trust_region_minimization(x, r, hess_vec_func, precond, trSize, settings): # minimize r@z + 0.5*z@J@z z = 0.*x zz = 0. @@ -331,7 +331,7 @@

Source code for optimism.EquationSolver

 # essentially deprecated