@@ -55,7 +55,7 @@ def runTest(self):
55
55
x0 = np .array ([- 1.2 , 1.0 ])
56
56
xl = - 1e20 * np .ones ((n ,))
57
57
xu = 1e20 * np .ones ((n ,))
58
- model = Model (npt , x0 , rosenbrock (x0 ), xl , xu , 1 )
58
+ model = Model (npt , x0 , rosenbrock (x0 ), xl , xu , [], 1 )
59
59
self .assertEqual (model .npt (), npt , 'Wrong npt after initialisation' )
60
60
self .assertTrue (array_compare (model .xopt (abs_coordinates = True ), x0 ), 'Wrong xopt after initialisation' )
61
61
self .assertTrue (array_compare (model .fopt (), rosenbrock (x0 )), 'Wrong fopt after initialisation' )
@@ -103,7 +103,7 @@ def runTest(self):
103
103
x0 = np .array ([- 1.2 , 1.0 ])
104
104
xl = - 1e20 * np .ones ((n ,))
105
105
xu = 1e20 * np .ones ((n ,))
106
- model = Model (npt , x0 , rosenbrock (x0 ), xl , xu , 1 )
106
+ model = Model (npt , x0 , rosenbrock (x0 ), xl , xu , [], 1 )
107
107
# Now add better point
108
108
x1 = np .array ([1.0 , 0.9 ])
109
109
f1 = rosenbrock (x1 )
@@ -131,7 +131,7 @@ def runTest(self):
131
131
x0 = np .array ([- 1.2 , 1.0 ])
132
132
xl = - 1e2 * np .ones ((n ,))
133
133
xu = 1e2 * np .ones ((n ,))
134
- model = Model (npt , x0 , rosenbrock (x0 ), xl , xu , 1 )
134
+ model = Model (npt , x0 , rosenbrock (x0 ), xl , xu , [], 1 )
135
135
self .assertTrue (array_compare (model .sl , xl - x0 ), 'Wrong sl after initialisation' )
136
136
self .assertTrue (array_compare (model .su , xu - x0 ), 'Wrong su after initialisation' )
137
137
x1 = np .array ([1.0 , 0.9 ])
@@ -204,7 +204,7 @@ def runTest(self):
204
204
x0 = np .array ([- 1.2 , 1.0 ])
205
205
xl = - 1e2 * np .ones ((n ,))
206
206
xu = 1e2 * np .ones ((n ,))
207
- model = Model (npt , x0 , rosenbrock (x0 ), xl , xu , 1 )
207
+ model = Model (npt , x0 , rosenbrock (x0 ), xl , xu , [], 1 )
208
208
x1 = np .array ([1.0 , 0.9 ])
209
209
model .change_point (1 , x1 - model .xbase , rosenbrock (x1 ))
210
210
x2 = np .array ([1.0 , 1.0 ])
@@ -224,13 +224,13 @@ def runTest(self):
224
224
x0 = np .array ([- 1.2 , 1.0 ])
225
225
xl = - 1e2 * np .ones ((n ,))
226
226
xu = 1e2 * np .ones ((n ,))
227
- model = Model (npt , x0 , rosenbrock (x0 ), xl , xu , 1 )
227
+ model = Model (npt , x0 , rosenbrock (x0 ), xl , xu , [], 1 )
228
228
x1 = np .array ([1.0 , 0.9 ])
229
229
model .change_point (1 , x1 - model .xbase , rosenbrock (x1 ))
230
230
x2 = np .array ([2.0 , 0.9 ])
231
231
model .change_point (2 , x2 - model .xbase , rosenbrock (x2 ))
232
232
self .assertAlmostEqual (model .min_objective_value (), - 1e20 , msg = 'Wrong min obj value' )
233
- model = Model (npt , x0 , rosenbrock (x0 ), xl , xu , 1 , abs_tol = 1.0 )
233
+ model = Model (npt , x0 , rosenbrock (x0 ), xl , xu , [], 1 , abs_tol = 1.0 )
234
234
self .assertAlmostEqual (model .min_objective_value (), 1.0 , msg = 'Wrong min obj value 3' )
235
235
236
236
@@ -241,7 +241,7 @@ def runTest(self):
241
241
x0 = np .array ([- 1.2 , 1.0 ])
242
242
xl = - 1e2 * np .ones ((n ,))
243
243
xu = 1e2 * np .ones ((n ,))
244
- model = Model (npt , x0 , rosenbrock (x0 ), xl , xu , 1 , precondition = False )
244
+ model = Model (npt , x0 , rosenbrock (x0 ), xl , xu , [], 1 , precondition = False )
245
245
x1 = np .array ([1.0 , 0.9 ])
246
246
model .change_point (1 , x1 - model .xbase , rosenbrock (x1 ))
247
247
x2 = np .array ([2.0 , 0.9 ])
@@ -280,7 +280,7 @@ def runTest(self):
280
280
x0 = np .array ([1.0 , 1.0 ])
281
281
xl = - 1e2 * np .ones ((n ,))
282
282
xu = 1e2 * np .ones ((n ,))
283
- model = Model (npt , x0 , objfun (x0 ), xl , xu , 1 , precondition = False )
283
+ model = Model (npt , x0 , objfun (x0 ), xl , xu , [], 1 , precondition = False )
284
284
x1 = x0 + np .array ([1.0 , 0.0 ])
285
285
model .change_point (1 , x1 - model .xbase , objfun (x1 ))
286
286
x2 = x0 + np .array ([0.1 , 0.9 ])
@@ -323,7 +323,7 @@ def runTest(self):
323
323
self .assertTrue (np .allclose (hess , model .model_hess ), 'Bad Hessian' )
324
324
325
325
# Build a new model
326
- model2 = Model (npt , x0 , objfun (x0 ), xl , xu , 1 , precondition = False )
326
+ model2 = Model (npt , x0 , objfun (x0 ), xl , xu , [], 1 , precondition = False )
327
327
model2 .change_point (1 , x1 - model .xbase , objfun (x1 ))
328
328
model2 .change_point (2 , x2 - model .xbase , objfun (x2 ))
329
329
model2 .change_point (3 , x3 - model .xbase , objfun (x3 ))
@@ -350,7 +350,7 @@ def runTest(self):
350
350
# print(model2.model_hess)
351
351
352
352
# Build a new model
353
- model3 = Model (npt , x0 , objfun (x0 ), xl , xu , 1 , precondition = False )
353
+ model3 = Model (npt , x0 , objfun (x0 ), xl , xu , [], 1 , precondition = False )
354
354
model3 .change_point (1 , x1 - model .xbase , objfun (x1 ))
355
355
model3 .change_point (2 , x2 - model .xbase , objfun (x2 ))
356
356
model3 .change_point (3 , x3 - model .xbase , objfun (x3 ))
@@ -376,7 +376,7 @@ def runTest(self):
376
376
x0 = np .array ([1.0 , 1.0 ])
377
377
xl = - 1e2 * np .ones ((n ,))
378
378
xu = 1e2 * np .ones ((n ,))
379
- model = Model (npt , x0 , objfun (x0 ), xl , xu , 1 , precondition = False )
379
+ model = Model (npt , x0 , objfun (x0 ), xl , xu , [], 1 , precondition = False )
380
380
x1 = x0 + np .array ([1.0 , 0.0 ])
381
381
model .change_point (1 , x1 - model .xbase , objfun (x1 ))
382
382
x2 = x0 + np .array ([0.1 , 0.9 ])
@@ -420,7 +420,7 @@ def runTest(self):
420
420
self .assertTrue (np .allclose (hess , model .model_hess ), 'Bad Hessian' )
421
421
422
422
# Build a new model
423
- model2 = Model (npt , x0 , objfun (x0 ), xl , xu , 1 , precondition = False )
423
+ model2 = Model (npt , x0 , objfun (x0 ), xl , xu , [], 1 , precondition = False )
424
424
model2 .change_point (1 , x1 - model .xbase , objfun (x1 ))
425
425
model2 .change_point (2 , x2 - model .xbase , objfun (x2 ))
426
426
model2 .change_point (3 , x3 - model .xbase , objfun (x3 ))
@@ -448,7 +448,7 @@ def runTest(self):
448
448
# print(model2.model_hess)
449
449
450
450
# Build a new model
451
- model3 = Model (npt , x0 , objfun (x0 ), xl , xu , 1 , precondition = False )
451
+ model3 = Model (npt , x0 , objfun (x0 ), xl , xu , [], 1 , precondition = False )
452
452
model3 .change_point (1 , x1 - model .xbase , objfun (x1 ))
453
453
model3 .change_point (2 , x2 - model .xbase , objfun (x2 ))
454
454
model3 .change_point (3 , x3 - model .xbase , objfun (x3 ))
@@ -475,7 +475,7 @@ def runTest(self):
475
475
x0 = np .array ([1.0 , 1.0 ])
476
476
xl = - 1e2 * np .ones ((n ,))
477
477
xu = 1e2 * np .ones ((n ,))
478
- model = Model (npt , x0 , objfun (x0 ), xl , xu , 1 )
478
+ model = Model (npt , x0 , objfun (x0 ), xl , xu , [], 1 )
479
479
x1 = x0 + np .array ([1.0 , 0.0 ])
480
480
model .change_point (1 , x1 - model .xbase , objfun (x1 ))
481
481
x2 = x0 + np .array ([0.1 , 0.9 ])
@@ -511,7 +511,7 @@ def runTest(self):
511
511
x0 = np .array ([- 1.2 , 1.0 ])
512
512
xl = - 1e2 * np .ones ((n ,))
513
513
xu = 1e2 * np .ones ((n ,))
514
- model = Model (npt , x0 , rosenbrock (x0 ), xl , xu , 1 )
514
+ model = Model (npt , x0 , rosenbrock (x0 ), xl , xu , [], 1 )
515
515
x1 = np .array ([1.0 , 0.9 ])
516
516
model .change_point (1 , x1 - model .xbase , rosenbrock (x1 ))
517
517
x2 = np .array ([2.0 , 0.9 ])
@@ -534,7 +534,7 @@ def runTest(self):
534
534
x0 = np .array ([1.0 , 1.0 ])
535
535
xl = - 1e2 * np .ones ((n ,))
536
536
xu = 1e2 * np .ones ((n ,))
537
- model = Model (npt , x0 , objfun (x0 ), xl , xu , 1 )
537
+ model = Model (npt , x0 , objfun (x0 ), xl , xu , [], 1 )
538
538
x1 = x0 + np .array ([1.0 , 0.0 ])
539
539
model .change_point (1 , x1 - model .xbase , objfun (x1 ))
540
540
x2 = x0 + np .array ([0.1 , 0.9 ])
@@ -559,7 +559,7 @@ def runTest(self):
559
559
x0 = np .array ([1.0 , 1.0 ])
560
560
xl = - 1e2 * np .ones ((n ,))
561
561
xu = 1e2 * np .ones ((n ,))
562
- model = Model (npt , x0 , objfun (x0 ), xl , xu , 1 )
562
+ model = Model (npt , x0 , objfun (x0 ), xl , xu , [], 1 )
563
563
x1 = x0 + np .array ([1.0 , 0.0 ])
564
564
model .change_point (1 , x1 - model .xbase , objfun (x1 ))
565
565
x2 = x0 + np .array ([0.1 , 0.9 ])
@@ -586,7 +586,7 @@ def runTest(self):
586
586
x0 = np .array ([1.0 , 1.0 ])
587
587
xl = - 1e2 * np .ones ((n ,))
588
588
xu = 1e2 * np .ones ((n ,))
589
- model = Model (npt , x0 , objfun (x0 ), xl , xu , 1 )
589
+ model = Model (npt , x0 , objfun (x0 ), xl , xu , [], 1 )
590
590
x1 = x0 + np .array ([1.0 , 0.0 ])
591
591
model .change_point (1 , x1 - model .xbase , objfun (x1 ))
592
592
x2 = x0 + np .array ([0.1 , 0.9 ])
@@ -616,7 +616,7 @@ def runTest(self):
616
616
delta = 0.5
617
617
xl = - 1e2 * np .ones ((n ,))
618
618
xu = 1e2 * np .ones ((n ,))
619
- model = Model (npt , x0 , rosenbrock (x0 ), xl , xu , 1 )
619
+ model = Model (npt , x0 , rosenbrock (x0 ), xl , xu , [], 1 )
620
620
model .add_new_sample (0 , rosenbrock (x0 ))
621
621
x1 = x0 + delta * np .array ([1.0 , 0.0 ])
622
622
model .change_point (1 , x1 - model .xbase , rosenbrock (x1 ))
@@ -636,7 +636,7 @@ def runTest(self):
636
636
x0 = np .array ([0.5 , 0.5 ])
637
637
xl = - 1e2 * np .ones ((n ,))
638
638
xu = 1e2 * np .ones ((n ,))
639
- model = Model (npt , x0 , objfun (x0 ), xl , xu , 1 )
639
+ model = Model (npt , x0 , objfun (x0 ), xl , xu , [], 1 )
640
640
x1 = np .array ([0.05 , 0.1 ])
641
641
model .change_point (1 , x1 - model .xbase , objfun (x1 ))
642
642
x2 = np .array ([0.1 , 0.05 ])
@@ -660,7 +660,7 @@ def runTest(self):
660
660
x0 = np .array ([0.5 , 0.5 ])
661
661
xl = - 1e2 * np .ones ((n ,))
662
662
xu = 1e2 * np .ones ((n ,))
663
- model = Model (npt , x0 , objfun (x0 ), xl , xu , 1 )
663
+ model = Model (npt , x0 , objfun (x0 ), xl , xu , [], 1 )
664
664
x1 = np .array ([0.524 , 0.0006 ])
665
665
model .change_point (1 , x1 - model .xbase , objfun (x1 ))
666
666
x2 = np .array ([0.032 , 0.323 ])
@@ -681,7 +681,7 @@ def runTest(self):
681
681
x0 = np .array ([- 1.2 , 1.0 ])
682
682
xl = - 1e2 * np .ones ((n ,))
683
683
xu = 1e2 * np .ones ((n ,))
684
- model = Model (npt , x0 , rosenbrock (x0 ), xl , xu , 1 )
684
+ model = Model (npt , x0 , rosenbrock (x0 ), xl , xu , [], 1 )
685
685
x1 = np .array ([1.0 , 0.9 ])
686
686
model .change_point (1 , x1 - model .xbase , rosenbrock (x1 ))
687
687
x2 = np .array ([2.0 , 0.9 ])
0 commit comments