MathGroup Archive 2005

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Constrained Optimization

Hi Caspar,
see below.
sincerely, Daniel

Caspar von Seckendorff wrote:
> Hi,
> I'd like to do constrained optimization with Mathematica 5.1 on a 
> function that is defined piecewise. Unfortunately Maximize[] does not 
> work  as I expected. A short & simple example to illustrate:
> f[x_,y_]:= (x-x^2) y
> Maximize[{f[x, y], 1/5 <= x <= 2/5, y > 0}, x]
Maximize is a numerical functions. Therefore, f[,] needs numeric input. 
However, y is so far a puer symbol and has no numerical value. If I 
understand your problem correctly, y is assumed to be a constant. But in 
this case the maximum value depends on the unspecified y.
Mathematica gives you a correct error message.
> As a result I get:
> "The objective function (x-x^2) y contains a nonconstant expression y 
> independent of variables {x}."
> Obviously for this Maximization, knowing that y > 0 I can do the 
> following to get the desired value for x:
> Maximize[{x-x^2, 1/5 <= x <= 2/5}, x]
> Out[]= {6/25, {x -> 2/5}}
> Is there a way to achieve this without manual intervention? The reason 
> is, that the functions I want to Maximize are defined Piecewise with 
> several constraints...
> Thanks,
> -Caspar

  • Prev by Date: Re: Constrained Optimization
  • Next by Date: Re: Constrained Optimization
  • Previous by thread: Re: Constrained Optimization
  • Next by thread: Re: Constrained Optimization