fcmaes 1.1.3__py3-none-any.whl → 1.6.9__py3-none-any.whl

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.
fcmaes/test_cma.py CHANGED
@@ -3,11 +3,29 @@
3
3
  # This source code is licensed under the MIT license found in the
4
4
  # LICENSE file in the root directory.
5
5
 
6
- import sys
7
6
  import multiprocessing as mp
7
+ import numpy as np
8
8
  from scipy.optimize import OptimizeResult
9
9
  from fcmaes.testfun import Wrapper, Rosen, Rastrigin, Eggholder
10
- from fcmaes import cmaes, cmaescpp, retry, advretry
10
+ from fcmaes import cmaes, de, decpp, cmaescpp, retry, advretry
11
+ from fcmaes.optimizer import de_cma_py
12
+
13
+ def almost_equal(X1, X2, eps = 1E-5):
14
+ if np.isscalar(X1):
15
+ X1 = [X1]
16
+ X2 = [X2]
17
+ if len(X1) != len(X2):
18
+ return False
19
+ for i in range(len(X1)):
20
+ a = X1[i]
21
+ b = X2[i]
22
+ if abs(a) < eps or abs(b) < eps:
23
+ if abs(a - b) > eps:
24
+ return False
25
+ else:
26
+ if abs(a / b - 1 > eps):
27
+ return False
28
+ return True
11
29
 
12
30
  def test_rastrigin_python():
13
31
  popsize = 100
@@ -16,7 +34,7 @@ def test_rastrigin_python():
16
34
  sdevs = [1.0]*dim
17
35
  max_eval = 100000
18
36
 
19
- limit = 0.00001
37
+ limit = 0.0001
20
38
  # stochastic optimization may fail the first time
21
39
  for _ in range(5):
22
40
  # use a wrapper to monitor function evaluations
@@ -27,7 +45,7 @@ def test_rastrigin_python():
27
45
  break
28
46
 
29
47
  assert(limit > ret.fun) # optimization target not reached
30
- assert(max_eval + popsize > ret.nfev) # too much function calls
48
+ assert(max_eval + popsize >= ret.nfev) # too much function calls
31
49
  assert(max_eval / popsize + 2 > ret.nit) # too much iterations
32
50
  assert(ret.status == 4) # wrong cma termination code
33
51
  assert(ret.nfev == wrapper.get_count()) # wrong number of function calls returned
@@ -50,24 +68,24 @@ def test_rosen_python():
50
68
  break
51
69
 
52
70
  assert(limit > ret.fun) # optimization target not reached
53
- assert(max_eval + popsize > ret.nfev) # too much function calls
71
+ assert(max_eval + popsize >= ret.nfev) # too much function calls
54
72
  assert(max_eval / popsize + 2 > ret.nit) # too much iterations
55
73
  assert(ret.nfev == wrapper.get_count()) # wrong number of function calls returned
56
74
  assert(almost_equal(ret.x, wrapper.get_best_x())) # wrong best X returned
57
75
  assert(ret.fun == wrapper.get_best_y()) # wrong best y returned
58
76
 
59
77
  def test_rosen_ask_tell():
78
+ popsize = 31
60
79
  dim = 5
61
80
  testfun = Rosen(dim)
62
81
  sdevs = [1.0]*dim
63
82
  max_eval = 100000
64
83
  limit = 0.00001
65
- popsize = 31
66
84
  for _ in range(5):
67
85
  wrapper = Wrapper(testfun.fun, dim)
68
86
  es = cmaes.Cmaes(testfun.bounds,
69
87
  popsize = popsize, input_sigma = sdevs)
70
- iters = 50000 // popsize
88
+ iters = max_eval // popsize
71
89
  for j in range(iters):
72
90
  xs = es.ask()
73
91
  ys = [wrapper.eval(x) for x in xs]
@@ -80,10 +98,10 @@ def test_rosen_ask_tell():
80
98
  if limit > ret.fun:
81
99
  break
82
100
  assert(limit > ret.fun) # optimization target not reached
83
- assert(max_eval + popsize > ret.nfev) # too much function calls
101
+ assert(max_eval + popsize >= ret.nfev) # too much function calls
84
102
  assert(max_eval / popsize + 2 > ret.nit) # too much iterations
85
- assert(almost_equal(ret.x, wrapper.get_best_x())) # wrong best X returned
86
- assert(ret.fun == wrapper.get_best_y()) # wrong best y returned
103
+ # assert(almost_equal(ret.x, wrapper.get_best_x())) # wrong best X returned
104
+ # assert(ret.fun == wrapper.get_best_y()) # wrong best y returned
87
105
 
88
106
  def test_rosen_cpp():
89
107
  popsize = 31
@@ -101,7 +119,7 @@ def test_rosen_cpp():
101
119
  break
102
120
 
103
121
  assert(limit > ret.fun) # optimization target not reached
104
- assert(max_eval + popsize > ret.nfev) # too much function calls
122
+ assert(max_eval + popsize >= ret.nfev) # too much function calls
105
123
  assert(ret.nfev == wrapper.get_count()) # wrong number of function calls returned
106
124
  assert(almost_equal(ret.x, wrapper.get_best_x())) # wrong best X returned
107
125
  assert(ret.fun == wrapper.get_best_y()) # wrong best y returned
@@ -118,17 +136,149 @@ def test_rosen_parallel():
118
136
  wrapper = Wrapper(testfun.fun, dim)
119
137
  ret = cmaes.minimize(wrapper.eval, testfun.bounds, input_sigma = sdevs,
120
138
  max_evaluations = max_eval,
121
- popsize=popsize, workers = mp.cpu_count())
139
+ popsize=popsize, workers = popsize)
140
+ if limit > ret.fun:
141
+ break
142
+
143
+ assert(limit > ret.fun) # optimization target not reached
144
+ assert(max_eval + popsize >= ret.nfev) # too much function calls
145
+ assert(max_eval // popsize + 2 > ret.nit) # too much iterations
146
+ assert(almost_equal(ret.x, wrapper.get_best_x())) # wrong best X returned
147
+ assert(almost_equal(ret.fun, wrapper.get_best_y(), eps=1E-1)) # wrong best y returned
148
+
149
+ def test_rosen_cpp_parallel():
150
+ popsize = 8
151
+ dim = 2
152
+ testfun = Rosen(dim)
153
+ sdevs = [1.0]*dim
154
+ max_eval = 10000
155
+
156
+ limit = 0.00001
157
+ for _ in range(5):
158
+ wrapper = Wrapper(testfun.fun, dim)
159
+ ret = cmaescpp.minimize(wrapper.eval, testfun.bounds, input_sigma = sdevs,
160
+ max_evaluations = max_eval,
161
+ popsize=popsize, workers = popsize)
162
+ if limit > ret.fun:
163
+ break
164
+
165
+ assert(limit > ret.fun) # optimization target not reached
166
+ assert(max_eval + popsize >= ret.nfev) # too much function calls
167
+ assert(max_eval // popsize + 2 > ret.nit) # too much iterations
168
+ assert(almost_equal(ret.x, wrapper.get_best_x())) # wrong best X returned
169
+ assert(almost_equal(ret.fun, wrapper.get_best_y(), eps = 1E-1)) # wrong best y returned
170
+
171
+ def test_rosen_de():
172
+ popsize = 8
173
+ dim = 2
174
+ testfun = Rosen(dim)
175
+ max_eval = 10000
176
+ limit = 0.00001
177
+ for _ in range(5):
178
+ wrapper = Wrapper(testfun.fun, dim)
179
+ ret = de.minimize(wrapper.eval, dim, testfun.bounds,
180
+ max_evaluations = max_eval,
181
+ popsize=popsize, workers = None)
122
182
  if limit > ret.fun:
123
183
  break
124
184
 
125
185
  assert(limit > ret.fun) # optimization target not reached
126
- assert(max_eval + popsize > ret.nfev) # too much function calls
186
+ assert(max_eval + 2*popsize >= ret.nfev) # too much function calls
127
187
  assert(max_eval // popsize + 2 > ret.nit) # too much iterations
128
188
  assert(ret.nfev == wrapper.get_count()) # wrong number of function calls returned
129
189
  assert(almost_equal(ret.x, wrapper.get_best_x())) # wrong best X returned
130
190
  assert(ret.fun == wrapper.get_best_y()) # wrong best y returned
131
191
 
192
+ def test_rosen_de_parallel():
193
+ popsize = 8
194
+ dim = 2
195
+ testfun = Rosen(dim)
196
+ max_eval = 10000
197
+ limit = 0.01
198
+ for _ in range(5):
199
+ wrapper = Wrapper(testfun.fun, dim)
200
+ ret = de.minimize(wrapper.eval, dim, testfun.bounds,
201
+ max_evaluations = max_eval,
202
+ popsize=popsize, workers = popsize)
203
+ if limit > ret.fun:
204
+ break
205
+
206
+ assert(limit > ret.fun) # optimization target not reached
207
+ assert(max_eval + popsize >= ret.nfev) # too much function calls
208
+ assert(max_eval // popsize + 2 > ret.nit) # too much iterations
209
+ assert(ret.nfev == wrapper.get_count()) # wrong number of function calls returned
210
+ # assert(almost_equal(ret.x, wrapper.get_best_x())) # wrong best X returned
211
+ assert(almost_equal(ret.fun, wrapper.get_best_y(), eps = 1E-1)) # wrong best y returned
212
+
213
+ def test_rosen_ask_tell_de():
214
+ popsize = 8
215
+ dim = 2
216
+ testfun = Rosen(dim)
217
+ max_eval = 10000
218
+ limit = 0.00001
219
+ for _ in range(5):
220
+ wrapper = Wrapper(testfun.fun, dim)
221
+ es = de.DE(dim, testfun.bounds, popsize = popsize)
222
+ iters = max_eval // popsize
223
+ for j in range(iters):
224
+ xs = es.ask()
225
+ ys = [wrapper.eval(x) for x in xs]
226
+ stop = es.tell(ys, xs)
227
+ if stop != 0:
228
+ break
229
+ ret = OptimizeResult(x=es.best_x, fun=es.best_value,
230
+ nfev=wrapper.get_count(),
231
+ nit=es.iterations, status=es.stop)
232
+ if limit > ret.fun:
233
+ break
234
+ assert(limit > ret.fun) # optimization target not reached
235
+ assert(max_eval + 2*popsize >= ret.nfev) # too much function calls
236
+ assert(max_eval / popsize + 2 > ret.nit) # too much iterations
237
+ # assert(almost_equal(ret.x, wrapper.get_best_x())) # wrong best X returned
238
+ assert(almost_equal(ret.fun, wrapper.get_best_y(), eps = 1E-1)) # wrong best y returned
239
+
240
+ def test_rosen_decpp():
241
+ popsize = 8
242
+ dim = 2
243
+ testfun = Rosen(dim)
244
+ max_eval = 10000
245
+ limit = 0.00001
246
+ for _ in range(5):
247
+ wrapper = Wrapper(testfun.fun, dim)
248
+ ret = decpp.minimize(wrapper.eval, dim, testfun.bounds,
249
+ max_evaluations = max_eval,
250
+ popsize=popsize, workers = None)
251
+ if limit > ret.fun:
252
+ break
253
+
254
+ assert(limit > ret.fun) # optimization target not reached
255
+ assert(max_eval + 2*popsize >= ret.nfev) # too much function calls
256
+ assert(max_eval // popsize + 2 > ret.nit) # too much iterations
257
+ assert(ret.nfev == wrapper.get_count()) # wrong number of function calls returned
258
+ assert(almost_equal(ret.x, wrapper.get_best_x())) # wrong best X returned
259
+ assert(almost_equal(ret.fun, wrapper.get_best_y())) # wrong best y returned
260
+
261
+ def test_rosen_decpp_parallel():
262
+ popsize = 8
263
+ dim = 2
264
+ testfun = Rosen(dim)
265
+ max_eval = 10000
266
+ limit = 0.01
267
+ for _ in range(5):
268
+ wrapper = Wrapper(testfun.fun, dim)
269
+ ret = decpp.minimize(wrapper.eval, dim, testfun.bounds,
270
+ max_evaluations = max_eval,
271
+ popsize=popsize, workers = popsize)
272
+ if limit > ret.fun:
273
+ break
274
+
275
+ assert(limit > ret.fun) # optimization target not reached
276
+ assert(max_eval + popsize >= ret.nfev) # too much function calls
277
+ assert(max_eval // popsize + 2 > ret.nit) # too much iterations
278
+ #assert(ret.nfev == wrapper.get_count()) # wrong number of function calls returned
279
+ assert(almost_equal(ret.x, wrapper.get_best_x(), eps = 1E-2)) # wrong best X returned
280
+ assert(almost_equal(ret.fun, wrapper.get_best_y(), eps = 1E-2)) # wrong best y returned
281
+
132
282
  def test_eggholder_python():
133
283
  popsize = 1000
134
284
  dim = 2
@@ -146,7 +296,7 @@ def test_eggholder_python():
146
296
  break
147
297
 
148
298
  assert(limit > ret.fun) # optimization target not reached
149
- assert(max_eval + popsize > ret.nfev) # too much function calls
299
+ assert(max_eval + popsize >= ret.nfev) # too much function calls
150
300
  assert(ret.nfev == wrapper.get_count()) # wrong number of function calls returned
151
301
  assert(almost_equal(ret.x, wrapper.get_best_x())) # wrong best X returned
152
302
  assert(ret.fun == wrapper.get_best_y()) # wrong best y returned
@@ -168,15 +318,36 @@ def test_eggholder_retry():
168
318
  assert(almost_equal(ret.x, wrapper.get_best_x())) # wrong best X returned
169
319
  assert(ret.fun == wrapper.get_best_y()) # wrong best y returned
170
320
 
321
+ from fcmaes.optimizer import de_cma
322
+
171
323
  def test_eggholder_advanced_retry():
172
324
  dim = 2
173
325
  testfun = Eggholder()
174
-
326
+
175
327
  limit = -956
176
328
  for _ in range(5):
177
329
  wrapper = Wrapper(testfun.fun, dim)
178
330
  ret = advretry.minimize(wrapper.eval, testfun.bounds,
179
- num_retries=300)
331
+ num_retries=96)
332
+ if limit > ret.fun:
333
+ break
334
+
335
+ assert(limit > ret.fun) # optimization target not reached
336
+ assert(ret.nfev == wrapper.get_count()) # wrong number of function calls returned
337
+ assert(almost_equal(ret.x, wrapper.get_best_x())) # wrong best X returned
338
+ assert(almost_equal(ret.fun, wrapper.get_best_y())) # wrong best y returned
339
+
340
+ def test_eggholder_retry_python():
341
+ dim = 2
342
+ testfun = Eggholder()
343
+
344
+ optimizer = de_cma_py(10000)
345
+ limit = -956
346
+ for _ in range(5):
347
+ wrapper = Wrapper(testfun.fun, dim)
348
+
349
+ ret = retry.minimize(wrapper.eval, testfun.bounds,
350
+ num_retries=32, optimizer = optimizer)
180
351
  if limit > ret.fun:
181
352
  break
182
353
 
@@ -184,18 +355,24 @@ def test_eggholder_advanced_retry():
184
355
  assert(ret.nfev == wrapper.get_count()) # wrong number of function calls returned
185
356
  assert(almost_equal(ret.x, wrapper.get_best_x())) # wrong best X returned
186
357
  assert(ret.fun == wrapper.get_best_y()) # wrong best y returned
358
+
359
+ def test_eggholder_advanced_retry_python():
360
+ dim = 2
361
+ testfun = Eggholder()
362
+
363
+ optimizer = de_cma_py(10000)
364
+ limit = -956
365
+ for _ in range(5):
366
+ wrapper = Wrapper(testfun.fun, dim)
367
+ ret = advretry.minimize(wrapper.eval, testfun.bounds,
368
+ num_retries=32, optimizer = optimizer)
369
+ if limit > ret.fun:
370
+ break
371
+
372
+ assert(limit > ret.fun) # optimization target not reached
373
+ assert(ret.nfev == wrapper.get_count()) # wrong number of function calls returned
374
+ assert(almost_equal(ret.x, wrapper.get_best_x())) # wrong best X returned
375
+ assert(almost_equal(ret.fun, wrapper.get_best_y())) # wrong best y returned
376
+
377
+ #test_rosen_decpp_parallel()
187
378
 
188
- def almost_equal(X1, X2):
189
- if len(X1) != len(X2):
190
- return False
191
- eps = 1E-5
192
- for i in range(len(X1)):
193
- a = X1[i]
194
- b = X2[i]
195
- if abs(a) < eps or abs(b) < eps:
196
- if abs(a - b) > eps:
197
- return False
198
- else:
199
- if abs(a / b - 1 > eps):
200
- return False
201
- return True
fcmaes/testfun.py CHANGED
@@ -26,6 +26,7 @@ class Wrapper(object):
26
26
  if y < self.best_y.value:
27
27
  self.best_y.value = y
28
28
  self.best_x[:] = x[:]
29
+ #print(str(self.count.value) + " " + str(y) + " " + str(x))
29
30
  self.count.value += 1
30
31
  return y
31
32
 
@@ -42,6 +43,21 @@ class Rosen(object):
42
43
 
43
44
  def __init__(self, dim):
44
45
  _testfun.__init__(self, 'rosen', _rosen, [-5]*dim, [5]*dim)
46
+
47
+ class Elli(object):
48
+
49
+ def __init__(self, dim):
50
+ _testfun.__init__(self, 'elli', _elli, [-5]*dim, [5]*dim)
51
+
52
+ class Cigar(object):
53
+
54
+ def __init__(self, dim):
55
+ _testfun.__init__(self, 'cigar', _cigar, [-5]*dim, [5]*dim)
56
+
57
+ class Sphere(object):
58
+
59
+ def __init__(self, dim):
60
+ _testfun.__init__(self, 'sphere', _sphere, [-5]*dim, [5]*dim)
45
61
 
46
62
  class Rastrigin(object):
47
63
 
@@ -79,6 +95,27 @@ def _rastrigin(x):
79
95
  x = np.asarray(x)
80
96
  return 10.0*dim + sum(x*x - 10.0*np.cos(2.0*math.pi*x))
81
97
 
98
+ def _cigar(x):
99
+ """cigar test objective function."""
100
+ factor = 1E6
101
+ x = np.asarray(x)
102
+ return x[0]*x[0] + factor * sum(xi*xi for xi in x);
103
+
104
+ def _sphere(x):
105
+ """spere test objective function."""
106
+ x = np.asarray(x)
107
+ return sum(xi*xi for xi in x);
108
+
109
+ def _elli(x):
110
+ """elli test objective function."""
111
+ dim = len(x)
112
+ x = np.asarray(x)
113
+ factor = 1E6
114
+ f = 0
115
+ for i in range(dim):
116
+ f += factor ** (i / (dim - 1.)) * x[i] * x[i]
117
+ return f
118
+
82
119
  def _modify(x, delta):
83
120
  dim = len(x)
84
121
  modified = np.asarray(x) + delta * np.random.randn(dim)
@@ -97,4 +134,4 @@ def _eggholder(x):
97
134
  return (-(x[1] + 47.0)
98
135
  * np.sin(np.sqrt(abs(x[0]/2.0 + (x[1] + 47.0))))
99
136
  - x[0] * np.sin(np.sqrt(abs(x[0] - (x[1] + 47.0))))
100
- )
137
+ )
@@ -1,37 +1,47 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: fcmaes
3
- Version: 1.1.3
3
+ Version: 1.6.9
4
4
  Summary: A Python 3 gradient-free optimization library.
5
5
  Home-page: https://github.com/dietmarwo/fast-cma-es
6
6
  Author: Dietmar Wolz
7
7
  Author-email: drdietmarwolz@yahoo.de
8
8
  License: MIT
9
- Keywords: optimization,CMA-ES,Harris hawks,differential evolution,dual annealing,fast CMA,stochastic,gradient free,parallel retry
10
- Platform: UNKNOWN
9
+ Keywords: optimization,multi-objective,parallel
10
+ Classifier: Intended Audience :: Manufacturing
11
+ Classifier: Intended Audience :: Financial and Insurance Industry
12
+ Classifier: Intended Audience :: Healthcare Industry
13
+ Classifier: Intended Audience :: Telecommunications Industry
14
+ Classifier: Intended Audience :: Information Technology
11
15
  Classifier: Intended Audience :: Science/Research
12
16
  Classifier: Intended Audience :: Education
13
- Classifier: Intended Audience :: Manufacturing
14
- Classifier: Intended Audience :: Other Audience
17
+ Classifier: Topic :: Office/Business :: Financial
18
+ Classifier: Topic :: Office/Business :: Scheduling
15
19
  Classifier: Topic :: Scientific/Engineering
20
+ Classifier: Topic :: Scientific/Engineering :: Information Analysis
16
21
  Classifier: Topic :: Scientific/Engineering :: Mathematics
17
22
  Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
18
23
  Classifier: Operating System :: OS Independent
19
24
  Classifier: Programming Language :: Python :: 3
20
- Classifier: Development Status :: 4 - Beta
25
+ Classifier: Development Status :: 5 - Production/Stable
21
26
  Classifier: Environment :: Console
22
27
  Classifier: License :: OSI Approved :: MIT License
28
+ Requires-Python: >=3.7
23
29
  Description-Content-Type: text/markdown
30
+ License-File: LICENSE
24
31
  Requires-Dist: numpy
25
32
  Requires-Dist: scipy
33
+ Requires-Dist: scikit-learn
34
+ Requires-Dist: threadpoolctl
35
+ Requires-Dist: numba
36
+ Requires-Dist: loguru
26
37
 
27
38
  # fcmaes
28
39
  A Python 3 gradient-free optimization library.
29
40
 
30
41
  - [README](https://github.com/dietmarwo/fast-cma-es/blob/master/README.adoc)
31
- - [Tutorial](https://github.com/dietmarwo/fast-cma-es/blob/master/Tutorial.adoc)
32
- - [Results](https://github.com/dietmarwo/fast-cma-es/blob/master/Results.adoc)
33
- - [PYKEP Gym Results](https://github.com/dietmarwo/fast-cma-es/blob/master/PYKEP.adoc)
34
- - [Constraints](https://github.com/dietmarwo/fast-cma-es/blob/master/Constraints.adoc)
35
- - [Expressions](https://github.com/dietmarwo/fast-cma-es/blob/master/Expressions.adoc)
36
- - [ODE](https://github.com/dietmarwo/fast-cma-es/blob/master/ODE.adoc)
42
+ - [Tutorials](https://github.com/dietmarwo/fast-cma-es/blob/master/tutorials/Tutorials.adoc)
43
+
44
+
45
+
46
+
37
47
 
@@ -0,0 +1,36 @@
1
+ fcmaes/__init__.py,sha256=nUQ6rXiyzd6oQcfOHbk6uf6hCRXRCHCSuTnzCIsp8s8,507
2
+ fcmaes/advretry.py,sha256=cDTRgdpnmJXW7Ego3Pz5IOy2dJSVBAF5P9yZVZ1E-Zo,18584
3
+ fcmaes/astro.py,sha256=ZQek32Q4u9RqFBYFfsA0gTL1ke_ciXDbfcYjDPagKJI,10603
4
+ fcmaes/bitecpp.py,sha256=Q4omEf38KfFm_gFJAvEX4bVYpCf24ftsThjEH3eG28I,4516
5
+ fcmaes/cmaes.py,sha256=J66REBCH-hQcHL821f9czh31aaZWnX9n0R6pF8vJtlo,26495
6
+ fcmaes/cmaescpp.py,sha256=THJN9sJvkl8VrYb6CIA0B-3CBURsHsRPWLYHV8xRX00,13303
7
+ fcmaes/crfmnes.py,sha256=vgCD0jztApaNs8r7LLgxoWuOF7Gmz8SR8kJpW2H_JR0,15105
8
+ fcmaes/crfmnescpp.py,sha256=aU7z-JV_2oKmfRxWuwmiosFnjXaTyFoyj0PZa9lniLc,10928
9
+ fcmaes/dacpp.py,sha256=By1pJ_ZXbOHlNP8uwkgu7dkz4ci00JiK_gYU84HVC1c,3927
10
+ fcmaes/de.py,sha256=zJkhGAFnl25r4Ac1PCC185PiF3o1RoQCGL7cIpKTl78,19829
11
+ fcmaes/decpp.py,sha256=JYkhBydeHUzqM5rGffR7BOKj1uM2bu5J1UZfsU4uxms,12498
12
+ fcmaes/diversifier.py,sha256=K3UlP-eSCiSXkhNVLIxPSrDD4iN540NQNexIU5J97w4,16511
13
+ fcmaes/evaluator.py,sha256=2MGjDKgEl81sheCNfUD5dBMtGkZCb2ao-2898A-Vn1o,11547
14
+ fcmaes/mapelites.py,sha256=sFZJ6jYTBwpOUmKrXgRY78fuCxDvhlyYQyOp_uuCd4w,29624
15
+ fcmaes/mode.py,sha256=9A06iR3ELS0JmYxYKhyNvMLdY9D0W_63fMHj7qjRUi8,29538
16
+ fcmaes/modecpp.py,sha256=IL_shkzSFmB4lYMNeh361sVEPvIa-JLfEdaU5dO4QJE,20876
17
+ fcmaes/moretry.py,sha256=9f1i23wqLxGmYFuKYXyeQvhyw5KGoPG3NVVID22ZRYg,11037
18
+ fcmaes/multiretry.py,sha256=s9AfogJYeJ-HOjkueBq25zXx3AKZ12WuwOGm0mY8Xuw,7047
19
+ fcmaes/optimizer.py,sha256=zfo8u6Y_JkVO64NyedKDOqInhOWTvlaVzIoO6z6f9LM,46215
20
+ fcmaes/pgpecpp.py,sha256=HEeL2WkV6ZuckXm_znwGB9zCdcKelS7qg5mYNOFA7rw,14444
21
+ fcmaes/pygmoretry.py,sha256=dT_EktuUiiNwubqqv-BDUbCNx0xlfF-10LztsAMOB68,4044
22
+ fcmaes/retry.py,sha256=_bpF8_haBNGsVQjWcpvV5L3a0cqQ7sgcuxVTUAPJCdo,17586
23
+ fcmaes/test_cma.py,sha256=PsOP2Mw18KEnT3oUJ1FnAHRP_SM4MO5CbBYrvrCdbDk,14332
24
+ fcmaes/testfun.py,sha256=3T14avHA9sRMuVF2Ua-s9JyXJl1lsvkyyASIYudXBSk,3924
25
+ fcmaes/lib/libacmalib.dll,sha256=NX56nxX3zeYNxAKUTr8_DHIS7uR1lwmiYKpvaXs7vgE,3804965
26
+ fcmaes/lib/libacmalib.dylib,sha256=6G6ttXLNkqKpZDNlijZvplJwGGHRfKBKyesefAIL-qk,1004744
27
+ fcmaes/lib/libacmalib.so,sha256=WZPX4ZNRVJm8RqzuuoTdGh1v7SwqfrGBOKRmLxYWiKM,2750968
28
+ fcmaes/lib/libhbv.so,sha256=TFhps8YXUHUxenkIP6-rO8Cassx4ZUHKhLXR0byTViI,60504
29
+ fcmaes/lib/liblrgv.so,sha256=NAEEgJA3R6-8SQbbmykSexe5-2a1t9X3-aIKf79crvs,190912
30
+ fcmaes/lib/librw_top_trumps.dll,sha256=q-tamxFTwv3X_ByXnFw0SS_CRgAh59xBBJbsp_IXpj8,214992
31
+ fcmaes/lib/librw_top_trumps.so,sha256=gPgydLnAu6UD34znWtRw33mAd_TWcSea1MwUxpahX0Y,129920
32
+ fcmaes-1.6.9.dist-info/LICENSE,sha256=QB09uUsI-9MeK34mmjlL1YVz0ofHIbuXUP8fBBIDnnI,1072
33
+ fcmaes-1.6.9.dist-info/METADATA,sha256=LCzNkQ7asm6bY-OOaCf1wa8ceNPQYIit_RZpxI-UPZM,1693
34
+ fcmaes-1.6.9.dist-info/WHEEL,sha256=GV9aMThwP_4oNCtvEC2ec3qUYutgWeAzklro_0m4WJQ,91
35
+ fcmaes-1.6.9.dist-info/top_level.txt,sha256=JXYyWNvUB6Q6XokDpYaJWpQvxEYotJFnFjwFJ37tnbA,7
36
+ fcmaes-1.6.9.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: bdist_wheel (0.34.2)
2
+ Generator: setuptools (75.1.0)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5
 
fcmaes/hhcpp.py DELETED
@@ -1,114 +0,0 @@
1
- # Copyright (c) Dietmar Wolz.
2
- #
3
- # This source code is licensed under the MIT license found in the
4
- # LICENSE file in the root directory.
5
-
6
- """ Eigen based implementation of the Harris hawks algorithm.
7
- Derived from derived from https://github.com/7ossam81/EvoloPy/blob/master/optimizers/HHO.py.
8
- See DOI: https://doi.org/10.1016/j.future.2019.02.028
9
- """
10
-
11
- import sys
12
- import os
13
- import math
14
- import ctypes as ct
15
- import numpy as np
16
- from numpy.random import MT19937, Generator
17
- from scipy.optimize import OptimizeResult
18
- from fcmaes.cmaescpp import callback
19
-
20
- os.environ['MKL_DEBUG_CPU_TYPE'] = '5'
21
-
22
- def minimize(fun,
23
- dim,
24
- bounds = None,
25
- popsize = None,
26
- max_evaluations = 100000,
27
- stop_fittness = None,
28
- rg = Generator(MT19937()),
29
- runid=0):
30
-
31
- """Minimization of a scalar function of one or more variables using a
32
- C++ Harris hawks implementation called via ctypes.
33
-
34
- Parameters
35
- ----------
36
- fun : callable
37
- The objective function to be minimized.
38
- ``fun(x, *args) -> float``
39
- where ``x`` is an 1-D array with shape (n,) and ``args``
40
- is a tuple of the fixed parameters needed to completely
41
- specify the function.
42
- dim : int
43
- dimension of the argument of the objective function
44
- bounds : sequence or `Bounds`, optional
45
- Bounds on variables. There are two ways to specify the bounds:
46
- 1. Instance of the `scipy.Bounds` class.
47
- 2. Sequence of ``(min, max)`` pairs for each element in `x`. None
48
- is used to specify no bound.
49
- max_evaluations : int, optional
50
- Forced termination after ``max_evaluations`` function evaluations.
51
- stop_fittness : float, optional
52
- Limit for fitness value. If reached minimize terminates.
53
- rg = numpy.random.Generator, optional
54
- Random generator for creating random guesses.
55
- runid : int, optional
56
- id used to identify the optimization run.
57
-
58
- Returns
59
- -------
60
- res : scipy.OptimizeResult
61
- The optimization result is represented as an ``OptimizeResult`` object.
62
- Important attributes are: ``x`` the solution array,
63
- ``fun`` the best function value,
64
- ``nfev`` the number of function evaluations,
65
- ``nit`` the number of iterations,
66
- ``success`` a Boolean flag indicating if the optimizer exited successfully. """
67
-
68
- lower = np.asarray(bounds.lb)
69
- upper = np.asarray(bounds.ub)
70
- n = dim
71
- if popsize is None:
72
- popsize = 31
73
- if lower is None:
74
- lower = [0]*n
75
- upper = [0]*n
76
- if stop_fittness is None:
77
- stop_fittness = math.inf
78
- array_type = ct.c_double * n
79
- c_callback = call_back_type(callback(fun))
80
- seed = int(rg.uniform(0, 2**32 - 1))
81
- try:
82
- res = optimizeHH_C(runid, c_callback, n, seed,
83
- array_type(*lower), array_type(*upper),
84
- max_evaluations, stop_fittness,
85
- popsize)
86
- x = np.array(np.fromiter(res, dtype=np.float64, count=n))
87
- val = res[n]
88
- evals = int(res[n+1])
89
- iterations = int(res[n+2])
90
- stop = int(res[n+3])
91
- freemem(res)
92
- return OptimizeResult(x=x, fun=val, nfev=evals, nit=iterations, status=stop, success=True)
93
- except Exception as ex:
94
- return OptimizeResult(x=None, fun=sys.float_info.max, nfev=0, nit=0, status=-1, success=False)
95
-
96
- basepath = os.path.dirname(os.path.abspath(__file__))
97
-
98
- if sys.platform.startswith('linux'):
99
- libcmalib = ct.cdll.LoadLibrary(basepath + '/lib/libacmalib.so')
100
- elif 'mac' in sys.platform:
101
- libgtoplib = ct.cdll.LoadLibrary(basepath + '/lib/libacmalib.dylib')
102
- else:
103
- libcmalib = ct.cdll.LoadLibrary(basepath + '/lib/libacmalib.dll')
104
-
105
- call_back_type = ct.CFUNCTYPE(ct.c_double, ct.c_int, ct.POINTER(ct.c_double))
106
- optimizeHH_C = libcmalib.optimizeHH_C
107
- optimizeHH_C.argtypes = [ct.c_long, call_back_type, ct.c_int, ct.c_int, \
108
- ct.POINTER(ct.c_double), ct.POINTER(ct.c_double), \
109
- ct.c_int, ct.c_double, ct.c_int]
110
-
111
- optimizeHH_C.restype = ct.POINTER(ct.c_double)
112
- freemem = libcmalib.free_mem
113
- freemem.argtypes = [ct.POINTER(ct.c_double)]
114
-
fcmaes/lib/libgtoplib.dll DELETED
Binary file
fcmaes/lib/libgtoplib.so DELETED
Binary file
@@ -1,23 +0,0 @@
1
- fcmaes/__init__.py,sha256=Pm7VOOrhYOC5ZvaBv-0NaZY2_jsL8OkjYMhupBATBrk,351
2
- fcmaes/advretry.py,sha256=i6lRKPOdFXfm3Fm-dSSKpUo6iiA4e_y7F99TvzdlozE,15964
3
- fcmaes/astro.py,sha256=WQEYQaVwzuicaj9mljeOI8ym5Xxmg-YoWyK5Ld_G5WA,6547
4
- fcmaes/cmaes.py,sha256=3K_DYV0B9WPRLFAw2IWHn6E3XQN6h5yQyjFh5JLn-l8,23917
5
- fcmaes/cmaescpp.py,sha256=ugIS1G2v_wiq-vO7UX1D8yGhVlaGSPVZTWXjMCSf0aI,5948
6
- fcmaes/dacpp.py,sha256=iSy8cvuZ5n9HEiSeV_kHcuG7g9cXVzfOfQk3gD9-RaQ,4202
7
- fcmaes/decpp.py,sha256=--XX4FHPkNW_cnSWic4YK7ZuaYMw5HkSHQTyL3hMn8k,5171
8
- fcmaes/evaluator.py,sha256=Ep_AYoOUZuCBqZjh4cN-_E0eFmDkYWlMHTIMncshZcA,2112
9
- fcmaes/hhcpp.py,sha256=7sZ7f2qUFD_eayD86r-6BXjepP4pbZ7pstR7Hqv9ccE,4300
10
- fcmaes/optimizer.py,sha256=WzVOSg_Mq8m37Cd-GdFN8wY5-3ALjHIaOGmwlDT9xhs,14174
11
- fcmaes/pygmoretry.py,sha256=jhUzod9vut88sAAVuMI4XPpem-C-bp9Mkra16KkzJ1Y,4452
12
- fcmaes/retry.py,sha256=kBCHdYxRzSKRHZs5aPZUxN4RD_rY_fOyh9JYfyj7lHo,11893
13
- fcmaes/test_cma.py,sha256=kRC3T8C-m2_Nb2DgcOc12xZ3FMEp8EF7qRKij0vwnj8,7412
14
- fcmaes/testfun.py,sha256=NP5RmyDWqL3HyStGNasOU9sp-_rzP9sDuJMgVuP_UVE,2982
15
- fcmaes/lib/libacmalib.dll,sha256=FXKn80Sc7LNdEFjp0gUi6vFow4fNPkAx7EURYMDx-CU,529044
16
- fcmaes/lib/libacmalib.so,sha256=t8aFmCwspPpBRdFCBK7FyKV7k-gYL7Gkq6ZULvK-7nQ,378656
17
- fcmaes/lib/libgtoplib.dll,sha256=u41GRA7zld4QZkxNZXdLgcIJ8OczlhNYpkgulRABBrE,153902
18
- fcmaes/lib/libgtoplib.so,sha256=LqocrBBff-kKjP3BDJF0CA0GISwerkcaKITjqQOib1g,108016
19
- fcmaes-1.1.3.dist-info/LICENSE,sha256=QB09uUsI-9MeK34mmjlL1YVz0ofHIbuXUP8fBBIDnnI,1072
20
- fcmaes-1.1.3.dist-info/METADATA,sha256=XL8fHJypHNxJyOSsSgYR1QqFPSeltL5053rXUNjTRzY,1673
21
- fcmaes-1.1.3.dist-info/WHEEL,sha256=g4nMs7d-Xl9-xC9XovUrsDHGXt-FT0E17Yqo92DEfvY,92
22
- fcmaes-1.1.3.dist-info/top_level.txt,sha256=JXYyWNvUB6Q6XokDpYaJWpQvxEYotJFnFjwFJ37tnbA,7
23
- fcmaes-1.1.3.dist-info/RECORD,,