Thread Subject: Parametric optimization using Genetic Algorithm

Subject: Parametric optimization using Genetic Algorithm

From: Luca Zanotti Fragonara

Date: 29 Sep, 2009 10:53:01

Message: 1 of 4

I'm trying to use ga to optimize a set of parameters. Usually I use fmincon, but I meet some problems of local minimum, so I want try to use the genetic algorithm to override the problem.

When I've used fmincon the syntax was the following:
par0S=zeros(152,1);
parminS=-ones(152,1);
parmaxS=ones(152,1);
Fob=fmincon(@myfun,par0S,[],[],[],[],parminS,parmaxS,[],opt,argin1,argin2,argin3)

where argin1,2,3 are parameters used by myfun to evaluate the Fob.

My objective function is of the form:
Fob=norm(abs(a)-abs(b),2);

I want to use ga, I'm trying to use it in the form:
Fob=ga(@myfun,152,[],[],[],[],parminS,parmaxS,[],opt,argin1,argin2,argin3)

but I receive an error of the following type: "To many input values".

Any suggestions?

Subject: Parametric optimization using Genetic Algorithm

From: Luca Zanotti Fragonara

Date: 29 Sep, 2009 16:03:03

Message: 2 of 4

Is there anyone who uses the genetic algorithm?

Subject: Parametric optimization using Genetic Algorithm

From: Marcelo Marazzi

Date: 30 Sep, 2009 21:34:24

Message: 3 of 4

Luca,

Passing additional arguments such as argin{1,2,3} in your example is an old MATLAB syntax that newer functions such as ga don't support any more.

Try using, for instance, anonymous functions.

Please see the doc:
http://www.mathworks.com/access/helpdesk/help/toolbox/optim/ug/brhkghv-7.html

-Marcelo

Luca Zanotti Fragonara wrote:
> I'm trying to use ga to optimize a set of parameters. Usually I use fmincon, but I meet some problems of local minimum, so I want try to use the genetic algorithm to override the problem.
>
> When I've used fmincon the syntax was the following:
> par0S=zeros(152,1);
> parminS=-ones(152,1);
> parmaxS=ones(152,1);
> Fob=fmincon(@myfun,par0S,[],[],[],[],parminS,parmaxS,[],opt,argin1,argin2,argin3)
>
> where argin1,2,3 are parameters used by myfun to evaluate the Fob.
>
> My objective function is of the form:
> Fob=norm(abs(a)-abs(b),2);
>
> I want to use ga, I'm trying to use it in the form:
> Fob=ga(@myfun,152,[],[],[],[],parminS,parmaxS,[],opt,argin1,argin2,argin3)
>
> but I receive an error of the following type: "To many input values".
>
> Any suggestions?

Subject: Parametric optimization using Genetic Algorithm

From: Luca Zanotti Fragonara

Date: 6 Oct, 2009 10:45:05

Message: 4 of 4

Thank you SO MUCH Marcelo, you've saved me!

Tags for this Thread

Everyone's Tags:

Add a New Tag:

Separated by commas
Ex.: root locus, bode

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Tag Activity for This Thread
Tag Applied By Date/Time
argin Luca Zanotti Fragonara 6 Oct, 2009 06:49:06
anonymous function Luca Zanotti Fragonara 6 Oct, 2009 06:49:06
ga Luca Zanotti Fragonara 29 Sep, 2009 06:54:03
fmincon Luca Zanotti Fragonara 29 Sep, 2009 06:54:03
genetic algorithm Luca Zanotti Fragonara 29 Sep, 2009 06:54:03
rssFeed for this Thread

Contact us at files@mathworks.com