@@ -3,7 +3,7 @@ use egobox_doe::{Lhs, LhsKind, SamplingMethod};
3
3
use ndarray:: { Array1 , Array2 , Axis , Zip } ;
4
4
use ndarray_rand:: rand:: { Rng , SeedableRng } ;
5
5
use rand_xoshiro:: Xoshiro256Plus ;
6
- use rayon:: prelude:: * ;
6
+ // use rayon::prelude::*;
7
7
8
8
#[ cfg( not( feature = "blas" ) ) ]
9
9
use linfa_linalg:: norm:: * ;
@@ -114,9 +114,17 @@ impl<'a, R: Rng + Clone + Sync + Send> LhsOptimizer<'a, R> {
114
114
} )
115
115
. collect ( ) ;
116
116
let values = Array1 :: from_vec ( vals. iter ( ) . map ( |( _, y, _) | * y) . collect ( ) ) ;
117
- let index_min = values
118
- . argmin ( )
119
- . unwrap_or_else ( |err| panic ! ( "Cannot find min in {}: {:?}" , values, err) ) ;
117
+ let index_min = values. argmin ( ) . unwrap_or_else ( |err| {
118
+ log:: error!(
119
+ "LHS optimization failed! Cannot find minimum in {} (Error: {})" ,
120
+ values,
121
+ err
122
+ ) ;
123
+ if values. is_empty ( ) {
124
+ log:: info!( "No valid value maybe due to ill-formed surrogate models" ) ;
125
+ }
126
+ panic ! ( "Optimization Aborted!" )
127
+ } ) ;
120
128
(
121
129
true ,
122
130
vals[ index_min] . 0 . to_owned ( ) ,
@@ -142,7 +150,6 @@ impl<'a, R: Rng + Clone + Sync + Send> LhsOptimizer<'a, R> {
142
150
143
151
// Make n_start optim
144
152
let x_optims = ( 0 ..self . n_start )
145
- . into_par_iter ( )
146
153
. map ( |_| self . find_lhs_min ( lhs. clone ( ) ) )
147
154
. collect :: < Vec < _ > > ( ) ;
148
155
0 commit comments