Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.soft-sys.math.mathematica > #16576
| From | Bob Hanlon <hanlonr357@gmail.com> |
|---|---|
| Newsgroups | comp.soft-sys.math.mathematica |
| Subject | Re: Minimization problem |
| Date | 2014-02-19 06:44 +0000 |
| Message-ID | <le1jrr$rg2$1@smc.vnet.net> (permalink) |
| References | <20140218040434.F19BC69E6@smc.vnet.net> |
| Organization | Time-Warner Telecom |
Presumably there is a problem with your definition of f; however, since you
have not given an example of a simpler function which demonstrates your
problem, I can only guess.
var = {h1, h2, h3, h4};
cons = 0.1 < # <= 1 & /@ var;
f[{h1_?NumericQ, h2_?NumericQ,
h3_?NumericQ, h4_?NumericQ}] :=
Abs[-2 h1 + 7 h2 - 3 h3 + 8 h4 + 3];
sol = NMinimize[{f[var], cons}, var]
{1.45916*10^-9, {h1 -> 0.939012, h2 -> 0.1, h3 -> 0.959647, h4 -> 0.132121}}
sol[[1]] == f[var] /. sol[[2]]
True
Bob Hanlon
On Mon, Feb 17, 2014 at 11:04 PM, PAR123 <reiser.paul@gmail.com> wrote:
> I'm trying to minimize f[{h1,h2,h3,h4}] subject to constraints that all
> h's lie between 0.1 and 1. Trying to use NMinimize:
> NMinimize[{f[{h1, h2, h3, h4}], {h1 > 0.1, h1 <= 1.0, h2 > 0.1,
> h2 <= 1.0, h3 > 0.1, h3 <= 1.0, h4 > 0.1, h4 <= 1.0}}, {h1, h2, h3,
> h4}]
>
> I keep getting errors that indicate FindMinimum is attempting to call f[]
> with symbolic h's, not numbers. f[] will return a number if the inputs are
> numbers, but if they are symbols, its not going to happen. Is there a
> simple thing I am doing wrong?
>
>
Back to comp.soft-sys.math.mathematica | Previous | Next | Find similar
Re: Minimization problem Bob Hanlon <hanlonr357@gmail.com> - 2014-02-19 06:44 +0000
csiph-web