help-gsl
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Help-gsl] GSL - Simulated Annealing Question - Multiple Variables


From: Carl Boettiger
Subject: Re: [Help-gsl] GSL - Simulated Annealing Question - Multiple Variables
Date: Fri, 4 Jun 2010 09:28:17 -0700

Hi Jesse,

The simulated annealing case has two modes, one for statically allocated
variables and another for dynamically allocated ones.  When you use a
dynamically allocated object like gsl_vector, you need to pass it a copy fn,
a construct and copy fn, and a destructor function, instead of the those
three NULLS.  It's well explained in the manual but there's no example of
this included with gsl, so it's a common source of confusion.  Basically its
just a matter of conforming to the format these functions have to have for
their arguments.

It's not stand alone, but here's an example of how I often use it.
http://gist.github.com/425617  Hope that helps.  If not, let us know!

-Carl


On Thu, Jun 3, 2010 at 9:27 AM, Coyle, Jesse A <address@hidden>wrote:

>
> Hello all,
>
> I had a question about the gsl simulated annealing code and I was hoping
> that maybe someone here might have a solution. I have been using the
> simulated annealing functions from the gsl library in an attempt to perform
> basic linear regressions. I have successfully utilized it for a simple
> one-variable case, however I am now in the process of trying to fit more
> variables. (i.e) y = b0 + b1x1 + b2x2. I am confused on how to pass multiple
> variables to the gsl_siman_solve function. I have tried a simple array, and
> also tried to use the gsl_vector structure. I am either having problems
> retrieving the current condition in the energy, step, and metric
> evaluations, or am passing condition to the gsl_siman_solve function
> improperly.Ultimately I would like to pass in 2 variables (B0 and B1, or
> perhaps even more, and minimize them using experimental data. I have tried
> to alter the step function and metric function for multiple variables to no
> success. I have attached a sample code I thought might have worked, but
> every time I try to run it, I get a segmentation fault. If you have the
> time, maybe you could take a peek and see what I am doing wrong.
>
> Thanks,
>
> Jesse Coyle
>
> Nuclear & Radiological Engineering
> Georgia Institute of Technology
> _______________________________________________
> Help-gsl mailing list
> address@hidden
> http://lists.gnu.org/mailman/listinfo/help-gsl
>
>


-- 
Carl Boettiger
Population Biology, UC Davis
http://two.ucdavis.edu/~cboettig


reply via email to

[Prev in Thread] Current Thread [Next in Thread]