@@ -197,6 +197,7 @@ impl<O: GroupFunc, SB: SurrogateBuilder> Egor<O, SB> {
197
197
y_opt : result. state . get_full_best_cost ( ) . unwrap ( ) . to_owned ( ) ,
198
198
x_hist : x_data,
199
199
y_hist : y_data,
200
+ state : result. state ,
200
201
}
201
202
} else {
202
203
let x_data = to_discrete_space ( & xtypes, & x_data. view ( ) ) ;
@@ -214,6 +215,7 @@ impl<O: GroupFunc, SB: SurrogateBuilder> Egor<O, SB> {
214
215
y_opt : result. state . get_full_best_cost ( ) . unwrap ( ) . to_owned ( ) ,
215
216
x_hist : x_data,
216
217
y_hist : y_data,
218
+ state : result. state ,
217
219
}
218
220
} ;
219
221
info ! ( "Optim Result: min f(x)={} at x={}" , res. y_opt, res. x_opt) ;
@@ -280,6 +282,7 @@ mod tests {
280
282
. max_iters ( 20 )
281
283
. regression_spec ( RegressionSpec :: ALL )
282
284
. correlation_spec ( CorrelationSpec :: ALL )
285
+ . seed ( 1 )
283
286
} )
284
287
. min_within ( & array ! [ [ 0.0 , 25.0 ] ] )
285
288
. run ( )
@@ -321,27 +324,15 @@ mod tests {
321
324
let xlimits = array ! [ [ 0.0 , 25.0 ] ] ;
322
325
let doe = Lhs :: new ( & xlimits) . sample ( 10 ) ;
323
326
let res = EgorBuilder :: optimize ( xsinx)
324
- . configure ( |config| {
325
- config
326
- . max_iters ( 15 )
327
- . doe ( & doe)
328
- . outdir ( outdir)
329
- . random_seed ( 42 )
330
- } )
327
+ . configure ( |config| config. max_iters ( 15 ) . doe ( & doe) . outdir ( outdir) . seed ( 42 ) )
331
328
. min_within ( & xlimits)
332
329
. run ( )
333
330
. expect ( "Minimize failure" ) ;
334
331
let expected = array ! [ 18.9 ] ;
335
332
assert_abs_diff_eq ! ( expected, res. x_opt, epsilon = 1e-1 ) ;
336
333
337
334
let res = EgorBuilder :: optimize ( xsinx)
338
- . configure ( |config| {
339
- config
340
- . max_iters ( 5 )
341
- . outdir ( outdir)
342
- . hot_start ( true )
343
- . random_seed ( 42 )
344
- } )
335
+ . configure ( |config| config. max_iters ( 5 ) . outdir ( outdir) . hot_start ( true ) . seed ( 42 ) )
345
336
. min_within ( & xlimits)
346
337
. run ( )
347
338
. expect ( "Egor should minimize xsinx" ) ;
@@ -375,7 +366,7 @@ mod tests {
375
366
. regression_spec ( RegressionSpec :: ALL )
376
367
. correlation_spec ( CorrelationSpec :: ALL )
377
368
. target ( 1e-2 )
378
- . random_seed ( 42 )
369
+ . seed ( 42 )
379
370
} )
380
371
. min_within ( & xlimits)
381
372
. run ( )
@@ -395,7 +386,7 @@ mod tests {
395
386
. with_rng ( Xoshiro256Plus :: seed_from_u64 ( 42 ) )
396
387
. sample ( 10 ) ;
397
388
let res = EgorBuilder :: optimize ( rosenb)
398
- . configure ( |config| config. doe ( & doe) . max_iters ( 20 ) . random_seed ( 42 ) )
389
+ . configure ( |config| config. doe ( & doe) . max_iters ( 20 ) . seed ( 42 ) )
399
390
. min_within ( & xlimits)
400
391
. run ( )
401
392
. expect ( "Minimize failure" ) ;
@@ -445,7 +436,7 @@ mod tests {
445
436
. doe ( & doe)
446
437
. max_iters ( 20 )
447
438
. cstr_tol ( array ! [ 2e-6 , 1e-6 ] )
448
- . random_seed ( 42 )
439
+ . seed ( 42 )
449
440
} )
450
441
. min_within ( & xlimits)
451
442
. run ( )
@@ -474,7 +465,7 @@ mod tests {
474
465
. doe ( & doe)
475
466
. target ( -5.5030 )
476
467
. max_iters ( 30 )
477
- . random_seed ( 42 )
468
+ . seed ( 42 )
478
469
} )
479
470
. min_within ( & xlimits)
480
471
. run ( )
@@ -508,7 +499,7 @@ mod tests {
508
499
. max_iters ( max_iters)
509
500
. target ( -15.1 )
510
501
. infill_strategy ( InfillStrategy :: EI )
511
- . random_seed ( 42 )
502
+ . seed ( 42 )
512
503
} )
513
504
. min_within_mixint_space ( & xtypes)
514
505
. run ( )
@@ -530,7 +521,7 @@ mod tests {
530
521
. max_iters ( max_iters)
531
522
. target ( -15.1 )
532
523
. infill_strategy ( InfillStrategy :: EI )
533
- . random_seed ( 42 )
524
+ . seed ( 42 )
534
525
} )
535
526
. min_within_mixint_space ( & xtypes)
536
527
. run ( )
@@ -550,7 +541,7 @@ mod tests {
550
541
. regression_spec ( egobox_moe:: RegressionSpec :: CONSTANT )
551
542
. correlation_spec ( egobox_moe:: CorrelationSpec :: SQUAREDEXPONENTIAL )
552
543
. max_iters ( max_iters)
553
- . random_seed ( 42 )
544
+ . seed ( 42 )
554
545
} )
555
546
. min_within_mixint_space ( & xtypes)
556
547
. run ( )
@@ -601,7 +592,7 @@ mod tests {
601
592
. regression_spec ( egobox_moe:: RegressionSpec :: CONSTANT )
602
593
. correlation_spec ( egobox_moe:: CorrelationSpec :: SQUAREDEXPONENTIAL )
603
594
. max_iters ( max_iters)
604
- . random_seed ( 42 )
595
+ . seed ( 42 )
605
596
} )
606
597
. min_within_mixint_space ( & xtypes)
607
598
. run ( )
@@ -632,7 +623,7 @@ mod tests {
632
623
let xlimits = as_continuous_limits :: < f64 > ( & xtypes) ;
633
624
634
625
EgorBuilder :: optimize ( mixobj)
635
- . configure ( |config| config. outdir ( outdir) . max_iters ( 1 ) . random_seed ( 42 ) )
626
+ . configure ( |config| config. outdir ( outdir) . max_iters ( 1 ) . seed ( 42 ) )
636
627
. min_within_mixint_space ( & xtypes)
637
628
. run ( )
638
629
. unwrap ( ) ;
@@ -644,13 +635,7 @@ mod tests {
644
635
// Check that with no iteration, obj function is never called
645
636
// as the DOE does not need to be evaluated!
646
637
EgorBuilder :: optimize ( |_x| panic ! ( "Should not call objective function!" ) )
647
- . configure ( |config| {
648
- config
649
- . outdir ( outdir)
650
- . hot_start ( true )
651
- . max_iters ( 0 )
652
- . random_seed ( 42 )
653
- } )
638
+ . configure ( |config| config. outdir ( outdir) . hot_start ( true ) . max_iters ( 0 ) . seed ( 42 ) )
654
639
. min_within_mixint_space ( & xtypes)
655
640
. run ( )
656
641
. unwrap ( ) ;
0 commit comments