From: Omega Zeng on
Hi,
I am having a problem minimization problem in Genetic Algorithm. Suppose I have two variables, one is the rows of Barrel (Nrows) and number of barrel in each row (NB); However, the NB is related to Nrows; see, like if I have only 5 Nrows (one input), the NB will have 5 numbers which corresponds to each row (5 inputs); if i have 10 Nrows (still 1 input), the NB will need 10 inputs. Is there a way to define this or how can I get around this ? The coding is below:


function [OIV,MaxRideDownGs] = DoSimDriver(Nrows,NB)

BarrelP0(j)=3000;
[OIV,MaxRideDownGs]=DoSimulation(Nrows,NB, BarrelP0)


Nrows and NB will pass to another function.

I appreciate the help.
From: Alan Weiss on
On 7/4/2010 4:01 PM, Omega Zeng wrote:
> Hi, I am having a problem minimization problem in Genetic Algorithm.
> Suppose I have two variables, one is the rows of Barrel (Nrows) and
> number of barrel in each row (NB); However, the NB is related to Nrows;
> see, like if I have only 5 Nrows (one input), the NB will have 5 numbers
> which corresponds to each row (5 inputs); if i have 10 Nrows (still 1
> input), the NB will need 10 inputs. Is there a way to define this or how
> can I get around this ? The coding is below:
>
> function [OIV,MaxRideDownGs] = DoSimDriver(Nrows,NB)
>
> BarrelP0(j)=3000;
> [OIV,MaxRideDownGs]=DoSimulation(Nrows,NB, BarrelP0)
>
>
> Nrows and NB will pass to another function.
>
> I appreciate the help.

I am not sure what you are trying to do. Have you looked at the sections
of the documentation related to writing fitness (objective) functions?
For basic syntax, see
http://www.mathworks.com/access/helpdesk/help/toolbox/gads/brdvu8r.html

For information on passing extra parameters, see
http://www.mathworks.com/access/helpdesk/help/toolbox/optim/ug/brhkghv-7.html

Alan Weiss
MATLAB mathematical toolbox documentation