Skip to content

Commit ecd1b58

Browse files
salomonlamontoison
authored andcommitted
Simplify parameters constraints error catching
1 parent c121e08 commit ecd1b58

1 file changed

Lines changed: 21 additions & 21 deletions

File tree

src/core.jl

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -212,27 +212,27 @@ function check_options(options::NomadOptions)
212212
end
213213
end
214214
end
215-
(options.max_bb_eval > 0) ? nothing : error("NOMAD.jl error: wrong parameters, max_bb_eval must be strictly positive")
216-
(options.eval_queue_sort EvalSortTypes) ? nothing : error("NOMAD.jl error: wrong parameters, eval_queue_sort must belong to EvalSortTypes, i.e. $(EvalSortTypes)")
217-
(options.sgtelib_model_max_eval > 0) ? nothing : error("NOMAD.jl error: wrong parameters, sgtelib_model_max_eval must be strictly positive")
218-
(options.h_max_0 > 0) ? nothing : error("NOMAD.jl error: wrong parameters, h_max_0 must be strictly positive")
219-
(isempty(options.direction_type) || options.direction_type DirectionTypes) ? nothing : error("NOMAD.jl error: wrong parameters, direction_type is either empty, or must belong to DirectionTypes, i.e. $(DirectionTypes)")
220-
(isempty(options.direction_type_secondary_poll) || options.direction_type_secondary_poll DirectionTypes) ? nothing : error("NOMAD.jl error: wrong parameters, direction_type_secondary_poll is either empty, or must belong to DirectionTypes, i.e. $(DirectionTypes)")
221-
(options.anisotropy_factor > 0) ? nothing : error("NOMAD.jl error: wrong parameters, anisotropy_factor must be strictly positive")
222-
(options.lh_search[1] >= 0 && options.lh_search[2] >=0) ? nothing : error("NOMAD.jl error: the lh_search parameters must be positive or null")
223-
(options.speculative_search_base_factor > 1) ? nothing : error("NOMAD.jl error: wrong parameters, speculative_search_base_factor must be > 1")
224-
(options.speculative_search_max >= 0) ? nothing : error("NOMAD.jl error: wrong parameters, speculative_search_max must be positive")
225-
(options.nm_delta_e > 1) ? nothing : error("NOMAD.jl error: wrong parameters, nm_delta_e must belong to ]1, + ∞[")
226-
(-1 < options.nm_delta_ic < 0) ? nothing : error("NOMAD.jl error: wrong parameters, nm_delta_ic must belong to ]-1, 0[")
227-
(0 < options.nm_delta_oc < 1) ? nothing : error("NOMAD.jl error: wrong parameters, nm_delta_oc must belong to ]0, 1[")
228-
(0 < options.nm_gamma < 1) ? nothing : error("NOMAD.jl error: wrong parameters, nm_gamma must belong to ]0, 1[")
229-
(0 < options.nm_search_rank_eps) ? nothing : error("NOMAD.jl error: wrong parameters, nm_search_rank_eps must be positive")
230-
(0 < options.nm_search_max_trial_pts_nfactor) ? nothing : error("NOMAD.jl error: wrong parameters, nm_search_max_trial_pts_nfactor must be positive")
231-
(options.vns_mads_search_max_trial_pts_nfactor >= 0) ? nothing : error("NOMAD.jl error: wrong parameters, vns_mads_search_max_trial_pts_nfactor must be positive")
232-
(0 <= options.vns_mads_search_trigger <= 1) ? nothing : error("NOMAD.jl error: wrong parameters, vns_mads_search_trigger is a ratio which must be comprised between 0 and 1")
233-
(!isnothing(options.max_time) && options.max_time > 0) || (isnothing(options.max_time)) ? nothing : error("NOMAD.jl error: wrong parameters, max_time must be strictly positive if defined")
234-
(options.linear_converter in BBLinearConverterTypes) ? nothing : error("NOMAD.jl error: the linear_converter type is not defined")
235-
(options.linear_constraints_atol >= 0) ? nothing : error("NOMAD.jl error: the linear_constraints_atol parameter must be positive or null")
215+
(options.max_bb_eval > 0) || error("NOMAD.jl error: wrong parameters, max_bb_eval must be strictly positive")
216+
(options.eval_queue_sort EvalSortTypes) || error("NOMAD.jl error: wrong parameters, eval_queue_sort must belong to EvalSortTypes, i.e. $(EvalSortTypes)")
217+
(options.sgtelib_model_max_eval > 0) || error("NOMAD.jl error: wrong parameters, sgtelib_model_max_eval must be strictly positive")
218+
(options.h_max_0 > 0) || error("NOMAD.jl error: wrong parameters, h_max_0 must be strictly positive")
219+
(isempty(options.direction_type) || options.direction_type DirectionTypes) || error("NOMAD.jl error: wrong parameters, direction_type is either empty, or must belong to DirectionTypes, i.e. $(DirectionTypes)")
220+
(isempty(options.direction_type_secondary_poll) || options.direction_type_secondary_poll DirectionTypes) || error("NOMAD.jl error: wrong parameters, direction_type_secondary_poll is either empty, or must belong to DirectionTypes, i.e. $(DirectionTypes)")
221+
(options.anisotropy_factor > 0) || error("NOMAD.jl error: wrong parameters, anisotropy_factor must be strictly positive")
222+
(options.lh_search[1] >= 0 && options.lh_search[2] >=0) || error("NOMAD.jl error: the lh_search parameters must be positive or null")
223+
(options.speculative_search_base_factor > 1) || error("NOMAD.jl error: wrong parameters, speculative_search_base_factor must be > 1")
224+
(options.speculative_search_max >= 0) || error("NOMAD.jl error: wrong parameters, speculative_search_max must be positive")
225+
(options.nm_delta_e > 1) || error("NOMAD.jl error: wrong parameters, nm_delta_e must belong to ]1, + ∞[")
226+
(-1 < options.nm_delta_ic < 0) || error("NOMAD.jl error: wrong parameters, nm_delta_ic must belong to ]-1, 0[")
227+
(0 < options.nm_delta_oc < 1) || error("NOMAD.jl error: wrong parameters, nm_delta_oc must belong to ]0, 1[")
228+
(0 < options.nm_gamma < 1) || error("NOMAD.jl error: wrong parameters, nm_gamma must belong to ]0, 1[")
229+
(0 < options.nm_search_rank_eps) || error("NOMAD.jl error: wrong parameters, nm_search_rank_eps must be positive")
230+
(0 < options.nm_search_max_trial_pts_nfactor) || error("NOMAD.jl error: wrong parameters, nm_search_max_trial_pts_nfactor must be positive")
231+
(options.vns_mads_search_max_trial_pts_nfactor >= 0) || error("NOMAD.jl error: wrong parameters, vns_mads_search_max_trial_pts_nfactor must be positive")
232+
(0 <= options.vns_mads_search_trigger <= 1) || error("NOMAD.jl error: wrong parameters, vns_mads_search_trigger is a ratio which must be comprised between 0 and 1")
233+
(!isnothing(options.max_time) && options.max_time > 0) || (isnothing(options.max_time)) || error("NOMAD.jl error: wrong parameters, max_time must be strictly positive if defined")
234+
(options.linear_converter in BBLinearConverterTypes) || error("NOMAD.jl error: the linear_converter type is not defined")
235+
(options.linear_constraints_atol >= 0) || error("NOMAD.jl error: the linear_constraints_atol parameter must be positive or null")
236236
end
237237

238238
"""

0 commit comments

Comments
 (0)