MathGroup Archive 2011

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

Search the Archive

Re: Numerical optimization

  • To: mathgroup at
  • Subject: [mg120137] Re: Numerical optimization
  • From: Dana DeLouis <dana01 at>
  • Date: Sat, 9 Jul 2011 07:33:32 -0400 (EDT)

...Do[NMaximize[{f, "Constraints"}, {s, p1, p2}], {c2, 0, 1, 0.1}, {g, 0, 1, 0.1}]

Hi.  You may have a function f, but you didn't pass it any parameters.
For constraints, it looks like a string variable.
We want to constrain the changing cells.  The other two variables are fixed via the table function.
Let's do a simple linear function where the output is easily observed.


We want constraints that don't make the problem unbounded.
The constraints are for the 3 changing variables.

const = {0<=p1<=100,0<=p2<=100,0<=s<=100};



The output is easy to see for this simple example.
Adjust your function accordingly.

Lots of different options. 
Here's one idea that just looks at the value.



= = = = = = = = = =
HTH  : >)
Dana DeLouis
8.0 for Mac OS X x86 (64-bit) (November 6, 2010)

On Jul 8, 5:00 am, Equilib <pette... at> wrote:
> Hi all,
> I'm new to numerical optimization routines and since I get no results
> I worry that I may have made errors in my setup. I would like to
> maximize function f(p1,p2,s,c2,g) using the variables p1, p2, s. The
> parameters c2 and g are both in the interval (0,1). Hence I want a
> large matrix with solutions to the maximization problem for all
> combinations of c2 and g.
> I set it up as follows:
> Do[NMaximize[{f, "Constraints"}, {s, p1, p2}], {c2, 0, 1, 0.1}, {g, 0,
> 1, 0.1}]
> but get a page full of different error mesages and no output. Can
> anyone see the programming errors and maybe suggest an alternative
> route?
> Thanks a lot,
> Petter

  • Prev by Date: Re: sequence of functions
  • Next by Date: Re: How to write a "proper" math document
  • Previous by thread: Re: Numerical optimization
  • Next by thread: Re: Numerical optimization