the main program is
% defining our search space
x = linspace(0,0.6,150);
y = linspace(0,0.6,150);
% creating a 2D mesh
[xx yy] = meshgrid(x,y);
% evaluating the stalagmite function
for i = 1:length(xx)
for j = 1:length(yy)
input_vector(1) = xx(i,j);
input_vector(2) = yy(i,j);
f(i,j) = stalagmite(input_vector);
endfor
endfor
surfc(xx, yy, f)
shading interp
[inputs, fval] = ga(@stalagmite(input_vector),2)
and the function used is.........................................................
function [output] = stalagmite(input_vector)
a = input_vector(1);
b = input_vector(2);
f1x = (sin(5.1*pi*a+0.5))^6;
f1y = (sin(5.1*pi*b+0.5))^6;
f2x = exp(-4*log(2)*(a-0.0667)^2/0.64);
f2y = exp(-4*log(2)*(b-0.0667)^2/0.64);
[output] = -[f1x*f2x*f1y*f2y];
endfunction
On Mon, May 13, 2019 at 1:40 AM Kai Torben Ohlhus <
address@hidden> wrote:
Sure, I am attaching the program till line 25 and also the function used in program. But I don't think there is a problem with the program as it has nothing to do with the ga package, I have used ga command only in line 25 after successfully running the program.
On Sat, 11 May, 2019, 10:50 PM Kai Torben Ohlhus, <
address@hidden> wrote:
I am using windows 10 operating system and ga package was installed by default from the octave 5.1 setup. I am attaching a photo of error.
On Thu, 9 May, 2019, 6:53 PM Kai Torben Ohlhus, <
address@hidden> wrote:
The genetic algorithm (ga) package available on website version 0.10.0 does not work anymore on octave 5.1. please update the package as soon as possible.
Thank you
Using Linux( openSUSE 15.0) I can still install the ga package with many warnings, but no errors. Admittedly, the code seems unmaintained in the past years (2012 was the last release). What is your operating system, how did you install Octave and the ga packge? Please, can you be more precise about what of the ga package is not working?
Best,
Kai
Please, can you keep the mailing list in the CC, so others may benefit from our discussion and answer at the bottom of the email (bottom posting [1]) to make it easier to follow the message thread.
Can you give a short example of "ga_stalagmite.m" up to line 25, which is not part of the ga package and triggers the bug? By just looking at the respective code lines of the error message, I cannot give any useful hints. Somehow non-integer indices are created in a situation like the following short example:
>> A = [1 2 3 4 5];
>> A(1/3)
error: A(0.333333): subscripts must be either integers 1 to (2^63)-1 or logicals
This should be avoided in your code.
HTH,
Kai
Can you attach some minimal, out-of-the-box running code to this mail thread. I am not willing to typewrite code from a screenshot -.-
Kai.
Thanks for the code. There are two problems: The first one is (probably a copy&past error) in your main program:
[inputs, fval] = ga(@stalagmite(input_vector),2)
The statement "@stalagmite(input_vector)" is evaluated to "-0.00036828", but the "ga" function expects a function handle. I think you want
[inputs, fval] = ga(@stalagmite,2)
The second problem is related to the "ga" package itself. It is simply not maintained and partially unfinished. Recently, Luca Favatella confirmed to no longer work on this code [1]. In particular the "exitflag" is not set (left as a TODO [2]).
If you care for the ga package, you are welcome to continue Luca Favatellas work on that package. But I am afraid you will not get far with the current state of the ga package with your intended use.
HTH,
Kai