[Top][All Lists]

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

[Help-gsl] Multidimensional Minimizer nmsimplex 2 : How to ignore certai

From: Philipp Basler
Subject: [Help-gsl] Multidimensional Minimizer nmsimplex 2 : How to ignore certain outputs during the Minimization
Date: Wed, 8 Jul 2015 16:58:08 +0200

Hello and thanks for reading this.

I have a Function which receives 2 variables v1 and v2 and 13 Parameters. I
want to minimize it in respect to v1 and v2 and the other parameters stay
constant during the process. I can't derive this Function as one can not
give an closed analytical form.

During the Function I have 4 4x4 Matrices from which I need the
Eigenvalues. I calculate these with the Eigen package. As I need the square
roots of these Eigenvalues, these can not be negative in which case the
tested v1,v2 does not interest me for my search of the minimum.

My Question:
Is there a Method so that the Minimization Routine just ignores these
cases? Maybe as an Option or just as an Output Parameter I can implement in
my function.

My Minimization Method is similiar to the one in the Manual and shown below.

Kind regards,
Philipp Basler.

const gsl_multimin_fminimizer_type *T = gsl_multimin_fminimizer_nmsimplex2;
  gsl_multimin_fminimizer *s = NULL;
  gsl_vector *ss, *x;
  gsl_multimin_function minex_func;

size_t iter = 0;
  int status;
  double size;

/* Starting point */
      x = gsl_vector_alloc (2);
      gsl_vector_set (x, 0, v1Start);
      gsl_vector_set (x, 1, v2Start);

/* Set initial step sizes to 1 */
      ss = gsl_vector_alloc (2);
      gsl_vector_set_all (ss, 1.0);

/* Initialize method and iterate */
      minex_func.n = 2;
      minex_func.f = my_f;
      minex_func.params = par;

      s = gsl_multimin_fminimizer_alloc (T, 2);
      gsl_multimin_fminimizer_set (s, &minex_func, x, ss);

          status = gsl_multimin_fminimizer_iterate(s);

          if (status)

          size = gsl_multimin_fminimizer_size (s);
          status = gsl_multimin_test_size (size, C_MinTOL);

          if (status == GSL_SUCCESS)
to minimum at\n");
<> ("%5d
%10.3e %10.3e f() = %7.3f size = %.3f\n",
                  gsl_vector_get (s->x, 0),
                  gsl_vector_get (s->x, 1),
                  s->fval, size);
<>(" at
Temperature %lf \n " , Temptmp);


      while (status == GSL_CONTINUE && iter < 1000);

reply via email to

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