×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

optimisation using the ga function

optimisation using the ga function

optimisation using the ga function

(OP)
Hi,

I'm trying to use the 'ga' function to optimise a model and am having some difficulties in using the tool. Specifically, I've got the following questions:

1. How do I set the parameter ranges for ga optimisation? For example, I want the moving average length tested to be between 5 and 200 hundred data points.

2. How do I make sure that parameter takes only integer values?

3. How do I include external data into the ga optimisation objective function? The examples I looked through in the help files uses functions in the form y = f(x), which do not make explicit use of external data. For example, the objective function I'm looking for can look like x = objfunc(data, p1, p2), where data is not necessarily a single vector and p1 and p2 are the parameters to be determined by the ga. (Note that I'm unable to use the objective function in this manner using the ga ... the ga function assumes that data is also a parameter)

4. If the objective function has more than one output, e.g. [x,y]=objfunc(z), how to set the optimisation for only one of them, e.g. x?

Below is an example that I hope will make things clearer for what I'm trying to achieve:

load data.mat

[p fval] = ga(@model1, 3);

[r,s] = model1(data, p1, p2, p3)

Thanks a bunch,

E

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources