Skip to content

Commit

Permalink
New version
Browse files Browse the repository at this point in the history
  • Loading branch information
thieu1995 committed Dec 7, 2019
1 parent 7e794e9 commit 2507c58
Show file tree
Hide file tree
Showing 5 changed files with 62 additions and 4 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Pycharm
.idea/

tut_upcode.md
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ print(func2d._bird__(solution))

### Documentation
```code
0. A Literature Survey of Benchmark Functions For Global Optimization Problems (2013)
1. http://benchmarkfcns.xyz/fcns
2. https://en.wikipedia.org/wiki/Test_functions_for_optimization
3. https://www.cs.unm.edu/~neal.holts/dga/benchmarkFunction/
Expand Down
29 changes: 29 additions & 0 deletions opfunu/benchmark1d.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#!/usr/bin/env python #
# ------------------------------------------------------------------------------------------------------#
# Created by "Thieu Nguyen" at 02:52, 07/12/2019 #
# #
# Email: [email protected] #
# Homepage: https://www.researchgate.net/profile/Thieu_Nguyen6 #
# Github: https://github.com/thieunguyen5991 #
#-------------------------------------------------------------------------------------------------------#


import numpy as np

class Functions:
"""
This class of functions is belongs to 1-dimensional space
"""

def _gramacy_lee__(self, solution=None):
"""
Class: uni-modal, non-convex, continuous
Global: 1 global minimum fx = −0.869011134989500, atx 0.548563444114526
Link: http://benchmarkfcns.xyz/benchmarkfcns/gramacyleefcn.html
@param solution: A numpy array include 1 items like: [0.5], limited range: [-0.5, 2.5]
"""
n = len(solution)
assert (n == 1, 'Gramacy and Lee function is only defined on a 1D space.')
return np.sin(10*np.pi*solution) / (2*solution) + (solution-1)**4
28 changes: 28 additions & 0 deletions opfunu/benchmark3d.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#!/usr/bin/env python #
# ------------------------------------------------------------------------------------------------------#
# Created by "Thieu Nguyen" at 02:52, 07/12/2019 #
# #
# Email: [email protected] #
# Homepage: https://www.researchgate.net/profile/Thieu_Nguyen6 #
# Github: https://github.com/thieunguyen5991 #
#-------------------------------------------------------------------------------------------------------#


import numpy as np

class Functions:
"""
This class of functions is belongs to 3-dimensional space
"""

def _wolfe__(self, solution=None):
"""
Class: multi-modal, non-convex, continuous, differentiable, non-separable
Global: 1 global minimum fx = 0, [0, 0, 0]
Link: http://benchmarkfcns.xyz/benchmarkfcns/wolfefcn.html
@param solution: A numpy array include 3 items like: [0.2, 0.22, 0.5], limited range: [0, 2]
"""
n = len(solution)
assert (n == 3, 'Wolfe function is only defined on a 3D space.')
return 4/3 * (solution[0]**2 + solution[1]**2 - solution[0]*solution[1])**0.75 + solution[2]
6 changes: 3 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ def readme():

setup(
name="opfunu",
version="0.2.0",
description="A python package for Optimization Functions in Numpy.",
version="0.2.1",
description="A python (Numpy) package for Un-constrained Optimization Functions",
long_description=readme(),
long_description_content_type="text/markdown",
url="https://github.com/thieunguyen5991/opfunu",
download_url="https://github.com/thieunguyen5991/opfunu/archive/v.0.2.0.zip",
download_url="https://github.com/thieunguyen5991/opfunu/archive/v.0.2.1.zip",
author="Thieu Nguyen",
author_email="[email protected]",
license="Apache License, Version 2.0",
Expand Down

0 comments on commit 2507c58

Please sign in to comment.