Path: news.mathworks.com!newsfeed-00.mathworks.com!nntp.TheWorld.com!news.mathforum.org!not-for-mail
From: SabbeRubbish <SabbeRubbish@gmail.com>
Newsgroups: comp.soft-sys.matlab
Subject: GA: extra parameters for fitness function
Date: Sat, 06 Dec 2008 13:13:32 EST
Organization: The Math Forum
Lines: 17
Message-ID: <32843526.1228587243063.JavaMail.jakarta@nitrogen.mathforum.org>
NNTP-Posting-Host: nitrogen.mathforum.org
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Trace: support1.mathforum.org 1228587243 3674 144.118.30.135 (6 Dec 2008 18:14:03 GMT)
X-Complaints-To: news@news.mathforum.org
NNTP-Posting-Date: Sat, 6 Dec 2008 18:14:03 +0000 (UTC)
Xref: news.mathworks.com comp.soft-sys.matlab:505383


Hi,
I'm new to the forums, I hope you can help me.
Is there any way to give ga (or gatool) an extra parameter/argument other than the variables to be optimized?

For example, I have a fitness function that calculates the contrast of an image.  I want to maximize the contrast of a grayscale image based on the color image, using the R, G and B factors as multipliers for the red, green and blue subimages respectively.

It works fine if I hardcode the image file into the fitness function, but I'd rather be able to parametrize like e.g.:

ga(@optimizeGrayscale(3, [], [], ones(3,3), [1 1 1], [0 0 0], [1 1 1], 'firstParam', 'fileName')

Where [] is A and b, ones(3,3) is Aeq, [1 1 1] is beq, [0 0 0] is LB and [1 1 1] is UB.

Is it possible to give an extra parameters when referencing functions like @function?

Thanks for any help.

SabbeRubbish