@@ -44,17 +44,17 @@ class TestPSO(DerandomizedTestCase):
4444
4545 def test_pso_quad (self ):
4646 f_quad = lambda x : numpy .sum (10 * (x - 0.5 )** 2 )
47- hh_opt = ParticleSwarmOptimiser (['x' ,'y' ,'z' ,'a' ], fitness_function = f_quad )
47+ hh_opt = ParticleSwarmOptimizer (['x' ,'y' ,'z' ,'a' ], fitness_function = f_quad )
4848 hh_opt ()
4949
5050 def test_pso_sin_sq (self ):
5151 f_sin_sq = lambda x : numpy .sum (np .sin (x - 0.2 )** 2 )
52- hh_opt = ParticleSwarmOptimiser (['x' ,'y' ,'z' ,'a' ], fitness_function = f_sin_sq )
52+ hh_opt = ParticleSwarmOptimizer (['x' ,'y' ,'z' ,'a' ], fitness_function = f_sin_sq )
5353 hh_opt ()
5454
5555 def test_pso_rosenbrock (self ):
5656 f_rosenbrock = lambda x : numpy .sum ([((x [i + 1 ] - x [i ]** 2 )** 2 + (1 - x [i ])** 2 )/ len (x ) for i in range (len (x )- 1 )])
57- hh_opt = ParticleSwarmOptimiser (['x' ,'y' ,'z' ,'a' ], fitness_function = f_rosenbrock )
57+ hh_opt = ParticleSwarmOptimizer (['x' ,'y' ,'z' ,'a' ], fitness_function = f_rosenbrock )
5858 hh_opt ()
5959
6060
@@ -84,7 +84,7 @@ def test_pso_perf_test_multiple_short(self):
8484 #Fitness function to evaluate the performance of the experiment
8585 EXPERIMENT_FITNESS = lambda performance : performance ['loss' ][:,- 1 ].mean (axis = 0 )
8686
87- hh_opt = ParticleSwarmOptimiser (params ,
87+ hh_opt = ParticleSwarmOptimizer (params ,
8888 n_trials = n_trials ,
8989 n_particles = n_particles ,
9090 prior = prior ,
@@ -95,58 +95,21 @@ def test_pso_perf_test_multiple_short(self):
9595 hh_opt (n_pso_iterations = 5 ,
9696 n_pso_particles = 6 )
9797
98-
99- def test_pso_perf_test_multiple_long (self ):
100- # Define our experiment
101- n_trials = 20 # Times we repeat the set of experiments
102- n_exp = 150 # Number of experiments in the set
103- n_particles = 4000 # Number of points we track during the experiment
104-
105- # Model for the experiment
106- model = rb .RandomizedBenchmarkingModel ()
107-
108- #Ordering of RB is 'p', 'A', 'B'
109- # A + B < 1, 0 < p < 1
110- #Prior distribution of the experiment
111- prior = dist .PostselectedDistribution (
112- dist .MultivariateNormalDistribution (mean = [0.5 ,0.1 ,0.25 ], cov = np .diag ([0.1 , 0.1 , 0.1 ])),
113- model
114- )
115-
116- #Heuristic used in the experiment
117- heuristic_class = qi .expdesign .ExpSparseHeuristic
118-
119- #Heuristic Parameters
120- params = ['base' , 'scale' ]
121-
122- #Fitness function to evaluate the performance of the experiment
123- EXPERIMENT_FITNESS = lambda performance : performance ['loss' ][:,- 1 ].mean (axis = 0 )
124-
125- hh_opt = ParticleSwarmOptimiser (params ,
126- n_trials = n_trials ,
127- n_particles = n_particles ,
128- prior = prior ,
129- model = model ,
130- n_exp = n_exp ,
131- heuristic_class = heuristic_class
132- )
133- hh_opt ()
134-
13598def TestPSSAO (DerandomizedTestCase ):
13699
137100 def test_pssao_quad (self ):
138101 f_quad = lambda x : numpy .sum (10 * (x - 0.5 )** 2 )
139- hh_opt = ParticleSwarmSimpleAnnealingOptimiser (['x' ,'y' ,'z' ,'a' ], fitness_function = f_quad )
102+ hh_opt = ParticleSwarmSimpleAnnealingOptimizer (['x' ,'y' ,'z' ,'a' ], fitness_function = f_quad )
140103 hh_opt ()
141104
142105 def test_pssao_sin_sq (self ):
143106 f_sin_sq = lambda x : numpy .sum (np .sin (x - 0.2 )** 2 )
144- hh_opt = ParticleSwarmSimpleAnnealingOptimiser (['x' ,'y' ,'z' ,'a' ], fitness_function = f_sin_sq )
107+ hh_opt = ParticleSwarmSimpleAnnealingOptimizer (['x' ,'y' ,'z' ,'a' ], fitness_function = f_sin_sq )
145108 hh_opt ()
146109
147110 def test_pssao_rosenbrock (self ):
148111 f_rosenbrock = lambda x : numpy .sum ([((x [i + 1 ] - x [i ]** 2 )** 2 + (1 - x [i ])** 2 )/ len (x ) for i in range (len (x )- 1 )])
149- hh_opt = ParticleSwarmSimpleAnnealingOptimiser (['x' ,'y' ,'z' ,'a' ], fitness_function = f_rosenbrock )
112+ hh_opt = ParticleSwarmSimpleAnnealingOptimizer (['x' ,'y' ,'z' ,'a' ], fitness_function = f_rosenbrock )
150113 hh_opt ()
151114
152115
@@ -176,7 +139,7 @@ def test_pssao_perf_test_multiple_short(self):
176139 #Fitness function to evaluate the performance of the experiment
177140 EXPERIMENT_FITNESS = lambda performance : performance ['loss' ][:,- 1 ].mean (axis = 0 )
178141
179- hh_opt = ParticleSwarmSimpleAnnealingOptimiser (params ,
142+ hh_opt = ParticleSwarmSimpleAnnealingOptimizer (params ,
180143 n_trials = n_trials ,
181144 n_particles = n_particles ,
182145 prior = prior ,
@@ -192,17 +155,17 @@ def TestPSTO(DerandomizedTestCase):
192155
193156 def test_psto_quad (self ):
194157 f_quad = lambda x : numpy .sum (10 * (x - 0.5 )** 2 )
195- hh_opt = ParticleSwarmTemperingOptimiser (['x' ,'y' ,'z' ,'a' ], fitness_function = f_quad )
158+ hh_opt = ParticleSwarmTemperingOptimizer (['x' ,'y' ,'z' ,'a' ], fitness_function = f_quad )
196159 hh_opt ()
197160
198161 def test_psto_sin_sq (self ):
199162 f_sin_sq = lambda x : numpy .sum (np .sin (x - 0.2 )** 2 )
200- hh_opt = ParticleSwarmTemperingOptimiser (['x' ,'y' ,'z' ,'a' ], fitness_function = f_sin_sq )
163+ hh_opt = ParticleSwarmTemperingOptimizer (['x' ,'y' ,'z' ,'a' ], fitness_function = f_sin_sq )
201164 hh_opt ()
202165
203166 def test_psto_rosenbrock (self ):
204167 f_rosenbrock = lambda x : numpy .sum ([((x [i + 1 ] - x [i ]** 2 )** 2 + (1 - x [i ])** 2 )/ len (x ) for i in range (len (x )- 1 )])
205- hh_opt = ParticleSwarmTemperingOptimiser (['x' ,'y' ,'z' ,'a' ], fitness_function = f_rosenbrock )
168+ hh_opt = ParticleSwarmTemperingOptimizer (['x' ,'y' ,'z' ,'a' ], fitness_function = f_rosenbrock )
206169 hh_opt ()
207170
208171
@@ -232,7 +195,7 @@ def test_psto_perf_test_multiple_short(self):
232195 #Fitness function to evaluate the performance of the experiment
233196 EXPERIMENT_FITNESS = lambda performance : performance ['loss' ][:,- 1 ].mean (axis = 0 )
234197
235- hh_opt = ParticleSwarmTemperingOptimiser (params ,
198+ hh_opt = ParticleSwarmTemperingOptimizer (params ,
236199 n_trials = n_trials ,
237200 n_particles = n_particles ,
238201 prior = prior ,
0 commit comments