From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Re: Optimization using Heaviside function
Date: Sun, 13 Jun 2010 20:25:04 +0000 (UTC)
Organization: The MathWorks, Inc.
Lines: 14
Message-ID: <hv3er0$nk2$>
References: <hv34vv$91u$> <hv37q2$psk$> <hv38rn$sfv$> <hv3clj$eua$>
Reply-To: <HIDDEN>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
X-Trace: 1276460704 24194 (13 Jun 2010 20:25:04 GMT)
NNTP-Posting-Date: Sun, 13 Jun 2010 20:25:04 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1187260
Xref: comp.soft-sys.matlab:644604

  (Ignoring the as yet unspecified Q0,) you have discontinuities along the x1 axis only at 0 and 5, and along the x2 axis at 0 and 19.  Define

 x1 = [0-1,(0+5)/2,5+1];
 x2 = [0-1,(0+19)/2,19+1];

Now evaluate Q-P-L at each of the nine combinations of values in x1 and x2.  That is, at

 [X1,X2] = meshgrid(x1,x2);

and select the maximum of these nine Q-P-L values.

  As long as your function consists only of constant rectangular regions as in the case you have described, this kind of procedure should be all that is necessary to find the maximum.  It is only when the total number of combined discontinuities are too large for practical computation that more heroic methods become necessary.

Roger Stafford