Add a New Comment (Rich Markup)
Comment Type & Canned Response: None None > Multiple Canned Responses Fixed in development Crash with no stack trace Already fixed in newer version Fixed in stable Bad description Bad description and crash Bad stack trace Obsolete version Duplicate and not fixed Duplicate and needs more info Duplicate and fixed Need info and old
After I reported this bug, I spent more time to find out the available options. I am writing this note to document what I know now in case others experience the same issue later.
I always appreciate the packages kindly provided by Octave community. The only purpose of this note is to state my feedback/observations on ga package with the intention that this note might help to make the package more useful and benefit other people who share my needs.
Optimization algorithms in general can be categorized into methods require objective function derivatives and methods require only objective function.
One characteristics of non-derivative optimization algorithm is its ability to control numbers of function evaluations through population size and number of iterations/generation. For problems with expensive function evaluation, this approach may provide great relief. For my own purpose, lowing computation expense has always been a main focus point when I use Octave for more intensive computation. Global optimization and neural network are two examples.
To summarize, I have four main points: (1) Octave ga is capable of unconstrained optimization. It appears to me that the original author was aware of discrepancies of the ga syntax and the functionalities it actually provides. (2) There are other open source ga package/toolbox available. I eventually chose to use the one below due to its functionalities and documentation. It is for unconstrained optimization http://uos-codem.github.io/GA-Toolbox/ (3) Octave sqp illustrates an excellent formulation for constructing constrained optimization solution. I follow sqp's equation construction to build up constraints/bounds. (4) Penalty method is probably the most popular method for ga or pso to handle constraint violation. There are still many recent technical papers on this subject, which implies that no method is found to work universally. With very small modifications, the penalty formulation that works for me is found at https://github.com/sdnchen/psomatlab The conventional penalty form such as augmented lagrangian method did not help. Convergence checking for exiting also speeds up the solution.
Thanks,
I think the more correct ga options for the simple example below should be
ga_options = gaoptimset('Generations', 100, 'PopulationSize', 30, 'PopInitRange', [LB,UB], 'Vectorized', 'off');
Without any workaround, the output remains the same, x=0. Thanks.
Hi John, I would also recommend you to verify if other constraints are actually applied.
I place a brutal work around in _ga_problem_ near Line 80 to get around the issue. It is a wrong way to fix this UB/LB issue.
NextPopulation=min(max(NextPopulation, LB), UB);
looking at the code, it does look like lb and ub are not currently used anywhere
I use Octave 7.1.0 with ga 1.10.3 on windows 10 64x.
ga *| 0.10.3 | C:\Octave\Octave-7.1.0\mingw64\share\octave\packages\ga-0.10.3
The one variable simple problem below gave a wrong answer. x=0 is output. The correct result should be x=LB.
LB/UB appear to be ineffective. I have not found any document to indicate if there are limitations on ga function.
pkg load ga fun=@(x) x.^2 x0=1.75; LB=1; UB=2; ga_options = gaoptimset('Generations', 100, 'PopulationSize', 30, 'InitialPopulation', x0, 'Vectorized', 'off'); [x, fval, exitflag, output, population, scores] = ga (fitnessfcn=fun, nvars=1, A=[], b=[], Aeq=[], beq=[], LB, UB, nonlcon=[], ga_options);x % x = -1.9613e-11 or some other near zero values
(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)
Attach Files: Comment:
No files currently attached
Depends on the following items: None found
Items that depend on this one: None found
There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.
Only project members can vote.
Please enter the title of George Orwell's famous dystopian book (it's a date):
Follow 2 latest changes.
Copyright © 2023 Free Software Foundation, Inc. Verbatim copying and distribution of this entire article is permitted in any medium, provided this notice is preserved. The Levitating, Meditating, Flute-playing Gnu logo is a GNU GPL'ed image provided by the Nevrax Design Team. Source Code
Powered by Savane 3.9