Revision 855,
1.4 KB
checked in by mmckerns, 5 months ago
(diff) |
updated copyright to 2016
|
-
Property svn:executable set to
*
|
Line | |
---|
1 | #!/usr/bin/env python |
---|
2 | # |
---|
3 | # Author: Mike McKerns (mmckerns @caltech and @uqfoundation) |
---|
4 | # Copyright (c) 1997-2016 California Institute of Technology. |
---|
5 | # License: 3-clause BSD. The full license text is available at: |
---|
6 | # - http://mmckerns.github.io/project/mystic/browser/mystic/LICENSE |
---|
7 | """ |
---|
8 | Testing the polynomial fitting problem of [1] using scipy's Nelder-Mead algorithm. |
---|
9 | |
---|
10 | Reference: |
---|
11 | |
---|
12 | [1] Storn, R. and Price, K. Differential Evolution - A Simple and Efficient |
---|
13 | Heuristic for Global Optimization over Continuous Spaces. Journal of Global |
---|
14 | Optimization 11: 341-359, 1997. |
---|
15 | """ |
---|
16 | |
---|
17 | from test_ffit import Chebyshev8, plot_solution, print_solution |
---|
18 | from TEST_ffitPP_b import ChebyshevCost |
---|
19 | |
---|
20 | if __name__ == '__main__': |
---|
21 | import random |
---|
22 | from mystic.solvers import fmin |
---|
23 | #from mystic._scipyoptimize import fmin |
---|
24 | from mystic.tools import random_seed |
---|
25 | random_seed(123) |
---|
26 | |
---|
27 | import pp |
---|
28 | import sys |
---|
29 | |
---|
30 | if len(sys.argv) > 1: |
---|
31 | tunnelport = sys.argv[1] |
---|
32 | ppservers = ("localhost:%s" % tunnelport,) |
---|
33 | else: |
---|
34 | ppservers = () |
---|
35 | |
---|
36 | myserver = pp.Server(ppservers=ppservers) |
---|
37 | |
---|
38 | trials = [] |
---|
39 | for trial in range(8): |
---|
40 | x = tuple([random.uniform(-100,100) + Chebyshev8[i] for i in range(9)]) |
---|
41 | trials.append(x) |
---|
42 | |
---|
43 | results = [myserver.submit(fmin,(ChebyshevCost,x),(),()) for x in trials] |
---|
44 | |
---|
45 | for solution in results: |
---|
46 | print_solution(solution()) |
---|
47 | |
---|
48 | #plot_solution(solution) |
---|
49 | |
---|
50 | # end of file |
---|
Note: See
TracBrowser
for help on using the repository browser.