Thanks. What about a method like NonLinearConjugateGradientOptimizer? The API is not so clear - are there any examples of usage?
If it can be helpful for others, I will collate the information I am receiving on the general topic of optimizing with commons and post it. Philippe On Fri, May 24, 2013 at 10:28 AM, Gilles <gil...@harfang.homelinux.org>wrote: > On Fri, 24 May 2013 09:52:23 -0400, Mister Mak wrote: > >> The multivariate function in my example was indeed flawed. Here is a >> better example with Thomas' solution: >> >> MultivariateFunction g = >> new MultivariateFunction() { >> public double value(double[] x) { >> return Math.exp(-Math.abs(x[0] - 5.4)) * >> Math.exp(-Math.abs(x[1] - 2.2)) + 1.1; >> } >> }; >> SimplexOptimizer optimizerMult = new SimplexOptimizer(1e-3, 1e-6); >> PointValuePair solutionMult = optimizerMult.optimize(new >> MaxEval(200), new ObjectiveFunction(g), GoalType.MAXIMIZE, new >> InitialGuess(new double[]{0, 0}), new MultiDirectionalSimplex(2)); >> >> System.out.println("Min is: " + solutionMult.getValue() + >> "\tobtained at:" + Arrays.toString(solutionMult.**getKey())); >> >> >> The above code works. However, introducing constraints like below, >> doesn't. >> >> PointValuePair solutionMult = optimizerMult.optimize(new MaxEval(200), new >> ObjectiveFunction(g), GoalType.MAXIMIZE, new InitialGuess(new double[]{0, >> 0}), new MultiDirectionalSimplex(2), new SimpleBounds(new double[]{-10, >> -15}, new double[]{12, 22})); >> >> So which optimizer does accept bounds? >> > > "SimpleBounds" are used by "CMAESOptimizer". > > For the other optimizers, bound handling can be mimicked by using the > MultivariateFunctionMappingAda**pter > or > MultivariateFunctionPenaltyAda**pter > defined in package "o.a.c.m.optim.nonlinear.**scalar". > > HTH, > Gilles > > > > ------------------------------**------------------------------**--------- > To unsubscribe, e-mail: > user-unsubscribe@commons.**apache.org<user-unsubscr...@commons.apache.org> > For additional commands, e-mail: user-h...@commons.apache.org > >