diff --git a/.travis.yml b/.travis.yml index 0d83694..dd1cf80 100644 --- a/.travis.yml +++ b/.travis.yml @@ -22,7 +22,7 @@ script: - coverage run -p examples/demo_sa_tsp.py examples/data/nctu.csv - coverage run -p examples/demo_aca_tsp.py - coverage run -p examples/demo_ia.py - - coverage run -p examples/demo_asfs.py + - coverage run -p examples/demo_afsa.py - coverage run -p examples/demo_pso_ani.py - coverage run -p examples/demo_de.py diff --git a/README.md b/README.md index 5d7185b..81b30af 100644 --- a/README.md +++ b/README.md @@ -451,19 +451,19 @@ print('best routine:', best_points, 'best_distance:', best_distance) ![IA](https://github.com/guofei9987/pictures_for_blog/blob/master/heuristic_algorithm/ia2.png?raw=true) -## 7. artificial fish swarm algorithm (AFSA) --> Demo code: [examples/demo_asfs.py#s1](https://github.com/guofei9987/scikit-opt/blob/master/examples/demo_asfs.py#L1) +## 7. Artificial Fish Swarm Algorithm (AFSA) +-> Demo code: [examples/demo_afsa.py#s1](https://github.com/guofei9987/scikit-opt/blob/master/examples/demo_afsa.py#L1) ```python def func(x): x1, x2 = x return 1 / x1 ** 2 + x1 ** 2 + 1 / x2 ** 2 + x2 ** 2 -from sko.ASFA import ASFA +from sko.AFSA import AFSA -asfa = ASFA(func, n_dim=2, size_pop=50, max_iter=300, +afsa = AFSA(func, n_dim=2, size_pop=50, max_iter=300, max_try_num=100, step=0.5, visual=0.3, q=0.98, delta=0.5) -best_x, best_y = asfa.run() +best_x, best_y = afsa.run() print(best_x, best_y) ``` diff --git a/docs/en/README.md b/docs/en/README.md index 67984f1..7131f2e 100644 --- a/docs/en/README.md +++ b/docs/en/README.md @@ -32,10 +32,6 @@ cd scikit-opt pip install . ``` -## News: -All algorithms will be available on ~~/Spark/Pytorch~~ **TensorFlow** on version ~~0.4~~ **1.x**, getting parallel performance. -Have fun! - ### Feature1: UDF @@ -92,10 +88,9 @@ print('best_x:', best_x, '\n', 'best_y:', best_y) ``` > Until Now, the **udf** surport `crossover`, `mutation`, `selection`, `ranking` of GA - > scikit-opt provide a dozen of operators, see [here](https://github.com/guofei9987/scikit-opt/tree/master/sko/operators) -> For advanced users, there is another OOP style: +For advanced users: -> Demo code: [examples/demo_ga_udf.py#s6](https://github.com/guofei9987/scikit-opt/blob/master/examples/demo_ga_udf.py#L31) ```python @@ -118,8 +113,11 @@ my_ga = MyGA(func=demo_func, n_dim=3, size_pop=100, max_iter=500, lb=[-1, -10, - best_x, best_y = my_ga.run() print('best_x:', best_x, '\n', 'best_y:', best_y) ``` +### feature2: GPU computation + We are developing GPU computation, which will be stable on version 1.0.0 +An example is already available: [https://github.com/guofei9987/scikit-opt/blob/master/examples/demo_ga_gpu.py](https://github.com/guofei9987/scikit-opt/blob/master/examples/demo_ga_gpu.py) -### feature2: continue to run +### feature3: continue to run (New in version 0.3.6) Run an algorithm for 10 iterations, and then run another 20 iterations base on the 10 iterations before: ```python @@ -433,19 +431,19 @@ print('best routine:', best_points, 'best_distance:', best_distance) ![IA](https://github.com/guofei9987/pictures_for_blog/blob/master/heuristic_algorithm/ia2.png?raw=true) -## 7. artificial fish swarm algorithm (AFSA) --> Demo code: [examples/demo_asfs.py#s1](https://github.com/guofei9987/scikit-opt/blob/master/examples/demo_asfs.py#L1) +## 7. Artificial Fish Swarm Algorithm (AFSA) +-> Demo code: [examples/demo_afsa.py#s1](https://github.com/guofei9987/scikit-opt/blob/master/examples/demo_afsa.py#L1) ```python def func(x): x1, x2 = x return 1 / x1 ** 2 + x1 ** 2 + 1 / x2 ** 2 + x2 ** 2 -from sko.ASFA import ASFA +from sko.AFSA import AFSA -asfa = ASFA(func, n_dim=2, size_pop=50, max_iter=300, +afsa = AFSA(func, n_dim=2, size_pop=50, max_iter=300, max_try_num=100, step=0.5, visual=0.3, q=0.98, delta=0.5) -best_x, best_y = asfa.run() +best_x, best_y = afsa.run() print(best_x, best_y) ``` diff --git a/docs/zh/README.md b/docs/zh/README.md index 8ea3dcf..cc6b6fe 100644 --- a/docs/zh/README.md +++ b/docs/zh/README.md @@ -420,19 +420,19 @@ print('best routine:', best_points, 'best_distance:', best_distance) ## 7. 人工鱼群算法 人工鱼群算法(artificial fish swarm algorithm, AFSA) --> Demo code: [examples/demo_asfs.py#s1](https://github.com/guofei9987/scikit-opt/blob/master/examples/demo_asfs.py#L1) +-> Demo code: [examples/demo_afsa.py#s1](https://github.com/guofei9987/scikit-opt/blob/master/examples/demo_afsa.py#L1) ```python def func(x): x1, x2 = x return 1 / x1 ** 2 + x1 ** 2 + 1 / x2 ** 2 + x2 ** 2 -from sko.ASFA import ASFA +from sko.AFSA import AFSA -asfa = ASFA(func, n_dim=2, size_pop=50, max_iter=300, +afsa = AFSA(func, n_dim=2, size_pop=50, max_iter=300, max_try_num=100, step=0.5, visual=0.3, q=0.98, delta=0.5) -best_x, best_y = asfa.run() +best_x, best_y = afsa.run() print(best_x, best_y) ``` diff --git a/examples/demo_asfs.py b/examples/demo_afsa.py similarity index 64% rename from examples/demo_asfs.py rename to examples/demo_afsa.py index 3cff988..2f9cde9 100644 --- a/examples/demo_asfs.py +++ b/examples/demo_afsa.py @@ -3,10 +3,10 @@ def func(x): return 1 / x1 ** 2 + x1 ** 2 + 1 / x2 ** 2 + x2 ** 2 -from sko.ASFA import ASFA +from sko.AFSA import AFSA -asfa = ASFA(func, n_dim=2, size_pop=50, max_iter=300, +afsa = AFSA(func, n_dim=2, size_pop=50, max_iter=300, max_try_num=100, step=0.5, visual=0.3, q=0.98, delta=0.5) -best_x, best_y = asfa.run() +best_x, best_y = afsa.run() print(best_x, best_y) diff --git a/sko/ASFA.py b/sko/AFSA.py similarity index 99% rename from sko/ASFA.py rename to sko/AFSA.py index cc223e6..1518db3 100644 --- a/sko/ASFA.py +++ b/sko/AFSA.py @@ -96,7 +96,7 @@ # return self.best_X, self.best_Y # %% -class ASFA: +class AFSA: def __init__(self, func, n_dim, size_pop=50, max_iter=300, max_try_num=100, step=0.5, visual=0.3, q=0.98, delta=0.5):