optimtool 2.9.0__tar.gz → 2.9.1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (38) hide show
  1. {optimtool-2.9.0 → optimtool-2.9.1}/PKG-INFO +2 -2
  2. {optimtool-2.9.0 → optimtool-2.9.1}/README.md +1 -1
  3. {optimtool-2.9.0 → optimtool-2.9.1}/optimtool/__init__.py +1 -1
  4. {optimtool-2.9.0 → optimtool-2.9.1}/optimtool/_drive.py +9 -14
  5. {optimtool-2.9.0 → optimtool-2.9.1}/optimtool/_version.py +1 -1
  6. {optimtool-2.9.0 → optimtool-2.9.1}/optimtool/constrain/mixequal.py +4 -2
  7. {optimtool-2.9.0 → optimtool-2.9.1}/optimtool/constrain/unequal.py +4 -2
  8. {optimtool-2.9.0 → optimtool-2.9.1}/optimtool/unconstrain/gradient_descent.py +1 -1
  9. {optimtool-2.9.0 → optimtool-2.9.1}/optimtool.egg-info/PKG-INFO +2 -2
  10. {optimtool-2.9.0 → optimtool-2.9.1}/setup.py +1 -1
  11. {optimtool-2.9.0 → optimtool-2.9.1}/LICENSE +0 -0
  12. {optimtool-2.9.0 → optimtool-2.9.1}/optimtool/_convert.py +0 -0
  13. {optimtool-2.9.0 → optimtool-2.9.1}/optimtool/_kernel.py +0 -0
  14. {optimtool-2.9.0 → optimtool-2.9.1}/optimtool/_proxim.py +0 -0
  15. {optimtool-2.9.0 → optimtool-2.9.1}/optimtool/_search.py +0 -0
  16. {optimtool-2.9.0 → optimtool-2.9.1}/optimtool/_typing.py +0 -0
  17. {optimtool-2.9.0 → optimtool-2.9.1}/optimtool/_utils.py +0 -0
  18. {optimtool-2.9.0 → optimtool-2.9.1}/optimtool/base.py +0 -0
  19. {optimtool-2.9.0 → optimtool-2.9.1}/optimtool/constrain/__init__.py +0 -0
  20. {optimtool-2.9.0 → optimtool-2.9.1}/optimtool/constrain/equal.py +0 -0
  21. {optimtool-2.9.0 → optimtool-2.9.1}/optimtool/example/Lasso.py +0 -0
  22. {optimtool-2.9.0 → optimtool-2.9.1}/optimtool/example/WanYuan.py +0 -0
  23. {optimtool-2.9.0 → optimtool-2.9.1}/optimtool/example/__init__.py +0 -0
  24. {optimtool-2.9.0 → optimtool-2.9.1}/optimtool/hybrid/__init__.py +0 -0
  25. {optimtool-2.9.0 → optimtool-2.9.1}/optimtool/hybrid/approt.py +0 -0
  26. {optimtool-2.9.0 → optimtool-2.9.1}/optimtool/hybrid/fista.py +0 -0
  27. {optimtool-2.9.0 → optimtool-2.9.1}/optimtool/hybrid/nesterov.py +0 -0
  28. {optimtool-2.9.0 → optimtool-2.9.1}/optimtool/unconstrain/__init__.py +0 -0
  29. {optimtool-2.9.0 → optimtool-2.9.1}/optimtool/unconstrain/newton.py +0 -0
  30. {optimtool-2.9.0 → optimtool-2.9.1}/optimtool/unconstrain/newton_quasi.py +0 -0
  31. {optimtool-2.9.0 → optimtool-2.9.1}/optimtool/unconstrain/nonlinear_least_square.py +0 -0
  32. {optimtool-2.9.0 → optimtool-2.9.1}/optimtool/unconstrain/trust_region.py +0 -0
  33. {optimtool-2.9.0 → optimtool-2.9.1}/optimtool.egg-info/SOURCES.txt +0 -0
  34. {optimtool-2.9.0 → optimtool-2.9.1}/optimtool.egg-info/dependency_links.txt +0 -0
  35. {optimtool-2.9.0 → optimtool-2.9.1}/optimtool.egg-info/not-zip-safe +0 -0
  36. {optimtool-2.9.0 → optimtool-2.9.1}/optimtool.egg-info/requires.txt +0 -0
  37. {optimtool-2.9.0 → optimtool-2.9.1}/optimtool.egg-info/top_level.txt +0 -0
  38. {optimtool-2.9.0 → optimtool-2.9.1}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: optimtool
3
- Version: 2.9.0
3
+ Version: 2.9.1
4
4
  Summary: The fundamental package for scientific research in optimization.
5
5
  Home-page: https://github.com/linjing-lab/optimtool
6
6
  Download-URL: https://github.com/linjing-lab/optimtool/tags
@@ -61,7 +61,7 @@ License-File: LICENSE
61
61
  author = {Lin, Jing},
62
62
  title = {optimtool: The fundamental package for scientific research in optimization.},
63
63
  year = {2021},
64
- version = {2.8.3},
64
+ version = {2.9.1},
65
65
  publisher = {PyPI},
66
66
  organization = {linjing-lab},
67
67
  url = {https://pypi.org/project/optimtool/},
@@ -32,7 +32,7 @@
32
32
  author = {Lin, Jing},
33
33
  title = {optimtool: The fundamental package for scientific research in optimization.},
34
34
  year = {2021},
35
- version = {2.8.3},
35
+ version = {2.9.1},
36
36
  publisher = {PyPI},
37
37
  organization = {linjing-lab},
38
38
  url = {https://pypi.org/project/optimtool/},
@@ -32,4 +32,4 @@ from .base import MATPLOTLIB_VERSION
32
32
  from ._version import __version__
33
33
 
34
34
  if sys.version_info < (3, 7, 0):
35
- raise OSError(f'optimtool-2.8.2 requires Python >=3.7, but yours is {sys.version}')
35
+ raise OSError(f'optimtool-2.9.1 requires Python >=3.7, but yours is {sys.version}')
@@ -167,40 +167,35 @@ def cons_unequal_L(cons_unequal: SympyMutableDenseMatrix,
167
167
  sub = sub - (muk[i] / sigma)**2
168
168
  return sp.Matrix([sub])
169
169
 
170
- def v_k(cons_equal: SympyMutableDenseMatrix,
171
- cons_unequal: SympyMutableDenseMatrix,
172
- args: SympyMutableDenseMatrix,
170
+ def v_k(cons_equal_num,
171
+ cons_unequal_num,
172
+ len_cons: int,
173
173
  muk: NDArray,
174
174
  sigma: float,
175
175
  x_0: IterPointType) -> DataType:
176
176
  sub = 0.
177
177
  # reps = dict(zip(args, x_0))
178
- len_unequal = cons_unequal.shape[0]
179
- cons_unequal_num = sp.lambdify(args, cons_unequal, modules='numpy')
180
178
  consv_unequal = cons_unequal_num(*x_0)
181
179
  # consv_unequal = np.array(cons_unequal.subs(reps)).astype(DataType)
182
- if cons_equal is not None:
183
- cons_equal_num = sp.lambdify(args, cons_equal, modules='numpy')
180
+ if cons_equal_num is not None:
184
181
  consv_equal = cons_equal_num(*x_0)
185
182
  # consv_equal = np.array(cons_equal.subs(reps)).astype(DataType)
186
183
  sub += (consv_equal.T).dot(consv_equal)
187
- for i in range(len_unequal):
184
+ for i in range(len_cons):
188
185
  sub += (max(consv_unequal[i], - muk[i] / sigma))**2
189
186
  else:
190
- for i in range(len_unequal):
187
+ for i in range(len_cons):
191
188
  sub += (max(consv_unequal[i], - muk[i] / sigma))**2
192
189
  return np.sqrt(sub)
193
190
 
194
- def renew_mu_k(cons_unequal: SympyMutableDenseMatrix,
195
- args: SympyMutableDenseMatrix,
191
+ def renew_mu_k(cons_unequal_num,
192
+ len_cons: int,
196
193
  muk: NDArray,
197
194
  sigma: float,
198
195
  x_0: IterPointType) -> NDArray:
199
196
  # reps = dict(zip(args, x_0))
200
- len_unequal = cons_unequal.shape[0]
201
- cons_unequal_num = sp.lambdify(args, cons_unequal, modules='numpy')
202
197
  consv_unequal = cons_unequal_num(*x_0)
203
- for i in range(len_unequal):
198
+ for i in range(len_cons):
204
199
  muk[i] = max(muk[i] + sigma * consv_unequal[i], 0)
205
200
  return muk
206
201
 
@@ -18,4 +18,4 @@
18
18
  # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19
19
  # SOFTWARE.
20
20
 
21
- __version__ = '2.9.0'
21
+ __version__ = '2.9.1'
@@ -208,6 +208,8 @@ def lagrange_augmentedm(funcs: FuncArray,
208
208
  lamk = np.array([lamk for _ in range(cons_equal.shape[0])]).reshape(cons_equal.shape[0], 1)
209
209
  muk = np.array([muk for _ in range(cons_unequal.shape[0])]).reshape(cons_unequal.shape[0], 1)
210
210
  cons_equal_num = sp.lambdify(args, cons_equal, modules='numpy')
211
+ len_cons_unequal = len(cons_unequal)
212
+ cons_unequal_num = sp.lambdify(args, cons_unequal, modules='numpy')
211
213
  while 1:
212
214
  f.append(get_value(funcs_num, x_0))
213
215
  if verbose:
@@ -218,7 +220,7 @@ def lagrange_augmentedm(funcs: FuncArray,
218
220
  L = sp.Matrix([funcs + (sigma / 2) * (cons_equal.T * cons_equal + cons_uneuqal_modifyed) + cons_equal.T * lamk])
219
221
  x_0, _ = search(L, args, tuple(x_0), draw=False, epsilon=epsilonk)
220
222
  k += 1
221
- vkx = v_k(cons_equal, cons_unequal, args, muk, sigma, x_0)
223
+ vkx = v_k(cons_equal_num, cons_unequal_num, len_cons_unequal, muk, sigma, x_0)
222
224
  if vkx <= epsilonk:
223
225
  res = L.jacobian(args)
224
226
  res_num = sp.lambdify(args, res, modules='numpy')
@@ -230,7 +232,7 @@ def lagrange_augmentedm(funcs: FuncArray,
230
232
  else:
231
233
  consv_equal = cons_equal_num(*x_0)
232
234
  lamk += sigma * consv_equal
233
- muk = renew_mu_k(cons_unequal, args, muk, sigma, x_0)
235
+ muk = renew_mu_k(cons_unequal_num, len_cons_unequal, muk, sigma, x_0)
234
236
  etak /= sigma
235
237
  epsilonk /= sigma**beta
236
238
  else:
@@ -135,6 +135,8 @@ def lagrange_augmentedu(funcs: FuncArray,
135
135
  funcs_num = sp.lambdify(args, funcs, modules='numpy')
136
136
  search, f = kernel(method), []
137
137
  muk = np.array([muk for _ in range(cons.shape[0])]).reshape(cons.shape[0], 1)
138
+ len_cons = len(cons)
139
+ cons_unequal_num = sp.lambdify(args, cons, modules='numpy')
138
140
  while 1:
139
141
  f.append(get_value(funcs_num, x_0))
140
142
  if verbose:
@@ -145,7 +147,7 @@ def lagrange_augmentedu(funcs: FuncArray,
145
147
  L = sp.Matrix([funcs + (sigma / 2) * cons_uneuqal_modifyed])
146
148
  x_0, _ = search(L, args, tuple(x_0), draw=False, epsilon=epsilonk)
147
149
  k += 1
148
- vkx = v_k(None, cons, args, muk, sigma, x_0)
150
+ vkx = v_k(None, cons_unequal_num, len_cons, muk, sigma, x_0)
149
151
  if vkx <= epsilonk:
150
152
  res = L.jacobian(args)
151
153
  res_num = sp.lambdify(args, res, modules='numpy')
@@ -155,7 +157,7 @@ def lagrange_augmentedu(funcs: FuncArray,
155
157
  print("{}\t{}\t{}".format(x_0, f[-1], k))
156
158
  break
157
159
  else:
158
- muk = renew_mu_k(cons, args, muk, sigma, x_0)
160
+ muk = renew_mu_k(cons_unequal_num, len_cons, muk, sigma, x_0)
159
161
  etak /= sigma
160
162
  epsilonk /= sigma**beta
161
163
  else:
@@ -178,7 +178,7 @@ def barzilar_borwein(funcs: FuncArray,
178
178
  yk = res_num(*x_0) + dk
179
179
  alpha_up = delta.dot(delta.T)
180
180
  alpha_down = (delta.dot(yk.T))[0]
181
- if alpha_down != 0:
181
+ if alpha_down > 0:
182
182
  alpha = alpha_up / alpha_down
183
183
  k += 1
184
184
  else:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: optimtool
3
- Version: 2.9.0
3
+ Version: 2.9.1
4
4
  Summary: The fundamental package for scientific research in optimization.
5
5
  Home-page: https://github.com/linjing-lab/optimtool
6
6
  Download-URL: https://github.com/linjing-lab/optimtool/tags
@@ -61,7 +61,7 @@ License-File: LICENSE
61
61
  author = {Lin, Jing},
62
62
  title = {optimtool: The fundamental package for scientific research in optimization.},
63
63
  year = {2021},
64
- version = {2.8.3},
64
+ version = {2.9.1},
65
65
  publisher = {PyPI},
66
66
  organization = {linjing-lab},
67
67
  url = {https://pypi.org/project/optimtool/},
@@ -4,7 +4,7 @@ import sys
4
4
  from setuptools import setup
5
5
 
6
6
  if sys.version_info < (3, 7, 0):
7
- raise OSError(f'optimtool-2.8.2 requires Python >=3.7, but yours is {sys.version}')
7
+ raise OSError(f'optimtool-2.9.1 requires Python >=3.7, but yours is {sys.version}')
8
8
 
9
9
  if (3, 7, 0) <= sys.version_info < (3, 8, 0):
10
10
  # https://github.com/pypa/setuptools/issues/926#issuecomment-294369342
File without changes
File without changes
File without changes
File without changes