@@ -800,6 +800,7 @@ static nlopt_result nlopt_optimize_(nlopt_opt opt, double *x, double *minf)
800800 double rho_init = nlopt_get_param (opt , "rho_init" ,1.0 );
801801 int inner_gradients = (int )nlopt_get_param (opt , "inner_gradients" ,1 );
802802 int always_improve = (int )nlopt_get_param (opt , "always_improve" ,1 );
803+ double sigma_min = nlopt_get_param (opt , "sigma_min" ,0.0 );
803804 nlopt_opt dual_opt ;
804805 nlopt_result ret ;
805806
@@ -809,6 +810,8 @@ static nlopt_result nlopt_optimize_(nlopt_opt opt, double *x, double *minf)
809810 RETURN_ERR (NLOPT_INVALID_ARGS , opt , "inner_gradients must be 0 or 1" );
810811 if (always_improve != 0 && always_improve != 1 )
811812 RETURN_ERR (NLOPT_INVALID_ARGS , opt , "always_improve must be 0 or 1" );
813+ if (sigma_min < 0.0 )
814+ RETURN_ERR (NLOPT_INVALID_ARGS , opt , "sigma_min must be non-negative" );
812815 verbosity = verbosity < 0 ? 0 : verbosity ;
813816
814817#define LO (param , def ) (opt->local_opt ? opt->local_opt->param : (def))
@@ -823,9 +826,9 @@ static nlopt_result nlopt_optimize_(nlopt_opt opt, double *x, double *minf)
823826 nlopt_set_maxeval (dual_opt , (int )nlopt_get_param (opt , "dual_maxeval" , LO (maxeval , 100000 )));
824827#undef LO
825828 if (algorithm == NLOPT_LD_MMA )
826- ret = mma_minimize (n , f , f_data , opt -> m , opt -> fc , lb , ub , x , minf , & stop , dual_opt , inner_maxeval , (unsigned )verbosity , rho_init , inner_gradients , always_improve , opt -> dx );
829+ ret = mma_minimize (n , f , f_data , opt -> m , opt -> fc , lb , ub , x , minf , & stop , dual_opt , inner_maxeval , (unsigned )verbosity , rho_init , inner_gradients , always_improve , sigma_min , opt -> dx );
827830 else
828- ret = ccsa_quadratic_minimize (n , f , f_data , opt -> m , opt -> fc , opt -> pre , lb , ub , x , minf , & stop , dual_opt , inner_maxeval , (unsigned )verbosity , rho_init , inner_gradients , always_improve , opt -> dx );
831+ ret = ccsa_quadratic_minimize (n , f , f_data , opt -> m , opt -> fc , opt -> pre , lb , ub , x , minf , & stop , dual_opt , inner_maxeval , (unsigned )verbosity , rho_init , inner_gradients , always_improve , sigma_min , opt -> dx );
829832 nlopt_destroy (dual_opt );
830833 return ret ;
831834 }
0 commit comments