The easiest way is to smoothly transform your parameters. E.g. if you have a parameter y constrained to fall within [-1; 72], then define
y = 73.0 / (1 + exp(-x)) - 1 in terms of a sigmoid function and optimize w.r.t. unconstrained x over the real line. Note that y goes to 72 for x->Inf and y goes to -1 for x->-Inf, as desired. Regards, -- mj On Fri, Sep 16, 2011 at 16:25, Srinivasan, Rajagopalan [ANMUS] < [email protected]> wrote: > Hope someone can help this "newbie" to gsl. > > > > I have a minimization problem but I cannot conceive of a way to come up > with a gradient. Hence I am using gsl_multimin_fminimizer_nmsimplex. > There are 5 variables in the range -1.0 - 72.0 with a desired step size > of 0.01. > > > > Since I do have constraints (-1.0 .. 72.0) , in my cost function, I > return GSL_NAN when the constraints are violated by the independent > variables. I am not sure if this is the proper way to implement the > constraints. The results so far are unsatisfactory. > > > > Couple of questions: > > > > - What is the proper way to implement the constraints? > > - I was hoping to use nmsimplex2 but does not appear to be in > my gsl library. (My problem is of size 5 and performance is somewhat > critical). > > - Similarly how about nmsimplex2rand > > > > If there are other suggestions, I would welcome them as well. > > > > Cheers, srini > > _______________________________________________ > Help-gsl mailing list > [email protected] > https://lists.gnu.org/mailman/listinfo/help-gsl > _______________________________________________ Help-gsl mailing list [email protected] https://lists.gnu.org/mailman/listinfo/help-gsl
