File tree Expand file tree Collapse file tree 4 files changed +14
-7
lines changed Expand file tree Collapse file tree 4 files changed +14
-7
lines changed Original file line number Diff line number Diff line change @@ -265,7 +265,7 @@ fn main() -> anyhow::Result<()> {
265
265
. configure ( |config| {
266
266
config
267
267
. n_cstr ( N_CSTR )
268
- . cstr_tol ( & cstr_tol)
268
+ . cstr_tol ( cstr_tol. clone ( ) )
269
269
. n_clusters ( 1 )
270
270
. n_start ( 50 )
271
271
. n_doe ( n_doe)
Original file line number Diff line number Diff line change @@ -412,13 +412,20 @@ mod tests {
412
412
. with_rng ( Xoshiro256Plus :: seed_from_u64 ( 42 ) )
413
413
. sample ( 3 ) ;
414
414
let res = EgorBuilder :: optimize ( f_g24)
415
- . configure ( |config| config. n_cstr ( 2 ) . doe ( & doe) . max_iters ( 20 ) . random_seed ( 42 ) )
415
+ . configure ( |config| {
416
+ config
417
+ . n_cstr ( 2 )
418
+ . doe ( & doe)
419
+ . max_iters ( 20 )
420
+ . cstr_tol ( array ! [ 2e-6 , 1e-6 ] )
421
+ . random_seed ( 42 )
422
+ } )
416
423
. min_within ( & xlimits)
417
424
. run ( )
418
425
. expect ( "Minimize failure" ) ;
419
426
println ! ( "G24 optim result = {res:?}" ) ;
420
427
let expected = array ! [ 2.3295 , 3.1785 ] ;
421
- assert_abs_diff_eq ! ( expected, res. x_opt, epsilon = 5e -2) ;
428
+ assert_abs_diff_eq ! ( expected, res. x_opt, epsilon = 2e -2) ;
422
429
}
423
430
424
431
#[ test]
@@ -434,7 +441,7 @@ mod tests {
434
441
. regression_spec ( RegressionSpec :: ALL )
435
442
. correlation_spec ( CorrelationSpec :: ALL )
436
443
. n_cstr ( 2 )
437
- . cstr_tol ( & array ! [ 2e-6 , 2e-6 ] )
444
+ . cstr_tol ( array ! [ 2e-6 , 2e-6 ] )
438
445
. q_points ( 2 )
439
446
. qei_strategy ( QEiStrategy :: KrigingBeliever )
440
447
. doe ( & doe)
Original file line number Diff line number Diff line change @@ -125,8 +125,8 @@ impl EgorConfig {
125
125
}
126
126
127
127
/// Sets the tolerance on constraints violation (`cstr < tol`)
128
- pub fn cstr_tol ( mut self , tol : & Array1 < f64 > ) -> Self {
129
- self . cstr_tol = Some ( tol. to_owned ( ) ) ;
128
+ pub fn cstr_tol ( mut self , tol : Array1 < f64 > ) -> Self {
129
+ self . cstr_tol = Some ( tol) ;
130
130
self
131
131
}
132
132
Original file line number Diff line number Diff line change @@ -433,7 +433,7 @@ impl Egor {
433
433
. max_iters ( max_iters. unwrap_or ( 1 ) )
434
434
. n_start ( self . n_start )
435
435
. n_doe ( self . n_doe )
436
- . cstr_tol ( & cstr_tol)
436
+ . cstr_tol ( cstr_tol)
437
437
. regression_spec ( egobox_moe:: RegressionSpec :: from_bits ( self . regression_spec . 0 ) . unwrap ( ) )
438
438
. correlation_spec (
439
439
egobox_moe:: CorrelationSpec :: from_bits ( self . correlation_spec . 0 ) . unwrap ( ) ,
You can’t perform that action at this time.
0 commit comments