Constrained Optimization
- To: mathgroup at smc.vnet.net
- Subject: [mg57609] Constrained Optimization
- From: Caspar von Seckendorff <seckendorff at alphatec.de>
- Date: Thu, 2 Jun 2005 05:16:47 -0400 (EDT)
- Sender: owner-wri-mathgroup at wolfram.com
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] 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