diff options
-rw-r--r-- | src/fit.c | 22 |
1 files changed, 20 insertions, 2 deletions
@@ -53,8 +53,7 @@ double nll(unsigned int n, const double *x, double *grad, void *params) int fit_event(event *ev, double *fmin) { - double x[7]; - double ss[7]; + double x[7], ss[7], lb[7], ub[7]; int rv; nlopt_opt opt = nlopt_create(NLOPT_LN_SBPLX, 7); @@ -77,6 +76,25 @@ int fit_event(event *ev, double *fmin) ss[5] = 0.1; ss[6] = 1.0; + lb[0] = 1.0; + lb[1] = -1000.0; + lb[2] = -1000.0; + lb[3] = -1000.0; + lb[4] = 0.0; + lb[5] = 0.0; + lb[6] = 0.0; + + ub[0] = 100000.0; + ub[1] = 1000.0; + ub[2] = 1000.0; + ub[3] = 1000.0; + ub[4] = M_PI; + ub[5] = 2*M_PI; + ub[6] = 400.0; + + nlopt_set_lower_bounds(opt, lb); + nlopt_set_upper_bounds(opt, ub); + nlopt_set_initial_step(opt, ss); rv = nlopt_optimize(opt,x,fmin); |