Skip to content

Commit 25b683d

Browse files
committed
release v2.5.0rc0 [optimtool.hybrid in beta]
1 parent 3e92f24 commit 25b683d

File tree

11 files changed

+113
-28
lines changed

11 files changed

+113
-28
lines changed

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,9 @@ pip install optimtool --upgrade
5656
|-- WanYuan.py
5757
|-- hybrid
5858
|-- __init__.py
59+
|-- approt.py
60+
|-- fista.py
61+
|-- nesterov.py
5962
|-- unconstrain
6063
|-- __init__.py
6164
|-- gradient_descent.py
@@ -67,6 +70,7 @@ pip install optimtool --upgrade
6770
|-- _convert.py
6871
|-- _drive.py
6972
|-- _kernel.py
73+
|-- _proxim.py
7074
|-- _search.py
7175
|-- _typing.py
7276
|-- _utils.py

README_en.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ pip install optimtool --upgrade
6767
|-- _convert.py
6868
|-- _drive.py
6969
|-- _kernel.py
70+
|-- _proxim.py
7071
|-- _search.py
7172
|-- _typing.py
7273
|-- _utils.py

optimtool/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,4 +32,4 @@
3232
from ._version import __version__
3333

3434
if sys.version_info < (3, 7, 0):
35-
raise OSError(f'optimtool-2.4.4 requires Python >=3.7, but yours is {sys.version}')
35+
raise OSError(f'optimtool-2.5.0rc0 requires Python >=3.7, but yours is {sys.version}')

optimtool/_proxim.py

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# Copyright (c) 2021 linjing-lab
2+
#
3+
# Permission is hereby granted, free of charge, to any person obtaining a copy
4+
# of this software and associated documentation files (the "Software"), to deal
5+
# in the Software without restriction, including without limitation the rights
6+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7+
# copies of the Software, and to permit persons to whom the Software is
8+
# furnished to do so, subject to the following conditions:
9+
#
10+
# The above copyright notice and this permission notice shall be included in all
11+
# copies or substantial portions of the Software.
12+
#
13+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19+
# SOFTWARE.
20+
21+
from .base import np
22+
23+
l1 = lambda delta, tk: np.sign(delta) * np.max(np.abs(delta) - tk, 0)
24+
25+
l2 = lambda delta, norm, tk: (1 - tk / norm) * delta if norm > tk else 0
26+
27+
ln = lambda delta, tk: (delta + np.sqrt(delta**2 + 4 * tk)) / 2 # association appears in 2.5.0

optimtool/_version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,4 @@
1818
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
1919
# SOFTWARE.
2020

21-
__version__ = '2.4.4'
21+
__version__ = '2.5.0rc0'

optimtool/hybrid/__init__.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,5 +18,13 @@
1818
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
1919
# SOFTWARE.
2020

21-
from . import approximate_point_gradient
22-
# appear in v2.5.0
21+
from . import approt
22+
from . import fista
23+
from . import nesterov
24+
25+
26+
__hybrid__ = {
27+
'Approximate Points': approt.__all__,
28+
'FISTA': fista.__all__,
29+
'Nesterov': nesterov.__all__
30+
} # access in v2.5.0

optimtool/hybrid/approt.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Copyright (c) 2021 linjing-lab
2+
#
3+
# Permission is hereby granted, free of charge, to any person obtaining a copy
4+
# of this software and associated documentation files (the "Software"), to deal
5+
# in the Software without restriction, including without limitation the rights
6+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7+
# copies of the Software, and to permit persons to whom the Software is
8+
# furnished to do so, subject to the following conditions:
9+
#
10+
# The above copyright notice and this permission notice shall be included in all
11+
# copies or substantial portions of the Software.
12+
#
13+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19+
# SOFTWARE.
20+
21+
__all__ = [] # access in v2.5.0

optimtool/hybrid/fista.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Copyright (c) 2021 linjing-lab
2+
#
3+
# Permission is hereby granted, free of charge, to any person obtaining a copy
4+
# of this software and associated documentation files (the "Software"), to deal
5+
# in the Software without restriction, including without limitation the rights
6+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7+
# copies of the Software, and to permit persons to whom the Software is
8+
# furnished to do so, subject to the following conditions:
9+
#
10+
# The above copyright notice and this permission notice shall be included in all
11+
# copies or substantial portions of the Software.
12+
#
13+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19+
# SOFTWARE.
20+
21+
__all__ = [] # access in v2.5.0

optimtool/hybrid/nesterov.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Copyright (c) 2021 linjing-lab
2+
#
3+
# Permission is hereby granted, free of charge, to any person obtaining a copy
4+
# of this software and associated documentation files (the "Software"), to deal
5+
# in the Software without restriction, including without limitation the rights
6+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7+
# copies of the Software, and to permit persons to whom the Software is
8+
# furnished to do so, subject to the following conditions:
9+
#
10+
# The above copyright notice and this permission notice shall be included in all
11+
# copies or substantial portions of the Software.
12+
#
13+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19+
# SOFTWARE.
20+
21+
__all__ = [] # access in v2.5.0

setup.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
from setuptools import setup
55

66
if sys.version_info < (3, 7, 0):
7-
raise OSError(f'optimtool-2.4.4 requires Python >=3.7, but yours is {sys.version}')
7+
raise OSError(f'optimtool-2.5.0rc0 requires Python >=3.7, but yours is {sys.version}')
88

99
if (3, 7, 0) <= sys.version_info < (3, 8, 0):
1010
# https://github.com/pypa/setuptools/issues/926#issuecomment-294369342
@@ -34,7 +34,7 @@
3434
_long_description = fp.read()
3535
except FileNotFoundError:
3636
_long_description = ''
37-
37+
3838
setup(
3939
name='optimtool', # pkg_name
4040
packages=[
@@ -77,10 +77,10 @@
7777
'Topic :: Software Development :: Libraries',
7878
'Topic :: Software Development :: Libraries :: Python Modules',
7979
],
80-
install_requires = [
80+
install_requires=[
8181
'numpy>=1.21.0',
8282
'sympy>=1.9',
8383
'matplotlib>=3.2.0'
8484
],
85-
# extras_require = []
85+
# extras_require=[]
8686
)

tests/hybrid/_hybrid.ipynb

Lines changed: 2 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,8 @@
77
"metadata": {},
88
"outputs": [],
99
"source": [
10-
"# load important dependencies \n",
11-
"import numpy as np\n",
12-
"import sympy as sp\n",
13-
"import matplotlib.pyplot as plt"
10+
"import optimtool as oo\n",
11+
"from optimtool.base import np, sp, plt"
1412
]
1513
},
1614
{
@@ -30,22 +28,6 @@
3028
"source": [
3129
"import optimtool.hybrid as oh"
3230
]
33-
},
34-
{
35-
"cell_type": "markdown",
36-
"id": "2b7ce89f-6339-4567-9513-7435d1a0fb68",
37-
"metadata": {},
38-
"source": [
39-
"## 近似点梯度下降法(approximate_point_gradient)"
40-
]
41-
},
42-
{
43-
"cell_type": "code",
44-
"execution_count": null,
45-
"id": "19979307",
46-
"metadata": {},
47-
"outputs": [],
48-
"source": []
4931
}
5032
],
5133
"metadata": {

0 commit comments

Comments
 (0)