help-octave
[Top][All Lists]

Re: Genetic algorithm pakage

 From: Aditya kumar Subject: Re: Genetic algorithm pakage Date: Mon, 13 May 2019 16:58:57 +0530

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)

[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:
On Sun, May 12, 2019 at 1:23 PM Aditya kumar <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:
On Sat, May 11, 2019 at 6:44 AM Aditya kumar <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:
On Wed, May 8, 2019 at 8:01 PM Aditya kumar <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.