Hi Philipp, few more details for the particular form of your function would help a lot. >From your description it seems that your function can have multiple minima depending on some of the input parameters (not necessarily v1,...v3), hence the illegal solution, is this correct?
There are several ways to treat constraints, and it is not always straightforward, because these may affect the quality of your solution see for example: Constraint-handling in nature-inspired numerical optimization: Past, present and future, Efrén Mezura-Montes, Carlos A. Coello Coello, 2011. One way is as Gilberto mentioned, return a value of the function which is large (compared to the minimum you are seeking). This, in some cases, may make your algorithm get stuck in suboptimal solutions (which may be very well good enough for your purposes), or for a very difficult fitness landscape, you may get an error (all of the proposed values of the minimizer are the same / "illegal"). A slightly better approach is for illegal values to return a very large value times a measure of "how illegal" is your solution (e.g. how far from zero is, e.g. somthing_large * norm_of_vector_of_illegal values ). In this way you allow for some exploration of parameter space close to the point of interest. Another approach is to allow the minimizer to complete the fit, and afterwards decided if you will keep or not the solution (remember, in the case of multiple minima, this method cannot give a unique solution, so you need another minimizer (mcmc / genetic algorithms / evolutionary optimization etc)). Another to tranform the (v1,v2,v3) --> (x1,x3,x3) where each of the tranformed values is a legal choice in box constraints. If you are searching for a numerical multivariate global minimization solver, try CMA-ES (it is not implemented in GSL, but it has a C-code, I am using libcmaes (C++ version) ). It would actually be a nice idea to have it in GSL, I don't know how fast would be to port the C code of Hansen in GSL standards: https://www.lri.fr/~hansen/cmaesintro.html Depending on the functional form you have this may, or may not, be the fastest choice. I hope the above helps, cheers Foivos On Wed, Nov 11, 2015 at 9:43 PM, Philipp Basler < [email protected]> wrote: > Hello to all, > > I am using gsl_multimin_fminimizer_nmsimplex2 to minimize a function V ( > v1,v2,v3) in those 3 variables v1,v2,v3. The function itself has a few more > parameters but those are constant during an Minimizationsprocess. > Also I can not calculate any derivatives of this function. > Normally you could just use the nmsimplex2 method to minimize this but I > have a further constraint : > In the process of calculating V(v1,v2,v3) there are two 4x4 real and > symmetric Matrices from whom I need the Eigenvalues, those are calculated > numerically with the Eigen package. All entries of those both Matrices are > functions of v1,v2 and v3 and therefore the Eigenvalues are too. > Now my constraint: If any of those 8 Eigenvalues is negativ I need to > discard this combination of v1,v2,v3 and it is not allowed to enter my > search for a minimum. > > Is there a way to do this? > > Cheers, > Philipp >
